Commit 5e15acc3 authored by qinxunjia's avatar qinxunjia

模板审核通知接口

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