Browse Source

#水电站bug解决

zhongwei
yang_shj 1 year ago
parent
commit
b839c6b725
  1. 6
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/controller/AlarmConfigDetailController.java
  2. 4
      hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/config/service/impl/AlarmConfigDetailServiceImpl.java
  3. 14
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AbnormalAlarmServiceImpl.java

6
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<AlarmConfigDetailEntity> entitys) {
return R.status(detailService.updateBatch(entitys));
public R updateBatch(@Valid @RequestBody AlarmConfigDetailEntity entitys) {
return R.status(detailService.saveOrUpdate(entitys));
}
}

4
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<AlarmConfigDet
AlarmConstants.ALARAM_SOURCE.forEach(source->{
// 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));

14
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AbnormalAlarmServiceImpl.java

@ -73,7 +73,7 @@ public class AbnormalAlarmServiceImpl extends BaseServiceImpl<AbnormalAlarmMappe
query.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
Calendar calendar = Calendar.getInstance();
query.setEndTime(LocalDateTime.parse(DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME),DateUtil.DATETIME_FORMATTER));
calendar.add(Calendar.MINUTE,-2);
calendar.add(Calendar.MINUTE,-10);
query.setBeginTime(LocalDateTime.parse(DateUtil.format(calendar.getTime() , DateUtil.PATTERN_DATETIME),DateUtil.DATETIME_FORMATTER));
query.setNeedPage(false);
query.setPage(1);
@ -83,8 +83,18 @@ public class AbnormalAlarmServiceImpl extends BaseServiceImpl<AbnormalAlarmMappe
if(!result.isSuccess() || ObjectUtil.isEmpty(result.getData()) || CollectionUtil.isEmpty(result.getData().getRecords())) {
return;
}
List<SoeData> soes = result.getData().getRecords();
// 过滤已经当天存储得告警数据
List<HistoryAbnormalAlarmEntity> history = historyAbnormalAlarmService.list(Wrappers.<HistoryAbnormalAlarmEntity>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;
}

Loading…
Cancel
Save