zoujiajian vor 1 Jahr
Ursprung
Commit
b5f2047845

+ 7 - 7
netflix-service/src/main/java/com/cyksj/service/coin/impl/UserGalaxyCoinServiceImpl.java

@@ -146,9 +146,9 @@ public class UserGalaxyCoinServiceImpl implements UserGalaxyCoinService {
 			BigDecimal galaxyCoin = userGalaxyCoinRecord.getGalaxyCoin();
 			//扣除记录 对应的银河币不可用
 			log.info("订单退款,扣除该笔订单oid:{}返现的银河币", orderId);
-			BigDecimal remainGalaxyCoin = userGalaxyCoinRecord.getRemainGalaxyCoin();
+			BigDecimal thisReturnRemainGalaxyCoin = userGalaxyCoinRecord.getRemainGalaxyCoin();
 			//扣除其他
-			if (remainGalaxyCoin.compareTo(galaxyCoin) < 0) {
+			if (thisReturnRemainGalaxyCoin.compareTo(galaxyCoin) < 0) {
 				//银河币抵扣
 				List<UserGalaxyCoinRecord> availableGalaxyCoinList = userGalaxyCoinRecordMapper.selectList(Wrappers.lambdaQuery(UserGalaxyCoinRecord.class)
 						.eq(UserGalaxyCoinRecord::getUserId, userGalaxyCoinRecord.getUserId())
@@ -156,27 +156,27 @@ public class UserGalaxyCoinServiceImpl implements UserGalaxyCoinService {
 						.gt(UserGalaxyCoinRecord::getExpiryTime, DateTime.now())
 						.gt(UserGalaxyCoinRecord::getRemainGalaxyCoin, 0));
 				//需要使用的银河币
-				BigDecimal userFinalUseGalaxyCoin = galaxyCoin.subtract(remainGalaxyCoin).abs();
+				BigDecimal userFinalUseGalaxyCoin = galaxyCoin.subtract(thisReturnRemainGalaxyCoin);
 				for (UserGalaxyCoinRecord galaxyCoinRecord : availableGalaxyCoinList) {
 					if (userFinalUseGalaxyCoin.compareTo(BigDecimal.ZERO) <= 0) {
 						break;
 					}
-					BigDecimal thisRemainGalaxyCoin = galaxyCoinRecord.getRemainGalaxyCoin();
+					BigDecimal remainGalaxyCoin = galaxyCoinRecord.getRemainGalaxyCoin();
 					Long galaxyCoinRecordId = galaxyCoinRecord.getId();
 					//扣完
-					if (thisRemainGalaxyCoin.compareTo(userFinalUseGalaxyCoin) == 0) {
+					if (remainGalaxyCoin.compareTo(userFinalUseGalaxyCoin) == 0) {
 						//完全抵扣
 						Integer update = deductUserGalaxyCoin(galaxyCoinRecordId, remainGalaxyCoin, remainGalaxyCoin, true);
 						if (update == 1) {
 							userFinalUseGalaxyCoin = BigDecimal.ZERO;
 						}
-					} else if (thisRemainGalaxyCoin.compareTo(userFinalUseGalaxyCoin) < 0) {
+					} else if (remainGalaxyCoin.compareTo(userFinalUseGalaxyCoin) < 0) {
 						//不足以抵扣
 						Integer update = deductUserGalaxyCoin(galaxyCoinRecordId, remainGalaxyCoin, remainGalaxyCoin, true);
 						if (update == 1) {
 							userFinalUseGalaxyCoin = userFinalUseGalaxyCoin.subtract(remainGalaxyCoin);
 						}
-					} else if (thisRemainGalaxyCoin.compareTo(userFinalUseGalaxyCoin) > 0) {
+					} else if (remainGalaxyCoin.compareTo(userFinalUseGalaxyCoin) > 0) {
 						//足以抵扣
 						Integer update = deductUserGalaxyCoin(galaxyCoinRecordId, userFinalUseGalaxyCoin, remainGalaxyCoin, false);
 						if (update == 1) {

+ 26 - 26
netflix-service/src/main/java/com/cyksj/service/mange/impl/CmsOrderDonServiceImpl.java

@@ -577,19 +577,19 @@ public class CmsOrderDonServiceImpl extends ServiceImpl<OrderDonMapper,OrderDon>
 //            }
 
             //是否全额退款
-            BigDecimal orderDonRefundMoney = Optional.ofNullable(orderDon.getRefundMoney()).orElse(BigDecimal.ZERO);
-            BigDecimal orderDonRefundBalance = Optional.ofNullable(orderDon.getRefundBalance()).orElse(BigDecimal.ZERO);
-            if (orderDonRefundMoney.add(orderDonRefundBalance).compareTo(orderDon.getMoney().add(Optional.ofNullable(orderDon.getBalance()).orElse(BigDecimal.ZERO))) == 0) {
-                //是否使用银河币支付
-                OrderDonGalaxyCoinRecord orderDonGalaxyCoinRecord = orderDonGalaxyCoinRecordMapper.selectOne(Wrappers.lambdaQuery(OrderDonGalaxyCoinRecord.class)
-                        .eq(OrderDonGalaxyCoinRecord::getOrderId, orderDon.getId())
-                        .eq(OrderDonGalaxyCoinRecord::getSource, OrderDonGalaxyCoinRecord.Source.upgrade.ordinal())
-                        .last("limit 1"));
-                if (orderDonGalaxyCoinRecord != null) {
-                    //有效时,返还银河币 并记录
-                    userGalaxyCoinService.recordOrderRefundGalaxyCoinIfValid(orderDon.getId(), orderDonGalaxyCoinRecord.getUserId(), orderDonGalaxyCoinRecord.getGalaxyCoin().abs(), OrderDonGalaxyCoinRecord.Source.upgrade);
-                }
-            }
+//            BigDecimal orderDonRefundMoney = Optional.ofNullable(orderDon.getRefundMoney()).orElse(BigDecimal.ZERO);
+//            BigDecimal orderDonRefundBalance = Optional.ofNullable(orderDon.getRefundBalance()).orElse(BigDecimal.ZERO);
+//            if (orderDonRefundMoney.add(orderDonRefundBalance).compareTo(orderDon.getMoney().add(Optional.ofNullable(orderDon.getBalance()).orElse(BigDecimal.ZERO))) == 0) {
+//                //是否使用银河币支付
+//                OrderDonGalaxyCoinRecord orderDonGalaxyCoinRecord = orderDonGalaxyCoinRecordMapper.selectOne(Wrappers.lambdaQuery(OrderDonGalaxyCoinRecord.class)
+//                        .eq(OrderDonGalaxyCoinRecord::getOrderId, orderDon.getId())
+//                        .eq(OrderDonGalaxyCoinRecord::getSource, OrderDonGalaxyCoinRecord.Source.upgrade.ordinal())
+//                        .last("limit 1"));
+//                if (orderDonGalaxyCoinRecord != null) {
+//                    //有效时,返还银河币 并记录
+//                    userGalaxyCoinService.recordOrderRefundGalaxyCoinIfValid(orderDon.getId(), orderDonGalaxyCoinRecord.getUserId(), orderDonGalaxyCoinRecord.getGalaxyCoin().abs(), OrderDonGalaxyCoinRecord.Source.upgrade);
+//                }
+//            }
             //扣除 该笔订单产生的返现银河币
             if (orderDon.getMoney().compareTo(BigDecimal.ZERO) > 0) {
                 userGalaxyCoinService.subOrderGenerateGalaxyCoin(orderDon.getId(), OrderDonGalaxyCoinRecord.Source.upgrade);
@@ -1071,19 +1071,19 @@ public class CmsOrderDonServiceImpl extends ServiceImpl<OrderDonMapper,OrderDon>
             userBenefitsService.addUserBalance(orderDon.getUserId(), addBalance, UserBalanceSourceRecord.Source.refund, orderDon.getYhsId(), orderDon.getId(), goodsDon.getTitle() + UserBalanceSourceRecord.Source.refund.getDesc(), true);
         }
         //是否全额退款
-        BigDecimal orderDonRefundMoney = Optional.ofNullable(orderDon.getRefundMoney()).orElse(BigDecimal.ZERO);
-        BigDecimal orderDonRefundBalance = Optional.ofNullable(orderDon.getRefundBalance()).orElse(BigDecimal.ZERO);
-        if (orderDonRefundMoney.add(orderDonRefundBalance).compareTo(orderDon.getMoney().add(Optional.ofNullable(orderDon.getBalance()).orElse(BigDecimal.ZERO))) == 0) {
-            //是否使用银河币支付
-            OrderDonGalaxyCoinRecord orderDonGalaxyCoinRecord = orderDonGalaxyCoinRecordMapper.selectOne(Wrappers.lambdaQuery(OrderDonGalaxyCoinRecord.class)
-                    .eq(OrderDonGalaxyCoinRecord::getSource, OrderDonGalaxyCoinRecord.Source.ordinary.ordinal())
-                    .eq(OrderDonGalaxyCoinRecord::getOrderId, orderDon.getId())
-                    .last("limit 1"));
-            if (orderDonGalaxyCoinRecord != null) {
-                //有效时,返还银河币 并记录
-                userGalaxyCoinService.recordOrderRefundGalaxyCoinIfValid(orderDon.getId(), orderDonGalaxyCoinRecord.getUserId(), orderDonGalaxyCoinRecord.getGalaxyCoin().abs(), OrderDonGalaxyCoinRecord.Source.ordinary);
-            }
-        }
+//        BigDecimal orderDonRefundMoney = Optional.ofNullable(orderDon.getRefundMoney()).orElse(BigDecimal.ZERO);
+//        BigDecimal orderDonRefundBalance = Optional.ofNullable(orderDon.getRefundBalance()).orElse(BigDecimal.ZERO);
+//        if (orderDonRefundMoney.add(orderDonRefundBalance).compareTo(orderDon.getMoney().add(Optional.ofNullable(orderDon.getBalance()).orElse(BigDecimal.ZERO))) == 0) {
+//            //是否使用银河币支付
+//            OrderDonGalaxyCoinRecord orderDonGalaxyCoinRecord = orderDonGalaxyCoinRecordMapper.selectOne(Wrappers.lambdaQuery(OrderDonGalaxyCoinRecord.class)
+//                    .eq(OrderDonGalaxyCoinRecord::getSource, OrderDonGalaxyCoinRecord.Source.ordinary.ordinal())
+//                    .eq(OrderDonGalaxyCoinRecord::getOrderId, orderDon.getId())
+//                    .last("limit 1"));
+//            if (orderDonGalaxyCoinRecord != null) {
+//                //有效时,返还银河币 并记录
+//                userGalaxyCoinService.recordOrderRefundGalaxyCoinIfValid(orderDon.getId(), orderDonGalaxyCoinRecord.getUserId(), orderDonGalaxyCoinRecord.getGalaxyCoin().abs(), OrderDonGalaxyCoinRecord.Source.ordinary);
+//            }
+//        }
 
         //扣除 该笔订单产生的返现银河币
         if (orderDon.getMoney().compareTo(BigDecimal.ZERO) > 0) {

+ 13 - 13
netflix-service/src/main/java/com/cyksj/service/mange/vip/impl/CmsVipOrderServiceImpl.java

@@ -103,19 +103,19 @@ public class CmsVipOrderServiceImpl implements CmsVipOrderService {
 //			userBenefitsService.addUserBalance(orderDon.getUserId(), addBalance, UserBalanceSourceRecord.Source.vip_refund, null, orderDon.getId(), orderDon.getPayTitle() + UserBalanceSourceRecord.Source.vip_refund.getDesc(), true);
 //		}
 		//是否全额退款
-		BigDecimal orderDonRefundMoney = Optional.ofNullable(orderDon.getRefundMoney()).orElse(BigDecimal.ZERO);
-		BigDecimal orderDonRefundBalance = Optional.ofNullable(orderDon.getRefundBalance()).orElse(BigDecimal.ZERO);
-		if (orderDonRefundMoney.add(orderDonRefundBalance).compareTo(orderDon.getMoney().add(Optional.ofNullable(orderDon.getBalance()).orElse(BigDecimal.ZERO))) == 0) {
-			//是否使用银河币支付
-			OrderDonGalaxyCoinRecord orderDonGalaxyCoinRecord = orderDonGalaxyCoinRecordMapper.selectOne(Wrappers.lambdaQuery(OrderDonGalaxyCoinRecord.class)
-					.eq(OrderDonGalaxyCoinRecord::getSource, OrderDonGalaxyCoinRecord.Source.vip.ordinal())
-					.eq(OrderDonGalaxyCoinRecord::getOrderId, orderDon.getId())
-					.last("limit 1"));
-			if (orderDonGalaxyCoinRecord != null) {
-				//有效时,返还银河币 并记录
-				userGalaxyCoinService.recordOrderRefundGalaxyCoinIfValid(orderDon.getId(), orderDonGalaxyCoinRecord.getUserId(), orderDonGalaxyCoinRecord.getGalaxyCoin().abs(), OrderDonGalaxyCoinRecord.Source.vip);
-			}
-		}
+//		BigDecimal orderDonRefundMoney = Optional.ofNullable(orderDon.getRefundMoney()).orElse(BigDecimal.ZERO);
+//		BigDecimal orderDonRefundBalance = Optional.ofNullable(orderDon.getRefundBalance()).orElse(BigDecimal.ZERO);
+//		if (orderDonRefundMoney.add(orderDonRefundBalance).compareTo(orderDon.getMoney().add(Optional.ofNullable(orderDon.getBalance()).orElse(BigDecimal.ZERO))) == 0) {
+//			//是否使用银河币支付
+//			OrderDonGalaxyCoinRecord orderDonGalaxyCoinRecord = orderDonGalaxyCoinRecordMapper.selectOne(Wrappers.lambdaQuery(OrderDonGalaxyCoinRecord.class)
+//					.eq(OrderDonGalaxyCoinRecord::getSource, OrderDonGalaxyCoinRecord.Source.vip.ordinal())
+//					.eq(OrderDonGalaxyCoinRecord::getOrderId, orderDon.getId())
+//					.last("limit 1"));
+//			if (orderDonGalaxyCoinRecord != null) {
+//				//有效时,返还银河币 并记录
+//				userGalaxyCoinService.recordOrderRefundGalaxyCoinIfValid(orderDon.getId(), orderDonGalaxyCoinRecord.getUserId(), orderDonGalaxyCoinRecord.getGalaxyCoin().abs(), OrderDonGalaxyCoinRecord.Source.vip);
+//			}
+//		}
 		//扣除 该笔订单产生的返现银河币
 		if (orderDon.getMoney().compareTo(BigDecimal.ZERO) > 0) {
 			userGalaxyCoinService.subOrderGenerateGalaxyCoin(orderDon.getId(), OrderDonGalaxyCoinRecord.Source.vip);