Browse Source

ST24PRJ-654 취소접수 로직 수정

card007 4 years ago
parent
commit
3a1cbfc2ac

+ 60 - 0
src/main/java/com/style24/core/biz/dao/TscOrderChangeDao.java

@@ -1182,4 +1182,64 @@ public interface TscOrderChangeDao {
 	 * @since 2021. 12. 22
 	 */
 	Collection<OrderChange> getAllCancelCanQty(OrderChange orderChange);
+
+	/**
+	 * 현금환불정보 생성
+	 * 
+	 * @param OrderChange
+	 * @return int
+	 * @author card007
+	 * @since 2022. 01. 04
+	 */
+	int createCashRefund(OrderChange orderChange);
+
+	/**
+	 * 현금환불내역수 조회
+	 *
+	 * @param orderChange
+	 * @return int
+	 * @author card007
+	 * @since 2022. 01. 05
+	 */
+	int getCashRefundListCount(OrderChange orderChange);
+
+	/**
+	 * 현금환불내역 조회
+	 * 
+	 * @param orderChange
+	 * @return Collection<OrderChange>
+	 * @author card007
+	 * @since 2022. 01. 05
+	 */
+	Collection<OrderChange> getCashRefundList(OrderChange orderChange);
+
+	/**
+	 * 현금환불정보 수정
+	 *
+	 * @param orderChange
+	 * @return int
+	 * @author card007
+	 * @since 2022. 01. 05
+	 */
+	int updateCashRefundInfo(OrderChange orderChange);
+
+	/**
+	 * 현금환불관리 CS메모 수정
+	 *
+	 * @param orderChange
+	 * @return int
+	 * @author card007
+	 * @since 2022. 01. 05
+	 */
+	int updateCsMemo(OrderChange orderChange);
+
+	/**
+	 * 현금환불 입금 완료 처리
+	 *
+	 * @param orderChange
+	 * @return int
+	 * @author card007
+	 * @since 2022. 01. 05
+	 */
+	int completeCashRefund(OrderChange orderChange);
 }

+ 46 - 58
src/main/java/com/style24/core/biz/service/TscDeliveryService.java

@@ -4,7 +4,6 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.env.Environment;
 import org.springframework.stereotype.Service;
@@ -17,7 +16,6 @@ import com.style24.core.biz.dao.TscOrderChangeDao;
 import com.style24.core.biz.dao.TscOrderDao;
 import com.style24.core.biz.dao.TscScmDao;
 import com.style24.core.support.env.TscConstants;
-import com.style24.core.biz.service.TscKakaotalkService;
 import com.style24.core.support.message.TscMessageByLocale;
 import com.style24.core.support.util.CryptoUtils;
 import com.style24.persistence.domain.DeliveryFee;
@@ -110,6 +108,7 @@ public class TscDeliveryService {
 					change.setChgReason(TscConstants.OrderCancelReason.SOLDOUT_CANCEL.value());
 					change.setChgReasonNm("품절취소");
 					change.setBatchYn(batchYn);
+					change.setCardPcableYn(param.getCardPcableYn());
 					cancelDataList.add(change);
 				}
 			}
@@ -121,47 +120,54 @@ public class TscDeliveryService {
 			change.setCnclRtnReqQtyArr(change.getCnclRtnReqQtyList().stream().mapToInt(i->i).toArray());
 
 			// 무통장입금 주문 중 환불계좌정보 없을 경우 취소신청
-			if((TscConstants.PgGb.KCP.value().equals(change.getPgGb()) && TscConstants.PayMeans.BANK_DEPOSIT.value().equals(change.getPayMeans()) && StringUtils.isEmpty(change.getAccountNo()))
-				|| TscConstants.PayMeans.CELL_PHONE.value().equals(change.getPayMeans())
-				|| TscConstants.PayMeans.BANK_DEPOSIT.value().equals(change.getPayMeans())) {
-				// 취소신청
-				change.setChgGb(TscConstants.OrderChangeGb.CANCEL.value());
-				change.setUserNo(userNo);
-				orderChangeService.cancelRequest(change);
-			} else {		// 무통장입금 주문 중 환불계좌정보 없을 경우 제외는 취소처리
-			
-				// 취소완료
-				GagaMap cancelInfo = orderChangeService.orderCancelPreInfo(change, userNo);
-				
-				
-				// 품절취소 알림톡 
-				try {
-					Order order = new Order();
-					order.setOrdChgSq(cancelInfo.getInt("ordChgSq"));
-					
-					Order info = deliveryDao.getSoldoutInfo(order);
-					
-					order.setOrdNo(info.getOrdNo());
-					order.setCustNo(info.getCustNo());
-					order.setOrdPhnno(info.getOrdPhnno());
-					order.setGoodsCnt(info.getGoodsCnt());
-					order.setGoodsNm(info.getGoodsNm());
-					order.setOrdNm(info.getOrdNm());
-					order.setCancelAllYn(info.getCancelAllYn());
-					order.setExtmallNm(info.getExtmallNm());
-					order.setMallGb(info.getMallGb());
-					order.setExtmallTell(info.getExtmallTell());
-					order.setCnclsmsSendYn(info.getCnclsmsSendYn());
-					kakaotalkService.sendSoldoutCancel(order, userNo);
-				}catch(Exception e) {
-					log.debug("kakaotalkService Exception ordChgSq:"+cancelInfo.getInt("ordChgSq"));
-				}
+			// 2022.01.04 card007 취소접수 로직 현금환불처리로 변경
+			GagaMap result;
+			// 무통장입금
+			if (TscConstants.PgGb.KCP.value().equals(change.getPgGb()) && TscConstants.PayMeans.BANK_DEPOSIT.value().equals(change.getPayMeans())) {
+				change.setCashRefundReason(TscConstants.CashRefundReason.BANK_DEPOSIT.value());
+				result = orderChangeService.cashRefund(change, userNo);
+			}
+			// 신용카드(부분취소불가)
+			else if (TscConstants.PgGb.KCP.value().equals(change.getPgGb()) && TscConstants.PayMeans.CREDIT_CARD.value().equals(change.getPayMeans()) && "N".equals(change.getCardPcableYn())) {
+				change.setCashRefundReason(TscConstants.CashRefundReason.CREDIT_CARD.value());
+				result = orderChangeService.cashRefund(change, userNo);
+			}
+			// 휴대폰결제
+			else if (TscConstants.PgGb.KCP.value().equals(change.getPgGb()) && TscConstants.PayMeans.CELL_PHONE.value().equals(change.getPayMeans())) {
+				change.setCashRefundReason(TscConstants.CashRefundReason.CELL_PHONE.value());
+				result = orderChangeService.cashRefund(change, userNo);
+			}
+			// 현금환불처리 제외 취소완료
+			else {
+				result = orderChangeService.orderCancelPreInfo(change, userNo);
+			}
+
+			// 품절취소 알림톡 
+			try {
+				Order order = new Order();
+				order.setOrdChgSq(result.getInt("ordChgSq"));
+
+				Order info = deliveryDao.getSoldoutInfo(order);
+
+				order.setOrdNo(info.getOrdNo());
+				order.setCustNo(info.getCustNo());
+				order.setOrdPhnno(info.getOrdPhnno());
+				order.setGoodsCnt(info.getGoodsCnt());
+				order.setGoodsNm(info.getGoodsNm());
+				order.setOrdNm(info.getOrdNm());
+				order.setCancelAllYn(info.getCancelAllYn());
+				order.setExtmallNm(info.getExtmallNm());
+				order.setMallGb(info.getMallGb());
+				order.setExtmallTell(info.getExtmallTell());
+				order.setCnclsmsSendYn(info.getCnclsmsSendYn());
+				kakaotalkService.sendSoldoutCancel(order, userNo);
+			} catch(Exception e) {
+				log.info("kakaotalkService Exception ordChgSq:"+result.getInt("ordChgSq"));
 			}
 		}
 		
 	}
-
-
+	
 	/**
 	 * 배송비 정책 코드 별 배송비 조회
 	 *
@@ -173,22 +179,4 @@ public class TscDeliveryService {
 	public Collection<DeliveryFee> getDeliveryFee(DeliveryFee deliveryFee) {
 		return deliveryDao.getDeliveryFee(deliveryFee);
 	}
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+}

+ 162 - 0
src/main/java/com/style24/core/biz/service/TscOrderChangeService.java

@@ -655,6 +655,9 @@ public class TscOrderChangeService {
 				int leftAmt = orderChangeDao.getPaymentPayamt(pg);
 				pg.setLeftAmt(leftAmt);
 
+				// 2022.01.04 card007 환불금액 설정
+				map.setInt("refundAmt", refundAmt);
+
 				log.info("pg.getPartCancelAmt() ::: {}", pg.getPartCancelAmt());
 				log.info("pg.getLeftAmt() ::: {}", pg.getLeftAmt());
 
@@ -5782,4 +5785,163 @@ public class TscOrderChangeService {
 
 		return result;
 	}
+
+	/**
+	 * 현금환불 처리
+	 *
+	 * @param OrderChange
+	 * @return GagaMap
+	 * @author card007
+	 * @since 2022. 01. 04
+	 */
+	@SuppressWarnings("unchecked")
+	@Transactional("shopTxnManager")
+	public GagaMap cashRefund(OrderChange orderChange, Integer userNo) {
+		GagaMap result = new GagaMap();
+		Integer ordChgSq;
+
+		// 1. 환불 사전 정보 조회
+		GagaMap refundPreInfo = getRefundPreInfo(orderChange);
+		List<Order> cnclReqList = (List<Order>)refundPreInfo.get("cnclReqList");
+		String allCanYn = refundPreInfo.getString("allCanYn");
+		String allLastCanYn = refundPreInfo.getString("allLastCanYn");
+
+		// 2. 취소완료 처리 데이터 설정
+		orderChange.setReqGbn("cnclComplete");
+
+		// 전체취소
+		if ("Y".equals(allCanYn)) {
+			orderChange.setChgGb(TscConstants.OrderChangeGb.CANCEL.value());
+			orderChange.setPgStat("Y");
+			orderChange.setRegNo(userNo);
+			orderChange.setUpdNo(userNo);
+
+			// 전체 취소 처리
+			ordChgSq = allCnclComplete(orderChange);
+			result.setInt("ordChgSq", ordChgSq);
+			
+			// 환불금액 설정
+			Payment payment = new Payment();
+			payment.setOrdNo(orderChange.getOrdNo());
+			payment = orderChangeDao.getPaymentInfo(payment);
+			result.setInt("refundAmt", payment.getPayAmt());
+		}
+		// 부분취소
+		else {
+			// 환불금액계산
+			result = orderRefundService.cnclRtnRefundAmt(cnclReqList);
+
+			// 부분취소 처리 정보 설정
+			result.setInt("ordNo", orderChange.getOrdNo());							// 주문번호
+			result.setString("chgReason", orderChange.getChgReason());				// 변경사유
+			result.setString("chgReasonNm", orderChange.getChgReasonNm());			// 변경사유명
+			result.setString("chgMemo", orderChange.getChgMemo());					// 변경메모
+			result.setString("accountNo", orderChange.getAccountNo());				// 환불계좌번호
+			result.setString("accountNm", orderChange.getAccountNm());				// 환불계좌예금주명
+			result.setString("bankCd", orderChange.getBankCd());					// 환불계좌은행코드
+			result.setString("allLastCanYn", allLastCanYn);							// 전체 마지막 취소 여부
+			result.setString("reqGbn", orderChange.getReqGbn());					// 신청구분
+			result.setString("ipAddress", orderChange.getIpAddress());				// IP주소
+			result.setInt("custNo", orderChange.getCustNo());						// 고객번호
+			result.setString("pgTid", refundPreInfo.getString("pgTid"));			// PG거래ID
+			result.setString("payMeans", refundPreInfo.getString("payMeans"));		// 결제수단
+			result.setString("pgGb", refundPreInfo.getString("pgGb"));				// PG구분
+			result.setString("cashAuthNo", refundPreInfo.getString("cashAuthNo"));	// 현금영수증 승인번호
+			result.setString("pgStat", "Y");										// PG점프
+			result.setString("batchYn", orderChange.getBatchYn());
+
+			// 부분취소 처리
+			result = partialCancel(result, userNo);
+		}
+		
+		// 5. 환불계좌 정보 설정
+		String accountNo = orderChange.getAccountNo();
+		String accountNm = orderChange.getAccountNm();
+		String bankCd = orderChange.getBankCd();
+		
+		if (StringUtils.isBlank(accountNo) || StringUtils.isBlank(accountNm) || StringUtils.isBlank(bankCd)) {
+			Order custAccount = new Order();
+			custAccount.setOrdNo(orderChange.getOrdNo());
+			Collection<Order> custAccountList = orderChangeDao.getRefundAccount(custAccount);
+			
+			if (custAccountList != null && custAccountList.size() > 0) {
+				accountNo = custAccountList.iterator().next().getAccountNo();
+				accountNm = custAccountList.iterator().next().getAccountNm();
+				bankCd = custAccountList.iterator().next().getBankCd();
+			}
+		}
+		
+		// 5. 현금환불관리 데이터 생성
+		OrderChange cashRefund = new OrderChange();
+		cashRefund.setOrdNo(orderChange.getOrdNo());
+		cashRefund.setOrdChgSq(result.getInt("ordChgSq"));
+		cashRefund.setDepositAmt(result.getInt("refundAmt"));
+		cashRefund.setCashRefundReason(orderChange.getCashRefundReason());
+		cashRefund.setBankCd(bankCd);
+		cashRefund.setAccountNo(accountNo);
+		cashRefund.setAccountNm(accountNm);
+		cashRefund.setDepositYn("N");
+		cashRefund.setDepositDt(null);
+		cashRefund.setRegNo(userNo);
+		cashRefund.setUpdNo(userNo);
+
+		orderChangeDao.createCashRefund(cashRefund);
+
+		return result;
+	}
+
+	/**
+	 * 현금환불내역수 조회
+	 *
+	 * @param orderChange
+	 * @return int
+	 * @author card007
+	 * @since 2022. 01. 05
+	 */
+	public int getCashRefundListCount(OrderChange orderChange) {
+		return orderChangeDao.getCashRefundListCount(orderChange);
+	}
+
+	/**
+	 * 현금환불내역 조회
+	 *
+	 * @param orderChange
+	 * @return Collection<OrderChange>
+	 * @author card007
+	 * @since 2022. 01. 05
+	 */
+	public Collection<OrderChange> getCashRefundList(OrderChange orderChange) {
+		return orderChangeDao.getCashRefundList(orderChange);
+	}
+
+	/**
+	 * 현금환불정보 수정
+	 *
+	 * @param orderChange
+	 * @return int
+	 * @author card007
+	 * @since 2022. 01. 05
+	 */
+	@Transactional("shopTxnManager")
+	public int updateCashRefundInfo(OrderChange orderChange) {
+		int result = 0;
+
+		result += orderChangeDao.updateCashRefundInfo(orderChange);
+		result += orderChangeDao.updateCsMemo(orderChange);
+
+		return result;
+	}
+
+	/**
+	 * 현금환불 입금 완료 처리
+	 *
+	 * @param orderChange
+	 * @return int
+	 * @author card007
+	 * @since 2022. 01. 05
+	 */
+	@Transactional("shopTxnManager")
+	public int completeCashRefund(OrderChange orderChange) {
+		return orderChangeDao.completeCashRefund(orderChange);
+	}
 }

+ 1 - 0
src/main/java/com/style24/core/biz/service/TscOrderService.java

@@ -2570,6 +2570,7 @@ public class TscOrderService {
 					change.setChgReasonNm("품절취소");
 					change.setDelvFeeCd(param.getDelvFeeCd());
 					change.setOrdChgSq(param.getOrdChgSq());
+					change.setCardPcableYn(param.getCardPcableYn());
 					cancelDataList.add(change);
 				}
 			}

+ 17 - 0
src/main/java/com/style24/core/support/env/TscConstants.java

@@ -1227,4 +1227,21 @@ public class TscConstants {
 			return value;
 		}
 	}
+
+	// 현금환불사유 코드
+	public enum CashRefundReason {
+		BANK_DEPOSIT("G690_10"),	// 무통장입금
+		CELL_PHONE("G690_20"),		// 휴대폰결제
+		CREDIT_CARD("G690_30");		// 신용카드(부분취소불가)
+
+		private String value;
+
+		private CashRefundReason(String value) {
+			this.value = value;
+		}
+
+		public String value() {
+			return value;
+		}
+	}
 }

+ 13 - 0
src/main/java/com/style24/persistence/domain/OrderChange.java

@@ -276,6 +276,19 @@ public class OrderChange extends TscBaseDomain {
 	private String msgStat;							// 메세지 전송 여부
 	private int cnclRtnQty;
 	private int ordReqChgQty;
+	private String cardPcableYn;
+	private String orgDepositYn;
+	private String depositYn;
+	private String depositDt;
+	private String cashRefundReason;
+	private String claimDt;
+	private String searchGb;
+	private String searchTxt;
+	private String search;
+	private String condition;
+	private String[] conditions;
+	private String searchDateGb;
+	private Integer cashRefundSq;
 
 	public String getMaskingOrdNm() {
 		return TscSession.getAttribute("maskingYn").equals("Y") ? MaskingUtils.name(getOrdNm()) : getOrdNm();

+ 223 - 1
src/main/java/com/style24/persistence/mybatis/shop/TscOrderChange.xml

@@ -5398,7 +5398,7 @@
 	<!-- 최초주문상세번호 기준 상품쿠폰 할인액 조회 -->
 	<select id="getGoodsCpnDcAmt" parameterType="Order" resultType="int">
 		/* TscOrderChange.getGoodsCpnDcAmt */
-		SELECT SUM(GOODS_CPN_DC_AMT) AS GOODS_CPN_DC_AMT
+		SELECT IFNULL(SUM(GOODS_CPN_DC_AMT), 0) AS GOODS_CPN_DC_AMT
 		  FROM TB_ORDER_DETAIL
 		 WHERE FIRST_ORD_DTL_NO = #{firstOrdDtlNo}
 	</select>
@@ -5453,6 +5453,228 @@
 		    ON OD.ORD_DTL_NO = OCD.ORD_DTL_NO
 		 WHERE OD.ORD_NO = #{ordNo}
 	</select>
+
+	<!-- 현금환불정보 생성 -->
+	<insert id="createCashRefund" parameterType="OrderChange">
+		/* TscOrderChange.createCashRefund */
+		INSERT INTO TB_CASH_REFUND (
+		       ORD_NO
+		     , ORD_CHG_SQ
+		     , DEPOSIT_AMT
+		     , CASH_REFUND_REASON
+		     , BANK_CD
+		     , ACCOUNT_NO
+		     , ACCOUNT_NM
+		     , DEPOSIT_YN
+		     , DEPOSIT_DT
+		     , REG_NO
+		     , REG_DT
+		     , UPD_NO
+		     , UPD_DT
+		) VALUES (
+		       #{ordNo}
+		     , #{ordChgSq}
+		     , #{depositAmt}
+		     , #{cashRefundReason}
+		     , #{bankCd}
+		     , #{accountNo}
+		     , #{accountNm}
+		     , #{depositYn}
+		     , #{depositDt}
+		     , #{regNo}
+		     , NOW()
+		     , #{updNo}
+		     , NOW()
+		)
+	</insert>
+
+	<!-- 현금환불내역수 조회 -->
+	<select id="getCashRefundListCount" parameterType="OrderChange" resultType="int">
+		/* TscOrderChange.getCashRefundListCount */
+		SELECT COUNT(*)
+		  FROM TB_CASH_REFUND CR
+		 INNER JOIN TB_ORDER O
+		    ON CR.ORD_NO = O.ORD_NO
+		 INNER JOIN TB_CUSTOMER C
+		    ON O.CUST_NO = C.CUST_NO
+		 INNER JOIN TB_PAYMENT P
+		    ON CR.ORD_NO = P.ORD_NO
+		   AND P.PAY_STAT IN ('G016_10', 'G016_30')
+		   AND P.PAY_GB = 'O'
+		 INNER JOIN TB_ORDER_CHANGE OC
+		    ON CR.ORD_CHG_SQ = OC.ORD_CHG_SQ
+		 WHERE 1=1
+		<if test="searchGb == 'ordNm' and searchTxt != null and searchTxt != ''">
+			AND O.ORD_NM = #{searchTxt}
+		</if>
+		<if test="searchGb == 'custId' and searchTxt != null and searchTxt != ''">
+			AND O.ORD_NM = #{searchTxt}
+		</if>
+		<if test="searchGb == 'ordPhnno' and searchTxt != null and searchTxt != ''">
+			AND O.ORD_NM = #{searchTxt}
+		</if>
+		<if test="depositYn != null and depositYn != ''">
+		   AND CR.DEPOSIT_YN = #{depositYn}
+		</if>
+		<if test="conditions != null and conditions.length > 0">
+			<choose>
+				<when test="search == 'searchOrdNo'">
+		   AND CR.ORD_NO IN
+					<foreach collection="conditions" item="item" index="index" open="(" close=")" separator=",">
+						#{item}
+					</foreach>
+				</when>
+				<when test="search == 'searchOrdChgSq'">
+		   AND CR.ORD_CHG_SQ IN
+					<foreach collection="conditions" item="item" index="index" open="(" close=")" separator=",">
+						#{item}
+					</foreach>
+				</when>
+			</choose>
+		</if>
+		<if test="accountNo != null and accountNo != ''">
+		   AND CR.ACCOUNT_NO = #{accountNo}
+		</if>
+		<if test="bankCd != null and bankCd != ''">
+		   AND CR.BANK_CD = #{bankCd}
+		</if>
+		<if test="stDate != null and stDate != '' and edDate != null and edDate != ''">
+			<choose>
+				<when test="searchDateGb == 'regDt'">
+					AND CR.REG_DT BETWEEN CONCAT(#{stDate}, ' 00:00:00') AND CONCAT(#{edDate}, ' 23:59:59')
+				</when>
+				<when test="searchDateGb == 'depositDt'">
+					AND CR.DEPOSIT_DT BETWEEN CONCAT(#{stDate}, ' 00:00:00') AND CONCAT(#{edDate}, ' 23:59:59')
+				</when>
+			</choose>
+		</if>
+	</select>
+
+	<!-- 현금환불내역 조회 -->
+	<select id="getCashRefundList" parameterType="OrderChange" resultType="OrderChange">
+		/* TscOrderChange.getCashRefundList */
+		SELECT CR.CASH_REFUND_SQ
+		     , CR.DEPOSIT_YN
+		     , CR.DEPOSIT_YN                         AS ORG_DEPOSIT_YN
+		     , (SELECT CHG_STAT
+		          FROM TB_ORDER_CHANGE_DETAIL
+		         WHERE ORD_CHG_SQ = CR.ORD_CHG_SQ
+		         LIMIT 1)                            AS CHG_STAT
+		     , FN_GET_CODE_NM('G685', (SELECT CHG_STAT
+		                                 FROM TB_ORDER_CHANGE_DETAIL
+		                                WHERE ORD_CHG_SQ = CR.ORD_CHG_SQ
+		                                LIMIT 1))    AS CHG_STAT_NM
+		     , OC.REG_DT                             AS CLAIM_DT
+		     , CR.ORD_NO
+		     , CR.ORD_CHG_SQ
+		     , CONCAT(O.ORD_NM, '(', C.CUST_ID, ')') AS ORD_NM
+		     , O.ORD_NM
+		     , O.ORD_PHNNO
+		     , CR.DEPOSIT_AMT
+		     , P.PAY_MEANS
+		     , FN_GET_CODE_NM('G014', P.PAY_MEANS)   AS PAY_MEANS_NM
+		     , CR.BANK_CD
+		     , CR.ACCOUNT_NO
+		     , CR.ACCOUNT_NM
+		     , OC.CHG_MEMO
+		     , CR.REG_DT
+		     , CR.DEPOSIT_DT
+		  FROM TB_CASH_REFUND CR
+		 INNER JOIN TB_ORDER O
+		    ON CR.ORD_NO = O.ORD_NO
+		 INNER JOIN TB_CUSTOMER C
+		    ON O.CUST_NO = C.CUST_NO
+		 INNER JOIN TB_PAYMENT P
+		    ON CR.ORD_NO = P.ORD_NO
+		   AND P.PAY_STAT IN ('G016_10', 'G016_30')
+		   AND P.PAY_GB = 'O'
+		 INNER JOIN TB_ORDER_CHANGE OC
+		    ON CR.ORD_CHG_SQ = OC.ORD_CHG_SQ
+		 WHERE 1=1
+		<if test="searchGb == 'ordNm' and searchTxt != null and searchTxt != ''">
+		   AND O.ORD_NM = #{searchTxt}
+		</if>
+		<if test="searchGb == 'custId' and searchTxt != null and searchTxt != ''">
+			AND C.CUST_ID = #{searchTxt}
+		</if>
+		<if test="searchGb == 'ordPhnno' and searchTxt != null and searchTxt != ''">
+			AND O.ORD_PHNNO = #{searchTxt}
+		</if>
+		<if test="depositYn != null and depositYn != ''">
+		   AND CR.DEPOSIT_YN = #{depositYn}
+		</if>
+		<if test="conditions != null and conditions.length > 0">
+			<choose>
+				<when test="search == 'searchOrdNo'">
+		   AND CR.ORD_NO IN
+					<foreach collection="conditions" item="item" index="index" open="(" close=")" separator=",">
+						#{item}
+					</foreach>
+				</when>
+				<when test="search == 'searchOrdChgSq'">
+		   AND CR.ORD_CHG_SQ IN
+					<foreach collection="conditions" item="item" index="index" open="(" close=")" separator=",">
+						#{item}
+					</foreach>
+				</when>
+			</choose>
+		</if>
+		<if test="accountNo != null and accountNo != ''">
+		   AND CR.ACCOUNT_NO = #{accountNo}
+		</if>
+		<if test="bankCd != null and bankCd != ''">
+		   AND CR.BANK_CD = #{bankCd}
+		</if>
+		<if test="stDate != null and stDate != '' and edDate != null and edDate != ''">
+			<choose>
+				<when test="searchDateGb == 'regDt'">
+		   AND CR.REG_DT BETWEEN CONCAT(#{stDate}, ' 00:00:00') AND CONCAT(#{edDate}, ' 23:59:59')
+				</when>
+				<when test="searchDateGb == 'depositDt'">
+		   AND CR.DEPOSIT_DT BETWEEN CONCAT(#{stDate}, ' 00:00:00') AND CONCAT(#{edDate}, ' 23:59:59')
+				</when>
+			</choose>
+		</if>
+		 ORDER BY CR.CASH_REFUND_SQ DESC
+	</select>
+	
+	<!-- 현금환불정보 수정 -->
+	<update id="updateCashRefundInfo" parameterType="OrderChange">
+		/* TscOrderChange.updateCashRefundInfo */
+		UPDATE TB_CASH_REFUND
+		   SET DEPOSIT_YN = #{depositYn}
+		<if test='depositYn == "Y"'>
+		     , DEPOSIT_DT = NOW()
+		</if>
+		     , BANK_CD = #{bankCd}
+		     , ACCOUNT_NO = #{accountNo}
+		     , ACCOUNT_NM = #{accountNm}
+		     , UPD_NO = #{updNo}
+		     , UPD_DT = NOW()
+		 WHERE CASH_REFUND_SQ = #{cashRefundSq}
+	</update>
+	
+	<!-- 현금환불관리 CS메모 수정 -->
+	<update id="updateCsMemo" parameterType="OrderChange">
+		/* TscOrderChange.updateCsMemo */
+		UPDATE TB_ORDER_CHANGE
+		   SET CHG_MEMO = #{chgMemo}
+		     , UPD_NO = #{updNo}
+		     , UPD_DT = NOW()
+		 WHERE ORD_CHG_SQ = #{ordChgSq}
+	</update>
+	
+	<!-- 현금환불 입금 완료 처리 -->
+	<update id="completeCashRefund" parameterType="OrderChange">
+		/* TscOrderChange.completeCashRefund */
+		UPDATE TB_CASH_REFUND
+		   SET DEPOSIT_YN = 'Y'
+		     , DEPOSIT_DT = NOW()
+		     , UPD_NO = #{updNo}
+		     , UPD_DT = NOW()
+		 WHERE CASH_REFUND_SQ = #{cashRefundSq}
+		   AND DEPOSIT_YN = 'N'
+	</update>
 </mapper>
 
 

+ 1 - 0
src/main/java/com/style24/persistence/mybatis/shop/TscScm.xml

@@ -119,6 +119,7 @@
 		                 , CASE WHEN P.PG_GB = 'KCP' THEN FN_GET_CODE_NM('G014', P.PAY_MEANS)
 		                        WHEN P.PG_GB = 'ISTYLE' THEN '상품권'
 		                        ELSE FN_GET_CODE_NM('G015', P.PG_GB) END AS PAY_MEANS_NM
+		                 , P.CARD_PCABLE_YN
 		                 , O.ORD_PHNNO
 		                 , DA.RECIP_NM
 		                 , DA.RECIP_PHNNO