|
|
@ -35,6 +35,7 @@ import org.springblade.core.tool.utils.CollectionUtil; |
|
|
|
import org.springblade.core.tool.utils.DateUtil; |
|
|
|
import org.springblade.core.tool.utils.DateUtil; |
|
|
|
import org.springblade.core.tool.utils.ObjectUtil; |
|
|
|
import org.springblade.core.tool.utils.ObjectUtil; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
|
|
|
|
import org.springframework.data.redis.core.RedisTemplate; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
|
|
import java.lang.reflect.Field; |
|
|
|
import java.lang.reflect.Field; |
|
|
@ -59,6 +60,8 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl<HistoryAbno |
|
|
|
|
|
|
|
|
|
|
|
private final ISoeClient alarmClient; |
|
|
|
private final ISoeClient alarmClient; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final RedisTemplate redisTemplate; |
|
|
|
|
|
|
|
|
|
|
|
@Value("${hzims.operation.alarm.types}") |
|
|
|
@Value("${hzims.operation.alarm.types}") |
|
|
|
private String types; |
|
|
|
private String types; |
|
|
|
|
|
|
|
|
|
|
@ -233,44 +236,62 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl<HistoryAbno |
|
|
|
if(!result.isSuccess() || ObjectUtil.isEmpty(result.getData()) || CollectionUtil.isEmpty(result.getData().getRecords())){ |
|
|
|
if(!result.isSuccess() || ObjectUtil.isEmpty(result.getData()) || CollectionUtil.isEmpty(result.getData().getRecords())){ |
|
|
|
return new AlarmReustVo(); |
|
|
|
return new AlarmReustVo(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 查询当天类型处理告警
|
|
|
|
|
|
|
|
List<AlarmHandleEntity> handles = handleService.handles(types.stream().map(Long::parseLong).collect(Collectors.toList()),AbnormalAlarmConstant.SYSTEM_ALARM); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 返回数据
|
|
|
|
// 返回数据
|
|
|
|
AlarmReustVo response = new AlarmReustVo(); |
|
|
|
AlarmReustVo response = new AlarmReustVo(); |
|
|
|
List<AlarmDataVo> datas = result.getData().getRecords().stream().map(alarm -> { |
|
|
|
if(types.size() > 1){ |
|
|
|
AlarmDataVo record = new AlarmDataVo(); |
|
|
|
response.setCount((int) result.getData().getTotal()); |
|
|
|
// 继承类属性拷贝
|
|
|
|
response.setTotal(result.getData().getTotal()); |
|
|
|
BeanUtil.copyProperties(alarm, record); |
|
|
|
response.setSoeList(result.getData().getRecords().stream().map(alarm -> { |
|
|
|
if(CollectionUtil.isEmpty(handles)){ |
|
|
|
AlarmDataVo record = new AlarmDataVo(); |
|
|
|
record.setIsHandle(false); |
|
|
|
// 继承类属性拷贝
|
|
|
|
}else{ |
|
|
|
BeanUtil.copyProperties(alarm, record); |
|
|
|
record.setIsHandle(handles.stream().map(AlarmHandleEntity::getAlarmId).collect(Collectors.toList()).contains(String.valueOf(alarm.getId()))); |
|
|
|
record.setStationCode(alarm.getStation()); |
|
|
|
} |
|
|
|
record.setContent(alarm.getSoeExplain()); |
|
|
|
record.setStationCode(alarm.getStation()); |
|
|
|
record.setType(alarm.getSoeType()); |
|
|
|
record.setContent(alarm.getSoeExplain()); |
|
|
|
record.setSoeType(AbnormalAlarmConstant.TYPE_NAMES[Integer.parseInt(alarm.getSoeType())]); |
|
|
|
record.setType(alarm.getSoeType()); |
|
|
|
record.setStationName((String) redisTemplate.opsForValue().get("alarm:station:" + alarm.getStation())); |
|
|
|
record.setSoeType(AbnormalAlarmConstant.TYPE_NAMES[Integer.parseInt(alarm.getSoeType())]); |
|
|
|
record.setServeType("2"); |
|
|
|
List<StationEntity> filter = stations.stream().filter(station -> station.getCode().equals(alarm.getStation())).collect(Collectors.toList()); |
|
|
|
record.setAlarmType(AbnormalAlarmConstant.SYSTEM_ALARM); |
|
|
|
if (CollectionUtil.isEmpty(filter)) { |
|
|
|
|
|
|
|
return record; |
|
|
|
return record; |
|
|
|
} |
|
|
|
}).sorted(Comparator.comparing(AlarmDataVo::getTs, Comparator.reverseOrder())).collect(Collectors.toList())); |
|
|
|
record.setStationName(filter.get(0).getName()); |
|
|
|
}else{ |
|
|
|
record.setServeType(filter.get(0).getServeType()); |
|
|
|
// 查询当天类型处理告警
|
|
|
|
record.setAlarmType(AbnormalAlarmConstant.SYSTEM_ALARM); |
|
|
|
List<AlarmHandleEntity> handles = handleService.handles(types.stream().map(Long::parseLong).collect(Collectors.toList()),AbnormalAlarmConstant.SYSTEM_ALARM); |
|
|
|
return record; |
|
|
|
|
|
|
|
}).sorted(Comparator.comparing(AlarmDataVo::getIsHandle) |
|
|
|
List<AlarmDataVo> datas = result.getData().getRecords().stream().map(alarm -> { |
|
|
|
.thenComparing(AlarmDataVo::getTs, Comparator.reverseOrder())).collect(Collectors.toList()); |
|
|
|
AlarmDataVo record = new AlarmDataVo(); |
|
|
|
|
|
|
|
// 继承类属性拷贝
|
|
|
|
response.setCount((int) (result.getData().getTotal() - handles.size())); |
|
|
|
BeanUtil.copyProperties(alarm, record); |
|
|
|
response.setSoeList(datas); |
|
|
|
if(CollectionUtil.isEmpty(handles)){ |
|
|
|
response.setTotal(result.getData().getTotal()); |
|
|
|
record.setIsHandle(false); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
record.setIsHandle(handles.stream().map(AlarmHandleEntity::getAlarmId).collect(Collectors.toList()).contains(String.valueOf(alarm.getId()))); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
record.setStationCode(alarm.getStation()); |
|
|
|
|
|
|
|
record.setContent(alarm.getSoeExplain()); |
|
|
|
|
|
|
|
record.setType(alarm.getSoeType()); |
|
|
|
|
|
|
|
record.setSoeType(AbnormalAlarmConstant.TYPE_NAMES[Integer.parseInt(alarm.getSoeType())]); |
|
|
|
|
|
|
|
List<StationEntity> filter = stations.stream().filter(station -> station.getCode().equals(alarm.getStation())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
if (CollectionUtil.isEmpty(filter)) { |
|
|
|
|
|
|
|
return record; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
record.setStationName(filter.get(0).getName()); |
|
|
|
|
|
|
|
record.setServeType(filter.get(0).getServeType()); |
|
|
|
|
|
|
|
record.setAlarmType(AbnormalAlarmConstant.SYSTEM_ALARM); |
|
|
|
|
|
|
|
return record; |
|
|
|
|
|
|
|
}).sorted(Comparator.comparing(AlarmDataVo::getIsHandle) |
|
|
|
|
|
|
|
.thenComparing(AlarmDataVo::getTs, Comparator.reverseOrder())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
response.setCount((int) (result.getData().getTotal() - handles.size())); |
|
|
|
|
|
|
|
response.setSoeList(datas); |
|
|
|
|
|
|
|
response.setTotal(result.getData().getTotal()); |
|
|
|
|
|
|
|
} |
|
|
|
return response; |
|
|
|
return response; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取处理数据ID集合 |
|
|
|
* 获取处理数据ID集合 |
|
|
|
* @return |
|
|
|
* @return |
|
|
@ -391,6 +412,11 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl<HistoryAbno |
|
|
|
return this.baseMapper.getStationName(); |
|
|
|
return this.baseMapper.getStationName(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void stations() { |
|
|
|
|
|
|
|
List<StationEntity> stations = stationService.list(); |
|
|
|
|
|
|
|
stations.forEach(item-> redisTemplate.opsForValue().set("alarm:station:" + item.getCode(),item.getName())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Boolean entityIsNull(Object object) { |
|
|
|
private Boolean entityIsNull(Object object) { |
|
|
|