Commit bdd91a6e authored by fuwanli's avatar fuwanli

"11"

parent 9a996165
...@@ -128,7 +128,7 @@ public class DmHubApi { ...@@ -128,7 +128,7 @@ public class DmHubApi {
log.info("**********单条发送入参*******:{},\r\n appId:{},timestamp:{},signature:{}", JSONObject.toJSONString(request), appId, timestamp, signature); log.info("**********单条发送入参*******:{},\r\n appId:{},timestamp:{},signature:{}", JSONObject.toJSONString(request), appId, timestamp, signature);
DmHubResponse response; DmHubResponse response;
try { try {
boolean checkResult = this.checkSignature(timestamp, signature); boolean checkResult = this.checkSignature(timestamp, signature);
if (!checkResult) { if (!checkResult) {
return new DmHubResponse("555", "签名校验不通过"); return new DmHubResponse("555", "签名校验不通过");
} }
......
...@@ -103,4 +103,32 @@ public class BgySmsServiceImpl implements BgySmsService { ...@@ -103,4 +103,32 @@ public class BgySmsServiceImpl implements BgySmsService {
smsTemplateInfo.setUpRejectMsg(auditReason); smsTemplateInfo.setUpRejectMsg(auditReason);
smsTemplateService.updateById(smsTemplateInfo); smsTemplateService.updateById(smsTemplateInfo);
} }
public static void main(String[] args) {
String appId = BgySMSConfig.appId;
String a = Md5Util.encrypt(2021 + "930844c7-7985-435b-af47-142b59b299c3".toUpperCase());
System.out.println(a);
System.out.println(appId);
if (1==1) {
return;
}
// String areaId = BgySMSConfig.areaId;
String securityCode = BgySMSConfig.securityCode;
String url = BgySMSConfig.url;
String api = BgySMSConfig.api;
Map<String, String> requestParams = new HashMap<>();
requestParams.put("api", "SendYXSMS");
requestParams.put("appId", "");
requestParams.put("security", "");
requestParams.put("areaId", "XXJSB");
requestParams.put("content", "测试模板内容,占位符测试:11,再来一个:22!退订回复TD【碧桂园】");
requestParams.put("mobile", "18088834894");
log.info("碧桂园短信接口参数:{}", requestParams);
String retStr = SendSmsUtil.sendSmsByPost("https://xstest.bgy.com.cn/ApiBgyTest/Open/Sms.ashx", JSONObject.toJSONString(requestParams));
log.info("碧桂园短信接口返回信息:{}", retStr);
}
} }
...@@ -18,6 +18,7 @@ import com.bgy.sms.service.MessageService; ...@@ -18,6 +18,7 @@ import com.bgy.sms.service.MessageService;
import com.bgy.sms.service.SmsTemplateService; import com.bgy.sms.service.SmsTemplateService;
import com.bgy.sms.service.bean.TemplateChangeBean; import com.bgy.sms.service.bean.TemplateChangeBean;
import com.bgy.util.HttpUtil; import com.bgy.util.HttpUtil;
import com.bgy.util.Md5Util;
import com.bgy.util.id.IdHandler; import com.bgy.util.id.IdHandler;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -96,32 +97,38 @@ public class MessageServiceImpl implements MessageService { ...@@ -96,32 +97,38 @@ public class MessageServiceImpl implements MessageService {
log.error("模板插入DB异常:【{}】", JSONObject.toJSONString(info)); log.error("模板插入DB异常:【{}】", JSONObject.toJSONString(info));
return new DmHubResponse(ResponseCode.SYSTEM_ERROR); return new DmHubResponse(ResponseCode.SYSTEM_ERROR);
}else { }else {
String appId = BgySMSConfig.appId;
String securityCode = BgySMSConfig.securityCode;
String pkID = info.getId()+""; String pkID = info.getId()+"";
String content = info.getContent(); String content = info.getContent();
JSONObject param = new JSONObject(); JSONObject param = new JSONObject();
param.put("api", "AddTemplate"); param.put("api", "AddTemplate");
param.put("appid", ""); param.put("appid", appId);
param.put("security", ""); param.put("security", Md5Util.encrypt(appId + securityCode.toUpperCase()));
param.put("content", content); param.put("content", content);
param.put("areaid", "FHY"); param.put("areaid", "FHY");
param.put("pkID", pkID); param.put("pkID", pkID);
param.put("account", ""); param.put("account", "liyuecheng");
param.put("templateType", ""); param.put("templateType", "");
String retStr = HttpUtil.sendPost(BgySMSConfig.url, JSONObject.toJSONString(param)); String retStr = HttpUtil.sendPost(BgySMSConfig.url, JSONObject.toJSONString(param));
JSONObject retJson = JSONObject.parseObject(retStr); JSONObject retJson = JSONObject.parseObject(retStr);
String ret = retJson.getString("ret");
String reePackage = retJson.getString("package"); String reePackage = retJson.getString("package");
String err = retJson.getString("err");
String retCode = retJson.getString("ret");
if ("0".equals(retCode)) {
if (err.contains("成功")) {
JSONObject Json = JSONObject.parseObject(reePackage);
String data = Json.getString("data");
info.setTemplateRecordId(data);
info.setStatus("normal");
info.setId(Long.parseLong(pkID));
smsTemplateService.updateById(info);
}
if (ret.equals(0)){
JSONObject Json = JSONObject.parseObject(reePackage);
String data = Json.getString("data");
info.setTemplateRecordId(data);
info.setId(Long.parseLong(pkID));
smsTemplateService.updateById(info);
} }
responseDTO.setCode(ResponseCode.SUCCESS.getCode()); responseDTO.setCode(ResponseCode.SUCCESS.getCode());
responseDTO.setError(JSONObject.parseObject(JSONObject.toJSONString(info))); responseDTO.setError(JSONObject.parseObject(JSONObject.toJSONString(info)));
return responseDTO; return responseDTO;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment