발전시뮬레이션 모듈 순서 변경
This commit is contained in:
parent
98c8da7859
commit
333ae0fa04
@ -123,44 +123,46 @@ public class PwrGnrSimService {
|
||||
return exceptionRes;
|
||||
}
|
||||
|
||||
// 지붕재의 모든 모듈 Item 조회
|
||||
// 지붕재의 모든 Group 모듈 Item 조회
|
||||
pwrGnrSimRequest.setItemGroup("MODULE_");
|
||||
List<PwrGnrSimRoofResponse> roofModuleList =
|
||||
List<PwrGnrSimRoofResponse> roofGroupModuleList =
|
||||
pwrGnrSimMapper.selectRoofItemList(pwrGnrSimRequest);
|
||||
|
||||
// 전체 모듈에서 모듈 그룹형태로 변경
|
||||
// 전체 모듈에서 SORT 변경 (총용량 DESC)
|
||||
List<PwrGnrSimRoofResponse> 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<PwrGnrSimRoofResponse> roofPcsList =
|
||||
// pwrGnrSimMapper.selectRoofItemList(pwrGnrSimRequest);
|
||||
|
||||
// GROUP PCS Group Item 조회
|
||||
// 모든GROUP PCS Group Item 조회
|
||||
List<PwrGnrSimRoofResponse> 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;
|
||||
|
||||
@ -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
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
x
Reference in New Issue
Block a user