Commit bdd91a6e authored by fuwanli's avatar fuwanli

"11"

parent 9a996165
......@@ -103,4 +103,32 @@ public class BgySmsServiceImpl implements BgySmsService {
smsTemplateInfo.setUpRejectMsg(auditReason);
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;
import com.bgy.sms.service.SmsTemplateService;
import com.bgy.sms.service.bean.TemplateChangeBean;
import com.bgy.util.HttpUtil;
import com.bgy.util.Md5Util;
import com.bgy.util.id.IdHandler;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
......@@ -96,32 +97,38 @@ public class MessageServiceImpl implements MessageService {
log.error("模板插入DB异常:【{}】", JSONObject.toJSONString(info));
return new DmHubResponse(ResponseCode.SYSTEM_ERROR);
}else {
String appId = BgySMSConfig.appId;
String securityCode = BgySMSConfig.securityCode;
String pkID = info.getId()+"";
String content = info.getContent();
JSONObject param = new JSONObject();
param.put("api", "AddTemplate");
param.put("appid", "");
param.put("security", "");
param.put("appid", appId);
param.put("security", Md5Util.encrypt(appId + securityCode.toUpperCase()));
param.put("content", content);
param.put("areaid", "FHY");
param.put("pkID", pkID);
param.put("account", "");
param.put("account", "liyuecheng");
param.put("templateType", "");
String retStr = HttpUtil.sendPost(BgySMSConfig.url, JSONObject.toJSONString(param));
JSONObject retJson = JSONObject.parseObject(retStr);
String ret = retJson.getString("ret");
String reePackage = retJson.getString("package");
String err = retJson.getString("err");
String retCode = retJson.getString("ret");
if (ret.equals(0)){
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);
}
}
responseDTO.setCode(ResponseCode.SUCCESS.getCode());
responseDTO.setError(JSONObject.parseObject(JSONObject.toJSONString(info)));
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