판매점 조회 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;
/**
* 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(

View File

@ -16,10 +16,11 @@ public interface ObjectMapper {
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);

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.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<SaleStoreResponse> storeList = new ArrayList<SaleStoreResponse>();
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<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"));
}
}
storeList = objectMapper.selectSaleStoreFirstList(userId);
}
return storeList;
@ -148,47 +110,9 @@ public class ObjectService {
message.getMessage("common.message.required.data", "User ID"));
}
// [0]. 판매점 목록 조회
// 판매점 목록 조회
List<SaleStoreResponse> storeList = new ArrayList<SaleStoreResponse>();
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<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"));
}
}
storeList = objectMapper.selectSaleStoreList(saleStoreId, firstFlg, userId);
return storeList;
}

View File

@ -36,16 +36,25 @@
<select id="selectSaleStoreFirstList" resultType="com.interplug.qcast.biz.object.dto.SaleStoreResponse">
/* sqlid : com.interplug.qcast.biz.object.selectSaleStoreFirstList */
SELECT
CASE WHEN SALE_STORE_LEVEL = '1' THEN 'Y' ELSE 'N' END AS FIRST_AGENT_YN
, SALE_STORE_ID
, SALE_STORE_NAME
, SALE_STORE_LEVEL
, FIRST_AGENT_ID
FROM M_SALES_STORE WITH(NOLOCK)
WHERE APPROVE_FLG = '2'
AND DEL_FLG = '0'
AND SALE_STORE_LEVEL = '1'
ORDER BY SALE_STORE_LEVEL ASC, SALE_STORE_ID ASC
T.*
FROM (
SELECT
CASE WHEN SS.SALE_STORE_LEVEL = '1' THEN 'Y' ELSE 'N' END AS FIRST_AGENT_YN
, SS.SALE_STORE_ID
, SS.SALE_STORE_NAME
, SS.SALE_STORE_LEVEL
, SS.FIRST_AGENT_ID
, CASE WHEN UFA.DISP_ORDER IS NULL THEN 'B' ELSE 'A' + CAST(UFA.DISP_ORDER AS NVARCHAR) END AS PRIORITY
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 id="selectSaleStoreList" parameterType="String" resultType="com.interplug.qcast.biz.object.dto.SaleStoreResponse">
@ -75,29 +84,45 @@
AND A.DEL_FLG = '0'
)
<if test='firstFlg != null and firstFlg == "1"'>
SELECT
'Y' AS FIRST_AGENT_YN
, A.SALE_STORE_ID
, A.SALE_STORE_NAME
, A.SALE_STORE_LEVEL
, A.FIRST_AGENT_ID
FROM M_SALES_STORE A WITH(NOLOCK)
WHERE SALE_STORE_ID = (SELECT FIRST_AGENT_ID FROM M_SALES_STORE WHERE SALE_STORE_ID = #{saleStoreId} AND DEL_FLG = '0')
AND APPROVE_FLG = '2'
AND DEL_FLG = '0'
UNION ALL
</if>
SELECT
CASE WHEN SALE_STORE_LEVEL = '1' THEN 'Y' ELSE 'N' END AS FIRST_AGENT_YN
, A.SALE_STORE_ID
, A.SALE_STORE_NAME
, A.SALE_STORE_LEVEL
, A.FIRST_AGENT_ID
FROM SALES_STORE_CTE A
<if test='firstFlg == null or firstFlg != "1"'>
WHERE A.SALE_STORE_LEVEL <![CDATA[ <> ]]> '1'
</if>
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"'>
SELECT
'Y' AS FIRST_AGENT_YN
, A.SALE_STORE_ID
, A.SALE_STORE_NAME
, A.SALE_STORE_LEVEL
, A.FIRST_AGENT_ID
FROM M_SALES_STORE A WITH(NOLOCK)
WHERE SALE_STORE_ID = (SELECT FIRST_AGENT_ID FROM M_SALES_STORE WHERE SALE_STORE_ID = #{saleStoreId} AND DEL_FLG = '0')
AND APPROVE_FLG = '2'
AND DEL_FLG = '0'
UNION ALL
</if>
SELECT
CASE WHEN SALE_STORE_LEVEL = '1' THEN 'Y' ELSE 'N' END AS FIRST_AGENT_YN
, A.SALE_STORE_ID
, A.SALE_STORE_NAME
, A.SALE_STORE_LEVEL
, A.FIRST_AGENT_ID
FROM SALES_STORE_CTE A
<if test='firstFlg == null or firstFlg != "1"'>
WHERE A.SALE_STORE_LEVEL <![CDATA[ <> ]]> '1'
</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 id="selectSaleStoreInfo" parameterType="String" resultType="com.interplug.qcast.biz.object.dto.SaleStoreResponse">