diff --git a/src/main/java/com/snp/batch/jobs/web/compliance/controller/ComplianceController.java b/src/main/java/com/snp/batch/jobs/web/compliance/controller/ComplianceController.java new file mode 100644 index 0000000..f1a55f2 --- /dev/null +++ b/src/main/java/com/snp/batch/jobs/web/compliance/controller/ComplianceController.java @@ -0,0 +1,39 @@ +package com.snp.batch.jobs.web.compliance.controller; + +import com.snp.batch.jobs.web.compliance.dto.ComplianceBypassDto; +import com.snp.batch.jobs.web.compliance.service.ComplianceBypassService; +import com.snp.batch.common.web.ApiResponse; +import com.snp.batch.common.web.controller.BaseBypassController; +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.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.RequestParam; + +/** + * IMO 기반 선박 Compliance 조회 bypass API + * S&P Maritime API에서 데이터를 실시간 조회하여 그대로 반환 + */ +@RestController +@RequestMapping("/api/compliance") +@RequiredArgsConstructor +@Tag(name = "Compliance", description = "IMO 기반 선박 Compliance 조회 bypass API") +public class ComplianceController extends BaseBypassController { + + private final ComplianceBypassService complianceBypassService; + + @Operation( + summary = "IMO 기반 선박 Compliance 조회 조회", + description = "S&P API에서 IMO 기반 선박 Compliance 조회 데이터를 요청하고 응답을 그대로 반환합니다." + ) + @GetMapping + public ResponseEntity>> getComplianceData(@Parameter(description = "IMO(최대 100개)") + @RequestParam(required = true) String imos) { + return execute(() -> complianceBypassService.getComplianceData(imos)); + } +} diff --git a/src/main/java/com/snp/batch/service/BypassCodeGenerator.java b/src/main/java/com/snp/batch/service/BypassCodeGenerator.java index fb7c299..56ee53c 100644 --- a/src/main/java/com/snp/batch/service/BypassCodeGenerator.java +++ b/src/main/java/com/snp/batch/service/BypassCodeGenerator.java @@ -203,6 +203,9 @@ public class BypassCodeGenerator { ? "import org.springframework.web.bind.annotation.RequestParam;\n" : ""; String requestBodyImport = isPost ? "import org.springframework.web.bind.annotation.RequestBody;\n" : ""; + String mappingImport = isPost + ? "import org.springframework.web.bind.annotation.PostMapping;\n" + : "import org.springframework.web.bind.annotation.GetMapping;\n"; String mappingPath = buildMappingPath(params); String requestMappingPath = "/api/" + domain; @@ -221,7 +224,7 @@ public class BypassCodeGenerator { import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; - {{PATH_VARIABLE_IMPORT}}{{REQUEST_PARAM_IMPORT}}{{REQUEST_BODY_IMPORT}} + {{MAPPING_IMPORT}}{{PATH_VARIABLE_IMPORT}}{{REQUEST_PARAM_IMPORT}}{{REQUEST_BODY_IMPORT}} /** * {{DISPLAY_NAME}} bypass API * S&P Maritime API에서 데이터를 실시간 조회하여 그대로 반환 @@ -251,6 +254,7 @@ public class BypassCodeGenerator { .replace("{{PATH_VARIABLE_IMPORT}}", pathVariableImport) .replace("{{REQUEST_PARAM_IMPORT}}", requestParamImport) .replace("{{REQUEST_BODY_IMPORT}}", requestBodyImport) + .replace("{{MAPPING_IMPORT}}", mappingImport) .replace("{{DISPLAY_NAME}}", config.getDisplayName()) .replace("{{DOMAIN_CAP}}", domainCap) .replace("{{REQUEST_MAPPING_PATH}}", requestMappingPath)