발전시뮬레이션 엑셀다운로드 개발

This commit is contained in:
DESKTOP-6ARNG1Q\dlsgk 2024-11-08 17:56:57 +09:00
parent 3a2b958335
commit 5a452adf82
6 changed files with 46 additions and 8 deletions

View File

@ -9,6 +9,10 @@ import com.interplug.qcast.biz.object.ObjectMapper;
import com.interplug.qcast.biz.object.dto.ObjectResponse; import com.interplug.qcast.biz.object.dto.ObjectResponse;
import com.interplug.qcast.biz.object.dto.PlanRequest; import com.interplug.qcast.biz.object.dto.PlanRequest;
import com.interplug.qcast.biz.object.dto.PlanResponse; import com.interplug.qcast.biz.object.dto.PlanResponse;
import com.interplug.qcast.biz.pwrGnrSimulation.PwrGnrSimService;
import com.interplug.qcast.biz.pwrGnrSimulation.dto.PwrGnrSimGuideResponse;
import com.interplug.qcast.biz.pwrGnrSimulation.dto.PwrGnrSimRequest;
import com.interplug.qcast.biz.pwrGnrSimulation.dto.PwrGnrSimResponse;
import com.interplug.qcast.config.Exception.ErrorCode; import com.interplug.qcast.config.Exception.ErrorCode;
import com.interplug.qcast.config.Exception.QcastException; import com.interplug.qcast.config.Exception.QcastException;
import com.interplug.qcast.config.message.Messages; import com.interplug.qcast.config.message.Messages;
@ -17,6 +21,7 @@ import com.interplug.qcast.util.InterfaceQsp;
import io.micrometer.common.util.StringUtils; import io.micrometer.common.util.StringUtils;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import java.awt.*;
import java.beans.BeanInfo; import java.beans.BeanInfo;
import java.beans.Introspector; import java.beans.Introspector;
import java.beans.PropertyDescriptor; import java.beans.PropertyDescriptor;
@ -25,6 +30,7 @@ import java.lang.reflect.Field;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.List;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -53,6 +59,8 @@ public class EstimateService {
private final FileMapper fileMapper; private final FileMapper fileMapper;
@Autowired private PwrGnrSimService pwrGnrSimService;
/** /**
* 1차점 price 관리 목록 조회 * 1차점 price 관리 목록 조회
* *
@ -673,6 +681,29 @@ public class EstimateService {
String excelTemplatePath = String excelTemplatePath =
excelTemplateFilePath + File.separator + "excel_download_quotation_detail_template.xlsx"; excelTemplateFilePath + File.separator + "excel_download_quotation_detail_template.xlsx";
// 발전시뮬레이션 계산
PwrGnrSimRequest pwrGnrSimRequest = new PwrGnrSimRequest();
pwrGnrSimRequest.setObjectNo(estimateResponse.getObjectNo());
pwrGnrSimRequest.setPlanNo(estimateResponse.getPlanNo());
PwrGnrSimResponse pwrGnrSimResponse =
pwrGnrSimService.selectPwrGnrSimulation(pwrGnrSimRequest);
if (pwrGnrSimResponse != null) {
try {
// 발전시뮬레이션 안내사항 조회
PwrGnrSimGuideResponse pwrGnrSimGuideInfo =
pwrGnrSimService.selectPwrGnrSimulationGuideInfo();
if (pwrGnrSimGuideInfo != null) {
pwrGnrSimResponse.setGuideInfo(pwrGnrSimGuideInfo.getData());
}
} catch (Exception e) {
}
}
estimateResponse.setPwrGnrSim(pwrGnrSimResponse);
excelUtil.download( excelUtil.download(
request, request,
response, response,
@ -680,6 +711,7 @@ public class EstimateService {
this.convertListToMap(estimateItemList), this.convertListToMap(estimateItemList),
excelFileName, excelFileName,
excelTemplatePath); excelTemplatePath);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -1,6 +1,7 @@
package com.interplug.qcast.biz.estimate.dto; package com.interplug.qcast.biz.estimate.dto;
import com.interplug.qcast.biz.file.dto.FileResponse; import com.interplug.qcast.biz.file.dto.FileResponse;
import com.interplug.qcast.biz.pwrGnrSimulation.dto.PwrGnrSimResponse;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List; import java.util.List;
import lombok.Data; import lombok.Data;
@ -233,4 +234,7 @@ public class EstimateResponse {
@Schema(description = "첨부파일 목록") @Schema(description = "첨부파일 목록")
List<FileResponse> fileList; List<FileResponse> fileList;
@Schema(description = "발전시뮬레이션 정보")
PwrGnrSimResponse pwrGnrSim;
} }

View File

@ -183,15 +183,15 @@ public class PwrGnrSimService {
int i = 0; int i = 0;
for (PwrGnrSimRoofResponse data : roofList) { for (PwrGnrSimRoofResponse data : roofList) {
if (data.getAzimuth() != null) { // 경사 if (data.getSlope() != null) { // 경사
dKoubai[i] = dKoubai[i] =
(2 * Math.PI) (2 * Math.PI)
* ((Math.atan(Double.parseDouble(data.getAzimuth()) / 10) * 180 / Math.PI) / 360); * ((Math.atan(Double.parseDouble(data.getSlope()) / 10) * 180 / Math.PI) / 360);
} else { // 각도 } else { // 각도
dKoubai[i] = (2 * Math.PI) * (Double.parseDouble(data.getAngle()) / 360); dKoubai[i] = (2 * Math.PI) * (Double.parseDouble(data.getAngle()) / 360);
} }
dHoui[i] = Math.abs((2 * Math.PI) * (Double.parseDouble(data.getSlope()) / 360)); dHoui[i] = Math.abs((2 * Math.PI) * (Double.parseDouble(data.getAzimuth()) / 360));
// 지붕별 모듈정보 셋팅 // 지붕별 모듈정보 셋팅
int j = 0; int j = 0;
@ -1038,7 +1038,6 @@ public class PwrGnrSimService {
double IrbyMath = 0; double IrbyMath = 0;
double[] IrbyTotal = new double[12]; double[] IrbyTotal = new double[12];
System.err.println(" simulationPointNumber >>>>> " + simulationPointNumber);
i = simulationPointNumber * 12; // Reset i i = simulationPointNumber * 12; // Reset i
// System.err.println( " i >>>>>>>>> " + i); // System.err.println( " i >>>>>>>>> " + i);

View File

@ -21,7 +21,7 @@ public class PwrGnrSimRequest {
@Schema(description = "관측지점 번호") @Schema(description = "관측지점 번호")
private int simulationPointNumber; private int simulationPointNumber;
@Schema(description = "기울기/경사") @Schema(description = "경사/각도")
private double[] koubai; private double[] koubai;
@Schema(description = "방위") @Schema(description = "방위")

View File

@ -60,4 +60,7 @@ public class PwrGnrSimResponse {
@Schema(description = "pcs list") @Schema(description = "pcs list")
private List<PwrGnrSimRoofResponse> pcsList; private List<PwrGnrSimRoofResponse> pcsList;
@Schema(description = "안내문구")
private String guideInfo;
} }

View File

@ -14,12 +14,12 @@ public class PwrGnrSimRoofResponse {
@Schema(description = "경사") @Schema(description = "경사")
private String slope; private String slope;
@Schema(description = "방위각")
private String azimuth;
@Schema(description = "각도") @Schema(description = "각도")
private String angle; private String angle;
@Schema(description = "방위각")
private String azimuth;
@Schema(description = "아이템 아이디") @Schema(description = "아이템 아이디")
private String itemId; private String itemId;