구독서비스 결제 - 결제취소 처리 후 재고 및 상태 변경
This commit is contained in:
@@ -33,6 +33,8 @@ public interface BOSubsvcMapper {
|
||||
|
||||
/** 구독서비스 주문에 따른 판매재고수량 수정*/
|
||||
public void updateSubsvcOrdrUsefulInvntryQy(BOSubsvcVO vo);
|
||||
/** 구독서비스 환불에 따른 판매재고수량 수정*/
|
||||
public void updateSubsvcRefundUsefulInvntryQy(BOSubsvcVO vo);
|
||||
/** 판매재고수량 변경에 따른 구독서비스 상태 수정*/
|
||||
public void updateInvntryPolicySubsvcSttusChng(BOSubsvcVO vo);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package com.wb.domainserver.domain.gcone.goods.subsvc.service;
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
import com.wb.domainserver.domain.gcone.goods.purchs.vo.BOOrderVO;
|
||||
import com.wb.domainserver.domain.gcone.goods.subsvc.mapper.BOSubsvcMapper;
|
||||
import com.wb.domainserver.domain.gcone.goods.subsvc.vo.BOSubsvcVO;
|
||||
import com.wb.domainserver.domain.gcone.ordr.ordr.vo.BOOrdrVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import io.micrometer.common.util.StringUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -142,18 +141,33 @@ public class BOSubsvcService {
|
||||
|
||||
/**
|
||||
* 주문에 따른 판매재고수량 수정
|
||||
* @param orderVO
|
||||
* @param ordrVO
|
||||
* @return
|
||||
*/
|
||||
@Transactional
|
||||
public void updateSubsvcOrdrUsefulInvntryQy(BOOrderVO orderVO) throws Exception {
|
||||
public void updateSubsvcOrdrUsefulInvntryQy(BOOrdrVO ordrVO) throws Exception {
|
||||
BOSubsvcVO subsvcVO = new BOSubsvcVO();
|
||||
BeanUtils.copyProperties(orderVO, subsvcVO);
|
||||
subsvcVO.setSubsvcInnb(orderVO.getSubsvcInnb().toString());
|
||||
BeanUtils.copyProperties(ordrVO, subsvcVO);
|
||||
|
||||
//판매수량 수정
|
||||
mapper.updateSubsvcOrdrUsefulInvntryQy(subsvcVO);
|
||||
//구독서비스 상태 수정
|
||||
mapper.updateInvntryPolicySubsvcSttusChng(subsvcVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 환불에 따른 판매재고수량 수정
|
||||
* @param ordrVO
|
||||
* @return
|
||||
*/
|
||||
@Transactional
|
||||
public void updateSubsvcRefundUsefulInvntryQy(BOOrdrVO ordrVO) throws Exception {
|
||||
BOSubsvcVO subsvcVO = new BOSubsvcVO();
|
||||
BeanUtils.copyProperties(ordrVO, subsvcVO);
|
||||
|
||||
//판매수량 수정
|
||||
mapper.updateSubsvcRefundUsefulInvntryQy(subsvcVO);
|
||||
//구독서비스 상태 수정
|
||||
mapper.updateInvntryPolicySubsvcSttusChng(subsvcVO);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ private static final long serialVersionUID = 1L;
|
||||
/** 회원구분코드 */
|
||||
private String mbrDvCd;
|
||||
/** 주문고유번호 */
|
||||
private BigInteger ordrInnb;
|
||||
private String ordrInnb;
|
||||
|
||||
|
||||
/** 결제상품정보 */
|
||||
|
||||
@@ -1,53 +1,45 @@
|
||||
package com.wb.domainserver.domain.gcone.ordr.rtngudrefnd.service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.wb.domainserver.domain.gcone.goods.goods.service.BOGoodsService;
|
||||
import com.wb.domainserver.domain.gcone.goods.purchs.mapper.BOPurchsMapper;
|
||||
import com.wb.domainserver.domain.gcone.goods.purchs.service.BOOrderService;
|
||||
import com.wb.domainserver.domain.gcone.goods.purchs.vo.BOOrderLogVO;
|
||||
import com.wb.domainserver.domain.gcone.goods.subsvc.service.BOSubsvcService;
|
||||
import com.wb.domainserver.domain.gcone.mbr.mlg.service.BOMlgService;
|
||||
import com.wb.domainserver.domain.gcone.mbr.mlg.vo.BOCashVO;
|
||||
import com.wb.domainserver.domain.gcone.mbr.mlg.vo.BOMlgVO;
|
||||
import com.wb.domainserver.domain.gcone.ntcn.mssage.service.BOMssageService;
|
||||
import com.wb.domainserver.domain.gcone.ordr.ordr.mapper.BOOrdrMapper;
|
||||
import com.wb.domainserver.domain.gcone.ordr.ordr.service.BOOrdrService;
|
||||
import com.wb.domainserver.domain.gcone.ordr.ordr.vo.BOOrdrDlvyVO;
|
||||
import com.wb.domainserver.domain.gcone.ordr.ordr.vo.BOOrdrRefundVO;
|
||||
import com.wb.domainserver.domain.gcone.ordr.ordr.vo.BOOrdrVO;
|
||||
import com.wb.domainserver.domain.gcone.ordr.pay.service.BOPayService;
|
||||
import com.wb.domainserver.domain.gcone.ordr.pay.vo.BOPayVO;
|
||||
import com.wb.domainserver.domain.gcone.ordr.rtngudrefnd.mapper.BORtngudrefndMapper;
|
||||
import com.wb.domainserver.domain.gcone.ordr.rtngudrefnd.vo.BOOrderReItemVO;
|
||||
import com.wb.domainserver.domain.gcone.ordr.rtngudrefnd.vo.BORefundSetleVO;
|
||||
import com.wb.domainserver.domain.gcone.ordr.rtngudrefnd.vo.BORtngudrefndSrchVO;
|
||||
import com.wb.domainserver.domain.gcone.ordr.rtngudrefnd.vo.BORtngudrefndVO;
|
||||
import com.wb.domainserver.domain.gcone.ordr.selngpruf.service.BOSelngprufService;
|
||||
import com.wb.domainserver.domain.gcone.ordr.selngpruf.vo.BOSelngprufVO;
|
||||
import com.wb.domainserver.domain.gcone.promtn.coupon.service.BOCouponService;
|
||||
import com.wb.domainserver.domain.gcone.promtn.coupon.vo.BODwldCouponVO;
|
||||
import com.wb.domainserver.domain.gcone.setup.site.mapper.BOSiteMapper;
|
||||
import com.wb.domainserver.domain.gcone.setup.site.vo.BOSetupContentsItemVO;
|
||||
import com.wb.domainserver.exception.WnbtRestException;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import com.wb.domainserver.util.string.StringUtil;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.wb.domainserver.domain.admin.sys.comncd.service.BOMaComncdService;
|
||||
import com.wb.domainserver.domain.gcone.ordr.rtngudrefnd.mapper.BORtngudrefndMapper;
|
||||
import com.wb.domainserver.domain.gcone.ordr.rtngudrefnd.vo.BORtngudrefndSrchVO;
|
||||
import com.wb.domainserver.domain.gcone.ordr.rtngudrefnd.vo.BORtngudrefndVO;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.support.WebExchangeBindException;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -87,6 +79,9 @@ public class BORtngudrefndService {
|
||||
@Autowired
|
||||
private BOOrderService orderService;
|
||||
|
||||
@Autowired
|
||||
private BOSubsvcService subsvcService;
|
||||
|
||||
@Autowired
|
||||
private BORtngudrefndMapper mapper;
|
||||
|
||||
@@ -1331,7 +1326,18 @@ public class BORtngudrefndService {
|
||||
if ("0".equals(message.get("status"))) {
|
||||
|
||||
// ########################################### 상품 재고 ###########################################
|
||||
boGoodsService.updateRefundUsefulInvntryQy(refundVO);
|
||||
BOOrdrVO ordrVO = new BOOrdrVO();
|
||||
ordrVO.setOrdrInnb(refundVO.getOrdrInnb());
|
||||
ordrVO.setSopmalCd(refundVO.getSopmalCd());
|
||||
|
||||
DataMap ordrDtl = ordrMapper.selectOrdrDtl(ordrVO);
|
||||
boolean subsvcAt = "Y".equals(ordrDtl.get("subsvcAt"));
|
||||
if(subsvcAt) {
|
||||
ordrVO.setSubsvcInnb(ordrDtl.get("subsvcInnb").toString());
|
||||
subsvcService.updateSubsvcRefundUsefulInvntryQy(ordrVO);
|
||||
} else {
|
||||
boGoodsService.updateRefundUsefulInvntryQy(refundVO);
|
||||
}
|
||||
|
||||
|
||||
// ########################################### 쿠폰 복원 ###########################################
|
||||
|
||||
@@ -2905,8 +2905,8 @@ public class OrdrController {
|
||||
DataMap ordrDtl = (DataMap) service.selectOrdrDtlInqire(ordrVO).get("dtl");
|
||||
boolean subsvcAt = "Y".equals(ordrDtl.get("subsvcAt"));
|
||||
if(subsvcAt) {
|
||||
orderVO.setSubsvcInnb(((Number) ordrDtl.get("subsvcInnb")).intValue());
|
||||
subsvcService.updateSubsvcOrdrUsefulInvntryQy(orderVO);
|
||||
ordrVO.setSubsvcInnb(ordrDtl.get("subsvcInnb").toString());
|
||||
subsvcService.updateSubsvcOrdrUsefulInvntryQy(ordrVO);
|
||||
} else {
|
||||
boGoodsService.updateOrdrUsefulInvntryQy(orderVO);
|
||||
}
|
||||
|
||||
@@ -334,6 +334,28 @@
|
||||
]]>
|
||||
</update>
|
||||
|
||||
<!-- 구독서비스 환불에 따른 판매재고수량 수정 -->
|
||||
<update id="updateSubsvcRefundUsefulInvntryQy" parameterType="com.wb.domainserver.domain.gcone.goods.subsvc.vo.BOSubsvcVO">
|
||||
<![CDATA[
|
||||
UPDATE GC_SUBSVC GS
|
||||
INNER JOIN (
|
||||
SELECT
|
||||
GO.SUBSVC_INNB,
|
||||
SUM(CASE WHEN GOR.REFUND_TY_CD = '01' THEN 1 ELSE 0 END) AS REFUND_QY
|
||||
FROM GC_ORDER GO
|
||||
INNER JOIN GC_ORDER_REFUND GOR
|
||||
ON GO.ORDR_INNB = GOR.ORDR_INNB
|
||||
WHERE GO.SOPMAL_CD = #{sopmalCd}
|
||||
AND GO.ORDR_INNB = #{ordrInnb}
|
||||
GROUP BY
|
||||
GO.SUBSVC_INNB
|
||||
) SUBQUERY
|
||||
ON GS.SUBSVC_INNB = SUBQUERY.SUBSVC_INNB
|
||||
SET GS.USEFUL_INVNTRY_QY = IFNULL(GS.USEFUL_INVNTRY_QY, 0) - SUBQUERY.REFUND_QY
|
||||
WHERE GS.SUBSVC_INNB = SUBQUERY.SUBSVC_INNB
|
||||
]]>
|
||||
</update>
|
||||
|
||||
<!-- 판매재고수량 변경에 따른 구독서비스 상태 수정 -->
|
||||
<update id="updateInvntryPolicySubsvcSttusChng" parameterType="com.wb.domainserver.domain.gcone.goods.subsvc.vo.BOSubsvcVO">
|
||||
<![CDATA[
|
||||
|
||||
Reference in New Issue
Block a user