From 0ed7ad518c3fb354b830cc6b27a18dc0cd01f6fb Mon Sep 17 00:00:00 2001 From: huangjiayang <5265313@qq.com> Date: 星期日, 27 四月 2025 08:54:31 +0800 Subject: [PATCH] 【UPDATE】优化气柜管路产能计划查询接口 --- aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsGasPipingRouteStatServiceImpl.java | 104 +++++++++++++++------------------------------------ 1 files changed, 31 insertions(+), 73 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 0522a73..cd38d02 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 @@ -257,14 +257,13 @@ } apsGasPipingRouteStats = apsGasPipingRouteStatMapper.selectApsGasPipingRouteStatList(apsGasPipingRouteStat); //鏍规嵁寮�宸ユ棩杩涜鍗囧簭鎺掑簭 - apsGasPipingRouteStats.sort((a, b)->a.getPlanStartDay().compareTo(b.getPlanStartDay())); + apsGasPipingRouteStats.sort((a, b)->a.getProcessPlanStartDay().compareTo(b.getProcessPlanStartDay())); //宸ュ簭鍒嗙粍缁熻 HashMap<String, List<ApsResourceDateStat>> processMap = new HashMap<>(); List<HashMap<String, List<ApsResourceDateStat>>> processList = new ArrayList<>(); - HashMap<String, List<ApsResourceDateStat>> processMapMonth = new HashMap<>(); - List<HashMap<String, List<ApsResourceDateStat>>> processListMonth = new ArrayList<>(); //宸ュ簭寮�宸ユ棩鏈� String planStartDate = ""; + //缁熻鎵�鏈夊伐搴忓搴旂殑寮�宸ユ椂闂� for (ApsGasPipingRouteStat apsGasPipingRouteStatTemp : apsGasPipingRouteStats) { planStartDate = simpleDateFormat.format(apsGasPipingRouteStatTemp.getProcessPlanStartDay()); if("month".equals(apsGasPipingRouteStat.getSearchType())){ @@ -289,86 +288,45 @@ apsResourceDateStatList.add(apsResourceDateStat); processMap.put(apsGasPipingRouteStatTemp.getProcessName(), apsResourceDateStatList); } + //鑱氬悎姣忛亾宸ュ簭鐨勫紑宸ユ椂闂村拰浜ц兘 processMap.forEach((processName, apsResourceDateStatList) -> { - HashMap<String, ApsResourceDateStat> dayMap = new HashMap<>(); + LinkedHashMap<String, ApsResourceDateStat> dayMap = new LinkedHashMap<>(); apsResourceDateStatList.forEach(apsResourceDateStat -> { startPlanTimeSet.add(apsResourceDateStat.getPlanDay().toString()); - if("month".equals(apsGasPipingRouteStat.getSearchType())){ - if(dayMap.containsKey(apsResourceDateStat.getPlanDay().toString())){ - ApsResourceDateStat apsResourceDateStatTemp = dayMap.get(apsResourceDateStat.getPlanDay().toString()); - apsResourceDateStatTemp.setDesignTimes(apsGasPipingPlanMap.get(processName)!=null?apsGasPipingPlanMap.get(processName).getMonthProduceAllNum().intValue():0); - apsResourceDateStatTemp.setRequireTimes(apsResourceDateStatTemp.getRequireTimes()+apsResourceDateStat.getRequireTimes()); - if(apsResourceDateStatTemp.getDesignTimes()!=0){ - apsResourceDateStatTemp.setCapacityLoad(BigDecimal.valueOf(apsResourceDateStatTemp.getRequireTimes()/apsResourceDateStatTemp.getDesignTimes()* 100L)); - }else{ - apsResourceDateStatTemp.setCapacityLoad(BigDecimal.valueOf(0)); - } - apsResourceDateStatTemp.setResourceGroupName(processName); - apsResourceDateStatTemp.setPlanDay(apsResourceDateStat.getPlanDay()); - dayMap.put(apsResourceDateStat.getPlanDay().toString(), apsResourceDateStatTemp); + if(dayMap.containsKey(apsResourceDateStat.getPlanDay().toString())){ + ApsResourceDateStat apsResourceDateStatTemp = dayMap.get(apsResourceDateStat.getPlanDay().toString()); + apsResourceDateStatTemp.setDesignTimes(apsGasPipingPlanMap.get(processName)!=null?apsGasPipingPlanMap.get(processName).getMonthProduceAllNum().intValue():0); + apsResourceDateStatTemp.setRequireTimes(apsResourceDateStatTemp.getRequireTimes()+apsResourceDateStat.getRequireTimes()); + if(apsResourceDateStatTemp.getDesignTimes()!=0){ + apsResourceDateStatTemp.setCapacityLoad(BigDecimal.valueOf(apsResourceDateStatTemp.getRequireTimes()/apsResourceDateStatTemp.getDesignTimes()* 100L)); }else{ - dayMap.put(apsResourceDateStat.getPlanDay().toString(), apsResourceDateStat); + apsResourceDateStatTemp.setCapacityLoad(BigDecimal.valueOf(0)); } + apsResourceDateStatTemp.setResourceGroupName(processName); + apsResourceDateStatTemp.setPlanDay(apsResourceDateStat.getPlanDay()); + dayMap.put(apsResourceDateStat.getPlanDay().toString(), apsResourceDateStatTemp); + }else{ + dayMap.put(apsResourceDateStat.getPlanDay().toString(), apsResourceDateStat); } }); - if("month".equals(apsGasPipingRouteStat.getSearchType())){ - List<ApsResourceDateStat> tempList = new ArrayList<>(); - dayMap.forEach((key, value) -> { - tempList.add(value); - }); - processMapMonth.put(processName, tempList); - } + List<ApsResourceDateStat> tempList = new ArrayList<>(); + dayMap.forEach((key, value) -> { + tempList.add(value); + }); +// processMap.put(processName, tempList); + HashMap<String, List<ApsResourceDateStat>> temp = new HashMap<>(); + temp.put(processName, tempList); + processList.add(temp); }); +// for (String key : processMap.keySet()) { +// HashMap<String, List<ApsResourceDateStat>> temp = new HashMap<>(); +// temp.put(key, processMap.get(key)); +// processList.add(temp); +// } + //鎺掑簭鏃堕棿鏍囬 List<String> sortedStartPlanTimeList = new ArrayList<>(startPlanTimeSet); Collections.sort(sortedStartPlanTimeList); -// processMap.forEach((processName, apsResourceDateStatList) -> { -// HashMap<String, ApsResourceDateStat> dayMap = new HashMap<>(); -// apsResourceDateStatList.forEach(apsResourceDateStat -> { -// startPlanTimeSet.add(apsResourceDateStat.getPlanDay().toString()); -// if(dayMap.containsKey(apsResourceDateStat.getPlanDay().toString())){ -// ApsResourceDateStat apsResourceDateStatTemp = dayMap.get(apsResourceDateStat.getPlanDay().toString()); -// if("day".equals(apsGasPipingRouteStat.getSearchType())){ -// apsResourceDateStatTemp.setDesignTimes(apsResourceDateStatTemp.getDesignTimes()+apsResourceDateStat.getDesignTimes()); -// }else if("month".equals(apsGasPipingRouteStat.getSearchType())){ -// apsResourceDateStatTemp.setDesignTimes(apsGasPipingPlanMap.get(processName)!=null?apsGasPipingPlanMap.get(processName).getMonthProduceAllNum().intValue():0); -// } -// apsResourceDateStatTemp.setRequireTimes(apsResourceDateStatTemp.getRequireTimes()+apsResourceDateStat.getRequireTimes()); -// if(apsResourceDateStatTemp.getDesignTimes()!=0){ -// apsResourceDateStatTemp.setCapacityLoad(BigDecimal.valueOf(apsResourceDateStatTemp.getRequireTimes()/apsResourceDateStatTemp.getDesignTimes()* 100L)); -// } -// apsResourceDateStatTemp.setResourceGroupName(processName); -// dayMap.put(apsResourceDateStat.getPlanDay().toString(), apsResourceDateStatTemp); -// }else{ -// dayMap.put(apsResourceDateStat.getPlanDay().toString(), apsResourceDateStat); -// } -// }); -// JSONArray tempList = new JSONArray(); -// dayMap.forEach((key, value) -> { -// JSONObject temp = new JSONObject(); -// temp.put("planDay", key); -// temp.put("designTimes", value.getDesignTimes()); -// temp.put("requireTimes", value.getRequireTimes()); -// temp.put("capacityLoad", value.getCapacityLoad()); -// temp.put("resourceGroupName", value.getResourceGroupName()); -// tempList.add(temp); -// }); -// processData.add(new JSONObject().put(processName, tempList)); -// }); - if("month".equals(apsGasPipingRouteStat.getSearchType())){ - for (String key : processMapMonth.keySet()) { - HashMap<String, List<ApsResourceDateStat>> temp = new HashMap<>(); - temp.put(key, processMapMonth.get(key)); - processListMonth.add(temp); - } - result.put("planTable", processListMonth); - }else{ - for (String key : processMap.keySet()) { - HashMap<String, List<ApsResourceDateStat>> temp = new HashMap<>(); - temp.put(key, processMap.get(key)); - processList.add(temp); - } - result.put("planTable", processList); - } + result.put("planTable", processList); result.put("planTitle", sortedStartPlanTimeList); } catch (Exception e) { e.printStackTrace(); -- Gitblit v1.9.3