wuxw лет назад: 6
Родитель
Сommit
5fb8a58f6d

+ 18 - 181
Api/src/main/java/com/java110/api/listener/owner/AppUserBindingOwnerListener.java

@@ -7,7 +7,9 @@ import com.java110.api.listener.AbstractServiceApiListener;
 import com.java110.core.annotation.Java110Listener;
 import com.java110.core.annotation.Java110Listener;
 import com.java110.core.context.DataFlowContext;
 import com.java110.core.context.DataFlowContext;
 import com.java110.core.factory.GenerateCodeFactory;
 import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.core.smo.community.ICommunityInnerServiceSMO;
 import com.java110.core.smo.file.IFileInnerServiceSMO;
 import com.java110.core.smo.file.IFileInnerServiceSMO;
+import com.java110.dto.community.CommunityDto;
 import com.java110.dto.file.FileDto;
 import com.java110.dto.file.FileDto;
 import com.java110.entity.center.AppService;
 import com.java110.entity.center.AppService;
 import com.java110.event.service.api.ServiceDataFlowEvent;
 import com.java110.event.service.api.ServiceDataFlowEvent;
@@ -41,6 +43,9 @@ public class AppUserBindingOwnerListener extends AbstractServiceApiListener {
     @Autowired
     @Autowired
     private IFileInnerServiceSMO fileInnerServiceSMOImpl;
     private IFileInnerServiceSMO fileInnerServiceSMOImpl;
 
 
+    @Autowired
+    private ICommunityInnerServiceSMO communityInnerServiceSMOImpl;
+
     private static Logger logger = LoggerFactory.getLogger(AppUserBindingOwnerListener.class);
     private static Logger logger = LoggerFactory.getLogger(AppUserBindingOwnerListener.class);
 
 
     @Override
     @Override
@@ -56,7 +61,7 @@ public class AppUserBindingOwnerListener extends AbstractServiceApiListener {
     @Override
     @Override
     protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
     protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
         Assert.hasKeyAndValue(reqJson, "communityName", "未包含小区名称");
         Assert.hasKeyAndValue(reqJson, "communityName", "未包含小区名称");
-        Assert.hasKeyAndValue(reqJson, "areaCode", "未包含小区名称");
+        Assert.hasKeyAndValue(reqJson, "areaCode", "未包含小区地区");
         Assert.hasKeyAndValue(reqJson, "appUserName", "未包含用户名称");
         Assert.hasKeyAndValue(reqJson, "appUserName", "未包含用户名称");
         Assert.hasKeyAndValue(reqJson, "idCard", "未包含身份证号");
         Assert.hasKeyAndValue(reqJson, "idCard", "未包含身份证号");
         Assert.hasKeyAndValue(reqJson, "link", "未包含联系电话");
         Assert.hasKeyAndValue(reqJson, "link", "未包含联系电话");
@@ -68,189 +73,12 @@ public class AppUserBindingOwnerListener extends AbstractServiceApiListener {
         logger.debug("ServiceDataFlowEvent : {}", event);
         logger.debug("ServiceDataFlowEvent : {}", event);
 
 
         //查询小区是否存在
         //查询小区是否存在
-    }
-
-    /**
-     * 生成小区楼ID
-     *
-     * @param paramObj 请求入参数据
-     */
-    private void generateMemberId(JSONObject paramObj) {
-        String memberId = GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_ownerId);
-        paramObj.put("memberId", memberId);
-        if (!paramObj.containsKey("ownerId") || "1001".equals(paramObj.getString("ownerTypeCd"))) {
-            paramObj.put("ownerId", memberId);
-        }
-    }
-
-
-    /**
-     * 添加小区楼信息
-     * <p>
-     * * name:'',
-     * *                 age:'',
-     * *                 link:'',
-     * *                 sex:'',
-     * *                 remark:''
-     *
-     * @param paramInJson 接口调用放传入入参
-     * @return 订单服务能够接受的报文
-     */
-    private JSONObject addOwner(JSONObject paramInJson) {
-
-
-        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
-        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_OWNER_INFO);
-        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ);
-        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
-        JSONObject businessOwner = new JSONObject();
-        businessOwner.putAll(paramInJson);
-        businessOwner.put("state", "2000");
-        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessOwner", businessOwner);
-
-        return business;
-    }
-
-
-    /**
-     * 添加小区成员
-     *
-     * @param paramInJson 组装 楼小区关系
-     * @return 小区成员信息
-     */
-    private JSONObject addCommunityMember(JSONObject paramInJson) {
-
-
-        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
-        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_MEMBER_JOINED_COMMUNITY);
-        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ_COMMUNITY_MEMBER);
-        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
-        JSONObject businessCommunityMember = new JSONObject();
-        businessCommunityMember.put("communityMemberId", "-1");
-        businessCommunityMember.put("communityId", paramInJson.getString("communityId"));
-        businessCommunityMember.put("memberId", paramInJson.getString("ownerId"));
-        businessCommunityMember.put("memberTypeCd", CommunityMemberTypeConstant.OWNER);
-        businessCommunityMember.put("auditStatusCd", StateConstant.AGREE_AUDIT);
-        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessCommunityMember", businessCommunityMember);
-
-        return business;
-    }
-
-
-    /**
-     * 售卖房屋信息
-     *
-     * @param paramInJson     接口调用放传入入参
-     * @param dataFlowContext 数据上下文
-     * @return 订单服务能够接受的报文
-     */
-    private JSONObject sellRoom(JSONObject paramInJson, DataFlowContext dataFlowContext) {
-
-
-        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
-        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_OWNER_ROOM_REL);
-        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ);
-        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
-        JSONObject businessUnit = new JSONObject();
-        businessUnit.putAll(paramInJson);
-        businessUnit.put("relId", "-1");
-        businessUnit.put("userId", dataFlowContext.getRequestCurrentHeaders().get(CommonConstant.HTTP_USER_ID));
-        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessOwnerRoomRel", businessUnit);
-
-        return business;
-    }
-
-    /**
-     * 添加物业费用
-     *
-     * @param paramInJson     接口调用放传入入参
-     * @param dataFlowContext 数据上下文
-     * @return 订单服务能够接受的报文
-     */
-    private JSONObject addPropertyFee(JSONObject paramInJson, DataFlowContext dataFlowContext) {
-
-
-        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
-        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_FEE_INFO);
-        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ + 1);
-        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
-        JSONObject businessUnit = new JSONObject();
-        businessUnit.put("feeId", "-1");
-        businessUnit.put("feeTypeCd", FeeTypeConstant.FEE_TYPE_PROPERTY);
-        businessUnit.put("incomeObjId", paramInJson.getString("storeId"));
-        businessUnit.put("amount", "-1.00");
-        businessUnit.put("startTime", DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));
-        businessUnit.put("endTime", DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));
-        businessUnit.put("communityId", paramInJson.getString("communityId"));
-        businessUnit.put("payerObjId", paramInJson.getString("roomId"));
-        businessUnit.put("userId", dataFlowContext.getRequestCurrentHeaders().get(CommonConstant.HTTP_USER_ID));
-        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessFee", businessUnit);
-
-        return business;
-    }
-
-    /**
-     * 添加物业费用
-     *
-     * @param paramInJson     接口调用放传入入参
-     * @param dataFlowContext 数据上下文
-     * @return 订单服务能够接受的报文
-     */
-    private JSONObject addOwnerPhoto(JSONObject paramInJson, DataFlowContext dataFlowContext) {
-
-
-        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
-        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_FILE_REL);
-        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ + 2);
-        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
-        JSONObject businessUnit = new JSONObject();
-        businessUnit.put("fileRelId", "-1");
-        businessUnit.put("relTypeCd", "10000");
-        businessUnit.put("saveWay", "table");
-        businessUnit.put("objId", paramInJson.getString("memberId"));
-        businessUnit.put("fileRealName", paramInJson.getString("ownerPhotoId"));
-        businessUnit.put("fileSaveName", paramInJson.getString("ownerPhotoId"));
-        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessFileRel", businessUnit);
-
-        return business;
+        CommunityDto communityDto = new CommunityDto();
+        //communityInnerServiceSMOImpl.queryCommunitys();
+        //
     }
     }
 
 
 
 
-    /**
-     * 数据校验
-     * <p>
-     * name:'',
-     * age:'',
-     * link:'',
-     * sex:'',
-     * remark:''
-     *
-     * @param paramIn "communityId": "7020181217000001",
-     *                "memberId": "3456789",
-     *                "memberTypeCd": "390001200001"
-     */
-    private void validate(String paramIn) {
-        Assert.jsonObjectHaveKey(paramIn, "name", "请求报文中未包含name");
-        Assert.jsonObjectHaveKey(paramIn, "userId", "请求报文中未包含userId");
-        Assert.jsonObjectHaveKey(paramIn, "age", "请求报文中未包含age");
-        Assert.jsonObjectHaveKey(paramIn, "link", "请求报文中未包含link");
-        Assert.jsonObjectHaveKey(paramIn, "sex", "请求报文中未包含sex");
-        Assert.jsonObjectHaveKey(paramIn, "ownerTypeCd", "请求报文中未包含类型");
-        Assert.jsonObjectHaveKey(paramIn, "communityId", "请求报文中未包含communityId");
-        //Assert.jsonObjectHaveKey(paramIn, "idCard", "请求报文中未包含身份证号");
-
-        JSONObject paramObj = JSONObject.parseObject(paramIn);
-
-        if (paramObj.containsKey("roomId")) {
-
-            Assert.jsonObjectHaveKey(paramObj, "state", "请求报文中未包含state节点");
-            Assert.jsonObjectHaveKey(paramObj, "storeId", "请求报文中未包含storeId节点");
-
-            Assert.hasLength(paramObj.getString("roomId"), "roomId不能为空");
-            Assert.hasLength(paramObj.getString("state"), "state不能为空");
-            Assert.hasLength(paramObj.getString("storeId"), "storeId不能为空");
-        }
-    }
 
 
 
 
     @Override
     @Override
@@ -266,4 +94,13 @@ public class AppUserBindingOwnerListener extends AbstractServiceApiListener {
     public void setFileInnerServiceSMOImpl(IFileInnerServiceSMO fileInnerServiceSMOImpl) {
     public void setFileInnerServiceSMOImpl(IFileInnerServiceSMO fileInnerServiceSMOImpl) {
         this.fileInnerServiceSMOImpl = fileInnerServiceSMOImpl;
         this.fileInnerServiceSMOImpl = fileInnerServiceSMOImpl;
     }
     }
+
+
+    public ICommunityInnerServiceSMO getCommunityInnerServiceSMOImpl() {
+        return communityInnerServiceSMOImpl;
+    }
+
+    public void setCommunityInnerServiceSMOImpl(ICommunityInnerServiceSMO communityInnerServiceSMOImpl) {
+        this.communityInnerServiceSMOImpl = communityInnerServiceSMOImpl;
+    }
 }
 }

+ 94 - 0
Api/src/main/java/com/java110/api/rest/GetPhotoByInst.java

@@ -0,0 +1,94 @@
+package com.java110.api.rest;
+
+import org.apache.commons.io.FileUtils;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.util.StringUtils;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.net.URL;
+
+/**
+ * @ClassName GetPhotoByInst
+ * @Description TODO
+ * @Author wuxw
+ * @Date 2019/8/28 22:49
+ * @Version 1.0
+ * add by wuxw 2019/8/28
+ **/
+public class GetPhotoByInst {
+
+    final static String PHOTO_INFO_PATH= "photoInfo.txt";
+    final static String DEFAULTE_PHOTO_DIR= "./Api/photos/";
+
+    public static void main(String[] args) {
+        //读取文件
+        Reader reader = null;
+        String sb = "";
+        try {
+            InputStream inputStream = new ClassPathResource(PHOTO_INFO_PATH).getInputStream();
+            //InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(File.separator + filePath);
+            reader = new InputStreamReader(inputStream, "UTF-8");
+            int tempChar;
+            StringBuffer b = new StringBuffer();
+            while ((tempChar = reader.read()) != -1) {
+                b.append((char) tempChar);
+            }
+            sb = b.toString();
+
+            String[] strs = sb.split("\n");
+
+            for(String str : strs){
+                dealPhoto(str);
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        } finally {
+            if (reader != null) {
+                try {
+                    reader.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+    }
+
+    private static void dealPhoto(String str) {
+
+        String[] tmpPhotoPaths = str.split("\\|");
+
+        String instId = tmpPhotoPaths[0];
+        String photoUrl = tmpPhotoPaths[1];
+
+        downloadFromUrl(photoUrl,DEFAULTE_PHOTO_DIR,"qhdx_"+instId+"_17.jpg");
+        //downloadFromUrl(photoUrl,DEFAULTE_PHOTO_DIR,instId+".jpg");
+    }
+
+
+    /**
+     * 文件下载的方法
+     * @param  url 地址
+     * @param  dir 目录
+     * @return String fileName
+     */
+    public static String downloadFromUrl(String url, String dir,String fileName) {
+
+        try {
+            URL httpurl = new URL(url);
+            //	fileName = getFileNameFromUrl(url);
+            //String[] us=url.split("/");
+            //fileName=us[us.length-1];
+            System.out.println("fileName:"+fileName);
+            File f = new File(dir + fileName);
+            FileUtils.copyURLToFile(httpurl, f);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return "Fault!";
+        }
+        return fileName;
+    }
+}

+ 0 - 4
UserService/src/main/java/com/java110/user/smo/impl/OrgInnerServiceSMOImpl.java

@@ -5,9 +5,7 @@ import com.java110.core.base.smo.BaseServiceSMO;
 import com.java110.core.smo.community.ICommunityInnerServiceSMO;
 import com.java110.core.smo.community.ICommunityInnerServiceSMO;
 import com.java110.core.smo.org.IOrgInnerServiceSMO;
 import com.java110.core.smo.org.IOrgInnerServiceSMO;
 import com.java110.core.smo.user.IUserInnerServiceSMO;
 import com.java110.core.smo.user.IUserInnerServiceSMO;
-import com.java110.dto.OwnerDto;
 import com.java110.dto.PageDto;
 import com.java110.dto.PageDto;
-import com.java110.dto.UserDto;
 import com.java110.dto.community.CommunityDto;
 import com.java110.dto.community.CommunityDto;
 import com.java110.dto.org.OrgDto;
 import com.java110.dto.org.OrgDto;
 import com.java110.user.dao.IOrgServiceDao;
 import com.java110.user.dao.IOrgServiceDao;
@@ -15,8 +13,6 @@ import com.java110.utils.util.BeanConvertUtil;
 import com.java110.utils.util.StringUtil;
 import com.java110.utils.util.StringUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
 
 
 import java.util.ArrayList;
 import java.util.ArrayList;