沙钢智慧能源系统后端代码
dengzedong
2025-02-14 26c638697968b97d5bf007da7e8427a534aa6e17
runLDGTankFactorPredTask queryPointsRealValue 优化
已修改1个文件
19 ■■■■■ 文件已修改
shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunLDGTankFactorPredTask.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
shasteel-biz/src/main/java/com/iailab/module/shasteel/job/task/RunLDGTankFactorPredTask.java
@@ -9,6 +9,9 @@
import org.springframework.stereotype.Component;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
 * @description: LDG柜容预测 监听触发
@@ -39,8 +42,11 @@
    public void run(String params) {
        logger.info("runLDGTankFactorPredTask定时任务正在执行,参数为:{}", params);
        try {
            //一次查询所有pointNo,减少请求
            List<String> allPointNos = checkPoints.values().stream().flatMap(List::stream).collect(Collectors.toList());
            Map<String, Object> pointsRealValue = dataPointApi.queryPointsRealValue(allPointNos);
            for (Map.Entry<String, List<String>> entry : checkPoints.entrySet()) {
                Map<String, Object> pointsRealValue = dataPointApi.queryPointsRealValue(entry.getValue());
                for (Map.Entry<String, Object> pointRealValue : pointsRealValue.entrySet()) {
                    String pointNo = pointRealValue.getKey();
                    Double value = null == pointRealValue.getValue() ? null : Double.valueOf(pointRealValue.getValue().toString());
@@ -50,12 +56,11 @@
                        break;
                    }
                }
                for (Map.Entry<String, Object> pointRealValue : pointsRealValue.entrySet()) {
                    Double value = null == pointRealValue.getValue() ? null : Double.valueOf(pointRealValue.getValue().toString());
                    pointsLastValue.put(pointRealValue.getKey(),value);
                }
            }
            //记录pointsLastValue
            for (Map.Entry<String, Object> pointRealValue : pointsRealValue.entrySet()) {
                Double value = null == pointRealValue.getValue() ? null : Double.valueOf(pointRealValue.getValue().toString());
                pointsLastValue.put(pointRealValue.getKey(),value);
            }
        } catch (Exception ex) {
            logger.error("runLDGTankFactorPredTask运行异常",ex);