From 8321d64987d51ebe4400c474103c507b4beaa6f5 Mon Sep 17 00:00:00 2001 From: lau572 <1010031226@qq.com> Date: Thu, 6 Jun 2024 18:59:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=BC=B9=E7=AA=97=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/DcEventController.java | 14 +++++++++ .../com/zc/business/mapper/DcEventMapper.java | 2 ++ .../zc/business/mapper/DcWarningMapper.java | 2 ++ .../zc/business/service/IDcEventService.java | 10 +++++++ .../service/impl/DcEventServiceImpl.java | 29 +++++++++++++++++++ .../mapper/business/DcEventMapper.xml | 3 ++ .../mapper/business/DcWarningMapper.xml | 3 ++ 7 files changed, 63 insertions(+) diff --git a/zc-business/src/main/java/com/zc/business/controller/DcEventController.java b/zc-business/src/main/java/com/zc/business/controller/DcEventController.java index 3b6d1218..14b32b58 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcEventController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcEventController.java @@ -227,4 +227,18 @@ public class DcEventController extends BaseController public AjaxResult getLinkEvent(@ApiParam(name = "eventId", value = "事件id", required = true) @PathVariable("eventId") String eventId){ return dcEventService.getLinkEvent(eventId); } + + /** + * @Description 获取事件数量 + * + * @author liuwenge + * @date 2024/6/6 18:45 + * @param type + * @return com.ruoyi.common.core.domain.AjaxResult + */ + @ApiOperation("获取事件数量") + @GetMapping( "/getCountNum/{type}") + public AjaxResult getCountNum(@ApiParam(name = "type", value = "类型 1:告警 2:待确认 3:处置中", required = true) @PathVariable("type") String type){ + return dcEventService.getCountNum(type); + } } diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcEventMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcEventMapper.java index 63ed43a8..324da21a 100644 --- a/zc-business/src/main/java/com/zc/business/mapper/DcEventMapper.java +++ b/zc-business/src/main/java/com/zc/business/mapper/DcEventMapper.java @@ -121,6 +121,8 @@ public interface DcEventMapper extends BaseMapper int selectClearInfo(String eventId); List dispatchRecordEventList(DcEvent dcEvent); + + Long selectEventNumByStatus(@Param("status") String status); } diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java index fa39632b..ac585d4e 100644 --- a/zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java +++ b/zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java @@ -150,4 +150,6 @@ public interface DcWarningMapper public String organizationName(Long id); //事件id查询调度记录id public HashMap selectDispatchId(@Param("eventId")String eventId); + + Long selectWarningNum(); } diff --git a/zc-business/src/main/java/com/zc/business/service/IDcEventService.java b/zc-business/src/main/java/com/zc/business/service/IDcEventService.java index 8d5d5933..6e2943eb 100644 --- a/zc-business/src/main/java/com/zc/business/service/IDcEventService.java +++ b/zc-business/src/main/java/com/zc/business/service/IDcEventService.java @@ -139,4 +139,14 @@ public interface IDcEventService AjaxResult getLinkEvent(String eventId); List dispatchRecordEventList(DcEvent dcEvent); + + /** + * @Description 获取事件数量 + * + * @author liuwenge + * @date 2024/6/6 18:45 + * @param type 类型 1:告警 2:待确认 3:处置中 + * @return com.ruoyi.common.core.domain.AjaxResult + */ + AjaxResult getCountNum(String type); } diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java index 2dada580..b50c21a4 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java @@ -1924,4 +1924,33 @@ public class DcEventServiceImpl extends ServiceImpl impl } + /** + * @Description 获取事件数量 + * + * @author liuwenge + * @date 2024/6/6 18:45 + * @param type 类型 1:告警 2:待确认 3:处置中 + * @return com.ruoyi.common.core.domain.AjaxResult + */ + @Override + public AjaxResult getCountNum(String type){ + if (StringUtils.isEmpty(type)){ + return AjaxResult.error("类型不能为空"); + } + + Long num = 0L; + //告警 + if (type.equals("1")){ + num = dcWarningMapper.selectWarningNum(); + } else if (type.equals("2")){ + num = dcEventMapper.selectEventNumByStatus("0"); + } else if (type.equals("3")){ + num = dcEventMapper.selectEventNumByStatus("1"); + } + + return AjaxResult.success(num); + } + + + } diff --git a/zc-business/src/main/resources/mapper/business/DcEventMapper.xml b/zc-business/src/main/resources/mapper/business/DcEventMapper.xml index 38faaef3..f88c5b12 100644 --- a/zc-business/src/main/resources/mapper/business/DcEventMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcEventMapper.xml @@ -850,4 +850,7 @@ + \ No newline at end of file diff --git a/zc-business/src/main/resources/mapper/business/DcWarningMapper.xml b/zc-business/src/main/resources/mapper/business/DcWarningMapper.xml index 4bfb8a26..7992b584 100644 --- a/zc-business/src/main/resources/mapper/business/DcWarningMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcWarningMapper.xml @@ -433,5 +433,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" +