Browse Source

# 消息模块日志注解添加

zhongwei
haungxing 8 months ago
parent
commit
8974b6ef99
  1. 20
      hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessagePushRecordController.java
  2. 8
      hzims-service/message/src/main/java/com/hnac/hzims/message/controller/web/MessageStatisticsController.java

20
hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessagePushRecordController.java

@ -5,13 +5,14 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.common.logs.annotation.OperationAnnotation;
import com.hnac.hzims.common.logs.enums.BusinessType;
import com.hnac.hzims.common.logs.enums.OperatorType;
import com.hnac.hzims.message.MessageConstants; import com.hnac.hzims.message.MessageConstants;
import com.hnac.hzims.message.entity.MessagePushRecordEntity; import com.hnac.hzims.message.entity.MessagePushRecordEntity;
import com.hnac.hzims.message.service.IMessagePushRecordService; import com.hnac.hzims.message.service.IMessagePushRecordService;
import com.hnac.hzims.message.vo.UnreadMessageVO; import com.hnac.hzims.message.vo.UnreadMessageVO;
import com.hnac.hzinfo.log.annotation.Business;
import com.hnac.hzinfo.log.annotation.Operate;
import com.hnac.hzinfo.log.contants.BusinessType;
import com.hnac.hzinfo.log.contants.Risk;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
@ -30,6 +31,7 @@ import java.util.List;
@RequestMapping("/message/record") @RequestMapping("/message/record")
@Api(value = "消息推送记录", tags = "消息推送记录") @Api(value = "消息推送记录", tags = "消息推送记录")
@AllArgsConstructor @AllArgsConstructor
@Business(module = MessageConstants.APP_NAME,value = "消息中心管理",ignore = false)
public class MessagePushRecordController extends BladeController { public class MessagePushRecordController extends BladeController {
private final IMessagePushRecordService messagePushRecordService; private final IMessagePushRecordService messagePushRecordService;
@ -37,6 +39,7 @@ public class MessagePushRecordController extends BladeController {
@PostMapping("/save") @PostMapping("/save")
@ApiOperation("保存消息推送") @ApiOperation("保存消息推送")
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 1)
@Operate(label = "保存消息推送记录",type = BusinessType.INSERT,risk = Risk.LOW,ignore = false)
public R<Boolean> save(@RequestBody MessagePushRecordEntity request) { public R<Boolean> save(@RequestBody MessagePushRecordEntity request) {
return R.status(messagePushRecordService.save(request)); return R.status(messagePushRecordService.save(request));
} }
@ -44,6 +47,7 @@ public class MessagePushRecordController extends BladeController {
@PostMapping("/update") @PostMapping("/update")
@ApiOperation("更新消息推送记录") @ApiOperation("更新消息推送记录")
@ApiOperationSupport(order = 2) @ApiOperationSupport(order = 2)
@Operate(label = "保存消息推送记录",type = BusinessType.UPDATE,risk = Risk.LOW,ignore = false)
public R<Boolean> update(@RequestBody MessagePushRecordEntity request) { public R<Boolean> update(@RequestBody MessagePushRecordEntity request) {
return R.status(messagePushRecordService.updateById(request)); return R.status(messagePushRecordService.updateById(request));
} }
@ -51,6 +55,7 @@ public class MessagePushRecordController extends BladeController {
@GetMapping("/list") @GetMapping("/list")
@ApiOperation("查询消息推送记录列表") @ApiOperation("查询消息推送记录列表")
@ApiOperationSupport(order = 3) @ApiOperationSupport(order = 3)
@Operate(label = "查询消息推送记录列表",type = BusinessType.QUERY,ignore = false)
public R<List<MessagePushRecordEntity>> list(MessagePushRecordEntity request) { public R<List<MessagePushRecordEntity>> list(MessagePushRecordEntity request) {
return R.data(messagePushRecordService.listNoUserScope(request)); return R.data(messagePushRecordService.listNoUserScope(request));
} }
@ -58,10 +63,7 @@ public class MessagePushRecordController extends BladeController {
@GetMapping("/listPage") @GetMapping("/listPage")
@ApiOperation("分页查询消息推送记录列表") @ApiOperation("分页查询消息推送记录列表")
@ApiOperationSupport(order = 4) @ApiOperationSupport(order = 4)
@OperationAnnotation( @Operate(label = "查询消息推送记录分页列表",type = BusinessType.QUERY,ignore = false)
moduleName = "消息管理",
title = "消息管理", operatorType = OperatorType.MOBILE, businessType = BusinessType.GENCODE,
action = "分页查询消息推送记录列表")
public R<IPage<MessagePushRecordEntity>> listPage(MessagePushRecordEntity request, Query query) { public R<IPage<MessagePushRecordEntity>> listPage(MessagePushRecordEntity request, Query query) {
return R.data(messagePushRecordService.listPageNoUserScope(request, query)); return R.data(messagePushRecordService.listPageNoUserScope(request, query));
} }
@ -69,6 +71,7 @@ public class MessagePushRecordController extends BladeController {
@GetMapping("/send/{id}") @GetMapping("/send/{id}")
@ApiOperation("推送消息记录") @ApiOperation("推送消息记录")
@ApiOperationSupport(order = 5) @ApiOperationSupport(order = 5)
@Operate(label = "根据消息记录发送消息",type = BusinessType.UPDATE,risk = Risk.LOW,ignore = false)
public R<Boolean> send(@PathVariable @ApiParam("消息记录ID") Long id) { public R<Boolean> send(@PathVariable @ApiParam("消息记录ID") Long id) {
return R.data(messagePushRecordService.send(id)); return R.data(messagePushRecordService.send(id));
} }
@ -76,6 +79,7 @@ public class MessagePushRecordController extends BladeController {
@GetMapping("/readMessage/{id}") @GetMapping("/readMessage/{id}")
@ApiOperation("读取消息") @ApiOperation("读取消息")
@ApiOperationSupport(order = 6) @ApiOperationSupport(order = 6)
@Operate(label = "将消息设为已读",type = BusinessType.UPDATE,risk = Risk.LOW,ignore = false)
public R<Boolean> readMessage(@PathVariable @ApiParam("消息记录ID") String id) { public R<Boolean> readMessage(@PathVariable @ApiParam("消息记录ID") String id) {
MessagePushRecordEntity record = messagePushRecordService.getById(id); MessagePushRecordEntity record = messagePushRecordService.getById(id);
if (!(Long.parseLong(record.getPusher()) == AuthUtil.getUserId())) { if (!(Long.parseLong(record.getPusher()) == AuthUtil.getUserId())) {
@ -91,6 +95,7 @@ public class MessagePushRecordController extends BladeController {
@GetMapping("/readMessageBatch") @GetMapping("/readMessageBatch")
@ApiOperation("批量处理消息") @ApiOperation("批量处理消息")
@ApiOperationSupport(order = 7) @ApiOperationSupport(order = 7)
@Operate(label = "批量将消息设为已读",type = BusinessType.UPDATE,risk = Risk.LOW,ignore = false)
public R<Boolean> readMessageBatch(@RequestParam(required = false) String businessClassify,@RequestParam(required = false) String type) { public R<Boolean> readMessageBatch(@RequestParam(required = false) String businessClassify,@RequestParam(required = false) String type) {
LambdaUpdateWrapper<MessagePushRecordEntity> eq = Wrappers.<MessagePushRecordEntity>lambdaUpdate() LambdaUpdateWrapper<MessagePushRecordEntity> eq = Wrappers.<MessagePushRecordEntity>lambdaUpdate()
.set(MessagePushRecordEntity::getStatus, MessageConstants.CONFIRM) .set(MessagePushRecordEntity::getStatus, MessageConstants.CONFIRM)
@ -113,6 +118,7 @@ public class MessagePushRecordController extends BladeController {
@GetMapping("/getPersonalAppUnreadMessage") @GetMapping("/getPersonalAppUnreadMessage")
@ApiOperation("获取当前登录人APP待办消息") @ApiOperation("获取当前登录人APP待办消息")
@ApiOperationSupport(order = 9) @ApiOperationSupport(order = 9)
@Operate(label = "获取当前登录人APP待办消息",type = BusinessType.QUERY,ignore = false)
public R<List<UnreadMessageVO>> getPersonalAppUnreadMessage() { public R<List<UnreadMessageVO>> getPersonalAppUnreadMessage() {
List<UnreadMessageVO> personalUnreadMessage = messagePushRecordService.getPersonalAppUnreadMessage(); List<UnreadMessageVO> personalUnreadMessage = messagePushRecordService.getPersonalAppUnreadMessage();
return R.data(personalUnreadMessage); return R.data(personalUnreadMessage);

8
hzims-service/message/src/main/java/com/hnac/hzims/message/controller/web/MessageStatisticsController.java

@ -1,7 +1,11 @@
package com.hnac.hzims.message.controller.web; package com.hnac.hzims.message.controller.web;
import com.hnac.hzims.message.MessageConstants;
import com.hnac.hzims.message.service.IMessagePushRecordService; import com.hnac.hzims.message.service.IMessagePushRecordService;
import com.hnac.hzims.message.vo.msgpushrecord.*; import com.hnac.hzims.message.vo.msgpushrecord.*;
import com.hnac.hzinfo.log.annotation.Business;
import com.hnac.hzinfo.log.annotation.Operate;
import com.hnac.hzinfo.log.contants.BusinessType;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
@ -21,6 +25,7 @@ import java.util.List;
@RestController @RestController
@RequiredArgsConstructor @RequiredArgsConstructor
@RequestMapping("/message/statistics") @RequestMapping("/message/statistics")
@Business(module = MessageConstants.APP_NAME,value = "消息推送统计管理",ignore = false)
public class MessageStatisticsController { public class MessageStatisticsController {
@ -32,6 +37,7 @@ public class MessageStatisticsController {
* @return * @return
*/ */
@GetMapping("/smsPushStat") @GetMapping("/smsPushStat")
@Operate(label = "过去一年消息记录类型分组统计图",type = BusinessType.QUERY,ignore = false)
public R smsPushStat(MessagePushRecordEntityVo vo) { public R smsPushStat(MessagePushRecordEntityVo vo) {
log.info("短信推送统计"); log.info("短信推送统计");
List<MessagePushRecordTypeVo> messagePushRecordVos = messagePushRecordService.smsPushStat(vo); List<MessagePushRecordTypeVo> messagePushRecordVos = messagePushRecordService.smsPushStat(vo);
@ -69,6 +75,7 @@ public class MessageStatisticsController {
* 新人员发送统计 * 新人员发送统计
*/ */
@GetMapping("/userPushStat") @GetMapping("/userPushStat")
@Operate(label = "过去一年消息记录推送人员分组统计图",type = BusinessType.QUERY,ignore = false)
public R userPushStat(MessagePushRecordEntityVo vo) { public R userPushStat(MessagePushRecordEntityVo vo) {
log.info("人员发送统计"); log.info("人员发送统计");
UserPushStatTypeResponseVo messagePushRecordVos = messagePushRecordService.newUserPushStat(vo); UserPushStatTypeResponseVo messagePushRecordVos = messagePushRecordService.newUserPushStat(vo);
@ -81,6 +88,7 @@ public class MessageStatisticsController {
* 推送成功失败统计 * 推送成功失败统计
*/ */
@GetMapping("/pushStat") @GetMapping("/pushStat")
@Operate(label = "过去一年消息记录推送结果分组统计图",type = BusinessType.QUERY,ignore = false)
public R pushStat(MessagePushRecordEntityVo vo) { public R pushStat(MessagePushRecordEntityVo vo) {
List<PushStatTypeVo> messagePushRecordVos = messagePushRecordService.pushStat(vo); List<PushStatTypeVo> messagePushRecordVos = messagePushRecordService.pushStat(vo);
log.info("推送成功失败统计 返回的数据: {}",messagePushRecordVos); log.info("推送成功失败统计 返回的数据: {}",messagePushRecordVos);

Loading…
Cancel
Save