From 9ed630736279c660ab42d6dee597cfb3cf02e659 Mon Sep 17 00:00:00 2001 From: Daseul Kim Date: Mon, 13 Jan 2025 20:01:32 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=EA=B0=80=EB=8C=80=20=EC=83=81?= =?UTF-8?q?=EC=84=B8=20=EC=A1=B0=ED=9A=8C=20api=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - method post로 수정 - request 데이터를 body json, list 형식으로 받아서 list size만큼 api 호출 후 response를 모아서 리턴 --- .../qcast/biz/master/MasterController.java | 96 +++++-------------- .../detail/ApiTrestleDetailRequest.java | 15 ++- 2 files changed, 36 insertions(+), 75 deletions(-) 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 1cadacf8..bcdc17a2 100644 --- a/src/main/java/com/interplug/qcast/biz/master/MasterController.java +++ b/src/main/java/com/interplug/qcast/biz/master/MasterController.java @@ -12,12 +12,14 @@ import com.interplug.qcast.biz.master.dto.quotation.ApiQuotationItemRequest; import com.interplug.qcast.biz.master.dto.quotation.ApiQuotationItemResponse; import com.interplug.qcast.biz.master.dto.roofmaterial.ApiRoofMaterialResponse; import com.interplug.qcast.biz.master.dto.trestle.ApiTrestleResponse; +import com.interplug.qcast.biz.master.dto.trestle.detail.ApiTrestleDetailRequest; import com.interplug.qcast.biz.master.dto.trestle.detail.ApiTrestleDetailResponse; 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.ArrayList; import java.util.List; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.GetMapping; @@ -173,79 +175,29 @@ public class MasterController { } @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); + @PostMapping("/getTrestleDetailList") + public ArrayList> getTrestleDetailList( + @RequestBody List reqList) { + ArrayList> results = new ArrayList<>(); + for (ApiTrestleDetailRequest req : reqList) { + ApiResponse result = + masterService.getTrestleDetailList( + req.getModuleTpCd(), + req.getRoofMatlCd(), + req.getTrestleMkrCd(), + req.getConstMthdCd(), + req.getRoofBaseCd(), + req.getIlluminationTp(), + req.getInstHt(), + req.getStdWindSpeed(), + req.getStdSnowLd(), + req.getInclCd(), + req.getConstTp(), + req.getMixMatlNo(), + req.getRoofPitch()); + results.add(result); } - - 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()); + return results; } @Operation(description = "PCS 메이커, 시리즈 조회한다.") diff --git a/src/main/java/com/interplug/qcast/biz/master/dto/trestle/detail/ApiTrestleDetailRequest.java b/src/main/java/com/interplug/qcast/biz/master/dto/trestle/detail/ApiTrestleDetailRequest.java index bf43b0e3..f0776ce2 100644 --- a/src/main/java/com/interplug/qcast/biz/master/dto/trestle/detail/ApiTrestleDetailRequest.java +++ b/src/main/java/com/interplug/qcast/biz/master/dto/trestle/detail/ApiTrestleDetailRequest.java @@ -1,6 +1,7 @@ package com.interplug.qcast.biz.master.dto.trestle.detail; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; import lombok.Getter; import lombok.Setter; @@ -9,40 +10,48 @@ import lombok.Setter; @Schema(description = "Api 가대 상세 조회 요청 객체") public class ApiTrestleDetailRequest { - @Schema(description = "Language코드") - private String langCd; - @Schema(description = "모듈타입코드") + @NotNull private String moduleTpCd; @Schema(description = "지붕재코드") + @NotNull private String roofMatlCd; @Schema(description = "가대메이커코드") + @NotNull private String trestleMkrCd; @Schema(description = "공법코드") + @NotNull private String constMthdCd; @Schema(description = "지붕기초코드") + @NotNull private String roofBaseCd; @Schema(description = "면조도") + @NotNull private String illuminationTp; @Schema(description = "설치높이") + @NotNull private String instHt; @Schema(description = "풍속") + @NotNull private String stdWindSpeed; @Schema(description = "적설량") + @NotNull private String stdSnowLd; @Schema(description = "경사도코드") + @NotNull private String inclCd; @Schema(description = "시공법") + @NotNull private String constTp; @Schema(description = "혼합모듈번호")