MessageCenterController.java
2.22 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
59
60
61
package cn.fw.hestia.server.controller.wx;
import cn.fw.common.page.AppPage;
import cn.fw.common.web.annotation.ControllerMethod;
import cn.fw.common.web.auth.PassportAuthBean;
import cn.fw.common.web.auth.annotation.CurrentUser;
import cn.fw.data.base.domain.common.Message;
import cn.fw.hestia.domain.vo.HistoryQuery;
import cn.fw.hestia.domain.vo.MessageHistoryVO;
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.NotNull;
import java.util.Map;
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.WECHAT)
@RequestMapping("/wx/message")
public class MessageCenterController {
private final MessageCenterBizService messageCenterBizService;
@Autowired
public MessageCenterController(final MessageCenterBizService messageCenterBizService) {
this.messageCenterBizService = messageCenterBizService;
}
@GetMapping("/unread")
@ControllerMethod("查询消息未读数")
public Message<Integer> send(@CurrentUser PassportAuthBean user) {
return success(messageCenterBizService.unreadCount(user.getUserId()));
}
@GetMapping("/query/pageParams")
@ControllerMethod("查询小程序页面的参数")
public Message<Map<String, String>> queryPageParams(@NotNull(message = "sceneToken不能为空") final Long sceneToken) {
return success(messageCenterBizService.queryPageParams(sceneToken));
}
@GetMapping("/query/history")
@ControllerMethod("查询消息历史记录")
public Message<AppPage<MessageHistoryVO>> queryHistory(HistoryQuery query) {
return success(messageCenterBizService.queryHistory(query));
}
}