diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/DataReceivingStatusManager.java b/jeecg-module-station-operation/src/main/java/org/jeecg/DataReceivingStatusManager.java index 12ff5d54..74d684b7 100644 --- a/jeecg-module-station-operation/src/main/java/org/jeecg/DataReceivingStatusManager.java +++ b/jeecg-module-station-operation/src/main/java/org/jeecg/DataReceivingStatusManager.java @@ -7,6 +7,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.jeecg.common.CacheName; import org.jeecg.common.config.mqtoken.UserTokenContext; +import org.jeecg.common.util.DateUtils; import org.jeecg.common.util.RedisUtil; import org.jeecg.modules.base.entity.original.GardsMetData; import org.jeecg.modules.base.entity.original.GardsSampleData; @@ -111,10 +112,14 @@ public class DataReceivingStatusManager { StationData stationData = new StationData(); //stream流获取探测器id List detectorIds = detectors.stream().map(GardsDetectorsSystem::getDetectorId).collect(Collectors.toList()); + //探测器加上NA 无效探测器id + detectorIds.add(1); //根据探测器id 开始时间查询样品基础数据 List sampleDataList = stationSampleDataMapper.findSampleDataList(detectorIds, startDateTime); //根据台站id,探测器id,开始时间 List sohDataList = stationSohDataMapper.findSohDataList(stationId, detectorIds, startDateTime); + //移除掉最后一个探测器 + detectorIds.remove(detectorIds.size()-1); //用于接收当前台站下所有探测器及探测器所有的样品数据,气体数据,状态数据集合 List> detectorDataList = new LinkedList<>(); for (Integer detectorId : detectorIds) { @@ -166,18 +171,16 @@ public class DataReceivingStatusManager { } } if (CollectionUtils.isNotEmpty(sohDataList)) { - List dataListSoh = sohDataList.stream().filter(item -> item.getDetectorId().equals(detectorId)).collect(Collectors.toList()); - //根据探测器id 台站id 开始时间查询状态数据 - if (CollectionUtils.isNotEmpty(dataListSoh)) { - for (GardsSohData sohData : dataListSoh) { - DataInfoVo dataInfo = new DataInfoVo(); - dataInfo.setType("SOH"); - dataInfo.setStatus("SOH"); - Date startTime = sohData.getStartTime(); - dataInfo.setBeginTime(Double.valueOf(startTime.getTime() / 1000)); - dataInfo.setSpanTime(Double.valueOf(sohData.getTime())); - dataInfoList.add(dataInfo); - } + //根据台站id 开始时间查询状态数据 + for (GardsSohData sohData : sohDataList) { + DataInfoVo dataInfo = new DataInfoVo(); + dataInfo.setType("SOH"); + dataInfo.setStatus("SOH"); + Date startTime = sohData.getStartTime(); + dataInfo.setBeginTime(Double.valueOf(startTime.getTime() / 1000)); + dataInfo.setSpanTime(Double.valueOf(sohData.getTime())); + dataInfo.setEndTime(Double.valueOf((startTime.getTime() / 1000) + sohData.getTime())); + dataInfoList.add(dataInfo); } } if (CollectionUtils.isNotEmpty(metDataList)) {