|
|
@@ -289,19 +289,21 @@ public class TscOrderChangeService {
|
|
|
|
|
|
// 3-2-3. 사용포인트원복
|
|
|
int pntDcAmt = vo.getPntDcAmt();
|
|
|
- vo.setOccurGb(TscConstants.PointOccurGb.USE_POINT.value());
|
|
|
+ vo.setOccurGb(TscConstants.PointOccurGb.ORD_USE_POINT.value());
|
|
|
|
|
|
for (Order point : orderChangeDao.getCustPointHst(vo)) {
|
|
|
- while (pntDcAmt > 0) {
|
|
|
- if (pntDcAmt < (point.getPntAmt() * -1)) {
|
|
|
- point.setPntAmt(pntDcAmt * -1);
|
|
|
+ if (pntDcAmt > 0) {
|
|
|
+ int pntAmt = point.getPntAmt() * -1;
|
|
|
+
|
|
|
+ if (pntDcAmt < pntAmt) {
|
|
|
+ point.setPntAmt(pntDcAmt);
|
|
|
pntDcAmt -= pntDcAmt;
|
|
|
} else {
|
|
|
- point.setPntAmt(point.getPntAmt() * -1);
|
|
|
- pntDcAmt -= (point.getPntAmt() * -1);
|
|
|
+ point.setPntAmt(pntAmt);
|
|
|
+ pntDcAmt -= pntAmt;
|
|
|
}
|
|
|
|
|
|
- point.setOccurGb(TscConstants.PointOccurGb.USE_POINT_CANCEL.value());
|
|
|
+ point.setOccurGb(TscConstants.PointOccurGb.ORD_USE_POINT_CANCEL.value());
|
|
|
point.setPntUploadStat(TscConstants.PntUploadStat.APPLY_COMPLETE.value());
|
|
|
point.setOccurDtlDesc("포인트사용취소");
|
|
|
point.setRegNo(userNo);
|
|
|
@@ -339,12 +341,15 @@ public class TscOrderChangeService {
|
|
|
int gfcdUseAmt = vo.getGfcdUseAmt();
|
|
|
|
|
|
for (Order giftCard : orderChangeDao.getCustGiftCardHst(vo)) {
|
|
|
- while (gfcdUseAmt > 0) {
|
|
|
- if (gfcdUseAmt < (giftCard.getGfcdAmt() * -1)) {
|
|
|
+ if (gfcdUseAmt > 0) {
|
|
|
+ int gfcdAmt = giftCard.getGfcdAmt() * -1;
|
|
|
+
|
|
|
+ if (gfcdUseAmt < gfcdAmt) {
|
|
|
giftCard.setGfcdAmt(gfcdUseAmt);
|
|
|
gfcdUseAmt -= gfcdUseAmt;
|
|
|
} else {
|
|
|
- gfcdUseAmt -= (giftCard.getGfcdAmt() * -1);
|
|
|
+ giftCard.setGfcdAmt(gfcdAmt);
|
|
|
+ gfcdUseAmt -= gfcdAmt;
|
|
|
}
|
|
|
|
|
|
giftCard.setOccurGb(TscConstants.GiftCardOccurGb.USE_GIFTCARD_CANCEL.value());
|
|
|
@@ -404,8 +409,7 @@ public class TscOrderChangeService {
|
|
|
if ("Y".equals(obj.getLastCanYn())) {
|
|
|
spanRefundAmt += sumDeliveryFee; // 환불금액 계산
|
|
|
addDelvFee = sumDeliveryFee; // 추가배송비 계산
|
|
|
-
|
|
|
- // TODO
|
|
|
+
|
|
|
// TB_DELIVERY_FEE 배송비 취소 처리
|
|
|
Order cancelDelvFee = new Order();
|
|
|
// cancelDelvFee.setPaySq(pg.getPaySq());
|
|
|
@@ -437,10 +441,11 @@ public class TscOrderChangeService {
|
|
|
pg.setPgTid(pgTid);
|
|
|
pg.setPayMeans(payMeans);
|
|
|
pg.setPartCancelAmt(spanRefundAmt);
|
|
|
- pg.setLeftAmt(payAmt);
|
|
|
+ pg.setLeftAmt(orderChangeDao.getLeftAmt(ordNo));
|
|
|
pg.setRegNo(userNo);
|
|
|
pg.setUpdNo(userNo);
|
|
|
-
|
|
|
+ log.info("cancelAmt >>> {}", pg.getPartCancelAmt());
|
|
|
+ log.info("leftAmt >>> {}", pg.getLeftAmt());
|
|
|
if (spanRefundAmt > 0) {
|
|
|
pgList.add(pg);
|
|
|
}
|
|
|
@@ -704,10 +709,10 @@ public class TscOrderChangeService {
|
|
|
|
|
|
// 5.3.3 사용포인트원복
|
|
|
int pntDcAmt = vo.getPntDcAmt();
|
|
|
- vo.setOccurGb(TscConstants.PointOccurGb.USE_POINT.value());
|
|
|
+ vo.setOccurGb(TscConstants.PointOccurGb.ORD_USE_POINT.value());
|
|
|
|
|
|
for (Order point : orderChangeDao.getCustPointHst(vo)) {
|
|
|
- while (pntDcAmt > 0) {
|
|
|
+ if (pntDcAmt > 0) {
|
|
|
if (pntDcAmt < point.getPntAmt()) {
|
|
|
point.setPntAmt(pntDcAmt);
|
|
|
pntDcAmt -= pntDcAmt;
|
|
|
@@ -715,7 +720,7 @@ public class TscOrderChangeService {
|
|
|
pntDcAmt -= point.getPntAmt();
|
|
|
}
|
|
|
|
|
|
- point.setOccurGb(TscConstants.PointOccurGb.USE_POINT_CANCEL.value());
|
|
|
+ point.setOccurGb(TscConstants.PointOccurGb.ORD_USE_POINT_CANCEL.value());
|
|
|
point.setOccurDtlDesc("포인트사용취소");
|
|
|
point.setRegNo(userNo);
|
|
|
point.setUpdNo(userNo);
|
|
|
@@ -750,7 +755,7 @@ public class TscOrderChangeService {
|
|
|
int gfcdUseAmt = vo.getGfcdUseAmt();
|
|
|
|
|
|
for (Order giftCard : orderChangeDao.getCustGiftCardHst(vo)) {
|
|
|
- while (gfcdUseAmt > 0) {
|
|
|
+ if (gfcdUseAmt > 0) {
|
|
|
if (gfcdUseAmt < giftCard.getGfcdAmt()) {
|
|
|
giftCard.setGfcdAmt(gfcdUseAmt);
|
|
|
gfcdUseAmt -= gfcdUseAmt;
|
|
|
@@ -2222,11 +2227,11 @@ public class TscOrderChangeService {
|
|
|
// 2. 사용포인트원복
|
|
|
Order vo = new Order();
|
|
|
vo.setOrdNo(ordNo);
|
|
|
- vo.setOccurGb(TscConstants.PointOccurGb.USE_POINT.value());
|
|
|
+ vo.setOccurGb(TscConstants.PointOccurGb.ORD_USE_POINT.value());
|
|
|
vo.setUpdNo(updNo);
|
|
|
|
|
|
for (Order point : orderChangeDao.getCustPointHst(vo)) {
|
|
|
- point.setOccurGb(TscConstants.PointOccurGb.USE_POINT_CANCEL.value());
|
|
|
+ point.setOccurGb(TscConstants.PointOccurGb.ORD_USE_POINT_CANCEL.value());
|
|
|
point.setPntUploadStat(TscConstants.PntUploadStat.APPLY_COMPLETE.value());
|
|
|
point.setOccurDtlDesc("포인트사용취소");
|
|
|
point.setPntAmt(point.getPntAmt() * -1);
|
|
|
@@ -2517,6 +2522,7 @@ public class TscOrderChangeService {
|
|
|
order.setOrdCanChgQty(cnclRtnReqQtyArr[index]);
|
|
|
} else {
|
|
|
order.setOrdCanChgQty(0);
|
|
|
+ order.setRtnDelvFee(0);
|
|
|
}
|
|
|
|
|
|
cnclReqList.add(order);
|