Преглед изворни кода

다다익선 추가 수정중

bin2107 пре 5 година
родитељ
комит
469dc3b9bf

+ 2 - 2
src/main/java/com/style24/admin/biz/dao/TsaMorebetterDao.java

@@ -216,11 +216,11 @@ public interface TsaMorebetterDao {
 
 
     /**
     /**
      * 다다익선 중복 상품 조회
      * 다다익선 중복 상품 조회
-     * @param moreBetter
+     * @param moreBetterGoods
      * @return
      * @return
      * @author bin2107
      * @author bin2107
      * @since 2021. 1. 12
      * @since 2021. 1. 12
      */
      */
-    Collection<MoreBetter> getMorebetterDuplicateList(MoreBetter moreBetter);
+    Collection<MoreBetterGoods> getMorebetterDuplicateList(MoreBetterGoods moreBetterGoods);
     /* // CSB 진행 */
     /* // CSB 진행 */
 }
 }

+ 5 - 7
src/main/java/com/style24/admin/biz/service/TsaMorebetterService.java

@@ -118,9 +118,6 @@ public class TsaMorebetterService {
         return morebetterDao.getMorebetterBurdenList(tmtbSq);
         return morebetterDao.getMorebetterBurdenList(tmtbSq);
     }
     }
 
 
-    public Collection<MoreBetter> getMorebetterDuplicateList(MoreBetter moreBetter) {
-        return morebetterDao.getMorebetterDuplicateList(moreBetter);
-    }
     /**
     /**
      * 다다익선 저장
      * 다다익선 저장
      * @param moreBetter
      * @param moreBetter
@@ -401,9 +398,10 @@ public class TsaMorebetterService {
      * @since 2021. 1. 22
      * @since 2021. 1. 22
      */
      */
     @Transactional("shopTxnManager")
     @Transactional("shopTxnManager")
-    public void createMorebetterGoodsTemp() throws Exception {
+    public void createMorebetterGoodsTemp(){
+        log.info("[deleteTmtbGoodsTemp a]{}");
         morebetterDao.deleteTmtbGoodsTemp();
         morebetterDao.deleteTmtbGoodsTemp();
-        morebetterDao.createTmtbGoodsTemp();
+        //morebetterDao.createTmtbGoodsTemp();
     }
     }
 
 
     /**
     /**
@@ -413,8 +411,8 @@ public class TsaMorebetterService {
      * @author bin2107
      * @author bin2107
      * @since 2021. 1. 22
      * @since 2021. 1. 22
      */
      */
-    public Collection<MoreBetterGoods> getMorebetterUsingGoodsList(MoreBetterGoods moreBetterGoods) {
-        return morebetterDao.getMorebetterUsingGoodsList(moreBetterGoods);
+    public Collection<MoreBetterGoods> getMorebetterDuplicateList(MoreBetterGoods moreBetterGoods) {
+        return morebetterDao.getMorebetterDuplicateList(moreBetterGoods);
     }
     }
 
 
     /* // CSB 진행 */
     /* // CSB 진행 */

+ 5 - 3
src/main/java/com/style24/admin/biz/web/TsaMarketingController.java

@@ -577,7 +577,7 @@ public class TsaMarketingController extends TsaBaseController {
 
 
 	@PostMapping("/morebetter/save")
 	@PostMapping("/morebetter/save")
 	@ResponseBody
 	@ResponseBody
-	public GagaResponse saveMorebetterDetail(@RequestBody MoreBetter moreBetter) throws Exception{
+	public GagaResponse saveMorebetterDetail(@RequestBody MoreBetter moreBetter){
 		String[] multiSupplyCompCd = moreBetter.getSupplyCompArr().split(",");
 		String[] multiSupplyCompCd = moreBetter.getSupplyCompArr().split(",");
 		String[] multiBrand = moreBetter.getBrandArr().split(",");
 		String[] multiBrand = moreBetter.getBrandArr().split(",");
 
 
@@ -589,9 +589,11 @@ public class TsaMarketingController extends TsaBaseController {
 
 
 		// TMTB_GOODS_TEMP TABLE TRUNCATE -> 다른 다다에서 사용중인 상품 조회 -> INSERT
 		// TMTB_GOODS_TEMP TABLE TRUNCATE -> 다른 다다에서 사용중인 상품 조회 -> INSERT
 		morebetterService.createMorebetterGoodsTemp();
 		morebetterService.createMorebetterGoodsTemp();
-		log.info("[saveMorebetterDetail createMorebetterGoodsTemp a]{}");
+		//log.info("[saveMorebetterDetail createMorebetterGoodsTemp a]{}");
 		// 다른 다다에서 사용중인 상품 조회
 		// 다른 다다에서 사용중인 상품 조회
-		Collection<MoreBetterGoods> usingGoodsList = morebetterService.getMorebetterUsingGoodsList(moreBetterGoods);
+		Collection<MoreBetterGoods> duplicateGoodsList = morebetterService.getMorebetterDuplicateList(moreBetterGoods);
+
+		log.info("[duplicateGoodsList size]{}",duplicateGoodsList.size());
 
 
 		// SELECT -> 지금 내가 선택한 업체&브랜드에 해당하는 상품 조회 MINUS TMTB_GOODS_TEMP 상품
 		// SELECT -> 지금 내가 선택한 업체&브랜드에 해당하는 상품 조회 MINUS TMTB_GOODS_TEMP 상품
 		// 조회 건수 있으면 -> 해당 상품코드 엑셀로 던져주기
 		// 조회 건수 있으면 -> 해당 상품코드 엑셀로 던져주기

+ 25 - 32
src/main/java/com/style24/persistence/mybatis/shop/TsaMorebetter.xml

@@ -484,38 +484,7 @@
 		</if>
 		</if>
 	</delete>
 	</delete>
 
 
-	<select id="getMorebetterDuplicateList" parameterType="MoreBetter" resultType="MoreBetter">
-		/* TsaMarketing.getMorebetterDuplicateList */
-		SELECT 		B.TMTB_SQ
-			 		, SUM(CASE WHEN B.GOODS_GB = 'G800_30' THEN -1 ELSE 1 END) USE_YN
-		FROM 		TB_TMTB A
-		INNER JOIN  TB_TMTB_APPLY_GOODS B
-			ON A.TMTB_SQ = B.TMTB_SQ
-		WHERE 1=1
-		  AND NOW() BETWEEN DATE_FORMAT(A.TMTB_ST_DT, '%Y-%m-%d %H:%i:%S') AND DATE_FORMAT(A.TMTB_ED_DT, '%Y-%m-%d %H:%i:%S')	-- 적용날짜에 속하고
-		  AND A.TMTB_STAT = 'G232_11'
-		  AND B.DEL_YN = 'N'
-		  AND EXISTS (SELECT 1
-					  FROM TB_GOODS G
-					  WHERE 1=1
-						AND B.GOODS_CD = G.GOODS_CD
-						<if test="multiSupplyCompCd != null and multiSupplyCompCd != ''">
-							AND G.SUPPLY_COMP_CD IN
-							<foreach collection="multiSupplyCompCd" item="item" index="index"  open="(" close=")" separator=",">
-								#{item}
-							</foreach>
-						</if>
-						<if test="multiBrand != null and multiBrand != ''">
-							AND G.BRAND_CD IN
-							<foreach collection="multiBrand" item="item" index="index"  open="(" close=")" separator=",">
-								#{item}
-							</foreach>
-						</if>
-			)
-		GROUP BY B.TMTB_SQ
-	</select>
-
-	<delete id="deleteTmtbGoodsTemp">
+	<delete id="deleteTmtbGoodsTemp" timeout="300">
 		/* TsaMarketing.deleteTmtbGoodsTemp */
 		/* TsaMarketing.deleteTmtbGoodsTemp */
 		TRUNCATE TABLE TB_TMTB_GOODS_TEMP
 		TRUNCATE TABLE TB_TMTB_GOODS_TEMP
 	</delete>
 	</delete>
@@ -540,5 +509,29 @@
 									  AND		C.GOODS_GB = 'G800_30'
 									  AND		C.GOODS_GB = 'G800_30'
 								)
 								)
 	</insert>
 	</insert>
+
+	<select id="getMorebetterDuplicateList" parameterType="MoreBetterGoods" resultType="MoreBetterGoods">
+		/* TsaMarketing.getMorebetterDuplicateList */
+		SELECT TMP.GOODS_CD
+		  FROM TB_TMTB_GOODS_TEMP TMP
+		 WHERE 1=1
+		   AND TMP.GOODS_CD IN (
+				   SELECT  G.GOODS_CD
+					 FROM  TB_GOODS G
+					WHERE  1=1
+						<if test="multiSupplyCompCd != null and multiSupplyCompCd != ''">
+							AND G.SUPPLY_COMP_CD IN
+							<foreach collection="multiSupplyCompCd" item="item" index="index"  open="(" close=")" separator=",">
+								#{item}
+							</foreach>
+						</if>
+						<if test="multiBrand != null and multiBrand != ''">
+							AND G.BRAND_CD IN
+							<foreach collection="multiBrand" item="item" index="index"  open="(" close=")" separator=",">
+								#{item}
+							</foreach>
+						</if>
+				)
+	</select>
 	<!--// CSB 진행 -->
 	<!--// CSB 진행 -->
 </mapper>
 </mapper>