Browse Source

duanxinbug

release_toaliyun_real
xhxu 5 years ago
parent
commit
c32479c488
4 changed files with 52 additions and 21 deletions
  1. +9
    -4
      mallinkCallback/src/main/java/com/iformall/controller/callback/WxMsgCallbackController.java
  2. +15
    -6
      mallinkService/src/main/java/com/iformall/service/impl/WxMsgModelServiceImpl.java
  3. +14
    -5
      mallinkService/src/main/java/com/iformall/service/impl/WxMsgValidationcodeModelServiceImpl.java
  4. +14
    -6
      mallinkService/src/main/java/com/iformall/sms/aliyun/AliyunSMS.java

+ 9
- 4
mallinkCallback/src/main/java/com/iformall/controller/callback/WxMsgCallbackController.java View File

@@ -52,12 +52,17 @@ public class WxMsgCallbackController extends BaseController {
* @param param
*/
@PostMapping(value = "/receivemodelAliyun")
public Result receiveverifymodel(@RequestParam Map<String, String> param) {
public Result receiveverifymodel(@RequestBody List<Map<String, String>> param) {
logger.debug("[" + getIpAddr() + "] WxMsgCallbackController::receivemodelAliyun");
logger.info(param.toString());
try {
//解析param数据插入数据库中
wxMsgCallbackService.receivemodelAliyun(param);
if(param != null && param.size() > 0){
for (Map<String, String> 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<Map<String, String>> param) {
public Result receivemsg(@RequestBody List<Map<String, String>> param) {
logger.debug("[" + getIpAddr() + "] WxMsgCallbackController::receivemsgAliyun");
logger.info(param.toString());
try {


+ 15
- 6
mallinkService/src/main/java/com/iformall/service/impl/WxMsgModelServiceImpl.java View File

@@ -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);
}


+ 14
- 5
mallinkService/src/main/java/com/iformall/service/impl/WxMsgValidationcodeModelServiceImpl.java View File

@@ -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);
}


+ 14
- 6
mallinkService/src/main/java/com/iformall/sms/aliyun/AliyunSMS.java View File

@@ -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;
}



Loading…
Cancel
Save