발전시뮬레이션 타입 및 list 4가지 케이스 추가

This commit is contained in:
DESKTOP-6ARNG1Q\dlsgk 2024-11-20 15:24:28 +09:00
parent 8125c7d4c7
commit bc61ad5256
5 changed files with 80 additions and 57 deletions

View File

@ -932,6 +932,8 @@ public class EstimateService {
PwrGnrSimResponse pwrGnrSimResponse = PwrGnrSimResponse pwrGnrSimResponse =
pwrGnrSimService.selectPwrGnrSimulation(pwrGnrSimRequest); pwrGnrSimService.selectPwrGnrSimulation(pwrGnrSimRequest);
pwrGnrSimResponse.setPwrGnrSimType(estimateRequest.getPwrGnrSimType());
if (pwrGnrSimResponse != null) { if (pwrGnrSimResponse != null) {
try { try {
// 발전시뮬레이션 안내사항 조회 // 발전시뮬레이션 안내사항 조회
@ -947,7 +949,7 @@ public class EstimateService {
estimateResponse.setPwrGnrSim(pwrGnrSimResponse); estimateResponse.setPwrGnrSim(pwrGnrSimResponse);
if ("PDF".equals(estimateRequest.getSchDownload())) { // PDF 다운로드 if ("PDF".equals(estimateRequest.getSchDownload())) { // PDF 다운로드
String[] arrSection = new String[5]; // TODO Section 갯수 넣기 String[] arrSection = new String[5];
int iSection = 0; int iSection = 0;
String templateFilePath = "pdf_download_quotation_detail_template.html"; String templateFilePath = "pdf_download_quotation_detail_template.html";
@ -972,7 +974,6 @@ public class EstimateService {
arrSection[iSection] = "div.section4"; arrSection[iSection] = "div.section4";
iSection++; iSection++;
arrSection[iSection] = "div.section5"; arrSection[iSection] = "div.section5";
iSection++;
// 발전시뮬레이션 pdf Html 생성 // 발전시뮬레이션 pdf Html 생성
doc = pwrGnrSimService.pwrGnrSimPdfHtml(doc, pwrGnrSimResponse); doc = pwrGnrSimService.pwrGnrSimPdfHtml(doc, pwrGnrSimResponse);

View File

@ -190,4 +190,7 @@ public class EstimateRequest {
@Schema(description = "다운로드 파일명") @Schema(description = "다운로드 파일명")
private String fileName; private String fileName;
@Schema(description = "발전시뮬레이션 타입")
private String pwrGnrSimType;
} }

View File

@ -113,8 +113,12 @@ public class PwrGnrSimService {
// 데이터가 없어서 오류가 발생한 경우, 빈값으로 리턴 // 데이터가 없어서 오류가 발생한 경우, 빈값으로 리턴
PwrGnrSimResponse exceptionRes = new PwrGnrSimResponse(); PwrGnrSimResponse exceptionRes = new PwrGnrSimResponse();
int[] exceptionData = new int[13]; double[] dExceptionData = new double[13];
exceptionRes.setFrcPwrGnrList(exceptionData); String[] strExceptionData = formatAndPrintArray(dExceptionData);
exceptionRes.setHatsudenryouAll(strExceptionData);
exceptionRes.setHatsudenryouAllSnow(strExceptionData);
exceptionRes.setHatsudenryouPeakcutAll(strExceptionData);
exceptionRes.setHatsudenryouPeakcutAllSnow(strExceptionData);
// 견적서 정보를 조회한다. // 견적서 정보를 조회한다.
PwrGnrSimPlanResponse planInfo = pwrGnrSimMapper.selectPlanInfo(pwrGnrSimRequest); PwrGnrSimPlanResponse planInfo = pwrGnrSimMapper.selectPlanInfo(pwrGnrSimRequest);
@ -274,7 +278,6 @@ public class PwrGnrSimService {
pwrGnrSimRes.setPlanNo(planInfo.getPlanNo()); pwrGnrSimRes.setPlanNo(planInfo.getPlanNo());
pwrGnrSimRes.setDrawingEstimateCreateDate(planInfo.getDrawingEstimateCreateDate()); pwrGnrSimRes.setDrawingEstimateCreateDate(planInfo.getDrawingEstimateCreateDate());
pwrGnrSimRes.setCapacity(String.valueOf(dSpecification)); pwrGnrSimRes.setCapacity(String.valueOf(dSpecification));
pwrGnrSimRes.setAnlFrcsGnrt(pwrGnrSimRes.getFrcPwrGnrList()[12]);
pwrGnrSimRes.setPrefName(planInfo.getPrefName()); pwrGnrSimRes.setPrefName(planInfo.getPrefName());
pwrGnrSimRes.setAreaName(planInfo.getAreaName()); pwrGnrSimRes.setAreaName(planInfo.getAreaName());
pwrGnrSimRes.setSnowfall(planInfo.getSnowfall()); pwrGnrSimRes.setSnowfall(planInfo.getSnowfall());
@ -437,10 +440,10 @@ public class PwrGnrSimService {
double sekisairitsu = module_youryou_total / (pcs_youryou_total * 1000); double sekisairitsu = module_youryou_total / (pcs_youryou_total * 1000);
// 피크 발전량 배열 선언 // 피크 발전량 배열 선언
int[] hatsudenryou_all = new int[13]; // 피크 없음 발전량(적설 고려 없음) double[] hatsudenryou_all = new double[13]; // 피크 없음 발전량(적설 고려 없음)
// double[] hatsudenryou_all_snow = new double[12]; // 피크 없음 발전량(적설 고려 있음) double[] hatsudenryou_all_snow = new double[12]; // 피크 없음 발전량(적설 고려 있음)
// double[] hatsudenryou_peakcut_all = new double[12]; // 피크 있음 발전량(적설 고려 없음) double[] hatsudenryou_peakcut_all = new double[12]; // 피크 있음 발전량(적설 고려 없음)
// double[] hatsudenryou_peakcut_all_snow = new double[12]; // 피크 있음 발전량(적설 고려 있음) double[] hatsudenryou_peakcut_all_snow = new double[12]; // 피크 있음 발전량(적설 고려 있음)
if (sekisairitsu <= 3) { if (sekisairitsu <= 3) {
@ -522,14 +525,13 @@ public class PwrGnrSimService {
for (int i = 0; i < roofLength; i++) { for (int i = 0; i < roofLength; i++) {
hatsudenryou_all[j] += (int) Math.round(hatsudenryou[i][j]); hatsudenryou_all[j] += (int) Math.round(hatsudenryou[i][j]);
// hatsudenryou_peakcut_all[j] += hatsudenryou_peakcut[i][j]; hatsudenryou_peakcut_all[j] += hatsudenryou_peakcut[i][j];
} }
// hatsudenryou_all_snow[j] = hatsudenryou_all_snow[j] =
// hatsudenryou_all[j] * (1 - (snow[(simulationPointNumber * 12) + j])); hatsudenryou_all[j] * (1 - (snow[(simulationPointNumber * 12) + j]));
// hatsudenryou_peakcut_all_snow[j] = hatsudenryou_peakcut_all_snow[j] =
// hatsudenryou_peakcut_all[j] * (1 - (snow[(simulationPointNumber * 12) + hatsudenryou_peakcut_all[j] * (1 - (snow[(simulationPointNumber * 12) + j]));
// j]));
} }
} }
@ -548,15 +550,21 @@ public class PwrGnrSimService {
// Arrays.toString(hatsudenryou_peakcut_all_snow)); // Arrays.toString(hatsudenryou_peakcut_all_snow));
PwrGnrSimResponse pwrGnrSimRes = new PwrGnrSimResponse(); PwrGnrSimResponse pwrGnrSimRes = new PwrGnrSimResponse();
// pwrGnrSimRes.setSekisairitsu(sekisairitsu); pwrGnrSimRes.setHatsudenryouAll(formatAndPrintArray(hatsudenryou_all));
pwrGnrSimRes.setFrcPwrGnrList(hatsudenryou_all); pwrGnrSimRes.setHatsudenryouAllSnow(formatAndPrintArray(hatsudenryou_all_snow));
// pwrGnrSimRes.setHatsudenryouAllSnow(hatsudenryou_all_snow); pwrGnrSimRes.setHatsudenryouPeakcutAll(formatAndPrintArray(hatsudenryou_peakcut_all));
// pwrGnrSimRes.setHatsudenryouPeakcutAll(hatsudenryou_peakcut_all); pwrGnrSimRes.setHatsudenryouPeakcutAllSnow(formatAndPrintArray(hatsudenryou_peakcut_all_snow));
// pwrGnrSimRes.setHatsudenryouPeakcutAllSnow(hatsudenryou_peakcut_all_snow);
return pwrGnrSimRes; return pwrGnrSimRes;
} }
// 배열 변환 포맷 처리 메서드
private static String[] formatAndPrintArray(double[] doubleArray) {
return Arrays.stream(doubleArray)
.mapToInt(d -> (int) d) // double -> int 변환
.mapToObj(i -> String.format("%,d", i))
.toArray(String[]::new); // String[] 변환
}
// 설치면의 사면 일사량 계산 // 설치면의 사면 일사량 계산
public static double[] peakcut( public static double[] peakcut(
int simulationPointNumber, int simulationPointNumber,
@ -1372,6 +1380,18 @@ public class PwrGnrSimService {
public static Document pwrGnrSimPdfHtml(Document doc, PwrGnrSimResponse data) public static Document pwrGnrSimPdfHtml(Document doc, PwrGnrSimResponse data)
throws IOException, QcastException { throws IOException, QcastException {
String[] pwrGnrSimList = new String[13];
if ("A".equals(data.getPwrGnrSimType())) {
pwrGnrSimList = data.getHatsudenryouAll();
} else if ("B".equals(data.getPwrGnrSimType())) {
pwrGnrSimList = data.getHatsudenryouAllSnow();
} else if ("C".equals(data.getPwrGnrSimType())) {
pwrGnrSimList = data.getHatsudenryouPeakcutAll();
} else if ("D".equals(data.getPwrGnrSimType())) {
pwrGnrSimList = data.getHatsudenryouPeakcutAllSnow();
}
Element elm; Element elm;
// 상단 요약정보 // 상단 요약정보
@ -1393,7 +1413,7 @@ public class PwrGnrSimService {
elm.text(StringUtils.defaultString(data.getCapacity())); elm.text(StringUtils.defaultString(data.getCapacity()));
elm = doc.getElementById("anlFrcsGnrt"); elm = doc.getElementById("anlFrcsGnrt");
elm.text(StringUtils.defaultString(String.valueOf(data.getAnlFrcsGnrt()))); elm.text(StringUtils.defaultString(String.valueOf(pwrGnrSimList[12])));
elm = doc.getElementById("snowfall"); elm = doc.getElementById("snowfall");
elm.text(StringUtils.defaultString(data.getSnowfall())); elm.text(StringUtils.defaultString(data.getSnowfall()));
@ -1401,10 +1421,13 @@ public class PwrGnrSimService {
elm = doc.getElementById("standardWindSpeedId"); elm = doc.getElementById("standardWindSpeedId");
elm.text(StringUtils.defaultString(data.getStandardWindSpeedId())); elm.text(StringUtils.defaultString(data.getStandardWindSpeedId()));
if (data.getFrcPwrGnrList() != null && data.getFrcPwrGnrList().length > 0) { boolean isUnchanged = Arrays.stream(pwrGnrSimList).allMatch(value -> value == "00");
if (!isUnchanged) { // 변경된값 확인
int[] onlyData = int[] onlyData =
Arrays.copyOfRange(data.getFrcPwrGnrList(), 0, data.getFrcPwrGnrList().length - 1); Arrays.stream(Arrays.copyOfRange(pwrGnrSimList, 0, pwrGnrSimList.length - 1))
.mapToInt(Integer::parseInt)
.toArray();
int referenceValue = 300; // table 높이 int referenceValue = 300; // table 높이
int orgMaxValue = int orgMaxValue =
@ -1485,28 +1508,28 @@ public class PwrGnrSimService {
} }
// 예측발전량 // 예측발전량
if (data.getFrcPwrGnrList() != null && data.getFrcPwrGnrList().length > 0) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
for (int i = 0; i < 13; i++) { for (int i = 0; i < 13; i++) {
sb.append( sb.append(
"<td>" "<td>" + StringUtils.defaultString(String.format("%,d", pwrGnrSimList[i])) + "</td>");
+ StringUtils.defaultString(String.valueOf(data.getFrcPwrGnrList()[i]))
+ "</td>");
} }
elm = doc.getElementById("frcPwrGnrList_detail"); elm = doc.getElementById("frcPwrGnrList_detail");
elm.append(sb.toString()); elm.append(sb.toString());
}
// 모듈 list // 모듈 list
if (data.getRoofModuleList() != null && data.getRoofModuleList().size() > 0) { if (data.getRoofModuleList() != null && data.getRoofModuleList().size() > 0) {
StringBuilder sb = new StringBuilder(); sb = new StringBuilder();
for (int i = 0; i < data.getRoofModuleList().size(); i++) { for (int i = 0; i < data.getRoofModuleList().size(); i++) {
PwrGnrSimRoofResponse listItem = data.getRoofModuleList().get(i); PwrGnrSimRoofResponse listItem = data.getRoofModuleList().get(i);
sb.append("<tr>"); sb.append("<tr>");
sb.append("<td>" + StringUtils.defaultString(listItem.getRoofSurface()) + "</td>"); sb.append("<td>" + StringUtils.defaultString(listItem.getRoofSurface()) + "</td>");
sb.append("<td>" + StringUtils.defaultString(listItem.getSlopeAngle()) + "</td>"); sb.append(
"<td>"
+ StringUtils.defaultString(listItem.getSlopeAngle())
+ (listItem.getClassType() == 0 ? "" : "º")
+ "</td>");
sb.append("<td>" + StringUtils.defaultString(listItem.getAzimuth()) + "</td>"); sb.append("<td>" + StringUtils.defaultString(listItem.getAzimuth()) + "</td>");
sb.append("<td>" + StringUtils.defaultString(listItem.getItemNo()) + "</td>"); sb.append("<td>" + StringUtils.defaultString(listItem.getItemNo()) + "</td>");
sb.append("<td>" + StringUtils.defaultString(listItem.getAmount()) + "</td>"); sb.append("<td>" + StringUtils.defaultString(listItem.getAmount()) + "</td>");
@ -1519,7 +1542,7 @@ public class PwrGnrSimService {
// pcs list // pcs list
if (data.getPcsList() != null && data.getPcsList().size() > 0) { if (data.getPcsList() != null && data.getPcsList().size() > 0) {
StringBuilder sb = new StringBuilder(); sb = new StringBuilder();
for (int i = 0; i < data.getPcsList().size(); i++) { for (int i = 0; i < data.getPcsList().size(); i++) {
PwrGnrSimRoofResponse listItem = data.getPcsList().get(i); PwrGnrSimRoofResponse listItem = data.getPcsList().get(i);

View File

@ -12,11 +12,8 @@ public class PwrGnrSimRequest {
@Schema(description = "플랜번호") @Schema(description = "플랜번호")
private String planNo; private String planNo;
// @Schema(description = "도도부현") @Schema(description = "list 종류")
// private String prefecture; private String pwrGnrSimType;
//
// @Schema(description = "관측지점")
// private String simulationPoint;
@Schema(description = "관측지점 번호") @Schema(description = "관측지점 번호")
private int simulationPointNumber; private int simulationPointNumber;

View File

@ -9,18 +9,20 @@ public class PwrGnrSimResponse {
@Schema(description = "적재율") @Schema(description = "적재율")
private double sekisairitsu; private double sekisairitsu;
@Schema(description = "예측발전량 리스트") @Schema(description = "적설 고려 없음 (피크 컷 없음 발전량) Type : A")
private int[] frcPwrGnrList; private String[] hatsudenryouAll;
// @Schema(description = "적설 고려 있음 (피크 컷 없음 발전량) Type : B")
// @Schema(description = "") private String[] hatsudenryouAllSnow;
// private double[] hatsudenryouAllSnow;
// @Schema(description = "적설 고려 없음 (피크 컷 있음 발전량) Type : C")
// @Schema(description = "") private String[] hatsudenryouPeakcutAll;
// private double[] hatsudenryouPeakcutAll;
// @Schema(description = "적설 고려 있음 (피크 컷 있음 발전량) Type : D")
// @Schema(description = "") private String[] hatsudenryouPeakcutAllSnow;
// private double[] hatsudenryouPeakcutAllSnow;
@Schema(description = "list 종류")
private String pwrGnrSimType;
@Schema(description = "물건번호") @Schema(description = "물건번호")
private String objectNo; private String objectNo;
@ -34,9 +36,6 @@ public class PwrGnrSimResponse {
@Schema(description = "시스템용량") @Schema(description = "시스템용량")
private String capacity; private String capacity;
@Schema(description = "연간예측발전량")
private int anlFrcsGnrt;
@Schema(description = "도도부현") @Schema(description = "도도부현")
private int prefId; private int prefId;