From 831901d5e82cd503ca16c22a0613785828bbd9f6 Mon Sep 17 00:00:00 2001
From: dengzedong <dengzedong@email>
Date: 星期二, 13 五月 2025 18:07:50 +0800
Subject: [PATCH] 默认值-2

---
 ansteel-biz/src/main/java/com/iailab/module/ansteel/job/task/RunPowerMaxdemandTask.java |   49 ++++++++++++++-----------------------------------
 1 files changed, 14 insertions(+), 35 deletions(-)

diff --git a/ansteel-biz/src/main/java/com/iailab/module/ansteel/job/task/RunPowerMaxdemandTask.java b/ansteel-biz/src/main/java/com/iailab/module/ansteel/job/task/RunPowerMaxdemandTask.java
index 076de83..92290bb 100644
--- a/ansteel-biz/src/main/java/com/iailab/module/ansteel/job/task/RunPowerMaxdemandTask.java
+++ b/ansteel-biz/src/main/java/com/iailab/module/ansteel/job/task/RunPowerMaxdemandTask.java
@@ -71,17 +71,18 @@
                 return;
             }
             for (PowerDemandEntity demand : demandList) {
-                // 查询今天的最大需量
+                logger.info("查询今天的最大需量");
                 ApiPointValueQueryDTO pointValueQuery0 = new ApiPointValueQueryDTO();
                 pointValueQuery0.setStart(dayStart);
                 pointValueQuery0.setEnd(nowTime);
                 pointValueQuery0.setPointNo(demand.getCurDemand());
                 Map<String, Object> maxValue = dataPointApi.queryPointMaxValue(pointValueQuery0);
-                BigDecimal todayMax = BigDecimal.ZERO;
-                if (CollectionUtils.isEmpty(maxValue) && maxValue.containsKey(demand.getCurDemand())) {
-                    todayMax = new BigDecimal(maxValue.get(demand.getCurDemand()).toString());
+                if (CollectionUtils.isEmpty(maxValue)) {
+                    logger.info("maxValue is empty");
+                    continue;
                 }
-
+                BigDecimal todayMax = new BigDecimal(maxValue.get(demand.getCurDemand()).toString());
+                logger.info("todayMax=" + todayMax);
                 List<ApiPointValueDTO> valueList = dataPointApi.queryPointHistoryValue(pointValueQuery0);
                 if (CollectionUtils.isEmpty(valueList)) {
                     logger.info("valueList is empty");
@@ -95,7 +96,7 @@
                     }
                 }
 
-                // 查询本月需量发生记录
+                logger.info("查询本月需量发生记录");
                 BigDecimal monthMax = powerMaxdemandMainService.getMax(demand.getCode(), monStart, nowTime);
 
                 // 保存记录
@@ -108,37 +109,15 @@
                 mainEntity.setOccurTime(occurTime);
                 mainEntity.setMaxDemand(todayMax);
                 String mainId = powerMaxdemandMainService.add(mainEntity);
-
-                Map<String, Object> params1 = new HashMap<>();
-                params1.put("pCode", demand.getCode());
-                List<PowerNetDropdownEntity> dropdownList = powerNetDropdownService.list(params1);
-                if (CollectionUtils.isEmpty(dropdownList)) {
-                    logger.info("dropdownList is empty");
+                // 插入第一层children
+                List<PowerMaxdemandDetEntity> detList0 = powerMaxdemandDetService.addList(mainId, demand.getName(), occurTime);
+                if(CollectionUtils.isEmpty(detList0)){
+                    logger.info("detList0 is empty");
                     continue;
                 }
-                for (PowerNetDropdownEntity dropdown : dropdownList) {
-                    if (StringUtils.isBlank(dropdown.getExt1())) {
-                        continue;
-                    }
-                    Calendar calendar1 = Calendar.getInstance();
-                    calendar1.setTime(occurTime);
-                    calendar1.add(Calendar.MINUTE, 1);
-                    ApiPointValueQueryDTO pointValueQuery1 = new ApiPointValueQueryDTO();
-                    pointValueQuery1.setStart(occurTime);
-                    pointValueQuery1.setEnd(calendar1.getTime());
-                    pointValueQuery1.setPointNo(dropdown.getExt1());
-                    List<ApiPointValueDTO> valueList1 = dataPointApi.queryPointHistoryValue(pointValueQuery1);
-                    if (CollectionUtils.isEmpty(valueList1)) {
-                        logger.info("valueList1 is empty");
-                        continue;
-                    }
-                    PowerMaxdemandDetEntity detEntity = new PowerMaxdemandDetEntity();
-                    detEntity.setRelId(mainId);
-                    detEntity.setCode(dropdown.getNodeCode());
-                    detEntity.setName(dropdown.getNodeName());
-                    detEntity.setOccurTime(occurTime);
-                    detEntity.setMaxDemand(BigDecimal.valueOf(valueList1.get(0).getV()));
-                    powerMaxdemandDetService.add(detEntity);
+                for (PowerMaxdemandDetEntity detEntity : detList0) {
+                    // 插入第二层children
+                    powerMaxdemandDetService.addList(detEntity.getId(), detEntity.getName(), occurTime);
                 }
             }
             logger.info("RunPowerMaxdemandTask end");

--
Gitblit v1.9.3