판매점 조회 API QSP 연동 제거

This commit is contained in:
LAPTOP-L3VE7KK2\USER 2024-11-08 10:25:30 +09:00
parent 577333b756
commit e89a271511
4 changed files with 80 additions and 116 deletions

View File

@ -53,6 +53,13 @@ public class EstimateService {
private final FileMapper fileMapper; private final FileMapper fileMapper;
/**
* 1차점 price 관리 목록 조회
*
* @param priceRequest 1차점 price 관련 정보
* @return PriceResponse 1차점 price 목록
* @throws Exception
*/
public PriceResponse selectStorePriceList(PriceRequest priceRequest) throws Exception { public PriceResponse selectStorePriceList(PriceRequest priceRequest) throws Exception {
// Validation // Validation
if (StringUtils.isEmpty(priceRequest.getSaleStoreId())) { if (StringUtils.isEmpty(priceRequest.getSaleStoreId())) {
@ -98,6 +105,11 @@ public class EstimateService {
return response; return response;
} }
/**
* @param priceRequest
* @return PriceResponse
* @throws Exception
*/
public PriceResponse selectItemPriceList(PriceRequest priceRequest) throws Exception { public PriceResponse selectItemPriceList(PriceRequest priceRequest) throws Exception {
// Validation // Validation
if (StringUtils.isEmpty(priceRequest.getSaleStoreId())) { if (StringUtils.isEmpty(priceRequest.getSaleStoreId())) {
@ -629,8 +641,10 @@ public class EstimateService {
estimateResponse.setPkgYn("YJSS".equals(estimateResponse.getEstimateType()) ? "Y" : "N"); estimateResponse.setPkgYn("YJSS".equals(estimateResponse.getEstimateType()) ? "Y" : "N");
estimateResponse.setPkgNo( estimateResponse.setPkgNo(
"YJSS".equals(estimateResponse.getEstimateType()) ? String.valueOf(j++) : ""); "YJSS".equals(estimateResponse.getEstimateType()) ? String.valueOf(j++) : "");
if ("YJSS".equals(estimateResponse.getEstimateType())) {
estimateResponse.setPkgAsp( estimateResponse.setPkgAsp(
String.format("%1$,.0f", Double.parseDouble(estimateResponse.getPkgAsp()))); String.format("%1$,.0f", Double.parseDouble(estimateResponse.getPkgAsp())));
}
estimateResponse.setTotVol( estimateResponse.setTotVol(
String.format("%1$,.0f", Double.parseDouble(estimateResponse.getTotVol()))); String.format("%1$,.0f", Double.parseDouble(estimateResponse.getTotVol())));
estimateResponse.setPkgTotPrice( estimateResponse.setPkgTotPrice(

View File

@ -16,10 +16,11 @@ public interface ObjectMapper {
public List<WindSpeedResponse> selectWindSpeedList(String city); public List<WindSpeedResponse> selectWindSpeedList(String city);
// 모든 판매점 목록 조회 // 모든 판매점 목록 조회
public List<SaleStoreResponse> selectSaleStoreFirstList(); public List<SaleStoreResponse> selectSaleStoreFirstList(String userId);
// 판매점 목록 조회 // 판매점 목록 조회
public List<SaleStoreResponse> selectSaleStoreList(String saleStoreId, String firstFlg); public List<SaleStoreResponse> selectSaleStoreList(
String saleStoreId, String firstFlg, String userId);
// 판매점 정보 조회 // 판매점 정보 조회
public SaleStoreResponse selectSaleStoreInfo(String saleStoreId); public SaleStoreResponse selectSaleStoreInfo(String saleStoreId);

View File

@ -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.UploadResponse;
import com.interplug.qcast.biz.object.dto.WindSpeedResponse; import com.interplug.qcast.biz.object.dto.WindSpeedResponse;
import com.interplug.qcast.biz.storeFavorite.StoreFavoriteService; 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.ErrorCode;
import com.interplug.qcast.config.Exception.QcastException; import com.interplug.qcast.config.Exception.QcastException;
import com.interplug.qcast.config.message.Messages; import com.interplug.qcast.config.message.Messages;
@ -32,7 +30,6 @@ import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -89,46 +86,11 @@ public class ObjectService {
message.getMessage("common.message.required.data", "User ID")); message.getMessage("common.message.required.data", "User ID"));
} }
// [0]. 판매점 목록 조회 // 1차점 판매점 목록 조회
List<SaleStoreResponse> storeList = new ArrayList<SaleStoreResponse>(); List<SaleStoreResponse> storeList = new ArrayList<SaleStoreResponse>();
if ("T01".equals(saleStoreId)) { if ("T01".equals(saleStoreId)) {
storeList = objectMapper.selectSaleStoreFirstList(); storeList = objectMapper.selectSaleStoreFirstList(userId);
// [1]. 판매점 목록 조회 결과
if (storeList.size() > 0) {
StoreFavoriteRequest storeFavoriteReq = new StoreFavoriteRequest();
storeFavoriteReq.setUserId(userId);
// [2]. 사용자 판매점 즐겨찾기 목록 조회 (QSP -> QCAST)
StoreFavoriteResponse storeFavoriteRes = new StoreFavoriteResponse();
storeFavoriteRes = storeFavoriteService.getStoreFavoriteList(storeFavoriteReq);
List<Map<String, Object>> data = (List<Map<String, Object>>) storeFavoriteRes.getData();
Map<String, Object> result = (Map<String, Object>) 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<String, Object> 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"));
}
}
} }
return storeList; return storeList;
@ -148,47 +110,9 @@ public class ObjectService {
message.getMessage("common.message.required.data", "User ID")); message.getMessage("common.message.required.data", "User ID"));
} }
// [0]. 판매점 목록 조회 // 판매점 목록 조회
List<SaleStoreResponse> storeList = new ArrayList<SaleStoreResponse>(); List<SaleStoreResponse> storeList = new ArrayList<SaleStoreResponse>();
storeList = objectMapper.selectSaleStoreList(saleStoreId, firstFlg); storeList = objectMapper.selectSaleStoreList(saleStoreId, firstFlg, userId);
// [1]. 판매점 목록 조회 결과
if (storeList.size() > 0) {
StoreFavoriteRequest storeFavoriteReq = new StoreFavoriteRequest();
storeFavoriteReq.setUserId(userId);
// [2]. 사용자 판매점 즐겨찾기 목록 조회 (QSP -> QCAST)
StoreFavoriteResponse storeFavoriteRes = new StoreFavoriteResponse();
storeFavoriteRes = storeFavoriteService.getStoreFavoriteList(storeFavoriteReq);
List<Map<String, Object>> data = (List<Map<String, Object>>) storeFavoriteRes.getData();
Map<String, Object> result = (Map<String, Object>) 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<String, Object> 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"));
}
}
return storeList; return storeList;
} }

View File

@ -36,16 +36,25 @@
<select id="selectSaleStoreFirstList" resultType="com.interplug.qcast.biz.object.dto.SaleStoreResponse"> <select id="selectSaleStoreFirstList" resultType="com.interplug.qcast.biz.object.dto.SaleStoreResponse">
/* sqlid : com.interplug.qcast.biz.object.selectSaleStoreFirstList */ /* sqlid : com.interplug.qcast.biz.object.selectSaleStoreFirstList */
SELECT SELECT
CASE WHEN SALE_STORE_LEVEL = '1' THEN 'Y' ELSE 'N' END AS FIRST_AGENT_YN T.*
, SALE_STORE_ID FROM (
, SALE_STORE_NAME SELECT
, SALE_STORE_LEVEL CASE WHEN SS.SALE_STORE_LEVEL = '1' THEN 'Y' ELSE 'N' END AS FIRST_AGENT_YN
, FIRST_AGENT_ID , SS.SALE_STORE_ID
FROM M_SALES_STORE WITH(NOLOCK) , SS.SALE_STORE_NAME
WHERE APPROVE_FLG = '2' , SS.SALE_STORE_LEVEL
AND DEL_FLG = '0' , SS.FIRST_AGENT_ID
AND SALE_STORE_LEVEL = '1' , CASE WHEN UFA.DISP_ORDER IS NULL THEN 'B' ELSE 'A' + CAST(UFA.DISP_ORDER AS NVARCHAR) END AS PRIORITY
ORDER BY SALE_STORE_LEVEL ASC, SALE_STORE_ID ASC FROM M_SALES_STORE SS WITH(NOLOCK)
LEFT OUTER JOIN M_USER_FAV_SALES_STORE UFA WITH (NOLOCK)
ON SS.SALE_STORE_ID = UFA.SALE_STORE_ID
AND UFA.USER_ID = #{userId}
AND UFA.DEL_FLG = '0'
WHERE SS.APPROVE_FLG = '2'
AND SS.DEL_FLG = '0'
AND SS.SALE_STORE_LEVEL = '1'
) T
ORDER BY T.PRIORITY ASC, T.SALE_STORE_LEVEL ASC, T.SALE_STORE_ID ASC
</select> </select>
<select id="selectSaleStoreList" parameterType="String" resultType="com.interplug.qcast.biz.object.dto.SaleStoreResponse"> <select id="selectSaleStoreList" parameterType="String" resultType="com.interplug.qcast.biz.object.dto.SaleStoreResponse">
@ -75,6 +84,15 @@
AND A.DEL_FLG = '0' AND A.DEL_FLG = '0'
) )
SELECT
TT.*
FROM (
SELECT
T.*
, CASE WHEN T.FIRST_AGENT_YN = 'Y' THEN 'A0'
WHEN UFA.DISP_ORDER IS NULL THEN 'B'
ELSE 'A' + CAST(UFA.DISP_ORDER AS NVARCHAR) END AS PRIORITY
FROM (
<if test='firstFlg != null and firstFlg == "1"'> <if test='firstFlg != null and firstFlg == "1"'>
SELECT SELECT
'Y' AS FIRST_AGENT_YN 'Y' AS FIRST_AGENT_YN
@ -98,6 +116,13 @@
<if test='firstFlg == null or firstFlg != "1"'> <if test='firstFlg == null or firstFlg != "1"'>
WHERE A.SALE_STORE_LEVEL <![CDATA[ <> ]]> '1' WHERE A.SALE_STORE_LEVEL <![CDATA[ <> ]]> '1'
</if> </if>
) T
LEFT OUTER JOIN M_USER_FAV_SALES_STORE UFA WITH (NOLOCK)
ON T.SALE_STORE_ID = UFA.SALE_STORE_ID
AND UFA.USER_ID = #{userId}
AND UFA.DEL_FLG = '0'
) TT
ORDER BY TT.PRIORITY ASC, TT.SALE_STORE_LEVEL ASC, TT.SALE_STORE_ID ASC
</select> </select>
<select id="selectSaleStoreInfo" parameterType="String" resultType="com.interplug.qcast.biz.object.dto.SaleStoreResponse"> <select id="selectSaleStoreInfo" parameterType="String" resultType="com.interplug.qcast.biz.object.dto.SaleStoreResponse">