Просмотр исходного кода

duanxinbug

release_toaliyun_real
xhxu 5 лет назад
Родитель
Сommit
c32479c488
4 измененных файлов: 52 добавлений и 21 удалений
  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 Просмотреть файл

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

}catch(Exception e){ }catch(Exception e){
logger.error("aliyun 模板回调ERROR",e); logger.error("aliyun 模板回调ERROR",e);
return new Result(ErrorCode.SYS_SERVER_ERROR); return new Result(ErrorCode.SYS_SERVER_ERROR);
@@ -67,7 +72,7 @@ public class WxMsgCallbackController extends BaseController {
} }


@PostMapping(value = "/receivemsgAliyun") @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.debug("[" + getIpAddr() + "] WxMsgCallbackController::receivemsgAliyun");
logger.info(param.toString()); logger.info(param.toString());
try { try {


+ 15
- 6
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.service.WxMsgModelService;
import com.iformall.sms.SMSFactory; import com.iformall.sms.SMSFactory;
import com.iformall.utils.*; import com.iformall.utils.*;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -83,16 +84,24 @@ public class WxMsgModelServiceImpl implements WxMsgModelService {
final IdWorker idWorker = IdWorker.get(); final IdWorker idWorker = IdWorker.get();
wxMsgModel.setId(idWorker.nextId()); wxMsgModel.setId(idWorker.nextId());
wxMsgModel.setTenantId(wxMsgModel.getTenantId()); 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.setCreatetime(new Date());
wxMsgModel.setStatus(2);//审核中 wxMsgModel.setStatus(2);//审核中
wxMsgModelMapper.insert(wxMsgModel); wxMsgModelMapper.insert(wxMsgModel);
} else { } 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);//审核中 wxMsgModel.setStatus(2);//审核中
wxMsgModelMapper.updateById(wxMsgModel); wxMsgModelMapper.updateById(wxMsgModel);
} }


+ 14
- 5
mallinkService/src/main/java/com/iformall/service/impl/WxMsgValidationcodeModelServiceImpl.java Просмотреть файл

@@ -133,15 +133,24 @@ public class WxMsgValidationcodeModelServiceImpl implements WxMsgValidationcodeM
final IdWorker idWorker = IdWorker.get(); final IdWorker idWorker = IdWorker.get();
wxMsgModel.setId(idWorker.nextId()); wxMsgModel.setId(idWorker.nextId());
wxMsgModel.setTenantId(wxMsgModel.getTenantId()); 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.setCreatetime(new Date());
wxMsgModel.setStatus(2);//审核中 wxMsgModel.setStatus(2);//审核中
wxMsgValidationcodeModelMapper.insert(wxMsgModel); wxMsgValidationcodeModelMapper.insert(wxMsgModel);
} else { } 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);//审核中 wxMsgModel.setStatus(2);//审核中
wxMsgValidationcodeModelMapper.updateById(wxMsgModel); wxMsgValidationcodeModelMapper.updateById(wxMsgModel);
} }


+ 14
- 6
mallinkService/src/main/java/com/iformall/sms/aliyun/AliyunSMS.java Просмотреть файл

@@ -34,7 +34,7 @@ public class AliyunSMS implements SMSExcutor {
sms.setSignName(signature); sms.setSignName(signature);
Result result = this.sendSms(sms); Result result = this.sendSms(sms);
if(result.getSendSmsResponse().getCode() != null if(result.getSendSmsResponse().getCode() != null
&& result.getSendSmsResponse().getCode().equals("ok")){
&& result.getSendSmsResponse().getCode().equalsIgnoreCase("ok")){
SMSResult.setRet("1"); SMSResult.setRet("1");
SMSResult.setData(result.getSendSmsResponse().getBizId()); SMSResult.setData(result.getSendSmsResponse().getBizId());
} }
@@ -50,7 +50,7 @@ public class AliyunSMS implements SMSExcutor {
smsTemplate.setTemplateType(templateType); smsTemplate.setTemplateType(templateType);
smsTemplate.setRemark(remark); smsTemplate.setRemark(remark);
AddSmsTemplateResponse addSmsTemplateResponse = this.addSmsTemplate(smsTemplate); 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.setRet("1");
SMSResult.setAliyunModelCode(addSmsTemplateResponse.getTemplateCode()); SMSResult.setAliyunModelCode(addSmsTemplateResponse.getTemplateCode());
} }
@@ -97,6 +97,7 @@ public class AliyunSMS implements SMSExcutor {
log.error("添加签名发生错误。错误代码是 [{}],错误消息是 [{}],错误请求ID是 [{}],错误Msg是 [{}],错误类型是 [{}]", log.error("添加签名发生错误。错误代码是 [{}],错误消息是 [{}],错误请求ID是 [{}],错误Msg是 [{}],错误类型是 [{}]",
e.getErrCode(), e.getMessage(), e.getRequestId(), e.getErrMsg(), e.getErrorType()); e.getErrCode(), e.getMessage(), e.getRequestId(), e.getErrMsg(), e.getErrorType());
} }
log.info("添加签名-----" + response.getCode() + "----" + response.getMessage());
return response; return response;
} }


@@ -115,6 +116,7 @@ public class AliyunSMS implements SMSExcutor {
log.error("删除签名发生错误。错误代码是 [{}],错误消息是 [{}],错误请求ID是 [{}],错误Msg是 [{}],错误类型是 [{}]", log.error("删除签名发生错误。错误代码是 [{}],错误消息是 [{}],错误请求ID是 [{}],错误Msg是 [{}],错误类型是 [{}]",
e.getErrCode(), e.getMessage(), e.getRequestId(), e.getErrMsg(), e.getErrorType()); e.getErrCode(), e.getMessage(), e.getRequestId(), e.getErrMsg(), e.getErrorType());
} }
log.info("删除签名-----" + response.getCode() + "----" + response.getMessage());
return response; return response;
} }


@@ -135,6 +137,7 @@ public class AliyunSMS implements SMSExcutor {
log.error("修改签名发生错误。错误代码是 [{}],错误消息是 [{}],错误请求ID是 [{}],错误Msg是 [{}],错误类型是 [{}]", log.error("修改签名发生错误。错误代码是 [{}],错误消息是 [{}],错误请求ID是 [{}],错误Msg是 [{}],错误类型是 [{}]",
e.getErrCode(), e.getMessage(), e.getRequestId(), e.getErrMsg(), e.getErrorType()); e.getErrCode(), e.getMessage(), e.getRequestId(), e.getErrMsg(), e.getErrorType());
} }
log.info("修改签名----" + response.getCode() + "----" + response.getMessage());
return response; return response;
} }


@@ -153,6 +156,7 @@ public class AliyunSMS implements SMSExcutor {
log.error("查询签名发生错误。错误代码是 [{}],错误消息是 [{}],错误请求ID是 [{}],错误Msg是 [{}],错误类型是 [{}]", log.error("查询签名发生错误。错误代码是 [{}],错误消息是 [{}],错误请求ID是 [{}],错误Msg是 [{}],错误类型是 [{}]",
e.getErrCode(), e.getMessage(), e.getRequestId(), e.getErrMsg(), e.getErrorType()); e.getErrCode(), e.getMessage(), e.getRequestId(), e.getErrMsg(), e.getErrorType());
} }
log.info("查询签名----" + response.getCode() + "----" + response.getMessage());
return response; return response;
} }


@@ -171,9 +175,10 @@ public class AliyunSMS implements SMSExcutor {
try { try {
response = acsClient.getAcsResponse(request); response = acsClient.getAcsResponse(request);
} catch (ClientException e) { } catch (ClientException e) {
log.error("添加签名发生错误。错误代码是 [{}],错误消息是 [{}],错误请求ID是 [{}],错误Msg是 [{}],错误类型是 [{}]",
log.error(" 添加模板发生错误。错误代码是 [{}],错误消息是 [{}],错误请求ID是 [{}],错误Msg是 [{}],错误类型是 [{}]",
e.getErrCode(), e.getMessage(), e.getRequestId(), e.getErrMsg(), e.getErrorType()); e.getErrCode(), e.getMessage(), e.getRequestId(), e.getErrMsg(), e.getErrorType());
} }
log.info(" 添加模板----" + response.getCode() + "----" + response.getMessage());
return response; return response;
} }


@@ -189,9 +194,10 @@ public class AliyunSMS implements SMSExcutor {
try { try {
response = acsClient.getAcsResponse(request); response = acsClient.getAcsResponse(request);
} catch (ClientException e) { } catch (ClientException e) {
log.error("删除签名发生错误。错误代码是 [{}],错误消息是 [{}],错误请求ID是 [{}],错误Msg是 [{}],错误类型是 [{}]",
log.error("删除模板发生错误。错误代码是 [{}],错误消息是 [{}],错误请求ID是 [{}],错误Msg是 [{}],错误类型是 [{}]",
e.getErrCode(), e.getMessage(), e.getRequestId(), e.getErrMsg(), e.getErrorType()); e.getErrCode(), e.getMessage(), e.getRequestId(), e.getErrMsg(), e.getErrorType());
} }
log.info(" 删除模板----" + response.getCode() + "----" + response.getMessage());
return response; return response;
} }


@@ -211,9 +217,10 @@ public class AliyunSMS implements SMSExcutor {
try { try {
response = acsClient.getAcsResponse(request); response = acsClient.getAcsResponse(request);
} catch (ClientException e) { } catch (ClientException e) {
log.error("修改签名发生错误。错误代码是 [{}],错误消息是 [{}],错误请求ID是 [{}],错误Msg是 [{}],错误类型是 [{}]",
log.error("修改模板发生错误。错误代码是 [{}],错误消息是 [{}],错误请求ID是 [{}],错误Msg是 [{}],错误类型是 [{}]",
e.getErrCode(), e.getMessage(), e.getRequestId(), e.getErrMsg(), e.getErrorType()); e.getErrCode(), e.getMessage(), e.getRequestId(), e.getErrMsg(), e.getErrorType());
} }
log.info(" 修改模板----" + response.getCode() + "----" + response.getMessage());
return response; return response;
} }


@@ -229,9 +236,10 @@ public class AliyunSMS implements SMSExcutor {
try { try {
response = acsClient.getAcsResponse(request); response = acsClient.getAcsResponse(request);
} catch (ClientException e) { } catch (ClientException e) {
log.error("查询签名发生错误。错误代码是 [{}],错误消息是 [{}],错误请求ID是 [{}],错误Msg是 [{}],错误类型是 [{}]",
log.error("查询模板发生错误。错误代码是 [{}],错误消息是 [{}],错误请求ID是 [{}],错误Msg是 [{}],错误类型是 [{}]",
e.getErrCode(), e.getMessage(), e.getRequestId(), e.getErrMsg(), e.getErrorType()); e.getErrCode(), e.getMessage(), e.getRequestId(), e.getErrMsg(), e.getErrorType());
} }
log.info(" 查询模板----" + response.getCode() + "----" + response.getMessage());
return response; return response;
} }




Загрузка…
Отмена
Сохранить