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