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 7ba652e8..bdaa0115 100644 --- a/src/main/java/com/interplug/qcast/biz/estimate/EstimateService.java +++ b/src/main/java/com/interplug/qcast/biz/estimate/EstimateService.java @@ -1,27 +1,5 @@ package com.interplug.qcast.biz.estimate; -import java.beans.BeanInfo; -import java.beans.Introspector; -import java.beans.PropertyDescriptor; -import java.io.IOException; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.math.BigDecimal; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import org.apache.commons.lang3.StringUtils; -import org.jsoup.nodes.Document; -import org.jsoup.nodes.Element; -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.UriComponentsBuilder; import com.fasterxml.jackson.databind.DeserializationFeature; import com.interplug.qcast.biz.estimate.dto.EstimateApiResponse; import com.interplug.qcast.biz.estimate.dto.EstimateCopyRequest; @@ -45,6 +23,7 @@ import com.interplug.qcast.biz.object.ObjectMapper; import com.interplug.qcast.biz.object.dto.ObjectRequest; import com.interplug.qcast.biz.object.dto.ObjectResponse; import com.interplug.qcast.biz.pwrGnrSimulation.PwrGnrSimService; +import com.interplug.qcast.biz.pwrGnrSimulation.dto.PwrGnrSimGuideResponse; import com.interplug.qcast.biz.pwrGnrSimulation.dto.PwrGnrSimRequest; import com.interplug.qcast.biz.pwrGnrSimulation.dto.PwrGnrSimResponse; import com.interplug.qcast.config.Exception.ErrorCode; @@ -55,8 +34,30 @@ import com.interplug.qcast.util.InterfaceQsp; import com.interplug.qcast.util.PdfUtil; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; +import java.beans.BeanInfo; +import java.beans.Introspector; +import java.beans.PropertyDescriptor; +import java.io.IOException; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.math.BigDecimal; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.jsoup.nodes.Document; +import org.jsoup.nodes.Element; +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.UriComponentsBuilder; @Slf4j @Service @@ -64,8 +65,7 @@ import lombok.extern.slf4j.Slf4j; public class EstimateService { private final InterfaceQsp interfaceQsp; - @Autowired - Messages message; + @Autowired Messages message; @Value("${file.ini.root.path}") private String baseDirPath; @@ -82,8 +82,7 @@ public class EstimateService { private final FileMapper fileMapper; - @Autowired - private PwrGnrSimService pwrGnrSimService; + @Autowired private PwrGnrSimService pwrGnrSimService; /** * QSP 1차점 price 관리 목록 조회 @@ -95,25 +94,31 @@ public class EstimateService { public EstimateApiResponse selectStorePriceList(PriceRequest priceRequest) throws Exception { // Validation if (StringUtils.isEmpty(priceRequest.getSaleStoreId())) { - throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, + throw new QcastException( + ErrorCode.INVALID_INPUT_VALUE, message.getMessage("common.message.required.data", "Sale Store ID")); } if (StringUtils.isEmpty(priceRequest.getSapSalesStoreCd())) { - throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, + throw new QcastException( + ErrorCode.INVALID_INPUT_VALUE, message.getMessage("common.message.required.data", "Sap Sale Store Code")); } if (StringUtils.isEmpty(priceRequest.getDocTpCd())) { - throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, + throw new QcastException( + ErrorCode.INVALID_INPUT_VALUE, message.getMessage("common.message.required.data", "Estimate Type")); } EstimateApiResponse response = null; /* [1]. QSP API (url + param) Setting */ String url = QSP_API_URL + "/api/price/storePriceList"; - String apiUrl = UriComponentsBuilder.fromHttpUrl(url) - .queryParam("saleStoreId", priceRequest.getSaleStoreId()) - .queryParam("sapSalesStoreCd", priceRequest.getSapSalesStoreCd()) - .queryParam("docTpCd", priceRequest.getDocTpCd()).build().toUriString(); + String apiUrl = + UriComponentsBuilder.fromHttpUrl(url) + .queryParam("saleStoreId", priceRequest.getSaleStoreId()) + .queryParam("sapSalesStoreCd", priceRequest.getSapSalesStoreCd()) + .queryParam("docTpCd", priceRequest.getDocTpCd()) + .build() + .toUriString(); /* [2]. QSP API CALL -> Response */ String strResponse = interfaceQsp.callApi(HttpMethod.GET, apiUrl, null); @@ -141,22 +146,26 @@ public class EstimateService { public EstimateApiResponse selectItemPriceList(PriceRequest priceRequest) throws Exception { // Validation if (StringUtils.isEmpty(priceRequest.getSaleStoreId())) { - throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, + throw new QcastException( + ErrorCode.INVALID_INPUT_VALUE, message.getMessage("common.message.required.data", "Sale Store ID")); } if (StringUtils.isEmpty(priceRequest.getSapSalesStoreCd())) { - throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, + throw new QcastException( + ErrorCode.INVALID_INPUT_VALUE, message.getMessage("common.message.required.data", "Sap Sale Store Code")); } if (StringUtils.isEmpty(priceRequest.getPriceCd())) { - throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, + throw new QcastException( + ErrorCode.INVALID_INPUT_VALUE, message.getMessage("common.message.required.data", "Price Code")); } EstimateApiResponse response = null; /* [1]. QSP API CALL -> Response */ - String strResponse = interfaceQsp.callApi(HttpMethod.POST, - QSP_API_URL + "/api//price/storePriceItemList", priceRequest); + String strResponse = + interfaceQsp.callApi( + HttpMethod.POST, QSP_API_URL + "/api//price/storePriceItemList", priceRequest); if (!"".equals(strResponse)) { com.fasterxml.jackson.databind.ObjectMapper om = @@ -193,11 +202,13 @@ public class EstimateService { public EstimateResponse selectEstimateDetail(String objectNo, String planNo) throws Exception { // Validation if (StringUtils.isEmpty(objectNo)) { - throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, + throw new QcastException( + ErrorCode.INVALID_INPUT_VALUE, message.getMessage("common.message.required.data", "Object No")); } if (StringUtils.isEmpty(planNo)) { - throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, + throw new QcastException( + ErrorCode.INVALID_INPUT_VALUE, message.getMessage("common.message.required.data", "Plan No")); } @@ -241,19 +252,23 @@ public class EstimateService { public void insertEstimate(EstimateRequest estimateRequest) throws Exception { // Validation if (StringUtils.isEmpty(estimateRequest.getObjectNo())) { - throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, + throw new QcastException( + ErrorCode.INVALID_INPUT_VALUE, message.getMessage("common.message.required.data", "Object No")); } if (StringUtils.isEmpty(estimateRequest.getPlanNo())) { - throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, + throw new QcastException( + ErrorCode.INVALID_INPUT_VALUE, message.getMessage("common.message.required.data", "Plan No")); } if (StringUtils.isEmpty(estimateRequest.getSaleStoreId())) { - throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, + throw new QcastException( + ErrorCode.INVALID_INPUT_VALUE, message.getMessage("common.message.required.data", "Sale Store ID")); } if (StringUtils.isEmpty(estimateRequest.getSapSalesStoreCd())) { - throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, + throw new QcastException( + ErrorCode.INVALID_INPUT_VALUE, message.getMessage("common.message.required.data", "Sap Sale Store Code")); } @@ -272,8 +287,8 @@ public class EstimateService { ObjectResponse objectResponse = objectMapper.selectObjectDetail(estimateRequest.getObjectNo()); if (objectResponse != null) { - estimateRequest - .setWeatherPoint(objectResponse.getPrefName() + " - " + objectResponse.getAreaName()); + estimateRequest.setWeatherPoint( + objectResponse.getPrefName() + " - " + objectResponse.getAreaName()); estimateRequest.setCharger(objectResponse.getReceiveUser()); } @@ -395,8 +410,10 @@ public class EstimateService { bomItem.setUnit(itemResponse.getUnit()); bomItem.setPnowW(itemResponse.getPnowW()); bomItem.setSpecification(itemResponse.getPnowW()); - bomItem.setAmount(String.valueOf(Integer.parseInt(itemResponse.getBomAmount()) - * Integer.parseInt(itemRequest.getAmount()))); + bomItem.setAmount( + String.valueOf( + Integer.parseInt(itemResponse.getBomAmount()) + * Integer.parseInt(itemRequest.getAmount()))); bomItem.setBomAmount(itemResponse.getBomAmount()); bomItem.setUnitPrice(itemResponse.getSalePrice()); bomItem.setSalePrice(itemResponse.getSalePrice()); @@ -487,24 +504,29 @@ public class EstimateService { String pcTypeNo = ""; for (ItemRequest itemRequest : itemList) { if (StringUtils.isEmpty(itemRequest.getDispOrder())) { - throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, + throw new QcastException( + ErrorCode.INVALID_INPUT_VALUE, message.getMessage("common.message.required.data", "Display Order")); } if (StringUtils.isEmpty(itemRequest.getItemId())) { - throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, + throw new QcastException( + ErrorCode.INVALID_INPUT_VALUE, message.getMessage("common.message.required.data", "Item ID")); } if (StringUtils.isEmpty(itemRequest.getAmount())) { - throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, + throw new QcastException( + ErrorCode.INVALID_INPUT_VALUE, message.getMessage("common.message.required.data", "Item Amount")); } // 수량 - BigDecimal amount = new BigDecimal( - StringUtils.isEmpty(itemRequest.getAmount()) ? "0" : itemRequest.getAmount()); + BigDecimal amount = + new BigDecimal( + StringUtils.isEmpty(itemRequest.getAmount()) ? "0" : itemRequest.getAmount()); // 아이템용량 - BigDecimal pnowW = new BigDecimal( - StringUtils.isEmpty(itemRequest.getPnowW()) ? "0" : itemRequest.getPnowW()); + BigDecimal pnowW = + new BigDecimal( + StringUtils.isEmpty(itemRequest.getPnowW()) ? "0" : itemRequest.getPnowW()); // 모듈/PC 체크 if ("MODULE_".equals(itemRequest.getItemGroup())) { @@ -573,7 +595,8 @@ public class EstimateService { itemRequest.setPartAdd( !StringUtils.isEmpty(itemRequest.getPartAdd()) ? itemRequest.getPartAdd() : "0"); itemRequest.setItemChangeFlg( - !StringUtils.isEmpty(itemRequest.getItemChangeFlg()) ? itemRequest.getItemChangeFlg() + !StringUtils.isEmpty(itemRequest.getItemChangeFlg()) + ? itemRequest.getItemChangeFlg() : "0"); itemRequest.setUserId(estimateRequest.getUserId()); @@ -612,11 +635,13 @@ public class EstimateService { throws Exception { // Validation if (StringUtils.isEmpty(estimateCopyRequest.getObjectNo())) { - throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, + throw new QcastException( + ErrorCode.INVALID_INPUT_VALUE, message.getMessage("common.message.required.data", "Object No")); } if (StringUtils.isEmpty(estimateCopyRequest.getPlanNo())) { - throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, + throw new QcastException( + ErrorCode.INVALID_INPUT_VALUE, message.getMessage("common.message.required.data", "Plan No")); } // 응답 객체 @@ -626,8 +651,8 @@ public class EstimateService { ObjectRequest objectRequest = new ObjectRequest(); objectRequest.setSaleStoreId(estimateCopyRequest.getCopySaleStoreId()); - objectRequest - .setReceiveUser(StringUtils.defaultString(estimateCopyRequest.getCopyReceiveUser())); + objectRequest.setReceiveUser( + StringUtils.defaultString(estimateCopyRequest.getCopyReceiveUser())); objectRequest.setDelFlg("0"); objectRequest.setTempFlg("0"); objectRequest.setTempDelFlg("0"); @@ -704,7 +729,8 @@ public class EstimateService { itemRequest.setPartAdd( !StringUtils.isEmpty(itemRequest.getPartAdd()) ? itemRequest.getPartAdd() : "0"); itemRequest.setItemChangeFlg( - !StringUtils.isEmpty(itemRequest.getItemChangeFlg()) ? itemRequest.getItemChangeFlg() + !StringUtils.isEmpty(itemRequest.getItemChangeFlg()) + ? itemRequest.getItemChangeFlg() : "0"); itemRequest.setUserId(estimateCopyRequest.getUserId()); @@ -793,13 +819,14 @@ public class EstimateService { * @param estimateRequest 견적서 엑셀 다운로드 요청 정보 * @throws Exception */ - public void excelDownload(HttpServletRequest request, HttpServletResponse response, - EstimateRequest estimateRequest) throws Exception { + public void excelDownload( + HttpServletRequest request, HttpServletResponse response, EstimateRequest estimateRequest) + throws Exception { // file Name 명이 없는경우 if (estimateRequest.getFileName() == null || "".equals(estimateRequest.getFileName())) { - estimateRequest - .setFileName("Quation_Detail_" + new SimpleDateFormat("yyyyMMdd").format(new Date())); + estimateRequest.setFileName( + "Quation_Detail_" + new SimpleDateFormat("yyyyMMdd").format(new Date())); } EstimateResponse estimateResponse = new EstimateResponse(); @@ -875,8 +902,8 @@ public class EstimateService { List estimateItemList = estimateMapper.selectEstimateItemList(estimateRequest); // 총 합산금액 계산 - this.selectTotalPriceInfo(estimateResponse, estimateItemList, - estimateRequest.getSchUnitPriceFlg()); + this.selectTotalPriceInfo( + estimateResponse, estimateItemList, estimateRequest.getSchUnitPriceFlg()); int j = 1; for (ItemResponse itemResponse : estimateItemList) { @@ -885,8 +912,8 @@ public class EstimateService { // 문자열 통화로 변환 처리 itemResponse.setSalePrice( String.format("%1$,.0f", Double.parseDouble(itemResponse.getSalePrice()))); - itemResponse - .setAmount(String.format("%1$,.0f", Double.parseDouble(itemResponse.getAmount()))); + itemResponse.setAmount( + String.format("%1$,.0f", Double.parseDouble(itemResponse.getAmount()))); itemResponse.setSaleTotPrice( String.format("%1$,.0f", Double.parseDouble(itemResponse.getSaleTotPrice()))); @@ -900,14 +927,14 @@ public class EstimateService { // 합산 문자열 통화로 변환 처리 estimateResponse.setPkgYn("YJSS".equals(estimateResponse.getEstimateType()) ? "Y" : "N"); - estimateResponse - .setPkgNo("YJSS".equals(estimateResponse.getEstimateType()) ? String.valueOf(j++) : ""); + estimateResponse.setPkgNo( + "YJSS".equals(estimateResponse.getEstimateType()) ? String.valueOf(j++) : ""); if ("YJSS".equals(estimateResponse.getEstimateType())) { - estimateResponse - .setPkgAsp(String.format("%1$,.0f", Double.parseDouble(estimateResponse.getPkgAsp()))); + estimateResponse.setPkgAsp( + String.format("%1$,.0f", Double.parseDouble(estimateResponse.getPkgAsp()))); } - estimateResponse - .setTotVol(String.format("%1$,.0f", Double.parseDouble(estimateResponse.getTotVol()))); + estimateResponse.setTotVol( + String.format("%1$,.0f", Double.parseDouble(estimateResponse.getTotVol()))); estimateResponse.setPkgTotPrice( String.format("%1$,.0f", Double.parseDouble(estimateResponse.getPkgTotPrice()))); estimateResponse.setSupplyPrice( @@ -929,11 +956,11 @@ public class EstimateService { if (pwrGnrSimResponse != null) { try { // 발전시뮬레이션 안내사항 조회 - // PwrGnrSimGuideResponse pwrGnrSimGuideInfo = - // pwrGnrSimService.selectPwrGnrSimulationGuideInfo(); - // if (pwrGnrSimGuideInfo != null) { - // pwrGnrSimResponse.setGuideInfo(pwrGnrSimGuideInfo.getData()); - // } + PwrGnrSimGuideResponse pwrGnrSimGuideInfo = + pwrGnrSimService.selectPwrGnrSimulationGuideInfo(); + if (pwrGnrSimGuideInfo != null) { + pwrGnrSimResponse.setGuideInfo(pwrGnrSimGuideInfo.getData()); + } } catch (Exception e) { } } @@ -989,8 +1016,12 @@ public class EstimateService { String excelTemplateNam = "excel_download_quotation_detail_template.xlsx"; ExcelUtil excelUtil = new ExcelUtil(); - excelUtil.download(request, response, this.convertVoToMap(estimateResponse), - this.convertListToMap(estimateItemList), estimateRequest.getFileName(), + excelUtil.download( + request, + response, + this.convertVoToMap(estimateResponse), + this.convertListToMap(estimateItemList), + estimateRequest.getFileName(), excelTemplateNam); } @@ -1007,8 +1038,9 @@ public class EstimateService { * @param unitPriceFlg 가격 표시 코드 * @throws Exception */ - public void selectTotalPriceInfo(EstimateResponse estimateResponse, List itemList, - String unitPriceFlg) throws Exception { + public void selectTotalPriceInfo( + EstimateResponse estimateResponse, List itemList, String unitPriceFlg) + throws Exception { BigDecimal totAmount = BigDecimal.ZERO; BigDecimal totVol = BigDecimal.ZERO; BigDecimal pkgTotPrice = BigDecimal.ZERO; @@ -1019,25 +1051,34 @@ public class EstimateService { String estimateType = estimateResponse.getEstimateType(); // 주택패키지 단가 - BigDecimal pkgAsp = new BigDecimal( - StringUtils.isEmpty(estimateResponse.getPkgAsp()) ? "0" : estimateResponse.getPkgAsp()); + BigDecimal pkgAsp = + new BigDecimal( + StringUtils.isEmpty(estimateResponse.getPkgAsp()) ? "0" : estimateResponse.getPkgAsp()); for (ItemResponse itemResponse : itemList) { // 수량 - BigDecimal amount = new BigDecimal( - StringUtils.isEmpty(itemResponse.getAmount()) ? "0" : itemResponse.getAmount()); + BigDecimal amount = + new BigDecimal( + StringUtils.isEmpty(itemResponse.getAmount()) ? "0" : itemResponse.getAmount()); // 판매가 BigDecimal salePrice = BigDecimal.ZERO; if ("1".equals(unitPriceFlg)) { - salePrice = new BigDecimal( - StringUtils.isEmpty(itemResponse.getUnitPrice()) ? "0" : itemResponse.getUnitPrice()); + salePrice = + new BigDecimal( + StringUtils.isEmpty(itemResponse.getUnitPrice()) + ? "0" + : itemResponse.getUnitPrice()); } else { - salePrice = new BigDecimal( - StringUtils.isEmpty(itemResponse.getSalePrice()) ? "0" : itemResponse.getSalePrice()); + salePrice = + new BigDecimal( + StringUtils.isEmpty(itemResponse.getSalePrice()) + ? "0" + : itemResponse.getSalePrice()); } // 아이템용량 - BigDecimal pnowW = new BigDecimal( - StringUtils.isEmpty(itemResponse.getPnowW()) ? "0" : itemResponse.getPnowW()); + BigDecimal pnowW = + new BigDecimal( + StringUtils.isEmpty(itemResponse.getPnowW()) ? "0" : itemResponse.getPnowW()); // 아이템 단가 합산 itemResponse.setSaleTotPrice(String.valueOf(salePrice.multiply(amount))); @@ -1081,10 +1122,11 @@ public class EstimateService { estimateResponse.setPkgTotPrice(String.valueOf(pkgTotPrice)); estimateResponse.setTotAmount(String.valueOf(totAmount.setScale(0, BigDecimal.ROUND_HALF_UP))); estimateResponse.setTotVol(String.valueOf(totVol)); - estimateResponse.setTotVolKw(String - .valueOf(totVol.multiply(new BigDecimal("0.001")).setScale(3, BigDecimal.ROUND_FLOOR))); - estimateResponse - .setSupplyPrice(String.valueOf(supplyPrice.setScale(0, BigDecimal.ROUND_HALF_UP))); + estimateResponse.setTotVolKw( + String.valueOf( + totVol.multiply(new BigDecimal("0.001")).setScale(3, BigDecimal.ROUND_FLOOR))); + estimateResponse.setSupplyPrice( + String.valueOf(supplyPrice.setScale(0, BigDecimal.ROUND_HALF_UP))); estimateResponse.setVatPrice(String.valueOf(vatPrice.setScale(0, BigDecimal.ROUND_HALF_UP))); estimateResponse.setTotPrice(String.valueOf(totPrice.setScale(0, BigDecimal.ROUND_HALF_UP))); } @@ -1137,8 +1179,9 @@ public class EstimateService { EstimateApiResponse response = null; /* [1]. QSP API CALL -> Response */ - String strResponse = interfaceQsp.callApi(HttpMethod.POST, - QSP_API_URL + "/api/order/qcastQuotationSave", estimateSendRequest); + String strResponse = + interfaceQsp.callApi( + HttpMethod.POST, QSP_API_URL + "/api/order/qcastQuotationSave", estimateSendRequest); if (!"".equals(strResponse)) { com.fasterxml.jackson.databind.ObjectMapper om = @@ -1155,7 +1198,7 @@ public class EstimateService { for (EstimateSendResponse data : quoteList) { if (data.getObjectNo().equals(succ.get("objectNo")) && data.getPlanNo().equals(succ.get("planNo"))) { - data.setSyncFlg("1"); + data.setSyncFlg(String.valueOf(succ.get("syncFlg"))); data.setDocNo(String.valueOf(succ.get("docNo"))); } } @@ -1232,18 +1275,28 @@ public class EstimateService { sb.append(""); sb.append( "" + StringUtils.defaultString(itemResponse.getNo()) + ""); - sb.append("" - + StringUtils.defaultString(itemResponse.getItemName()) + ""); - sb.append("" + StringUtils.defaultString(itemResponse.getItemNo()) - + ""); - sb.append("" - + StringUtils.defaultString(itemResponse.getSalePrice()) + ""); - sb.append("" - + StringUtils.defaultString(itemResponse.getAmount()) + ""); + sb.append( + "" + + StringUtils.defaultString(itemResponse.getItemName()) + + ""); + sb.append( + "" + + StringUtils.defaultString(itemResponse.getItemNo()) + + ""); + sb.append( + "" + + StringUtils.defaultString(itemResponse.getSalePrice()) + + ""); + sb.append( + "" + + StringUtils.defaultString(itemResponse.getAmount()) + + ""); sb.append( "" + StringUtils.defaultString(itemResponse.getUnit()) + ""); - sb.append("" - + StringUtils.defaultString(itemResponse.getSaleTotPrice()) + ""); + sb.append( + "" + + StringUtils.defaultString(itemResponse.getSaleTotPrice()) + + ""); sb.append(""); } if ("Y".equals(data.getPkgYn())) { @@ -1251,13 +1304,19 @@ public class EstimateService { sb.append("" + StringUtils.defaultString(data.getPkgNo()) + ""); sb.append("住宅 PKG"); sb.append("-"); - sb.append("" - + StringUtils.defaultString(data.getPkgAsp()) + ""); - sb.append("" - + StringUtils.defaultString(data.getTotVol()) + ""); + sb.append( + "" + + StringUtils.defaultString(data.getPkgAsp()) + + ""); + sb.append( + "" + + StringUtils.defaultString(data.getTotVol()) + + ""); sb.append("W"); - sb.append("" - + StringUtils.defaultString(data.getPkgTotPrice()) + ""); + sb.append( + "" + + StringUtils.defaultString(data.getPkgTotPrice()) + + ""); sb.append(""); } elm = doc.getElementById("itemList_detail"); @@ -1280,10 +1339,14 @@ public class EstimateService { sb = new StringBuilder(); for (NoteResponse noteResponse : data.getNoteList()) { sb.append(""); - sb.append("" - + StringUtils.defaultString(noteResponse.getCodeNm()) + ""); - sb.append("" - + StringUtils.defaultString(noteResponse.getRemarks()) + ""); + sb.append( + "" + + StringUtils.defaultString(noteResponse.getCodeNm()) + + ""); + sb.append( + "" + + StringUtils.defaultString(noteResponse.getRemarks()) + + ""); sb.append(""); } elm = doc.getElementById("noteList_detail"); @@ -1292,8 +1355,11 @@ public class EstimateService { // 도면 설정 elm = doc.getElementById("objectNo4"); - elm.text(StringUtils.defaultString(data.getObjectNo()) + " (Plan No : " - + StringUtils.defaultString(data.getPlanNo()) + ")"); + elm.text( + StringUtils.defaultString(data.getObjectNo()) + + " (Plan No : " + + StringUtils.defaultString(data.getPlanNo()) + + ")"); elm = doc.getElementById("objectName"); elm.text(StringUtils.defaultString(data.getObjectName())); @@ -1327,10 +1393,14 @@ public class EstimateService { if (!"STAND_".equals(itemResponse.getItemGroup())) { sb.append(""); sb.append("" + (no++) + ""); - sb.append("" - + StringUtils.defaultString(itemResponse.getItemNo()) + ""); - sb.append("" - + StringUtils.defaultString(itemResponse.getAmount()) + ""); + sb.append( + "" + + StringUtils.defaultString(itemResponse.getItemNo()) + + ""); + sb.append( + "" + + StringUtils.defaultString(itemResponse.getAmount()) + + ""); sb.append(""); } } @@ -1344,8 +1414,12 @@ public class EstimateService { sb.append(""); sb.append("" + (no++) + ""); sb.append( - "" + StringUtils.defaultString(roofResponse.getItemNo()) - + "[" + roofResponse.getPcModuleAmount() + "]" + ""); + "" + + StringUtils.defaultString(roofResponse.getItemNo()) + + "[" + + roofResponse.getPcModuleAmount() + + "]" + + ""); sb.append(""); } elm = doc.getElementById("pcsItemList_detail"); @@ -1359,8 +1433,10 @@ public class EstimateService { sb.append("" + StringUtils.defaultString(roofResponse.getRoofSurface()) + ""); sb.append("" + StringUtils.defaultString(roofResponse.getClassTypeName()) + ""); sb.append("" + StringUtils.defaultString(roofResponse.getAmount()) + ""); - sb.append("" - + StringUtils.defaultString(roofResponse.getVolKw()) + ""); + sb.append( + "" + + StringUtils.defaultString(roofResponse.getVolKw()) + + ""); sb.append(""); } elm = doc.getElementById("surFaceList_detail"); @@ -1378,13 +1454,19 @@ public class EstimateService { for (RoofResponse roofResponse : data.getRoofInfo().getRoofList()) { sb.append(""); sb.append("" + StringUtils.defaultString(roofResponse.getRoofSurface()) + ""); - sb.append("" - + StringUtils.defaultString(roofResponse.getRoofMaterialName()) + ""); + sb.append( + "" + + StringUtils.defaultString(roofResponse.getRoofMaterialName()) + + ""); sb.append("" + StringUtils.defaultString(roofResponse.getSlope()) + "寸"); - sb.append("" + StringUtils.defaultString(roofResponse.getConstructSpecificationName()) - + ""); - sb.append("" - + StringUtils.defaultString(roofResponse.getSupportMethodName()) + ""); + sb.append( + "" + + StringUtils.defaultString(roofResponse.getConstructSpecificationName()) + + ""); + sb.append( + "" + + StringUtils.defaultString(roofResponse.getSupportMethodName()) + + ""); sb.append("" + StringUtils.defaultString(roofResponse.getSurfaceType()) + ""); sb.append("" + StringUtils.defaultString(roofResponse.getSetupHeight()) + ""); sb.append(""); @@ -1394,8 +1476,11 @@ public class EstimateService { } elm = doc.getElementById("objectNo5"); - elm.text(StringUtils.defaultString(data.getObjectNo()) + " (Plan No : " - + StringUtils.defaultString(data.getPlanNo()) + ")"); + elm.text( + StringUtils.defaultString(data.getObjectNo()) + + " (Plan No : " + + StringUtils.defaultString(data.getPlanNo()) + + ")"); elm = doc.getElementById("objectName5"); elm.text(StringUtils.defaultString(data.getObjectName())); @@ -1429,10 +1514,14 @@ public class EstimateService { if ("STAND_".equals(itemResponse.getItemGroup())) { sb.append(""); sb.append("" + (no++) + ""); - sb.append("" - + StringUtils.defaultString(itemResponse.getItemNo()) + ""); - sb.append("" - + StringUtils.defaultString(itemResponse.getAmount()) + ""); + sb.append( + "" + + StringUtils.defaultString(itemResponse.getItemNo()) + + ""); + sb.append( + "" + + StringUtils.defaultString(itemResponse.getAmount()) + + ""); sb.append(""); } } @@ -1444,13 +1533,19 @@ public class EstimateService { for (RoofResponse roofResponse : data.getRoofInfo().getRoofList()) { sb.append(""); sb.append("" + StringUtils.defaultString(roofResponse.getRoofSurface()) + ""); - sb.append("" - + StringUtils.defaultString(roofResponse.getRoofMaterialName()) + ""); + sb.append( + "" + + StringUtils.defaultString(roofResponse.getRoofMaterialName()) + + ""); sb.append("" + StringUtils.defaultString(roofResponse.getSlope()) + "寸"); - sb.append("" + StringUtils.defaultString(roofResponse.getConstructSpecificationName()) - + ""); - sb.append("" - + StringUtils.defaultString(roofResponse.getSupportMethodName()) + ""); + sb.append( + "" + + StringUtils.defaultString(roofResponse.getConstructSpecificationName()) + + ""); + sb.append( + "" + + StringUtils.defaultString(roofResponse.getSupportMethodName()) + + ""); sb.append("" + StringUtils.defaultString(roofResponse.getSurfaceType()) + ""); sb.append("" + StringUtils.defaultString(roofResponse.getSetupHeight()) + ""); sb.append(""); diff --git a/src/main/java/com/interplug/qcast/biz/object/ObjectService.java b/src/main/java/com/interplug/qcast/biz/object/ObjectService.java index a0e9e5b5..d4f7bd23 100644 --- a/src/main/java/com/interplug/qcast/biz/object/ObjectService.java +++ b/src/main/java/com/interplug/qcast/biz/object/ObjectService.java @@ -60,18 +60,46 @@ public class ObjectService { private final StoreFavoriteService storeFavoriteService; + /** + * 도도부현 목록 조회 + * + * @return List 도도부현 목록 + * @throws Exception + */ public List selectPrefList() throws Exception { return objectMapper.selectPrefList(); } + /** + * 발전시뮬레이션 지역 목록 조회 + * + * @param prefId 도도부현 코드 + * @return List 발전시뮬레이션 지역 목록 + * @throws Exception + */ public List selectPrefAreaList(String prefId) throws Exception { return objectMapper.selectPrefAreaList(prefId); } + /** + * 기준 풍속 목록 조회 + * + * @param city 지역코드 + * @return List 기준 풍속 목록 + * @throws Exception + */ public List selectWindSpeedList(String city) throws Exception { return objectMapper.selectWindSpeedList(city); } + /** + * 1차점 판매점 목록 조회 + * + * @param saleStoreId 1차점 판매점 아이디 + * @param userId 유저 아이디 + * @return List 1차점 판매점 목록 + * @throws Exception + */ public List selectFirstSaleStoreList(String saleStoreId, String userId) throws Exception { // Validation @@ -96,6 +124,15 @@ public class ObjectService { return storeList; } + /** + * 하위 판매점 목록 조회 + * + * @param saleStoreId 판매점 아이디 + * @param firstFlg 1차점 판매점 여부 + * @param userId 유저 아이디 + * @return List 하위 판매점 목록 + * @throws Exception + */ public List selectSaleStoreList( String saleStoreId, String firstFlg, String userId) throws Exception { // Validation @@ -117,14 +154,35 @@ public class ObjectService { return storeList; } + /** + * 판매점 정보 상세 조회 + * + * @param saleStoreId 판매점 아이디 + * @return SaleStoreResponse 판매점 상세 정보 + * @throws Exception + */ public SaleStoreResponse selectSaleStoreInfo(String saleStoreId) throws Exception { return objectMapper.selectSaleStoreInfo(saleStoreId); } + /** + * 물건정보 목록 조회 + * + * @param objectRequest 물건정보 검색어 정보 + * @return List 물건정보 목록 + * @throws Exception + */ public List selectObjectList(ObjectRequest objectRequest) throws Exception { return objectMapper.selectObjectList(objectRequest); } + /** + * 물건정보 상세 조회 + * + * @param objectNo 물건번호 + * @return ObjectResponse 물건정보 상세 + * @throws Exception + */ public ObjectResponse selectObjectDetail(String objectNo) throws Exception { // object 상세 정보 조회 ObjectResponse objectResponse = objectMapper.selectObjectDetail(objectNo); @@ -141,6 +199,13 @@ public class ObjectService { return objectResponse; } + /** + * 물건정보 저장 + * + * @param objectRequest 물건정보 + * @return ObjectResponse 물건정보 저장 결과 값 + * @throws Exception + */ public ObjectResponse insertObject(ObjectRequest objectRequest) throws Exception { int result = 0; String objectNo = ""; @@ -157,9 +222,12 @@ public class ObjectService { message.getMessage("common.message.required.data", "Sale Store Level")); } + objectRequest.setSourceOrigin("QCAST_III"); + // 물건번호 등록/조회 if ("0".equals(objectRequest.getTempFlg())) { - objectRequest.setDelFlg("0"); + objectRequest.setDelFlg("1"); + objectRequest.setOrgDelFlg("0"); objectRequest.setTempFlg("0"); objectRequest.setTempDelFlg("0"); @@ -167,6 +235,7 @@ public class ObjectService { objectNo = objectMapper.selectObjectNo(objectRequest); } else if ("1".equals(objectRequest.getTempFlg())) { objectRequest.setDelFlg("1"); + objectRequest.setOrgDelFlg("1"); objectRequest.setTempFlg("1"); objectRequest.setTempDelFlg("0"); @@ -183,10 +252,7 @@ public class ObjectService { // 물건정보 등록 objectRequest.setAddress( - objectRequest.getPrefName() - + ((!StringUtils.isEmpty(objectRequest.getAddress())) - ? objectRequest.getAddress() - : "")); + ((!StringUtils.isEmpty(objectRequest.getAddress())) ? objectRequest.getAddress() : "")); objectRequest.setAddresseeCompanyName( objectRequest.getObjectName() + ' ' + objectRequest.getObjectNameOmit()); objectRequest.setAddresseeCompanyNameOmit(objectRequest.getObjectNameOmit()); @@ -243,6 +309,13 @@ public class ObjectService { return objectResponse; } + /** + * 물건정보 수정 + * + * @param objectRequest 물건정보 + * @return ObjectResponse 물건정보 수정 결과 값 + * @throws Exception + */ public ObjectResponse updateObject(ObjectRequest objectRequest) throws Exception { int result = 0; boolean tempChgFlg = false; @@ -273,10 +346,7 @@ public class ObjectService { // 물건정보 수정 objectRequest.setAddress( - objectRequest.getPrefName() - + ((!StringUtils.isEmpty(objectRequest.getAddress())) - ? objectRequest.getAddress() - : "")); + ((!StringUtils.isEmpty(objectRequest.getAddress())) ? objectRequest.getAddress() : "")); objectRequest.setAddresseeCompanyName( objectRequest.getObjectName() + ' ' + objectRequest.getObjectNameOmit()); objectRequest.setAddresseeCompanyNameOmit(objectRequest.getObjectNameOmit()); @@ -327,6 +397,13 @@ public class ObjectService { return objectResponse; } + /** + * 물건정보 삭제 + * + * @param objectRequest 물건정보 + * @return int 결과 값 + * @throws Exception + */ public int deleteObject(ObjectRequest objectRequest) throws Exception { int result = 0; @@ -376,6 +453,13 @@ public class ObjectService { return result; } + /** + * 신규 플랜정보 추가 + * + * @param planRequest 플랜정보 + * @return String 추가 플랜번호 + * @throws Exception + */ public String insertPlan(PlanRequest planRequest) throws Exception { // Validation if (StringUtils.isEmpty(planRequest.getObjectNo())) { @@ -404,6 +488,12 @@ public class ObjectService { return planRequest.getPlanNo(); } + /** + * 플랜정보 삭제 + * + * @param planRequest 플랜정보 + * @throws Exception + */ public void deletePlan(PlanRequest planRequest) throws Exception { // Validation if (StringUtils.isEmpty(planRequest.getObjectNo())) { @@ -428,6 +518,13 @@ public class ObjectService { objectMapper.deletePlan(planRequest); } + /** + * 설계의뢰 목록 조회 + * + * @param planReqRequest 설계의뢰 요청 정보 + * @return PlanReqResponse 설계의뢰 응답 정보 + * @throws Exception + */ public PlanReqResponse selectPlanReqList(PlanReqRequest planReqRequest) throws Exception { // Validation @@ -512,6 +609,14 @@ public class ObjectService { return response; } + /** + * 물건정보 첨부파일 다운로드 + * + * @param request Request + * @param response Response + * @param uploadRequest 첨부파일 요청 정보 + * @throws Exception + */ public void fileDownload( HttpServletRequest request, HttpServletResponse response, UploadRequest uploadRequest) throws Exception { diff --git a/src/main/java/com/interplug/qcast/biz/object/dto/ObjectRequest.java b/src/main/java/com/interplug/qcast/biz/object/dto/ObjectRequest.java index 4a07696a..a443f622 100644 --- a/src/main/java/com/interplug/qcast/biz/object/dto/ObjectRequest.java +++ b/src/main/java/com/interplug/qcast/biz/object/dto/ObjectRequest.java @@ -90,6 +90,9 @@ public class ObjectRequest { @Schema(description = "컨텐츠 파일경로") private String contentsPath; + @Schema(description = "소스 원본") + private String sourceOrigin; + @Schema(description = "임시저장여부") private String tempFlg; @@ -102,6 +105,9 @@ public class ObjectRequest { @Schema(description = "삭제여부") private String delFlg; + @Schema(description = "원본 삭제여부") + private String orgDelFlg; + @Schema(description = "사용자아이디") private String userId; diff --git a/src/main/resources/mappers/object/objectMapper.xml b/src/main/resources/mappers/object/objectMapper.xml index eafa2a0a..3a7ce3dc 100644 --- a/src/main/resources/mappers/object/objectMapper.xml +++ b/src/main/resources/mappers/object/objectMapper.xml @@ -213,7 +213,8 @@ INNER JOIN SALES_STORE_CTE T ON S.SALE_STORE_ID = T.SALE_STORE_ID - WHERE (O.DEL_FLG = '0' OR (O.TEMP_FLG = '1' AND O.TEMP_DEL_FLG = '0')) + WHERE O.SOURCE_ORIGIN = 'QCAST_III' + AND (O.ORG_DEL_FLG = '0' OR (O.TEMP_FLG = '1' AND O.TEMP_DEL_FLG = '0')) AND O.OBJECT_NO LIKE '%' + #{schObjectNo} + '%' @@ -316,7 +317,8 @@ LEFT OUTER JOIN M_PREFECTURE_AREA PA ON O.AREA_ID = PA.AREA_ID WHERE O.OBJECT_NO = #{objectNo} - AND (O.DEL_FLG = '0' OR (O.TEMP_FLG = '1' AND O.TEMP_DEL_FLG = '0')) + AND O.SOURCE_ORIGIN = 'QCAST_III' + AND (O.ORG_DEL_FLG = '0' OR (O.TEMP_FLG = '1' AND O.TEMP_DEL_FLG = '0'))