|
@ -106,12 +106,24 @@ public class WarrantServiceImpl implements WarrantService { |
|
|
// 将xml转为map
|
|
|
// 将xml转为map
|
|
|
Map<String, Object> result = WXXmlToMapUtil.multilayerXmlToMap(msg); |
|
|
Map<String, Object> result = WXXmlToMapUtil.multilayerXmlToMap(msg); |
|
|
Map<String,Object> xml = (Map<String, Object>) result.get(ModuleConstant.XML); |
|
|
Map<String,Object> xml = (Map<String, Object>) result.get(ModuleConstant.XML); |
|
|
if (xml.get(ModuleConstant.MSG_TYPE).equals(ModuleConstant.EVENT_LOW)) { |
|
|
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(); |
|
|
|
|
|
} |
|
|
|
|
|
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’ 的是代码审核结果
|
|
|
// TODO 目前来看,msgType = ‘event’ 的是代码审核结果
|
|
|
Long createTime = Long.valueOf(xml.get(ModuleConstant.CREATE_TIME).toString()); |
|
|
Long createTime = Long.valueOf(xml.get(ModuleConstant.CREATE_TIME).toString()); |
|
|
CodeAuditRecordFormDTO codeAuditRecord = ConvertUtils.mapToEntity(xml, CodeAuditRecordFormDTO.class); |
|
|
CodeAuditRecordFormDTO codeAuditRecord = ConvertUtils.mapToEntity(xml, CodeAuditRecordFormDTO.class); |
|
|
codeAuditRecord.setWechatCreateTime(componentVerifyTicketServiceImpl.sToDate(createTime.toString())); |
|
|
codeAuditRecord.setWechatCreateTime(componentVerifyTicketServiceImpl.sToDate(createTime.toString())); |
|
|
String toUserName = codeAuditRecord.getToUserName();//小程序原始ID
|
|
|
// String toUserName = codeAuditRecord.getToUserName();//小程序原始ID
|
|
|
CustomerIdAndClientResultDTO customerIdAndClientResultDTO = miniInfoDao.selectCustomerIdAndClientByToUserName(toUserName); |
|
|
CustomerIdAndClientResultDTO customerIdAndClientResultDTO = miniInfoDao.selectCustomerIdAndClientByToUserName(toUserName); |
|
|
String clientType = customerIdAndClientResultDTO.getClientType(); |
|
|
String clientType = customerIdAndClientResultDTO.getClientType(); |
|
|
String customerId = customerIdAndClientResultDTO.getCustomerId(); |
|
|
String customerId = customerIdAndClientResultDTO.getCustomerId(); |
|
@ -123,10 +135,10 @@ public class WarrantServiceImpl implements WarrantService { |
|
|
codeAuditRecord.setAuthAppId(authAppId); |
|
|
codeAuditRecord.setAuthAppId(authAppId); |
|
|
codeAuditRecord.setTemplateId(templateId); |
|
|
codeAuditRecord.setTemplateId(templateId); |
|
|
//插入 代码审核 记录
|
|
|
//插入 代码审核 记录
|
|
|
log.info(String.format(ThirdRunTimeInfoConstant.CODE_AUDIT_RESULT,xml)); |
|
|
log.info(String.format(ThirdRunTimeInfoConstant.CODE_AUDIT_RESULT, xml)); |
|
|
codeAuditRecordDao.insertCodeAuditRecord(codeAuditRecord); |
|
|
codeAuditRecordDao.insertCodeAuditRecord(codeAuditRecord); |
|
|
// 修改 code_audit_result 中的代码审核结果
|
|
|
// 修改 code_audit_result 中的代码审核结果
|
|
|
String event = codeAuditRecord.getEvent(); |
|
|
// String event = codeAuditRecord.getEvent();
|
|
|
String codeResult = null; |
|
|
String codeResult = null; |
|
|
switch (event) { |
|
|
switch (event) { |
|
|
case ModuleConstant.WEAPP_AUDIT_SUCCESS: |
|
|
case ModuleConstant.WEAPP_AUDIT_SUCCESS: |
|
@ -141,7 +153,10 @@ public class WarrantServiceImpl implements WarrantService { |
|
|
} |
|
|
} |
|
|
String codeCustomerId = codeCustomerDao.selectCodeCustomerId(codeAuditRecord); |
|
|
String codeCustomerId = codeCustomerDao.selectCodeCustomerId(codeAuditRecord); |
|
|
codeAuditResultDao.updateAuditResult(customerId, codeCustomerId, codeResult); |
|
|
codeAuditResultDao.updateAuditResult(customerId, codeCustomerId, codeResult); |
|
|
}else if (xml.get(ModuleConstant.MSG_TYPE).equals(ModuleConstant.TEXT)){ |
|
|
}else { |
|
|
|
|
|
this.replyEventMessage(request,response,event,toUserName,fromUserName); |
|
|
|
|
|
} |
|
|
|
|
|
}else if (msgType.equals(ModuleConstant.TEXT)){ |
|
|
// TODO 公众号回复消息
|
|
|
// TODO 公众号回复消息
|
|
|
MessagePushTextFormDTO messagePushTextFormDTO = ConvertUtils.mapToEntity(xml, MessagePushTextFormDTO.class); |
|
|
MessagePushTextFormDTO messagePushTextFormDTO = ConvertUtils.mapToEntity(xml, MessagePushTextFormDTO.class); |
|
|
Object createTime = xml.get(ModuleConstant.CREATE_TIME); |
|
|
Object createTime = xml.get(ModuleConstant.CREATE_TIME); |
|
@ -157,7 +172,7 @@ public class WarrantServiceImpl implements WarrantService { |
|
|
* 1)微信模推送给第三方平台方:文本消息,其中 Content 字段的内容固定为:TESTCOMPONENT_MSG_TYPE_TEXT |
|
|
* 1)微信模推送给第三方平台方:文本消息,其中 Content 字段的内容固定为:TESTCOMPONENT_MSG_TYPE_TEXT |
|
|
* 2)第三方平台方立马回应文本消息并最终触达粉丝:Content 必须固定为:TESTCOMPONENT_MSG_TYPE_TEXT_callback |
|
|
* 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)){ |
|
|
}else if (content.startsWith(ModuleConstant.QUERY_AUTH_CODE)){ |
|
@ -166,7 +181,10 @@ public class WarrantServiceImpl implements WarrantService { |
|
|
//auth_code
|
|
|
//auth_code
|
|
|
String queryAuthCode = content.substring(contentBefore.length() + NumConstant.ONE, content.length()); |
|
|
String queryAuthCode = content.substring(contentBefore.length() + NumConstant.ONE, content.length()); |
|
|
|
|
|
|
|
|
} |
|
|
}*/ |
|
|
|
|
|
|
|
|
|
|
|
this.processTextMessage(request,response,content,toUserName,fromUserName); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
log.info("消息与事件接收URL【代码审核结果】结束......"); |
|
|
log.info("消息与事件接收URL【代码审核结果】结束......"); |
|
|
return ModuleConstant.SUCCESS; |
|
|
return ModuleConstant.SUCCESS; |
|
@ -224,7 +242,7 @@ public class WarrantServiceImpl implements WarrantService { |
|
|
public void replyTextMessage(HttpServletRequest request, HttpServletResponse response, |
|
|
public void replyTextMessage(HttpServletRequest request, HttpServletResponse response, |
|
|
String content,String toUserName, String fromUserName) |
|
|
String content,String toUserName, String fromUserName) |
|
|
throws DocumentException, IOException { |
|
|
throws DocumentException, IOException { |
|
|
Long createTime = System.currentTimeMillis() / 1000; |
|
|
Long createTime = System.currentTimeMillis() / NumConstant.ONE_THOUSAND; |
|
|
StringBuffer sb = new StringBuffer(512); |
|
|
StringBuffer sb = new StringBuffer(512); |
|
|
sb.append("<xml>"); |
|
|
sb.append("<xml>"); |
|
|
sb.append("<ToUserName><![CDATA["+toUserName+"]]></ToUserName>"); |
|
|
sb.append("<ToUserName><![CDATA["+toUserName+"]]></ToUserName>"); |
|
@ -251,7 +269,7 @@ public class WarrantServiceImpl implements WarrantService { |
|
|
// 得到微信授权成功的消息后,应该立刻进行处理!!相关信息只会在首次授权的时候推送过来
|
|
|
// 得到微信授权成功的消息后,应该立刻进行处理!!相关信息只会在首次授权的时候推送过来
|
|
|
//第三方平台【component_access_token】
|
|
|
//第三方平台【component_access_token】
|
|
|
String componentAccessToken = redisThird.getComponentAccessToken(); |
|
|
String componentAccessToken = redisThird.getComponentAccessToken(); |
|
|
com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject(); |
|
|
JSONObject jsonObject = new JSONObject(); |
|
|
jsonObject.put(ModuleConstant.COMPONENT_APPID, componentAppId); |
|
|
jsonObject.put(ModuleConstant.COMPONENT_APPID, componentAppId); |
|
|
jsonObject.put(ModuleConstant.AUTHORIZATION_CODE, auth_code); |
|
|
jsonObject.put(ModuleConstant.AUTHORIZATION_CODE, auth_code); |
|
|
String authInfo = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_QUERY_AUTH_URL + componentAccessToken, JSON.toJSONString(jsonObject)).getData(); |
|
|
String authInfo = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_QUERY_AUTH_URL + componentAccessToken, JSON.toJSONString(jsonObject)).getData(); |
|
|