Commit 5e15acc3 authored by qinxunjia's avatar qinxunjia

模板审核通知接口

parent 3589f5f1
......@@ -2,7 +2,7 @@ package com.bgy.sms.channel.api;
import com.alibaba.fastjson.JSONObject;
import com.bgy.sms.channel.bgy.dto.CLNotifyRequest;
import com.bgy.sms.channel.bgy.dto.TemplateNotify;
import com.bgy.sms.channel.bgy.dto.ReportDto;
import com.bgy.sms.channel.bgy.service.BgySmsService;
import org.slf4j.Logger;
......@@ -16,12 +16,15 @@ public class BgyApi {
private static final Logger log = LoggerFactory.getLogger(BgyApi.class);
@PostMapping("/notify")
public String notify(@RequestParam CLNotifyRequest notifyInfo) {
log.info("碧桂园异步通知接口入参:{}", JSONObject.toJSONString(notifyInfo));
@Autowired
private BgySmsService bgySmsService;
@PostMapping("/templateNotify")
public String notify(@RequestBody TemplateNotify templateNotify) {
log.info("碧桂园异步通知接口入参:{}", JSONObject.toJSONString(templateNotify));
String response = "success";
try {
// bgySmsService.asyncNotify(notifyInfo);
bgySmsService.asyncNotify(templateNotify);
} catch (Exception e) {
log.error("处理创建模板异步通知异常:", e);
response = "fail";
......
......@@ -3,63 +3,26 @@ package com.bgy.sms.channel.bgy.dto;
import java.io.Serializable;
public class CLNotifyRequest implements Serializable {
public class TemplateNotify implements Serializable {
private static final long serialVersionUID = 1L;
// 接口用户名
private String username;
// 十位时间戳
private String timestamp;
// 签名串
private String signature;
// 模块
private String action;
// 模板id
private String id;
// 模板流水号
private String data;
// 审核状态(模板(1审核,2驳回),签名(2通过,3驳回))
private String auditStatus;
// 驳回原因
private String auditReason;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getTimestamp() {
return timestamp;
}
public void setTimestamp(String timestamp) {
this.timestamp = timestamp;
}
public String getSignature() {
return signature;
}
public void setSignature(String signature) {
this.signature = signature;
}
public String getAction() {
return action;
}
public void setAction(String action) {
this.action = action;
public static long getSerialVersionUID() {
return serialVersionUID;
}
public String getId() {
return id;
public String getData() {
return data;
}
public void setId(String id) {
this.id = id;
public void setData(String data) {
this.data = data;
}
public String getAuditStatus() {
......
package com.bgy.sms.channel.bgy.service;
import com.bgy.sms.channel.bgy.dto.CLBizResponse;
import com.bgy.sms.channel.bgy.dto.TemplateNotify;
public interface BgySmsService {
......@@ -8,4 +9,5 @@ public interface BgySmsService {
CLBizResponse sendSms(String mobile, String content, String areaId) throws Exception;
void asyncNotify(TemplateNotify templateNotify);
}
......@@ -4,6 +4,7 @@ package com.bgy.sms.channel.bgy.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.bgy.sms.channel.bgy.config.BgySMSConfig;
import com.bgy.sms.channel.bgy.dto.CLBizResponse;
import com.bgy.sms.channel.bgy.dto.TemplateNotify;
import com.bgy.sms.channel.bgy.service.BgySmsService;
import com.bgy.sms.channel.bgy.utils.SendSmsUtil;
import com.bgy.sms.channel.dmHub.service.DmHubService;
......@@ -73,4 +74,14 @@ public class BgySmsServiceImpl implements BgySmsService {
}
}
/**
* 处理短信模板的通知
*
* @param templateNotify
*/
@Override
public void asyncNotify(TemplateNotify templateNotify) {
}
}
......@@ -89,6 +89,8 @@ public class MessageServiceImpl implements MessageService {
info.setUpContent(chuanglanSend);
info.setParams(params);
boolean insert = smsTemplateService.insert(info);
if (!insert) {
log.error("模板插入DB异常:【{}】", JSONObject.toJSONString(info));
return new DmHubResponse(ResponseCode.SYSTEM_ERROR);
......@@ -299,7 +301,7 @@ public class MessageServiceImpl implements MessageService {
*/
private String getMsg(String upContent, List<String> params) {
for (String info : params) {
upContent = upContent.replaceFirst("\\{\\$var\\}", info);
upContent = upContent.replaceFirst("\\$v\\$", info);
}
return upContent;
}
......
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