| 
					
				 | 
			
			
				@@ -23,6 +23,7 @@ import com.ym.mec.im.ImFeignService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.thirdparty.message.MessageSenderPluginContext; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.util.collection.MapUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.util.date.DateUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.commons.lang3.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.stereotype.Service; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -42,8 +43,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	@Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	private ClassGroupDao classGroupDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	@Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	private VipGroupClassGroupMapperDao vipGroupClassGroupMapperDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	@Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	private ClassGroupTeacherMapperDao classGroupTeacherMapperDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	@Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	private CourseScheduleService courseScheduleService; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -101,6 +100,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	private TeacherAttendanceDao teacherAttendanceDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	@Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	private ContractService contractService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	@Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	private ClassGroupService classGroupService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	@Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	public BaseDAO<Long, VipGroup> getDAO() { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -146,6 +147,13 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         	throw new BizException("该用户不存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String studentIds=vipGroup.getStudentIds(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		List<String> studentIdList=new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(StringUtils.isNotBlank(studentIds)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			studentIdList = Arrays.asList(studentIds.split(",")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Date now=new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		VipGroupApplyBaseInfoDto vipGroupApplyBaseInfoDto=vipGroup.getVipGroupApplyBaseInfo(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -186,18 +194,47 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				true, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//		if() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		VipGroupSalarySettlementDto vipGroupSalarySettlementDto = JSON.parseObject(vipGroupActivity.getSalarySettlementJson(), VipGroupSalarySettlementDto.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		BigDecimal offlineClassNum=new BigDecimal(vipGroupApplyBaseInfoDto.getOfflineClassesNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		BigDecimal onlineClassNum=new BigDecimal(vipGroupApplyBaseInfoDto.getOnlineClassesNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if(vipGroupActivity.getType().equals(VipGroupActivityTypeEnum.GIVE_CLASS)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if(vipGroupApplyBaseInfoDto.getGiveTeachMode()==TeachModeEnum.OFFLINE){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				if(new BigDecimal(totalClassTimes).compareTo(new BigDecimal(vipGroupActivity.getAttribute1()))>-1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					offlineClassNum=offlineClassNum.subtract(new BigDecimal(vipGroupActivity.getAttribute2())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			}else if(vipGroupApplyBaseInfoDto.getGiveTeachMode()==TeachModeEnum.ONLINE){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				if(new BigDecimal(totalClassTimes).compareTo(new BigDecimal(vipGroupActivity.getAttribute1()))>-1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					onlineClassNum=onlineClassNum.subtract(new BigDecimal(vipGroupActivity.getAttribute2())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			}else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				throw new BizException("请指定赠送课程类型!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		BigDecimal tempFee = costInfo.get("totalPrice").multiply(new BigDecimal(0.6)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		BigDecimal totalSalary = vipGroupApplyBaseInfoDto.getOfflineTeacherSalary().multiply(offlineClassNum) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				.add(vipGroupApplyBaseInfoDto.getOnlineTeacherSalary().multiply(onlineClassNum)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if(totalSalary.compareTo(tempFee)>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			throw new BizException("课酬异常"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		//如果默认课酬与实际课酬不匹配则需要审批 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if(costInfo.get("offlineTeacherSalary").compareTo(vipGroupApplyBaseInfoDto.getOfflineTeacherSalary())!=0|| 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			costInfo.get("onlineTeacherSalary").compareTo(vipGroupApplyBaseInfoDto.getOnlineTeacherSalary())!=0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			costInfo.get("onlineTeacherSalary").compareTo(vipGroupApplyBaseInfoDto.getOnlineTeacherSalary())!=0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			&&StringUtils.isBlank(studentIds)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			vipGroupApplyBaseInfoDto.setAuditStatus(AuditStatusEnum.ING); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		}else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			vipGroupApplyBaseInfoDto.setAuditStatus(AuditStatusEnum.PASS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		vipGroupApplyBaseInfoDto.setTotalPrice(costInfo.get("totalPrice")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		vipGroupApplyBaseInfoDto.setStatus(VipGroupStatusEnum.APPLYING); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if(StringUtils.isNotBlank(studentIds)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			vipGroupApplyBaseInfoDto.setStatus(VipGroupStatusEnum.FINISH); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		}else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			vipGroupApplyBaseInfoDto.setStatus(VipGroupStatusEnum.APPLYING); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		vipGroupApplyBaseInfoDto.setOrganId(sysUser.getOrganId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		//开课时间为排课的第一节课的开始时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		vipGroupApplyBaseInfoDto.setCourseStartDate(firstCourseSchedule.getStartClassTime()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -212,28 +249,27 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		ClassGroup classGroup=new ClassGroup(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		classGroup.setSubjectIdList(vipGroupApplyBaseInfoDto.getSubjectIdList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		classGroup.setExpectStudentNum(vipGroupCategory.getStudentNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if(StringUtils.isNotBlank(studentIds)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			classGroup.setStudentNum(studentIdList.size()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		classGroup.setName(vipGroupApplyBaseInfoDto.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		classGroup.setExpectStudentNum(vipGroupApplyBaseInfoDto.getStudentNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		classGroup.setTotalClassTimes(totalClassTimes); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		classGroup.setType(ClassGroupTypeEnum.VIP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		classGroup.setDelFlag(YesOrNoEnum.YES); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		classGroup.setGroupType(GroupType.VIP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		classGroup.setMusicGroupId(vipGroupApplyBaseInfoDto.getId().toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		classGroup.setCreateTime(now); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		classGroup.setUpdateTime(now); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		classGroupDao.insert(classGroup); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		//创建vip课班级关联记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		VipGroupClassGroupMapper vipGroupClassGroupMapper=new VipGroupClassGroupMapper(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		vipGroupClassGroupMapper.setVipGroupId(vipGroupApplyBaseInfoDto.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		vipGroupClassGroupMapper.setClassGroupId(classGroup.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		vipGroupClassGroupMapperDao.insert(vipGroupClassGroupMapper); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		//创建班级老师关联记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		ClassGroupTeacherMapper classGroupTeacherMapper=new ClassGroupTeacherMapper(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		classGroupTeacherMapper.setMusicGroupId(vipGroupApplyBaseInfoDto.getId().toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		classGroupTeacherMapper.setClassGroupId(classGroup.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		classGroupTeacherMapper.setTeacherRole(TeachTypeEnum.BISHOP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		classGroupTeacherMapper.setUserId(vipGroupApplyBaseInfoDto.getUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		classGroupTeacherMapper.setGroupType(GroupType.VIP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		classGroupTeacherMapper.setCreateTime(now); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		classGroupTeacherMapper.setUpdateTime(now); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		classGroupTeacherMapperDao.insert(classGroupTeacherMapper); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -246,6 +282,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		classGroupTeacherSalary.setUserId(vipGroupApplyBaseInfoDto.getUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		classGroupTeacherSalary.setSalary(vipGroupApplyBaseInfoDto.getOfflineTeacherSalary()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		classGroupTeacherSalary.setOnlineClassesSalary(vipGroupApplyBaseInfoDto.getOnlineTeacherSalary()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		classGroupTeacherSalary.setGroupType(GroupType.VIP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		classGroupTeacherSalaryDao.insert(classGroupTeacherSalary); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		//课程信息调整 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -261,12 +298,18 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		vipGroupApplyBaseInfoDto.setCourseSchedulesJson(JSON.toJSONString(vipGroup.getCourseSchedules())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		vipGroupDao.update(vipGroupApplyBaseInfoDto); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		SysUser systemUser = sysUserFeignService.queryUserById(systemId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if(StringUtils.isNotBlank(studentIds)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			List<Integer> collect = studentIdList.stream().mapToInt(Integer::parseInt).boxed().collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			classGroupService.addStudentIntoClassGroup(vipGroupApplyBaseInfoDto.getId().toString(),classGroup.getId(),collect); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			createVipGroupCourseScheInfo(vipGroupApplyBaseInfoDto.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		Set<Integer> roleIds = new HashSet<>(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		roleIds.add(SysUserRole.OPERATION_EXECUTIVE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		Map<String,Long> memo = new HashMap<>(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		memo.put("vipGroupId",vipGroupApplyBaseInfoDto.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if (systemId != null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			SysUser systemUser = sysUserFeignService.queryUserById(systemId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			sysMessageService.batchSeoMessage(roleIds,MessageTypeEnum.BACKSTAGE_VIP_COURSE_APPLY, JSONObject.toJSONString(memo),systemUser.getUsername(),sysUser.getUsername()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		}else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			sysMessageService.batchSeoMessage(roleIds,MessageTypeEnum.BACKSTAGE_TEACHER_APPLY_VIP, JSONObject.toJSONString(memo),sysUser.getUsername()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -400,7 +443,11 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			List<Long> vipGroupIds = dataList.stream().map(vipGroup -> vipGroup.getId()).distinct().collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			List<Map<Long, Integer>> vipGroupOverCourses = vipGroupDao.countVipGroupOverCourse(vipGroupIds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			Map<Long,Integer> vipGroupOverCourseMaps = MapUtil.convertIntegerMap(vipGroupOverCourses); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			List<ClassGroup> classGroupsByVipGroups = vipGroupClassGroupMapperDao.findClassGroupsByVipGroups(vipGroupIds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			List<ClassGroup> classGroupsByVipGroups = classGroupDao 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					.findByMusicGroupsAndType(vipGroupIds.stream().map(vipGroupId->String.valueOf(vipGroupId)).collect(Collectors.toList()), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+							GroupType.VIP.getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			Map<String, ClassGroup> vipGroupClassGroupMap = classGroupsByVipGroups.stream().collect(Collectors.toMap(ClassGroup::getMusicGroupId, classGroup -> classGroup)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			dataList.forEach(vipGroup -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				Integer overCourses = vipGroupOverCourseMaps.get(vipGroup.getId()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -497,6 +544,26 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	@Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	public PageInfo findHaveCourseBalanceStudents(VipGroupQueryInfo queryInfo) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		PageInfo pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		Map<String, Object> params = new HashMap<String, Object>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		MapUtil.populateMap(params, queryInfo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		List dataList = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		int count = vipGroupDao.countHaveCourseBalanceStudentNum(params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if (count > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			pageInfo.setTotal(count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			params.put("offset", pageInfo.getOffset()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			dataList = vipGroupDao.findHaveCourseBalanceStudents(params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if (count == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			dataList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		pageInfo.setRows(dataList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		return pageInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	@Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	public VipGroupManageDetailDto getVipGroupDetail(Long vipGroupId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if(Objects.isNull(vipGroupId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			throw new BizException("请指定vip课程"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -612,6 +679,10 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			throw new BizException("请指定课程形式"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if(Objects.isNull(vipGroup.getSingleClassMinutes())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			throw new BizException("请指定课程时长"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		VipGroupCategory vipGroupCategory = vipGroupCategoryDao.get(vipGroup.getVipGroupCategoryId().intValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if(Objects.isNull(vipGroupCategory)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			throw new BizException("未找到课程形式"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -640,7 +711,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		BigDecimal teacherSalaryTimeUnit=new BigDecimal(sysConfigDao.findConfigValue(SysConfigService.TEACHER_SALARY_TIME_UNIT)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		//课程时长与结算单位时长占比 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		BigDecimal classTimeDuty=new BigDecimal(vipGroupCategory.getSingleClassMinutes()).divide(teacherSalaryTimeUnit); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		BigDecimal classTimeDuty=new BigDecimal(vipGroup.getSingleClassMinutes()).divide(teacherSalaryTimeUnit); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		BigDecimal offlineClassNum=new BigDecimal(vipGroup.getOfflineClassesNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		BigDecimal onlineClassNum=new BigDecimal(vipGroup.getOnlineClassesNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		BigDecimal onlineVipGroupCharge = onlineClassesUnitPrice.multiply(onlineClassNum); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -751,7 +822,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if(Objects.isNull(vipGroup)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			throw new BizException("指定的vip课程不存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		ClassGroup classGroup=vipGroupClassGroupMapperDao.findClassGroupByVipGroup(vipGroupId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		ClassGroup classGroup=classGroupDao.findByMusicGroupAndType(vipGroupId.toString(),ClassGroupTypeEnum.VIP.getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if(Objects.isNull(classGroup)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			throw new BizException("未找到关联班级"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -838,13 +909,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			throw new BizException("您已购买过此课程"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		VipGroupClassGroupMapper vipGroupClassGroupMapper = vipGroupClassGroupMapperDao.findByVipGroupId(vipGroup.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		if(Objects.isNull(vipGroupClassGroupMapper)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			throw new BizException("课程信息错误"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		ClassGroup classGroup = vipGroupClassGroupMapperDao.findClassGroupByVipGroup(vipGroupBuyParams.getVipGroupId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		ClassGroup classGroup= classGroupDao.findByMusicGroupAndType(vipGroup.getId().toString(),ClassGroupTypeEnum.VIP.getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if(Objects.isNull(classGroup)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			throw new BizException("课程信息错误"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -863,7 +928,8 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			//更新班级人数,如果订单支付失败则减少 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			this.updateVipGroupStudentNumAndStatus(vipGroup.getId(),1,false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			ClassGroupStudentMapper classGroupStudentMapper=new ClassGroupStudentMapper(vipGroupClassGroupMapper.getClassGroupId(),user.getId().intValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			ClassGroupStudentMapper classGroupStudentMapper=new ClassGroupStudentMapper(classGroup.getId(),user.getId().intValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			classGroupStudentMapper.setGroupType(GroupType.VIP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			classGroupStudentMapper.setMusicGroupId(vipGroup.getId().toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			classGroupStudentMapperDao.insert(classGroupStudentMapper); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -873,6 +939,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		StudentPaymentOrder studentPaymentOrder=new StudentPaymentOrder(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		studentPaymentOrder.setUserId(user.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        studentPaymentOrder.setGroupType(GroupType.VIP); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		String orderNo=StringUtils.join(new String[]{user.getId().toString(),String.valueOf(System.currentTimeMillis())}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		studentPaymentOrder.setOrderNo(orderNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		studentPaymentOrder.setStatus(DealStatusEnum.ING); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -881,9 +948,13 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		studentPaymentOrder.setMusicGroupId(vipGroup.getId().toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		studentPaymentOrder.setActualAmount(studentPaymentOrder.getExpectAmount()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		studentPaymentOrder.setMusicGroupId(vipGroup.getId().toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		studentPaymentOrder.setClassGroupId(vipGroupClassGroupMapper.getClassGroupId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		studentPaymentOrder.setClassGroupId(classGroup.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		contractService.register(user.getId(),user.getRealName(),user.getIdCardNo(),user.getPhone()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			contractService.register(user.getId(),user.getRealName(),user.getIdCardNo(),user.getPhone()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		//生成回调地址 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		Map<String,Object> payMap = payService.getPayMap( 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -954,10 +1025,10 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.STUDENT_PUSH_VIP_BUY, map, null, 0, "2", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 				vipGroup.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		VipGroupClassGroupMapper vipGroupClassGroupMapper = vipGroupClassGroupMapperDao.findByVipGroupId(vipGroupId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		ClassGroup classGroup=classGroupDao.findByMusicGroupAndType(vipGroupId.toString(),ClassGroupTypeEnum.VIP.getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		//更新所属分部列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		List<Integer> organIds = classGroupDao.findStudentOrganIdsByClassGroup(vipGroupClassGroupMapper.getClassGroupId().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		List<Integer> organIds = classGroupDao.findStudentOrganIdsByClassGroup(classGroup.getId().longValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		organIds.add(vipGroup.getOrganId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		HashSet<Integer> hashSet = new HashSet<>(organIds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		String organIdsString = StringUtils.join(hashSet, ","); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1142,19 +1213,21 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			pageInfo.setTotal(count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			params.put("offset", pageInfo.getOffset()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			dataList = courseScheduleTeacherSalaryDao.findVipGroupSalarys(params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			dataList.forEach(vipGroupSalaryDto -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				if(Objects.isNull(vipGroupSalaryDto.getExpectSalary())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-					vipGroupSalaryDto.setExpectSalary(new BigDecimal(0)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				if(Objects.isNull(vipGroupSalaryDto.getActualSalary())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-					vipGroupSalaryDto.setActualSalary(new BigDecimal(0)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-					vipGroupSalaryDto.setDeductionFee(new BigDecimal(0)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-					vipGroupSalaryDto.setIsSalary(YesOrNoEnum.NO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				}else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-					vipGroupSalaryDto.setDeductionFee(vipGroupSalaryDto.getExpectSalary().subtract(vipGroupSalaryDto.getActualSalary())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-					vipGroupSalaryDto.setIsSalary(YesOrNoEnum.YES); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if(!CollectionUtils.isEmpty(dataList)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				dataList.forEach(vipGroupSalaryDto -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					if(Objects.isNull(vipGroupSalaryDto.getExpectSalary())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						vipGroupSalaryDto.setExpectSalary(new BigDecimal(0)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					if(Objects.isNull(vipGroupSalaryDto.getActualSalary())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						vipGroupSalaryDto.setActualSalary(new BigDecimal(0)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						vipGroupSalaryDto.setDeductionFee(new BigDecimal(0)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						vipGroupSalaryDto.setIsSalary(YesOrNoEnum.NO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					}else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						vipGroupSalaryDto.setDeductionFee(vipGroupSalaryDto.getExpectSalary().subtract(vipGroupSalaryDto.getActualSalary())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						vipGroupSalaryDto.setIsSalary(YesOrNoEnum.YES); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if (count == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			dataList = new ArrayList<>(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1373,22 +1446,80 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	@Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	@Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	public void addVipGroupStudents(Long vipGroupId, List<Integer> studentIds) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if(CollectionUtils.isEmpty(studentIds)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			throw new BizException("请选择学生"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if(Objects.isNull(vipGroupId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			throw new BizException("请指定班级"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			throw new BizException("请指定vip课程"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		VipGroup vipGroup=vipGroupDao.get(vipGroupId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if(Objects.isNull(vipGroup)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			throw new BizException("未找到指定的vip课程"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		ClassGroup classGroup = classGroupDao.findByVipGroup(vipGroupId, null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		List<CourseSchedule> surplusCourses = courseScheduleDao.findByClassGroupAndStatus(classGroup.getId(), CourseStatusEnum.NOT_START.getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if(CollectionUtils.isEmpty(surplusCourses)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			throw new BizException("此vip课程没有剩余课程计划"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		BigDecimal surplusCoursesPrice=new BigDecimal(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		surplusCourses.forEach(courseSchedule -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if(courseSchedule.getTeachMode().equals(TeachModeEnum.OFFLINE)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				surplusCoursesPrice.add(vipGroup.getOfflineClassesUnitPrice()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			}else if(courseSchedule.getTeachMode().equals(TeachModeEnum.ONLINE)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				surplusCoursesPrice.add(vipGroup.getOnlineClassesUnitPrice()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		List<ImGroupMember> imGroupMemberList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		//生成学生单课缴费信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		for (Integer studentId:studentIds) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			SysUserCashAccount sysUserCashAccount = sysUserCashAccountService.get(studentId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if(sysUserCashAccount.getCourseBalance().compareTo(surplusCoursesPrice)<0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				throw new BizException("存在课程余额不足的学生"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			courseScheduleStudentPaymentService.createCourseScheduleStudentPaymentForVipGroup(vipGroupId,studentId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			sysUserCashAccountService.updateCourseBalance(studentId,surplusCoursesPrice.negate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			imGroupMemberList.add(new ImGroupMember(studentId.toString())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			ImGroupMember[] imGroupMembers = imGroupMemberList.toArray(new ImGroupMember[imGroupMemberList.size()]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			// 创建群组 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			imFeignService.groupCreate(new ImGroupModel(classGroup.getId().toString(), imGroupMembers, classGroup.getName())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	@Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	@Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	public void stopVipGroupWithNoCreate() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		List<VipGroup> noCreateSuccessVipGroups = vipGroupDao.findNoCreateSuccessVipGroup(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if(CollectionUtils.isEmpty(noCreateSuccessVipGroups)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//		studentPaymentOrderDao.queryByDealStatus() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		//用户账户资金变动信息列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		List<SysUserCashAccountDetail> userCashAccountDetails = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		for (VipGroup noCreateSuccessVipGroup : noCreateSuccessVipGroups) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			List<StudentPaymentOrder> studentPaymentOrders = studentPaymentOrderDao.queryByDealStatus(noCreateSuccessVipGroup.getId().toString(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					OrderTypeEnum.SMALL_CLASS_TO_BUY, DealStatusEnum.SUCCESS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			for (StudentPaymentOrder studentPaymentOrder:studentPaymentOrders){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				//生成账户资金明细 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				sysUserCashAccountService.updateCourseBalance(studentPaymentOrder.getUserId(),studentPaymentOrder.getActualAmount()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				SysUserCashAccount sysUserCashAccount = sysUserCashAccountService.get(studentPaymentOrder.getUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				SysUserCashAccountDetail sysUserIncomeCashAccountDetail = new SysUserCashAccountDetail(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				sysUserIncomeCashAccountDetail.setUserId(studentPaymentOrder.getUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				sysUserIncomeCashAccountDetail.setType(PlatformCashAccountDetailTypeEnum.REFUNDS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				sysUserIncomeCashAccountDetail.setStatus(DealStatusEnum.SUCCESS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				sysUserIncomeCashAccountDetail.setAmount(studentPaymentOrder.getActualAmount()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				sysUserIncomeCashAccountDetail.setBalance(sysUserCashAccount.getBalance()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				sysUserIncomeCashAccountDetail.setAttribute(studentPaymentOrder.getTransNo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				userCashAccountDetails.add(sysUserIncomeCashAccountDetail); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		sysUserCashAccountDetailDao.batchInsert(userCashAccountDetails); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |