zhanghl
2025-05-23 dec8951aae400e54f6ee83a8f95867dba9da8af1
aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsGasPipingRouteStatServiceImpl.java
@@ -1744,7 +1744,7 @@
                                // 使用专用查询方法查询设计产能数据
                                // 按文档要求:根据process_name和plant去aps_gas_pipeline_capacity_plan表中查询
                                capacityPlans = apsGasPipelineCapacityPlanMapper.selectDesignCapacityForInterface2(
                                        processName.trim(), year, month, null, plant);
                                        processName.trim(), year, month, major, plant);
                                
                                // 将结果存入缓存
                                capacityPlanCache.put(cacheKey, capacityPlans);
@@ -1811,7 +1811,7 @@
                            // 使用专用查询方法查询设计产能数据
                            // 按文档要求:根据process_name和plant去aps_gas_pipeline_capacity_plan表中查询
                            capacityPlans = apsGasPipelineCapacityPlanMapper.selectDesignCapacityForInterface2(
                                    processName, year, month, null, plant);
                                    processName, year, month, major, plant);
                            
                            // 将结果存入缓存
                            capacityPlanCache.put(cacheKey, capacityPlans);
@@ -1854,6 +1854,30 @@
        result.put("timePoints", timePoints);
        result.put("rowGroupBy", rowGroupBy);
        
        // 根据文档注意点3,添加排序逻辑
        if (!plantTable.isEmpty()) {
            // 对聚合结果进行排序
            Collections.sort(plantTable, (map1, map2) -> {
                String key1 = map1.keySet().iterator().next();
                String key2 = map2.keySet().iterator().next();
                // 首先按rowGroupBy排序(processName或workshop)
                int result1 = key1.compareTo(key2);
                if (result1 != 0) {
                    return result1;
                }
                // 如果rowGroupBy相同,再按plant排序
                Map<String, Object> detail1 = (Map<String, Object>) map1.get(key1);
                Map<String, Object> detail2 = (Map<String, Object>) map2.get(key2);
                String plant1 = detail1.containsKey("plant") ? (String) detail1.get("plant") : "";
                String plant2 = detail2.containsKey("plant") ? (String) detail2.get("plant") : "";
                return plant1.compareTo(plant2);
            });
        }
        return result;
    }