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 0dd73a40..9105676b 100644
--- a/src/main/java/com/interplug/qcast/biz/estimate/EstimateService.java
+++ b/src/main/java/com/interplug/qcast/biz/estimate/EstimateService.java
@@ -22,6 +22,8 @@ import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
+import com.interplug.qcast.biz.canvaspopupstatus.CanvasPopupStatusService;
+import com.interplug.qcast.biz.canvaspopupstatus.dto.CanvasPopupStatus;
import com.interplug.qcast.biz.pwrGnrSimulation.dto.PwrGnrSimRoofResponse;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Workbook;
@@ -91,6 +93,9 @@ public class EstimateService {
@Value("${qsp.url}")
private String QSP_API_URL;
+ @Value("${front.url}")
+ private String frontUrl;
+
private final ObjectMapper objectMapper;
private final EstimateMapper estimateMapper;
@@ -103,6 +108,9 @@ public class EstimateService {
@Autowired
private PwrGnrSimService pwrGnrSimService;
+ @Autowired
+ private CanvasPopupStatusService canvasPopupStatusService;
+
/**
* QSP 1차점 price 관리 목록 조회
*
@@ -1404,6 +1412,40 @@ public class EstimateService {
// 인증용량 구하기 (지붕면마다 모듈과 각각의 PCS의 총 용량을 서로 비교해 낮은쪽 용량으로 합산)
roofInfoResponse.setCertVolKw(estimateMapper.selectEstimateRoofCertVolKw(estimateRequest));
+ //방위값
+ CanvasPopupStatus cps = canvasPopupStatusService.selectCanvasPopupStatus(estimateResponse.getObjectNo(), Integer.parseInt(estimateResponse.getPlanNo()), "1");
+ String popupStatus = cps.getPopupStatus();
+ ExcelUtil excelUtil = new ExcelUtil();
+ try {
+ com.fasterxml.jackson.databind.ObjectMapper jsonMapper =
+ new com.fasterxml.jackson.databind.ObjectMapper();
+ com.fasterxml.jackson.databind.JsonNode jsonNode = jsonMapper.readTree(popupStatus);
+
+ // 특정 키의 값을 가져오기
+ String compasDeg = jsonNode.get("compasDeg").toString();
+ double degreeValue = Double.parseDouble(compasDeg.replace("\"", ""));
+
+ // 각도 매핑 함수 호출
+ String mappedDegree = excelUtil.mapCompassDegree(degreeValue);
+ String compasDegImgUrl = frontUrl + "/static/images/canvas/deg/" + mappedDegree + ".png";
+
+ URL url = new URL(compasDegImgUrl);
+ URLConnection con = url.openConnection();
+ HttpURLConnection exitCode = (HttpURLConnection)con;
+ if (exitCode.getResponseCode() == 200) {
+ InputStream imageInputStream = new URL(compasDegImgUrl).openStream();
+ byte[] degImg = Util.toByteArray(imageInputStream);
+ roofInfoResponse.setCompasDegImg(degImg);
+ }
+
+ roofInfoResponse.setCompasDeg(compasDeg);
+
+
+ } catch (Exception e) {
+ log.error("JSON 파싱 오류: ", e);
+ }
+
+
estimateResponse.setRoofInfo(roofInfoResponse);
// 아이템 목록 조회
@@ -1598,7 +1640,6 @@ public class EstimateService {
}
}
-
if ("PDF".equals(estimateRequest.getSchDownload())) { // PDF 다운로드
String[] arrSection = new String[6];
int iSection = 0;
@@ -1736,7 +1777,7 @@ public class EstimateService {
}
estimateResponse.setPcsList3(pcsList3);
- ExcelUtil excelUtil = new ExcelUtil();
+ excelUtil = new ExcelUtil();
byte[] excelBytes =
excelUtil.download(request, response, excelUtil.convertVoToMap(estimateResponse),
excelUtil.convertListToMap(estimateItemList), excelTemplateNam);
@@ -2142,6 +2183,9 @@ public class EstimateService {
elm = doc.getElementById("standardWindSpeedName4");
elm.text(StringUtils.defaultString(data.getStandardWindSpeedName()));
+// elm = doc.getElementById("deg1");
+// elm.text(StringUtils.defaultString(data.getRoofInfo().getCompasDeg())+"°");
+
// 도면(가대제외 이미지)
if (data.getDrawingImg1() != null) {
elm = doc.getElementById("drawingImg1");
@@ -2149,6 +2193,16 @@ public class EstimateService {
elm.html("
");
}
+ if (data.getRoofInfo().getCompasDegImg() != null) {
+ elm = doc.getElementById("degImg1");
+ String imgSrc1 = Base64.getEncoder().encodeToString(data.getRoofInfo().getCompasDegImg());
+ elm.html(
+ "
"+ StringUtils.defaultString(data.getRoofInfo().getCompasDeg()) + "°
");
+ }
+
+
int no = 1;
sb = new StringBuilder();
for (ItemResponse itemResponse : list) {
@@ -2256,6 +2310,15 @@ public class EstimateService {
elm.html("
");
}
+ if (data.getRoofInfo().getCompasDegImg() != null) {
+ elm = doc.getElementById("degImg2");
+ String imgSrc2 = Base64.getEncoder().encodeToString(data.getRoofInfo().getCompasDegImg());
+ elm.html(
+ "
"+ StringUtils.defaultString(data.getRoofInfo().getCompasDeg()) + "°
");
+ }
+
no = 1;
sb = new StringBuilder();
for (ItemResponse itemResponse : list) {
diff --git a/src/main/java/com/interplug/qcast/biz/estimate/dto/RoofInfoResponse.java b/src/main/java/com/interplug/qcast/biz/estimate/dto/RoofInfoResponse.java
index 6e12bb64..80571b0d 100644
--- a/src/main/java/com/interplug/qcast/biz/estimate/dto/RoofInfoResponse.java
+++ b/src/main/java/com/interplug/qcast/biz/estimate/dto/RoofInfoResponse.java
@@ -26,4 +26,11 @@ public class RoofInfoResponse {
@Schema(description = "지붕면 용량 목록")
private List roofVolList;
+
+ @Schema(description = "방위")
+ private String compasDeg;
+
+ @Schema(description = "방위이미지")
+ private byte[] compasDegImg;
+
}
diff --git a/src/main/java/com/interplug/qcast/util/ExcelUtil.java b/src/main/java/com/interplug/qcast/util/ExcelUtil.java
index a25288cb..a725d097 100644
--- a/src/main/java/com/interplug/qcast/util/ExcelUtil.java
+++ b/src/main/java/com/interplug/qcast/util/ExcelUtil.java
@@ -225,4 +225,67 @@ public class ExcelUtil {
return DECIMAL_FORMAT.format(sum);
}
}
+
+ /**
+ * compasDeg 값(-180~180)을 매핑된 각도로 변환
+ * @param degreeValue 원본 각도 값
+ * @return 매핑된 각도 문자열
+ */
+ public String mapCompassDegree(double degreeValue) {
+ if (degreeValue >= 0 && degreeValue <= 6) {
+ return "0";
+ } else if (degreeValue >= 7 && degreeValue <= 21) {
+ return "15";
+ } else if (degreeValue >= 22 && degreeValue <= 36) {
+ return "30";
+ } else if (degreeValue >= 37 && degreeValue <= 51) {
+ return "45";
+ } else if (degreeValue >= 52 && degreeValue <= 66) {
+ return "60";
+ } else if (degreeValue >= 67 && degreeValue <= 81) {
+ return "75";
+ } else if (degreeValue >= 82 && degreeValue <= 96) {
+ return "90";
+ } else if (degreeValue >= 97 && degreeValue <= 111) {
+ return "105";
+ } else if (degreeValue >= 112 && degreeValue <= 126) {
+ return "120";
+ } else if (degreeValue >= 127 && degreeValue <= 141) {
+ return "135";
+ } else if (degreeValue >= 142 && degreeValue <= 156) {
+ return "150";
+ } else if (degreeValue >= 157 && degreeValue <= 171) {
+ return "165";
+ } else if (degreeValue >= 172 && degreeValue <= 180) {
+ return "180";
+ } else if (degreeValue >= -180 && degreeValue <= -172) {
+ return "180";
+ } else if (degreeValue >= -171 && degreeValue <= -157) {
+ return "-165";
+ } else if (degreeValue >= -156 && degreeValue <= -142) {
+ return "-150";
+ } else if (degreeValue >= -141 && degreeValue <= -127) {
+ return "-135";
+ } else if (degreeValue >= -126 && degreeValue <= -112) {
+ return "-120";
+ } else if (degreeValue >= -111 && degreeValue <= -97) {
+ return "-105";
+ } else if (degreeValue >= -96 && degreeValue <= -82) {
+ return "-90";
+ } else if (degreeValue >= -81 && degreeValue <= -67) {
+ return "-75";
+ } else if (degreeValue >= -66 && degreeValue <= -52) {
+ return "-60";
+ } else if (degreeValue >= -51 && degreeValue <= -37) {
+ return "-45";
+ } else if (degreeValue >= -36 && degreeValue <= -22) {
+ return "-30";
+ } else if (degreeValue >= -21 && degreeValue <= -7) {
+ return "-15";
+ } else if (degreeValue >= -6 && degreeValue < 0) {
+ return "0";
+ } else {
+ return "0"; // 기본값
+ }
+ }
}
\ No newline at end of file
diff --git a/src/main/resources/config/application-dev.yml b/src/main/resources/config/application-dev.yml
index d2a739a6..1a1d7969 100644
--- a/src/main/resources/config/application-dev.yml
+++ b/src/main/resources/config/application-dev.yml
@@ -51,6 +51,6 @@ file:
ini.drawing.img.path: https://files.hanasys.jp/Drawing/dev
front:
- url: http://1.248.227.176:3000
+ url: https://dev.hanasys.jp
swagger.url: https://dev-api.hanasys.jp
\ No newline at end of file
diff --git a/src/main/resources/template/excel/excel_download_quotation_detail_template.xlsx b/src/main/resources/template/excel/excel_download_quotation_detail_template.xlsx
index 48db3f03..4ffd2280 100644
Binary files a/src/main/resources/template/excel/excel_download_quotation_detail_template.xlsx and b/src/main/resources/template/excel/excel_download_quotation_detail_template.xlsx differ
diff --git a/src/main/resources/template/pdf/pdf_download_quotation_detail_template.html b/src/main/resources/template/pdf/pdf_download_quotation_detail_template.html
index d96e776a..b5e8498b 100644
--- a/src/main/resources/template/pdf/pdf_download_quotation_detail_template.html
+++ b/src/main/resources/template/pdf/pdf_download_quotation_detail_template.html
@@ -67,15 +67,24 @@
/* 가이드박스 */
.guide-box {
+ position: relative;
border: 1px solid #000;
padding: 15px;
- margin: 10px 0
+ margin: 10px 0;
+ display: flex;
+ align-items: flex-start;
+ }
+
+ .guide-image {
+ margin-right: 15px;
+ flex-shrink: 0;
}
.guide-content {
white-space: pre-line;
line-height: 1.4;
- font-size: 14px
+ font-size: 14px;
+ flex: 1;
}
/* 차트퍼블 */
@@ -345,7 +354,17 @@
padding: 30px 0;
border: 1px solid #000;
}
+ .guide-image{
+ position: absolute;
+ top: 20px;
+ left: 20px;
+ width: 50px;
+ }
+ .guide-img-tit{
+ text-align: center;
+ font-size: 8px;
+ }
@@ -663,7 +682,11 @@
@@ -774,6 +797,8 @@