Просмотр исходного кода

ST24PRJ-21 [결함] 교환배송비 PG점프/현금환불로직 - 휴대폰 결제시

card007 4 лет назад
Родитель
Сommit
9400573ec7

+ 51 - 7
src/main/java/com/style24/core/biz/service/TscOrderChangeService.java

@@ -727,7 +727,7 @@ public class TscOrderChangeService {
 			if (TscConstants.PgGb.NAVER_ORDER.value().equals(pgGb) || TscConstants.PayMeans.EXTMALL.value().equals(payMeans) || "Y".equals(pgStat) || pg.getPartCancelAmt() == 0) {
 				// 2021.10.15 card007 PG점프는 추후 데이터 구분을 위해 pgTid, pgTradeNo 없앰
 				pg.setPayAmt(pg.getPartCancelAmt() * -1);
-				pg.setPgTid("");
+				// pg.setPgTid("");
 				pg.setPgTradeNo("");
 				orderDao.insertPaymentCancel(pg);
 			} else if (TscConstants.PgGb.KCP.value().equals(pgGb) || TscConstants.PgGb.PAYCO.value().equals(pgGb)) {
@@ -1741,9 +1741,16 @@ public class TscOrderChangeService {
 			orderChangeDao.createOrderChangeDetailHstForAllCancel(orderChange);
 
 			// 4. PG 취소 처리
+			// 2021.11.29 card007 교환배송비 취소불가 시 PG점프 처리 추가
 			if (pg != null && StringUtils.isNotBlank(pg.getPgTid())) {
 				if(!TscConstants.PgGb.NAVER_ORDER.value().equals(pg.getPgGb())) {
-					kcpService.kcpCancel(pg);
+					if ("N".equals(paymentList.iterator().next().getCanDeliveryCancelYn())) {
+						pg.setPayAmt(pg.getPayAmt() * -1);
+						pg.setPgTradeNo("");
+						orderDao.insertPaymentCancel(pg);
+					} else {
+						kcpService.kcpCancel(pg);
+					}
 				}
 			}
 
@@ -2361,7 +2368,7 @@ public class TscOrderChangeService {
 			// 상품권 100%, 제휴몰, PG점프처리, 네이버페이주문은 PG점프 처리
 			// 2021.10.15 card007 PG점프는 추후 데이터 구분을 위해 pgTid, pgTradeNo 없앰
 			pg.setPayAmt(pg.getPayAmt() * -1);
-			pg.setPgTid("");
+			// pg.setPgTid("");
 			pg.setPgTradeNo("");
 			orderDao.insertPaymentCancel(pg);
 		} else if (TscConstants.PgGb.KCP.value().equals(pgGb) || TscConstants.PgGb.PAYCO.value().equals(pgGb)) {
@@ -3320,7 +3327,7 @@ public class TscOrderChangeService {
 			if (TscConstants.PgGb.NAVER_ORDER.value().equals(pgGb) || TscConstants.PayMeans.EXTMALL.value().equals(payMeans) || "Y".equals(pgStat) || refundAmt == 0) {
 				// 2021.10.15 card007 PG점프는 추후 데이터 구분을 위해 pgTid, pgTradeNo 없앰
 				pg.setPayAmt(pg.getPartCancelAmt() * -1);
-				pg.setPgTid("");
+				// pg.setPgTid("");
 				pg.setPgTradeNo("");
 				orderDao.insertPaymentCancel(pg);
 			}
@@ -3770,7 +3777,7 @@ public class TscOrderChangeService {
 		if (TscConstants.PgGb.NAVER_ORDER.value().equals(pgGb) || TscConstants.PayMeans.EXTMALL.value().equals(payMeans) || "Y".equals(pgStat) || refundAmt == 0) {
 			// 2021.10.15 card007 PG점프는 추후 데이터 구분을 위해 pgTid, pgTradeNo 없앰
 			pg.setPayAmt(pg.getPayAmt() * -1);
-			pg.setPgTid("");
+			// pg.setPgTid("");
 			pg.setPgTradeNo("");
 			orderDao.insertPaymentCancel(pg);
 		}
@@ -5082,6 +5089,9 @@ public class TscOrderChangeService {
 
 			// 추가배송비 존재 시
 			if (paymentList != null && paymentList.size() > 0) {
+				String canDeliveryCancelYn = paymentList.iterator().next().getCanDeliveryCancelYn();
+				String payMeans = paymentList.iterator().next().getPayMeans();
+				String pgStat = "N";
 
 				// 추가배송비 결제정보 조회
 				Payment pg = new Payment();
@@ -5093,7 +5103,7 @@ public class TscOrderChangeService {
 				if ("W".equals(orderChange.getWdGb())) {
 					orderChangeDao.createAddDeliveryFeeCancelPart(orderChange);
 
-					// 추가배송비 취소 정보 설정19938874
+					// 추가배송비 취소 정보 설정
 					if (StringUtils.isNotBlank(pg.getPgTid())) {
 						pg.setPayStat(TscConstants.PaymentStat.PAYMENT_CANCEL.value());
 						pg.setPayGb(TscConstants.PaymentGb.DELIVERY.value());
@@ -5108,6 +5118,13 @@ public class TscOrderChangeService {
 						pg.setLeftAmt(orderChange.getAddPayCost());
 						pg.setPartCancelAmt(leftAmt);
 					}
+
+					// 2021.11.29 card007 교환배송비 취소 PG점프 여부 설정
+					if (TscConstants.PayMeans.CELL_PHONE.value().equals(payMeans)) {
+						pgStat = "Y";
+						
+						pg.setPayAmt(pg.getPartCancelAmt());
+					}
 				}
 				// 회수구분 직접일때는 전체취소 (D)
 				else {
@@ -5123,10 +5140,25 @@ public class TscOrderChangeService {
 						pg.setRegNo(orderChange.getUserNo());
 						pg.setUpdNo(orderChange.getUserNo());
 					}
+
+					// 2021.11.29 card007 교환배송비 취소 PG점프 여부 설정
+					if ("N".equals(canDeliveryCancelYn)) {
+						pgStat = "Y";
+					}
 				}
 
 				// KCP 취소 처리
-				kcpService.kcpCancel(pg);
+				// 2021.11.29 card007 교환배송비 취소불가 시 PG점프 처리
+				if (StringUtils.isNotBlank(pg.getPgTid())) {
+					if ("Y".equals(pgStat)) {
+						pg.setPayAmt(pg.getPayAmt() * -1);
+						pg.setPgTradeNo("");
+
+						orderDao.insertPaymentCancel(pg);
+					} else {
+						kcpService.kcpCancel(pg);
+					}
+				}
 			}
 		}
 	}
@@ -5585,4 +5617,16 @@ public class TscOrderChangeService {
 	public void deleteRefundAccount(Integer custNo) {
 		orderChangeDao.deleteRefundAccount(custNo);
 	}
+
+	/**
+	 * 추가배송비 결제 여부 조회
+	 * 
+	 * @param OrderChange
+	 * @return Collection<Order>
+	 * @author card007
+	 * @since 2021. 11. 29
+	 */
+	public Collection<Order> getAddDeliveryFeePayment (OrderChange orderChange) {
+		return orderChangeDao.getAddDeliveryFeePayment(orderChange);
+	}
 }

+ 1 - 0
src/main/java/com/style24/persistence/domain/Order.java

@@ -786,6 +786,7 @@ public class Order extends TscBaseDomain {
 	private int addDeliveryFee;	
 	private String wdBfSendYn;
 	private String canRequestCancelYn;
+	private String canDeliveryCancelYn;
 	private String holdCode;
 	private String holdReason;
 	

+ 6 - 3
src/main/java/com/style24/persistence/mybatis/shop/TscOrder.xml

@@ -1663,9 +1663,9 @@
 		         WHERE 1 = 1
 		           AND DF.ORD_NO = #{ordNo}
 		           AND EXISTS (SELECT 1
-		                        FROM TB_ORDER_CHANGE_DETAIL OCD
-		                       WHERE DF.ORD_CHG_SQ = OCD.ORD_CHG_SQ
-		                         AND OCD.CHG_STAT IN ('G685_40', 'G685_60'))
+		                        FROM TB_ORDER_CHANGE OC
+		                       WHERE DF.ORD_CHG_SQ = OC.ORD_CHG_SQ
+		                         AND OC.CHG_GB IN ('G680_30', 'G680_40'))
 		  ) Z
 		 GROUP BY Z.DELV_FEE_GB
 		        , Z.DELV_FEE_GB_NM
@@ -3553,6 +3553,9 @@
 		ON     DF.ORD_NO = P.ORD_NO
 		AND    P.PAY_STAT IN ('G016_30', 'G016_10')
 		AND    P.PAY_GB = IFNULL(NULLIF(#{payGb}, ''), 'O')
+		<if test="ordChgSq != null and ordChgSq != ''">
+		AND    DF.ORD_CHG_SQ = P.ORD_CHG_SQ
+		</if>
 		SET    DF.PAY_SQ = P.PAY_SQ
 		     , DF.UPD_NO = #{updNo}
 		     , DF.UPD_DT = NOW()

+ 27 - 18
src/main/java/com/style24/persistence/mybatis/shop/TscOrderChange.xml

@@ -2029,6 +2029,13 @@
 		/* OrderChange.getAddDeliveryFeePayment */
 		SELECT OC.ORD_CHG_SQ
 		     , P.PAY_AMT
+		     , P.PAY_DT
+		     , P.PAY_MEANS
+		     , CASE P.PAY_MEANS WHEN 'G014_60' THEN CASE WHEN DATE_FORMAT(NOW(), '%m') <![CDATA[<>]]> DATE_FORMAT(P.PAY_DT, '%m') THEN 'N'
+		                                                 ELSE 'Y'
+		                                             END
+		                        ELSE 'Y'
+		        END AS CAN_DELIVERY_CANCEL_YN
 		  FROM TB_ORDER_CHANGE OC
 		 INNER JOIN TB_PAYMENT P
 		    ON P.ORD_CHG_SQ = OC.ORD_CHG_SQ
@@ -4074,20 +4081,21 @@
 		           AND P.PAY_GB = 'O'
 		           AND P.PAY_STAT = 'G016_30'
 		           AND P.PG_GB <![CDATA[<>]]> 'NAVER_ORDER'
-		--         WHERE O.DISP_YN = 'Y'
-		<choose>
-			<when test="custNo > 0">
+		<where>
+			<choose>
+				<when test="custNo > 0">
 		           AND O.CUST_NO = #{custNo}
-			</when>
-			<otherwise>
+				</when>
+				<otherwise>
 		           AND O.ORD_NO = #{ordNo}
 		           AND O.ORD_NM = #{ordNm}
 		           AND O.ORD_PHNNO = #{ordPhnno}
-			</otherwise>
-		</choose>
-		<if test="ordChgSq != null and ordChgSq != ''">
+				</otherwise>
+			</choose>
+			<if test="ordChgSq != null and ordChgSq != ''">
 		           AND OC.ORD_CHG_SQ = #{ordChgSq}
-		</if>
+			</if>
+		</where>
 		) Z
 		 GROUP BY Z.ORD_CHG_SQ, Z.CHG_GB, Z.CHG_QTY, Z.ORD_DT, Z.ORD_DATE, Z.CHG_DATE, Z.CHG_TIME, Z.CHG_DT, Z.COMPLETE_DT, Z.CHG_STAT
 		        , Z.CHG_STAT_NM, Z.ORD_NO, Z.DELV_FEE_CD, Z.ORD_AMT, Z.ORD_QTY, Z.CNCL_RTN_QTY, Z.CNCL_RTN_AMT, Z.CPN1_DC_AMT, Z.REAL_ORD_AMT, Z.PNT_DC_AMT
@@ -4286,20 +4294,21 @@
 		            ON P.ORD_CHG_SQ = OC.ORD_CHG_SQ
 		           AND P.PAY_GB = 'D'
 		           AND P.PAY_STAT = 'G016_30'
-		--         WHERE O.DISP_YN = 'Y'
-		<choose>
-			<when test="custNo > 0">
+		<where>
+			<choose>
+				<when test="custNo > 0">
 		           AND O.CUST_NO = #{custNo}
-			</when>
-			<otherwise>
+				</when>
+				<otherwise>
 		           AND O.ORD_NO = #{ordNo}
 		           AND O.ORD_NM = #{ordNm}
 		           AND O.ORD_PHNNO = #{ordPhnno}
-			</otherwise>
-		</choose>
-		<if test="ordChgSq != null and ordChgSq != ''">
+				</otherwise>
+			</choose>
+			<if test="ordChgSq != null and ordChgSq != ''">
 		           AND OC.ORD_CHG_SQ = #{ordChgSq}
-		</if>
+			</if>
+		</where>
 		) Z
 		 GROUP BY Z.ORD_CHG_SQ, Z.CHG_GB, Z.WD_BF_SEND_YN, Z.CHG_QTY, Z.ORD_DT, Z.ORD_DATE, Z.CHG_DATE, Z.CHG_TIME, Z.CHG_DT, Z.COMPLETE_DT, Z.CHG_STAT
 		        , Z.CHG_STAT_NM, Z.ORD_DTL_STAT, Z.EXCHANGE_SHIP_COMP_CD, Z.EXCHANGE_INVOICE_NO, Z.ORD_NO, Z.DELV_FEE_CD, Z.ORD_AMT, Z.ORD_QTY, Z.CNCL_RTN_QTY, Z.CNCL_RTN_AMT