Browse Source

#定时任务抽离

zhongwei
yang_shj 2 years ago
parent
commit
dda76a358c
  1. 32
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java

32
hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java

@ -728,7 +728,7 @@ public class StAlamRecordServiceImpl extends BaseServiceImpl<StAlarmRecordMapper
@Override @Override
public List<FaultVo> getFaultList(String code) { public List<FaultVo> getFaultList(String code) {
List<StationEntity> stations = this.getStationByUserAuth(code);; List<StationEntity> stations = this.getStationByUserAuth(code);;
/*if(CollectionUtil.isEmpty(stations)){ if(CollectionUtil.isEmpty(stations)){
return null; return null;
} }
String result = fdpMonitorClient.getFaultList(); String result = fdpMonitorClient.getFaultList();
@ -737,29 +737,15 @@ public class StAlamRecordServiceImpl extends BaseServiceImpl<StAlarmRecordMapper
} }
List<FaultVo> list = JSONArray.parseArray(result,FaultVo.class); List<FaultVo> list = JSONArray.parseArray(result,FaultVo.class);
if(CollectionUtil.isEmpty(list)){ if(CollectionUtil.isEmpty(list)){
return new ArrayList<>(); return null;
}*/
List<FaultVo> list = new ArrayList<>();
FaultVo test =new FaultVo();
test.setInfo("可是我不会忘");
test.setFtype("1");
test.setFaultId("114233824210698186");
test.setName("爱来爱去空一场");
test.setStationName("海南三亚大隆一级电站");
test.setStation("902100000026");
test.setStatus("0");
test.setCreateTime("2023-06-01 09:55:33");
test.setOrd("1");
test.setFtype("1");
test.setFinfo("你说人这东西可信不可信,骗子脸上又不会写字");
list.add(test);
Map<String,String> map = stations.stream().collect(Collectors.toMap(StationEntity::getCode,StationEntity::getName));
// 查询已处理预警数据
List<AlarmHandleEntity> handles = handleService.handles(Collections.singletonList(AbnormalAlarmConstant.EARLY_WARNING),null);
if(CollectionUtil.isEmpty(handles)){
return list.stream().filter(fault -> map.containsKey(fault.getStation())).peek(o-> o.setStationName(map.get(o.getStation()))).collect(Collectors.toList());
} }
return list.stream().filter(fault -> !handles.stream().map(AlarmHandleEntity::getAlarmId).collect(Collectors.toList()).contains(fault.getFaultId()) && map.containsKey(fault.getStation())).peek(o-> o.setStationName(map.get(o.getStation()))).collect(Collectors.toList()); log.error("fault_list_stations: {}",stations);
log.error("fault_list_list: {}",list);
Map<String,String> map = stations.stream().collect(Collectors.toMap(StationEntity::getCode,StationEntity::getName));
return list.stream().filter(fault -> map.containsKey(fault.getStation())).map(o->{
o.setStationName(map.get(o.getStation()));
return o;
}).collect(Collectors.toList());
} }

Loading…
Cancel
Save