phi-sms-feign/src/main/java/com/hz/sms/dto/ContentItemDto.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
phi-sms-feign/src/main/java/com/hz/sms/dto/MpTemplateMsg.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
phi-sms-feign/src/main/java/com/hz/sms/dto/ResponsesSendMessage.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
phi-sms-feign/src/main/java/com/hz/sms/dto/SmsGeneralSendDto.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
phi-sms-feign/src/main/java/com/hz/sms/dto/TemplateMessageDto.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
phi-sms-feign/src/main/java/com/hz/sms/dto/TemplateMsgDto.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
phi-sms-feign/src/main/java/com/hz/sms/dto/WeAppTemplateMsg.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
phi-sms-feign/src/main/java/com/hz/sms/feign/FSmsSendService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
phi-sms-feign/src/main/java/com/hz/sms/feign/FSysSendService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
phi-sms-feign/src/main/java/com/hz/sms/dto/ContentItemDto.java
New file @@ -0,0 +1,25 @@ package com.hz.sms.dto; public class ContentItemDto { /** 长度10个汉字以内 */ private String key; /** 长度30个汉字以内(支持id转译) */ private String value; public String getKey() { return key; } public void setKey(String key) { this.key = key; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } } phi-sms-feign/src/main/java/com/hz/sms/dto/MpTemplateMsg.java
New file @@ -0,0 +1,66 @@ package com.hz.sms.dto; public class MpTemplateMsg { //公众号appid,要求与小程序有绑定且同主体 private String appid; //公众号模板id private String template_id; //公众号模板消息所要跳转的url private String url; //公众号模板消息所要跳转的小程序,小程序的必须与公众号具有绑定关系 private String miniprogram; //公众号模板消息的数据 private String data; public String getAppid() { return appid; } public void setAppid(String appid) { this.appid = appid; } public String getTemplate_id() { return template_id; } public void setTemplate_id(String template_id) { this.template_id = template_id; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public String getMiniprogram() { return miniprogram; } public void setMiniprogram(String miniprogram) { this.miniprogram = miniprogram; } public String getData() { return data; } public void setData(String data) { this.data = data; } @Override public String toString() { return "MpTemplateMsg{" + "appid='" + appid + '\'' + ", template_id='" + template_id + '\'' + ", url='" + url + '\'' + ", miniprogram='" + miniprogram + '\'' + ", data='" + data + '\'' + '}'; } } phi-sms-feign/src/main/java/com/hz/sms/dto/ResponsesSendMessage.java
New file @@ -0,0 +1,58 @@ package com.hz.sms.dto; /** * 参数用于下发小程序和公众号统一的服务消息 (参数实体) */ public class ResponsesSendMessage { //标识 private String id; //获取到的凭证 private String accessToken; //用户openid,可以是小程序的openid,也可以是mp_template_msg.appid对应的公众号的openid private String touser; //小程序模板消息相关的信息,可以参考小程序模板消息接口; 有此节点则优先发送小程序模板消息;(小程序模板消息已下线,不用传此节点) private WeAppTemplateMsg weapp_template_msg; //公众号模板消息相关的信息,可以参考公众号模板消息接口;有此节点并且没有weapp_template_msg节点时,发送公众号模板消息 private MpTemplateMsg mp_template_msg; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getAccessToken() { return accessToken; } public void setAccessToken(String accessToken) { this.accessToken = accessToken; } public String getTouser() { return touser; } public void setTouser(String touser) { this.touser = touser; } public WeAppTemplateMsg getWeapp_template_msg() { return weapp_template_msg; } public void setWeapp_template_msg(WeAppTemplateMsg weapp_template_msg) { this.weapp_template_msg = weapp_template_msg; } public MpTemplateMsg getMp_template_msg() { return mp_template_msg; } public void setMp_template_msg(MpTemplateMsg mp_template_msg) { this.mp_template_msg = mp_template_msg; } } phi-sms-feign/src/main/java/com/hz/sms/dto/SmsGeneralSendDto.java
New file @@ -0,0 +1,103 @@ package com.hz.sms.dto; import java.text.SimpleDateFormat; import java.util.Date; public class SmsGeneralSendDto { /*标识*/ private String id; /*短信内容*/ private String msg; /*手机号码*/ private String phone; /*定时发送短信时间*/ private String sendtime; /*如需状态报告则传true*/ private String report = "false"; /*下发短信号码扩展码*/ private String extend; /*该条短信在您业务系统内的ID*/ private String uid; public SmsGeneralSendDto() { } public SmsGeneralSendDto(String id, String msg, String phone, String sendtime, String report, String extend, String uid) { this.id = id; this.msg = msg; this.phone = phone; this.sendtime = sendtime; this.report = report; this.extend = extend; this.uid = uid; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getSendtime() { return sendtime; } public Date getDateSendTime(){ try { Date dateSendTime = new SimpleDateFormat("yyyyMMddHHmm").parse(sendtime); return dateSendTime; }catch (Exception e){ return null; } } public void setSendtime(String sendtime) { this.sendtime = sendtime; } public String getReport() { return report; } public void setReport(String report) { this.report = report; } public String getExtend() { return extend; } public void setExtend(String extend) { this.extend = extend; } public String getUid() { return uid; } public void setUid(String uid) { this.uid = uid; } } phi-sms-feign/src/main/java/com/hz/sms/dto/TemplateMessageDto.java
New file @@ -0,0 +1,105 @@ package com.hz.sms.dto; public class TemplateMessageDto { /** 标识 */ private String id; /** 企业ID */ private String corpid; /** 成员ID列表(消息接收者,多个接收者用‘|’分隔,最多支持1000个) */ private String touser; /** 部门ID列表,多个接收者用‘|’分隔,最多支持100个。 */ private String toparty; /** 标签ID列表,多个接收者用‘|’分隔,最多支持100个。 */ private String totag; /** 消息类型 ,此时固定为:miniprogram_notice */ private String msgtype = "miniprogram_notice"; /** 参数内容 */ private TemplateMsgDto miniprogram_notice; /** 表示是否开启id转译,0表示否,1表示是,默认0 */ private Integer enable_id_trans = 0; /** 表示是否开启重复消息检查,0表示否,1表示是,默认0 */ private Integer enable_duplicate_check = 0; /** 表示是否重复消息检查的时间间隔,默认1800s,最大不超过4小时 */ private Integer duplicate_check_interval = 1800; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getCorpid() { return corpid; } public void setCorpid(String corpid) { this.corpid = corpid; } public String getTouser() { return touser; } public void setTouser(String touser) { this.touser = touser; } public String getToparty() { return toparty; } public void setToparty(String toparty) { this.toparty = toparty; } public String getTotag() { return totag; } public void setTotag(String totag) { this.totag = totag; } public String getMsgtype() { return msgtype; } public void setMsgtype(String msgtype) { this.msgtype = msgtype; } public TemplateMsgDto getMiniprogram_notice() { return miniprogram_notice; } public void setMiniprogram_notice(TemplateMsgDto miniprogram_notice) { this.miniprogram_notice = miniprogram_notice; } public Integer getEnable_id_trans() { return enable_id_trans; } public void setEnable_id_trans(Integer enable_id_trans) { this.enable_id_trans = enable_id_trans; } public Integer getEnable_duplicate_check() { return enable_duplicate_check; } public void setEnable_duplicate_check(Integer enable_duplicate_check) { this.enable_duplicate_check = enable_duplicate_check; } public Integer getDuplicate_check_interval() { return duplicate_check_interval; } public void setDuplicate_check_interval(Integer duplicate_check_interval) { this.duplicate_check_interval = duplicate_check_interval; } } phi-sms-feign/src/main/java/com/hz/sms/dto/TemplateMsgDto.java
New file @@ -0,0 +1,67 @@ package com.hz.sms.dto; import java.util.List; public class TemplateMsgDto { /** 小程序appid,必须是与当前应用关联的小程序 */ private String appid; /** 点击消息卡片后的小程序页面,最长1024个字节,仅限本小程序内的页面。该字段不填则消息点击后不跳转。 */ private String page; /** 消息标题,长度限制4-12个汉字(支持id转译)*/ private String title; /** 消息描述,长度限制4-12个汉字(支持id转译)*/ private String description; /** 是否放大第一个content_item*/ private boolean emphasis_first_item; /** 消息内容键值对,最多允许10个item*/ private List<ContentItemDto> content_item; public String getAppid() { return appid; } public void setAppid(String appid) { this.appid = appid; } public String getPage() { return page; } public void setPage(String page) { this.page = page; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public boolean isEmphasis_first_item() { return emphasis_first_item; } public void setEmphasis_first_item(boolean emphasis_first_item) { this.emphasis_first_item = emphasis_first_item; } public List<ContentItemDto> getContent_item() { return content_item; } public void setContent_item(List<ContentItemDto> content_item) { this.content_item = content_item; } } phi-sms-feign/src/main/java/com/hz/sms/dto/WeAppTemplateMsg.java
New file @@ -0,0 +1,54 @@ package com.hz.sms.dto; public class WeAppTemplateMsg { //小程序模板ID private String template_id; //小程序页面路径 private String page; //小程序模板消息formid private String from_id; //小程序模板放大关键词 private String emphasis_keyword; //小程序模板数据 private String data; public String getTemplate_id() { return template_id; } public void setTemplate_id(String template_id) { this.template_id = template_id; } public String getPage() { return page; } public void setPage(String page) { this.page = page; } public String getFrom_id() { return from_id; } public void setFrom_id(String from_id) { this.from_id = from_id; } public String getEmphasis_keyword() { return emphasis_keyword; } public void setEmphasis_keyword(String emphasis_keyword) { this.emphasis_keyword = emphasis_keyword; } public String getData() { return data; } public void setData(String data) { this.data = data; } } phi-sms-feign/src/main/java/com/hz/sms/feign/FSmsSendService.java
@@ -1,10 +1,12 @@ package com.hz.sms.feign; import com.hx.resultTool.Result; import com.hz.sms.dto.SmsGeneralSendDto; import com.hz.sms.dto.SmsSendDto; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.ResponseBody; /** * 这里这个name 需要填写 请求的服务提供者的注册到nacos Server上面的服务名,path 是请求接口前缀 @@ -27,5 +29,28 @@ @PostMapping(value = "/sms/identicalSend") Result sendIdenticalsend(@RequestBody SmsSendDto smsSendDto); /** * 发送短信验证码 * @param smsGeneralSendDto * @return */ @PostMapping(value = "/verification/code") Result sendVerificationCode(@RequestBody SmsGeneralSendDto smsGeneralSendDto); /** * 发送通知短信 * @param smsGeneralSendDto * @return */ @PostMapping(value = "/inform/sms") Result sendNoticeSms(@RequestBody SmsGeneralSendDto smsGeneralSendDto); /** * 发送营销短信 * @param smsGeneralSendDto * @return */ @PostMapping(value = "/marketing/sms") Result sendMarketingSend(@RequestBody SmsGeneralSendDto smsGeneralSendDto); } phi-sms-feign/src/main/java/com/hz/sms/feign/FSysSendService.java
New file @@ -0,0 +1,41 @@ package com.hz.sms.feign; import com.hx.resultTool.Result; import com.hz.sms.dto.ResponsesSendMessage; import com.hz.sms.dto.SmsGeneralSendDto; import com.hz.sms.dto.TemplateMessageDto; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; /** * 这里这个name 需要填写 请求的服务提供者的注册到nacos Server上面的服务名,path 是请求接口前缀 */ @FeignClient(name="phi-sms-user",path = "/sys",contextId = "sys-send") public interface FSysSendService { /** * 发送企业微信应用消息 * @param templateMessageDto * @return */ @PostMapping(value = "/application/message") Result sendNoticeSms(@RequestBody TemplateMessageDto templateMessageDto); /** * 微信小程序下发统一消息 * @param responsesSendMessage * @return */ @PostMapping(value = "/applet/message") Result sendAppletMessage(@RequestBody ResponsesSendMessage responsesSendMessage); /** * 微信公众号下发统一消息 * @param responsesSendMessage * @return */ @PostMapping(value = "/public/message") Result sendPublicMessage(@RequestBody ResponsesSendMessage responsesSendMessage); }