[1219] 견적서 엑셀에 방위각도 추가
This commit is contained in:
parent
b8fb5b844c
commit
c494df23a7
@ -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);
|
||||||
|
|||||||
@ -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;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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"; // 기본값
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -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
|
||||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user