From 06d3d15a5a08637041cc601101c063b11b07a346 Mon Sep 17 00:00:00 2001 From: net <net@netdeMBP.lan> Date: 星期五, 14 二月 2025 17:25:21 +0800 Subject: [PATCH] 合并理去杀杀人 --- zhitan-system/src/main/java/com/zhitan/peakvalley/service/impl/PeakValleyServiceImpl.java | 41 ++++++++++++++++++++++++++++++----------- 1 files changed, 30 insertions(+), 11 deletions(-) diff --git a/zhitan-system/src/main/java/com/zhitan/peakvalley/service/impl/PeakValleyServiceImpl.java b/zhitan-system/src/main/java/com/zhitan/peakvalley/service/impl/PeakValleyServiceImpl.java index e607910..4753201 100644 --- a/zhitan-system/src/main/java/com/zhitan/peakvalley/service/impl/PeakValleyServiceImpl.java +++ b/zhitan-system/src/main/java/com/zhitan/peakvalley/service/impl/PeakValleyServiceImpl.java @@ -5,6 +5,8 @@ import com.zhitan.common.enums.ElectricityTypeEnum; import com.zhitan.common.enums.TimeType; import com.zhitan.common.utils.DateUtils; +import com.zhitan.costmanagement.domain.vo.CostPriceRelevancyVo; +import com.zhitan.costmanagement.mapper.CostPriceRelevancyMapper; import com.zhitan.model.domain.vo.ModelNodeIndexInfor; import com.zhitan.model.mapper.ModelNodeMapper; import com.zhitan.peakvalley.domain.ElectricityDataItem; @@ -35,7 +37,8 @@ private ModelNodeMapper modelNodeMapper; @Resource private PeakValleyMapper electricityDataItemMapper; - + @Resource + CostPriceRelevancyMapper costPriceRelevancyMapper; /** * 鏌ヨ缁熻鏁版嵁 @@ -131,14 +134,23 @@ List<ModelNodeIndexInfor> nodeIndexInfoList = modelNodeMapper.selectIndexByModelCodeAndNodeId(dto.getModelCode(), dto.getNodeId()); if (CollectionUtils.isNotEmpty(nodeIndexInfoList)) { Set<String> indexSet = nodeIndexInfoList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toSet()); - List<ElectricityDataItem> dataItemList = electricityDataItemMapper.getDataStatistics(indexSet, startTime, endTime, timeType); + // 鏍规嵁灏忔椂鏁版嵁璁$畻澶╃殑鏁版嵁 + List<ElectricityDataItem> dataItemList = electricityDataItemMapper.getDataStatistics(indexSet, startTime, endTime, TimeType.HOUR.name()); electricityDataMap = dataItemList.stream() .collect(Collectors.groupingBy(li -> DateUtil.formatDateTime(li.getDataTime()))); } while (!startTime.after(endTime)) { - String mapKey = DateUtil.formatDateTime(startTime); - List<ElectricityDataItem> dataItemList = electricityDataMap.get(mapKey); + + Date nextTime = DateUtil.offsetDay(startTime, 1); + List<ElectricityDataItem> dataItemList = new ArrayList<>(); + for (Map.Entry<String, List<ElectricityDataItem>> entry : electricityDataMap.entrySet()) { + String key = entry.getKey(); + if ((DateUtils.parseDate(key).after(startTime) || DateUtils.parseDate(key).equals(startTime)) && DateUtils.parseDate(key).before(nextTime)) { + List<ElectricityDataItem> list = entry.getValue(); + dataItemList.addAll(list); + } + } BigDecimal sharpFee = BigDecimal.ZERO; BigDecimal sharpPower = BigDecimal.ZERO; @@ -199,11 +211,11 @@ AtomicReference<BigDecimal> tipCount = new AtomicReference<>(BigDecimal.ZERO); AtomicReference<BigDecimal> troughCount = new AtomicReference<>(BigDecimal.ZERO); AtomicReference<BigDecimal> peakCount = new AtomicReference<>(BigDecimal.ZERO); - + reportVOList.stream().forEach(r->{ PeakValleyLineChatVO costVO = new PeakValleyLineChatVO(); PeakValleyLineChatVO powerConsumptionVO = new PeakValleyLineChatVO(); - + /** * 鐢ㄧ數閲� */ @@ -243,7 +255,7 @@ peakFreeCount.set(peakFreeCount.get().add(r.getPeakFee())); }); - peakValleyDayTotalVO.setPeakPowerCost(peakFreeCount.get().doubleValue()); + peakValleyDayTotalVO.setPeakPowerCost(peakFreeCount.get().doubleValue()); peakValleyDayTotalVO.setPeakPowerConsumption(peakCount.get().doubleValue()); peakValleyDayTotalVO.setFlatPowerCost(flatFreeCount.get().doubleValue()); peakValleyDayTotalVO.setFlatPowerConsumption(flatCount.get().doubleValue()); @@ -277,13 +289,15 @@ peakValleyDayTotalVO.setTipPowerCostProportion(0); peakValleyDayTotalVO.setTroughPowerCostProportion(0); } - - peakValleyDayTotalVO.setTotalCost(powerTotal.doubleValue()); - peakValleyDayTotalVO.setTotalPowerConsumption(freeTotal.doubleValue()); + +// peakValleyDayTotalVO.setTotalCost(powerTotal.doubleValue()); +// peakValleyDayTotalVO.setTotalPowerConsumption(freeTotal.doubleValue()); + peakValleyDayTotalVO.setTotalCost(freeTotal.doubleValue()); + peakValleyDayTotalVO.setTotalPowerConsumption(powerTotal.doubleValue()); peakValleyVO.setTotalVO(peakValleyDayTotalVO); peakValleyVO.setCostList(costList); peakValleyVO.setPowerConsumptionList(powerConsumptionList); - + return peakValleyVO; } @@ -472,4 +486,9 @@ return reportVOList; } + + @Override + public PeakValleyDayVO segmentAnalysisDayCustomize(PeakValleyDTO dto) { + return null; + } } -- Gitblit v1.9.3