From 9d139cf89f3b8bfae3e32ca1cc99551507f96c8b Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Wed, 6 Dec 2023 17:34:05 +0800 Subject: [PATCH] =?UTF-8?q?#=E5=91=8A=E8=AD=A6=E6=95=B0=E6=8D=AE=E6=9D=A5?= =?UTF-8?q?=E6=BA=90=E7=BB=9F=E8=AE=A1=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/alarm/show/controller/ShowAlarmController.java | 4 ++-- .../com/hnac/hzims/alarm/show/service/AlarmService.java | 2 +- .../hzims/alarm/show/service/impl/AlarmServiceImpl.java | 13 +++++++++++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/controller/ShowAlarmController.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/controller/ShowAlarmController.java index 66da6fe..d5873d2 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/controller/ShowAlarmController.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/controller/ShowAlarmController.java @@ -55,8 +55,8 @@ public class ShowAlarmController extends BladeController { @PostMapping("/count") @ApiOperationSupport(order = 3) @ApiOperation(value = "告警分类数量", notes = "不需要传入参数") - public R> counts() { - return R.data(alarmService.counts()); + public R> counts(@RequestBody AlarmEntity alarm) { + return R.data(alarmService.counts(alarm)); } } \ No newline at end of file diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmService.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmService.java index 488ae76..0898de5 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmService.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmService.java @@ -14,7 +14,7 @@ public interface AlarmService extends BaseService { IPage alarms(AlarmEntity alarm, IPage page); - List counts(); + List counts(AlarmEntity alarm); List broadcast(String startTime, String endTime); } \ No newline at end of file diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java index 45eccff..b710add 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java @@ -98,7 +98,7 @@ public class AlarmServiceImpl extends BaseServiceImpl * @return */ @Override - public List counts() { + public List counts(AlarmEntity alarm) { // 站点查询 List stations = this.stations(); if(CollectionUtil.isEmpty(stations)){ @@ -114,13 +114,22 @@ public class AlarmServiceImpl extends BaseServiceImpl QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq("IS_RIGHT_TABULATION",0); wrapper.in("STATION_ID",stations.stream().map(StationEntity::getCode).collect(Collectors.toList())); + if(!StringUtil.isEmpty(alarm.getStationId())){ + wrapper.eq("STATION_ID",alarm.getStationId()); + } + if(!StringUtil.isEmpty(alarm.getAlarmSource())){ + wrapper.eq("ALARM_SOURCE",alarm.getAlarmSource()); + } + if(!StringUtil.isEmpty(alarm.getAlarmType())){ + wrapper.eq("ALARM_TYPE",alarm.getAlarmType()); + } // 查询告警数据 List alarms = this.list(wrapper); // 查询数量 return AlarmConstants.ALARAM_SOURCE.stream().map(source->{ AlarmCountVo count = new AlarmCountVo(); count.setType(source); - if(CollectionUtil.isNotEmpty(alarms)){ + if(CollectionUtil.isEmpty(alarms)){ count.setCount(0L); }else{ count.setCount(alarms.stream().filter(o->o.getAlarmSource().equals(source)).count());