SysMessageController.java 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. package com.ym.mec.web.controller;
  2. import com.ym.mec.auth.api.client.SysUserFeignService;
  3. import com.ym.mec.auth.api.entity.SysUser;
  4. import com.ym.mec.biz.dal.entity.ChargeType;
  5. import com.ym.mec.biz.dal.entity.SysMessage;
  6. import com.ym.mec.biz.service.ChargeTypeService;
  7. import com.ym.mec.biz.service.SysMessageService;
  8. import com.ym.mec.common.controller.BaseController;
  9. import com.ym.mec.common.page.QueryInfo;
  10. import com.ym.mec.common.security.SecurityUtils;
  11. import io.swagger.annotations.Api;
  12. import io.swagger.annotations.ApiOperation;
  13. import io.swagger.annotations.ApiParam;
  14. import org.springframework.beans.factory.annotation.Autowired;
  15. import org.springframework.web.bind.annotation.*;
  16. import java.util.Date;
  17. @RequestMapping("message")
  18. @Api(tags = "消息提醒服务")
  19. @RestController
  20. public class SysMessageController extends BaseController {
  21. @Autowired
  22. private SysMessageService sysMessageService;
  23. @Autowired
  24. private SysUserFeignService sysUserFeignService;
  25. @ApiOperation(value = "新增消息提醒")
  26. @PostMapping("/add")
  27. public Object add(SysMessage sysMessage) {
  28. sysMessageService.insert(sysMessage);
  29. return succeed();
  30. }
  31. @ApiOperation(value = "删除消息提醒")
  32. @PostMapping("/del/{id}")
  33. @ApiParam(value = "消息提醒编号", required = true)
  34. public Object del( @PathVariable("id") Long id) {
  35. sysMessageService.delete(id);
  36. return succeed();
  37. }
  38. @ApiOperation(value = "修改消息提醒")
  39. @PostMapping("/update")
  40. public Object update(SysMessage sysMessage) {
  41. // sysMessage.setUpdateTime(new Date());
  42. sysMessageService.update(sysMessage);
  43. return succeed();
  44. }
  45. @ApiOperation(value = "获取用户未读消息条数")
  46. @PostMapping("/findNewMessageNum")
  47. public Object findNewMessageNum(){
  48. SysUser sysUser = sysUserFeignService.queryUserInfo();
  49. if(sysUser == null){
  50. return failed("请重新登录");
  51. }
  52. return succeed(sysMessageService.findNewMessageNum(sysUser.getId()));
  53. }
  54. @ApiOperation(value = "分页查询消息提醒列表")
  55. @GetMapping("/queryPage")
  56. public Object queryPage(QueryInfo queryInfo) {
  57. return succeed(sysMessageService.queryPage(queryInfo));
  58. }
  59. }