| | |
| | | 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"); |