| 
					
				 | 
			
			
				@@ -3175,7 +3175,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Transactional(rollbackFor = Exception.class,isolation = Isolation.READ_COMMITTED) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public HttpResponseResult repay(Integer userId,Integer practiceGroupId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public HttpResponseResult repay(Integer userId,Integer practiceGroupId, boolean useBalancePayment) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if(Objects.isNull(practiceGroupId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             throw new BizException("请指定需要重新支付的课程组"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3207,13 +3207,44 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if(CollectionUtils.isEmpty(ingOrders)||ingOrders.size()<=0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return BaseController.failed(HttpStatus.FAILED_DEPENDENCY, "该课程组已失效,请重新购买"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            for (StudentPaymentOrder ingOrder : ingOrders) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                ingOrder.setStatus(DealStatusEnum.CLOSE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                ingOrder.setMemo("用户重新支付"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                studentPaymentOrderDao.update(ingOrder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        newOrder.setStatus(DealStatusEnum.ING); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        newOrder.setVersion(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        studentPaymentOrderService.insert(newOrder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(useBalancePayment || newOrder.getExpectAmount().doubleValue() == 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            SysUserCashAccount userCashAccount = sysUserCashAccountService.getLocked(userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(userCashAccount == null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                throw new BizException("用户账户找不到"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            newOrder.setPaymentChannel("BALANCE"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(userCashAccount.getBalance().subtract(newOrder.getExpectAmount()).doubleValue() >= 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // 更新订单信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                newOrder.setActualAmount(new BigDecimal(0)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                newOrder.setBalancePaymentAmount(newOrder.getExpectAmount()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                newOrder.setStatus(DealStatusEnum.SUCCESS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                newOrder.setUpdateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                newOrder.setOrganId(practiceGroup.getOrganId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                sysUserCashAccountService.updateBalance(userId, newOrder.getExpectAmount().negate(),PlatformCashAccountDetailTypeEnum.PAY_FEE,"网管课购买"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                this.orderCallback(newOrder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Map<String,Object> result=new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                result.put("orderNo",newOrder.getOrderNo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return BaseController.succeed(result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (userCashAccount.getBalance().doubleValue() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    sysUserCashAccountService.updateBalance(userId, userCashAccount.getBalance().negate(), PlatformCashAccountDetailTypeEnum.PAY_FEE, "网管课购买"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    BigDecimal amount = newOrder.getExpectAmount().subtract(userCashAccount.getBalance()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    newOrder.setActualAmount(amount); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    newOrder.setBalancePaymentAmount(userCashAccount.getBalance()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    newOrder.setBalancePaymentAmount(new BigDecimal(0)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         String orderNo=idGeneratorService.generatorId("payment") + ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         String baseApiUrl = sysConfigDao.findConfigValue("base_api_url"); 
			 |