diff --git a/mallinkCallback/src/main/java/com/iformall/controller/callback/WxMsgCallbackController.java b/mallinkCallback/src/main/java/com/iformall/controller/callback/WxMsgCallbackController.java index e765afc18..3bf488541 100644 --- a/mallinkCallback/src/main/java/com/iformall/controller/callback/WxMsgCallbackController.java +++ b/mallinkCallback/src/main/java/com/iformall/controller/callback/WxMsgCallbackController.java @@ -52,12 +52,17 @@ public class WxMsgCallbackController extends BaseController { * @param param */ @PostMapping(value = "/receivemodelAliyun") - public Result receiveverifymodel(@RequestParam Map param) { + public Result receiveverifymodel(@RequestBody List> param) { logger.debug("[" + getIpAddr() + "] WxMsgCallbackController::receivemodelAliyun"); logger.info(param.toString()); try { - //解析param数据插入数据库中 - wxMsgCallbackService.receivemodelAliyun(param); + if(param != null && param.size() > 0){ + for (Map p:param) { + //解析param数据插入数据库中 + wxMsgCallbackService.receivemodelAliyun(p); + } + } + }catch(Exception e){ logger.error("aliyun 模板回调ERROR",e); return new Result(ErrorCode.SYS_SERVER_ERROR); @@ -67,7 +72,7 @@ public class WxMsgCallbackController extends BaseController { } @PostMapping(value = "/receivemsgAliyun") - public Result receivemsg(@RequestParam List> param) { + public Result receivemsg(@RequestBody List> param) { logger.debug("[" + getIpAddr() + "] WxMsgCallbackController::receivemsgAliyun"); logger.info(param.toString()); try { diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxMsgModelServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxMsgModelServiceImpl.java index 8d5133c7f..f7042a5c6 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxMsgModelServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxMsgModelServiceImpl.java @@ -17,6 +17,7 @@ import com.iformall.mapper.WxMsgModelMapper; import com.iformall.service.WxMsgModelService; import com.iformall.sms.SMSFactory; import com.iformall.utils.*; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -83,16 +84,24 @@ public class WxMsgModelServiceImpl implements WxMsgModelService { final IdWorker idWorker = IdWorker.get(); wxMsgModel.setId(idWorker.nextId()); wxMsgModel.setTenantId(wxMsgModel.getTenantId()); - String data = jsonObjectResult.get("data").toString(); - wxMsgModel.setModelId(Integer.valueOf(data)); - wxMsgModel.setModelCode(jsonObjectResult.get("aliyunModelCode").toString()); + if(jsonObjectResult.get("data") != null){ + String data = jsonObjectResult.get("data").toString(); + wxMsgModel.setModelId(Integer.valueOf(data)); + } + if(jsonObjectResult.get("aliyunModelCode") != null){ + wxMsgModel.setModelCode(jsonObjectResult.get("aliyunModelCode").toString()); + } wxMsgModel.setCreatetime(new Date()); wxMsgModel.setStatus(2);//审核中 wxMsgModelMapper.insert(wxMsgModel); } else { - String data = jsonObjectResult.get("data").toString(); - wxMsgModel.setModelId(Integer.valueOf(data)); - wxMsgModel.setModelCode(jsonObjectResult.get("aliyunModelCode").toString()); + if(jsonObjectResult.get("data") != null){ + String data = jsonObjectResult.get("data").toString(); + wxMsgModel.setModelId(Integer.valueOf(data)); + } + if(jsonObjectResult.get("aliyunModelCode") != null){ + wxMsgModel.setModelCode(jsonObjectResult.get("aliyunModelCode").toString()); + } wxMsgModel.setStatus(2);//审核中 wxMsgModelMapper.updateById(wxMsgModel); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxMsgValidationcodeModelServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxMsgValidationcodeModelServiceImpl.java index 9a8c8f069..6225aaa9c 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxMsgValidationcodeModelServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxMsgValidationcodeModelServiceImpl.java @@ -133,15 +133,24 @@ public class WxMsgValidationcodeModelServiceImpl implements WxMsgValidationcodeM final IdWorker idWorker = IdWorker.get(); wxMsgModel.setId(idWorker.nextId()); wxMsgModel.setTenantId(wxMsgModel.getTenantId()); - String data = jsonObjectResult.get("data").toString(); - wxMsgModel.setModelId(Integer.valueOf(data)); - wxMsgModel.setModelCode(jsonObjectResult.get("aliyunModelCode").toString()); + if(jsonObjectResult.get("data") != null){ + String data = jsonObjectResult.get("data").toString(); + wxMsgModel.setModelId(Integer.valueOf(data)); + } + if(jsonObjectResult.get("aliyunModelCode") != null){ + wxMsgModel.setModelCode(jsonObjectResult.get("aliyunModelCode").toString()); + } wxMsgModel.setCreatetime(new Date()); wxMsgModel.setStatus(2);//审核中 wxMsgValidationcodeModelMapper.insert(wxMsgModel); } else { - String data = jsonObjectResult.get("data").toString(); - wxMsgModel.setModelId(Integer.valueOf(data)); + if(jsonObjectResult.get("data") != null){ + String data = jsonObjectResult.get("data").toString(); + wxMsgModel.setModelId(Integer.valueOf(data)); + } + if(jsonObjectResult.get("aliyunModelCode") != null){ + wxMsgModel.setModelCode(jsonObjectResult.get("aliyunModelCode").toString()); + } wxMsgModel.setStatus(2);//审核中 wxMsgValidationcodeModelMapper.updateById(wxMsgModel); } diff --git a/mallinkService/src/main/java/com/iformall/sms/aliyun/AliyunSMS.java b/mallinkService/src/main/java/com/iformall/sms/aliyun/AliyunSMS.java index 53f8cab46..76ba6bcf3 100644 --- a/mallinkService/src/main/java/com/iformall/sms/aliyun/AliyunSMS.java +++ b/mallinkService/src/main/java/com/iformall/sms/aliyun/AliyunSMS.java @@ -34,7 +34,7 @@ public class AliyunSMS implements SMSExcutor { sms.setSignName(signature); Result result = this.sendSms(sms); if(result.getSendSmsResponse().getCode() != null - && result.getSendSmsResponse().getCode().equals("ok")){ + && result.getSendSmsResponse().getCode().equalsIgnoreCase("ok")){ SMSResult.setRet("1"); SMSResult.setData(result.getSendSmsResponse().getBizId()); } @@ -50,7 +50,7 @@ public class AliyunSMS implements SMSExcutor { smsTemplate.setTemplateType(templateType); smsTemplate.setRemark(remark); AddSmsTemplateResponse addSmsTemplateResponse = this.addSmsTemplate(smsTemplate); - if(addSmsTemplateResponse.getCode() != null && addSmsTemplateResponse.getCode().equals("ok")){ + if(addSmsTemplateResponse.getCode() != null && addSmsTemplateResponse.getCode().equalsIgnoreCase("ok")){ SMSResult.setRet("1"); SMSResult.setAliyunModelCode(addSmsTemplateResponse.getTemplateCode()); } @@ -97,6 +97,7 @@ public class AliyunSMS implements SMSExcutor { log.error("添加签名发生错误。错误代码是 [{}],错误消息是 [{}],错误请求ID是 [{}],错误Msg是 [{}],错误类型是 [{}]", e.getErrCode(), e.getMessage(), e.getRequestId(), e.getErrMsg(), e.getErrorType()); } + log.info("添加签名-----" + response.getCode() + "----" + response.getMessage()); return response; } @@ -115,6 +116,7 @@ public class AliyunSMS implements SMSExcutor { log.error("删除签名发生错误。错误代码是 [{}],错误消息是 [{}],错误请求ID是 [{}],错误Msg是 [{}],错误类型是 [{}]", e.getErrCode(), e.getMessage(), e.getRequestId(), e.getErrMsg(), e.getErrorType()); } + log.info("删除签名-----" + response.getCode() + "----" + response.getMessage()); return response; } @@ -135,6 +137,7 @@ public class AliyunSMS implements SMSExcutor { log.error("修改签名发生错误。错误代码是 [{}],错误消息是 [{}],错误请求ID是 [{}],错误Msg是 [{}],错误类型是 [{}]", e.getErrCode(), e.getMessage(), e.getRequestId(), e.getErrMsg(), e.getErrorType()); } + log.info("修改签名----" + response.getCode() + "----" + response.getMessage()); return response; } @@ -153,6 +156,7 @@ public class AliyunSMS implements SMSExcutor { log.error("查询签名发生错误。错误代码是 [{}],错误消息是 [{}],错误请求ID是 [{}],错误Msg是 [{}],错误类型是 [{}]", e.getErrCode(), e.getMessage(), e.getRequestId(), e.getErrMsg(), e.getErrorType()); } + log.info("查询签名----" + response.getCode() + "----" + response.getMessage()); return response; } @@ -171,9 +175,10 @@ public class AliyunSMS implements SMSExcutor { try { response = acsClient.getAcsResponse(request); } catch (ClientException e) { - log.error("添加签名发生错误。错误代码是 [{}],错误消息是 [{}],错误请求ID是 [{}],错误Msg是 [{}],错误类型是 [{}]", + log.error(" 添加模板发生错误。错误代码是 [{}],错误消息是 [{}],错误请求ID是 [{}],错误Msg是 [{}],错误类型是 [{}]", e.getErrCode(), e.getMessage(), e.getRequestId(), e.getErrMsg(), e.getErrorType()); } + log.info(" 添加模板----" + response.getCode() + "----" + response.getMessage()); return response; } @@ -189,9 +194,10 @@ public class AliyunSMS implements SMSExcutor { try { response = acsClient.getAcsResponse(request); } catch (ClientException e) { - log.error("删除签名发生错误。错误代码是 [{}],错误消息是 [{}],错误请求ID是 [{}],错误Msg是 [{}],错误类型是 [{}]", + log.error("删除模板发生错误。错误代码是 [{}],错误消息是 [{}],错误请求ID是 [{}],错误Msg是 [{}],错误类型是 [{}]", e.getErrCode(), e.getMessage(), e.getRequestId(), e.getErrMsg(), e.getErrorType()); } + log.info(" 删除模板----" + response.getCode() + "----" + response.getMessage()); return response; } @@ -211,9 +217,10 @@ public class AliyunSMS implements SMSExcutor { try { response = acsClient.getAcsResponse(request); } catch (ClientException e) { - log.error("修改签名发生错误。错误代码是 [{}],错误消息是 [{}],错误请求ID是 [{}],错误Msg是 [{}],错误类型是 [{}]", + log.error("修改模板发生错误。错误代码是 [{}],错误消息是 [{}],错误请求ID是 [{}],错误Msg是 [{}],错误类型是 [{}]", e.getErrCode(), e.getMessage(), e.getRequestId(), e.getErrMsg(), e.getErrorType()); } + log.info(" 修改模板----" + response.getCode() + "----" + response.getMessage()); return response; } @@ -229,9 +236,10 @@ public class AliyunSMS implements SMSExcutor { try { response = acsClient.getAcsResponse(request); } catch (ClientException e) { - log.error("查询签名发生错误。错误代码是 [{}],错误消息是 [{}],错误请求ID是 [{}],错误Msg是 [{}],错误类型是 [{}]", + log.error("查询模板发生错误。错误代码是 [{}],错误消息是 [{}],错误请求ID是 [{}],错误Msg是 [{}],错误类型是 [{}]", e.getErrCode(), e.getMessage(), e.getRequestId(), e.getErrMsg(), e.getErrorType()); } + log.info(" 查询模板----" + response.getCode() + "----" + response.getMessage()); return response; }