From 5c8f2de10bd3c6004c1065271e0e9c6650074d27 Mon Sep 17 00:00:00 2001 From: huangjiayang <5265313@qq.com> Date: 星期一, 28 四月 2025 21:02:17 +0800 Subject: [PATCH] 【UPDATE-BUGFIX】修改获取设计产能数据查询条件 --- aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsGasPipingRouteStatServiceImpl.java | 32 +++++++++++++++++++++++--------- 1 files changed, 23 insertions(+), 9 deletions(-) diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsGasPipingRouteStatServiceImpl.java b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsGasPipingRouteStatServiceImpl.java index c0cbf3a..092a6be 100644 --- a/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsGasPipingRouteStatServiceImpl.java +++ b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsGasPipingRouteStatServiceImpl.java @@ -234,9 +234,9 @@ @Override public JSONObject getCapacityPlanData(ApsGasPipingRouteStat apsGasPipingRouteStat) { JSONObject result = new JSONObject(); - HashSet<String> startPlanTimeSet = new HashSet<>(); YearMonth yearMonth = YearMonth.parse(apsGasPipingRouteStat.getSearchEndDate()); int daysInMonth = yearMonth.lengthOfMonth(); + HashSet<String> startPlanTimeSet = new HashSet<>(); //宸ュ簭鍒嗙粍缁熻 LinkedHashMap<String, List<ApsResourceDateStat>> processMap = new LinkedHashMap<>(); List<HashMap<String, List<ApsResourceDateStat>>> processList = new ArrayList<>(); @@ -256,8 +256,14 @@ if("day".equals(apsGasPipingRouteStat.getSearchType())){ searchCapacityPlan.setYear(yearMonth.getYear()+""); searchCapacityPlan.setMonth(yearMonth.getMonthValue()+""); + for(int i=1;i<=daysInMonth;i++){ + startPlanTimeSet.add(yearMonth +"-"+ (i<10?"0"+i:i)); + } }else if("month".equals(apsGasPipingRouteStat.getSearchType())){ searchCapacityPlan.setYear(yearMonth.getYear()+""); + for(int i=1;i<=12;i++){ + startPlanTimeSet.add(yearMonth.getYear()+"-"+(i<10?"0"+i:i)); + } } List<ApsGasPipelineCapacityPlan> apsGasPipelineCapacityPlanList = apsGasPipelineCapacityPlanMapper.selectApsGasPipelineCapacityPlanList(searchCapacityPlan); apsGasPipelineCapacityPlanList.forEach(apsGasPipelineCapacityPlan -> { @@ -312,7 +318,7 @@ processMap.forEach((processName, apsResourceDateStatList) -> { LinkedHashMap<String, ApsResourceDateStat> dayMap = new LinkedHashMap<>(); apsResourceDateStatList.forEach(apsResourceDateStat -> { - startPlanTimeSet.add(apsResourceDateStat.getPlanDay().toString()); +// startPlanTimeSet.add(apsResourceDateStat.getPlanDay().toString()); if(dayMap.containsKey(apsResourceDateStat.getPlanDay().toString())){ ApsResourceDateStat apsResourceDateStatTemp = dayMap.get(apsResourceDateStat.getPlanDay().toString()); if("month".equals(apsGasPipingRouteStat.getSearchType())){ @@ -350,22 +356,30 @@ HashMap<String, List<ApsResourceDateStat>> temp = processList.get(i); for (Map.Entry<String, List<ApsResourceDateStat>> entry : temp.entrySet()){ List<ApsResourceDateStat> apsResourceDateStatList = entry.getValue(); - if(apsResourceDateStatList.size()<=0){ - for(String tempTime:sortedStartPlanTimeList){ + String key = entry.getKey(); + LocalDate crtDate=LocalDate.parse(key, formatter); + for(String tempTime:sortedStartPlanTimeList) { + List<ApsResourceDateStat> crtList = new ArrayList<>(); + Optional<ApsResourceDateStat> first = apsResourceDateStatList.stream().filter(x -> x.getPlanDay().equals(crtDate)).findFirst(); + if (first.isPresent()) { + ApsResourceDateStat apsResourceDateStat = first.get(); + crtList.add(apsResourceDateStat); + } else { ApsResourceDateStat apsResourceDateStat = new ApsResourceDateStat(); apsResourceDateStat.setPlanDay(LocalDate.parse(tempTime, formatter)); - if("month".equals(apsGasPipingRouteStat.getSearchType())){ - apsResourceDateStat.setDesignTimes(apsGasPipingPlanMap.get(entry.getKey())!=null?apsGasPipingPlanMap.get(entry.getKey()).getMonthProduceAllNum():new BigDecimal(0)); - }else{ - apsResourceDateStat.setDesignTimes(apsGasPipingPlanMap.get(entry.getKey())!=null?apsGasPipingPlanMap.get(entry.getKey()).getDayProduceAllNum():new BigDecimal(0)); + if ("month".equals(apsGasPipingRouteStat.getSearchType())) { + apsResourceDateStat.setDesignTimes(apsGasPipingPlanMap.get(entry.getKey()) != null ? apsGasPipingPlanMap.get(entry.getKey()).getMonthProduceAllNum() : new BigDecimal(0)); + } else { + apsResourceDateStat.setDesignTimes(apsGasPipingPlanMap.get(entry.getKey()) != null ? apsGasPipingPlanMap.get(entry.getKey()).getDayProduceAllNum() : new BigDecimal(0)); } apsResourceDateStat.setRequireTimes(new BigDecimal(0)); apsResourceDateStat.setCapacityLoad(new BigDecimal(0)); apsResourceDateStat.setResourceName(entry.getKey()); apsResourceDateStat.setResourceGroupName(entry.getKey()); apsResourceDateStatList.add(apsResourceDateStat); + crtList.add(apsResourceDateStat); } - temp.put(entry.getKey(), apsResourceDateStatList); + temp.put(entry.getKey(), crtList); processList.set(i, temp); } } -- Gitblit v1.9.3