value
2024-05-27 cdefd6a50721e2c4ba6df850e1405419f9df3c31
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package com.yuanchu.mom.controller;
 
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yuanchu.mom.annotation.ValueAuth;
import com.yuanchu.mom.pojo.InformationNotification;
import com.yuanchu.mom.service.InformationNotificationService;
import com.yuanchu.mom.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.util.Map;
 
/**
 * <p>
 * 消息通知 前端控制器
 * </p>
 *
 * @author 江苏鵷雏网络科技有限公司
 * @since 2024-04-23 02:14:30
 */
@Api(tags = "消息通知")
@RestController
@RequestMapping("/informationNotification")
public class InformationNotificationController {
 
    @Autowired
    private InformationNotificationService informationNotificationService;
 
    @ApiOperation(value = "消息通知-滚动分页查询")
    @GetMapping("page")
    @ValueAuth
    public Result<?> getPage(Long size, Long current, String messageType) {
        return Result.success(informationNotificationService.getPage(new Page<>(current, size), messageType));
    }
 
    @ApiOperation(value = "消息通知-更新消息状态(拒绝、接收)")
    @PutMapping("updateMessageStatus")
    @ValueAuth
    public Result<?> updateMessageStatus(@RequestBody InformationNotification informationNotification) {
        informationNotificationService.updateById(informationNotification);
        return Result.success();
    }
 
    @ApiOperation(value = "消息通知-标记所有信息为已读/删除所有已读消息")
    @PutMapping("informationReadOrDelete/{isMarkAllInformationRead}")
    @ValueAuth
    public Result<?> markAllInformationReadOrDeleteAllReadMessages(@PathVariable("isMarkAllInformationRead") Boolean isMarkAllInformationRead) {
        informationNotificationService.markAllInformationReadOrDeleteAllReadMessages(isMarkAllInformationRead);
        return Result.success();
    }
 
    @ApiOperation(value = "消息通知-删除数据")
    @DeleteMapping("deleteDataBasedOnId")
    @ValueAuth
    public Result<?> deleteDataBasedOnId(Integer id) {
        informationNotificationService.removeById(id);
        return Result.success();
    }
 
    @ApiOperation(value = "消息通知-查询是否存在未读数据")
    @GetMapping("checkForUnreadData")
    @ValueAuth
    public Result<?> checkForUnreadData() {
        return Result.success(informationNotificationService.checkForUnreadData());
    }
 
    @ApiOperation(value = "消息通知-点击详情触发修改状态为已读")
    @PutMapping("triggerModificationStatusToRead/{id}")
    @ValueAuth
    public Result<?> triggerModificationStatusToRead(@PathVariable("id") Integer id) {
        informationNotificationService.triggerModificationStatusToRead(id);
        return Result.success();
    }
 
    @ApiOperation(value = "消息通知-获取首页四种消息数量")
    @GetMapping("getNumberFourTypesMessagesHomePage")
    @ValueAuth
    public Result<?> getNumberFourTypesMessagesHomePage() {
        Map<String, Object> data = informationNotificationService.getNumberFourTypesMessagesHomePage();
        return Result.success(data);
    }
}