diff --git a/src/main/java/com/interplug/qcast/biz/estimate/EstimateController.java b/src/main/java/com/interplug/qcast/biz/estimate/EstimateController.java index 6e6dd1ea..d4448842 100644 --- a/src/main/java/com/interplug/qcast/biz/estimate/EstimateController.java +++ b/src/main/java/com/interplug/qcast/biz/estimate/EstimateController.java @@ -71,6 +71,14 @@ public class EstimateController { return estimateService.insertEstimateCopy(estimateCopyRequest); } + @Operation(description = "견적서를 초기화한다.") + @PostMapping("/reset-estimate") + @ResponseStatus(HttpStatus.CREATED) + public EstimateResponse updateEstimateReset(@RequestBody EstimateRequest estimateRequest) + throws Exception { + return estimateService.updateEstimateReset(estimateRequest); + } + @Operation(description = "견적서를 엑셀로 다운로드한다.") @PostMapping("/excel-download") @ResponseStatus(HttpStatus.OK) 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 18591801..f6a23fa4 100644 --- a/src/main/java/com/interplug/qcast/biz/estimate/EstimateMapper.java +++ b/src/main/java/com/interplug/qcast/biz/estimate/EstimateMapper.java @@ -60,6 +60,9 @@ public interface EstimateMapper { // 견적서 정보 수정 public int updateEstimate(EstimateRequest estimateRequest); + // 견적서 정보 초기화 + public int updateEstimateReset(EstimateRequest estimateRequest); + // 견적서 API 정보 수정 public int updateEstimateApi(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 89638a8a..3ae17c54 100644 --- a/src/main/java/com/interplug/qcast/biz/estimate/EstimateService.java +++ b/src/main/java/com/interplug/qcast/biz/estimate/EstimateService.java @@ -40,10 +40,7 @@ import java.io.IOException; import java.io.InputStream; import java.math.BigDecimal; import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Map; +import java.util.*; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -285,12 +282,17 @@ public class EstimateService { List roofList = new ArrayList(); List itemList = estimateRequest.getItemList(); + estimateRequest.setTempFlg("0"); + try { // 도면 작성일 경우에만 지붕재 데이터를 셋팅 if ("1".equals(estimateRequest.getDrawingFlg())) { // [1]. 견적서 기본셋팅 + // 플랜정보 조회 (임시저장여부 가져오기) + EstimateResponse estimateResponse = estimateMapper.selectEstimateDetail(estimateRequest); estimateRequest.setEstimateType("YJOD"); estimateRequest.setPriceCd("UNIT_PRICE"); + estimateRequest.setTempFlg("0".equals(estimateResponse.getTempFlg()) ? "0" : "1"); // 물건정보 조회 후 데이터 축출 ObjectResponse objectResponse = @@ -399,6 +401,7 @@ public class EstimateService { itemRequest.setItemCtgGr(itemResponse.getItemCtgGr()); itemRequest.setPartAdd("0"); itemRequest.setDelFlg("0"); + itemRequest.setDrawingItemFlg("1"); break; } } @@ -433,6 +436,7 @@ public class EstimateService { bomItem.setItemCtgGr(itemResponse.getItemCtgGr()); bomItem.setPartAdd("0"); bomItem.setDelFlg("0"); + bomItem.setDrawingItemFlg("1"); estimateBomList.add(bomItem); } @@ -440,9 +444,7 @@ public class EstimateService { } // BOM 컴포넌트 추가 - for (ItemRequest estimateBom : estimateBomList) { - itemList.add(estimateBom); - } + itemList.addAll(estimateBomList); // [4]. 견적특이사항 관련 데이터 셋팅 NoteRequest noteRequest = new NoteRequest(); @@ -469,10 +471,11 @@ public class EstimateService { estimateOptions += !StringUtils.isEmpty(estimateOptions) ? splitStr : ""; estimateOptions += "ATTR004"; // 북면설치 체크 } else if ("ATTR005".equals(noteResponse.getCode()) - && "1".equals(objectResponse.getSaltAreaFlg())) { + && "1".equals(objectResponse != null ? objectResponse.getSaltAreaFlg() : "")) { estimateOptions += !StringUtils.isEmpty(estimateOptions) ? splitStr : ""; estimateOptions += "ATTR005"; // 염해지역 체크 - } else if ("ATTR006".equals(objectResponse.getColdRegionFlg()) + } else if ("ATTR006" + .equals(objectResponse != null ? objectResponse.getColdRegionFlg() : "") && "1".equals(estimateRequest.getNorthArrangement())) { estimateOptions += !StringUtils.isEmpty(estimateOptions) ? splitStr : ""; estimateOptions += "ATTR006"; // 적설지역 체크 @@ -651,20 +654,23 @@ public class EstimateService { } } - // QSP Q.CAST SEND API - List resultList = new ArrayList(); - resultList = this.sendEstimateApi(estimateRequest); - // API에서 받은 문서번호 업데이트 - for (EstimateSendResponse result : resultList) { - estimateRequest.setObjectNo(result.getObjectNo()); - estimateRequest.setPlanNo(result.getPlanNo()); - estimateRequest.setDocNo(result.getDocNo()); - estimateRequest.setSyncFlg(result.getSyncFlg()); + // 임시저장 상태에서는 인터페이스 막도록 처리 + if ("0".equals(estimateRequest.getTempFlg())) { + // QSP Q.CAST SEND API + List resultList = new ArrayList(); + resultList = this.sendEstimateApi(estimateRequest); + // API에서 받은 문서번호 업데이트 + for (EstimateSendResponse result : resultList) { + estimateRequest.setObjectNo(result.getObjectNo()); + estimateRequest.setPlanNo(result.getPlanNo()); + estimateRequest.setDocNo(result.getDocNo()); + estimateRequest.setSyncFlg(result.getSyncFlg()); - estimateMapper.updateEstimateApi(estimateRequest); + estimateMapper.updateEstimateApi(estimateRequest); + } } + } catch (Exception e) { - e.printStackTrace(); throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR); } } @@ -856,6 +862,319 @@ public class EstimateService { return response; } + /** + * 견적서 초기화 + * + * @param estimateRequest + * @return EstimateResponse 견적서 초기화 후 상세 정보 + * @throws Exception + */ + public EstimateResponse updateEstimateReset(EstimateRequest estimateRequest) throws Exception { + // Validation + if (StringUtils.isEmpty(estimateRequest.getObjectNo())) { + 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, + message.getMessage("common.message.required.data", "Plan No")); + } + + // 견적서 상세 조회 + EstimateResponse estimateResponse = estimateMapper.selectEstimateDetail(estimateRequest); + if (estimateResponse == null) { + throw new QcastException( + ErrorCode.NOT_FOUND, message.getMessage("common.message.required.data", "Estimate Info")); + } + + // 응답 객체 + EstimateResponse response = new EstimateResponse(); + String splitStr = "、"; + + try { + // [1]. 견적서 기본셋팅 + estimateRequest.setEstimateType("YJOD"); + estimateRequest.setPriceCd("UNIT_PRICE"); + estimateRequest.setTempFlg("0".equals(estimateResponse.getTempFlg()) ? "0" : "1"); + + // 물건정보 조회 후 데이터 축출 + ObjectResponse objectResponse = + objectMapper.selectObjectDetail(estimateRequest.getObjectNo()); + if (objectResponse != null) { + estimateRequest.setWeatherPoint( + objectResponse.getPrefName() + " - " + objectResponse.getAreaName()); + estimateRequest.setCharger(objectResponse.getReceiveUser()); + } + + // [2] 도면에서 저장된 아이템 목록 조회 (BOM 컴포넌트 제외) + estimateRequest.setSchBomNotExist("1"); + estimateRequest.setSchDrawingFlg("1"); + List estimateItemList = estimateMapper.selectEstimateItemList(estimateRequest); + List itemList = new ArrayList(); + for (ItemResponse itemResponse : estimateItemList) { + ItemRequest itemRequest = new ItemRequest(); + itemRequest.setObjectNo(itemResponse.getObjectNo()); + itemRequest.setPlanNo(itemResponse.getPlanNo()); + itemRequest.setItemId(itemResponse.getItemId()); + itemRequest.setAmount(itemResponse.getAmount()); + + itemList.add(itemRequest); + } + + // [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); + // BOM 정보 목록 + List estimateBomList = new ArrayList(); + + int j = 1; + for (ItemRequest itemRequest : itemList) { + int dispOrder = 100 * j++; + itemRequest.setDispOrder(String.valueOf(dispOrder)); + + 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.setFileUploadFlg(itemResponse.getFileUploadFlg()); + itemRequest.setPkgMaterialFlg(itemResponse.getPkgMaterialFlg()); + itemRequest.setOpenFlg(itemResponse.getOpenFlg()); + itemRequest.setItemGroup(itemResponse.getItemGroup()); + itemRequest.setItemCtgGr(itemResponse.getItemCtgGr()); + itemRequest.setPartAdd("0"); + itemRequest.setDelFlg("0"); + itemRequest.setDrawingItemFlg("1"); + break; + } + } + + // 아이템 BOM Header인 경우 컴포넌트 등록 처리 + if ("ERLA".equals(itemRequest.getItemCtgGr())) { + List itemBomList = + estimateMapper.selectItemMasterBomList(itemRequest.getItemId()); + + int k = 1; + for (ItemResponse itemResponse : itemBomList) { + ItemRequest bomItem = new ItemRequest(); + + bomItem.setPaDispOrder(String.valueOf(dispOrder)); + bomItem.setDispOrder(String.valueOf(dispOrder + k++)); + bomItem.setItemId(itemResponse.getItemId()); + bomItem.setItemNo(itemResponse.getItemNo()); + bomItem.setItemName(itemResponse.getItemName()); + 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.setBomAmount(itemResponse.getBomAmount()); + bomItem.setUnitPrice(itemResponse.getSalePrice()); + bomItem.setSalePrice(itemResponse.getSalePrice()); + bomItem.setFileUploadFlg(itemResponse.getFileUploadFlg()); + bomItem.setPkgMaterialFlg(itemResponse.getPkgMaterialFlg()); + bomItem.setItemGroup(itemResponse.getItemGroup()); + bomItem.setItemCtgGr(itemResponse.getItemCtgGr()); + bomItem.setPartAdd("0"); + bomItem.setDelFlg("0"); + bomItem.setDrawingItemFlg("1"); + + estimateBomList.add(bomItem); + } + } + } + + // BOM 컴포넌트 추가 + itemList.addAll(estimateBomList); + + // [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 != null ? objectResponse.getSaltAreaFlg() : "")) { + estimateOptions += !StringUtils.isEmpty(estimateOptions) ? splitStr : ""; + estimateOptions += "ATTR005"; // 염해지역 체크 + } else if ("ATTR006".equals(objectResponse != null ? 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) { + if (estimateOptions.indexOf(noteResponse.getCode()) < 0) { + estimateOptions += !StringUtils.isEmpty(estimateOptions) ? splitStr : ""; + estimateOptions += noteResponse.getCode(); + } + } + estimateRequest.setEstimateOption(estimateOptions); + + // 아이템별 특이사항 코드 체크 + for (ItemRequest itemRequest : itemList) { + String specialNoteCd = ""; + for (NoteResponse noteResponse : noteItemList) { + if (itemRequest.getItemId().equals(noteResponse.getItemId())) { + specialNoteCd += !StringUtils.isEmpty(specialNoteCd) ? splitStr : ""; + specialNoteCd += noteResponse.getCode(); + } + } + itemRequest.setSpecialNoteCd(specialNoteCd); + } + + // 첨부파일 초기화 + FileRequest fileRequest = new FileRequest(); + fileRequest.setObjectNo(estimateRequest.getObjectNo()); + fileRequest.setPlanNo(estimateRequest.getPlanNo()); + fileRequest.setUserId(estimateRequest.getUserId()); + fileMapper.deleteFile(fileRequest); + + // 아이템 목록 필수 값 체크 + BigDecimal capacity = BigDecimal.ZERO; + String moduleModel = ""; + String pcTypeNo = ""; + for (ItemRequest itemRequest : itemList) { + if (StringUtils.isEmpty(itemRequest.getDispOrder())) { + 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, + 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); + + // 견적서 정보 초기화 + estimateMapper.updateEstimateReset(estimateRequest); + // 견적서 모든 아이템 제거 + estimateMapper.deleteEstimateItemList(estimateRequest); + // 견적서 아이템 신규 추가 + String hisNo = estimateMapper.selectEstimateItemHisNo(estimateRequest); // 아이템 히스토리 번호 조회 + for (ItemRequest itemRequest : itemList) { + itemRequest.setHisNo(hisNo); + itemRequest.setObjectNo(estimateRequest.getObjectNo()); + itemRequest.setPlanNo(estimateRequest.getPlanNo()); + itemRequest.setAmount( + !StringUtils.isEmpty(itemRequest.getAmount()) ? itemRequest.getAmount() : "0"); + itemRequest.setSalePrice( + !StringUtils.isEmpty(itemRequest.getSalePrice()) ? itemRequest.getSalePrice() : "0"); + itemRequest.setBomAmount( + !StringUtils.isEmpty(itemRequest.getBomAmount()) ? itemRequest.getBomAmount() : "0"); + itemRequest.setPartAdd( + !StringUtils.isEmpty(itemRequest.getPartAdd()) ? itemRequest.getPartAdd() : "0"); + itemRequest.setOpenFlg( + !StringUtils.isEmpty(itemRequest.getOpenFlg()) ? itemRequest.getOpenFlg() : "0"); + itemRequest.setItemChangeFlg( + !StringUtils.isEmpty(itemRequest.getItemChangeFlg()) + ? itemRequest.getItemChangeFlg() + : "0"); + itemRequest.setUserId(estimateRequest.getUserId()); + + estimateMapper.insertEstimateItemHis(itemRequest); + + if (!"1".equals(itemRequest.getDelFlg())) { + estimateMapper.insertEstimateItem(itemRequest); + } + } + + // 임시저장 상태에서는 인터페이스 막도록 처리 + if ("0".equals(estimateRequest.getTempFlg())) { + // QSP Q.CAST SEND API + List resultList = new ArrayList(); + resultList = this.sendEstimateApi(estimateRequest); + // API에서 받은 문서번호 업데이트 + for (EstimateSendResponse result : resultList) { + estimateRequest.setObjectNo(result.getObjectNo()); + estimateRequest.setPlanNo(result.getPlanNo()); + estimateRequest.setDocNo(result.getDocNo()); + estimateRequest.setSyncFlg(result.getSyncFlg()); + + estimateMapper.updateEstimateApi(estimateRequest); + } + } + + } catch (Exception e) { + throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR); + } + + // [9]. 최종 생성 물건번호 리턴 + response.setObjectNo(estimateRequest.getObjectNo()); + response.setPlanNo(estimateRequest.getPlanNo()); + return response; + } + /** * 견적서 엑셀 다운로드 * @@ -1354,11 +1673,14 @@ public class EstimateService { elm = doc.getElementById("estimateDate"); elm.text(StringUtils.defaultString(data.getEstimateDate())); + elm = doc.getElementById("saleStoreName"); + elm.text(StringUtils.defaultString(data.getSaleStoreName())); + elm = doc.getElementById("bizNo"); elm.text(StringUtils.defaultString(data.getBizNo())); elm = doc.getElementById("zipNo"); - elm.text(StringUtils.defaultString(data.getZipNo())); + elm.text("(" + StringUtils.defaultString(data.getZipNo()) + ")"); elm = doc.getElementById("address"); elm.text(StringUtils.defaultString(data.getAddress())); 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 1a468ca5..13aeab39 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 @@ -157,6 +157,9 @@ public class EstimateRequest { @Schema(description = "QSP 동기화 여부") private String syncFlg; + @Schema(description = "임시저장 여부") + private String tempFlg; + @Schema(description = "비고") private String remarks; @@ -185,6 +188,9 @@ public class EstimateRequest { @Schema(description = "검색 - 아이템 BOM 제외여부") private String schBomNotExist; + @Schema(description = "검색 - 도면 아이템여부") + private String schDrawingItemFlg; + // 데이터 목록 관련 정보 @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 96232114..c887f9bf 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 @@ -146,6 +146,9 @@ public class EstimateResponse { @Schema(description = "비고") private String remarks; + @Schema(description = "임시저장 여부") + private String tempFlg; + @Schema(description = "갱신일") private String lastEditDatetime; @@ -208,6 +211,12 @@ public class EstimateResponse { @Schema(description = "하위 판매점명") private String agencySaleStoreName; + @Schema(description = "한랭지 대책여부") + private String coldRegionFlg; + + @Schema(description = "염해지역 아이템사용 여부") + private String saltAreaFlg; + // 판매점 정보 @Schema(description = "고객 판매점명") private String custSaleStoreName; 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 55dd700f..d2c5c7bf 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 @@ -89,6 +89,9 @@ public class ItemRequest { @Schema(description = "히스토리 번호") private String hisNo; + @Schema(description = "도면 아이템여부") + private String drawingItemFlg; + @Schema(description = "삭제여부") private String delFlg; diff --git a/src/main/java/com/interplug/qcast/biz/master/MasterController.java b/src/main/java/com/interplug/qcast/biz/master/MasterController.java index e71d40ac..6df0150e 100644 --- a/src/main/java/com/interplug/qcast/biz/master/MasterController.java +++ b/src/main/java/com/interplug/qcast/biz/master/MasterController.java @@ -1,240 +1,244 @@ package com.interplug.qcast.biz.master; -import com.interplug.qcast.biz.master.dto.ApiConstructionResponse; -import com.interplug.qcast.biz.master.dto.ApiModuleTpResponse; -import com.interplug.qcast.biz.master.dto.ApiResponse; -import com.interplug.qcast.biz.master.dto.ApiRoofMaterialResponse; -import com.interplug.qcast.biz.master.dto.ApiTrestleDetailResponse; -import com.interplug.qcast.biz.master.dto.ApiTrestleResponse; +import com.interplug.qcast.biz.master.dto.*; import com.interplug.qcast.config.Exception.ErrorCode; import com.interplug.qcast.config.Exception.QcastException; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; -import java.util.List; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +import java.util.List; + @RestController @RequestMapping("/api/v1/master") @RequiredArgsConstructor @Tag(name = "MasterController", description = "Master API") public class MasterController { - private final MasterService masterService; + private final MasterService masterService; - @Operation(description = "지붕재 목록을 조회한다.") - @GetMapping("/getRoofMaterialList") - public ApiResponse getRoofMaterialList() { - return masterService.getRoofMaterialList(); - } - - @Operation(description = "모듈 타입별 아이템 목록을 조회한다.") - @GetMapping("/getModuleTypeItemList") - public ApiResponse getModuleTypeItemList( - @Parameter(description = "지붕재 코드 목록") @RequestParam("arrRoofMatlCd") - List roofMaterialCd) - throws QcastException { - if (roofMaterialCd == null - || roofMaterialCd.isEmpty() - || roofMaterialCd.size() > 4 - || roofMaterialCd.stream().anyMatch(s -> s == null || s.trim().isEmpty())) { - throw new QcastException(ErrorCode.INVALID_INPUT_VALUE); - } - return masterService.getModuleTypeItemList(roofMaterialCd); - } - - @Operation(description = "가대 목록 조회한다.") - @GetMapping("/getTrestleList") - public ApiResponse getTrestleList( - @Parameter(description = "모듈타입코드") @RequestParam(required = false) String moduleTpCd, - @Parameter(description = "지붕재코드") @RequestParam(required = false) String roofMatlCd, - @Parameter(description = "서까래기초코드") @RequestParam(required = false) String raftBaseCd, - @Parameter(description = "가대메이커코드") @RequestParam(required = false) String trestleMkrCd, - @Parameter(description = "공법코드") @RequestParam(required = false) String constMthdCd, - @Parameter(description = "지붕기초코드") @RequestParam(required = false) String roofBaseCd) { - - ApiTrestleBuilder apiTrestleInfoBuilder = - new ApiTrestleBuilder( - moduleTpCd, roofMatlCd, raftBaseCd, trestleMkrCd, constMthdCd, roofBaseCd); - ApiTrestleBuilder atb = - apiTrestleInfoBuilder - .setModuleTpCd(moduleTpCd) - .setRoofMatlCdCd(roofMatlCd) - .setRaftBaseCd(raftBaseCd) - .setTrestleMkrCd(trestleMkrCd) - .setConstMthdCd(constMthdCd) - .setRoofBaseCd(roofBaseCd) - .build(); - return masterService.getTrestleList( - atb.getModuleTpCd(), - atb.getRoofMatlCd(), - atb.getRaftBaseCd(), - atb.getTrestleMkrCd(), - atb.getConstMthdCd(), - atb.getRoofBaseCd()); - } - - @Operation(description = "시공법 목록 조회한다.") - @GetMapping("/getConstructionList") - public ApiResponse getConstructionList( - @Parameter(description = "모듈타입코드") @RequestParam String moduleTpCd, - @Parameter(description = "지붕재코드") @RequestParam String roofMatlCd, - @Parameter(description = "가대메이커코드") @RequestParam String trestleMkrCd, - @Parameter(description = "공법코드") @RequestParam String constMthdCd, - @Parameter(description = "지붕기초코드") @RequestParam String roofBaseCd, - @Parameter(description = "면조도") @RequestParam String illuminationTp, - @Parameter(description = "설치높이") @RequestParam String instHt, - @Parameter(description = "풍속") @RequestParam String stdWindSpeed, - @Parameter(description = "적설량") @RequestParam String stdSnowLd, - @Parameter(description = "경사도코드") @RequestParam String inclCd, - @Parameter(description = "서까래기초코드") @RequestParam(required = false) String raftBaseCd, - @Parameter(description = "하제(망둥어)피치") @RequestParam(required = false) Integer roofPitch) - throws QcastException { - - if (moduleTpCd == null - || moduleTpCd.trim().isEmpty() - || roofMatlCd == null - || roofMatlCd.trim().isEmpty() - || trestleMkrCd == null - || trestleMkrCd.trim().isEmpty() - || constMthdCd == null - || constMthdCd.trim().isEmpty() - || roofBaseCd == null - || roofBaseCd.trim().isEmpty() - || illuminationTp == null - || illuminationTp.trim().isEmpty() - || instHt == null - || instHt.trim().isEmpty() - || stdWindSpeed == null - || stdWindSpeed.trim().isEmpty() - || stdSnowLd == null - || stdSnowLd.trim().isEmpty() - || inclCd == null - || inclCd.trim().isEmpty()) { - throw new QcastException(ErrorCode.INVALID_INPUT_VALUE); + @Operation(description = "지붕재 목록을 조회한다.") + @GetMapping("/getRoofMaterialList") + public ApiResponse getRoofMaterialList() { + return masterService.getRoofMaterialList(); } - ApiConstructionBuilder apiConstructionBuilder = - new ApiConstructionBuilder( - moduleTpCd, - roofMatlCd, - trestleMkrCd, - constMthdCd, - roofBaseCd, - illuminationTp, - instHt, - stdWindSpeed, - stdSnowLd, - inclCd, - raftBaseCd, - roofPitch); - ApiConstructionBuilder acb = - apiConstructionBuilder - .setModuleTpCd(moduleTpCd) - .setRoofMatlCd(roofMatlCd) - .setTrestleMkrCd(trestleMkrCd) - .setConstMthdCd(constMthdCd) - .setRoofBaseCd(roofBaseCd) - .setIlluminationTp(illuminationTp) - .setInstHt(instHt) - .setStdWindSpeed(stdWindSpeed) - .setStdSnowLd(stdSnowLd) - .setInclCd(inclCd) - .setRaftBaseCd(raftBaseCd) - .setRoofPitch(roofPitch) - .build(); - - return masterService.getConstructionList( - acb.getModuleTpCd(), - acb.getRoofMatlCd(), - acb.getTrestleMkrCd(), - acb.getConstMthdCd(), - acb.getRoofBaseCd(), - acb.getIlluminationTp(), - acb.getInstHt(), - acb.getStdWindSpeed(), - acb.getStdSnowLd(), - acb.getInclCd(), - acb.getRaftBaseCd(), - acb.getRoofPitch()); - } - - @Operation(description = "가대 상세 조회한다.") - @GetMapping("/getTrestleDetailList") - public ApiResponse getTrestleDetailList( - @Parameter(description = "모듈타입코드") @RequestParam String moduleTpCd, - @Parameter(description = "지붕재코드") @RequestParam String roofMatlCd, - @Parameter(description = "가대메이커코드") @RequestParam String trestleMkrCd, - @Parameter(description = "공법코드") @RequestParam String constMthdCd, - @Parameter(description = "지붕기초코드") @RequestParam String roofBaseCd, - @Parameter(description = "면조도") @RequestParam String illuminationTp, - @Parameter(description = "설치높이") @RequestParam String instHt, - @Parameter(description = "풍속") @RequestParam String stdWindSpeed, - @Parameter(description = "적설량") @RequestParam String stdSnowLd, - @Parameter(description = "경사도코드") @RequestParam String inclCd, - @Parameter(description = "시공법") @RequestParam String constTp, - @Parameter(description = "혼합모듈번호") @RequestParam(required = false) Integer mixMatlNo, - @Parameter(description = "하제(망둥어)피치") @RequestParam(required = false) Integer roofPitch) - throws QcastException { - - if (moduleTpCd == null - || moduleTpCd.trim().isEmpty() - || roofMatlCd == null - || roofMatlCd.trim().isEmpty() - || trestleMkrCd == null - || trestleMkrCd.trim().isEmpty() - || constMthdCd == null - || constMthdCd.trim().isEmpty() - || roofBaseCd == null - || roofBaseCd.trim().isEmpty() - || illuminationTp == null - || illuminationTp.trim().isEmpty() - || instHt == null - || instHt.trim().isEmpty() - || stdWindSpeed == null - || stdWindSpeed.trim().isEmpty() - || stdSnowLd == null - || stdSnowLd.trim().isEmpty() - || inclCd == null - || inclCd.trim().isEmpty() - || constTp == null - || constTp.trim().isEmpty()) { - throw new QcastException(ErrorCode.INVALID_INPUT_VALUE); + @Operation(description = "모듈 타입별 아이템 목록을 조회한다.") + @GetMapping("/getModuleTypeItemList") + public ApiResponse getModuleTypeItemList( + @Parameter(description = "지붕재 코드 목록") @RequestParam("arrRoofMatlCd") + List roofMaterialCd) + throws QcastException { + if (roofMaterialCd == null + || roofMaterialCd.isEmpty() + || roofMaterialCd.size() > 4 + || roofMaterialCd.stream().anyMatch(s -> s == null || s.trim().isEmpty())) { + throw new QcastException(ErrorCode.INVALID_INPUT_VALUE); + } + return masterService.getModuleTypeItemList(roofMaterialCd); } - ApiTrestleDetailBuilder atdb = - ApiTrestleDetailBuilder.builder() - .moduleTpCd(moduleTpCd) - .roofMatlCd(roofMatlCd) - .trestleMkrCd(trestleMkrCd) - .constMthdCd(constMthdCd) - .roofBaseCd(roofBaseCd) - .illuminationTp(illuminationTp) - .instHt(instHt) - .stdWindSpeed(stdWindSpeed) - .stdSnowLd(stdSnowLd) - .inclCd(inclCd) - .constTp(constTp) - .mixMatlNo(mixMatlNo) - .roofPitch(roofPitch) - .build(); + @Operation(description = "가대 목록 조회한다.") + @GetMapping("/getTrestleList") + public ApiResponse getTrestleList( + @Parameter(description = "모듈타입코드") @RequestParam(required = false) String moduleTpCd, + @Parameter(description = "지붕재코드") @RequestParam(required = false) String roofMatlCd, + @Parameter(description = "서까래기초코드") @RequestParam(required = false) String raftBaseCd, + @Parameter(description = "가대메이커코드") @RequestParam(required = false) String trestleMkrCd, + @Parameter(description = "공법코드") @RequestParam(required = false) String constMthdCd, + @Parameter(description = "지붕기초코드") @RequestParam(required = false) String roofBaseCd) { - return masterService.getTrestleDetailList( - atdb.getModuleTpCd(), - atdb.getRoofMatlCd(), - atdb.getTrestleMkrCd(), - atdb.getConstMthdCd(), - atdb.getRoofBaseCd(), - atdb.getIlluminationTp(), - atdb.getInstHt(), - atdb.getStdWindSpeed(), - atdb.getStdSnowLd(), - atdb.getInclCd(), - atdb.getConstTp(), - atdb.getMixMatlNo(), - atdb.getRoofPitch()); - } + ApiTrestleBuilder apiTrestleInfoBuilder = + new ApiTrestleBuilder( + moduleTpCd, roofMatlCd, raftBaseCd, trestleMkrCd, constMthdCd, roofBaseCd); + ApiTrestleBuilder atb = + apiTrestleInfoBuilder + .setModuleTpCd(moduleTpCd) + .setRoofMatlCdCd(roofMatlCd) + .setRaftBaseCd(raftBaseCd) + .setTrestleMkrCd(trestleMkrCd) + .setConstMthdCd(constMthdCd) + .setRoofBaseCd(roofBaseCd) + .build(); + return masterService.getTrestleList( + atb.getModuleTpCd(), + atb.getRoofMatlCd(), + atb.getRaftBaseCd(), + atb.getTrestleMkrCd(), + atb.getConstMthdCd(), + atb.getRoofBaseCd()); + } + + @Operation(description = "시공법 목록 조회한다.") + @GetMapping("/getConstructionList") + public ApiResponse getConstructionList( + @Parameter(description = "모듈타입코드") @RequestParam String moduleTpCd, + @Parameter(description = "지붕재코드") @RequestParam String roofMatlCd, + @Parameter(description = "가대메이커코드") @RequestParam String trestleMkrCd, + @Parameter(description = "공법코드") @RequestParam String constMthdCd, + @Parameter(description = "지붕기초코드") @RequestParam String roofBaseCd, + @Parameter(description = "면조도") @RequestParam String illuminationTp, + @Parameter(description = "설치높이") @RequestParam String instHt, + @Parameter(description = "풍속") @RequestParam String stdWindSpeed, + @Parameter(description = "적설량") @RequestParam String stdSnowLd, + @Parameter(description = "경사도코드") @RequestParam String inclCd, + @Parameter(description = "서까래기초코드") @RequestParam(required = false) String raftBaseCd, + @Parameter(description = "하제(망둥어)피치") @RequestParam(required = false) Integer roofPitch) + throws QcastException { + + if (moduleTpCd == null + || moduleTpCd.trim().isEmpty() + || roofMatlCd == null + || roofMatlCd.trim().isEmpty() + || trestleMkrCd == null + || trestleMkrCd.trim().isEmpty() + || constMthdCd == null + || constMthdCd.trim().isEmpty() + || roofBaseCd == null + || roofBaseCd.trim().isEmpty() + || illuminationTp == null + || illuminationTp.trim().isEmpty() + || instHt == null + || instHt.trim().isEmpty() + || stdWindSpeed == null + || stdWindSpeed.trim().isEmpty() + || stdSnowLd == null + || stdSnowLd.trim().isEmpty() + || inclCd == null + || inclCd.trim().isEmpty()) { + throw new QcastException(ErrorCode.INVALID_INPUT_VALUE); + } + + ApiConstructionBuilder apiConstructionBuilder = + new ApiConstructionBuilder( + moduleTpCd, + roofMatlCd, + trestleMkrCd, + constMthdCd, + roofBaseCd, + illuminationTp, + instHt, + stdWindSpeed, + stdSnowLd, + inclCd, + raftBaseCd, + roofPitch); + ApiConstructionBuilder acb = + apiConstructionBuilder + .setModuleTpCd(moduleTpCd) + .setRoofMatlCd(roofMatlCd) + .setTrestleMkrCd(trestleMkrCd) + .setConstMthdCd(constMthdCd) + .setRoofBaseCd(roofBaseCd) + .setIlluminationTp(illuminationTp) + .setInstHt(instHt) + .setStdWindSpeed(stdWindSpeed) + .setStdSnowLd(stdSnowLd) + .setInclCd(inclCd) + .setRaftBaseCd(raftBaseCd) + .setRoofPitch(roofPitch) + .build(); + + return masterService.getConstructionList( + acb.getModuleTpCd(), + acb.getRoofMatlCd(), + acb.getTrestleMkrCd(), + acb.getConstMthdCd(), + acb.getRoofBaseCd(), + acb.getIlluminationTp(), + acb.getInstHt(), + acb.getStdWindSpeed(), + acb.getStdSnowLd(), + acb.getInclCd(), + acb.getRaftBaseCd(), + acb.getRoofPitch()); + } + + @Operation(description = "가대 상세 조회한다.") + @GetMapping("/getTrestleDetailList") + public ApiResponse getTrestleDetailList( + @Parameter(description = "모듈타입코드") @RequestParam String moduleTpCd, + @Parameter(description = "지붕재코드") @RequestParam String roofMatlCd, + @Parameter(description = "가대메이커코드") @RequestParam String trestleMkrCd, + @Parameter(description = "공법코드") @RequestParam String constMthdCd, + @Parameter(description = "지붕기초코드") @RequestParam String roofBaseCd, + @Parameter(description = "면조도") @RequestParam String illuminationTp, + @Parameter(description = "설치높이") @RequestParam String instHt, + @Parameter(description = "풍속") @RequestParam String stdWindSpeed, + @Parameter(description = "적설량") @RequestParam String stdSnowLd, + @Parameter(description = "경사도코드") @RequestParam String inclCd, + @Parameter(description = "시공법") @RequestParam String constTp, + @Parameter(description = "혼합모듈번호") @RequestParam(required = false) Integer mixMatlNo, + @Parameter(description = "하제(망둥어)피치") @RequestParam(required = false) Integer roofPitch) + throws QcastException { + + if (moduleTpCd == null + || moduleTpCd.trim().isEmpty() + || roofMatlCd == null + || roofMatlCd.trim().isEmpty() + || trestleMkrCd == null + || trestleMkrCd.trim().isEmpty() + || constMthdCd == null + || constMthdCd.trim().isEmpty() + || roofBaseCd == null + || roofBaseCd.trim().isEmpty() + || illuminationTp == null + || illuminationTp.trim().isEmpty() + || instHt == null + || instHt.trim().isEmpty() + || stdWindSpeed == null + || stdWindSpeed.trim().isEmpty() + || stdSnowLd == null + || stdSnowLd.trim().isEmpty() + || inclCd == null + || inclCd.trim().isEmpty() + || constTp == null + || constTp.trim().isEmpty()) { + throw new QcastException(ErrorCode.INVALID_INPUT_VALUE); + } + + ApiTrestleDetailBuilder atdb = + ApiTrestleDetailBuilder.builder() + .moduleTpCd(moduleTpCd) + .roofMatlCd(roofMatlCd) + .trestleMkrCd(trestleMkrCd) + .constMthdCd(constMthdCd) + .roofBaseCd(roofBaseCd) + .illuminationTp(illuminationTp) + .instHt(instHt) + .stdWindSpeed(stdWindSpeed) + .stdSnowLd(stdSnowLd) + .inclCd(inclCd) + .constTp(constTp) + .mixMatlNo(mixMatlNo) + .roofPitch(roofPitch) + .build(); + + return masterService.getTrestleDetailList( + atdb.getModuleTpCd(), + atdb.getRoofMatlCd(), + atdb.getTrestleMkrCd(), + atdb.getConstMthdCd(), + atdb.getRoofBaseCd(), + atdb.getIlluminationTp(), + atdb.getInstHt(), + atdb.getStdWindSpeed(), + atdb.getStdSnowLd(), + atdb.getInclCd(), + atdb.getConstTp(), + atdb.getMixMatlNo(), + atdb.getRoofPitch()); + } + + @Operation(description = "PCS 메이커, 시리즈 조회한다.") + @GetMapping("/pcsMakerList") + public ApiResponse getPcsMakerList(@Parameter(description = "PCS 메이커 코드") @RequestParam(required = false) String pcsMkrCd, + @Parameter(description = "혼합모듈번호") @RequestParam(required = false) String mixMatlNo) { + + return masterService.getPcsMakerList(pcsMkrCd, mixMatlNo); + } } diff --git a/src/main/java/com/interplug/qcast/biz/master/MasterService.java b/src/main/java/com/interplug/qcast/biz/master/MasterService.java index 54628a21..1651d6f3 100644 --- a/src/main/java/com/interplug/qcast/biz/master/MasterService.java +++ b/src/main/java/com/interplug/qcast/biz/master/MasterService.java @@ -1,69 +1,70 @@ package com.interplug.qcast.biz.master; -import com.interplug.qcast.biz.master.dto.ApiConstructionResponse; -import com.interplug.qcast.biz.master.dto.ApiModuleTpResponse; -import com.interplug.qcast.biz.master.dto.ApiResponse; -import com.interplug.qcast.biz.master.dto.ApiRoofMaterialResponse; -import com.interplug.qcast.biz.master.dto.ApiTrestleDetailResponse; -import com.interplug.qcast.biz.master.dto.ApiTrestleResponse; -import java.util.List; +import com.interplug.qcast.biz.master.dto.*; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; +import java.util.List; + // @FeignClient(name = "master", url = "${feign.master.url}") @FeignClient(name = "master", url = "${qsp.url}/api/master") public interface MasterService { - // 지붕재 목록 조회 - @GetMapping("/roofMaterialList") - public ApiResponse getRoofMaterialList(); + // 지붕재 목록 조회 + @GetMapping("/roofMaterialList") + public ApiResponse getRoofMaterialList(); - // 모듈 타입별 아이템 목록 조회 - @GetMapping("/moduleTypeItemList") - public ApiResponse getModuleTypeItemList( - @RequestParam("arrRoofMatlCd") List roofMaterialCd); + // 모듈 타입별 아이템 목록 조회 + @GetMapping("/moduleTypeItemList") + public ApiResponse getModuleTypeItemList( + @RequestParam("arrRoofMatlCd") List roofMaterialCd); - // 가대 목록 조회 - @GetMapping("/trestle") - public ApiResponse getTrestleList( - @RequestParam(required = false) String moduleTpCd, - @RequestParam(required = false) String roofMatlCd, - @RequestParam(required = false) String raftBaseCd, - @RequestParam(required = false) String trestleMkrCd, - @RequestParam(required = false) String constMthdCd, - @RequestParam(required = false) String roofBaseCd); + // 가대 목록 조회 + @GetMapping("/trestle") + public ApiResponse getTrestleList( + @RequestParam(required = false) String moduleTpCd, + @RequestParam(required = false) String roofMatlCd, + @RequestParam(required = false) String raftBaseCd, + @RequestParam(required = false) String trestleMkrCd, + @RequestParam(required = false) String constMthdCd, + @RequestParam(required = false) String roofBaseCd); - // 시공법 목록 조회 - @GetMapping("/construction") - public ApiResponse getConstructionList( - @RequestParam String moduleTpCd, - @RequestParam String roofMatlCd, - @RequestParam String trestleMkrCd, - @RequestParam String constMthdCd, - @RequestParam String roofBaseCd, - @RequestParam String illuminationTp, - @RequestParam String instHt, - @RequestParam String stdWindSpeed, - @RequestParam String stdSnowLd, - @RequestParam String inclCd, - @RequestParam(required = false) String raftBaseCd, - @RequestParam(required = false) Integer roofPitch); + // 시공법 목록 조회 + @GetMapping("/construction") + public ApiResponse getConstructionList( + @RequestParam String moduleTpCd, + @RequestParam String roofMatlCd, + @RequestParam String trestleMkrCd, + @RequestParam String constMthdCd, + @RequestParam String roofBaseCd, + @RequestParam String illuminationTp, + @RequestParam String instHt, + @RequestParam String stdWindSpeed, + @RequestParam String stdSnowLd, + @RequestParam String inclCd, + @RequestParam(required = false) String raftBaseCd, + @RequestParam(required = false) Integer roofPitch); - // 가대 상세 조회 - @GetMapping(value = "/trestle/detail", consumes = "application/json") - public ApiResponse getTrestleDetailList( - @RequestParam String moduleTpCd, - @RequestParam String roofMatlCd, - @RequestParam String trestleMkrCd, - @RequestParam String constMthdCd, - @RequestParam String roofBaseCd, - @RequestParam String illuminationTp, - @RequestParam String instHt, - @RequestParam String stdWindSpeed, - @RequestParam String stdSnowLd, - @RequestParam String inclCd, - @RequestParam String constTp, - @RequestParam(required = false) Integer mixMatlNo, - @RequestParam(required = false) Integer roofPitch); + // 가대 상세 조회 + @GetMapping(value = "/trestle/detail", consumes = "application/json") + public ApiResponse getTrestleDetailList( + @RequestParam String moduleTpCd, + @RequestParam String roofMatlCd, + @RequestParam String trestleMkrCd, + @RequestParam String constMthdCd, + @RequestParam String roofBaseCd, + @RequestParam String illuminationTp, + @RequestParam String instHt, + @RequestParam String stdWindSpeed, + @RequestParam String stdSnowLd, + @RequestParam String inclCd, + @RequestParam String constTp, + @RequestParam(required = false) Integer mixMatlNo, + @RequestParam(required = false) Integer roofPitch); + + // PCS Maker, 시리즈 목록 조회 + @GetMapping("/pcsMakerList") + public ApiResponse getPcsMakerList(@RequestParam(required = false) String pcsMkrCd, + @RequestParam(required = false) String mixMatlNo); } diff --git a/src/main/java/com/interplug/qcast/biz/master/dto/ApiPcsMakerResponse.java b/src/main/java/com/interplug/qcast/biz/master/dto/ApiPcsMakerResponse.java new file mode 100644 index 00000000..980f20d5 --- /dev/null +++ b/src/main/java/com/interplug/qcast/biz/master/dto/ApiPcsMakerResponse.java @@ -0,0 +1,37 @@ +package com.interplug.qcast.biz.master.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@Schema(description = "PCS 메이커, 시리즈 목록 조회") +public class ApiPcsMakerResponse { + + @Schema(description = "PCS메이커코드") + private String pcsMkrCd; + + @Schema(description = "PCS메이커코드명") + private String pcsMkrNm; + + @Schema(description = "PCS메이커코드명(일본)") + private String pcsMkrNmJp; + + @Schema(description = "PCS시리즈멀티선택타입(멀티:MULTI, 단독:SINGLE, 단독(병설):SINGLE-P)") + private String pcsMkrMultiType; + + @Schema(description = "PCS시리즈코드") + private String pcsSerCd; + + @Schema(description = "PCS시리즈코드명") + private String pcsSerNm; + + @Schema(description = "PCS시리즈코드명(일본)") + private String pcsSerNmJp; + + @Schema(description = "PCS시리즈 병설 여부") + private String pcsSerParallelYn; + + +} diff --git a/src/main/java/com/interplug/qcast/biz/object/ObjectController.java b/src/main/java/com/interplug/qcast/biz/object/ObjectController.java index d6fbe32a..8a6efcdb 100644 --- a/src/main/java/com/interplug/qcast/biz/object/ObjectController.java +++ b/src/main/java/com/interplug/qcast/biz/object/ObjectController.java @@ -1,14 +1,6 @@ package com.interplug.qcast.biz.object; -import com.interplug.qcast.biz.object.dto.ObjectRequest; -import com.interplug.qcast.biz.object.dto.ObjectResponse; -import com.interplug.qcast.biz.object.dto.PlanReqRequest; -import com.interplug.qcast.biz.object.dto.PlanReqResponse; -import com.interplug.qcast.biz.object.dto.PlanRequest; -import com.interplug.qcast.biz.object.dto.PrefResponse; -import com.interplug.qcast.biz.object.dto.SaleStoreResponse; -import com.interplug.qcast.biz.object.dto.UploadRequest; -import com.interplug.qcast.biz.object.dto.WindSpeedResponse; +import com.interplug.qcast.biz.object.dto.*; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.http.HttpServletRequest; @@ -113,8 +105,8 @@ public class ObjectController { @Operation(description = "물건정보의 플랜정보를 추가한다.") @PostMapping("/add-plan") @ResponseStatus(HttpStatus.CREATED) - public void insertPlan(@RequestBody PlanRequest planRequest) throws Exception { - objectService.insertPlan(planRequest); + public PlanResponse insertPlan(@RequestBody PlanRequest planRequest) throws Exception { + return objectService.insertPlan(planRequest); } @Operation(description = "물건정보의 플랜정보를 삭제한다.") 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 d4f7bd23..aceacb3d 100644 --- a/src/main/java/com/interplug/qcast/biz/object/ObjectService.java +++ b/src/main/java/com/interplug/qcast/biz/object/ObjectService.java @@ -270,6 +270,7 @@ public class ObjectService { planRequest.setNorthArrangement("0"); planRequest.setDiffRoofEnabled("0"); planRequest.setOrderFlg("0"); + planRequest.setTempFlg("1"); planRequest.setUserId(objectRequest.getUserId()); result += objectMapper.insertPlan(planRequest); @@ -460,7 +461,10 @@ public class ObjectService { * @return String 추가 플랜번호 * @throws Exception */ - public String insertPlan(PlanRequest planRequest) throws Exception { + public PlanResponse insertPlan(PlanRequest planRequest) throws Exception { + + PlanResponse planResponse = new PlanResponse(); + // Validation if (StringUtils.isEmpty(planRequest.getObjectNo())) { throw new QcastException( @@ -482,10 +486,14 @@ public class ObjectService { planRequest.setNorthArrangement("0"); planRequest.setDiffRoofEnabled("0"); planRequest.setOrderFlg("0"); + planRequest.setTempFlg("1"); objectMapper.insertPlan(planRequest); - return planRequest.getPlanNo(); + planResponse.setObjectNo(planRequest.getObjectNo()); + planResponse.setPlanNo(planRequest.getPlanNo()); + + return planResponse; } /** diff --git a/src/main/java/com/interplug/qcast/biz/object/dto/PlanRequest.java b/src/main/java/com/interplug/qcast/biz/object/dto/PlanRequest.java index 8b257862..1e1e6601 100644 --- a/src/main/java/com/interplug/qcast/biz/object/dto/PlanRequest.java +++ b/src/main/java/com/interplug/qcast/biz/object/dto/PlanRequest.java @@ -106,4 +106,7 @@ public class PlanRequest { @Schema(description = "발주여부") private String orderFlg; + + @Schema(description = "임시저장여부") + private String tempFlg; } diff --git a/src/main/resources/mappers/estimate/estimateMapper.xml b/src/main/resources/mappers/estimate/estimateMapper.xml index e5d15d39..d165566a 100644 --- a/src/main/resources/mappers/estimate/estimateMapper.xml +++ b/src/main/resources/mappers/estimate/estimateMapper.xml @@ -49,6 +49,7 @@ , P.PKG_ASP , P.PRICE_CD , P.REMARKS + , P.TEMP_FLG , P.LAST_EDIT_DATETIME , P.CREATE_DATETIME , P.CREATE_USER @@ -56,6 +57,8 @@ , O.OBJECT_NAME_OMIT , O.REMARKS AS OBJECT_REMARKS , O.SALE_STORE_ID + , ISNULL(O.COLD_REGION_FLG, '0') AS COLD_REGION_FLG + , ISNULL(O.SALT_AREA_FLG, '0') AS SALT_AREA_FLG , SS.FIRST_AGENT_ID , SS.SALE_STORE_LEVEL , CASE WHEN ISNULL(SS.FIRST_AGENT_ID, '') = '' THEN SS.SALE_STORE_NAME ELSE (SELECT SALE_STORE_NAME FROM M_SALES_STORE WHERE SALE_STORE_ID = SS.FIRST_AGENT_ID) END AS FIRST_SALE_STORE_NAME @@ -75,11 +78,11 @@ SELECT T.* , SS1.SALE_STORE_NAME AS CUST_SALE_STORE_NAME - , SS2.SALE_STORE_NAME - , SS2.ZIP_NO - , SS2.ADDRESS - , SS2.TEL - , SS2.FAX + , CASE WHEN SS2.DISP_COMPANY_NAME IS NOT NULL THEN SS2.DISP_COMPANY_NAME ELSE SS2.SALE_STORE_NAME END AS SALE_STORE_NAME + , CASE WHEN SS2.DISP_ZIP_NO IS NOT NULL THEN SS2.DISP_ZIP_NO ELSE SS2.ZIP_NO END AS ZIP_NO + , CASE WHEN SS2.DISP_ADDRESS IS NOT NULL THEN SS2.DISP_ADDRESS ELSE SS2.ADDRESS END AS ADDRESS + , CASE WHEN SS2.DISP_TEL IS NOT NULL THEN SS2.DISP_TEL ELSE SS2.TEL END AS TEL + , CASE WHEN SS2.DISP_FAX IS NOT NULL THEN SS2.DISP_FAX ELSE SS2.FAX END AS FAX , SS2.BIZ_NO FROM ( @@ -240,6 +243,9 @@ AND (PE.PA_DISP_ORDER IS NULL OR PE.PA_DISP_ORDER = '') + + AND PE.DRAWING_ITEM_FLG = #{schDrawingItemFlg} + ORDER BY PE.DISP_ORDER ASC @@ -606,6 +612,7 @@ , PKG_ASP = NULL , PRICE_CD = #{priceCd} , SURFACE_TYPE = #{surfaceType} + , TEMP_FLG = CASE WHEN TEMP_FLG = '0' THEN '0' ELSE #{tempFlg} END , CREATE_DATETIME = GETDATE() , CREATE_USER = #{userId} @@ -617,6 +624,7 @@ , REMARKS = #{remarks} , PKG_ASP = #{pkgAsp} , PRICE_CD = #{priceCd} + , TEMP_FLG = '0' , CAPACITY = #{capacity} @@ -628,6 +636,27 @@ AND PLAN_NO = #{planNo} + + /* sqlid : com.interplug.qcast.biz.estimate.updateEstimate */ + UPDATE T_PLAN + SET + ESTIMATE_TYPE = #{estimateType} + , CHARGER = NULL + , FILE_FLG = '0' + , ESTIMATE_OPTION = #{estimateOption} + , REMARKS = NULL + , PKG_ASP = NULL + , PRICE_CD = #{priceCd} + , TEMP_FLG = CASE WHEN TEMP_FLG = '0' THEN '0' ELSE #{tempFlg} END + , CAPACITY = #{capacity} + , MODULE_MODEL = #{moduleModel} + , PC_TYPE_NO = #{pcTypeNo} + , LAST_EDIT_DATETIME = GETDATE() + , LAST_EDIT_USER = #{userId} + WHERE OBJECT_NO = #{objectNo} + AND PLAN_NO = #{planNo} + + /* sqlid : com.interplug.qcast.biz.estimate.updateEstimateApi */ UPDATE T_PLAN @@ -672,6 +701,9 @@ , PKG_MATERIAL_FLG , OPEN_FLG , ITEM_CHANGE_FLG + + , DRAWING_ITEM_FLG + ) VALUES ( #{objectNo} , #{planNo} @@ -701,6 +733,9 @@ , #{pkgMaterialFlg} , #{openFlg} , #{itemChangeFlg} + + , #{drawingItemFlg} + ) diff --git a/src/main/resources/mappers/object/objectMapper.xml b/src/main/resources/mappers/object/objectMapper.xml index c8d80513..03578786 100644 --- a/src/main/resources/mappers/object/objectMapper.xml +++ b/src/main/resources/mappers/object/objectMapper.xml @@ -699,6 +699,7 @@ , SUPPORT_MEAKER_MULTI , DIFF_ROOF_ENABLED , ORDER_FLG + , TEMP_FLG ) VALUES ( #{objectNo} , #{planNo} @@ -735,6 +736,7 @@ , #{supportMeakerMulti} , #{diffRoofEnabled} , #{orderFlg} + , #{tempFlg} )