From e89a27151131475ba90d230ad31e678c53569120 Mon Sep 17 00:00:00 2001 From: "LAPTOP-L3VE7KK2\\USER" Date: Fri, 8 Nov 2024 10:25:30 +0900 Subject: [PATCH] =?UTF-8?q?=ED=8C=90=EB=A7=A4=EC=A0=90=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20API=20QSP=20=EC=97=B0=EB=8F=99=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../qcast/biz/estimate/EstimateService.java | 18 +++- .../qcast/biz/object/ObjectMapper.java | 5 +- .../qcast/biz/object/ObjectService.java | 84 +---------------- .../resources/mappers/object/objectMapper.xml | 89 ++++++++++++------- 4 files changed, 80 insertions(+), 116 deletions(-) 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 6f91130d..2d1c14b0 100644 --- a/src/main/java/com/interplug/qcast/biz/estimate/EstimateService.java +++ b/src/main/java/com/interplug/qcast/biz/estimate/EstimateService.java @@ -53,6 +53,13 @@ public class EstimateService { private final FileMapper fileMapper; + /** + * 1차점 price 관리 목록 조회 + * + * @param priceRequest 1차점 price 관련 정보 + * @return PriceResponse 1차점 price 목록 + * @throws Exception + */ public PriceResponse selectStorePriceList(PriceRequest priceRequest) throws Exception { // Validation if (StringUtils.isEmpty(priceRequest.getSaleStoreId())) { @@ -98,6 +105,11 @@ public class EstimateService { return response; } + /** + * @param priceRequest + * @return PriceResponse + * @throws Exception + */ public PriceResponse selectItemPriceList(PriceRequest priceRequest) throws Exception { // Validation if (StringUtils.isEmpty(priceRequest.getSaleStoreId())) { @@ -629,8 +641,10 @@ public class EstimateService { estimateResponse.setPkgYn("YJSS".equals(estimateResponse.getEstimateType()) ? "Y" : "N"); estimateResponse.setPkgNo( "YJSS".equals(estimateResponse.getEstimateType()) ? String.valueOf(j++) : ""); - estimateResponse.setPkgAsp( - String.format("%1$,.0f", Double.parseDouble(estimateResponse.getPkgAsp()))); + if ("YJSS".equals(estimateResponse.getEstimateType())) { + estimateResponse.setPkgAsp( + String.format("%1$,.0f", Double.parseDouble(estimateResponse.getPkgAsp()))); + } estimateResponse.setTotVol( String.format("%1$,.0f", Double.parseDouble(estimateResponse.getTotVol()))); estimateResponse.setPkgTotPrice( diff --git a/src/main/java/com/interplug/qcast/biz/object/ObjectMapper.java b/src/main/java/com/interplug/qcast/biz/object/ObjectMapper.java index a0e5da8e..00b9bb7c 100644 --- a/src/main/java/com/interplug/qcast/biz/object/ObjectMapper.java +++ b/src/main/java/com/interplug/qcast/biz/object/ObjectMapper.java @@ -16,10 +16,11 @@ public interface ObjectMapper { public List selectWindSpeedList(String city); // 모든 판매점 목록 조회 - public List selectSaleStoreFirstList(); + public List selectSaleStoreFirstList(String userId); // 판매점 목록 조회 - public List selectSaleStoreList(String saleStoreId, String firstFlg); + public List selectSaleStoreList( + String saleStoreId, String firstFlg, String userId); // 판매점 정보 조회 public SaleStoreResponse selectSaleStoreInfo(String saleStoreId); diff --git a/src/main/java/com/interplug/qcast/biz/object/ObjectService.java b/src/main/java/com/interplug/qcast/biz/object/ObjectService.java index 72bae669..bc28e492 100644 --- a/src/main/java/com/interplug/qcast/biz/object/ObjectService.java +++ b/src/main/java/com/interplug/qcast/biz/object/ObjectService.java @@ -13,8 +13,6 @@ import com.interplug.qcast.biz.object.dto.UploadRequest; import com.interplug.qcast.biz.object.dto.UploadResponse; import com.interplug.qcast.biz.object.dto.WindSpeedResponse; import com.interplug.qcast.biz.storeFavorite.StoreFavoriteService; -import com.interplug.qcast.biz.storeFavorite.dto.StoreFavoriteRequest; -import com.interplug.qcast.biz.storeFavorite.dto.StoreFavoriteResponse; import com.interplug.qcast.config.Exception.ErrorCode; import com.interplug.qcast.config.Exception.QcastException; import com.interplug.qcast.config.message.Messages; @@ -32,7 +30,6 @@ import java.nio.charset.StandardCharsets; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; -import java.util.Comparator; import java.util.List; import java.util.Map; import lombok.RequiredArgsConstructor; @@ -89,46 +86,11 @@ public class ObjectService { message.getMessage("common.message.required.data", "User ID")); } - // [0]. 판매점 목록 조회 + // 1차점 판매점 목록 조회 List storeList = new ArrayList(); if ("T01".equals(saleStoreId)) { - storeList = objectMapper.selectSaleStoreFirstList(); - - // [1]. 판매점 목록 조회 결과 - if (storeList.size() > 0) { - StoreFavoriteRequest storeFavoriteReq = new StoreFavoriteRequest(); - storeFavoriteReq.setUserId(userId); - - // [2]. 사용자 판매점 즐겨찾기 목록 조회 (QSP -> QCAST) - StoreFavoriteResponse storeFavoriteRes = new StoreFavoriteResponse(); - storeFavoriteRes = storeFavoriteService.getStoreFavoriteList(storeFavoriteReq); - - List> data = (List>) storeFavoriteRes.getData(); - Map result = (Map) storeFavoriteRes.getResult(); - - // [3]. 판매점 목록 중, 즐겨찾기 판매점에 해당하는 경우 정렬 기준 셋팅 - if ("S".equals(result.get("resultCode"))) { - if (data.size() > 0) { - for (SaleStoreResponse saleStore : storeList) { - String storeId = saleStore.getSaleStoreId(); - saleStore.setPriority("B"); - for (Map storeFavorite : data) { - String favStoreId = (String) storeFavorite.get("storeId"); - if (storeId.equals(favStoreId)) { - saleStore.setPriority("A" + (String) storeFavorite.get("priority")); - break; - } - } - } - // [4]. 정렬 기준 sort (오름차순) - storeList.sort(Comparator.comparing(SaleStoreResponse::getPriority)); - } - } else { - throw new QcastException( - ErrorCode.INTERNAL_SERVER_ERROR, (String) result.get("resultMsg")); - } - } + storeList = objectMapper.selectSaleStoreFirstList(userId); } return storeList; @@ -148,47 +110,9 @@ public class ObjectService { message.getMessage("common.message.required.data", "User ID")); } - // [0]. 판매점 목록 조회 + // 판매점 목록 조회 List storeList = new ArrayList(); - storeList = objectMapper.selectSaleStoreList(saleStoreId, firstFlg); - - // [1]. 판매점 목록 조회 결과 - if (storeList.size() > 0) { - StoreFavoriteRequest storeFavoriteReq = new StoreFavoriteRequest(); - storeFavoriteReq.setUserId(userId); - - // [2]. 사용자 판매점 즐겨찾기 목록 조회 (QSP -> QCAST) - StoreFavoriteResponse storeFavoriteRes = new StoreFavoriteResponse(); - storeFavoriteRes = storeFavoriteService.getStoreFavoriteList(storeFavoriteReq); - - List> data = (List>) storeFavoriteRes.getData(); - Map result = (Map) storeFavoriteRes.getResult(); - - // [3]. 판매점 목록 중, 즐겨찾기 판매점에 해당하는 경우 정렬 기준 셋팅 - if ("S".equals(result.get("resultCode"))) { - if (data.size() > 0) { - for (SaleStoreResponse saleStore : storeList) { - String storeId = saleStore.getSaleStoreId(); - if ("1".equals(saleStore.getSaleStoreLevel())) { - saleStore.setPriority("A0"); - } else { - saleStore.setPriority("B"); - } - for (Map storeFavorite : data) { - String favStoreId = (String) storeFavorite.get("storeId"); - if (storeId.equals(favStoreId)) { - saleStore.setPriority("A" + (String) storeFavorite.get("priority")); - break; - } - } - } - // [4]. 정렬 기준 sort (오름차순) - storeList.sort(Comparator.comparing(SaleStoreResponse::getPriority)); - } - } else { - throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR, (String) result.get("resultMsg")); - } - } + storeList = objectMapper.selectSaleStoreList(saleStoreId, firstFlg, userId); return storeList; } diff --git a/src/main/resources/mappers/object/objectMapper.xml b/src/main/resources/mappers/object/objectMapper.xml index 57105134..f2edf5e0 100644 --- a/src/main/resources/mappers/object/objectMapper.xml +++ b/src/main/resources/mappers/object/objectMapper.xml @@ -36,16 +36,25 @@