Przeglądaj źródła

修改对接 token

wuxw 6 lat temu
rodzic
commit
8ff4edca6e

+ 1 - 3
Api/src/main/java/com/java110/api/ApiApplicationStart.java

@@ -40,10 +40,8 @@ import java.nio.charset.Charset;
  * @date 2016年8月6日
  * @tag
  */
-@SpringBootApplication(scanBasePackages = {"com.java110.service.aop",
+@SpringBootApplication(scanBasePackages = {
         "com.java110.service.configuration",
-        "com.java110.service.controller",
-        "com.java110.service.filter",
         "com.java110.service.init",
         "com.java110.api",
         "com.java110.core",

+ 91 - 3
Api/src/main/java/com/java110/api/listener/owner/AppUserBindingOwnerListener.java

@@ -9,8 +9,11 @@ import com.java110.core.context.DataFlowContext;
 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.owner.IOwnerAppUserInnerServiceSMO;
+import com.java110.core.smo.owner.IOwnerInnerServiceSMO;
 import com.java110.dto.community.CommunityDto;
 import com.java110.dto.file.FileDto;
+import com.java110.dto.owner.OwnerDto;
 import com.java110.entity.center.AppService;
 import com.java110.event.service.api.ServiceDataFlowEvent;
 import com.java110.utils.constant.*;
@@ -25,6 +28,8 @@ import org.springframework.http.HttpHeaders;
 import org.springframework.http.HttpMethod;
 import org.springframework.http.ResponseEntity;
 
+import java.util.List;
+
 /**
  * @ClassName AppUserBindingOwnerListener
  * @Description app用户绑定业主接口
@@ -46,6 +51,12 @@ public class AppUserBindingOwnerListener extends AbstractServiceApiListener {
     @Autowired
     private ICommunityInnerServiceSMO communityInnerServiceSMOImpl;
 
+    @Autowired
+    private IOwnerInnerServiceSMO ownerInnerServiceSMOImpl;
+
+    @Autowired
+    private IOwnerAppUserInnerServiceSMO ownerAppUserInnerServiceSMOImpl;
+
     private static Logger logger = LoggerFactory.getLogger(AppUserBindingOwnerListener.class);
 
     @Override
@@ -72,13 +83,81 @@ public class AppUserBindingOwnerListener extends AbstractServiceApiListener {
 
         logger.debug("ServiceDataFlowEvent : {}", event);
 
+
+
+
         //查询小区是否存在
         CommunityDto communityDto = new CommunityDto();
-        //communityInnerServiceSMOImpl.queryCommunitys();
-        //
-    }
+        communityDto.setCityCode(reqJson.getString("areaCode"));
+        communityDto.setName(reqJson.getString("communityName"));
+        communityDto.setState("1100");
+        List<CommunityDto> communityDtos = communityInnerServiceSMOImpl.queryCommunitys(communityDto);
+
+        Assert.listOnlyOne(communityDtos, "填写小区信息错误");
+
+        CommunityDto tmpCommunityDto = communityDtos.get(0);
+
+        OwnerDto ownerDto = new OwnerDto();
+        ownerDto.setCommunityId(tmpCommunityDto.getCommunityId());
+        ownerDto.setIdCard(reqJson.getString("idCard"));
+        ownerDto.setName(reqJson.getString("appUserName"));
+        ownerDto.setLink(reqJson.getString("link"));
+        List<OwnerDto> ownerDtos = ownerInnerServiceSMOImpl.queryOwnerMembers(ownerDto);
+
+        Assert.listOnlyOne(ownerDtos, "填写业主信息错误");
+
+        OwnerDto tmpOwnerDto = ownerDtos.get(0);
 
+        DataFlowContext dataFlowContext = event.getDataFlowContext();
+        AppService service = event.getAppService();
+        String paramIn = dataFlowContext.getReqData();
+        JSONObject paramObj = JSONObject.parseObject(paramIn);
+        HttpHeaders header = new HttpHeaders();
+        dataFlowContext.getRequestCurrentHeaders().put(CommonConstant.HTTP_ORDER_TYPE_CD, "D");
+        JSONArray businesses = new JSONArray();
+        //添加小区楼
+        businesses.add(addOwnerAppUser(paramObj, tmpCommunityDto, tmpOwnerDto));
 
+        JSONObject paramInObj = super.restToCenterProtocol(businesses, dataFlowContext.getRequestCurrentHeaders());
+
+        //将 rest header 信息传递到下层服务中去
+        super.freshHttpHeader(header, dataFlowContext.getRequestCurrentHeaders());
+
+
+        ResponseEntity<String> responseEntity = this.callService(dataFlowContext, service.getServiceCode(), paramInObj);
+
+        dataFlowContext.setResponseEntity(responseEntity);
+
+    }
+
+    /**
+     * 添加业主应用用户关系
+     *
+     * @param paramInJson
+     * @return
+     */
+    private JSONObject addOwnerAppUser(JSONObject paramInJson, CommunityDto communityDto, OwnerDto ownerDto) {
+
+
+        JSONObject business = JSONObject.parseObject("{\"datas\":{}}");
+        business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_OWNER_APP_USER);
+        business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ);
+        business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
+        JSONObject businessOwnerAppUser = new JSONObject();
+        businessOwnerAppUser.putAll(paramInJson);
+        //状态类型,10000 审核中,12000 审核成功,13000 审核失败
+        businessOwnerAppUser.put("state", "10000");
+        businessOwnerAppUser.put("appTypeCd", "10010");
+        businessOwnerAppUser.put("appUserId", "-1");
+        businessOwnerAppUser.put("memberId", ownerDto.getMemberId());
+        businessOwnerAppUser.put("communityName", communityDto.getName());
+        businessOwnerAppUser.put("communityId", communityDto.getCommunityId());
+        businessOwnerAppUser.put("appUserName", ownerDto.getName());
+        businessOwnerAppUser.put("idCard", ownerDto.getIdCard());
+        businessOwnerAppUser.put("link",ownerDto.getLink());
+        business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessOwnerAppUser", businessOwnerAppUser);
+        return business;
+    }
 
 
     @Override
@@ -103,4 +182,13 @@ public class AppUserBindingOwnerListener extends AbstractServiceApiListener {
     public void setCommunityInnerServiceSMOImpl(ICommunityInnerServiceSMO communityInnerServiceSMOImpl) {
         this.communityInnerServiceSMOImpl = communityInnerServiceSMOImpl;
     }
+
+
+    public IOwnerInnerServiceSMO getOwnerInnerServiceSMOImpl() {
+        return ownerInnerServiceSMOImpl;
+    }
+
+    public void setOwnerInnerServiceSMOImpl(IOwnerInnerServiceSMO ownerInnerServiceSMOImpl) {
+        this.ownerInnerServiceSMOImpl = ownerInnerServiceSMOImpl;
+    }
 }

+ 2 - 3
AppFrontService/src/main/java/com/java110/app/AppFrontServiceApplicationStart.java

@@ -27,10 +27,9 @@ import java.nio.charset.Charset;
  * @date 2016年8月6日
  * @tag
  */
-@SpringBootApplication(scanBasePackages = {"com.java110.service.aop",
+@SpringBootApplication(scanBasePackages = {"com.java110.front.aop",
         "com.java110.service.configuration",
-        "com.java110.service.controller",
-        "com.java110.service.filter",
+        "com.java110.front.filter",
         "com.java110.service.init",
         "com.java110.app",
         "com.java110.core",

+ 0 - 19
AppFrontService/src/main/java/com/java110/app/smo/wxLogin/impl/WxLoginSMOImpl.java

@@ -101,25 +101,6 @@ public class WxLoginSMOImpl extends AppAbstractComponentSMO implements IWxLoginS
             Assert.hasLength(userDefaultPassword, "映射表中未设置员工默认密码,请检查" + MappingConstant.KEY_STAFF_DEFAULT_PASSWORD);
             userDefaultPassword = AuthenticationFactory.passwdMd5(userDefaultPassword);
 
-            /**
-             * {
-             *      "userId": "-1",
-             *      "name": "张三",
-             *      "email": "928255095@qq.com",
-             *      "address": "青海省西宁市城中区129号",
-             *      "password": "ERCBHDUYFJDNDHDJDNDJDHDUDHDJDDKDK",
-             *      "locationCd": "001",
-             *      "age": 19,
-             *      "sex": "0",
-             *      "tel": "17797173943",
-             *      "level_cd": "1",
-             *      "businessUserAttr": [{
-             *      "attrId":"-1",
-             *      "specCd":"1001",
-             *      "value":"01"
-             *      }]
-             *      }
-             */
             registerInfo.put("userId", "-1");
             registerInfo.put("email", "");
             registerInfo.put("address", userInfo.getString("country") + userInfo.getString("province") + userInfo.getString("city"));

+ 2 - 3
WebService/src/main/java/com/java110/web/WebServiceApplicationStart.java

@@ -27,10 +27,9 @@ import java.nio.charset.Charset;
  * @date 2016年8月6日
  * @tag
  */
-@SpringBootApplication(scanBasePackages = {"com.java110.service.aop",
+@SpringBootApplication(scanBasePackages = {"com.java110.front.aop",
         "com.java110.service.configuration",
-        "com.java110.service.controller",
-        "com.java110.service.filter",
+        "com.java110.front.filter",
         "com.java110.service.init",
         "com.java110.web",
         "com.java110.core",

+ 1 - 1
java110-service/src/main/java/com/java110/service/aop/PageProcessAspect.java

@@ -1,4 +1,4 @@
-package com.java110.service.aop;
+package com.java110.front.aop;
 
 import com.alibaba.fastjson.JSONObject;
 import com.java110.utils.constant.CommonConstant;

+ 5 - 3
java110-service/src/main/java/com/java110/service/configuration/ServiceConfiguration.java

@@ -1,6 +1,6 @@
-package com.java110.service.configuration;
+package com.java110.front.configuration;
 
-import com.java110.service.filter.JwtFilter;
+import com.java110.front.filter.JwtFilter;
 import org.springframework.boot.web.servlet.FilterRegistrationBean;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
@@ -21,12 +21,14 @@ public class ServiceConfiguration {
         exclusions.append("/flow/register,");
         exclusions.append("/flow/advertVedioFlow,");//放开 广告页面是不需要登录的
         exclusions.append("/callComponent/advertVedioView/*,");//放开 广告页面是不需要登录的
-        exclusions.append("/callComponent/download/getFile/file");//放开 下载图片也不需要登录
+        exclusions.append("/callComponent/download/getFile/file,");//放开 下载图片也不需要登录
+        exclusions.append("/app/loginWx");// 登录跳过
         final FilterRegistrationBean registrationBean = new FilterRegistrationBean();
         registrationBean.setFilter(new JwtFilter());
         registrationBean.addUrlPatterns("/");
         registrationBean.addUrlPatterns("/callComponent/*");
         registrationBean.addUrlPatterns("/flow/*");
+        registrationBean.addUrlPatterns("/app/*");
         registrationBean.addInitParameter("excludedUri",exclusions.toString());
 
         return registrationBean;

+ 1 - 1
java110-service/src/main/java/com/java110/service/controller/SystemErrorController.java

@@ -1,4 +1,4 @@
-package com.java110.service.controller;
+package com.java110.front.controller;
 
 import com.java110.utils.constant.ResponseConstant;
 import com.java110.utils.util.StringUtil;

+ 1 - 1
java110-service/src/main/java/com/java110/service/filter/JwtFilter.java

@@ -1,4 +1,4 @@
-package com.java110.service.filter;
+package com.java110.front.filter;
 
 import com.java110.utils.constant.CommonConstant;
 import com.java110.utils.constant.ResponseConstant;