Parcourir la source

오류 수정

card007 il y a 5 ans
Parent
commit
9be7097166

+ 17 - 12
src/main/java/com/style24/core/biz/service/TscOrderChangeService.java

@@ -292,13 +292,15 @@ public class TscOrderChangeService {
 						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.ORD_USE_POINT_CANCEL.value());
@@ -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());
@@ -707,7 +711,7 @@ public class TscOrderChangeService {
 						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;
@@ -750,7 +754,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;
@@ -2517,6 +2521,7 @@ public class TscOrderChangeService {
 				order.setOrdCanChgQty(cnclRtnReqQtyArr[index]);
 			} else {
 				order.setOrdCanChgQty(0);
+				order.setRtnDelvFee(0);
 			}
 
 			cnclReqList.add(order);

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

@@ -2198,13 +2198,13 @@
 	
 	<!-- 마이페이지 사용포인트 원복 수정  -->
 	<update id="updateCustPointRollback" parameterType="Order">
-		/* TscOrderChange.createCustPointHstRollback */
+		/* TscOrderChange.updateCustPointRollback */
 		UPDATE TB_CUST_POINT
 		   SET US_PNT_AMT = US_PNT_AMT - #{pntAmt}
 		     , RM_PNT_AMT = RM_PNT_AMT + #{pntAmt}
 		     , UPD_NO = #{updNo}
 		     , UPD_DT = NOW()
-		 WHERE CUST_PNT_SQ = #{CUST_PNT_SQ}
+		 WHERE CUST_PNT_SQ = #{custPntSq}
 	</update>
 
 	<!-- 마이페이지 상품쿠폰 원복 수정 -->