From d53965c5f62984287b3fc89cab4620f27806bc90 Mon Sep 17 00:00:00 2001 From: yang_shj Date: Fri, 17 Mar 2023 13:43:22 +0800 Subject: [PATCH 1/3] =?UTF-8?q?#=E5=91=8A=E8=AD=A6=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/operational/config/service/impl/StAlamRecordServiceImpl.java | 1 + .../src/main/java/com/hnac/hzims/operational/main/vo/SoeDataVo.java | 2 ++ 2 files changed, 3 insertions(+) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java index 0a4f280..3d76b07 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java @@ -501,6 +501,7 @@ public class StAlamRecordServiceImpl extends BaseServiceImpl Date: Fri, 17 Mar 2023 14:00:28 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E9=80=9A=E8=AE=AF=E4=B8=AD=E6=96=AD=E6=97=B6=E9=97=B4=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alert/controller/AbnormalAlarmController.java | 4 ++-- .../alert/service/HistoryAbnormalAlarmService.java | 2 +- .../impl/HistoryAbnormalAlarmServiceImpl.java | 26 +++++++++++++++++++--- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/AbnormalAlarmController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/AbnormalAlarmController.java index e6721fb..b5f6d1b 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/AbnormalAlarmController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/AbnormalAlarmController.java @@ -47,8 +47,8 @@ public class AbnormalAlarmController extends BladeController { @GetMapping("/queryByEntity") @ApiOperationSupport(order = 1) @ApiOperation(value = "统计通讯中断二级目录查询", notes = "传入imsDutyMainEntity") - public R> queryByEntity(HistoryAbnormalAlarmEntity entity, Query query) { - IPage pages = service.queryByEntity(entity,query); + public R> queryByEntity(HistoryAbnormalAlarmEntity entity, Query query) { + IPage pages = service.queryByEntity(entity,query); return R.data(pages); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/HistoryAbnormalAlarmService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/HistoryAbnormalAlarmService.java index 0682ecf..41fce42 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/HistoryAbnormalAlarmService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/HistoryAbnormalAlarmService.java @@ -25,7 +25,7 @@ public interface HistoryAbnormalAlarmService extends BaseService getAlarmTime(Query query, HistoryAbnormalAlarmEntity entity); - IPage queryByEntity(HistoryAbnormalAlarmEntity entity,Query query); + IPage queryByEntity(HistoryAbnormalAlarmEntity entity,Query query); // 智能告警数量: 时间范围当天 List alarmCount(); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java index 1773c0c..5c8b08b 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java @@ -158,7 +158,7 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl getAlarmEntityQueryWrapper(HistoryAbnormalAlarmEntity entity) { QueryWrapper queryWrapper = new QueryWrapper<>(); if (entity.getStationName() != null) { - queryWrapper.lambda().eq(HistoryAbnormalAlarmEntity::getStationName, entity.getStationName()); + queryWrapper.lambda().like(HistoryAbnormalAlarmEntity::getStationName, entity.getStationName()); } if (entity.getType() != null) { queryWrapper.lambda().eq(HistoryAbnormalAlarmEntity::getType, entity.getType()); @@ -173,10 +173,30 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl queryByEntity(HistoryAbnormalAlarmEntity entity, Query query) { + public IPage queryByEntity(HistoryAbnormalAlarmEntity entity, Query query) { QueryWrapper alarmEntityQueryWrapper = getAlarmEntityQueryWrapper(entity); IPage historyAbnormalAlarmEntityIPage = this.baseMapper.selectPage(Condition.getPage(query), alarmEntityQueryWrapper); - return historyAbnormalAlarmEntityIPage; + List records = historyAbnormalAlarmEntityIPage.getRecords(); + List voList =new ArrayList<>(); + if (records.size()>0) { + List historyAbnormalAlarmVos = BeanUtil.copy(records, HistoryAbnormalAlarmVo.class); + //赋值空的endTime + if (ObjectUtils.isNotEmpty(entity.getEndTime())) { + historyAbnormalAlarmVos.stream().filter(s -> s.getEndTime() == null).forEach(s -> s.setEndTime(entity.getEndTime())); + } else { + historyAbnormalAlarmVos.stream().filter(s -> s.getEndTime() == null).forEach(s -> s.setEndTime(new Date())); + } + voList= historyAbnormalAlarmVos.parallelStream().map(s -> { + long duration = s.getEndTime().getTime() - s.getStartTime().getTime(); + double v = BigDecimal.valueOf(duration / (1000 * 60 * 60.00)).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); + s.setDuration(v); + return s; + }).collect(Collectors.toList()); + } + IPage page = Condition.getPage(query); + page.setTotal(historyAbnormalAlarmEntityIPage.getTotal()); + page.setRecords(voList); + return page; } /** From 837d99e8ff4f6cbebbd5b939a0c2deae0673fb34 Mon Sep 17 00:00:00 2001 From: tyty Date: Fri, 17 Mar 2023 16:09:25 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E9=80=9A=E8=AE=AF=E4=B8=AD=E6=96=AD=E6=97=B6=E9=97=B4=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alert/service/impl/HistoryAbnormalAlarmServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java index 5c8b08b..4ba46b8 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java @@ -164,10 +164,10 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl