| 
														
															@@ -46,7 +46,7 @@ import java.util.stream.Collectors; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 @Service 
														 | 
														
														 | 
														
															 @Service 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> implements VipGroupService { 
														 | 
														
														 | 
														
															 public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> implements VipGroupService { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	@Autowired 
														 | 
														
														 | 
														
															 	@Autowired 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	private VipGroupDao vipGroupDao; 
														 | 
														
														 | 
														
															 	private VipGroupDao vipGroupDao; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	@Autowired 
														 | 
														
														 | 
														
															 	@Autowired 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -137,6 +137,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	private OrganizationDao organizationDao; 
														 | 
														
														 | 
														
															 	private OrganizationDao organizationDao; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	@Autowired 
														 | 
														
														 | 
														
															 	@Autowired 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	private GroupClassService groupClassService; 
														 | 
														
														 | 
														
															 	private GroupClassService groupClassService; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	@Autowired 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	private StudentPaymentRouteOrderService studentPaymentRouteOrderService; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	private static final Logger LOGGER = LoggerFactory 
														 | 
														
														 | 
														
															 	private static final Logger LOGGER = LoggerFactory 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			.getLogger(VipGroup.class); 
														 | 
														
														 | 
														
															 			.getLogger(VipGroup.class); 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -233,7 +235,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			} 
														 | 
														
														 | 
														
															 			} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		}else{ 
														 | 
														
														 | 
														
															 		}else{ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			VipGroupDefaultClassesCycle vipGroupDefaultClassesCycle = vipGroupDefaultClassesCycleDao.findByOrganAndClassTimes(totalClassTimes); 
														 | 
														
														 | 
														
															 			VipGroupDefaultClassesCycle vipGroupDefaultClassesCycle = vipGroupDefaultClassesCycleDao.findByOrganAndClassTimes(totalClassTimes); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-			 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			if (vipGroupDefaultClassesCycle != null) { 
														 | 
														
														 | 
														
															 			if (vipGroupDefaultClassesCycle != null) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 				int month = DateUtil.monthsBetween(firstCourseSchedule.getStartClassTime(), latestCourseSchedule.getEndClassTime()); 
														 | 
														
														 | 
														
															 				int month = DateUtil.monthsBetween(firstCourseSchedule.getStartClassTime(), latestCourseSchedule.getEndClassTime()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 				if (month > vipGroupDefaultClassesCycle.getMonth()) { 
														 | 
														
														 | 
														
															 				if (month > vipGroupDefaultClassesCycle.getMonth()) { 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -1242,7 +1244,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	@Override 
														 | 
														
														 | 
														
															 	@Override 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED) 
														 | 
														
														 | 
														
															 	@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	public Map buyVipGroup(VipGroupBuyParamsDto vipGroupBuyParams) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	public Map buyVipGroup(VipGroupBuyParamsDto vipGroupBuyParams) throws Exception { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		SysUser user = sysUserFeignService.queryUserInfo(); 
														 | 
														
														 | 
														
															 		SysUser user = sysUserFeignService.queryUserInfo(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		if(user == null){ 
														 | 
														
														 | 
														
															 		if(user == null){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			throw new BizException("用户信息获取失败"); 
														 | 
														
														 | 
														
															 			throw new BizException("用户信息获取失败"); 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -1321,11 +1323,14 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		studentPaymentOrder.setActualAmount(studentPaymentOrder.getExpectAmount()); 
														 | 
														
														 | 
														
															 		studentPaymentOrder.setActualAmount(studentPaymentOrder.getExpectAmount()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		studentPaymentOrder.setMusicGroupId(vipGroup.getId().toString()); 
														 | 
														
														 | 
														
															 		studentPaymentOrder.setMusicGroupId(vipGroup.getId().toString()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		studentPaymentOrder.setClassGroupId(classGroup.getId()); 
														 | 
														
														 | 
														
															 		studentPaymentOrder.setClassGroupId(classGroup.getId()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		studentPaymentOrder.setOrganId(vipGroup.getOrganId()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		studentPaymentOrder.setVersion(0); 
														 | 
														
														 | 
														
															 		studentPaymentOrder.setVersion(0); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		studentPaymentOrderDao.insert(studentPaymentOrder); 
														 | 
														
														 | 
														
															 		studentPaymentOrderDao.insert(studentPaymentOrder); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		BigDecimal amount=vipGroup.getTotalPrice(); 
														 | 
														
														 | 
														
															 		BigDecimal amount=vipGroup.getTotalPrice(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		BigDecimal balance = BigDecimal.ZERO; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		if("36".equals(user.getOrganId())){ 
														 | 
														
														 | 
														
															 		if("36".equals(user.getOrganId())){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+			studentPaymentRouteOrderService.addRouteOrder(orderNo, vipGroup.getOrganId(), vipGroup.getTotalPrice()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			studentPaymentOrder.setPaymentChannel("BALANCE"); 
														 | 
														
														 | 
														
															 			studentPaymentOrder.setPaymentChannel("BALANCE"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			studentPaymentOrder.setActualAmount(new BigDecimal(0)); 
														 | 
														
														 | 
														
															 			studentPaymentOrder.setActualAmount(new BigDecimal(0)); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			studentPaymentOrder.setBalancePaymentAmount(amount); 
														 | 
														
														 | 
														
															 			studentPaymentOrder.setBalancePaymentAmount(amount); 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -1342,6 +1347,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			} 
														 | 
														
														 | 
														
															 			} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			studentPaymentOrder.setPaymentChannel("BALANCE"); 
														 | 
														
														 | 
														
															 			studentPaymentOrder.setPaymentChannel("BALANCE"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			if(userCashAccount.getBalance().subtract(vipGroup.getTotalPrice()).doubleValue() >= 0){ 
														 | 
														
														 | 
														
															 			if(userCashAccount.getBalance().subtract(vipGroup.getTotalPrice()).doubleValue() >= 0){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+				studentPaymentRouteOrderService.addRouteOrder(orderNo, vipGroup.getOrganId(), vipGroup.getTotalPrice()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 				// 更新订单信息 
														 | 
														
														 | 
														
															 				// 更新订单信息 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 				studentPaymentOrder.setActualAmount(new BigDecimal(0)); 
														 | 
														
														 | 
														
															 				studentPaymentOrder.setActualAmount(new BigDecimal(0)); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 				studentPaymentOrder.setBalancePaymentAmount(amount); 
														 | 
														
														 | 
														
															 				studentPaymentOrder.setBalancePaymentAmount(amount); 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -1360,7 +1366,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 				return result; 
														 | 
														
														 | 
														
															 				return result; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			}else{ 
														 | 
														
														 | 
														
															 			}else{ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 				if (userCashAccount.getBalance().doubleValue() > 0) { 
														 | 
														
														 | 
														
															 				if (userCashAccount.getBalance().doubleValue() > 0) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-					sysUserCashAccountService.updateBalance(user.getId(), userCashAccount.getBalance().negate(), PlatformCashAccountDetailTypeEnum.PAY_FEE, "VIP课购买"); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					balance = userCashAccount.getBalance(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					sysUserCashAccountService.updateBalance(user.getId(), balance.negate(), PlatformCashAccountDetailTypeEnum.PAY_FEE, "VIP课购买"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 					amount = amount.subtract(userCashAccount.getBalance()); 
														 | 
														
														 | 
														
															 					amount = amount.subtract(userCashAccount.getBalance()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 					studentPaymentOrder.setActualAmount(amount); 
														 | 
														
														 | 
														
															 					studentPaymentOrder.setActualAmount(amount); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 					studentPaymentOrder.setBalancePaymentAmount(userCashAccount.getBalance()); 
														 | 
														
														 | 
														
															 					studentPaymentOrder.setBalancePaymentAmount(userCashAccount.getBalance()); 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -1384,17 +1391,16 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		classFee.put("instrument",BigDecimal.ZERO); 
														 | 
														
														 | 
														
															 		classFee.put("instrument",BigDecimal.ZERO); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		classFee.put("accessories",BigDecimal.ZERO); 
														 | 
														
														 | 
														
															 		classFee.put("accessories",BigDecimal.ZERO); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		classFee.put("other",BigDecimal.ZERO); 
														 | 
														
														 | 
														
															 		classFee.put("other",BigDecimal.ZERO); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-		try { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			Map<String,Object> payMap = payService.getPayMap( 
														 | 
														
														 | 
														
															 			Map<String,Object> payMap = payService.getPayMap( 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 					amount, 
														 | 
														
														 | 
														
															 					amount, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					balance, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 					orderNo, 
														 | 
														
														 | 
														
															 					orderNo, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 					baseApiUrl+"/api-student/studentOrder/notify", 
														 | 
														
														 | 
														
															 					baseApiUrl+"/api-student/studentOrder/notify", 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 					baseApiUrl+"/api-student/studentOrder/paymentResult?orderNo=" + orderNo, 
														 | 
														
														 | 
														
															 					baseApiUrl+"/api-student/studentOrder/paymentResult?orderNo=" + orderNo, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 					"vip课购买", 
														 | 
														
														 | 
														
															 					"vip课购买", 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 					vipGroup.getName(), 
														 | 
														
														 | 
														
															 					vipGroup.getName(), 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-					user.getId(), 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-					classFee, 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-					vipGroup.getOrganId() 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					vipGroup.getOrganId(), 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+					"vipBuy" 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			); 
														 | 
														
														 | 
														
															 			); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			Map<String,BigDecimal> routingFee = (Map<String,BigDecimal>)payMap.get("routingFee"); 
														 | 
														
														 | 
														
															 			Map<String,BigDecimal> routingFee = (Map<String,BigDecimal>)payMap.get("routingFee"); 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -1408,9 +1414,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			studentPaymentOrderService.update(studentPaymentOrder); 
														 | 
														
														 | 
														
															 			studentPaymentOrderService.update(studentPaymentOrder); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			return payMap; 
														 | 
														
														 | 
														
															 			return payMap; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-		} catch (Exception e) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-			throw new BizException("调用支付接口出错", e); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-		} 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	} 
														 | 
														
														 | 
														
															 	} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -2059,7 +2062,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		if (null == studentPaymentOrder) { 
														 | 
														
														 | 
														
															 		if (null == studentPaymentOrder) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			throw new BizException("未找到原订单信息!"); 
														 | 
														
														 | 
														
															 			throw new BizException("未找到原订单信息!"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		} 
														 | 
														
														 | 
														
															 		} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-		 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		if(status ==StudentApplyRefundsStatus.ING){ 
														 | 
														
														 | 
														
															 		if(status ==StudentApplyRefundsStatus.ING){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			throw new BizException("状态不正确"); 
														 | 
														
														 | 
														
															 			throw new BizException("状态不正确"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		} 
														 | 
														
														 | 
														
															 		} 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -2925,7 +2928,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		} 
														 | 
														
														 | 
														
															 		} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		if(noCreateSuccessVipGroups != null && noCreateSuccessVipGroups.size() > 0){ 
														 | 
														
														 | 
														
															 		if(noCreateSuccessVipGroups != null && noCreateSuccessVipGroups.size() > 0){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			vipGroupDao.batchUpdate(noCreateSuccessVipGroups); 
														 | 
														
														 | 
														
															 			vipGroupDao.batchUpdate(noCreateSuccessVipGroups); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-			 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			for (VipGroup noCreateSuccessVipGroup : noCreateSuccessVipGroups) { 
														 | 
														
														 | 
														
															 			for (VipGroup noCreateSuccessVipGroup : noCreateSuccessVipGroups) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 				//推送消息 
														 | 
														
														 | 
														
															 				//推送消息 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 				if(noCreateSuccessVipGroup.getStatus().equals(VipGroupStatusEnum.CANCEL)) { 
														 | 
														
														 | 
														
															 				if(noCreateSuccessVipGroup.getStatus().equals(VipGroupStatusEnum.CANCEL)) { 
														 |