鞍钢鲅鱼圈能源管控系统后端代码
dengzedong
2 天以前 48b69b857ae860050a790be63b317e15be49f1b1
ansteel-biz/src/main/java/com/iailab/module/ansteel/job/task/RunPowerMaxdemandTask.java
@@ -109,42 +109,15 @@
                mainEntity.setOccurTime(occurTime);
                mainEntity.setMaxDemand(todayMax);
                String mainId = powerMaxdemandMainService.add(mainEntity);
                Map<String, Object> params1 = new HashMap<>();
                params1.put("groupName", demand.getName());
                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;
                }
                Calendar calendar1 = Calendar.getInstance();
                calendar1.setTime(occurTime);
                calendar1.add(Calendar.MINUTE, 1);
                int sort = 0;
                for (PowerNetDropdownEntity dropdown : dropdownList) {
                    if (StringUtils.isBlank(dropdown.getExt1())) {
                        logger.info(dropdown.getNodeCode() + ":dropdown.getExt1() is empty");
                        continue;
                    }
                    logger.info(dropdown.getNodeCode() + ":dropdown.getExt1() = " + dropdown.getExt1());
                    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()));
                    detEntity.setSort(sort);
                    powerMaxdemandDetService.add(detEntity);
                    sort ++;
                for (PowerMaxdemandDetEntity detEntity : detList0) {
                    // 插入第二层children
                    powerMaxdemandDetService.addList(detEntity.getId(), detEntity.getName(), occurTime);
                }
            }
            logger.info("RunPowerMaxdemandTask end");