123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- package com.bosshand.virgo.controller;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.PathVariable;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
- import org.springframework.web.bind.annotation.RestController;
- import com.alibaba.fastjson.JSONObject;
- import com.bosshand.virgo.core.response.Response;
- import com.bosshand.virgo.message.model.NotificationMessage;
- import com.bosshand.virgo.message.service.MessageService;
- import io.swagger.annotations.ApiOperation;
- @RestController
- @RequestMapping(value = "message")
- public class MessageController {
- @Autowired
- private MessageService messageService;
- @ApiOperation(value = "个人消息列表", notes = "个人消息列表")
- @RequestMapping(value = "/{userId}", method = RequestMethod.GET)
- public Response getByUserId(@PathVariable long userId) {
- return Response.ok(messageService.getMessageByUserId(userId));
- }
- @ApiOperation(value = "待办事项", notes = "待办事项")
- @RequestMapping(value = "/backlog/{userId}", method = RequestMethod.GET)
- public Response backlog(@PathVariable long userId) {
- return Response.ok(messageService.getMessage(userId, false));
- }
- @ApiOperation(value = "已办事项", notes = "已办事项")
- @RequestMapping(value = "/finishBacklog/{userId}", method = RequestMethod.GET)
- public Response finishBacklog(@PathVariable long userId) {
- return Response.ok(messageService.getMessage(userId, true));
- }
- @ApiOperation(value = "审核消息发送", notes = "审核消息发送")
- @RequestMapping(value = "/", method = RequestMethod.POST)
- public Response pushMesssage(@RequestBody JSONObject parameter) {
- messageService.pushMessage(parameter);
- return Response.ok();
- }
- @ApiOperation(value = "其他消息发送", notes = "其他消息发送")
- @RequestMapping(value = "/{userIds}", method = RequestMethod.POST)
- public Response pushOtherMesssage(@PathVariable String userIds, @RequestBody NotificationMessage message) {
- messageService.pushOtherMesssage(userIds, message);
- return Response.ok();
- }
- @ApiOperation(value = "修改", notes = "修改")
- @RequestMapping(value = "/{id}", method = RequestMethod.PUT)
- public Response updateViewed(@PathVariable long id) {
- messageService.updateViewed(id);
- return Response.ok();
- }
- @ApiOperation(value = "详情", notes = "详情")
- @RequestMapping(value = "/get/{id}", method = RequestMethod.GET)
- public Response get(@PathVariable long id) {
- return Response.ok(messageService.get(id));
- }
- @ApiOperation(value = "根据type获取消息列表", notes = "根据type获取消息列表")
- @RequestMapping(value = "/messageType/{userId}/{messageType}", method = RequestMethod.GET)
- public Response getByUserId(@PathVariable int messageType, @PathVariable long userId) {
- return Response.ok(messageService.getMessageByUserId(messageType, userId));
- }
- @ApiOperation(value = "根据type统计未读消息", notes = "根据type统计未读消息")
- @RequestMapping(value = "/countUnread/messageType/{userId}/{messageType}", method = RequestMethod.GET)
- public Response countUnread(@PathVariable int messageType, @PathVariable long userId) {
- return Response.ok(messageService.countUnread(messageType, userId));
- }
- }
|