diff --git a/src/main/java/com/interplug/qcast/batch/system/CommonCodeConfiguration.java b/src/main/java/com/interplug/qcast/batch/system/CommonCodeConfiguration.java index 350aa3d5..f4d9936f 100644 --- a/src/main/java/com/interplug/qcast/batch/system/CommonCodeConfiguration.java +++ b/src/main/java/com/interplug/qcast/batch/system/CommonCodeConfiguration.java @@ -26,7 +26,7 @@ import com.interplug.qcast.biz.commCode.dto.HeadCodeRequest; import com.interplug.qcast.util.InterfaceQsp; import lombok.extern.slf4j.Slf4j; -/** 영업사원 동기화 배치 */ +/** 공통코드 동기화 배치 */ @Configuration @Slf4j public class CommonCodeConfiguration implements JobExecutionListener { diff --git a/src/main/java/com/interplug/qcast/biz/estimate/EstimateMapper.java b/src/main/java/com/interplug/qcast/biz/estimate/EstimateMapper.java index 5e169ed3..48bf6fed 100644 --- a/src/main/java/com/interplug/qcast/biz/estimate/EstimateMapper.java +++ b/src/main/java/com/interplug/qcast/biz/estimate/EstimateMapper.java @@ -21,7 +21,19 @@ public interface EstimateMapper { // 아이템 마스터 목록 조회 public List selectItemMasterList(EstimateRequest estimateRequest); - // 아이템 마스터 목록 조회 + // 견적서 지붕재 인증용량 조회 + public String selectEstimateRoofCertVolKw(EstimateRequest estimateRequest); + + // 견적서 지붕재 목록 조회 + public List selectEstimateRoofList(EstimateRequest estimateRequest); + + // 견적서 지붕재 PC 목록 조회 + public List selectEstimateRoofPcList(EstimateRequest estimateRequest); + + // 견적서 지붕재 용량 목록 조회 + public List selectEstimateRoofVolList(EstimateRequest estimateRequest); + + // 견적서 특이사항 목록 조회 public List selectEstimateNoteList(NoteRequest noteRequest); // 아이템 마스터 목록 조회 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 35940cad..43ef5b91 100644 --- a/src/main/java/com/interplug/qcast/biz/estimate/EstimateService.java +++ b/src/main/java/com/interplug/qcast/biz/estimate/EstimateService.java @@ -28,6 +28,7 @@ import java.beans.PropertyDescriptor; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.math.BigDecimal; +import java.text.SimpleDateFormat; import java.util.*; import java.util.List; import lombok.RequiredArgsConstructor; @@ -117,8 +118,8 @@ public class EstimateService { /** * QSP 아이템 가격 목록 조회 * - * @param priceRequest - * @return PriceResponse + * @param priceRequest QSP 관련 아이템 목록 정보 + * @return PriceResponse QSP 아이템 가격 목록 * @throws Exception */ public EstimateApiResponse selectItemPriceList(PriceRequest priceRequest) throws Exception { @@ -158,10 +159,25 @@ public class EstimateService { return response; } + /** + * 견적 특이사항 목록 조회 + * + * @param noteRequest 견적 특이사항 조회 정보 + * @return List 견적 특이사항 목록 + * @throws Exception + */ public List selectSpecialNoteList(NoteRequest noteRequest) throws Exception { return estimateMapper.selectEstimateNoteList(noteRequest); } + /** + * 견적서 상세 조회 + * + * @param objectNo 물건번호 + * @param planNo 플랜번호 + * @return EstimateResponse 견적서 상세 정보 + * @throws Exception + */ public EstimateResponse selectEstimateDetail(String objectNo, String planNo) throws Exception { // Validation if (StringUtils.isEmpty(objectNo)) { @@ -206,6 +222,12 @@ public class EstimateService { return response; } + /** + * 견적서 저장 + * + * @param estimateRequest 견적서 저장 정보 + * @throws Exception + */ public void insertEstimate(EstimateRequest estimateRequest) throws Exception { // Validation if (StringUtils.isEmpty(estimateRequest.getObjectNo())) { @@ -524,6 +546,13 @@ public class EstimateService { } } + /** + * 견적서 복사 + * + * @param estimateRequest 견적서 복사 정보 + * @return EstimateResponse 견적서 복사 후 상세 정보 + * @throws Exception + */ public EstimateResponse insertEstimateCopy(EstimateRequest estimateRequest) throws Exception { // Validation if (StringUtils.isEmpty(estimateRequest.getObjectNo())) { @@ -615,6 +644,14 @@ public class EstimateService { return response; } + /** + * 견적서 엑셀 다운로드 + * + * @param request HttpServletRequest + * @param response HttpServletResponse + * @param estimateRequest 견적서 엑셀 다운로드 요청 정보 + * @throws Exception + */ public void excelDownload( HttpServletRequest request, HttpServletResponse response, EstimateRequest estimateRequest) throws Exception { @@ -650,6 +687,36 @@ public class EstimateService { estimateResponse.setNoteList(noteList); } + // 지붕재 목록 조회 + RoofInfoResponse roofInfoResponse = new RoofInfoResponse(); + List roofList = estimateMapper.selectEstimateRoofList(estimateRequest); + List roofPcList = estimateMapper.selectEstimateRoofPcList(estimateRequest); + estimateRequest.setSchItemGroup("MODULE_"); + List roofVolList = estimateMapper.selectEstimateRoofVolList(estimateRequest); + + BigDecimal moduleTotAmount = BigDecimal.ZERO; + BigDecimal moduleTotVolKw = BigDecimal.ZERO; + for (RoofResponse roofVol : roofVolList) { + BigDecimal amount = + new BigDecimal(StringUtils.isEmpty(roofVol.getAmount()) ? "0" : roofVol.getAmount()); + BigDecimal vol = + new BigDecimal(StringUtils.isEmpty(roofVol.getVolKw()) ? "0" : roofVol.getVolKw()); + + moduleTotAmount = moduleTotAmount.add(amount); + moduleTotVolKw = moduleTotVolKw.add(vol); + } + roofInfoResponse.setModuleTotAmount(String.valueOf(moduleTotAmount)); + roofInfoResponse.setModuleTotVolKw(String.valueOf(moduleTotVolKw)); + + roofInfoResponse.setRoofList(roofList); + roofInfoResponse.setRoofPcList(roofPcList); + roofInfoResponse.setRoofVolList(roofVolList); + + // 인증용량 구하기 (지붕면마다 모듈과 PCS의 총 용량을 서로 비교해 낮은쪽 용량으로 합산) + roofInfoResponse.setCertVolKw(estimateMapper.selectEstimateRoofCertVolKw(estimateRequest)); + + estimateResponse.setRoofInfo(roofInfoResponse); + // 아이템 목록 조회 List estimateItemList = estimateMapper.selectEstimateItemList(estimateRequest); @@ -703,7 +770,6 @@ public class EstimateService { PwrGnrSimResponse pwrGnrSimResponse = pwrGnrSimService.selectPwrGnrSimulation(pwrGnrSimRequest); if (pwrGnrSimResponse != null) { - try { // 발전시뮬레이션 안내사항 조회 PwrGnrSimGuideResponse pwrGnrSimGuideInfo = @@ -722,20 +788,14 @@ public class EstimateService { int iSection = 0; // PDF 다운로드 + String pdfFileName = + "Quation_Detail_" + new SimpleDateFormat("yyyyMMdd").format(new Date()); String templateFilePath = "pdf_download_quotation_detail_template.html"; - String pdfFileName = "Quation_Detail"; // 템플릿 html 조회 Document doc = PdfUtil.getPdfDoc(request, templateFilePath); Element elm; - arrSection[iSection] = "div.section1"; - iSection++; - - elm = doc.getElementsByClass("section2").first(); - elm.remove(); - // 1은 나누고 2는 지우고 3은 그리고 - // 발전시뮬레이션 pdf Html 생성 if (true) { arrSection[iSection] = "div.section3"; @@ -746,14 +806,13 @@ public class EstimateService { elm.remove(); } - System.err.println(doc.toString()); - // pdf 다운로드 PdfUtil.pdfDownload(request, response, doc, pdfFileName, arrSection); } else { - String excelFileName = "Quation_Detail"; + String excelFileName = + "Quation_Detail_" + new SimpleDateFormat("yyyyMMdd").format(new Date()); String excelTemplateNam = "excel_download_quotation_detail_template.xlsx"; excelUtil.download( @@ -948,6 +1007,12 @@ public class EstimateService { return quoteList; } + /** + * Object => Map 변환 함수 + * + * @param vo Object + * @return Map Map 변환 정보 + */ public Map convertVoToMap(Object vo) { Map result = new HashMap(); @@ -965,6 +1030,12 @@ public class EstimateService { return result; } + /** + * List => List 변환 함수 + * + * @param target List + * @return List> List 변환 정보 + */ public static List> convertListToMap(Collection target) { List> resultList = new ArrayList>(); diff --git a/src/main/java/com/interplug/qcast/biz/estimate/dto/EstimateRequest.java b/src/main/java/com/interplug/qcast/biz/estimate/dto/EstimateRequest.java index daee7689..55950d59 100644 --- a/src/main/java/com/interplug/qcast/biz/estimate/dto/EstimateRequest.java +++ b/src/main/java/com/interplug/qcast/biz/estimate/dto/EstimateRequest.java @@ -163,18 +163,21 @@ public class EstimateRequest { private String[] arrItemId; // 다운로드 관련 조건 - @Schema(description = "다운로드 정가 표시여부") + @Schema(description = "검색 - 다운로드 정가 표시여부") private String schUnitPriceFlg; - @Schema(description = "다운로드 표시여부") + @Schema(description = "검색 - 다운로드 표시여부") private String schDisplayFlg; - @Schema(description = "가대중량표 포함 여부") + @Schema(description = "검색 - 가대중량표 포함 여부") private String schWeightFlg; - @Schema(description = "도면 포함 여부") + @Schema(description = "검색 - 도면 포함 여부") private String schDrawingFlg; + @Schema(description = "검색 - 아이템 그룹") + private String schItemGroup; + // 데이터 목록 관련 정보 @Schema(description = "지붕재 목록") List roofList; diff --git a/src/main/java/com/interplug/qcast/biz/estimate/dto/EstimateResponse.java b/src/main/java/com/interplug/qcast/biz/estimate/dto/EstimateResponse.java index e08d0036..9fd895dc 100644 --- a/src/main/java/com/interplug/qcast/biz/estimate/dto/EstimateResponse.java +++ b/src/main/java/com/interplug/qcast/biz/estimate/dto/EstimateResponse.java @@ -80,6 +80,9 @@ public class EstimateResponse { @Schema(description = "기준풍속ID") private String standardWindSpeedId; + @Schema(description = "기준풍속명") + private String standardWindSpeedName; + @Schema(description = "가대 메이커명") private String supportMeaker; @@ -175,6 +178,12 @@ public class EstimateResponse { @Schema(description = "경칭") private String objectNameOmit; + @Schema(description = "도도부현명") + private String prefName; + + @Schema(description = "지역명") + private String areaName; + @Schema(description = "물건정보 비고") private String objectRemarks; @@ -235,6 +244,9 @@ public class EstimateResponse { @Schema(description = "첨부파일 목록") List fileList; + @Schema(description = "지붕재 정보") + RoofInfoResponse roofInfo; + @Schema(description = "발전시뮬레이션 정보") PwrGnrSimResponse pwrGnrSim; } diff --git a/src/main/java/com/interplug/qcast/biz/estimate/dto/EstimateSendResponse.java b/src/main/java/com/interplug/qcast/biz/estimate/dto/EstimateSendResponse.java index 50955725..0c0b5aef 100644 --- a/src/main/java/com/interplug/qcast/biz/estimate/dto/EstimateSendResponse.java +++ b/src/main/java/com/interplug/qcast/biz/estimate/dto/EstimateSendResponse.java @@ -19,6 +19,9 @@ public class EstimateSendResponse { @Schema(description = "물건명") private String objectName; + @Schema(description = "경칭코드") + private String objectNameOmitCd; + @Schema(description = "견적서 등록일") private String estimateDetailCreateDate; diff --git a/src/main/java/com/interplug/qcast/biz/estimate/dto/ItemRequest.java b/src/main/java/com/interplug/qcast/biz/estimate/dto/ItemRequest.java index 154ed112..560a7c27 100644 --- a/src/main/java/com/interplug/qcast/biz/estimate/dto/ItemRequest.java +++ b/src/main/java/com/interplug/qcast/biz/estimate/dto/ItemRequest.java @@ -62,6 +62,9 @@ public class ItemRequest { @Schema(description = "아이템 변경 여부") private String itemChangeFlg; + @Schema(description = "PC 아이템 ID") + private String pcItemId; + @Schema(description = "W") private String pnowW; diff --git a/src/main/java/com/interplug/qcast/biz/estimate/dto/RoofInfoResponse.java b/src/main/java/com/interplug/qcast/biz/estimate/dto/RoofInfoResponse.java new file mode 100644 index 00000000..4c035da5 --- /dev/null +++ b/src/main/java/com/interplug/qcast/biz/estimate/dto/RoofInfoResponse.java @@ -0,0 +1,29 @@ +package com.interplug.qcast.biz.estimate.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.List; +import lombok.Getter; +import lombok.Setter; + +// @Data +@Getter +@Setter +public class RoofInfoResponse { + @Schema(description = "인증용량") + private String certVolKw; + + @Schema(description = "모듈 총 수") + private String moduleTotAmount; + + @Schema(description = "모듈 총 용량") + private String moduleTotVolKw; + + @Schema(description = "지붕면 목록") + private List roofList; + + @Schema(description = "지붕면 파워컨디셔너 목록") + private List roofPcList; + + @Schema(description = "지붕면 용량 목록") + private List roofVolList; +} diff --git a/src/main/java/com/interplug/qcast/biz/estimate/dto/RoofResponse.java b/src/main/java/com/interplug/qcast/biz/estimate/dto/RoofResponse.java new file mode 100644 index 00000000..361fc215 --- /dev/null +++ b/src/main/java/com/interplug/qcast/biz/estimate/dto/RoofResponse.java @@ -0,0 +1,82 @@ +package com.interplug.qcast.biz.estimate.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +// @Data +@Getter +@Setter +public class RoofResponse { + @Schema(description = "물건번호") + private String objectNo; + + @Schema(description = "플랜번호") + private String planNo; + + @Schema(description = "지붕재 번호") + private String roofNo; + + @Schema(description = "지붕면") + private String roofSurface; + + @Schema(description = "지붕재 아이템 ID") + private String roofMaterialId; + + @Schema(description = "지붕재 아이템명") + private String roofMaterialName; + + @Schema(description = "공법 ID") + private String supportMethodId; + + @Schema(description = "공법명") + private String supportMethodName; + + @Schema(description = "시공사양 ID") + private String constructSpecification; + + @Schema(description = "시공사양명") + private String constructSpecificationName; + + @Schema(description = "지붕재 아이템명") + private String roofMaterialIdMulti; + + @Schema(description = "공법명") + private String supportMethodIdMulti; + + @Schema(description = "시공방법명") + private String constructSpecificationMulti; + + @Schema(description = "가대메이커명") + private String supportMeaker; + + @Schema(description = "경사") + private String slope; + + @Schema(description = "각도") + private String angle; + + @Schema(description = "방위각") + private String azimuth; + + @Schema(description = "면조도구분") + private String surfaceType; + + @Schema(description = "설치높이") + private String setupHeight; + + @Schema(description = "아이템 ID") + private String itemId; + + @Schema(description = "아이템 번호") + private String itemNo; + + @Schema(description = "매수") + private String amount; + + @Schema(description = "용량") + private String volKw; + + @Schema(description = "Pc 모듈 매수") + private String pcModuleAmount; +} 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 bc28e492..a0e9e5b5 100644 --- a/src/main/java/com/interplug/qcast/biz/object/ObjectService.java +++ b/src/main/java/com/interplug/qcast/biz/object/ObjectService.java @@ -337,8 +337,41 @@ public class ObjectService { message.getMessage("common.message.required.data", "Object No")); } - // 물건정보 삭제 - result = objectMapper.deleteObject(objectRequest); + // object 상세 정보 조회 + ObjectResponse objectResponse = objectMapper.selectObjectDetail(objectRequest.getObjectNo()); + if (objectResponse != null) { + // 설계의뢰 번호가 존재하고 물건정보에 견적서가 없을 경우 QSP 설계의뢰 물건번호 초기화 + if (!StringUtils.isEmpty(objectResponse.getPlanReqNo()) + && objectResponse.getEstimateTotCnt() == 0) { + PlanReqResponse response = null; + + PlanReqRequest planReqRequest = new PlanReqRequest(); + planReqRequest.setSaleStoreId(objectResponse.getSaleStoreId()); + planReqRequest.setSaleStoreLevel(objectResponse.getSaleStoreLevel()); + planReqRequest.setObjectNo(objectResponse.getObjectNo()); + planReqRequest.setPlanReqNo(objectResponse.getPlanReqNo()); + planReqRequest.setDelFlg("1"); + + String strResponse = + interfaceQsp.callApi( + HttpMethod.POST, QSP_API_URL + "/api/planReq/updateObjectNo", planReqRequest); + if (!"".equals(strResponse)) { + com.fasterxml.jackson.databind.ObjectMapper om = + new com.fasterxml.jackson.databind.ObjectMapper() + .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + response = om.readValue(strResponse, PlanReqResponse.class); + + Map map = (Map) response.getResult(); + if ("E".equals(String.valueOf(map.get("resultCode")))) { + throw new QcastException( + ErrorCode.INTERNAL_SERVER_ERROR, String.valueOf(map.get("resultMsg"))); + } + } + } + + // 물건정보 삭제 + result = objectMapper.deleteObject(objectRequest); + } return result; } diff --git a/src/main/java/com/interplug/qcast/biz/object/dto/ObjectResponse.java b/src/main/java/com/interplug/qcast/biz/object/dto/ObjectResponse.java index 072cd47c..a786e460 100644 --- a/src/main/java/com/interplug/qcast/biz/object/dto/ObjectResponse.java +++ b/src/main/java/com/interplug/qcast/biz/object/dto/ObjectResponse.java @@ -125,6 +125,9 @@ public class ObjectResponse { @Schema(description = "플랜 전체 건수") private String planTotCnt; + @Schema(description = "견적서 전체 건수") + private Integer estimateTotCnt; + // 플랜목록 @Schema(description = "플랜목록") private List planList; diff --git a/src/main/java/com/interplug/qcast/biz/object/dto/PlanReqRequest.java b/src/main/java/com/interplug/qcast/biz/object/dto/PlanReqRequest.java index a1aa3cd6..7898141c 100644 --- a/src/main/java/com/interplug/qcast/biz/object/dto/PlanReqRequest.java +++ b/src/main/java/com/interplug/qcast/biz/object/dto/PlanReqRequest.java @@ -17,6 +17,9 @@ public class PlanReqRequest { @Schema(description = "물건번호") private String objectNo; + @Schema(description = "삭제여부") + private String delFlg; + @Schema(description = "검색 - 설계의뢰번호") private String schPlanReqNo; diff --git a/src/main/resources/mappers/estimate/estimateMapper.xml b/src/main/resources/mappers/estimate/estimateMapper.xml index f2c9f9af..9e51be6c 100644 --- a/src/main/resources/mappers/estimate/estimateMapper.xml +++ b/src/main/resources/mappers/estimate/estimateMapper.xml @@ -84,7 +84,9 @@ SELECT P.OBJECT_NO , P.PLAN_NO + , CONVERT(VARCHAR(10), P.DRAWING_ESTIMATE_CREATE_DATE, 121) AS DRAWING_ESTIMATE_CREATE_DATE , P.ESTIMATE_VALIDITY_TERM + , P.SNOWFALL , P.ESTIMATE_TYPE , P.ESTIMATE_OPTION , P.PKG_ASP @@ -94,9 +96,20 @@ , O.OBJECT_NAME , O.OBJECT_NAME_OMIT , (SELECT SALE_STORE_ID FROM M_USER WHERE USER_ID = O.CREATE_USER) AS CREATE_SALE_STORE_ID + , ISNULL(MP.PREF_NAME, '') AS PREF_NAME + , ISNULL(MPA.AREA_NAME, '') AS AREA_NAME + , ISNULL(C1.CODE_NM, '') AS STANDARD_WIND_SPEED_NAME FROM T_PLAN P WITH (NOLOCK) INNER JOIN T_OBJECT O WITH (NOLOCK) ON P.OBJECT_NO = O.OBJECT_NO + LEFT OUTER JOIN M_PREFECTURE MP WITH (NOLOCK) + ON O.PREF_ID = MP.PREF_ID + LEFT OUTER JOIN M_PREFECTURE_AREA MPA WITH (NOLOCK) + ON O.PREF_ID = MPA.PREF_ID + AND O.AREA_ID = MPA.AREA_ID + LEFT OUTER JOIN M_COMM_L C1 WITH (NOLOCK) + ON C1.HEAD_CD = '202000' + AND P.STANDARD_WIND_SPEED_ID = C1.CODE WHERE P.OBJECT_NO = #{objectNo} AND P.PLAN_NO = #{planNo} ) T @@ -107,11 +120,12 @@ + + + + + + + +