From f5f908446cab6a5563cd5146bdf0119384514697 Mon Sep 17 00:00:00 2001
From: huangjiayang <5265313@qq.com>
Date: 星期一, 28 四月 2025 21:37:35 +0800
Subject: [PATCH] 【UPDATE-BUGFIX】修改获取设计产能数BUG
---
aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsGasPipingRouteStatServiceImpl.java | 21 ++++++++++++++++++---
1 files changed, 18 insertions(+), 3 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 325eb6e..bcb7094 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
@@ -236,7 +236,7 @@
JSONObject result = new JSONObject();
YearMonth yearMonth = YearMonth.parse(apsGasPipingRouteStat.getSearchEndDate());
int daysInMonth = yearMonth.lengthOfMonth();
- HashSet<String> startPlanTimeSet = new HashSet<>();
+ LinkedHashSet<String> startPlanTimeSet = new LinkedHashSet<>();
//宸ュ簭鍒嗙粍缁熻
LinkedHashMap<String, List<ApsResourceDateStat>> processMap = new LinkedHashMap<>();
List<HashMap<String, List<ApsResourceDateStat>>> processList = new ArrayList<>();
@@ -261,8 +261,11 @@
}
}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));
+ YearMonth start = YearMonth.of(Integer.parseInt(apsGasPipingRouteStat.getSearchStartDate().split("-")[0]), Integer.parseInt(apsGasPipingRouteStat.getSearchStartDate().split("-")[1]));
+ YearMonth end = YearMonth.of(Integer.parseInt(apsGasPipingRouteStat.getSearchEndDate().split("-")[0]), Integer.parseInt(apsGasPipingRouteStat.getSearchEndDate().split("-")[1]));
+ List<String> yearMonths = getYearMonthsInRange(start, end);
+ for (String yearMonthStr : yearMonths) {
+ startPlanTimeSet.add(yearMonthStr);
}
}
List<ApsGasPipelineCapacityPlan> apsGasPipelineCapacityPlanList = apsGasPipelineCapacityPlanMapper.selectApsGasPipelineCapacityPlanList(searchCapacityPlan);
@@ -488,4 +491,16 @@
styles.put("title", style);
return styles;
}
+
+ public static List<String> getYearMonthsInRange(YearMonth start, YearMonth end) {
+ List<String> yearMonths = new ArrayList<>();
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
+
+ while (!start.isAfter(end)) {
+ yearMonths.add(start.format(formatter));
+ start = start.plusMonths(1);
+ }
+
+ return yearMonths;
+ }
}
--
Gitblit v1.9.3