dev #211

Merged
ysCha merged 2 commits from dev into prd-deploy 2025-07-31 13:22:40 +09:00
6 changed files with 163 additions and 5 deletions

View File

@ -22,6 +22,8 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; 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 com.interplug.qcast.biz.pwrGnrSimulation.dto.PwrGnrSimRoofResponse;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
@ -91,6 +93,9 @@ public class EstimateService {
@Value("${qsp.url}") @Value("${qsp.url}")
private String QSP_API_URL; private String QSP_API_URL;
@Value("${front.url}")
private String frontUrl;
private final ObjectMapper objectMapper; private final ObjectMapper objectMapper;
private final EstimateMapper estimateMapper; private final EstimateMapper estimateMapper;
@ -103,6 +108,9 @@ public class EstimateService {
@Autowired @Autowired
private PwrGnrSimService pwrGnrSimService; private PwrGnrSimService pwrGnrSimService;
@Autowired
private CanvasPopupStatusService canvasPopupStatusService;
/** /**
* QSP 1차점 price 관리 목록 조회 * QSP 1차점 price 관리 목록 조회
* *
@ -1404,6 +1412,40 @@ public class EstimateService {
// 인증용량 구하기 (지붕면마다 모듈과 각각의 PCS의 용량을 서로 비교해 낮은쪽 용량으로 합산) // 인증용량 구하기 (지붕면마다 모듈과 각각의 PCS의 용량을 서로 비교해 낮은쪽 용량으로 합산)
roofInfoResponse.setCertVolKw(estimateMapper.selectEstimateRoofCertVolKw(estimateRequest)); 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); estimateResponse.setRoofInfo(roofInfoResponse);
// 아이템 목록 조회 // 아이템 목록 조회
@ -1598,7 +1640,6 @@ public class EstimateService {
} }
} }
if ("PDF".equals(estimateRequest.getSchDownload())) { // PDF 다운로드 if ("PDF".equals(estimateRequest.getSchDownload())) { // PDF 다운로드
String[] arrSection = new String[6]; String[] arrSection = new String[6];
int iSection = 0; int iSection = 0;
@ -1736,7 +1777,7 @@ public class EstimateService {
} }
estimateResponse.setPcsList3(pcsList3); estimateResponse.setPcsList3(pcsList3);
ExcelUtil excelUtil = new ExcelUtil(); excelUtil = new ExcelUtil();
byte[] excelBytes = byte[] excelBytes =
excelUtil.download(request, response, excelUtil.convertVoToMap(estimateResponse), excelUtil.download(request, response, excelUtil.convertVoToMap(estimateResponse),
excelUtil.convertListToMap(estimateItemList), excelTemplateNam); excelUtil.convertListToMap(estimateItemList), excelTemplateNam);
@ -2142,6 +2183,9 @@ public class EstimateService {
elm = doc.getElementById("standardWindSpeedName4"); elm = doc.getElementById("standardWindSpeedName4");
elm.text(StringUtils.defaultString(data.getStandardWindSpeedName())); elm.text(StringUtils.defaultString(data.getStandardWindSpeedName()));
// elm = doc.getElementById("deg1");
// elm.text(StringUtils.defaultString(data.getRoofInfo().getCompasDeg())+"°");
// 도면(가대제외 이미지) // 도면(가대제외 이미지)
if (data.getDrawingImg1() != null) { if (data.getDrawingImg1() != null) {
elm = doc.getElementById("drawingImg1"); elm = doc.getElementById("drawingImg1");
@ -2149,6 +2193,16 @@ public class EstimateService {
elm.html("<img src='data:image/png;base64," + imgSrc1 + "' width='660'/>"); elm.html("<img src='data:image/png;base64," + imgSrc1 + "' width='660'/>");
} }
if (data.getRoofInfo().getCompasDegImg() != null) {
elm = doc.getElementById("degImg1");
String imgSrc1 = Base64.getEncoder().encodeToString(data.getRoofInfo().getCompasDegImg());
elm.html(
"<img src='data:image/png;base64,"
+ imgSrc1
+ "' width='50'/><div class=\"guide-img-tit\" >"+ StringUtils.defaultString(data.getRoofInfo().getCompasDeg()) + "°</div>");
}
int no = 1; int no = 1;
sb = new StringBuilder(); sb = new StringBuilder();
for (ItemResponse itemResponse : list) { for (ItemResponse itemResponse : list) {
@ -2256,6 +2310,15 @@ public class EstimateService {
elm.html("<img src='data:image/png;base64," + imgSrc2 + "' width='660'/>"); elm.html("<img src='data:image/png;base64," + imgSrc2 + "' width='660'/>");
} }
if (data.getRoofInfo().getCompasDegImg() != null) {
elm = doc.getElementById("degImg2");
String imgSrc2 = Base64.getEncoder().encodeToString(data.getRoofInfo().getCompasDegImg());
elm.html(
"<img src='data:image/png;base64,"
+ imgSrc2
+ "' width='50'/><div class=\"guide-img-tit\" >"+ StringUtils.defaultString(data.getRoofInfo().getCompasDeg()) + "°</div>");
}
no = 1; no = 1;
sb = new StringBuilder(); sb = new StringBuilder();
for (ItemResponse itemResponse : list) { for (ItemResponse itemResponse : list) {

View File

@ -26,4 +26,11 @@ public class RoofInfoResponse {
@Schema(description = "지붕면 용량 목록") @Schema(description = "지붕면 용량 목록")
private List<RoofResponse> roofVolList; private List<RoofResponse> roofVolList;
@Schema(description = "방위")
private String compasDeg;
@Schema(description = "방위이미지")
private byte[] compasDegImg;
} }

View File

@ -225,4 +225,67 @@ public class ExcelUtil {
return DECIMAL_FORMAT.format(sum); 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"; // 기본값
}
}
} }

View File

@ -51,6 +51,6 @@ file:
ini.drawing.img.path: https://files.hanasys.jp/Drawing/dev ini.drawing.img.path: https://files.hanasys.jp/Drawing/dev
front: front:
url: http://1.248.227.176:3000 url: https://dev.hanasys.jp
swagger.url: https://dev-api.hanasys.jp swagger.url: https://dev-api.hanasys.jp

View File

@ -67,15 +67,24 @@
/* 가이드박스 */ /* 가이드박스 */
.guide-box { .guide-box {
position: relative;
border: 1px solid #000; border: 1px solid #000;
padding: 15px; padding: 15px;
margin: 10px 0 margin: 10px 0;
display: flex;
align-items: flex-start;
}
.guide-image {
margin-right: 15px;
flex-shrink: 0;
} }
.guide-content { .guide-content {
white-space: pre-line; white-space: pre-line;
line-height: 1.4; line-height: 1.4;
font-size: 14px font-size: 14px;
flex: 1;
} }
/* 차트퍼블 */ /* 차트퍼블 */
@ -345,7 +354,17 @@
padding: 30px 0; padding: 30px 0;
border: 1px solid #000; border: 1px solid #000;
} }
.guide-image{
position: absolute;
top: 20px;
left: 20px;
width: 50px;
}
.guide-img-tit{
text-align: center;
font-size: 8px;
}
</style> </style>
</head> </head>
@ -663,7 +682,11 @@
</table> </table>
<div class="guide-box"> <div class="guide-box">
<div class="guide-image" id="degImg1">
</div>
<div class="guide-content" id="drawingImg1"> <div class="guide-content" id="drawingImg1">
</div> </div>
</div> </div>
@ -774,6 +797,8 @@
</table> </table>
<div class="guide-box"> <div class="guide-box">
<div class="guide-image" id="degImg2">
</div>
<div class="guide-content" id="drawingImg2"> <div class="guide-content" id="drawingImg2">
</div> </div>
</div> </div>