phi-sms-feign/src/main/java/com/hz/sms/dto/ResponsesSendMessage.java
@@ -1,58 +1,26 @@ package com.hz.sms.dto; import lombok.Data; /** * 参数用于下发小程序和公众号统一的服务消息 (参数实体) */ @Data public class ResponsesSendMessage { //标识 //小程序 appId private String appId; //标识 (记录wx_wechat表数据的id) 不用传 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; } // 发送状态 (0: 立即发送; 1:异步发送) private Integer sendStatus; } phi-sms-feign/src/main/java/com/hz/sms/dto/ResponsesWxSendMpDto.java
@@ -24,6 +24,8 @@ private String lang; /** 模板内容*/ private JSONObject data; /** 发送状态 (0: 立即发送; 1:异步发送)*/ private Integer sendStatus; public String getLang() { if (StringUtils.isEmpty(lang)){ phi-sms-feign/src/main/java/com/hz/sms/dto/SmsGeneralSendDto.java
@@ -1,14 +1,25 @@ package com.hz.sms.dto; import com.hx.util.StringUtils; import lombok.Data; import java.text.SimpleDateFormat; import java.util.Date; @Data public class SmsGeneralSendDto { /*标识*/ /* 标识 (记录sms_general_item表数据的id)*/ private String id; /* 账号*/ private String account; /* 密码*/ private String password; /*签名*/ private String sign; /* 定时短信时间,格式为yyyyMMddHHmm,值小于或等于当前时间则立即发送,默认立即发送*/ private String timestamp; /*短信内容*/ private String msg; /*手机号码*/ @@ -16,53 +27,17 @@ /*定时发送短信时间*/ private String sendtime; /*如需状态报告则传true*/ private String report = "false"; private String report; /*下发短信号码扩展码*/ private String extend; /*该条短信在您业务系统内的ID*/ private String uid; /*短信类型*/ private Integer smsType; /* 发送状态 (0: 立即发送; 1:异步发送)*/ private Integer sendStatus; 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); @@ -72,32 +47,10 @@ } } public void setSendtime(String sendtime) { this.sendtime = sendtime; } public String getReport() { if (!StringUtils.isEmpty(report) && !"true".equals(report)){ return null; } 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
@@ -1,105 +1,62 @@ package com.hz.sms.dto; import lombok.Data; import org.apache.commons.lang.StringUtils; import org.springframework.util.ObjectUtils; @Data public class TemplateMessageDto { /** 标识 */ /** 企业微信id*/ private String corpId; /** 关联小程序id*/ private String appId; /** 标识 (记录corp_wx_application表数据的id) (不用传)*/ private String id; /** 企业ID */ private String corpid; /** 成员ID列表(消息接收者,多个接收者用‘|’分隔,最多支持1000个) */ private String touser; private String touSer; /** 部门ID列表,多个接收者用‘|’分隔,最多支持100个。 */ private String toparty; /** 标签ID列表,多个接收者用‘|’分隔,最多支持100个。 */ private String totag; private String toTag; /** 消息类型 ,此时固定为:miniprogram_notice */ private String msgtype = "miniprogram_notice"; private String msgType; /** 参数内容 */ private TemplateMsgDto miniprogram_notice; /** 表示是否开启id转译,0表示否,1表示是,默认0 */ private Integer enable_id_trans = 0; private Integer enable_id_trans; /** 表示是否开启重复消息检查,0表示否,1表示是,默认0 */ private Integer enable_duplicate_check = 0; private Integer enable_duplicate_check; /** 表示是否重复消息检查的时间间隔,默认1800s,最大不超过4小时 */ private Integer duplicate_check_interval = 1800; private Integer duplicate_check_interval; /** 发送状态 (0: 立即发送; 1:异步发送)*/ private Integer sendStatus; public String getId() { return id; public String getMsgType() { if (!StringUtils.isEmpty(msgType) && !"miniprogram_notice".equals(msgType)){ return null; } return msgType; } 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() { if (ObjectUtils.isEmpty(enable_id_trans)){ return null; } 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() { if (ObjectUtils.isEmpty(enable_duplicate_check)){ return null; } 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() { if (ObjectUtils.isEmpty(duplicate_check_interval)){ return null; } 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/feign/FCorpWXSendService.java
New file @@ -0,0 +1,22 @@ package com.hz.sms.feign; import com.hx.resultTool.Result; 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 = "/sms",contextId = "send-corpwx") public interface FCorpWXSendService { /** * 发送企业微信应用消息 * @param templateMessageDto * @return */ @PostMapping(value = "/corp-wx-send/application/message") Result sendNoticeSms(@RequestBody TemplateMessageDto templateMessageDto); } phi-sms-feign/src/main/java/com/hz/sms/feign/FSmsSendService.java
@@ -2,16 +2,14 @@ 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 是请求接口前缀 */ @FeignClient(name="phi-sms-user",path = "/sms",contextId = "sms-send") @FeignClient(name="phi-sms-user",path = "/sms",contextId = "send-sms") public interface FSmsSendService { /** @@ -19,7 +17,7 @@ * @param smsGeneralSendDto * @return */ @PostMapping(value = "/send/verification/code") @PostMapping(value = "/send-general/item/send/verification/code") Result sendVerificationCode(@RequestBody SmsGeneralSendDto smsGeneralSendDto); /** @@ -27,7 +25,7 @@ * @param smsGeneralSendDto * @return */ @PostMapping(value = "/send/inform") @PostMapping(value = "/send-general/item/send/inform") Result sendNoticeSms(@RequestBody SmsGeneralSendDto smsGeneralSendDto); /** @@ -35,7 +33,7 @@ * @param smsGeneralSendDto * @return */ @PostMapping(value = "/send/marketing") @PostMapping(value = "/send-general/item/send/marketing") Result sendMarketingSend(@RequestBody SmsGeneralSendDto smsGeneralSendDto); } phi-sms-feign/src/main/java/com/hz/sms/feign/FWXSendService.java
@@ -1,10 +1,9 @@ package com.hz.sms.feign; import com.hx.resultTool.Result; import com.hz.sms.dto.ResponsesSendMessage; import com.hz.sms.dto.ResponsesWxSendMpDto; 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; @@ -13,23 +12,15 @@ /** * 这里这个name 需要填写 请求的服务提供者的注册到nacos Server上面的服务名,path 是请求接口前缀 */ @FeignClient(name="phi-sms-user",path = "/sms",contextId = "sys-send") @FeignClient(name="phi-sms-user",path = "/sms",contextId = "send-wx") public interface FWXSendService { /** * 发送企业微信应用消息 * @param templateMessageDto * @return */ @PostMapping(value = "/application/message") Result sendNoticeSms(@RequestBody TemplateMessageDto templateMessageDto); /** * 微信小程序下发统一消息 (废除) * @param responsesSendMessage * @return */ @PostMapping(value = "/applet/message") @PostMapping(value = "/wx/send/applet/message") Result sendAppletMessage(@RequestBody ResponsesSendMessage responsesSendMessage); /** @@ -37,7 +28,7 @@ * @param responsesSendMessage * @return */ @PostMapping(value = "/wechat/message") @PostMapping(value = "/wx/send/wechat/message") Result sendWeChatMessage(@RequestBody ResponsesSendMessage responsesSendMessage); /** @@ -45,6 +36,6 @@ * @param responsesWxSendMpDto * @return */ @RequestMapping(value = "/mp/subscribe/message") @RequestMapping(value = "/wx/send/mp/subscribe/message") Result sendMpMessage(@RequestBody ResponsesWxSendMpDto responsesWxSendMpDto); } phi-sms-feign/src/main/java/com/hz/sms/platform/FCorpWxImmediatelyService.java
New file @@ -0,0 +1,23 @@ package com.hz.sms.platform; import com.hx.resultTool.Result; 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-rocketmq", path = "/sms",contextId = "sms-corpwx") public interface FCorpWxImmediatelyService { /** * 发送企业微信应用消息 * @param templateMessageDto * @return */ @PostMapping(value = "/immediately/send/corp-wx/application/message") Result sendNoticeSms(@RequestBody TemplateMessageDto templateMessageDto); } phi-sms-feign/src/main/java/com/hz/sms/platform/FSmsImmediatelyService.java
New file @@ -0,0 +1,39 @@ package com.hz.sms.platform; import com.hx.resultTool.Result; import com.hz.sms.dto.SmsGeneralSendDto; 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-rocketmq", path = "/sms",contextId = "sms") public interface FSmsImmediatelyService { /** * 发送短信验证码 * @param smsGeneralSendDto * @return */ @PostMapping(value = "/immediately/send/sms/verification/code") Result sendVerificationCode(@RequestBody SmsGeneralSendDto smsGeneralSendDto); /** * 发送通知短信 * @param smsGeneralSendDto * @return */ @PostMapping(value = "/immediately/send/sms/notice") Result sendNoticeSms(@RequestBody SmsGeneralSendDto smsGeneralSendDto); /** * 发送营销短信 * @param smsGeneralSendDto * @return */ @PostMapping(value = "/immediately/send/sms/marketing") Result sendMarketingSend(@RequestBody SmsGeneralSendDto smsGeneralSendDto); } phi-sms-feign/src/main/java/com/hz/sms/platform/FWxImmediatelyService.java
New file @@ -0,0 +1,33 @@ package com.hz.sms.platform; import com.hx.resultTool.Result; import com.hz.sms.dto.ResponsesSendMessage; import com.hz.sms.dto.ResponsesWxSendMpDto; 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.RequestMapping; /** * 这里这个name 需要填写 请求的服务提供者的注册到nacos Server上面的服务名,path 是请求接口前缀 */ @FeignClient(name="phi-sms-rocketmq", path = "/sms",contextId = "sms-wx") public interface FWxImmediatelyService { /** * 微信公众号下发统一消息 * @param responsesSendMessage * @return */ @PostMapping(value = "/immediately/send/wechat/message") Result sendWeChatMessage(@RequestBody ResponsesSendMessage responsesSendMessage); /** * 微信小程序发送订阅消息 * @param responsesWxSendMpDto * @return */ @RequestMapping(value = "/immediately/send/mp/message") Result sendMpMessage(@RequestBody ResponsesWxSendMpDto responsesWxSendMpDto); }