Commit 01b28df6 authored by qinxunjia's avatar qinxunjia

优化

parent 3290e610
......@@ -133,6 +133,11 @@ public class BgySmsServiceImpl implements BgySmsService {
String retCode = retJson.getString("ret");
String retPack = retJson.getString("package");
if (!sendSuccessCode.equals(retCode)) {
if (err.contains("成功0条")) {
return new CLBizResponse(ResponseCode.UPSTREAM_FAIL.getCode(), StringUtils.isNotBlank(err) ? "碧桂园短信发送接口返回:" + err : "碧桂园短信发送接口返回空");
} else if (err.contains("成功")) {
return new CLBizResponse(ResponseCode.SUCCESS);
}
return new CLBizResponse(ResponseCode.UPSTREAM_FAIL.getCode(), StringUtils.isNotBlank(err) ? "碧桂园短信发送接口返回:" + err : "碧桂园短信发送接口返回空");
} else {
return new CLBizResponse(ResponseCode.SUCCESS);
......
......@@ -75,6 +75,10 @@ public class MessageServiceImpl implements MessageService {
TemplateChangeBean bean = dmHub2BgyTemplateSend(templateContent);
String bgySendStr = bean.getUpSendStr();
String upCreateStr = bean.getUpCreateStr();
boolean check = checkContent(upCreateStr);
if (!check) {
return new DmHubResponse("500", "短信模板不能包含以下特殊内容:()()【】[]");
}
String params = bean.getParams().toString();
SmsTemplateInfo dbInfo = smsTemplateService.selectOne(new EntityWrapper<SmsTemplateInfo>()
.eq("dm_template_id", templateId)
......@@ -127,6 +131,7 @@ public class MessageServiceImpl implements MessageService {
smsTemplateService.updateById(updateInfo);
return new DmHubResponse(ResponseCode.SUCCESS);
} else {
boolean b = smsTemplateService.deleteById(info.getId());
return new DmHubResponse(code, msg);
}
}
......@@ -139,6 +144,27 @@ public class MessageServiceImpl implements MessageService {
return responseDTO;
}
public static void main(String[] args) {
String str = "dafdsfadsfadfadf]";
String regEx = "[\\[\\]()()【】]";
Pattern p = Pattern.compile(regEx);
Matcher m = p.matcher(str);
boolean b = m.find();
System.out.println(b);
}
private boolean checkContent(String upCreateStr) {
String regEx = "[\\[\\]()()【】]";
Pattern p = Pattern.compile(regEx);
Matcher m = p.matcher(upCreateStr);
boolean b = m.find();
if (b) {
log.error("Dm Hub请求创建模板,模板包含特殊内容:()()【】");
return false;
}
return true;
}
/**
* 将DM HUb的模板装成可以简单模式模板,用户后续参数封装
......
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