Przeglądaj źródła

预警历史数据查询

zhaoxian 4 lat temu
rodzic
commit
4ce1bafb25

+ 42 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/controller/AlarmEventSendController.java

@@ -3,10 +3,13 @@ package cn.com.ctop.alarm.modules.controller;
 import cn.com.ctop.alarm.modules.entity.AlarmEventSend;
 import cn.com.ctop.alarm.modules.service.IAlarmEventSendService;
 import cn.com.ctop.common.module.annotation.AutoLog;
+import cn.com.ctop.common.module.utils.Check;
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
@@ -81,6 +84,44 @@ public class AlarmEventSendController {
         return result;
     }
 
+    @AutoLog(value = "预警事件发送表-分页列表查询")
+    @ApiOperation(value = "预警事件发送表-分页列表查询", notes = "预警事件发送表-分页列表查询")
+    @GetMapping(value = "/pageList")
+    public Result<Object> queryPageLists(AlarmEventSend alarmEventSend,
+                                         @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                         @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                         HttpServletRequest req) {
+        try {
+            QueryWrapper<AlarmEventSend> queryWrapper = new QueryWrapper<>();
+            if (!Check.isNull(alarmEventSend.getGroupName())) {
+                queryWrapper.like("group_name", alarmEventSend.getGroupName());
+            }
+            if (!Check.isNull(alarmEventSend.getUserId())) {
+                queryWrapper.like("user_id", alarmEventSend.getUserId());
+            }
+            if (!Check.isNull(alarmEventSend.getAlarmDetail())) {
+                queryWrapper.like("alarm_detail", alarmEventSend.getAlarmDetail());
+            }
+            if (!Check.isNull(alarmEventSend.getMediaType())) {
+                queryWrapper.like("media_type", alarmEventSend.getMediaType());
+            }
+            if (!Check.isNull(alarmEventSend.getAccountId())) {
+                queryWrapper.eq("account_id", alarmEventSend.getAccountId());
+            }
+            if (!Check.isNull(alarmEventSend.getRuleDimension())) {
+                queryWrapper.eq("rule_dimension", alarmEventSend.getRuleDimension());
+            }
+            queryWrapper.orderByDesc("create_time");
+            PageHelper.startPage(pageNo, pageSize);
+            List<AlarmEventSend> list = alarmEventSendService.list(queryWrapper);
+            PageInfo<AlarmEventSend> pageInfo = new PageInfo<>(list);
+            return Result.ok(pageInfo);
+        } catch (Exception e) {
+            log.error("预警历史发送数据-分页列表查询异常", e);
+        }
+        return Result.error("查询失败");
+    }
+
     /**
      * 添加
      *
@@ -127,6 +168,7 @@ public class AlarmEventSendController {
         }
         return result;
     }
+
     /**
      * 编辑
      *

+ 1 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/entity/AlarmEventSend.java

@@ -34,6 +34,7 @@ public class AlarmEventSend {
     @TableId(type = IdType.AUTO)
     @ApiModelProperty(value = "主键id")
     private Long alarmSendId;
+    private Long accountId;
 
     private String userId;
     /**

+ 1 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/service/impl/RuleGroupServiceImpl.java

@@ -614,6 +614,7 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
                 send.setAlarmDetail(msg.replace("<br/>", ","));
                 send.setAlarmStatus(NoEn.NO1.valueStr());
                 send.setGroupId(ruleGroup.getId());
+                send.setAccountId(accountId);
                 send.setMediaType((NoEn.NO1.valueInt() == mediaType || NoEn.NO3.valueInt() == mediaType) ? "头条" : "快手");
                 send.setGroupName(ruleGroup.getGroupName());
                 if (CREATIVE.equals(type)) {