qcast-api/src/main/java/com/interplug/qcast/biz/master/MasterController.java
Daseul Kim 8c71c2403f docs: swagger description 추가
- 지붕재 목록 조회 api, 모듈 타입별 아이템 목록 조회 api
2024-12-23 18:00:29 +09:00

126 lines
5.9 KiB
Java

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.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;
@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<ApiRoofMaterialResponse> getRoofMaterialList() {
return masterService.getRoofMaterialList();
}
@Operation(description = "모듈 타입별 아이템 목록을 조회한다.")
@GetMapping("/getModuleTypeItemList")
public ApiResponse<ApiModuleTpResponse> getModuleTypeItemList(
@Parameter(description = "지붕재 코드 목록") @RequestParam("arrRoofMatlCd")
List<String> 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<ApiTrestleResponse> 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<ApiConstructionResponse> 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<ApiTrestleDetailResponse> 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);
}
}