From b839c6b725336b61648ce679485dfada8356b6df Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Wed, 18 Oct 2023 08:42:29 +0800 Subject: [PATCH] =?UTF-8?q?#=E6=B0=B4=E7=94=B5=E7=AB=99bug=E8=A7=A3?= =?UTF-8?q?=E5=86=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/controller/AlarmConfigDetailController.java | 6 +++--- .../config/service/impl/AlarmConfigDetailServiceImpl.java | 4 ++-- .../alert/service/impl/AbnormalAlarmServiceImpl.java | 14 ++++++++++++-- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/controller/AlarmConfigDetailController.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/controller/AlarmConfigDetailController.java index f7dffa0..0af8bd8 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/controller/AlarmConfigDetailController.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/controller/AlarmConfigDetailController.java @@ -34,10 +34,10 @@ public class AlarmConfigDetailController extends BladeController { return R.data(detailService.details(configId)); } - @PostMapping("/updateBatch") + @PostMapping("/saveUpdateBatch") @ApiOperationSupport(order = 6) @ApiOperation(value = "批量新增或修改", notes = "传入list") - public R updateBatch(@Valid @RequestBody List entitys) { - return R.status(detailService.updateBatch(entitys)); + public R updateBatch(@Valid @RequestBody AlarmConfigDetailEntity entitys) { + return R.status(detailService.saveOrUpdate(entitys)); } } \ No newline at end of file diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/impl/AlarmConfigDetailServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/impl/AlarmConfigDetailServiceImpl.java index 1760be1..732edc8 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/impl/AlarmConfigDetailServiceImpl.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/impl/AlarmConfigDetailServiceImpl.java @@ -41,10 +41,10 @@ public class AlarmConfigDetailServiceImpl extends BaseServiceImpl{ // HZ3000告警 if(AlarmConstants.HZ3000_ALARM.equals(source)){ - AlarmConstants.HZ3000_ALARAM_LIST.forEach(type-> batchs.add(this.superposition(entity,Integer.valueOf(source),type))); + AlarmConstants.HZ3000_ALARAM_LIST.forEach(type-> batchs.add(this.superposition(entity, source,type))); // 等级告警 }else if(AlarmConstants.LEVEL_ALARM.equals(source)){ - AlarmConstants.LEVEL_ALARAM.forEach(type-> batchs.add(this.superposition(entity,Integer.valueOf(source),type))); + AlarmConstants.LEVEL_ALARAM.forEach(type-> batchs.add(this.superposition(entity, source,type))); // 条件告警 }else if(AlarmConstants.CONDITION_ALARM.equals(source)){ batchs.add(this.superposition(entity, source,AlarmConstants.CONDITION)); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AbnormalAlarmServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AbnormalAlarmServiceImpl.java index dd0c672..ab7f643 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AbnormalAlarmServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AbnormalAlarmServiceImpl.java @@ -73,7 +73,7 @@ public class AbnormalAlarmServiceImpl extends BaseServiceImpl soes = result.getData().getRecords(); + // 过滤已经当天存储得告警数据 + List history = historyAbnormalAlarmService.list(Wrappers.lambdaQuery() + .in(HistoryAbnormalAlarmEntity::getAlarmId,soes.stream().map(SoeData::getId).collect(Collectors.toList())) + .ge(HistoryAbnormalAlarmEntity::getStartTime,DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 00:00:00") + ); + if(CollectionUtil.isNotEmpty(history)){ + soes = result.getData().getRecords().stream().filter(soe-> !history.stream().map(HistoryAbnormalAlarmEntity::getAlarmId).collect(Collectors.toList()).contains(soe.getId())).collect(Collectors.toList()); + } + // 遍历告警信息 - result.getData().getRecords().forEach(item -> { + soes.forEach(item -> { if(!AbnormalAlarmConstant.INTERRUPT_LIST.contains(item.getSoeType())){ return; }