| 
					
				 | 
			
			
				@@ -184,7 +184,9 @@ public class BackPolicyUtil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                                                                         long rechargeMoney, boolean isFirstOrder, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                                                                         LocalDateTime payTime, LocalDateTime regTime, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                                                                                         String userId, IBackPolicyCheck backPolicyCheck) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Tuple2<Long, Long> backInfo = backPolicyCheck.backCountForUserWithSplitOrder(userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         BigDecimal rechargeAmount = NumberUtil.divide100(new BigDecimal(rechargeMoney)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        BigDecimal rechargeSumAmount = NumberUtil.divide100(new BigDecimal(backInfo.second)).add(rechargeAmount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (policyOfSumRecharge.getRegPayIntervalTime() != null 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 && ((DateUtil.localDateTimeToSecond(payTime) - DateUtil.localDateTimeToSecond(regTime)) / 60) > policyOfSumRecharge.getRegPayIntervalTime()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             log.error("订单 id[{}]通过回传策略[{}]判断后,超过注册充值间隔时间({}),不回传", orderId, policyId, policyOfSumRecharge.getRegPayIntervalTime()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -192,23 +194,22 @@ public class BackPolicyUtil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         BackPolicyOfSumRecharge.RechargeLevel rechargeLevel = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for (BackPolicyOfSumRecharge.RechargeLevel item : policyOfSumRecharge.getRechargeLevelList()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (rechargeAmount.compareTo(item.getMinAmount()) >= 0 && rechargeAmount.compareTo(item.getMaxAmount()) < 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (rechargeSumAmount.compareTo(item.getMinAmount()) >= 0 && rechargeSumAmount.compareTo(item.getMaxAmount()) < 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 rechargeLevel = item; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (rechargeLevel == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             log.error("订单 id[{}]通过回传策略[{}]判断后,找不到对应的累充挡位,不回传", orderId, policyId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return Tuples.tuple(Boolean.FALSE, rechargeMoney, "充值金额(" + rechargeAmount + ")未找到对应的挡位,默认不回传", null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return Tuples.tuple(Boolean.FALSE, rechargeMoney, "累充金额(" + rechargeSumAmount + ")未找到对应的挡位,默认不回传", null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Tuple2<Long, Long> backInfo = backPolicyCheck.backCountForUserWithSplitOrder(userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (rechargeLevel.getBackCountOfUser() <= backInfo.first) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             log.error("订单 id[{}]通过回传策略[{}]判断后,已达到回传的订单数,不回传", orderId, policyId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return Tuples.tuple(Boolean.FALSE, rechargeMoney, "充值金额(" + rechargeAmount + ")已达到回传的订单数(已回传:" + backInfo.first + "笔,当前挡位:" + rechargeLevel.getBackCountOfUser() + "笔),不回传", null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return Tuples.tuple(Boolean.FALSE, rechargeMoney, "累值金额(" + rechargeSumAmount + ")已达到回传的订单数(已回传:" + backInfo.first + "笔,当前挡位:" + rechargeLevel.getBackCountOfUser() + "笔),不回传", null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         long backCount = rechargeLevel.getBackCountOfUser() - backInfo.first; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        long backMoney = backInfo.second - NumberUtil.multiply100(rechargeLevel.getMinAmount()).longValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        long backMoney = NumberUtil.multiply100(rechargeSumAmount.subtract(rechargeLevel.getMinAmount())).longValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (backMoney <= 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // 最低回传一分钱 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             backMoney = 1; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -217,7 +218,7 @@ public class BackPolicyUtil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for (int i = 0; i < backCount; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             splitOrder.add(Tuple2.with(backMoney, LocalDateTime.now())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        String backMsg = "充值金额(" + rechargeAmount + ") 已回传:" + backInfo.first + "笔,当前挡位:" + rechargeLevel.getBackCountOfUser() + "笔,回传(" + backCount + "-" + backMoney + ")笔"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String backMsg = "累充金额(" + rechargeSumAmount + ") 已回传:" + backInfo.first + "笔,当前挡位:" + rechargeLevel.getBackCountOfUser() + "笔,回传(" + backCount + "-" + backMoney + ")笔"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         log.error("订单 id[{}]通过回传策略[{}]判断后,回传。回传日志:{}", orderId, policyId, backMsg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return Tuples.tuple(Boolean.TRUE, rechargeMoney, backMsg, splitOrder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 |