zoujiajian 1 an în urmă
părinte
comite
9b1247be05

+ 5 - 2
netflix-service/src/main/java/com/cyksj/service/order/impl/OrderDonServiceImpl.java

@@ -2694,7 +2694,7 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 		deductGalaxyCoinPayOrderMoney(orderDon, sku, galaxyCoin, user);
 	}
 
-	private void deductGalaxyCoinPayOrderMoney(OrderDon orderDon, GoodsDonSku sku, BigDecimal toUseGalaxyCoin, User user) {
+	public void deductGalaxyCoinPayOrderMoney(OrderDon orderDon, GoodsDonSku sku, BigDecimal toUseGalaxyCoin, User user) {
 		//存在银河币
 		if (toUseGalaxyCoin != null && toUseGalaxyCoin.compareTo(BigDecimal.ZERO) > 0) {
 			BigDecimal userGalaxyCoin = user.getGalaxyCoin();
@@ -2743,6 +2743,9 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 				//需要使用的银河币
 				BigDecimal userFinalUseGalaxyCoin = subGalxyCoin;
 				for (UserGalaxyCoinRecord galaxyCoinRecord : availableGalaxyCoinList) {
+					if (userFinalUseGalaxyCoin.compareTo(BigDecimal.ZERO) <= 0) {
+						break;
+					}
 					BigDecimal remainGalaxyCoin = galaxyCoinRecord.getRemainGalaxyCoin();
 					Long galaxyCoinRecordId = galaxyCoinRecord.getId();
 					//扣完
@@ -4958,7 +4961,7 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 		}
 	}
 
-	private void returnGalaxyCoin(OrderDon orderDon) {
+	public void returnGalaxyCoin(OrderDon orderDon) {
 		if (orderDon.getMoney().compareTo(BigDecimal.ZERO) > 0) {
 			Long userId = orderDon.getUserId();
 			BigDecimal money = orderDon.getMoney();

+ 5 - 2
netflix-service/src/main/java/com/cyksj/service/order/impl/VipOrderDonServiceImpl.java

@@ -473,7 +473,7 @@ public class VipOrderDonServiceImpl extends ServiceImpl<VipOrderDonMapper, VipOr
 		deductGalaxyCoinPayOrderMoney(orderDon, payRequest.getGalaxyCoin(), user, actuallyPayMoney);
 	}
 
-	private void deductGalaxyCoinPayOrderMoney(VipOrderDon orderDon, BigDecimal toUseGalaxyCoin, User user, BigDecimal actuallyPayMoney) {
+	public void deductGalaxyCoinPayOrderMoney(VipOrderDon orderDon, BigDecimal toUseGalaxyCoin, User user, BigDecimal actuallyPayMoney) {
 		//存在银河币
 		if (toUseGalaxyCoin != null && toUseGalaxyCoin.compareTo(BigDecimal.ZERO) > 0) {
 			BigDecimal userGalaxyCoin = user.getGalaxyCoin();
@@ -521,6 +521,9 @@ public class VipOrderDonServiceImpl extends ServiceImpl<VipOrderDonMapper, VipOr
 				//需要使用的银河币
 				BigDecimal userFinalUseGalaxyCoin = subGalxyCoin;
 				for (UserGalaxyCoinRecord galaxyCoinRecord : availableGalaxyCoinList) {
+					if (userFinalUseGalaxyCoin.compareTo(BigDecimal.ZERO) <= 0) {
+						break;
+					}
 					BigDecimal remainGalaxyCoin = galaxyCoinRecord.getRemainGalaxyCoin();
 					Long galaxyCoinRecordId = galaxyCoinRecord.getId();
 					//扣完
@@ -830,7 +833,7 @@ public class VipOrderDonServiceImpl extends ServiceImpl<VipOrderDonMapper, VipOr
 		return userPlatDistributeRate;
 	}
 
-	private void deductUserGalaxyCoin(Long galaxyCoinRecordId, BigDecimal deductGalaxyCoin, BigDecimal remainGalaxyCoin, boolean isUsed) {
+	public void deductUserGalaxyCoin(Long galaxyCoinRecordId, BigDecimal deductGalaxyCoin, BigDecimal remainGalaxyCoin, boolean isUsed) {
 		Integer update = userGalaxyCoinRecordMapper.update(null, Wrappers.lambdaUpdate(UserGalaxyCoinRecord.class)
 				.set(UserGalaxyCoinRecord::getRemainGalaxyCoin, remainGalaxyCoin.subtract(deductGalaxyCoin))
 				.set(isUsed, UserGalaxyCoinRecord::getIsUsed, isUsed)