diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java index 82c6875518..52b8fce60b 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java @@ -221,8 +221,6 @@ public class PublicUserLoginServiceImpl implements PublicUserLoginService { //2.用户不存在时不允许登陆 Map map1 = (Map)jsonObject.get("paUserResult"); PaUserDTO userDTO = ConvertUtils.mapToEntity(map1, PaUserDTO.class); - logger.info("map1的值:"+map1); - logger.info("userDTO的值:"+userDTO); if (null == userDTO || StringUtils.isBlank(userDTO.getId())) { throw new RenException(EpmetErrorCode.PUBLIC_NOT_EXISTS.getCode()); } @@ -240,7 +238,6 @@ public class PublicUserLoginServiceImpl implements PublicUserLoginService { String token = this.generateGovWxmpToken(userDTO.getId()); //4-2.判断是否存在信息,给customerId赋值 Map map2 = (Map)jsonObject.get("paCustomerResult"); - logger.info("map2的值:"+map2); PaCustomerDTO customerDTO = ConvertUtils.mapToEntity(map2, PaCustomerDTO.class); String customerId = ""; if (null != customerDTO && !StringUtils.isBlank(customerDTO.getId())) { @@ -248,7 +245,6 @@ public class PublicUserLoginServiceImpl implements PublicUserLoginService { } //4-3.token存入redis Map map3 = (Map)jsonObject.get("paUserWechatResult"); - logger.info("map3的值:"+map3); PaUserWechatDTO wechatDTO = ConvertUtils.mapToEntity(map3, PaUserWechatDTO.class); String openid = wechatDTO.getWxOpenId(); String unionId = (null == wechatDTO.getUnionId() ? "" : wechatDTO.getUnionId()); @@ -283,16 +279,13 @@ public class PublicUserLoginServiceImpl implements PublicUserLoginService { public UserTokenResultDTO register(RegisterFormDTO formDTO) { //1.调用epmet-third服务,完成信息注册 String data = HttpClientManager.getInstance().sendPostByJSON(AuthHttpUrlConstant.REGISTER_URL, JSON.toJSONString(formDTO)).getData(); - logger.info("data数据为:"+data); JSONObject toResult = JSON.parseObject(data); Result result = ConvertUtils.mapToEntity(toResult, Result.class); - logger.info("转换的result结果为:"+result); if (!result.success()) { logger.error(String.format("调用epmet_third服务初始化用户信息失败,数据来源[%s],手机号[%s],userId:[%S]", formDTO.getSource(), formDTO.getPhone(), formDTO.getUserId())); throw new RenException(result.getCode()); } Object RegisterResult = result.getData(); - logger.info("getData()数据为:"+RegisterResult); JSONObject jsonObject = JSON.parseObject(RegisterResult.toString()); RegisterResultDTO resultDTO = ConvertUtils.mapToEntity(jsonObject, RegisterResultDTO.class); diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ModuleConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ModuleConstant.java index bbe5ac73b9..bdf4ea37bb 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ModuleConstant.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ModuleConstant.java @@ -91,6 +91,9 @@ public interface ModuleConstant { String FROM_CALLBACK = "from_callback"; String APPLICATION_JSON = "application/json"; String _FROM_API = "_from_api"; + String WE_APP_AUDIT = "we_app_audit"; + String TO_USER_NAME = "ToUserName"; + String FROM_USER_NAME = "FromUserName"; /** * 微信模推送给第三方平台方 Content固定格式 diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRunTimeInfoConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRunTimeInfoConstant.java index 2f0a2f103f..6821a3c1ad 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRunTimeInfoConstant.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRunTimeInfoConstant.java @@ -109,4 +109,6 @@ public interface ThirdRunTimeInfoConstant { String SEND_MESSAGE_XML = "要发送的xml内容为:%s"; String CONTENT = "content为:%s"; + + String MSG_TYPE = "消息类型为:%s"; } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java index 6d4aba484a..5994769f3e 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java @@ -417,23 +417,17 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe String authAppId = authorizationInfoResultDTO.getAuthorizer_appid(); List fixationAppIdResultDTOS = fixationAppIdDao.selectFixationInfos(); String finalCustomerId = customerId;// - log.info("新customerId为:"+customerId); - log.info("新finalCustomerId为:"+finalCustomerId); fixationAppIdResultDTOS.forEach(fixationAppId -> { if (fixationAppId.getAppId().equals(authAppId)){ // TODO 是城阳项目或者党群e事通 // crm表中的customerId【原customerId】 String masterCustomerId = fixationAppId.getMasterCustomerId(); - log.info("老customerId为:"+masterCustomerId); formDTO.setCustomerId(masterCustomerId); authCodeDao.deleteCustomerAuthCode(finalCustomerId,clientType); authCodeDao.insertRedirectAuthCode(formDTO); //authCode存缓存 redisThird.setAuthCode(formDTO); this.authInfoByAuthCode(authCode, masterCustomerId, clientType); - - log.info("=======================公众号的客户id为:"+finalCustomerId); - ModifyCustomerFormDTO modifyCustomer = new ModifyCustomerFormDTO(); modifyCustomer.setOldCustomerId(finalCustomerId); modifyCustomer.setNewCustomerId(masterCustomerId); @@ -441,7 +435,6 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe // 管理员授权 CustomerManagerFormDTO customerManager = paUserDao.selectManagerInfo(userId); - log.info("=======================公众号的客户id为:"+finalCustomerId); customerManager.setCustomerId(finalCustomerId); operCrmOpenFeignClient.addManager(customerManager); } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/WarrantServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/WarrantServiceImpl.java index 2adf60adeb..d9b753172c 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/WarrantServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/WarrantServiceImpl.java @@ -106,42 +106,57 @@ public class WarrantServiceImpl implements WarrantService { // 将xml转为map Map result = WXXmlToMapUtil.multilayerXmlToMap(msg); Map xml = (Map) result.get(ModuleConstant.XML); - if (xml.get(ModuleConstant.MSG_TYPE).equals(ModuleConstant.EVENT_LOW)) { - // TODO 目前来看,msgType = ‘event’ 的是代码审核结果 - Long createTime = Long.valueOf(xml.get(ModuleConstant.CREATE_TIME).toString()); - CodeAuditRecordFormDTO codeAuditRecord = ConvertUtils.mapToEntity(xml, CodeAuditRecordFormDTO.class); - codeAuditRecord.setWechatCreateTime(componentVerifyTicketServiceImpl.sToDate(createTime.toString())); - String toUserName = codeAuditRecord.getToUserName();//小程序原始ID - CustomerIdAndClientResultDTO customerIdAndClientResultDTO = miniInfoDao.selectCustomerIdAndClientByToUserName(toUserName); - String clientType = customerIdAndClientResultDTO.getClientType(); - String customerId = customerIdAndClientResultDTO.getCustomerId(); - TemplateAndAppIdResultDTO templateAndAppId = codeCustomerDao.selectTemplateAndAppId(customerId, clientType); - String authAppId = templateAndAppId.getAuthAppId(); - String templateId = templateAndAppId.getTemplateId(); - codeAuditRecord.setClientType(clientType); - codeAuditRecord.setCustomerId(customerId); - codeAuditRecord.setAuthAppId(authAppId); - codeAuditRecord.setTemplateId(templateId); - //插入 代码审核 记录 - log.info(String.format(ThirdRunTimeInfoConstant.CODE_AUDIT_RESULT,xml)); - codeAuditRecordDao.insertCodeAuditRecord(codeAuditRecord); - // 修改 code_audit_result 中的代码审核结果 - String event = codeAuditRecord.getEvent(); - String codeResult = null; - switch (event) { - case ModuleConstant.WEAPP_AUDIT_SUCCESS: - codeResult = ModuleConstant.AUDIT_SUCCESS; - break; - case ModuleConstant.WEAPP_AUDIT_FAIL: - codeResult = ModuleConstant.AUDIT_FAILED; - break; - case ModuleConstant.WEAPP_AUDIT_DELAY: - codeResult = ModuleConstant.DELAY; - break; + String msgType = xml.get(ModuleConstant.MSG_TYPE).toString(); + log.info(String.format(ThirdRunTimeInfoConstant.MSG_TYPE,msgType)); + String toUserName = null; + String fromUserName = null; + if (msgType.equals(ModuleConstant.EVENT_LOW)) { + String event = xml.get(ModuleConstant.EVENT).toString(); + if (xml.containsKey(ModuleConstant.TO_USER_NAME)){ + toUserName = xml.get(ModuleConstant.TO_USER_NAME).toString(); } - String codeCustomerId = codeCustomerDao.selectCodeCustomerId(codeAuditRecord); - codeAuditResultDao.updateAuditResult(customerId, codeCustomerId, codeResult); - }else if (xml.get(ModuleConstant.MSG_TYPE).equals(ModuleConstant.TEXT)){ + if (xml.containsKey(ModuleConstant.FROM_USER_NAME)){ + fromUserName = xml.get(ModuleConstant.FROM_USER_NAME).toString(); + } + if (event.startsWith(ModuleConstant.WE_APP_AUDIT)) { + // TODO 目前来看,msgType = ‘event’ 的是代码审核结果 + Long createTime = Long.valueOf(xml.get(ModuleConstant.CREATE_TIME).toString()); + CodeAuditRecordFormDTO codeAuditRecord = ConvertUtils.mapToEntity(xml, CodeAuditRecordFormDTO.class); + codeAuditRecord.setWechatCreateTime(componentVerifyTicketServiceImpl.sToDate(createTime.toString())); +// String toUserName = codeAuditRecord.getToUserName();//小程序原始ID + CustomerIdAndClientResultDTO customerIdAndClientResultDTO = miniInfoDao.selectCustomerIdAndClientByToUserName(toUserName); + String clientType = customerIdAndClientResultDTO.getClientType(); + String customerId = customerIdAndClientResultDTO.getCustomerId(); + TemplateAndAppIdResultDTO templateAndAppId = codeCustomerDao.selectTemplateAndAppId(customerId, clientType); + String authAppId = templateAndAppId.getAuthAppId(); + String templateId = templateAndAppId.getTemplateId(); + codeAuditRecord.setClientType(clientType); + codeAuditRecord.setCustomerId(customerId); + codeAuditRecord.setAuthAppId(authAppId); + codeAuditRecord.setTemplateId(templateId); + //插入 代码审核 记录 + log.info(String.format(ThirdRunTimeInfoConstant.CODE_AUDIT_RESULT, xml)); + codeAuditRecordDao.insertCodeAuditRecord(codeAuditRecord); + // 修改 code_audit_result 中的代码审核结果 +// String event = codeAuditRecord.getEvent(); + String codeResult = null; + switch (event) { + case ModuleConstant.WEAPP_AUDIT_SUCCESS: + codeResult = ModuleConstant.AUDIT_SUCCESS; + break; + case ModuleConstant.WEAPP_AUDIT_FAIL: + codeResult = ModuleConstant.AUDIT_FAILED; + break; + case ModuleConstant.WEAPP_AUDIT_DELAY: + codeResult = ModuleConstant.DELAY; + break; + } + String codeCustomerId = codeCustomerDao.selectCodeCustomerId(codeAuditRecord); + codeAuditResultDao.updateAuditResult(customerId, codeCustomerId, codeResult); + }else { + this.replyEventMessage(request,response,event,toUserName,fromUserName); + } + }else if (msgType.equals(ModuleConstant.TEXT)){ // TODO 公众号回复消息 MessagePushTextFormDTO messagePushTextFormDTO = ConvertUtils.mapToEntity(xml, MessagePushTextFormDTO.class); Object createTime = xml.get(ModuleConstant.CREATE_TIME); @@ -157,7 +172,7 @@ public class WarrantServiceImpl implements WarrantService { * 1)微信模推送给第三方平台方:文本消息,其中 Content 字段的内容固定为:TESTCOMPONENT_MSG_TYPE_TEXT * 2)第三方平台方立马回应文本消息并最终触达粉丝:Content 必须固定为:TESTCOMPONENT_MSG_TYPE_TEXT_callback */ - if (content.equals(ModuleConstant.TESTCOMPONENT_MSG_TYPE_TEXT)){ + /*if (content.equals(ModuleConstant.TESTCOMPONENT_MSG_TYPE_TEXT)){ }else if (content.startsWith(ModuleConstant.QUERY_AUTH_CODE)){ @@ -166,7 +181,10 @@ public class WarrantServiceImpl implements WarrantService { //auth_code String queryAuthCode = content.substring(contentBefore.length() + NumConstant.ONE, content.length()); - } + }*/ + + this.processTextMessage(request,response,content,toUserName,fromUserName); + } log.info("消息与事件接收URL【代码审核结果】结束......"); return ModuleConstant.SUCCESS;