diff --git a/src/main/java/com/interplug/qcast/biz/pwrGnrSimulation/PwrGnrSimService.java b/src/main/java/com/interplug/qcast/biz/pwrGnrSimulation/PwrGnrSimService.java index 290b2073..72f73060 100644 --- a/src/main/java/com/interplug/qcast/biz/pwrGnrSimulation/PwrGnrSimService.java +++ b/src/main/java/com/interplug/qcast/biz/pwrGnrSimulation/PwrGnrSimService.java @@ -123,44 +123,46 @@ public class PwrGnrSimService { return exceptionRes; } - // 지붕재의 모든 모듈 Item 조회 + // 지붕재의 모든 Group 모듈 Item 조회 pwrGnrSimRequest.setItemGroup("MODULE_"); - List roofModuleList = + List roofGroupModuleList = pwrGnrSimMapper.selectRoofItemList(pwrGnrSimRequest); - // 전체 모듈에서 모듈 그룹형태로 변경 + // 전체 모듈에서 SORT 변경 (총용량 DESC) List moduleGroupList = - roofModuleList.stream() - .collect( - Collectors.groupingBy( - PwrGnrSimRoofResponse::getItemId, // 첫 번째 그룹화 기준 - Collectors.collectingAndThen( - Collectors.toList(), - list -> { - // 그룹화된 첫 번째 요소를 기반으로 새 객체 생성 - ObjectMapper mapper = new ObjectMapper(); - PwrGnrSimRoofResponse setDto = - mapper.convertValue(list.get(0), PwrGnrSimRoofResponse.class); - - // specification 합산 - double totSpecification = - list.stream() - .mapToDouble(response -> response.getTotSpecification()) - .sum(); - - totSpecification = totSpecification / 1000; - - // 합산 결과 설정 - setDto.setTotSpecification(totSpecification); - - return setDto; - }))) - .values() - .stream() + roofGroupModuleList.stream() .sorted( Comparator.comparingDouble(PwrGnrSimRoofResponse::getTotSpecification) .reversed()) // 내림차순 정렬 .collect(Collectors.toList()); + // .collect( + // Collectors.groupingBy( + // PwrGnrSimRoofResponse::getItemId, // 첫 번째 그룹화 기준 + // Collectors.collectingAndThen( + // Collectors.toList(), + // list -> { + // // 그룹화된 첫 번째 요소를 기반으로 새 객체 생성 + // ObjectMapper mapper = new ObjectMapper(); + // PwrGnrSimRoofResponse setDto = + // mapper.convertValue(list.get(0), + // PwrGnrSimRoofResponse.class); + // + // // specification 합산 + // double totSpecification = + // list.stream() + // .mapToDouble(response -> + // response.getTotSpecification()) + // .sum(); + // + // totSpecification = totSpecification / 1000; + // + // // 합산 결과 설정 + // setDto.setTotSpecification(totSpecification); + // + // return setDto; + // }))) + // .values() + // .stream() // 모듈 아이템이 없음. if (moduleGroupList.isEmpty()) { @@ -168,12 +170,7 @@ public class PwrGnrSimService { return exceptionRes; } - // 지붕재의 모든 PCS Item 조회 - // pwrGnrSimRequest.setItemGroup("PC_"); - // List roofPcsList = - // pwrGnrSimMapper.selectRoofItemList(pwrGnrSimRequest); - - // GROUP PCS Group Item 조회 + // 모든GROUP PCS Group Item 조회 List pcsGroupList = pwrGnrSimMapper.selectRoofPcsGroupList(pwrGnrSimRequest); @@ -261,7 +258,7 @@ public class PwrGnrSimService { // 지붕별 모듈정보 셋팅 int j = 0; - for (PwrGnrSimRoofResponse m : roofModuleList) { + for (PwrGnrSimRoofResponse m : moduleGroupList) { if (data.getRoofSurfaceId().equals(m.getRoofSurfaceId())) { dSpecification += m.getTotSpecification(); if (j == 0) { @@ -271,7 +268,6 @@ public class PwrGnrSimService { } else { dModuleInput3[i] = Integer.parseInt(m.getAmount()); } - j++; } } @@ -306,7 +302,7 @@ public class PwrGnrSimService { pwrGnrSimRes.setAreaName(planInfo.getAreaName()); pwrGnrSimRes.setSnowfall(planInfo.getSnowfall()); pwrGnrSimRes.setStandardWindSpeedId(planInfo.getStandardWindSpeedId()); - pwrGnrSimRes.setRoofModuleList(roofModuleList); + pwrGnrSimRes.setRoofModuleList(roofGroupModuleList); pwrGnrSimRes.setPcsList(pcsGroupList); return pwrGnrSimRes; diff --git a/src/main/resources/mappers/pwrGnrSimulation/pwrGnrSimMapper.xml b/src/main/resources/mappers/pwrGnrSimulation/pwrGnrSimMapper.xml index c49984e5..d2a7554d 100644 --- a/src/main/resources/mappers/pwrGnrSimulation/pwrGnrSimMapper.xml +++ b/src/main/resources/mappers/pwrGnrSimulation/pwrGnrSimMapper.xml @@ -103,6 +103,6 @@ AND C.ITEM_GROUP = #{itemGroup} GROUP BY A.ROOF_SURFACE_ID, A.ROOF_SURFACE, A.CLASS_TYPE, A.AZIMUTH, A.ANGLE, A.SLOPE, B.ITEM_ID, B.ITEM_NO ) T - ORDER BY T.SPECIFICATION DESC + ORDER BY T.ROOF_SURFACE_ID ASC, T.ITEM_ID ASC \ No newline at end of file