From 742ef888746d0831cdfbb1eb23cce34fcb6ed773 Mon Sep 17 00:00:00 2001 From: ysCha Date: Mon, 12 Jan 2026 16:55:53 +0900 Subject: [PATCH] =?UTF-8?q?[1383]=EA=B2=AC=EC=A0=81=EC=84=9C=20=EC=95=84?= =?UTF-8?q?=EC=9D=B4=ED=85=9C=20=EC=9D=B8=EC=BD=94=EB=94=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../qcast/biz/estimate/EstimateService.java | 38 ++++++++++++++----- 1 file changed, 29 insertions(+), 9 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 3de29103..fd1dffd2 100644 --- a/src/main/java/com/interplug/qcast/biz/estimate/EstimateService.java +++ b/src/main/java/com/interplug/qcast/biz/estimate/EstimateService.java @@ -9,6 +9,8 @@ import java.math.BigDecimal; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLConnection; +import java.net.URLDecoder; +import java.nio.charset.StandardCharsets; import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; @@ -16,6 +18,7 @@ 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.StringEscapeUtils; import org.apache.commons.lang3.StringUtils; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.WorkbookFactory; @@ -26,6 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpMethod; import org.springframework.stereotype.Service; +import org.springframework.web.util.HtmlUtils; import org.springframework.web.util.UriComponentsBuilder; import com.fasterxml.jackson.databind.DeserializationFeature; import com.interplug.qcast.biz.canvasStatus.CanvasStatusService; @@ -1421,16 +1425,7 @@ public class EstimateService { // 각도 매핑 함수 호출 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); -// } try { // classpath에서 리소스 파일을 읽어옵니다 @@ -1469,6 +1464,31 @@ public class EstimateService { for (ItemResponse itemResponse : estimateItemList) { itemResponse.setNo(String.valueOf(j++)); + // itemName 디코딩 및 HTML Unescape 처리 + String itemName = itemResponse.getItemName(); + if (StringUtils.isNotEmpty(itemName)) { + try { + // 1. URL 디코딩 (% 처리) + if (itemName.contains("%")) { + itemName = URLDecoder.decode(itemName, StandardCharsets.UTF_8); + } + + // 2. HTML Unescape 처리 (&가 포함된 경우만) + // Φ1 -> Φ1 -> Φ1 순차적으로 복원 + if (itemName.contains("&")) { + String prevName; + do { + prevName = itemName; + itemName = HtmlUtils.htmlUnescape(itemName); + } while (!prevName.equals(itemName) && itemName.contains("&")); + } + + itemResponse.setItemName(itemName); + } catch (Exception e) { + log.warn("Excel itemName processing failed: {}", itemName); + } + } + // 문자열 통화로 변환 처리 itemResponse.setSalePrice( String.format("%1$,.0f", Double.parseDouble(itemResponse.getSalePrice()))); -- 2.47.2