|  | @@ -116,6 +116,8 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 | 
	
		
			
				|  |  |      private StudentDao studentDao;
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private ActivityUserMapperService activityUserMapperService;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private StudentRegistrationService studentRegistrationService;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public BaseDAO<Long, MusicGroupPaymentCalender> getDAO() {
 | 
	
	
		
			
				|  | @@ -1003,14 +1005,21 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 | 
	
		
			
				|  |  |  //                    autoClassGroupAdjust(musicGroupStudentClassAdjust);
 | 
	
		
			
				|  |  |  //                }
 | 
	
		
			
				|  |  |              } else if (calender.getPaymentType() == SPAN_GROUP_CLASS_ADJUST) {
 | 
	
		
			
				|  |  | -                //删除和解冻班级,课程信息
 | 
	
		
			
				|  |  | +                List<MusicGroupPaymentCalenderStudentDetail> calenderStudentDetails = musicGroupPaymentCalenderStudentDetailDao.findByBatchNo(batchNo);
 | 
	
		
			
				|  |  | +                //将学员加入新乐团、扣除原乐团剩余课程余额、补充到现有乐团
 | 
	
		
			
				|  |  | +                Map<Integer, List<MusicGroupPaymentCalenderStudentDetail>> collect = calenderStudentDetails.stream().collect(Collectors.groupingBy(e -> e.getUserId()));
 | 
	
		
			
				|  |  |                  MusicGroupStudentClassAdjust adjust = musicGroupStudentClassAdjustDao.findByBatchNo(batchNo);
 | 
	
		
			
				|  |  |                  List<Map> classGroupStudents = JSON.parseArray(adjust.getClassGroupStudents(), Map.class);
 | 
	
		
			
				|  |  | +                for (Map<Integer, String> classGroupStudent : classGroupStudents) {
 | 
	
		
			
				|  |  | +                    Integer classGroupId = classGroupStudent.keySet().iterator().next();
 | 
	
		
			
				|  |  | +                    studentRegistrationService.insertStudent(classGroupStudent.get(classGroupId), musicGroupDao.findByClassGroupId(classGroupId).getId(), musicGroup.getId(), collect);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                //删除和解冻班级,课程信息
 | 
	
		
			
				|  |  |                  List<Integer> studentIds = JSON.parseArray(adjust.getStudentIds(), Integer.class);
 | 
	
		
			
				|  |  |                  List<Long> courseIds = JSON.parseArray(adjust.getSubLockCourseIds(), Long.class);
 | 
	
		
			
				|  |  |                  List<Long> allLockCourseIds = JSON.parseArray(adjust.getAllLockCourseIds(), Long.class);
 | 
	
		
			
				|  |  |                  //如果是跨团班级合并,添加学员
 | 
	
		
			
				|  |  | -                musicGroupPaymentCalenderDetailService.batchAdd(calender, musicGroupPaymentCalenderStudentDetailDao.findByBatchNo(batchNo));
 | 
	
		
			
				|  |  | +                musicGroupPaymentCalenderDetailService.batchAdd(calender, calenderStudentDetails);
 | 
	
		
			
				|  |  |                  classGroupService.spanGroupClassAdjustPass(adjust.getMasterClassGroupId()
 | 
	
		
			
				|  |  |                          , studentIds, courseIds, classGroupStudents, allLockCourseIds, batchNo, adjust.getMasterTotalPrice());
 | 
	
		
			
				|  |  |              }
 | 
	
	
		
			
				|  | @@ -1091,7 +1100,7 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 | 
	
		
			
				|  |  |          SysUser sysUser = sysUserFeignService.queryUserInfo();
 | 
	
		
			
				|  |  |          Date date = new Date();
 | 
	
		
			
				|  |  |          calenders.forEach(e -> {
 | 
	
		
			
				|  |  | -            if (e.getPaymentType() == ADD_STUDENT || e.getPaymentType() == SPAN_GROUP_CLASS_ADJUST) {
 | 
	
		
			
				|  |  | +            if (e.getPaymentType() == ADD_STUDENT) {
 | 
	
		
			
				|  |  |                  throw new BizException("{} 的缴费项目不允许撤回", e.getStatus().getDesc());
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              if (e.getStatus() != AUDITING) {
 | 
	
	
		
			
				|  | @@ -1287,9 +1296,24 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 | 
	
		
			
				|  |  |          if (musicGroupPaymentCalenderDetailList != null && musicGroupPaymentCalenderDetailList.size() > 0) {
 | 
	
		
			
				|  |  |              throw new BizException("操作失败:缴费项目中已存在学员");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        MusicGroupStudentClassAdjust byBatchNo = musicGroupStudentClassAdjustDao.findByBatchNo(calender.getBatchNo());
 | 
	
		
			
				|  |  | -        if (byBatchNo != null) {
 | 
	
		
			
				|  |  | -            throw new BizException("操作失败:班级调整的缴费项目不支持");
 | 
	
		
			
				|  |  | +        MusicGroupStudentClassAdjust adjust = musicGroupStudentClassAdjustDao.findByBatchNo(calender.getBatchNo());
 | 
	
		
			
				|  |  | +        if (!Objects.isNull(adjust)) {
 | 
	
		
			
				|  |  | +//            throw new BizException("操作失败:班级调整的缴费项目不支持");
 | 
	
		
			
				|  |  | +            List<Map> classGroupStudents = JSON.parseArray(adjust.getClassGroupStudents(), Map.class);
 | 
	
		
			
				|  |  | +            //删除班级关联的学员
 | 
	
		
			
				|  |  | +            List<Integer> classGroupIds = new ArrayList<>();
 | 
	
		
			
				|  |  | +            if (classGroupStudents != null && classGroupStudents.size() > 0) {
 | 
	
		
			
				|  |  | +                for (Map<Integer, String> classGroupStudent : classGroupStudents) {
 | 
	
		
			
				|  |  | +                    classGroupIds.addAll(classGroupStudent.keySet());
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            List<Long> allLockCourseIds = JSON.parseArray(adjust.getAllLockCourseIds(), Long.class);
 | 
	
		
			
				|  |  | +            //解冻课程
 | 
	
		
			
				|  |  | +            courseScheduleDao.batchUpdateLockByCourseIds(allLockCourseIds, 0,null);
 | 
	
		
			
				|  |  | +            //解冻班级
 | 
	
		
			
				|  |  | +            classGroupIds.add(adjust.getMasterClassGroupId());
 | 
	
		
			
				|  |  | +            classGroupService.batchUpdateLockByClassGroupIds(classGroupIds, 0);
 | 
	
		
			
				|  |  | +            musicGroupStudentClassAdjustDao.delete(adjust.getId());
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          if (calender.getPaymentType() == PaymentType.MUSIC_APPLY) {
 |