feat: BY PASS API 등록 프로세스 설계 및 개발 (#63) #108
@ -1,81 +0,0 @@
|
||||
package com.snp.batch.jobs.web.compliance.controller;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import com.snp.batch.jobs.web.compliance.service.CompliancesByImosService;
|
||||
import com.snp.batch.jobs.web.compliance.service.UpdatedComplianceListService;
|
||||
import com.snp.batch.jobs.web.compliance.service.ComplianceValuesMeaningService;
|
||||
import com.snp.batch.jobs.web.compliance.service.PagedUpdatedComplianceListService;
|
||||
|
||||
/**
|
||||
* Compliance bypass API
|
||||
* S&P Maritime API에서 데이터를 실시간 조회하여 JSON을 그대로 반환
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/compliance")
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "Compliance", description = "[Service API] Compliance bypass API")
|
||||
public class ComplianceController extends BaseBypassController {
|
||||
|
||||
private final CompliancesByImosService compliancesByImosService;
|
||||
private final UpdatedComplianceListService updatedComplianceListService;
|
||||
private final ComplianceValuesMeaningService complianceValuesMeaningService;
|
||||
private final PagedUpdatedComplianceListService pagedUpdatedComplianceListService;
|
||||
|
||||
@Operation(
|
||||
summary = "IMO 기반 Compliance 조회 조회",
|
||||
description = "S&P API에서 IMO 기반 Compliance 조회 데이터를 요청하고 응답을 그대로 반환합니다."
|
||||
)
|
||||
@GetMapping("/CompliancesByImos")
|
||||
public ResponseEntity<ApiResponse<JsonNode>> getCompliancesByImosData(@Parameter(description = "Comma separated IMOs up to a total of 100", example = "9876543")
|
||||
@RequestParam(required = true) String imos) {
|
||||
return execute(() -> compliancesByImosService.getCompliancesByImosData(imos));
|
||||
}
|
||||
|
||||
@Operation(
|
||||
summary = "기간 내 변경 Compliance 조회 조회",
|
||||
description = "S&P API에서 기간 내 변경 Compliance 조회 데이터를 요청하고 응답을 그대로 반환합니다."
|
||||
)
|
||||
@GetMapping("/UpdatedComplianceList")
|
||||
public ResponseEntity<ApiResponse<JsonNode>> getUpdatedComplianceListData(@Parameter(description = "Time/seconds are optional", example = "9876543")
|
||||
@RequestParam(required = true) String fromDate,
|
||||
@Parameter(description = "Time/seconds are optional. If unspecified, the current UTC date and time is used", example = "9876543")
|
||||
@RequestParam(required = true) String toDate) {
|
||||
return execute(() -> updatedComplianceListService.getUpdatedComplianceListData(fromDate, toDate));
|
||||
}
|
||||
|
||||
@Operation(
|
||||
summary = "모든 Compliance 지표 조회 조회",
|
||||
description = "S&P API에서 모든 Compliance 지표 조회 데이터를 요청하고 응답을 그대로 반환합니다."
|
||||
)
|
||||
@GetMapping("/ComplianceValuesMeaning")
|
||||
public ResponseEntity<ApiResponse<JsonNode>> getComplianceValuesMeaningData() {
|
||||
return execute(() -> complianceValuesMeaningService.getComplianceValuesMeaningData());
|
||||
}
|
||||
|
||||
@Operation(
|
||||
summary = "PagedUpdatedComplianceList 조회",
|
||||
description = "S&P API에서 PagedUpdatedComplianceList 데이터를 요청하고 응답을 그대로 반환합니다."
|
||||
)
|
||||
@GetMapping("/PagedUpdatedComplianceList")
|
||||
public ResponseEntity<ApiResponse<JsonNode>> getPagedUpdatedComplianceListData(@Parameter(description = "Time/seconds are optional", example = "9876543")
|
||||
@RequestParam(required = true) String fromDate,
|
||||
@Parameter(description = "Time/seconds are optional. If unspecified, the current UTC date and time is used", example = "9876543")
|
||||
@RequestParam(required = true) String toDate,
|
||||
@Parameter(description = "Page number to display.", example = "9876543")
|
||||
@RequestParam(required = true) String pageNumber,
|
||||
@Parameter(description = "How many elements will be on the single page. Maximum allowed is 1000.", example = "9876543")
|
||||
@RequestParam(required = true) String pageSize) {
|
||||
return execute(() -> pagedUpdatedComplianceListService.getPagedUpdatedComplianceListData(fromDate, toDate, pageNumber, pageSize));
|
||||
}
|
||||
}
|
||||
@ -1,31 +0,0 @@
|
||||
package com.snp.batch.jobs.web.compliance.service;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.snp.batch.common.web.service.BaseBypassService;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.reactive.function.client.WebClient;
|
||||
|
||||
/**
|
||||
* 모든 Compliance 지표 조회 bypass 서비스
|
||||
* 외부 Maritime API에서 데이터를 실시간 조회하여 JSON을 그대로 반환
|
||||
*/
|
||||
@Service
|
||||
public class ComplianceValuesMeaningService extends BaseBypassService<JsonNode> {
|
||||
|
||||
public ComplianceValuesMeaningService(
|
||||
@Qualifier("maritimeServiceApiWebClient") WebClient webClient) {
|
||||
super(webClient, "/RiskAndCompliance/ComplianceValuesMeaning", "모든 Compliance 지표 조회",
|
||||
new ParameterizedTypeReference<>() {},
|
||||
new ParameterizedTypeReference<>() {});
|
||||
}
|
||||
|
||||
/**
|
||||
* 모든 Compliance 지표 조회 데이터를 조회합니다.
|
||||
*/
|
||||
public JsonNode getComplianceValuesMeaningData() {
|
||||
return fetchRawGet(uri -> uri.path(getApiPath())
|
||||
.build());
|
||||
}
|
||||
}
|
||||
@ -1,32 +0,0 @@
|
||||
package com.snp.batch.jobs.web.compliance.service;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.snp.batch.common.web.service.BaseBypassService;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.reactive.function.client.WebClient;
|
||||
|
||||
/**
|
||||
* IMO 기반 Compliance 조회 bypass 서비스
|
||||
* 외부 Maritime API에서 데이터를 실시간 조회하여 JSON을 그대로 반환
|
||||
*/
|
||||
@Service
|
||||
public class CompliancesByImosService extends BaseBypassService<JsonNode> {
|
||||
|
||||
public CompliancesByImosService(
|
||||
@Qualifier("maritimeServiceApiWebClient") WebClient webClient) {
|
||||
super(webClient, "/RiskAndCompliance/CompliancesByImos", "IMO 기반 Compliance 조회",
|
||||
new ParameterizedTypeReference<>() {},
|
||||
new ParameterizedTypeReference<>() {});
|
||||
}
|
||||
|
||||
/**
|
||||
* IMO 기반 Compliance 조회 데이터를 조회합니다.
|
||||
*/
|
||||
public JsonNode getCompliancesByImosData(String imos) {
|
||||
return fetchRawGet(uri -> uri.path(getApiPath())
|
||||
.queryParam("imos", imos)
|
||||
.build());
|
||||
}
|
||||
}
|
||||
@ -1,35 +0,0 @@
|
||||
package com.snp.batch.jobs.web.compliance.service;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.snp.batch.common.web.service.BaseBypassService;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.reactive.function.client.WebClient;
|
||||
|
||||
/**
|
||||
* PagedUpdatedComplianceList bypass 서비스
|
||||
* 외부 Maritime API에서 데이터를 실시간 조회하여 JSON을 그대로 반환
|
||||
*/
|
||||
@Service
|
||||
public class PagedUpdatedComplianceListService extends BaseBypassService<JsonNode> {
|
||||
|
||||
public PagedUpdatedComplianceListService(
|
||||
@Qualifier("maritimeServiceApiWebClient") WebClient webClient) {
|
||||
super(webClient, "/RiskAndCompliance/PagedUpdatedComplianceList", "PagedUpdatedComplianceList",
|
||||
new ParameterizedTypeReference<>() {},
|
||||
new ParameterizedTypeReference<>() {});
|
||||
}
|
||||
|
||||
/**
|
||||
* PagedUpdatedComplianceList 데이터를 조회합니다.
|
||||
*/
|
||||
public JsonNode getPagedUpdatedComplianceListData(String fromDate, String toDate, String pageNumber, String pageSize) {
|
||||
return fetchRawGet(uri -> uri.path(getApiPath())
|
||||
.queryParam("fromDate", fromDate)
|
||||
.queryParam("toDate", toDate)
|
||||
.queryParam("pageNumber", pageNumber)
|
||||
.queryParam("pageSize", pageSize)
|
||||
.build());
|
||||
}
|
||||
}
|
||||
@ -1,33 +0,0 @@
|
||||
package com.snp.batch.jobs.web.compliance.service;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.snp.batch.common.web.service.BaseBypassService;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.reactive.function.client.WebClient;
|
||||
|
||||
/**
|
||||
* 기간 내 변경 Compliance 조회 bypass 서비스
|
||||
* 외부 Maritime API에서 데이터를 실시간 조회하여 JSON을 그대로 반환
|
||||
*/
|
||||
@Service
|
||||
public class UpdatedComplianceListService extends BaseBypassService<JsonNode> {
|
||||
|
||||
public UpdatedComplianceListService(
|
||||
@Qualifier("maritimeServiceApiWebClient") WebClient webClient) {
|
||||
super(webClient, "/RiskAndCompliance/UpdatedComplianceList", "기간 내 변경 Compliance 조회",
|
||||
new ParameterizedTypeReference<>() {},
|
||||
new ParameterizedTypeReference<>() {});
|
||||
}
|
||||
|
||||
/**
|
||||
* 기간 내 변경 Compliance 조회 데이터를 조회합니다.
|
||||
*/
|
||||
public JsonNode getUpdatedComplianceListData(String fromDate, String toDate) {
|
||||
return fetchRawGet(uri -> uri.path(getApiPath())
|
||||
.queryParam("fromDate", fromDate)
|
||||
.queryParam("toDate", toDate)
|
||||
.build());
|
||||
}
|
||||
}
|
||||
@ -200,7 +200,7 @@ public class BypassCodeGenerator {
|
||||
|
||||
methods.append("\n");
|
||||
methods.append(" @Operation(\n");
|
||||
methods.append(" summary = \"").append(config.getDisplayName()).append(" 조회\",\n");
|
||||
methods.append(" summary = \"").append(config.getDisplayName()).append("\",\n");
|
||||
String opDescription = (config.getDescription() != null && !config.getDescription().isEmpty())
|
||||
? config.getDescription()
|
||||
: config.getDisplayName() + " 데이터를 요청하고 응답을 그대로 반환합니다.";
|
||||
|
||||
불러오는 중...
Reference in New Issue
Block a user