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 a1ee000d..1f73781f 100644 --- a/src/main/java/com/interplug/qcast/biz/estimate/EstimateMapper.java +++ b/src/main/java/com/interplug/qcast/biz/estimate/EstimateMapper.java @@ -31,9 +31,21 @@ public interface EstimateMapper { // 견적서 정보 수정 public int updateEstimate(EstimateRequest estimateRequest); + // 견적서 지붕재 등록 + public int insertEstimateRoof(RoofRequest roofRequest); + + // 견적서 지붕재 아이템 등록 + public int insertEstimateRoofItem(ItemRequest itemRequest); + // 견적서 아이템 등록 public int insertEstimateItem(ItemRequest itemRequest); + // 견적서 지붕재 목록 삭제(물리 삭제) + public int deleteEstimateRoofList(EstimateRequest estimateRequest); + + // 견적서 지붕재 아이템 목록 삭제(물리 삭제) + public int deleteEstimateRoofItemList(EstimateRequest estimateRequest); + // 견적서 아이템 목록 삭제(물리 삭제) public int deleteEstimateItemList(EstimateRequest estimateRequest); 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 ac89aad2..6f91130d 100644 --- a/src/main/java/com/interplug/qcast/biz/estimate/EstimateService.java +++ b/src/main/java/com/interplug/qcast/biz/estimate/EstimateService.java @@ -207,238 +207,269 @@ public class EstimateService { } String splitStr = "、"; + List roofList = new ArrayList(); List itemList = estimateRequest.getItemList(); - // 도면 작성일 경우에만 지붕재 데이터를 셋팅 - if ("1".equals(estimateRequest.getDrawingFlg())) { - // [1]. 견적서 기본셋팅 - estimateRequest.setEstimateType("YJOD"); + try { + // 도면 작성일 경우에만 지붕재 데이터를 셋팅 + if ("1".equals(estimateRequest.getDrawingFlg())) { + // [1]. 견적서 기본셋팅 + estimateRequest.setEstimateType("YJOD"); + estimateRequest.setPriceCd("UNIT_PRICE"); + + // 물건정보 조회 후 데이터 축출 + ObjectResponse objectResponse = + objectMapper.selectObjectDetail(estimateRequest.getObjectNo()); + if (objectResponse != null) { + estimateRequest.setWeatherPoint( + objectResponse.getPrefName() + " - " + objectResponse.getAreaName()); + estimateRequest.setCharger(objectResponse.getReceiveUser()); + } + + // [2]. 지붕재 관련 데이터 셋팅 + roofList = estimateRequest.getRoofList(); + + // 지붕재 시공사양 ID + String constructSpecifications = ""; + // 지붕재 아이템 ID + String roofMaterialIds = ""; + // 지붕재 공법 ID + String supportMethodIds = ""; + // 지붕재 아이템명 + String roofMaterialIdMultis = ""; + // 지붕재 공법명 + String supportMethodIdMultis = ""; + // 지붕재 시공사양명 + String constructSpecificationMultis = ""; + // 가대 메이커명 + String supportMeakers = ""; + for (RoofRequest roofRequest : roofList) { + if (!StringUtils.isEmpty(roofRequest.getRoofMaterialId())) { + roofMaterialIds += !StringUtils.isEmpty(roofMaterialIds) ? splitStr : ""; + roofMaterialIds += roofRequest.getRoofMaterialId(); + } + + if (!StringUtils.isEmpty(roofRequest.getSupportMethodId())) { + supportMethodIds += !StringUtils.isEmpty(supportMethodIds) ? splitStr : ""; + supportMethodIds += roofRequest.getSupportMethodId(); + } + + if (!StringUtils.isEmpty(roofRequest.getConstructSpecification())) { + constructSpecifications += + !StringUtils.isEmpty(constructSpecifications) ? splitStr : ""; + constructSpecifications += roofRequest.getConstructSpecification(); + } + + if (!StringUtils.isEmpty(roofRequest.getRoofMaterialIdMulti())) { + roofMaterialIdMultis += !StringUtils.isEmpty(roofMaterialIdMultis) ? splitStr : ""; + roofMaterialIdMultis += roofRequest.getRoofMaterialIdMulti(); + } + + if (!StringUtils.isEmpty(roofRequest.getSupportMethodIdMulti())) { + supportMethodIdMultis += !StringUtils.isEmpty(supportMethodIdMultis) ? splitStr : ""; + supportMethodIdMultis += roofRequest.getSupportMethodIdMulti(); + } + + if (!StringUtils.isEmpty(roofRequest.getConstructSpecificationMulti())) { + constructSpecificationMultis += + !StringUtils.isEmpty(constructSpecificationMultis) ? splitStr : ""; + constructSpecificationMultis += roofRequest.getConstructSpecificationMulti(); + } + + if (!StringUtils.isEmpty(roofRequest.getSupportMeaker())) { + supportMeakers += !StringUtils.isEmpty(supportMeakers) ? splitStr : ""; + supportMeakers += roofRequest.getSupportMeaker(); + } + } + + // 지붕재 관련 데이터 셋팅 + estimateRequest.setRoofMaterialId(roofMaterialIds); + estimateRequest.setSupportMethodId(supportMethodIds); + estimateRequest.setConstructSpecification(constructSpecifications); + estimateRequest.setRoofMaterialIdMulti(roofMaterialIdMultis); + estimateRequest.setSupportMethodIdMulti(supportMethodIdMultis); + estimateRequest.setConstructSpecificationMulti(constructSpecificationMultis); + estimateRequest.setSupportMeaker(supportMeakers); + + // [3]. 아이템 관련 데이터 셋팅 + String[] arrItemId = new String[itemList.size()]; + int i = 0; + for (ItemRequest itemRequest : itemList) { + arrItemId[i++] = itemRequest.getItemId(); + } + estimateRequest.setArrItemId(arrItemId); + // 아이템의 마스터 정보 및 정가 정보 조회 + List itemResponseList = estimateMapper.selectItemMasterList(estimateRequest); + + int j = 1; + for (ItemRequest itemRequest : itemList) { + itemRequest.setDispOrder(String.valueOf(j++)); + + for (ItemResponse itemResponse : itemResponseList) { + if (itemRequest.getItemId().equals(itemResponse.getItemId())) { + itemRequest.setItemNo(itemResponse.getItemNo()); + itemRequest.setItemName(itemResponse.getItemName()); + itemRequest.setUnit(itemResponse.getUnit()); + itemRequest.setPnowW(itemResponse.getPnowW()); + itemRequest.setSpecification(itemResponse.getPnowW()); + itemRequest.setUnitPrice(itemResponse.getSalePrice()); + itemRequest.setSalePrice(itemResponse.getSalePrice()); + itemRequest.setPkgMaterialFlg(itemResponse.getPkgMaterialFlg()); + itemRequest.setItemGroup(itemResponse.getItemGroup()); + + break; + } + } + } + + // [4]. 견적특이사항 관련 데이터 셋팅 + NoteRequest noteRequest = new NoteRequest(); + noteRequest.setArrItemId(arrItemId); + noteRequest.setSchSpnTypeCd("COMM"); + List noteList = estimateMapper.selectEstimateNoteList(noteRequest); + noteRequest.setSchSpnTypeCd("PROD"); + List noteItemList = estimateMapper.selectEstimateNoteItemList(noteRequest); + + // 견적특이사항 코드 + String estimateOptions = ""; + for (NoteResponse noteResponse : noteList) { + if ("ATTR001".equals(noteResponse.getCode())) { + estimateOptions += !StringUtils.isEmpty(estimateOptions) ? splitStr : ""; + estimateOptions += "ATTR001"; // 공통 필수체크 + } else if ("ATTR002".equals(noteResponse.getCode())) { + estimateOptions += !StringUtils.isEmpty(estimateOptions) ? splitStr : ""; + estimateOptions += "ATTR002"; // YJOD 필수체크 + } else if ("ATTR003".equals(noteResponse.getCode())) { + estimateOptions += !StringUtils.isEmpty(estimateOptions) ? splitStr : ""; + estimateOptions += "ATTR003"; // 출력제어시간 기본 체크 + } else if ("ATTR004".equals(noteResponse.getCode()) + && "1".equals(estimateRequest.getNorthArrangement())) { + estimateOptions += !StringUtils.isEmpty(estimateOptions) ? splitStr : ""; + estimateOptions += "ATTR004"; // 북면설치 체크 + } else if ("ATTR005".equals(noteResponse.getCode()) + && "1".equals(objectResponse.getSaltAreaFlg())) { + estimateOptions += !StringUtils.isEmpty(estimateOptions) ? splitStr : ""; + estimateOptions += "ATTR005"; // 염해지역 체크 + } else if ("ATTR006".equals(objectResponse.getColdRegionFlg()) + && "1".equals(estimateRequest.getNorthArrangement())) { + estimateOptions += !StringUtils.isEmpty(estimateOptions) ? splitStr : ""; + estimateOptions += "ATTR006"; // 적설지역 체크 + } else if ("ATTR007".equals(noteResponse.getCode())) { + estimateOptions += !StringUtils.isEmpty(estimateOptions) ? splitStr : ""; + estimateOptions += "ATTR007"; // 지붕재치수, 레이아웃 기본 체크 + } else if ("ATTR008".equals(noteResponse.getCode())) { + estimateOptions += !StringUtils.isEmpty(estimateOptions) ? splitStr : ""; + estimateOptions += "ATTR008"; // 별도비용 기본 체크 + } else if ("ATTR009".equals(noteResponse.getCode())) { + estimateOptions += !StringUtils.isEmpty(estimateOptions) ? splitStr : ""; + estimateOptions += "ATTR009"; // 과적재 기본 체크 + } + } + for (NoteResponse noteResponse : noteItemList) { + estimateOptions += !StringUtils.isEmpty(estimateOptions) ? splitStr : ""; + estimateOptions += noteResponse.getCode(); + } + + estimateRequest.setEstimateOption(estimateOptions); + } + + // 아이템 목록 필수 값 체크 + BigDecimal capacity = BigDecimal.ZERO; + String moduleModel = ""; + String pcTypeNo = ""; + for (ItemRequest itemRequest : itemList) { + if (StringUtils.isEmpty(itemRequest.getItemId())) { + 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, + message.getMessage("common.message.required.data", "Item Amount")); + } + + // 수량 + BigDecimal amount = + new BigDecimal( + StringUtils.isEmpty(itemRequest.getAmount()) ? "0" : itemRequest.getAmount()); + // 아이템용량 + BigDecimal pnowW = + new BigDecimal( + StringUtils.isEmpty(itemRequest.getPnowW()) ? "0" : itemRequest.getPnowW()); + + // 모듈/PC 체크 + if ("MODULE_".equals(itemRequest.getItemGroup())) { + moduleModel += !StringUtils.isEmpty(moduleModel) ? splitStr : ""; + moduleModel += itemRequest.getItemNo(); + + capacity = capacity.add(amount.multiply(pnowW)); + } else if ("PC_".equals(itemRequest.getItemGroup())) { + pcTypeNo += !StringUtils.isEmpty(pcTypeNo) ? splitStr : ""; + pcTypeNo += itemRequest.getItemNo(); + } + } + estimateRequest.setCapacity(String.valueOf(capacity)); + estimateRequest.setModuleModel(moduleModel); + estimateRequest.setPcTypeNo(pcTypeNo); + + // 물건정보 수정 + if (!StringUtils.isEmpty(estimateRequest.getObjectName()) + || !StringUtils.isEmpty(estimateRequest.getSurfaceType()) + || !StringUtils.isEmpty(estimateRequest.getSetupHeight()) + || !StringUtils.isEmpty(estimateRequest.getStandardWindSpeedId()) + || !StringUtils.isEmpty(estimateRequest.getSnowfall())) { + estimateMapper.updateObject(estimateRequest); + } + + // 견적서 정보 수정 estimateRequest.setPriceCd("UNIT_PRICE"); + estimateMapper.updateEstimate(estimateRequest); - // 물건정보 조회 후 데이터 축출 - ObjectResponse objectResponse = - objectMapper.selectObjectDetail(estimateRequest.getObjectNo()); - if (objectResponse != null) { - estimateRequest.setWeatherPoint( - objectResponse.getPrefName() + " - " + objectResponse.getAreaName()); - estimateRequest.setCharger(objectResponse.getReceiveUser()); - } + // 도면 작성일 경우에만 지붕재 데이터 초기화 후 저장 + if ("1".equals(estimateRequest.getDrawingFlg())) { + // 견적서 지붕면/아이템 제거 + estimateMapper.deleteEstimateRoofList(estimateRequest); + estimateMapper.deleteEstimateRoofItemList(estimateRequest); - // [2]. 지붕재 관련 데이터 셋팅 - List roofList = estimateRequest.getRoofList(); + // 견적서 지붕면/아이템 신규 추가 + for (RoofRequest roofRequest : roofList) { + roofRequest.setObjectNo(estimateRequest.getObjectNo()); + roofRequest.setPlanNo(estimateRequest.getPlanNo()); + roofRequest.setUserId(estimateRequest.getUserId()); - // 지붕재 시공사양 ID - String constructSpecifications = ""; - // 지붕재 아이템 ID - String roofMaterialIds = ""; - // 지붕재 공법 ID - String supportMethodIds = ""; - // 지붕재 아이템명 - String roofMaterialIdMultis = ""; - // 지붕재 공법명 - String supportMethodIdMultis = ""; - // 지붕재 시공사양명 - String constructSpecificationMultis = ""; - // 가대 메이커명 - String supportMeakers = ""; - for (RoofRequest roofRequest : roofList) { - if (!StringUtils.isEmpty(roofRequest.getRoofMaterialId())) { - roofMaterialIds += !StringUtils.isEmpty(roofMaterialIds) ? splitStr : ""; - roofMaterialIds += roofRequest.getRoofMaterialId(); - } + estimateMapper.insertEstimateRoof(roofRequest); - if (!StringUtils.isEmpty(roofRequest.getSupportMethodId())) { - supportMethodIds += !StringUtils.isEmpty(supportMethodIds) ? splitStr : ""; - supportMethodIds += roofRequest.getSupportMethodId(); - } + List roofItemList = roofRequest.getRoofItemList(); + for (ItemRequest itemRequest : roofItemList) { + itemRequest.setObjectNo(estimateRequest.getObjectNo()); + itemRequest.setPlanNo(estimateRequest.getPlanNo()); + itemRequest.setRoofNo(roofRequest.getRoofNo()); - if (!StringUtils.isEmpty(roofRequest.getConstructSpecification())) { - constructSpecifications += !StringUtils.isEmpty(constructSpecifications) ? splitStr : ""; - constructSpecifications += roofRequest.getConstructSpecification(); - } - - if (!StringUtils.isEmpty(roofRequest.getRoofMaterialIdMulti())) { - roofMaterialIdMultis += !StringUtils.isEmpty(roofMaterialIdMultis) ? splitStr : ""; - roofMaterialIdMultis += roofRequest.getRoofMaterialIdMulti(); - } - - if (!StringUtils.isEmpty(roofRequest.getSupportMethodIdMulti())) { - supportMethodIdMultis += !StringUtils.isEmpty(supportMethodIdMultis) ? splitStr : ""; - supportMethodIdMultis += roofRequest.getSupportMethodIdMulti(); - } - - if (!StringUtils.isEmpty(roofRequest.getConstructSpecificationMulti())) { - constructSpecificationMultis += - !StringUtils.isEmpty(constructSpecificationMultis) ? splitStr : ""; - constructSpecificationMultis += roofRequest.getConstructSpecificationMulti(); - } - - if (!StringUtils.isEmpty(roofRequest.getSupportMeaker())) { - supportMeakers += !StringUtils.isEmpty(supportMeakers) ? splitStr : ""; - supportMeakers += roofRequest.getSupportMeaker(); - } - } - - // 지붕재 관련 데이터 셋팅 - estimateRequest.setRoofMaterialId(roofMaterialIds); - estimateRequest.setSupportMethodId(supportMethodIds); - estimateRequest.setConstructSpecification(constructSpecifications); - estimateRequest.setRoofMaterialIdMulti(roofMaterialIdMultis); - estimateRequest.setSupportMethodIdMulti(supportMethodIdMultis); - estimateRequest.setConstructSpecificationMulti(constructSpecificationMultis); - estimateRequest.setSupportMeaker(supportMeakers); - - // [3]. 아이템 관련 데이터 셋팅 - String[] arrItemId = new String[itemList.size()]; - int i = 0; - for (ItemRequest itemRequest : itemList) { - arrItemId[i++] = itemRequest.getItemId(); - } - estimateRequest.setArrItemId(arrItemId); - // 아이템의 마스터 정보 및 정가 정보 조회 - List itemResponseList = estimateMapper.selectItemMasterList(estimateRequest); - - int j = 1; - for (ItemRequest itemRequest : itemList) { - itemRequest.setDispOrder(String.valueOf(j++)); - - for (ItemResponse itemResponse : itemResponseList) { - if (itemRequest.getItemId().equals(itemResponse.getItemId())) { - itemRequest.setItemNo(itemResponse.getItemNo()); - itemRequest.setItemName(itemResponse.getItemName()); - itemRequest.setUnit(itemResponse.getUnit()); - itemRequest.setPnowW(itemResponse.getPnowW()); - itemRequest.setSpecification(itemResponse.getPnowW()); - itemRequest.setUnitPrice(itemResponse.getSalePrice()); - itemRequest.setSalePrice(itemResponse.getSalePrice()); - itemRequest.setPkgMaterialFlg(itemResponse.getPkgMaterialFlg()); - itemRequest.setItemGroup(itemResponse.getItemGroup()); - - break; + estimateMapper.insertEstimateRoofItem(itemRequest); } } } - // [4]. 견적특이사항 관련 데이터 셋팅 - NoteRequest noteRequest = new NoteRequest(); - noteRequest.setArrItemId(arrItemId); - noteRequest.setSchSpnTypeCd("COMM"); - List noteList = estimateMapper.selectEstimateNoteList(noteRequest); - noteRequest.setSchSpnTypeCd("PROD"); - List noteItemList = estimateMapper.selectEstimateNoteItemList(noteRequest); + // 견적서 모든 아이템 제거 + estimateMapper.deleteEstimateItemList(estimateRequest); - // 견적특이사항 코드 - String estimateOptions = ""; - for (NoteResponse noteResponse : noteList) { - if ("ATTR001".equals(noteResponse.getCode())) { - estimateOptions += !StringUtils.isEmpty(estimateOptions) ? splitStr : ""; - estimateOptions += "ATTR001"; // 공통 필수체크 - } else if ("ATTR002".equals(noteResponse.getCode())) { - estimateOptions += !StringUtils.isEmpty(estimateOptions) ? splitStr : ""; - estimateOptions += "ATTR002"; // YJOD 필수체크 - } else if ("ATTR003".equals(noteResponse.getCode())) { - estimateOptions += !StringUtils.isEmpty(estimateOptions) ? splitStr : ""; - estimateOptions += "ATTR003"; // 출력제어시간 기본 체크 - } else if ("ATTR004".equals(noteResponse.getCode()) - && "1".equals(estimateRequest.getNorthArrangement())) { - estimateOptions += !StringUtils.isEmpty(estimateOptions) ? splitStr : ""; - estimateOptions += "ATTR004"; // 북면설치 체크 - } else if ("ATTR005".equals(noteResponse.getCode()) - && "1".equals(objectResponse.getSaltAreaFlg())) { - estimateOptions += !StringUtils.isEmpty(estimateOptions) ? splitStr : ""; - estimateOptions += "ATTR005"; // 염해지역 체크 - } else if ("ATTR006".equals(objectResponse.getColdRegionFlg()) - && "1".equals(estimateRequest.getNorthArrangement())) { - estimateOptions += !StringUtils.isEmpty(estimateOptions) ? splitStr : ""; - estimateOptions += "ATTR006"; // 적설지역 체크 - } else if ("ATTR007".equals(noteResponse.getCode())) { - estimateOptions += !StringUtils.isEmpty(estimateOptions) ? splitStr : ""; - estimateOptions += "ATTR007"; // 지붕재치수, 레이아웃 기본 체크 - } else if ("ATTR008".equals(noteResponse.getCode())) { - estimateOptions += !StringUtils.isEmpty(estimateOptions) ? splitStr : ""; - estimateOptions += "ATTR008"; // 별도비용 기본 체크 - } else if ("ATTR009".equals(noteResponse.getCode())) { - estimateOptions += !StringUtils.isEmpty(estimateOptions) ? splitStr : ""; - estimateOptions += "ATTR009"; // 과적재 기본 체크 - } + // 견적서 아이템 신규 추가 + for (ItemRequest itemRequest : itemList) { + itemRequest.setObjectNo(estimateRequest.getObjectNo()); + itemRequest.setPlanNo(estimateRequest.getPlanNo()); + itemRequest.setPartAdd( + !StringUtils.isEmpty(itemRequest.getPartAdd()) ? itemRequest.getPartAdd() : "0"); + itemRequest.setItemChangeFlg( + !StringUtils.isEmpty(itemRequest.getItemChangeFlg()) + ? itemRequest.getItemChangeFlg() + : "0"); + itemRequest.setUserId(estimateRequest.getUserId()); + + estimateMapper.insertEstimateItem(itemRequest); } - for (NoteResponse noteResponse : noteItemList) { - estimateOptions += !StringUtils.isEmpty(estimateOptions) ? splitStr : ""; - estimateOptions += noteResponse.getCode(); - } - - estimateRequest.setEstimateOption(estimateOptions); - } - - // 아아템 목록 필수 값 체크 - BigDecimal capacity = BigDecimal.ZERO; - String moduleModel = ""; - String pcTypeNo = ""; - for (ItemRequest itemRequest : itemList) { - if (StringUtils.isEmpty(itemRequest.getItemId())) { - 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, - message.getMessage("common.message.required.data", "Item Amount")); - } - - // 수량 - BigDecimal amount = - new BigDecimal( - StringUtils.isEmpty(itemRequest.getAmount()) ? "0" : itemRequest.getAmount()); - // 아이템용량 - BigDecimal pnowW = - new BigDecimal( - StringUtils.isEmpty(itemRequest.getPnowW()) ? "0" : itemRequest.getPnowW()); - - // 모듈/PC 체크 - if ("MODULE_".equals(itemRequest.getItemGroup())) { - moduleModel += !StringUtils.isEmpty(moduleModel) ? splitStr : ""; - moduleModel += itemRequest.getItemNo(); - - capacity = capacity.add(amount.multiply(pnowW)); - } else if ("PC_".equals(itemRequest.getItemGroup())) { - pcTypeNo += !StringUtils.isEmpty(pcTypeNo) ? splitStr : ""; - pcTypeNo += itemRequest.getItemNo(); - } - } - estimateRequest.setCapacity(String.valueOf(capacity)); - estimateRequest.setModuleModel(moduleModel); - estimateRequest.setPcTypeNo(pcTypeNo); - - // 물건정보 수정 - if (!StringUtils.isEmpty(estimateRequest.getObjectName()) - || !StringUtils.isEmpty(estimateRequest.getSurfaceType()) - || !StringUtils.isEmpty(estimateRequest.getSetupHeight()) - || !StringUtils.isEmpty(estimateRequest.getStandardWindSpeedId()) - || !StringUtils.isEmpty(estimateRequest.getSnowfall())) { - estimateMapper.updateObject(estimateRequest); - } - - // 견적서 정보 수정 - estimateRequest.setPriceCd("UNIT_PRICE"); - estimateMapper.updateEstimate(estimateRequest); - - // 견적서 모든 아이템 제거 - estimateMapper.deleteEstimateItemList(estimateRequest); - - // 견적서 아이템 신규 추가 - for (ItemRequest itemRequest : itemList) { - itemRequest.setObjectNo(estimateRequest.getObjectNo()); - itemRequest.setPlanNo(estimateRequest.getPlanNo()); - itemRequest.setPartAdd( - !StringUtils.isEmpty(itemRequest.getPartAdd()) ? itemRequest.getPartAdd() : "0"); - itemRequest.setItemChangeFlg( - !StringUtils.isEmpty(itemRequest.getItemChangeFlg()) - ? itemRequest.getItemChangeFlg() - : "0"); - itemRequest.setUserId(estimateRequest.getUserId()); - - estimateMapper.insertEstimateItem(itemRequest); + } catch (Exception e) { + e.printStackTrace(); } } 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 d17675d3..6c86de57 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 @@ -36,6 +36,9 @@ public class EstimateRequest { @Schema(description = "경사") private String slope; + @Schema(description = "각도") + private String angle; + @Schema(description = "지붕재 아이템 CLASS ID") private String roofMaterialClassId; 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 c3ef189f..287f930a 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 @@ -28,6 +28,9 @@ public class EstimateResponse { @Schema(description = "경사") private String slope; + @Schema(description = "각도") + private String angle; + @Schema(description = "지붕재 아이템 CLASS ID") private String roofMaterialClassId; 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 ad443f94..5a1dc9f6 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 @@ -14,6 +14,9 @@ public class ItemRequest { @Schema(description = "플랜번호") private String planNo; + @Schema(description = "지붕재 번호") + private String roofNo; + @Schema(description = "아이템 ID") private String itemId; diff --git a/src/main/java/com/interplug/qcast/biz/estimate/dto/ItemResponse.java b/src/main/java/com/interplug/qcast/biz/estimate/dto/ItemResponse.java index 7a44e3df..300ef026 100644 --- a/src/main/java/com/interplug/qcast/biz/estimate/dto/ItemResponse.java +++ b/src/main/java/com/interplug/qcast/biz/estimate/dto/ItemResponse.java @@ -14,6 +14,9 @@ public class ItemResponse { @Schema(description = "플랜번호") private String planNo; + @Schema(description = "노출번호") + private String dispOrder; + @Schema(description = "번호") private String no; diff --git a/src/main/java/com/interplug/qcast/biz/estimate/dto/RoofRequest.java b/src/main/java/com/interplug/qcast/biz/estimate/dto/RoofRequest.java index 6f64f8c4..4aebc2c5 100644 --- a/src/main/java/com/interplug/qcast/biz/estimate/dto/RoofRequest.java +++ b/src/main/java/com/interplug/qcast/biz/estimate/dto/RoofRequest.java @@ -1,6 +1,7 @@ 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; @@ -8,6 +9,18 @@ import lombok.Setter; @Getter @Setter public class RoofRequest { + @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; @@ -28,4 +41,19 @@ public class RoofRequest { @Schema(description = "가대메이커명") private String supportMeaker; + + @Schema(description = "경사") + private String slope; + + @Schema(description = "각도") + private String angle; + + @Schema(description = "방위각") + private String azimuth; + + @Schema(description = "사용자아이디") + private String userId; + + @Schema(description = "아이템 목록") + List roofItemList; } diff --git a/src/main/resources/mappers/estimate/estimateMapper.xml b/src/main/resources/mappers/estimate/estimateMapper.xml index 9b17598f..b5ab1c92 100644 --- a/src/main/resources/mappers/estimate/estimateMapper.xml +++ b/src/main/resources/mappers/estimate/estimateMapper.xml @@ -13,6 +13,7 @@ , P.WEATHER_POINT , P.ROOF_KIND_ID , P.SLOPE + , P.ANGLE , P.ROOF_MATERIAL_CLASS_ID , P.ROOF_MATERIAL_ID , P.SUPPORT_METHOD_ID @@ -108,6 +109,7 @@ SELECT PE.OBJECT_NO , PE.PLAN_NO + , PE.DISP_ORDER , PE.ITEM_ID , PE.ITEM_NO , PE.ITEM_NAME @@ -233,6 +235,7 @@ , SETUP_HEIGHT = #{setupHeight} , WEATHER_POINT = #{weatherPoint} , SLOPE = #{slope} + , ANGLE = #{angle} , ROOF_MATERIAL_ID = #{roofMaterialId} , SUPPORT_METHOD_ID = #{supportMethodId} , DRAWING_ESTIMATE_CREATE_DATE = GETDATE() @@ -251,6 +254,7 @@ , ESTIMATE_OPTION = #{estimateOption} , PKG_ASP = NULL , PRICE_CD = #{priceCd} + , SURFACE_TYPE = #{surfaceType} , CHARGER = #{charger} @@ -272,7 +276,7 @@ - /* sqlid : com.interplug.qcast.biz.estimate.insertEstimateItem*/ + /* sqlid : com.interplug.qcast.biz.estimate.insertEstimateItem */ INSERT INTO T_PART_ESTIMATE ( OBJECT_NO @@ -317,6 +321,92 @@ ) + + /* sqlid : com.interplug.qcast.biz.estimate.insertEstimateRoof */ + + SELECT @@IDENTITY + + + INSERT INTO T_ROOF_ESTIMATE + ( + OBJECT_NO + , PLAN_NO + , ROOF_SURFACE + , ROOF_MATERIAL_ID + , SUPPORT_METHOD_ID + , CONSTRUCT_SPECIFICATION + + , SLOPE + + + , ANGLE + + + , AZIMUTH + + , CREATE_DATETIME + , CREATE_USER + ) VALUES ( + #{objectNo} + , #{planNo} + , #{roofSurface} + , #{roofMaterialId} + , #{supportMethodId} + , #{constructSpecification} + + , #{slope} + + + , #{angle} + + + , #{azimuth} + + , GETDATE() + , #{userId} + ) + + + + /* sqlid : com.interplug.qcast.biz.estimate.insertEstimateRoofItem */ + INSERT INTO T_ROOF_ITEM_ESTIMATE + ( + ROOF_NO + , OBJECT_NO + , PLAN_NO + , ITEM_ID + , ITEM_NO + , ITEM_NAME + , SPECIFICATION + , AMOUNT + ) + SELECT + #{roofNo} AS ROOF_NO + , #{objectNo} AS OBJECT_NO + , #{planNo} AS PLAN_NO + , I.ITEM_ID + , I.ITEM_NO + , I.ITEM_NAME + , I.PNOW_W + , #{amount} + FROM M_ITEM I WITH (NOLOCK) + WHERE I.ITEM_ID = #{itemId} + + + + /* sqlid : com.interplug.qcast.biz.estimate.deleteEstimateRoofList */ + DELETE FROM T_ROOF_ESTIMATE + WHERE OBJECT_NO = #{objectNo} + AND PLAN_NO = #{planNo} + + + + /* sqlid : com.interplug.qcast.biz.estimate.deleteEstimateRoofItemList */ + DELETE FROM T_ROOF_ITEM_ESTIMATE + WHERE OBJECT_NO = #{objectNo} + AND PLAN_NO = #{planNo} + + /* sqlid : com.interplug.qcast.biz.estimate.deleteEstimateItemList */ DELETE FROM T_PART_ESTIMATE diff --git a/src/main/resources/mappers/file/fileMapper.xml b/src/main/resources/mappers/file/fileMapper.xml index 6b0f1fee..3f65ad61 100644 --- a/src/main/resources/mappers/file/fileMapper.xml +++ b/src/main/resources/mappers/file/fileMapper.xml @@ -41,6 +41,7 @@ , U.LAST_EDIT_USER FROM T_UPLOAD U WITH (NOLOCK) WHERE U.OBJECT_NO = #{objectNo} + AND U.DEL_FLG = '0' AND U.PLAN_NO = #{planNo}