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.config.Exception.ErrorCode; import com.interplug.qcast.config.Exception.QcastException; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; 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; @RestController @RequestMapping("/api/v1/master") @RequiredArgsConstructor @Tag(name = "MasterController", description = "Master API") public class MasterController { private final MasterService masterService; @Operation(description = "지붕재 목록을 조회한다.") @GetMapping("/getRoofMaterialList") public ApiResponse getRoofMaterialList() { return masterService.getRoofMaterialList(); } @Operation(description = "모듈 타입별 아이템 목록을 조회한다.") @GetMapping("/getModuleTypeItemList") public ApiResponse getModuleTypeItemList( @RequestParam("roofMatlCd") String roofMaterialCd) throws QcastException { if (roofMaterialCd == null || roofMaterialCd.trim().isEmpty()) { throw new QcastException(ErrorCode.INVALID_INPUT_VALUE); } return masterService.getModuleTypeItemList(roofMaterialCd); } @Operation(description = "가대 목록 조회") @GetMapping("/getTrestleList") 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) { return masterService.getTrestleList(moduleTpCd,roofMatlCd,raftBaseCd,trestleMkrCd,constMthdCd,roofBaseCd); } @Operation(description = "시공법 목록 조회") @GetMapping("/getConstructionList") 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) 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); } return masterService.getConstructionList(moduleTpCd, roofMatlCd, trestleMkrCd, constMthdCd, roofBaseCd, illuminationTp, instHt, stdWindSpeed, stdSnowLd, inclCd, raftBaseCd, roofPitch); } @Operation(description = "가대 상세 조회") @GetMapping("/getTrestleDetailList") 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) 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); } return masterService.getTrestleDetailList(moduleTpCd, roofMatlCd, trestleMkrCd, constMthdCd, roofBaseCd, illuminationTp, instHt, stdWindSpeed, stdSnowLd, inclCd, constTp, mixMatlNo, roofPitch); } }