Merge pull request 'dev' (#350) from dev into dev-deploy

Reviewed-on: #350
This commit is contained in:
ysCha 2026-01-26 16:28:18 +09:00
commit d11578d472
3 changed files with 40 additions and 35 deletions

View File

@ -55,22 +55,22 @@ public interface UserMapper {
int setUserSave(UserRequest userReqList) throws Exception;
/**
* 판매점 등록 여부 체크
* 판매점 가격 패턴 조회
*
* @param storeReq
* @return
* @throws Exception
*/
int getStoreChk(StoreRequest storeReq) throws Exception;
String getStorePricePattern(StoreRequest storeReq) throws Exception;
/**
* 판매점의 가격 등록 여부 체크
* 판매점의 정가가격 삭제
*
* @param storeReq
* @return
* @throws Exception
*/
int getStoreUnitPriceChk(StoreRequest storeReq) throws Exception;
int deleteStoreUnitPrice(StoreRequest storeReq) throws Exception;
/**
* 판매점의 정가가격 등록

View File

@ -2,6 +2,7 @@ package com.interplug.qcast.biz.user;
import com.interplug.qcast.biz.user.dto.*;
import com.interplug.qcast.util.InterfaceQsp;
import io.micrometer.common.util.StringUtils;
import java.util.List;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ -27,18 +28,19 @@ public class UserService {
* @throws Exception
*/
public int setStoreSave(StoreRequest storeReq) throws Exception {
int storeChk = userMapper.getStoreChk(storeReq);
String prevPricePattern = userMapper.getStorePricePattern(storeReq); // 등록된 가격 랭크 조회
String pricePattern =
StringUtils.isEmpty(storeReq.getPricePattern()) ? "" : storeReq.getPricePattern();
int resultCnt = userMapper.setStoreSave(storeReq);
userMapper.setStoreInfoSave(storeReq);
userMapper.setStoreSapCdSave(storeReq);
userMapper.setStoreNorthModuleSave(storeReq);
// 신규판매점 등록 이면서 판매점 가격이 등록이 안되어 있는 경우 추가
if (storeReq.getPricePattern() != null
&& storeChk == 0
&& userMapper.getStoreUnitPriceChk(storeReq) == 0) {
// 등록된 가격이 없는경우 정가 가격 등록
// 가격 패턴이 이전에 등록된 가격 패턴과 다른경우 적용
if (storeReq.getPricePattern() != null && !prevPricePattern.equals(pricePattern)) {
// 등록된 가격이 없는경우 정가 가격 삭제후 저장
userMapper.deleteStoreUnitPrice(storeReq);
userMapper.setStoreUnitPrice(storeReq);
}
return resultCnt;
@ -80,17 +82,21 @@ public class UserService {
// 판매점 동기화
for (StoreRequest storeRequest : storeList) {
try {
int storeChk = userMapper.getStoreChk(storeRequest);
String prevPricePattern = userMapper.getStorePricePattern(storeRequest); // 등록된 가격 랭크 조회
String pricePattern =
StringUtils.isEmpty(storeRequest.getPricePattern())
? ""
: storeRequest.getPricePattern();
userMapper.setStoreSave(storeRequest);
userMapper.setStoreInfoSave(storeRequest);
userMapper.setStoreSapCdSave(storeRequest);
userMapper.setStoreNorthModuleSave(storeRequest);
// 신규판매점 등록 이면서 판매점 가격이 등록이 안되어 있는 경우 추가
if (storeRequest.getPricePattern() != null
&& storeChk == 0
&& userMapper.getStoreUnitPriceChk(storeRequest) == 0) {
// 등록된 가격이 없는경우 정가 가격 등록
// 가격 패턴이 이전에 등록된 가격 패턴과 다른경우 적용
if (storeRequest.getPricePattern() != null && !prevPricePattern.equals(pricePattern)) {
// 등록된 가격이 없는경우 정가 가격 삭제후 저장
userMapper.deleteStoreUnitPrice(storeRequest);
userMapper.setStoreUnitPrice(storeRequest);
}
} catch (Exception e) {
@ -161,17 +167,19 @@ public class UserService {
List<StoreRequest> storeList = storeSyncResponse.getStoreList();
for (StoreRequest storeRequest : storeList) {
int storeChk = userMapper.getStoreChk(storeRequest);
String prevPricePattern = userMapper.getStorePricePattern(storeRequest); // 등록된 가격 랭크 조회
String pricePattern =
StringUtils.isEmpty(storeRequest.getPricePattern()) ? "" : storeRequest.getPricePattern();
userMapper.setStoreSave(storeRequest);
userMapper.setStoreInfoSave(storeRequest);
userMapper.setStoreSapCdSave(storeRequest);
userMapper.setStoreNorthModuleSave(storeRequest);
// 신규판매점 등록 이면서 판매점 가격이 등록이 안되어 있는 경우 추가
if (storeRequest.getPricePattern() != null
&& storeChk == 0
&& userMapper.getStoreUnitPriceChk(storeRequest) == 0) {
// 등록된 가격이 없는경우 정가 가격 등록
// 가격 패턴이 이전에 등록된 가격 패턴과 다른경우 적용
if (storeRequest.getPricePattern() != null && !prevPricePattern.equals(pricePattern)) {
// 등록된 가격이 없는경우 정가 가격 삭제후 저장
userMapper.deleteStoreUnitPrice(storeRequest);
userMapper.setStoreUnitPrice(storeRequest);
}
}

View File

@ -87,7 +87,7 @@
, DISP_FAX = #{dispFax}
, DISP_MAIL = #{dispMail}
, SALE_STORE_LEVEL = #{saleStoreLevel}
, PRICE_PATTERN = (CASE WHEN ISNULL(PRICE_PATTERN, '') = '' AND #{secondAgentFlg} = '1' THEN '510' ELSE PRICE_PATTERN END)
, PRICE_PATTERN = #{pricePattern}
, DEL_FLG = #{delFlg}
, LAST_EDIT_DATETIME = GETDATE()
, LAST_EDIT_USER = #{lastEditUser}
@ -145,7 +145,7 @@
, #{secondAgentFlg}
, #{firstAgentId}
, #{parentSaleAgentId}
, (CASE WHEN #{secondAgentFlg} = '1' THEN '510' ELSE NULL END)
, #{pricePattern}
, 0 -- 출력 대비표 분류
, 0 -- 산업출력 대비표 출력
, 0 -- 정가 표시
@ -257,23 +257,20 @@
);
</insert>
<select id="getStoreChk" parameterType="com.interplug.qcast.biz.user.dto.StoreRequest" resultType="Integer">
/* sqlid : com.interplug.qcast.user.getStoreChk */
<select id="getStorePricePattern" parameterType="com.interplug.qcast.biz.user.dto.StoreRequest" resultType="String">
/* sqlid : com.interplug.qcast.user.getStorePricePattern */
SELECT
COUNT(1)
PRICE_PATTERN
FROM M_SALES_STORE
WHERE
SALE_STORE_ID = #{saleStoreId}
</select>
<select id="getStoreUnitPriceChk" parameterType="com.interplug.qcast.biz.user.dto.StoreRequest" resultType="Integer">
/* sqlid : com.interplug.qcast.user.getStoreUnitPriceChk */
SELECT
COUNT(1)
FROM M_SALE_STORE_PRICE
WHERE
SALE_STORE_ID = #{saleStoreId}
</select>
<delete id="deleteStoreUnitPrice" parameterType="com.interplug.qcast.biz.user.dto.StoreRequest" >
/* sqlid : com.interplug.qcast.user.deleteStoreUnitPrice */
DELETE FROM M_SALE_STORE_PRICE
WHERE SALE_STORE_ID = #{saleStoreId}
</delete>
<insert id="setStoreUnitPrice" parameterType="com.interplug.qcast.biz.user.dto.StoreRequest" >
/* sqlid : com.interplug.qcast.user.setStoreUnitPrice */