优化测试问题
This commit is contained in:
@@ -136,4 +136,9 @@ public interface MessageFeign {
|
||||
@ApiOperation("消息推送测试")
|
||||
@PostMapping("/pushTest")
|
||||
ResultBean pushTest(@RequestParam("userSid") String userSid);
|
||||
|
||||
@ApiOperation("发送短信通知")
|
||||
@PostMapping("/pushSms")
|
||||
ResultBean pushSms(@RequestBody PushSmsDto dto);
|
||||
|
||||
}
|
||||
@@ -115,4 +115,11 @@ public class MessageFeignFallback implements MessageFeign {
|
||||
public ResultBean pushTest(String userSid) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultBean pushSms(PushSmsDto dto) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.yxt.messagecenter.api.message;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Fan
|
||||
* @description
|
||||
* @date 2024/1/15 15:47
|
||||
*/
|
||||
@Data
|
||||
public class PushSmsDto {
|
||||
@ApiModelProperty("手机号")
|
||||
private String mobile;
|
||||
@ApiModelProperty("短信内容")
|
||||
private String msg;
|
||||
}
|
||||
@@ -196,4 +196,11 @@ public class MessageRest implements MessageFeign {
|
||||
public ResultBean pushTest(String userSid) {
|
||||
return messageService.pushTest(userSid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultBean pushSms(PushSmsDto dto) {
|
||||
return messageService.pushSms(dto);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1249,4 +1249,19 @@ public class MessageService extends MybatisBaseService<MessageMapper, Message> {
|
||||
}
|
||||
return rb.success();
|
||||
}
|
||||
|
||||
public ResultBean pushSms(PushSmsDto dto) {
|
||||
ResultBean rb = ResultBean.fireFail();
|
||||
//标题、内容、消息类别key、消息类别名称、
|
||||
YamlPropertiesFactoryBean factoryBean = new YamlPropertiesFactoryBean();
|
||||
factoryBean.setResources(new ClassPathResource("application.yml"));
|
||||
Properties properties = factoryBean.getObject();
|
||||
if ("pro".equals(properties.get("spring.profiles.active"))) {
|
||||
String res = MsgWs.SendWaitWorkMsg(dto.getMobile(), dto.getMsg());
|
||||
System.out.println("审批发送短信:" + res);
|
||||
return rb.success().setData(res);
|
||||
}
|
||||
// String res = MsgWs.SendWaitWorkMsg(dto.getMobile(), dto.getMsg());
|
||||
return rb.success();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user