Merge pull request '[1383]견적서 아이템 인코딩' (#311) from dev_cha into dev
Reviewed-on: #311
This commit is contained in:
commit
2746e171d0
@ -9,6 +9,8 @@ import java.math.BigDecimal;
|
|||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLConnection;
|
import java.net.URLConnection;
|
||||||
|
import java.net.URLDecoder;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
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.CanvasPopupStatusService;
|
||||||
import com.interplug.qcast.biz.canvaspopupstatus.dto.CanvasPopupStatus;
|
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.StringEscapeUtils;
|
||||||
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;
|
||||||
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
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.beans.factory.annotation.Value;
|
||||||
import org.springframework.http.HttpMethod;
|
import org.springframework.http.HttpMethod;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.web.util.HtmlUtils;
|
||||||
import org.springframework.web.util.UriComponentsBuilder;
|
import org.springframework.web.util.UriComponentsBuilder;
|
||||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
import com.interplug.qcast.biz.canvasStatus.CanvasStatusService;
|
import com.interplug.qcast.biz.canvasStatus.CanvasStatusService;
|
||||||
@ -1421,16 +1425,7 @@ public class EstimateService {
|
|||||||
|
|
||||||
// 각도 매핑 함수 호출
|
// 각도 매핑 함수 호출
|
||||||
String mappedDegree = excelUtil.mapCompassDegree(degreeValue);
|
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 {
|
try {
|
||||||
// classpath에서 리소스 파일을 읽어옵니다
|
// classpath에서 리소스 파일을 읽어옵니다
|
||||||
@ -1469,6 +1464,31 @@ public class EstimateService {
|
|||||||
for (ItemResponse itemResponse : estimateItemList) {
|
for (ItemResponse itemResponse : estimateItemList) {
|
||||||
itemResponse.setNo(String.valueOf(j++));
|
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(
|
itemResponse.setSalePrice(
|
||||||
String.format("%1$,.0f", Double.parseDouble(itemResponse.getSalePrice())));
|
String.format("%1$,.0f", Double.parseDouble(itemResponse.getSalePrice())));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user