발전시뮬레이션 계산 중 데이터가 없어서 오류발생시 0값으로 리턴처리

This commit is contained in:
DESKTOP-6ARNG1Q\dlsgk 2024-11-15 09:28:05 +09:00
parent c7d9400463
commit 68ccbb02c2

View File

@ -104,19 +104,26 @@ public class PwrGnrSimService {
public PwrGnrSimResponse selectPwrGnrSimulation(PwrGnrSimRequest pwrGnrSimRequest)
throws Exception {
// 데이터가 없어서 오류가 발생한 경우, 빈값으로 리턴
PwrGnrSimResponse exceptionRes = new PwrGnrSimResponse();
int[] exceptionData = new int[13];
exceptionRes.setFrcPwrGnrList(exceptionData);
// 견적서 정보를 조회한다.
PwrGnrSimPlanResponse planInfo = pwrGnrSimMapper.selectPlanInfo(pwrGnrSimRequest);
// 지역이 없으면 계산 불가능
if (planInfo == null || planInfo.getAreaId() == 0) {
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR, "지역값이 없음");
log.error("지역값이 없음.");
return exceptionRes;
}
// 견적서의 지붕재와 아이템 정보 조회한다.
List<PwrGnrSimRoofResponse> roofItemList = pwrGnrSimMapper.selectRoofItemList(pwrGnrSimRequest);
// 지붕재 또는 지붕재에 아이템이 없음.
if (roofItemList == null || roofItemList.size() == 0) {
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR, "지붕재 또는 지붕재에 아이템이 없음.");
log.error("지붕재 또는 지붕재에 아이템이 없음.");
return exceptionRes;
}
List<PwrGnrSimRoofResponse> moduleList =
@ -130,7 +137,8 @@ public class PwrGnrSimService {
// 모듈 아이템이 없음.
if (moduleList == null || moduleList.size() == 0) {
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR, "모듈 아이템이 없음.");
log.error("모듈 아이템이 없음.");
return exceptionRes;
}
List<PwrGnrSimRoofResponse> pcsList =
@ -155,7 +163,8 @@ public class PwrGnrSimService {
// pcs 아이템이 없음.
if (pcsList == null || pcsList.size() == 0) {
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR, "pcs 아이템이 없음.");
log.error("PCS 아이템이 없음.");
return exceptionRes;
}
List<PwrGnrSimRoofResponse> roofList =