발전시뮬레이션 타입 및 list 4가지 케이스 추가
This commit is contained in:
parent
8125c7d4c7
commit
bc61ad5256
@ -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);
|
||||
|
||||
@ -190,4 +190,7 @@ public class EstimateRequest {
|
||||
|
||||
@Schema(description = "다운로드 파일명")
|
||||
private String fileName;
|
||||
|
||||
@Schema(description = "발전시뮬레이션 타입")
|
||||
private String pwrGnrSimType;
|
||||
}
|
||||
|
||||
@ -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(
|
||||
"<td>"
|
||||
+ StringUtils.defaultString(String.valueOf(data.getFrcPwrGnrList()[i]))
|
||||
+ "</td>");
|
||||
}
|
||||
|
||||
elm = doc.getElementById("frcPwrGnrList_detail");
|
||||
elm.append(sb.toString());
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < 13; i++) {
|
||||
sb.append(
|
||||
"<td>" + StringUtils.defaultString(String.format("%,d", pwrGnrSimList[i])) + "</td>");
|
||||
}
|
||||
|
||||
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("<tr>");
|
||||
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.getItemNo()) + "</td>");
|
||||
sb.append("<td>" + StringUtils.defaultString(listItem.getAmount()) + "</td>");
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user