| | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | |
| | | @Api(tags="消息管理接口") |
| | | @Api(tags="消息管理接口") |
| | | @Controller |
| | | @CrossOrigin(origins="*",maxAge=3600) |
| | | @RequestMapping(value = "/msg/msg/") |
| | | public class MsgInfoController { |
| | | |
| | | // 分页查询中,默认记录条数和页数 |
| | | // 分页查询中,默认记录条数和页数 |
| | | private static final int DEFAULT_PAGE_SIZE = 10; |
| | | private static final int DEFAULT_PAGE_NUM = 1; |
| | | |
| | |
| | | IMsgInfoService msgInfoService; |
| | | |
| | | /** |
| | | * 消息列表 |
| | | * 消息列表 |
| | | */ |
| | | @ApiOperation(value = "获取消息列表") |
| | | @ApiOperation(value = "获取消息列表") |
| | | @RequestMapping(value = "list", method = RequestMethod.GET) |
| | | public @ResponseBody Result list(Short type,Integer pageSize,Integer pageNum) { |
| | | pageSize = pageSize != null && pageSize > 0 ? pageSize : DEFAULT_PAGE_SIZE; |
| | | pageNum = pageNum != null && pageNum > 0 ? pageNum : DEFAULT_PAGE_NUM; |
| | | |
| | | //消息数量 |
| | | //消息数量 |
| | | int totalCount = msgInfoService.listCount(type); |
| | | Pager pager = new Pager(pageSize,pageNum); |
| | | pager.setTotalCount(totalCount); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 删除消息 |
| | | * 删除消息 |
| | | * @param msgIds |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "删除消息") |
| | | @ApiOperation(value = "删除消息") |
| | | @RequestMapping(value = "delete", method = RequestMethod.GET) |
| | | public @ResponseBody Result deleteUserMsg(String msgIds){ |
| | | if(StringUtils.isEmpty(msgIds)){ |
| | | return new Result(false,"参数错误!"); |
| | | return new Result(false,"参数错误!"); |
| | | } |
| | | |
| | | return this.msgInfoService.deleteUserMsg(msgIds.split(",")); |
| | | } |
| | | |
| | | /** |
| | | * 清空个人消息 |
| | | * 清空个人消息 |
| | | * |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "清空消息") |
| | | @ApiOperation(value = "清空消息") |
| | | @RequestMapping(value = "clear", method = RequestMethod.GET) |
| | | public @ResponseBody Result deleteAllUserMsg(Short type){ |
| | | return this.msgInfoService.deleteAllUserMsg(type); |
| | | } |
| | | |
| | | /** |
| | | * 修改已读标志位 |
| | | * 修改已读标志位 |
| | | * @param msgId |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "更新为已读") |
| | | @ApiOperation(value = "更新为已读") |
| | | @RequestMapping(value = "read", method = RequestMethod.GET) |
| | | public @ResponseBody Result updateReadFlag(String msgIds){ |
| | | return this.msgInfoService.updateReadStatus(msgIds.split(",")); |
| | | } |
| | | |
| | | /** |
| | | * 全部已读 |
| | | * 全部已读 |
| | | * @param msgId |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "全部更新为已读") |
| | | @ApiOperation(value = "全部更新为已读") |
| | | @RequestMapping(value = "readall", method = RequestMethod.GET) |
| | | public @ResponseBody Result updateAllUserReadFlag(Short type){ |
| | | return this.msgInfoService.updateUserAllReadStatus(type); |
| | |
| | | |
| | | |
| | | /** |
| | | * 最近的提醒消息 |
| | | * 最近的提醒消息 |
| | | * @param msgId |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "最近的一条提醒信息") |
| | | @ApiOperation(value = "最近的一条提醒信息") |
| | | @RequestMapping(value = "last", method = RequestMethod.GET) |
| | | public @ResponseBody Result getLatest(){ |
| | | return new Result(true,"",this.msgInfoService.readLastRemindMsg()); |
| | |
| | | |
| | | |
| | | /** |
| | | * 最近的提醒消息 |
| | | * 最近的提醒消息 |
| | | * @param msgId |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "按类型获取未读消息的数量") |
| | | @ApiOperation(value = "按类型获取未读消息的数量") |
| | | @RequestMapping(value = "count", method = RequestMethod.GET) |
| | | public @ResponseBody Result queryUnReadMsgCountByType(){ |
| | | return new Result(true,"",this.msgInfoService.queryUnReadMsgCountByType()); |
| | | } |
| | | |
| | | /** |
| | | * 查询未读消息总数 |
| | | * 查询未读消息总数 |
| | | * @param msgId |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "查询用户未读消息总数") |
| | | @ApiOperation(value = "查询用户未读消息总数") |
| | | @RequestMapping(value = "totalcount", method = RequestMethod.GET) |
| | | public @ResponseBody Result queryUnReadTotalCount(){ |
| | | return new Result(true,"",CollectionUtils.newObjectMap("totalCount",this.msgInfoService.queryUnReadTotalCount())); |