huangjiayang
2025-04-28 f5f908446cab6a5563cd5146bdf0119384514697
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;
    }
}