diff --git a/src/main/java/com/interplug/qcast/biz/estimate/EstimateController.java b/src/main/java/com/interplug/qcast/biz/estimate/EstimateController.java index 50ed0ca9..215d8343 100644 --- a/src/main/java/com/interplug/qcast/biz/estimate/EstimateController.java +++ b/src/main/java/com/interplug/qcast/biz/estimate/EstimateController.java @@ -96,4 +96,11 @@ public class EstimateController { throws Exception { estimateService.excelDownload(request, response, estimateRequest); } + + @Operation(description = "2차점 특가 있는 2nd Agency 목록을 조회한다.") + @GetMapping("/agency-cust-list") + @ResponseStatus(HttpStatus.OK) + public EstimateApiResponse selectAgencyCustList(PriceRequest priceRequest) throws Exception { + return estimateService.selectAgencyCustList(priceRequest); + } } diff --git a/src/main/java/com/interplug/qcast/biz/estimate/EstimateService.java b/src/main/java/com/interplug/qcast/biz/estimate/EstimateService.java index 99606339..e2be6132 100644 --- a/src/main/java/com/interplug/qcast/biz/estimate/EstimateService.java +++ b/src/main/java/com/interplug/qcast/biz/estimate/EstimateService.java @@ -2246,4 +2246,35 @@ public class EstimateService { return circuitCfg; } + + public EstimateApiResponse selectAgencyCustList(PriceRequest priceRequest) throws Exception { + // Validation + + if (StringUtils.isEmpty(priceRequest.getSapSalesStoreCd())) { + throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, + message.getMessage("common.message.required.data", "Sap Sale Store Code")); + } + + + EstimateApiResponse response = null; + /* [1]. QSP API (url + param) Setting */ + String url = QSP_API_URL + "/api/master/agencyCustList"; + String apiUrl = UriComponentsBuilder.fromHttpUrl(url) + .queryParam("sapSalesStoreCd", priceRequest.getSapSalesStoreCd()).build().toUriString(); + + /* [2]. QSP API CALL -> Response */ + String strResponse = interfaceQsp.callApi(HttpMethod.GET, apiUrl, null); + + if (!"".equals(strResponse)) { + com.fasterxml.jackson.databind.ObjectMapper om = + new com.fasterxml.jackson.databind.ObjectMapper() + .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + response = om.readValue(strResponse, EstimateApiResponse.class); + } else { + // [msg] No data + throw new QcastException(ErrorCode.NOT_FOUND, message.getMessage("common.message.no.data")); + } + + return response; + } }