台站运行管理初始化台站运行状态,台站运行效率新增过滤台站状态条件

This commit is contained in:
qiaoqinzheng 2024-01-23 15:43:23 +08:00
parent 6b69e226d4
commit 0d7000058d
2 changed files with 15 additions and 5 deletions

View File

@ -6,6 +6,7 @@ import org.jeecg.common.CalculateStationData;
import org.jeecg.common.properties.MaximumPoolSizeProperties;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.modules.base.entity.configuration.GardsStations;
import org.jeecg.modules.base.enums.DetectorStatus;
import org.jeecg.modules.entity.data.RateParam;
import org.jeecg.modules.entity.data.StationInfo;
import org.springframework.scheduling.concurrent.CustomizableThreadFactory;
@ -61,7 +62,7 @@ public class DataProvisionEfficiencyManager {
HashMap<String, GardsStations> stationInfoMap = (HashMap<String, GardsStations>) redisUtil.get("stationInfoMap");
List<Integer> detectorsUsedList = (List<Integer>) redisUtil.get("detectorsUsedList");
// 获取所有的台站信息
List<GardsStations> stations = stationInfoMap.values().stream().filter(item-> item.getLon()!=null && item.getLat()!=null).sorted(Comparator.comparing(GardsStations::getStationId)).collect(Collectors.toList());
List<GardsStations> stations = stationInfoMap.values().stream().filter(item-> item.getLon()!=null && item.getLat()!=null && item.getStatus() != null && item.getStatus().equalsIgnoreCase(DetectorStatus.ON.getValue())).sorted(Comparator.comparing(GardsStations::getStationId)).collect(Collectors.toList());
List<StationInfo> stationInfos = new ArrayList<>();
for (GardsStations gardsStations : stations) {
StationInfo stationInfo = new StationInfo();

View File

@ -10,9 +10,11 @@ import org.jeecg.common.config.mqtoken.UserTokenContext;
import org.jeecg.common.properties.MaximumPoolSizeProperties;
import org.jeecg.common.util.DateUtils;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.modules.base.entity.configuration.GardsStations;
import org.jeecg.modules.base.entity.original.GardsMetData;
import org.jeecg.modules.base.entity.original.GardsSampleData;
import org.jeecg.modules.base.entity.original.GardsSohData;
import org.jeecg.modules.base.enums.DetectorStatus;
import org.jeecg.modules.entity.data.*;
import org.jeecg.modules.mapper.StationMetDataMapper;
import org.jeecg.modules.mapper.StationSampleDataMapper;
@ -88,8 +90,14 @@ public class DataReceivingStatusManager {
}
}
//从redis中获取台站信息
Map<String, String> stationInfoMap = (Map<String, String>)redisUtil.get("stationMap");
List<String> stationIds = stationInfoMap.keySet().stream().collect(Collectors.toList());
Map<String, GardsStations> stationInfoMap = (HashMap<String, GardsStations>) redisUtil.get("stationInfoMap");
List<String> stationIds = new LinkedList<>();
for (Map.Entry<String, GardsStations> stationInfo:stationInfoMap.entrySet()) {
GardsStations infoValue = stationInfo.getValue();
if (infoValue.getStatus() != null && infoValue.getStatus().equalsIgnoreCase(DetectorStatus.ON.getValue())) {
stationIds.add(infoValue.getStationId().toString());
}
}
//从redis中获取探测器信息
Map<Integer, String> detectorInfoMap = (Map<Integer, String>)redisUtil.get("detectorsMap");
//声明存储所有台站id对应的数据信息的集合
@ -216,8 +224,9 @@ public class DataReceivingStatusManager {
stationMap.put(stationId, detectorDataList);
stationData.setStationId(stationId);
if (CollectionUtils.isNotEmpty(stationInfoMap)) {
if (StringUtils.isNotBlank(stationInfoMap.get(stationId))) {
stationData.setStationCode(stationInfoMap.get(stationId));
if (Objects.nonNull(stationInfoMap.get(stationId))) {
GardsStations stations = stationInfoMap.get(stationId);
stationData.setStationCode(stations.getStationCode());
}
}
stationData.setDetectors(stationMap);