|
|
|
@ -23,10 +23,7 @@ import com.hnac.hzinfo.sdk.core.response.Result;
|
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.springblade.core.tool.jackson.JsonUtil; |
|
|
|
|
import org.springblade.core.tool.utils.CollectionUtil; |
|
|
|
|
import org.springblade.core.tool.utils.DateUtil; |
|
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
|
import org.springblade.core.tool.utils.ObjectUtil; |
|
|
|
|
import org.springblade.core.tool.utils.*; |
|
|
|
|
import org.springblade.mqtt.producer.IMqttSender; |
|
|
|
|
import org.springframework.data.redis.core.RedisTemplate; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
@ -228,15 +225,19 @@ public class AlarmServiceImpl implements AlarmService {
|
|
|
|
|
List<SoeData> soes = result.getData().getRecords(); |
|
|
|
|
// 查询当天数据中断告警记录
|
|
|
|
|
List<InterruptionEntity> saves = this.saveInterruptions(stations.stream().map(StationEntity::getCode).collect(Collectors.toList())); |
|
|
|
|
List<InterruptionEntity> entities = soes.stream().filter(o-> CollectionUtil.isEmpty(saves) || !saves.stream().map(InterruptionEntity::getAlarmId).collect(Collectors.toList()).contains(o.getId())).map(soe->{ |
|
|
|
|
List<InterruptionEntity> entities = soes.stream().filter( |
|
|
|
|
o -> (CollectionUtil.isEmpty(saves) || !saves.stream().map(itr -> itr.getStationId() + itr.getRealId() + itr.getAlarmTime()).collect(Collectors.toList()).contains(o.getStation() + o.getRealId() + o.getTs())) |
|
|
|
|
&& StringUtil.isNotBlank(o.getStation())).map(soe->{ |
|
|
|
|
InterruptionEntity entity = new InterruptionEntity(); |
|
|
|
|
List<StationEntity> soeStations = stations.stream().filter(o->o.getCode().equals(soe.getStation())).collect(Collectors.toList()); |
|
|
|
|
if(!CollectionUtil.isEmpty(soeStations)){ |
|
|
|
|
entity.setStationId(soeStations.get(0).getCode()); |
|
|
|
|
entity.setStationName(soeStations.get(0).getName()); |
|
|
|
|
entity.setCreateDept(soeStations.get(0).getRefDept()); |
|
|
|
|
entity.setTenantId(soeStations.get(0).getTenantId()); |
|
|
|
|
entity.setCreateUser(soeStations.get(0).getCreateUser()); |
|
|
|
|
Optional<StationEntity> optional = stations.stream().filter(o->o.getCode().equals(soe.getStation())).findFirst(); |
|
|
|
|
if(optional.isPresent()){ |
|
|
|
|
entity.setStationId(optional.get().getCode()); |
|
|
|
|
entity.setStationName(optional.get().getName()); |
|
|
|
|
entity.setCreateDept(optional.get().getRefDept()); |
|
|
|
|
entity.setTenantId(optional.get().getTenantId()); |
|
|
|
|
entity.setCreateUser(optional.get().getCreateUser()); |
|
|
|
|
}else{ |
|
|
|
|
entity.setStationId(soe.getStation()); |
|
|
|
|
} |
|
|
|
|
entity.setAlarmId(soe.getId()); |
|
|
|
|
entity.setRealId(soe.getRealId()); |
|
|
|
@ -248,8 +249,6 @@ public class AlarmServiceImpl implements AlarmService {
|
|
|
|
|
if(InterruptionConstants.ABNORMAL_STATUS.equals(soe.getSoeAlarmType())){ |
|
|
|
|
entity.setStatus(1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return entity; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
if(CollectionUtil.isEmpty(entities)){ |
|
|
|
|