From bc61ad5256e14e97d7d1c549f4014d1c3862cd8d Mon Sep 17 00:00:00 2001 From: "DESKTOP-6ARNG1Q\\dlsgk" Date: Wed, 20 Nov 2024 15:24:28 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B0=9C=EC=A0=84=EC=8B=9C=EB=AE=AC=EB=A0=88?= =?UTF-8?q?=EC=9D=B4=EC=85=98=20=ED=83=80=EC=9E=85=20=EB=B0=8F=20list=204?= =?UTF-8?q?=EA=B0=80=EC=A7=80=20=EC=BC=80=EC=9D=B4=EC=8A=A4=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../qcast/biz/estimate/EstimateService.java | 5 +- .../biz/estimate/dto/EstimateRequest.java | 3 + .../pwrGnrSimulation/PwrGnrSimService.java | 95 ++++++++++++------- .../dto/PwrGnrSimRequest.java | 7 +- .../dto/PwrGnrSimResponse.java | 27 +++--- 5 files changed, 80 insertions(+), 57 deletions(-) diff --git a/src/main/java/com/interplug/qcast/biz/estimate/EstimateService.java b/src/main/java/com/interplug/qcast/biz/estimate/EstimateService.java index 3fa16552..b24a5557 100644 --- a/src/main/java/com/interplug/qcast/biz/estimate/EstimateService.java +++ b/src/main/java/com/interplug/qcast/biz/estimate/EstimateService.java @@ -932,6 +932,8 @@ public class EstimateService { PwrGnrSimResponse pwrGnrSimResponse = pwrGnrSimService.selectPwrGnrSimulation(pwrGnrSimRequest); + pwrGnrSimResponse.setPwrGnrSimType(estimateRequest.getPwrGnrSimType()); + if (pwrGnrSimResponse != null) { try { // 발전시뮬레이션 안내사항 조회 @@ -947,7 +949,7 @@ public class EstimateService { estimateResponse.setPwrGnrSim(pwrGnrSimResponse); if ("PDF".equals(estimateRequest.getSchDownload())) { // PDF 다운로드 - String[] arrSection = new String[5]; // TODO Section 갯수 넣기 + String[] arrSection = new String[5]; int iSection = 0; String templateFilePath = "pdf_download_quotation_detail_template.html"; @@ -972,7 +974,6 @@ public class EstimateService { arrSection[iSection] = "div.section4"; iSection++; arrSection[iSection] = "div.section5"; - iSection++; // 발전시뮬레이션 pdf Html 생성 doc = pwrGnrSimService.pwrGnrSimPdfHtml(doc, pwrGnrSimResponse); diff --git a/src/main/java/com/interplug/qcast/biz/estimate/dto/EstimateRequest.java b/src/main/java/com/interplug/qcast/biz/estimate/dto/EstimateRequest.java index 8d7b428b..7058d14a 100644 --- a/src/main/java/com/interplug/qcast/biz/estimate/dto/EstimateRequest.java +++ b/src/main/java/com/interplug/qcast/biz/estimate/dto/EstimateRequest.java @@ -190,4 +190,7 @@ public class EstimateRequest { @Schema(description = "다운로드 파일명") private String fileName; + + @Schema(description = "발전시뮬레이션 타입") + private String pwrGnrSimType; } 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 c9272407..d5280a53 100644 --- a/src/main/java/com/interplug/qcast/biz/pwrGnrSimulation/PwrGnrSimService.java +++ b/src/main/java/com/interplug/qcast/biz/pwrGnrSimulation/PwrGnrSimService.java @@ -113,8 +113,12 @@ public class PwrGnrSimService { // 데이터가 없어서 오류가 발생한 경우, 빈값으로 리턴 PwrGnrSimResponse exceptionRes = new PwrGnrSimResponse(); - int[] exceptionData = new int[13]; - exceptionRes.setFrcPwrGnrList(exceptionData); + double[] dExceptionData = new double[13]; + String[] strExceptionData = formatAndPrintArray(dExceptionData); + exceptionRes.setHatsudenryouAll(strExceptionData); + exceptionRes.setHatsudenryouAllSnow(strExceptionData); + exceptionRes.setHatsudenryouPeakcutAll(strExceptionData); + exceptionRes.setHatsudenryouPeakcutAllSnow(strExceptionData); // 견적서 정보를 조회한다. PwrGnrSimPlanResponse planInfo = pwrGnrSimMapper.selectPlanInfo(pwrGnrSimRequest); @@ -274,7 +278,6 @@ public class PwrGnrSimService { pwrGnrSimRes.setPlanNo(planInfo.getPlanNo()); pwrGnrSimRes.setDrawingEstimateCreateDate(planInfo.getDrawingEstimateCreateDate()); pwrGnrSimRes.setCapacity(String.valueOf(dSpecification)); - pwrGnrSimRes.setAnlFrcsGnrt(pwrGnrSimRes.getFrcPwrGnrList()[12]); pwrGnrSimRes.setPrefName(planInfo.getPrefName()); pwrGnrSimRes.setAreaName(planInfo.getAreaName()); pwrGnrSimRes.setSnowfall(planInfo.getSnowfall()); @@ -437,10 +440,10 @@ public class PwrGnrSimService { double sekisairitsu = module_youryou_total / (pcs_youryou_total * 1000); // 피크 컷 및 발전량 배열 선언 - int[] hatsudenryou_all = new int[13]; // 피크 컷 없음 발전량(적설 고려 없음) - // double[] hatsudenryou_all_snow = new double[12]; // 피크 컷 없음 발전량(적설 고려 있음) - // double[] hatsudenryou_peakcut_all = new double[12]; // 피크 컷 있음 발전량(적설 고려 없음) - // double[] hatsudenryou_peakcut_all_snow = new double[12]; // 피크 컷 있음 발전량(적설 고려 있음) + double[] hatsudenryou_all = new double[13]; // 피크 컷 없음 발전량(적설 고려 없음) + double[] hatsudenryou_all_snow = new double[12]; // 피크 컷 없음 발전량(적설 고려 있음) + double[] hatsudenryou_peakcut_all = new double[12]; // 피크 컷 있음 발전량(적설 고려 없음) + double[] hatsudenryou_peakcut_all_snow = new double[12]; // 피크 컷 있음 발전량(적설 고려 있음) if (sekisairitsu <= 3) { @@ -522,14 +525,13 @@ public class PwrGnrSimService { for (int i = 0; i < roofLength; i++) { 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[j] * (1 - (snow[(simulationPointNumber * 12) + j])); - // hatsudenryou_peakcut_all_snow[j] = - // hatsudenryou_peakcut_all[j] * (1 - (snow[(simulationPointNumber * 12) + - // j])); + hatsudenryou_all_snow[j] = + hatsudenryou_all[j] * (1 - (snow[(simulationPointNumber * 12) + j])); + hatsudenryou_peakcut_all_snow[j] = + hatsudenryou_peakcut_all[j] * (1 - (snow[(simulationPointNumber * 12) + j])); } } @@ -548,15 +550,21 @@ public class PwrGnrSimService { // Arrays.toString(hatsudenryou_peakcut_all_snow)); PwrGnrSimResponse pwrGnrSimRes = new PwrGnrSimResponse(); - // pwrGnrSimRes.setSekisairitsu(sekisairitsu); - pwrGnrSimRes.setFrcPwrGnrList(hatsudenryou_all); - // pwrGnrSimRes.setHatsudenryouAllSnow(hatsudenryou_all_snow); - // pwrGnrSimRes.setHatsudenryouPeakcutAll(hatsudenryou_peakcut_all); - // pwrGnrSimRes.setHatsudenryouPeakcutAllSnow(hatsudenryou_peakcut_all_snow); - + pwrGnrSimRes.setHatsudenryouAll(formatAndPrintArray(hatsudenryou_all)); + pwrGnrSimRes.setHatsudenryouAllSnow(formatAndPrintArray(hatsudenryou_all_snow)); + pwrGnrSimRes.setHatsudenryouPeakcutAll(formatAndPrintArray(hatsudenryou_peakcut_all)); + pwrGnrSimRes.setHatsudenryouPeakcutAllSnow(formatAndPrintArray(hatsudenryou_peakcut_all_snow)); 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( int simulationPointNumber, @@ -1372,6 +1380,18 @@ public class PwrGnrSimService { public static Document pwrGnrSimPdfHtml(Document doc, PwrGnrSimResponse data) 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; // 상단 요약정보 @@ -1393,7 +1413,7 @@ public class PwrGnrSimService { elm.text(StringUtils.defaultString(data.getCapacity())); 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.text(StringUtils.defaultString(data.getSnowfall())); @@ -1401,10 +1421,13 @@ public class PwrGnrSimService { elm = doc.getElementById("standardWindSpeedId"); 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 = - 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 orgMaxValue = @@ -1485,28 +1508,28 @@ public class PwrGnrSimService { } // 예측발전량 - if (data.getFrcPwrGnrList() != null && data.getFrcPwrGnrList().length > 0) { - StringBuilder sb = new StringBuilder(); - for (int i = 0; i < 13; i++) { - sb.append( - "" - + StringUtils.defaultString(String.valueOf(data.getFrcPwrGnrList()[i])) - + ""); - } - - elm = doc.getElementById("frcPwrGnrList_detail"); - elm.append(sb.toString()); + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < 13; i++) { + sb.append( + "" + StringUtils.defaultString(String.format("%,d", pwrGnrSimList[i])) + ""); } + elm = doc.getElementById("frcPwrGnrList_detail"); + elm.append(sb.toString()); + // 모듈 list if (data.getRoofModuleList() != null && data.getRoofModuleList().size() > 0) { - StringBuilder sb = new StringBuilder(); + sb = new StringBuilder(); for (int i = 0; i < data.getRoofModuleList().size(); i++) { PwrGnrSimRoofResponse listItem = data.getRoofModuleList().get(i); sb.append(""); sb.append("" + StringUtils.defaultString(listItem.getRoofSurface()) + ""); - sb.append("" + StringUtils.defaultString(listItem.getSlopeAngle()) + ""); + sb.append( + "" + + StringUtils.defaultString(listItem.getSlopeAngle()) + + (listItem.getClassType() == 0 ? "寸" : "º") + + ""); sb.append("" + StringUtils.defaultString(listItem.getAzimuth()) + ""); sb.append("" + StringUtils.defaultString(listItem.getItemNo()) + ""); sb.append("" + StringUtils.defaultString(listItem.getAmount()) + ""); @@ -1519,7 +1542,7 @@ public class PwrGnrSimService { // pcs list if (data.getPcsList() != null && data.getPcsList().size() > 0) { - StringBuilder sb = new StringBuilder(); + sb = new StringBuilder(); for (int i = 0; i < data.getPcsList().size(); i++) { PwrGnrSimRoofResponse listItem = data.getPcsList().get(i); diff --git a/src/main/java/com/interplug/qcast/biz/pwrGnrSimulation/dto/PwrGnrSimRequest.java b/src/main/java/com/interplug/qcast/biz/pwrGnrSimulation/dto/PwrGnrSimRequest.java index cb22305d..b87df87d 100644 --- a/src/main/java/com/interplug/qcast/biz/pwrGnrSimulation/dto/PwrGnrSimRequest.java +++ b/src/main/java/com/interplug/qcast/biz/pwrGnrSimulation/dto/PwrGnrSimRequest.java @@ -12,11 +12,8 @@ public class PwrGnrSimRequest { @Schema(description = "플랜번호") private String planNo; - // @Schema(description = "도도부현") - // private String prefecture; - // - // @Schema(description = "관측지점") - // private String simulationPoint; + @Schema(description = "list 종류") + private String pwrGnrSimType; @Schema(description = "관측지점 번호") private int simulationPointNumber; diff --git a/src/main/java/com/interplug/qcast/biz/pwrGnrSimulation/dto/PwrGnrSimResponse.java b/src/main/java/com/interplug/qcast/biz/pwrGnrSimulation/dto/PwrGnrSimResponse.java index 16bbf332..0ab67a65 100644 --- a/src/main/java/com/interplug/qcast/biz/pwrGnrSimulation/dto/PwrGnrSimResponse.java +++ b/src/main/java/com/interplug/qcast/biz/pwrGnrSimulation/dto/PwrGnrSimResponse.java @@ -9,18 +9,20 @@ public class PwrGnrSimResponse { @Schema(description = "적재율") private double sekisairitsu; - @Schema(description = "예측발전량 리스트") - private int[] frcPwrGnrList; + @Schema(description = "적설 고려 없음 (피크 컷 없음 발전량) Type : A") + private String[] hatsudenryouAll; - // - // @Schema(description = "") - // private double[] hatsudenryouAllSnow; - // - // @Schema(description = "") - // private double[] hatsudenryouPeakcutAll; - // - // @Schema(description = "") - // private double[] hatsudenryouPeakcutAllSnow; + @Schema(description = "적설 고려 있음 (피크 컷 없음 발전량) Type : B") + private String[] hatsudenryouAllSnow; + + @Schema(description = "적설 고려 없음 (피크 컷 있음 발전량) Type : C") + private String[] hatsudenryouPeakcutAll; + + @Schema(description = "적설 고려 있음 (피크 컷 있음 발전량) Type : D") + private String[] hatsudenryouPeakcutAllSnow; + + @Schema(description = "list 종류") + private String pwrGnrSimType; @Schema(description = "물건번호") private String objectNo; @@ -34,9 +36,6 @@ public class PwrGnrSimResponse { @Schema(description = "시스템용량") private String capacity; - @Schema(description = "연간예측발전량") - private int anlFrcsGnrt; - @Schema(description = "도도부현") private int prefId;