CommonController.java
1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package cn.fw.hestia.server.controller.common;
import cn.fw.common.web.annotation.ControllerMethod;
import cn.fw.data.base.domain.common.Message;
import cn.fw.hestia.service.buz.MessageCenterBizService;
import cn.fw.security.auth.client.annotation.Authorization;
import cn.fw.security.auth.client.enums.AuthType;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import static cn.fw.common.web.util.ResultBuilder.success;
/**
* @author : kurisu
* @className : MessageCenterController
* @description :
* @date: 2021-09-23 15:39
*/
@Slf4j
@Validated
@RestController
@Authorization(AuthType.NONE)
@RequestMapping("/common/message")
public class CommonController {
private final MessageCenterBizService messageCenterBizService;
@Autowired
public CommonController(final MessageCenterBizService messageCenterBizService) {
this.messageCenterBizService = messageCenterBizService;
}
@GetMapping("/send")
@ControllerMethod("手动发送消息")
public Message<String> manualSend(@NotNull(message = "sceneToken不能为空") final Long sceneToken) {
return success(messageCenterBizService.manualSend(sceneToken));
}
@GetMapping("/change/code")
@ControllerMethod("修改模板码")
public Message<Void> changeCode(@NotEmpty(message = "模板码不能为空") final String code) {
messageCenterBizService.changeRdsTemplateCode(code);
return success();
}
@GetMapping("/query/code")
@ControllerMethod("查询模板码")
public Message<String> getCode() {
return success(messageCenterBizService.getRdsTemplateCode());
}
}