| | |
| | | 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柜容预测 监听触发 |
| | |
| | | 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()); |
| | |
| | | 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); |