Forráskód Böngészése

保存公司服务端开发完成测试

吴学文 7 éve%!(EXTRA string=óta)
szülő
commit
1563709cf7

+ 33 - 0
Api/src/main/java/com/java110/api/listener/store/SaveStoreServiceListener.java

@@ -1,10 +1,12 @@
 package com.java110.api.listener.store;
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.java110.api.listener.AbstractServiceApiDataFlowListener;
 import com.java110.common.cache.MappingCache;
 import com.java110.common.constant.*;
 import com.java110.common.util.Assert;
+import com.java110.core.annotation.Java110Listener;
 import com.java110.core.context.DataFlowContext;
 import com.java110.entity.center.AppService;
 import com.java110.event.service.api.ServiceDataFlowEvent;
@@ -16,6 +18,7 @@ import org.springframework.http.HttpMethod;
  * 保存商户信息
  * Created by Administrator on 2019/3/29.
  */
+@Java110Listener("saveStoreServiceListener")
 public class SaveStoreServiceListener extends AbstractServiceApiDataFlowListener {
     @Override
     public int getOrder() {
@@ -134,6 +137,36 @@ public class SaveStoreServiceListener extends AbstractServiceApiDataFlowListener
             }
         }
 
+        if(paramObj.containsKey("businessStoreAttr")){
+            JSONArray attrs = paramObj.getJSONArray("businessStoreAttr");
+
+            for (int businessStoreAttrIndex = 0 ;businessStoreAttrIndex < attrs.size();businessStoreAttrIndex ++ ){
+                JSONObject attr = attrs.getJSONObject(businessStoreAttrIndex);
+                attr.put("storeId","-1");
+                attr.put("attrId","-"+(businessStoreAttrIndex+1));
+            }
+        }
+
+        if(paramObj.containsKey("businessStorePhoto")){
+            JSONArray photos = paramObj.getJSONArray("businessStorePhoto");
+
+            for (int businessStorePhotoIndex = 0 ;businessStorePhotoIndex < photos.size();businessStorePhotoIndex ++ ){
+                JSONObject attr = photos.getJSONObject(businessStorePhotoIndex);
+                attr.put("storeId","-1");
+                attr.put("storePhotoId","-"+(businessStorePhotoIndex+1));
+            }
+        }
+
+        if(paramObj.containsKey("businessStoreCerdentials")){
+            JSONArray cerdentials = paramObj.getJSONArray("businessStoreCerdentials");
+
+            for (int businessStoreCerdentialsIndex = 0 ;businessStoreCerdentialsIndex < cerdentials.size();businessStoreCerdentialsIndex ++ ){
+                JSONObject attr = cerdentials.getJSONObject(businessStoreCerdentialsIndex);
+                attr.put("storeId","-1");
+                attr.put("storeCerdentialsId","-"+(businessStoreCerdentialsIndex+1));
+            }
+        }
+
         return paramObj;
     }
 

+ 61 - 1
WebService/src/main/java/com/java110/web/smo/impl/CompanyServiceSMOImpl.java

@@ -1,6 +1,9 @@
 package com.java110.web.smo.impl;
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.java110.common.constant.AttrCdConstant;
+import com.java110.common.constant.CredentialsConstant;
 import com.java110.common.constant.ServiceConstant;
 import com.java110.common.util.Assert;
 import com.java110.core.context.IPageData;
@@ -12,6 +15,7 @@ import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Service;
 import org.springframework.web.client.RestTemplate;
+import springfox.documentation.spring.web.json.Json;
 
 /**
  * 初始化公司实现类
@@ -54,11 +58,67 @@ public class CompanyServiceSMOImpl extends BaseComponentSMO implements ICompanyS
         Assert.hasLength(pd.getUserId(),"用户还未登录请先登录");
 
         validateCompanyInfo(pd.getReqData());
-        responseEntity = this.callCenterService(restTemplate,pd,pd.getReqData(), ServiceConstant.SERVICE_API_URL+"/api/query.store.type?type=all", HttpMethod.POST);
+
+
+        JSONObject reqJson = JSONObject.parseObject("{\"businessStore\":{}}");
+
+        JSONObject paramJson = JSONObject.parseObject(pd.getReqData());
+
+        //基本信息
+        JSONObject businessStore = reqJson.getJSONObject("businessStore");
+        businessStore.put("userId",pd.getUserId());
+        businessStore.put("name",paramJson.getString("name"));
+        businessStore.put("address",paramJson.getString("address"));
+        businessStore.put("tel",paramJson.getString("tel"));
+        businessStore.put("storeTypeCd",paramJson.getString("storeTypeCd"));
+        businessStore.put("nearbyLandmarks",paramJson.getString("nearbyLandmarks"));
+
+        JSONArray businessStoreAttr = new JSONArray();
+
+        JSONObject attr = new JSONObject();
+        attr.put("specCd", AttrCdConstant.SPEC_CD_STORE_CORPORATION);
+        attr.put("value",paramJson.getString("corporation"));
+        businessStoreAttr.add(attr);
+
+         attr = new JSONObject();
+        attr.put("specCd", AttrCdConstant.SPEC_CD_STORE_REGISTEREDCAPITAL);
+        attr.put("value",paramJson.getString("registeredCapital"));
+        businessStoreAttr.add(attr);
+
+         attr = new JSONObject();
+        attr.put("specCd", AttrCdConstant.SPEC_CD_STORE_FOUNDINGTIME);
+        attr.put("value",paramJson.getString("foundingTime"));
+        businessStoreAttr.add(attr);
+
+        attr = new JSONObject();
+        attr.put("specCd", AttrCdConstant.SPEC_CD_STORE_REGISTRATIONAUTHORITY);
+        attr.put("value",paramJson.getString("registrationAuthority"));
+        businessStoreAttr.add(attr);
+
+        attr = new JSONObject();
+        attr.put("specCd", AttrCdConstant.SPEC_CD_STORE_SCOPE);
+        attr.put("value",paramJson.getString("scope"));
+        businessStoreAttr.add(attr);
+        reqJson.put("businessStoreAttr",businessStoreAttr);
+
+        JSONArray businessStoreCerdentials = new JSONArray();
+        JSONObject cerdentials = new JSONObject();
+
+        cerdentials.put("credentialsCd", CredentialsConstant.LICENCE);
+        cerdentials.put("value",paramJson.getString("value"));
+        cerdentials.put("validityPeriod",paramJson.getString("validityPeriod"));
+        cerdentials.put("positivePhoto","");
+        cerdentials.put("negativePhoto","");
+        businessStoreCerdentials.add(cerdentials);
+
+        reqJson.put("businessStoreCerdentials",businessStoreCerdentials);
+
+        responseEntity = this.callCenterService(restTemplate,pd,reqJson.toJSONString(), ServiceConstant.SERVICE_API_URL+"/api/save.store.info", HttpMethod.POST);
 
         return responseEntity;
     }
 
+
     /**
      * 校验公司信息
      * @param param

+ 8 - 0
java110-common/src/main/java/com/java110/common/constant/AttrCdConstant.java

@@ -19,6 +19,14 @@ public class AttrCdConstant {
 
 
 
+    public final static String SPEC_CD_STORE_CORPORATION = "100201903001";// 法人
+    public final static String SPEC_CD_STORE_REGISTEREDCAPITAL = "100201903002";// 注册资本
+    public final static String SPEC_CD_STORE_FOUNDINGTIME = "100201903003";// 成立日期
+    public final static String SPEC_CD_STORE_REGISTRATIONAUTHORITY = "100201903004";// 登记机关
+    public final static String SPEC_CD_STORE_SCOPE = "100201903005";// 经营范围
+
+
+
 
 
 

+ 12 - 0
java110-common/src/main/java/com/java110/common/constant/CredentialsConstant.java

@@ -0,0 +1,12 @@
+package com.java110.common.constant;
+
+/**
+ * 证件常量类
+ */
+public class CredentialsConstant {
+
+    /**
+     * 营业执照
+     */
+    public final static String LICENCE ="300200900001";
+}