浏览代码

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	mec-biz/src/main/java/com/ym/mec/biz/service/StudentManageService.java
zouxuan 4 年之前
父节点
当前提交
fcd829c097
共有 28 个文件被更改,包括 567 次插入345 次删除
  1. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ClassGroupDao.java
  2. 1 2
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentManageDao.java
  3. 2 2
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentRegistrationDao.java
  4. 32 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/HighClassGroupNumDto.java
  5. 12 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentRecoverInfoDto.java
  6. 12 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/TeacherAttendancesDto.java
  7. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/Teacher.java
  8. 11 1
      mec-biz/src/main/java/com/ym/mec/biz/service/ClassGroupService.java
  9. 2 2
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentRegistrationService.java
  10. 258 241
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java
  11. 12 19
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupStudentMapperServiceImpl.java
  12. 63 13
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java
  13. 39 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleTeacherSalaryServiceImpl.java
  14. 3 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentManageServiceImpl.java
  15. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentRouteOrderServiceImpl.java
  16. 2 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java
  17. 28 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java
  18. 2 1
      mec-biz/src/main/resources/config/mybatis/ClassGroupMapper.xml
  19. 3 3
      mec-biz/src/main/resources/config/mybatis/StudentAttendanceMapper.xml
  20. 9 7
      mec-biz/src/main/resources/config/mybatis/StudentManageDao.xml
  21. 6 3
      mec-biz/src/main/resources/config/mybatis/StudentPaymentRouteOrderMapper.xml
  22. 3 3
      mec-biz/src/main/resources/config/mybatis/StudentRegistrationMapper.xml
  23. 6 4
      mec-biz/src/main/resources/config/mybatis/TeacherMapper.xml
  24. 26 20
      mec-web/src/main/java/com/ym/mec/web/controller/ClassGroupController.java
  25. 2 2
      mec-web/src/main/java/com/ym/mec/web/controller/StudentManageController.java
  26. 3 0
      mec-web/src/main/java/com/ym/mec/web/controller/StudentPaymentRouteOrderController.java
  27. 4 4
      mec-web/src/main/java/com/ym/mec/web/controller/StudentRegistrationController.java
  28. 13 12
      mec-web/src/main/java/com/ym/mec/web/controller/TeacherAttendanceController.java

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ClassGroupDao.java

@@ -759,5 +759,5 @@ public interface ClassGroupDao extends BaseDAO<Integer, ClassGroup> {
      *
      * @return
      */
-    int getMusicGroupHighClassNumBySubject(@Param("musicGroupId") String musicGroupId, @Param("subjectIds") String subjectIds);
+    Integer getMusicGroupHighClassNumBySubject(@Param("musicGroupId") String musicGroupId, @Param("subjectIds") String subjectIds, @Param("type") ClassGroupTypeEnum type);
 }

+ 1 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentManageDao.java

@@ -10,7 +10,6 @@ import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dto.BasicUserDto;
 import com.ym.mec.biz.dal.dto.MusicGroupStudentSignDto;
 import com.ym.mec.biz.dal.dto.MusicGroupStudentsDto;
-import com.ym.mec.biz.dal.dto.StudentHasCourseDto;
 import com.ym.mec.biz.dal.dto.StudentListCourseDto;
 import com.ym.mec.biz.dal.dto.StudentManageAccountBaseInfoDto;
 import com.ym.mec.biz.dal.dto.StudentManageBaseInfoOfMusicGroupDto;
@@ -262,7 +261,7 @@ public interface StudentManageDao {
      * @return
      */
     List<BasicUserDto> queryCanAddStudent(@Param("musicGroupId") String musicGroupId,
-                                          @Param("musicGroupPaymentCalenderId") Long musicGroupPaymentCalenderId,
+                                          @Param("batchNo") String batchNo,
                                           @Param("search") String search,
                                           @Param("subjectId") Integer subjectId);
 

+ 2 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentRegistrationDao.java

@@ -172,7 +172,7 @@ public interface StudentRegistrationDao extends BaseDAO<Long, StudentRegistratio
      *
      * @return
      */
-    List<StudentRegistration> findMusicGroupStudent(@Param("musicGroupId") String musicGroupId, @Param("actualSubjectId") Integer actualSubjectId);
+    List<StudentRegistration> findMusicGroupStudent(@Param("musicGroupId") String musicGroupId, @Param("actualSubjectId") String actualSubjectId);
 
     /**
      * 查询乐团userIdList的学生
@@ -391,5 +391,5 @@ public interface StudentRegistrationDao extends BaseDAO<Long, StudentRegistratio
      *
      * @return
      */
-    int getMusicGroupSubjectNum(@Param("musicGroupId") String musicGroupId, @Param("subjectIds") String subjectIds);
+    Integer getMusicGroupSubjectStudentNum(@Param("musicGroupId") String musicGroupId, @Param("subjectIds") String subjectIds);
 }

+ 32 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/HighClassGroupNumDto.java

@@ -0,0 +1,32 @@
+package com.ym.mec.biz.dal.dto;
+
+import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
+import io.swagger.annotations.ApiModelProperty;
+
+public class HighClassGroupNumDto {
+
+    @ApiModelProperty(value = "班级类型", required = true)
+    private ClassGroupTypeEnum type;
+
+    @ApiModelProperty(value = "已有基础技能班/线上基础技能班数量", required = true)
+    private Integer nowHighClassGroupNum;
+
+    @ApiModelProperty(value = "容许最大数量", required = true)
+    private Integer maxHighClassGroupNum;
+
+    public Integer getNowHighClassGroupNum() {
+        return nowHighClassGroupNum;
+    }
+
+    public void setNowHighClassGroupNum(Integer nowHighClassGroupNum) {
+        this.nowHighClassGroupNum = nowHighClassGroupNum;
+    }
+
+    public Integer getMaxHighClassGroupNum() {
+        return maxHighClassGroupNum;
+    }
+
+    public void setMaxHighClassGroupNum(Integer maxHighClassGroupNum) {
+        this.maxHighClassGroupNum = maxHighClassGroupNum;
+    }
+}

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentRecoverInfoDto.java

@@ -1,5 +1,7 @@
 package com.ym.mec.biz.dal.dto;
 
+import java.time.LocalDate;
+
 /**
  * @Author Joburgess
  * @Date 2019/12/24
@@ -18,6 +20,16 @@ public class StudentRecoverInfoDto {
 
     private int giveCourseTimes;
 
+    private LocalDate expireDate;
+
+    public LocalDate getExpireDate() {
+        return expireDate;
+    }
+
+    public void setExpireDate(LocalDate expireDate) {
+        this.expireDate = expireDate;
+    }
+
     public Integer getVipGroupId() {
         return vipGroupId;
     }

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/TeacherAttendancesDto.java

@@ -1,10 +1,12 @@
 package com.ym.mec.biz.dal.dto;
 
 import com.ym.mec.biz.dal.entity.CourseSchedule;
+import com.ym.mec.biz.dal.entity.TeacherAttendance;
 import com.ym.mec.biz.dal.enums.CourseStatusEnum;
 import com.ym.mec.biz.dal.enums.SignInStatusEnum;
 import com.ym.mec.biz.dal.enums.SignOutStatusEnum;
 import com.ym.mec.biz.dal.enums.TeachTypeEnum;
+
 import io.swagger.annotations.ApiModelProperty;
 
 import java.util.Date;
@@ -15,6 +17,8 @@ public class TeacherAttendancesDto {
 	private String teacherName;
 
     private TeachTypeEnum teacherRole;
+    
+    private TeacherAttendance teacherAttendance = new TeacherAttendance();
 
     @ApiModelProperty(value = "分部名",required = false)
 	private String organName;
@@ -217,4 +221,12 @@ public class TeacherAttendancesDto {
     public void setSignOutTime(Date signOutTime) {
         this.signOutTime = signOutTime;
     }
+
+	public TeacherAttendance getTeacherAttendance() {
+		return teacherAttendance;
+	}
+
+	public void setTeacherAttendance(TeacherAttendance teacherAttendance) {
+		this.teacherAttendance = teacherAttendance;
+	}
 }

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/Teacher.java

@@ -96,6 +96,9 @@ public class Teacher extends SysUser {
 	@ApiModelProperty(value = "离职时间", required = false)
 	private Date demissionDate;
 	
+	@ApiModelProperty(value = "转正时间", required = false)
+	private Date formalStaffDate;
+	
 	@ApiModelProperty(value = "是否支持课程奖励规则活动", required = false)
 	private Boolean isSupportCourseScheduleRewardsRules;
 	
@@ -320,6 +323,14 @@ public class Teacher extends SysUser {
 		this.demissionDate = demissionDate;
 	}
 
+	public Date getFormalStaffDate() {
+		return formalStaffDate;
+	}
+
+	public void setFormalStaffDate(Date formalStaffDate) {
+		this.formalStaffDate = formalStaffDate;
+	}
+
 	public Boolean getIsSupportCourseScheduleRewardsRules() {
 		return isSupportCourseScheduleRewardsRules;
 	}

+ 11 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/ClassGroupService.java

@@ -491,4 +491,14 @@ public interface ClassGroupService extends BaseService<Integer, ClassGroup> {
      * @return
      */
     Map<String,Long> findClassCourseMinuteMap(List<Integer> classGroupIds,Map<String,Long> classCourseMinuteMap);
-}
+
+    /**
+     * 获取基础技能班/线上基础技能班数量和容许最大数量
+     * @param musicGroupId
+     * @param type
+     * @param subjectIds
+     * @return
+     */
+    HighClassGroupNumDto getSubjectMaxHighClassGroupNum(String musicGroupId,ClassGroupTypeEnum type,String subjectIds);
+
+    }

+ 2 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/StudentRegistrationService.java

@@ -195,7 +195,7 @@ public interface StudentRegistrationService extends BaseService<Long, StudentReg
      *
      * @return
      */
-    List<StudentRegistration> findMusicGroupStudent(String musicGroupId, Integer actualSubjectId);
+    List<StudentRegistration> findMusicGroupStudent(String musicGroupId, String actualSubjectId);
 
     /**
      * 查询乐团userIdList的学生
@@ -254,7 +254,7 @@ public interface StudentRegistrationService extends BaseService<Long, StudentReg
      * @param subjectId
      * @return
      */
-    List<StudentRegistration> findMusicGroupStuNoClassType(String musicGroupId, Long classGroupId, ClassGroupTypeEnum type, Integer subjectId);
+    List<StudentRegistration> findMusicGroupStuNoClassType(String musicGroupId, Long classGroupId, ClassGroupTypeEnum type, String subjectIds);
 
     /**
      * 获取乐团下所有学员身上的声部列表

+ 258 - 241
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java

@@ -6,7 +6,6 @@ import static com.ym.mec.biz.dal.enums.GroupType.MUSIC;
 import static com.ym.mec.biz.dal.enums.GroupType.PRACTICE;
 import static com.ym.mec.biz.dal.enums.GroupType.VIP;
 
-import java.lang.reflect.InvocationTargetException;
 import java.math.BigDecimal;
 import java.time.Duration;
 import java.time.Instant;
@@ -27,20 +26,16 @@ import java.util.Objects;
 import java.util.Set;
 import java.util.stream.Collectors;
 
-import com.alibaba.fastjson.JSONArray;
 import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.service.*;
 import com.ym.mec.common.service.IdGeneratorService;
-import org.apache.commons.beanutils.BeanUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
-import org.springframework.transaction.interceptor.TransactionAspectSupport;
 import org.springframework.util.CollectionUtils;
 
 import com.alibaba.fastjson.JSON;
@@ -218,10 +213,14 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         }
 
         //基础技能班和线上基础技能班,可分班原则为声部人数/6向上取整
-//        if(classGroup.getType().equals(ClassGroupTypeEnum.HIGH_ONLINE)||classGroup.getType().equals(ClassGroupTypeEnum.HIGH)){
-//            int classGroupNum = classGroupDao.getMusicGroupHighClassNumBySubject(classGroup.getMusicGroupId(), classGroup.getSubjectIdList());
-//            int musicGroupSubjectNum = studentRegistrationDao.getMusicGroupSubjectNum(classGroup.getMusicGroupId(), classGroup.getSubjectIdList());
-//        }
+        if (classGroup.getType().equals(ClassGroupTypeEnum.HIGH_ONLINE) || classGroup.getType().equals(ClassGroupTypeEnum.HIGH)) {
+            String subjectIds = classGroup.getType().equals(ClassGroupTypeEnum.HIGH_ONLINE) ? classGroup.getMemo() : classGroup.getSubjectIdList();
+            HighClassGroupNumDto highClassGroupNumDto = getSubjectMaxHighClassGroupNum(classGroup.getMusicGroupId(), classGroup.getType(), subjectIds);
+            if (highClassGroupNumDto.getNowHighClassGroupNum() >= highClassGroupNumDto.getMaxHighClassGroupNum()) {
+                String errMsg = classGroup.getType().equals(ClassGroupTypeEnum.HIGH_ONLINE) ? "线上基础技能班" : "基础技能班";
+                throw new BizException("此乐团所选声部," + errMsg + "数量不能大于" + highClassGroupNumDto.getMaxHighClassGroupNum());
+            }
+        }
 
         String userIds = classGroup.getUserIds();
 
@@ -367,7 +366,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public ClassGroup addMixClassGroup(String musicGroupId, String name, String classGroupIds){
+    public ClassGroup addMixClassGroup(String musicGroupId, String name, String classGroupIds) {
         Date date;
         date = new Date();
 
@@ -578,7 +577,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             batchAddImGroup(classGroupImGroupList);
             classGroupTeacherMapperService.classGroupTeachersInsert(classGroupTeacherMapperList);
             // 检测新排课冲突
-            courseScheduleService.checkNewCourseSchedules(courseScheduleList, false,false);
+            courseScheduleService.checkNewCourseSchedules(courseScheduleList, false, false);
             courseScheduleDao.batchAddCourseSchedules(courseScheduleList);
         } finally {
             redisCache.releaseLocked(key, value);
@@ -601,7 +600,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             param.put("teacherId", queryInfo.getSearch());
             param.put("attendanceStatus", YesOrNoEnum.YES);
             Set<String> classGroupIds = dataList.stream().map(e -> e.getClassGroupIds()).collect(Collectors.toSet());
-            Map<Integer,Long> hasRestClassMap = MapUtil.convertIntegerMap(courseScheduleDao.queryHasReatClass(classGroupIds,queryInfo.getSearch()));
+            Map<Integer, Long> hasRestClassMap = MapUtil.convertIntegerMap(courseScheduleDao.queryHasReatClass(classGroupIds, queryInfo.getSearch()));
             int teacherPersonalAttendancesCount = teacherAttendanceDao.getTeacherPersonalAttendancesCount(param);
             dataList.forEach(e -> {
                 param.put("musicGroupId", e.getMusicGroupId());
@@ -739,8 +738,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 
                 for (TeacherDefaultMusicGroupSalary teacherDefaultMusicGroupSalary : teacherSalaryByUserIdAndType) {
                     if (teacherDefaultMusicGroupSalary.getCourseScheduleType().equals(CourseSchedule.CourseScheduleType.HIGH_ONLINE) && teacherDefaultMusicGroupSalary.getSalaryRuleJson() != null) {
-                        if(studentNum>5){
-                            studentNum=Long.valueOf(5);
+                        if (studentNum > 5) {
+                            studentNum = Long.valueOf(5);
                         }
                         BigDecimal salary = JSON.parseObject(teacherDefaultMusicGroupSalary.getSalaryRuleJson()).getBigDecimal(studentNum.toString());
                         teacherDefaultMusicGroupSalary.setMainTeacher30MinSalary(salary);
@@ -1066,8 +1065,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                     List<TeacherDefaultMusicGroupSalary> teacherSalaryList = teacherDefaultMusicGroupSalaryService.getTeacherSalaryByUserIdAndType(classGroupTeacher.getUserId(), ClassGroupTypeEnum.HIGH_ONLINE.getCode(), null);
                     Map<CourseSchedule.CourseScheduleType, TeacherDefaultMusicGroupSalary> collect = teacherSalaryList.stream().collect(Collectors.toMap(TeacherDefaultMusicGroupSalary::getCourseScheduleType, teacherDefaultMusicGroupSalary -> teacherDefaultMusicGroupSalary));
                     TeacherDefaultMusicGroupSalary teacherDefaultMusicGroupSalary = collect.get(courseSchedule.getType());
-                    if(studentNum>5){
-                        studentNum=5;
+                    if (studentNum > 5) {
+                        studentNum = 5;
                     }
                     BigDecimal salary = JSON.parseObject(teacherDefaultMusicGroupSalary.getSalaryRuleJson()).getBigDecimal(studentNum.toString());
 
@@ -1096,108 +1095,108 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-	public boolean addStudentToClassGroupAndCourseArranging(Integer studentId, String classGroupIdListStr,
+    public boolean addStudentToClassGroupAndCourseArranging(Integer studentId, String classGroupIdListStr,
                                                             String batchNo,
-			List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingsList) {
+                                                            List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingsList) {
 
         //如果学员已经在某些班级,
-        Boolean isExistClassGroup = classGroupStudentMapperDao.existByClassGroupIds(classGroupIdListStr,studentId);
-        if(isExistClassGroup){
+        Boolean isExistClassGroup = classGroupStudentMapperDao.existByClassGroupIds(classGroupIdListStr, studentId);
+        if (isExistClassGroup) {
             return true;
         }
-		List<ClassGroup> classGroupList = classGroupDao.findClassGroupByIds(classGroupIdListStr);
-		if (classGroupList == null || classGroupList.size() == 0) {
-			throw new BizException("班级查询失败");
-		}
-
-		Date date = new Date();
-		List<CourseScheduleStudentPayment> courseScheduleStudentPayments = new ArrayList<CourseScheduleStudentPayment>();
-
-		// 计算单价
-		Map<CourseScheduleType, BigDecimal> unitPriceMap = new HashMap<CourseSchedule.CourseScheduleType, BigDecimal>();
-		Map<CourseScheduleType, BigDecimal> originUnitPriceMap = new HashMap<CourseSchedule.CourseScheduleType, BigDecimal>();
-		Map<CourseScheduleType, BigDecimal> totalCurrentPriceMap = new HashMap<CourseSchedule.CourseScheduleType, BigDecimal>();
-		Map<CourseScheduleType, BigDecimal> totalOriginPriceMap = new HashMap<CourseSchedule.CourseScheduleType, BigDecimal>();
-		for (MusicGroupPaymentCalenderCourseSettings musicGroupPaymentCalenderCourseSettings : musicGroupPaymentCalenderCourseSettingsList) {
-			unitPriceMap.put(
-					musicGroupPaymentCalenderCourseSettings.getCourseType(),
-					musicGroupPaymentCalenderCourseSettings.getCourseCurrentPrice().divide(
-							new BigDecimal(musicGroupPaymentCalenderCourseSettings.getCourseTotalMinuties()),CommonConstants.DECIMAL_FINAL_PLACE,BigDecimal.ROUND_DOWN));
-			
-			originUnitPriceMap.put(
-					musicGroupPaymentCalenderCourseSettings.getCourseType(),
-					musicGroupPaymentCalenderCourseSettings.getCourseOriginalPrice().divide(
-							new BigDecimal(musicGroupPaymentCalenderCourseSettings.getCourseTotalMinuties()),CommonConstants.DECIMAL_FINAL_PLACE,BigDecimal.ROUND_DOWN));
-			
-			totalCurrentPriceMap.put(musicGroupPaymentCalenderCourseSettings.getCourseType(), musicGroupPaymentCalenderCourseSettings.getCourseCurrentPrice());
-			totalOriginPriceMap.put(musicGroupPaymentCalenderCourseSettings.getCourseType(), musicGroupPaymentCalenderCourseSettings.getCourseOriginalPrice());
-		}
-		
-		Map<CourseScheduleType, BigDecimal> totalPriceMap = new HashMap<CourseSchedule.CourseScheduleType, BigDecimal>();
-		Map<CourseScheduleType, BigDecimal> totalOrignPriceMap = new HashMap<CourseSchedule.CourseScheduleType, BigDecimal>();
-
-		BigDecimal unitPrice = new BigDecimal(0);
-		BigDecimal originUnitPrice = new BigDecimal(0);
-		CourseScheduleType courseType = null;
-		for (ClassGroup classGroup : classGroupList) {
-			// 1、增加班级人数
-			classGroupDao.addStudentNum(classGroup);
-
-			// 2、插入关联关系
-			ClassGroupStudentMapper classGroupStudentMapper = new ClassGroupStudentMapper();
-			classGroupStudentMapper.setMusicGroupId(classGroup.getMusicGroupId());
-			classGroupStudentMapper.setClassGroupId(classGroup.getId());
-			classGroupStudentMapper.setUserId(studentId);
-			classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
-			classGroupStudentMapper.setGroupType(classGroup.getGroupType());
-			classGroupStudentMapper.setCreateTime(date);
-			classGroupStudentMapperDao.insert(classGroupStudentMapper);
-
-			// 3、学生加入级未开始课程
-			List<CourseSchedule> courseScheduleList = courseScheduleService.findNoStartCoursesByClassGroupId(classGroup.getId());
-			for (CourseSchedule courseSchedule : courseScheduleList) {
-				CourseScheduleStudentPayment courseScheduleStudentPayment = new CourseScheduleStudentPayment();
-				courseScheduleStudentPayment.setCourseSchedule(courseSchedule);
-				courseScheduleStudentPayment.setGroupType(classGroup.getGroupType());
-				courseScheduleStudentPayment.setMusicGroupId(classGroup.getMusicGroupId());
-				courseScheduleStudentPayment.setCourseScheduleId(courseSchedule.getId());
-				courseScheduleStudentPayment.setUserId(studentId);
-				courseScheduleStudentPayment.setBatchNo(batchNo);
-
-				unitPrice = unitPriceMap.get(courseSchedule.getType());
-				if (unitPrice != null) {
-					courseType = courseSchedule.getType();
-					BigDecimal duration = new BigDecimal(DateUtil.minutesBetween(courseSchedule.getStartClassTime(), courseSchedule.getEndClassTime()));
-					courseScheduleStudentPayment.setExpectPrice(unitPrice.multiply(duration).setScale(2, BigDecimal.ROUND_DOWN));
-
-					if (totalPriceMap.containsKey(courseType)) {
-						totalPriceMap.put(courseType, totalPriceMap.get(courseType).add(courseScheduleStudentPayment.getExpectPrice()));
-					} else {
-						totalPriceMap.put(courseType, courseScheduleStudentPayment.getExpectPrice());
-					}
-				}
-				
-				originUnitPrice = originUnitPriceMap.get(courseSchedule.getType());
-				if (originUnitPrice != null) {
-					courseType = courseSchedule.getType();
-					BigDecimal duration = new BigDecimal(DateUtil.minutesBetween(courseSchedule.getStartClassTime(), courseSchedule.getEndClassTime()));
-					courseScheduleStudentPayment.setOriginalPrice(originUnitPrice.multiply(duration).setScale(2, BigDecimal.ROUND_DOWN));
-
-					if (totalOrignPriceMap.containsKey(courseType)) {
-						totalOrignPriceMap.put(courseType, totalOrignPriceMap.get(courseType).add(courseScheduleStudentPayment.getOriginalPrice()));
-					} else {
-						totalOrignPriceMap.put(courseType, courseScheduleStudentPayment.getOriginalPrice());
-					}
-				}
-				courseScheduleStudentPayment.setClassGroupId(classGroup.getId());
-				courseScheduleStudentPayment.setCreateTime(date);
-				courseScheduleStudentPayment.setUpdateTime(date);
-				courseScheduleStudentPayments.add(courseScheduleStudentPayment);
-			}
+        List<ClassGroup> classGroupList = classGroupDao.findClassGroupByIds(classGroupIdListStr);
+        if (classGroupList == null || classGroupList.size() == 0) {
+            throw new BizException("班级查询失败");
+        }
+
+        Date date = new Date();
+        List<CourseScheduleStudentPayment> courseScheduleStudentPayments = new ArrayList<CourseScheduleStudentPayment>();
+
+        // 计算单价
+        Map<CourseScheduleType, BigDecimal> unitPriceMap = new HashMap<CourseSchedule.CourseScheduleType, BigDecimal>();
+        Map<CourseScheduleType, BigDecimal> originUnitPriceMap = new HashMap<CourseSchedule.CourseScheduleType, BigDecimal>();
+        Map<CourseScheduleType, BigDecimal> totalCurrentPriceMap = new HashMap<CourseSchedule.CourseScheduleType, BigDecimal>();
+        Map<CourseScheduleType, BigDecimal> totalOriginPriceMap = new HashMap<CourseSchedule.CourseScheduleType, BigDecimal>();
+        for (MusicGroupPaymentCalenderCourseSettings musicGroupPaymentCalenderCourseSettings : musicGroupPaymentCalenderCourseSettingsList) {
+            unitPriceMap.put(
+                    musicGroupPaymentCalenderCourseSettings.getCourseType(),
+                    musicGroupPaymentCalenderCourseSettings.getCourseCurrentPrice().divide(
+                            new BigDecimal(musicGroupPaymentCalenderCourseSettings.getCourseTotalMinuties()), CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_DOWN));
+
+            originUnitPriceMap.put(
+                    musicGroupPaymentCalenderCourseSettings.getCourseType(),
+                    musicGroupPaymentCalenderCourseSettings.getCourseOriginalPrice().divide(
+                            new BigDecimal(musicGroupPaymentCalenderCourseSettings.getCourseTotalMinuties()), CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_DOWN));
+
+            totalCurrentPriceMap.put(musicGroupPaymentCalenderCourseSettings.getCourseType(), musicGroupPaymentCalenderCourseSettings.getCourseCurrentPrice());
+            totalOriginPriceMap.put(musicGroupPaymentCalenderCourseSettings.getCourseType(), musicGroupPaymentCalenderCourseSettings.getCourseOriginalPrice());
+        }
+
+        Map<CourseScheduleType, BigDecimal> totalPriceMap = new HashMap<CourseSchedule.CourseScheduleType, BigDecimal>();
+        Map<CourseScheduleType, BigDecimal> totalOrignPriceMap = new HashMap<CourseSchedule.CourseScheduleType, BigDecimal>();
+
+        BigDecimal unitPrice = new BigDecimal(0);
+        BigDecimal originUnitPrice = new BigDecimal(0);
+        CourseScheduleType courseType = null;
+        for (ClassGroup classGroup : classGroupList) {
+            // 1、增加班级人数
+            classGroupDao.addStudentNum(classGroup);
+
+            // 2、插入关联关系
+            ClassGroupStudentMapper classGroupStudentMapper = new ClassGroupStudentMapper();
+            classGroupStudentMapper.setMusicGroupId(classGroup.getMusicGroupId());
+            classGroupStudentMapper.setClassGroupId(classGroup.getId());
+            classGroupStudentMapper.setUserId(studentId);
+            classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
+            classGroupStudentMapper.setGroupType(classGroup.getGroupType());
+            classGroupStudentMapper.setCreateTime(date);
+            classGroupStudentMapperDao.insert(classGroupStudentMapper);
+
+            // 3、学生加入级未开始课程
+            List<CourseSchedule> courseScheduleList = courseScheduleService.findNoStartCoursesByClassGroupId(classGroup.getId());
+            for (CourseSchedule courseSchedule : courseScheduleList) {
+                CourseScheduleStudentPayment courseScheduleStudentPayment = new CourseScheduleStudentPayment();
+                courseScheduleStudentPayment.setCourseSchedule(courseSchedule);
+                courseScheduleStudentPayment.setGroupType(classGroup.getGroupType());
+                courseScheduleStudentPayment.setMusicGroupId(classGroup.getMusicGroupId());
+                courseScheduleStudentPayment.setCourseScheduleId(courseSchedule.getId());
+                courseScheduleStudentPayment.setUserId(studentId);
+                courseScheduleStudentPayment.setBatchNo(batchNo);
+
+                unitPrice = unitPriceMap.get(courseSchedule.getType());
+                if (unitPrice != null) {
+                    courseType = courseSchedule.getType();
+                    BigDecimal duration = new BigDecimal(DateUtil.minutesBetween(courseSchedule.getStartClassTime(), courseSchedule.getEndClassTime()));
+                    courseScheduleStudentPayment.setExpectPrice(unitPrice.multiply(duration).setScale(2, BigDecimal.ROUND_DOWN));
+
+                    if (totalPriceMap.containsKey(courseType)) {
+                        totalPriceMap.put(courseType, totalPriceMap.get(courseType).add(courseScheduleStudentPayment.getExpectPrice()));
+                    } else {
+                        totalPriceMap.put(courseType, courseScheduleStudentPayment.getExpectPrice());
+                    }
+                }
+
+                originUnitPrice = originUnitPriceMap.get(courseSchedule.getType());
+                if (originUnitPrice != null) {
+                    courseType = courseSchedule.getType();
+                    BigDecimal duration = new BigDecimal(DateUtil.minutesBetween(courseSchedule.getStartClassTime(), courseSchedule.getEndClassTime()));
+                    courseScheduleStudentPayment.setOriginalPrice(originUnitPrice.multiply(duration).setScale(2, BigDecimal.ROUND_DOWN));
+
+                    if (totalOrignPriceMap.containsKey(courseType)) {
+                        totalOrignPriceMap.put(courseType, totalOrignPriceMap.get(courseType).add(courseScheduleStudentPayment.getOriginalPrice()));
+                    } else {
+                        totalOrignPriceMap.put(courseType, courseScheduleStudentPayment.getOriginalPrice());
+                    }
+                }
+                courseScheduleStudentPayment.setClassGroupId(classGroup.getId());
+                courseScheduleStudentPayment.setCreateTime(date);
+                courseScheduleStudentPayment.setUpdateTime(date);
+                courseScheduleStudentPayments.add(courseScheduleStudentPayment);
+            }
 
             //4、调整未上课课酬
             List<ClassGroupTeacherMapper> classGroupTeachers = classGroupTeacherMapperService.getClassGroupTeachers(classGroup.getId());
-            if ((classGroup.getType().equals(ClassGroupTypeEnum.HIGH_ONLINE)||classGroup.getType().equals(ClassGroupTypeEnum.HIGH)) && courseScheduleList.size() > 0) {
+            if ((classGroup.getType().equals(ClassGroupTypeEnum.HIGH_ONLINE) || classGroup.getType().equals(ClassGroupTypeEnum.HIGH)) && courseScheduleList.size() > 0) {
                 Date nowDate = new Date();
                 List<CourseScheduleTeacherSalary> courseScheduleTeacherSalaryList = new ArrayList<>();
                 List<Long> courseScheduleIds = courseScheduleList.stream().map(CourseSchedule::getId).collect(Collectors.toList());
@@ -1211,12 +1210,12 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                         Map<CourseSchedule.CourseScheduleType, TeacherDefaultMusicGroupSalary> collect = teacherSalaryList.stream().collect(Collectors.toMap(TeacherDefaultMusicGroupSalary::getCourseScheduleType, teacherDefaultMusicGroupSalary -> teacherDefaultMusicGroupSalary));
                         TeacherDefaultMusicGroupSalary teacherDefaultMusicGroupSalary = collect.get(CourseSchedule.CourseScheduleType.HIGH_ONLINE);
 
-                        int studentNum = classGroup.getStudentNum()+1;
-                        if(studentNum>5){
-                            studentNum=5;
+                        int studentNum = classGroup.getStudentNum() + 1;
+                        if (studentNum > 5) {
+                            studentNum = 5;
                         }
 
-                        BigDecimal salary = JSON.parseObject(teacherDefaultMusicGroupSalary.getSalaryRuleJson()).getBigDecimal(studentNum+"");
+                        BigDecimal salary = JSON.parseObject(teacherDefaultMusicGroupSalary.getSalaryRuleJson()).getBigDecimal(studentNum + "");
 
                         CourseScheduleTeacherSalary courseScheduleTeacherSalary = new CourseScheduleTeacherSalary();
                         courseScheduleTeacherSalary.setCourseScheduleId(courseSchedule.getId());
@@ -1234,36 +1233,36 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                 courseScheduleTeacherSalaryService.batchInsert(courseScheduleTeacherSalaryList);
             }
 
-			// 5、加入班级群组
-			ImGroupMember[] imGroupMembers = new ImGroupMember[] { new ImGroupMember(studentId.toString()) };
-			imFeignService.groupJoin(new ImGroupModel(classGroup.getId().toString(), imGroupMembers, classGroup.getName()));
-
-		}
-
-		if (courseScheduleStudentPayments.size() > 0) {
-			// 排序
-			Collections.sort(courseScheduleStudentPayments);
-			List<CourseScheduleType> list = new ArrayList<CourseSchedule.CourseScheduleType>();
-			for (CourseScheduleStudentPayment courseScheduleStudentPayment : courseScheduleStudentPayments) {
-				courseType = courseScheduleStudentPayment.getCourseSchedule().getType();
-				if (!list.contains(courseType)) {
-					list.add(courseType);
-
-					// 修改第一节课的金额
-					courseScheduleStudentPayment.setExpectPrice(courseScheduleStudentPayment.getExpectPrice().add(
-							totalCurrentPriceMap.get(courseType).subtract(totalPriceMap.get(courseType))));
-					
-					courseScheduleStudentPayment.setOriginalPrice(courseScheduleStudentPayment.getOriginalPrice().add(
-							totalOriginPriceMap.get(courseType).subtract(totalOrignPriceMap.get(courseType))));
-				}
-			}
-			courseScheduleStudentPaymentService.batchInsert(courseScheduleStudentPayments);
-		}
-
-		return true;
-	}
-
-	@Override
+            // 5、加入班级群组
+            ImGroupMember[] imGroupMembers = new ImGroupMember[]{new ImGroupMember(studentId.toString())};
+            imFeignService.groupJoin(new ImGroupModel(classGroup.getId().toString(), imGroupMembers, classGroup.getName()));
+
+        }
+
+        if (courseScheduleStudentPayments.size() > 0) {
+            // 排序
+            Collections.sort(courseScheduleStudentPayments);
+            List<CourseScheduleType> list = new ArrayList<CourseSchedule.CourseScheduleType>();
+            for (CourseScheduleStudentPayment courseScheduleStudentPayment : courseScheduleStudentPayments) {
+                courseType = courseScheduleStudentPayment.getCourseSchedule().getType();
+                if (!list.contains(courseType)) {
+                    list.add(courseType);
+
+                    // 修改第一节课的金额
+                    courseScheduleStudentPayment.setExpectPrice(courseScheduleStudentPayment.getExpectPrice().add(
+                            totalCurrentPriceMap.get(courseType).subtract(totalPriceMap.get(courseType))));
+
+                    courseScheduleStudentPayment.setOriginalPrice(courseScheduleStudentPayment.getOriginalPrice().add(
+                            totalOriginPriceMap.get(courseType).subtract(totalOrignPriceMap.get(courseType))));
+                }
+            }
+            courseScheduleStudentPaymentService.batchInsert(courseScheduleStudentPayments);
+        }
+
+        return true;
+    }
+
+    @Override
     public List<ClassGroup> findNoClassSubjects(String musicGroupId) {
         return classGroupDao.findNoClassSubjects(musicGroupId);
     }
@@ -1512,8 +1511,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
     }
 
     @Override
-	public boolean updateClassStudentNum(Integer classGroupId) {
-    	ClassGroup classGroup = classGroupDao.lockClassGroup(classGroupId);
+    public boolean updateClassStudentNum(Integer classGroupId) {
+        ClassGroup classGroup = classGroupDao.lockClassGroup(classGroupId);
         if (Objects.isNull(classGroup)) {
             throw new BizException("班级不存在");
         }
@@ -1524,9 +1523,9 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         classGroupDao.update(classGroup);
 
         return true;
-	}
+    }
 
-	@Override
+    @Override
     public TeacherClassHeadInfo findTeacherClassGroupInfo(Integer classGroupId) {
         if (Objects.isNull(classGroupId)) {
             throw new BizException("请指定班级");
@@ -1616,9 +1615,9 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         truantStudent.addAll(leaveStudent);
         if (!CollectionUtils.isEmpty(truantStudent)) {
             CourseSchedule schedule = courseScheduleDao.get(courseScheduleId);
-            if(schedule.getGroupType() == MUSIC){
+            if (schedule.getGroupType() == MUSIC) {
                 Set<Long> collect = truantStudent.stream().map(e -> e.getStudentId()).collect(Collectors.toSet());
-                Map<Integer,String> paymentStatusMap = MapUtil.convertIntegerMap(musicGroupPaymentCalenderDao.queryUserCoursePaymentStatus(collect,schedule.getMusicGroupId()));
+                Map<Integer, String> paymentStatusMap = MapUtil.convertIntegerMap(musicGroupPaymentCalenderDao.queryUserCoursePaymentStatus(collect, schedule.getMusicGroupId()));
                 truantStudent.forEach(studentAttendanceViewDto -> {
                     studentAttendanceViewDto.setPaymentStatus(paymentStatusMap.get(studentAttendanceViewDto.getStudentId().intValue()));
                 });
@@ -1671,7 +1670,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public ClassGroup classGroupAdjust(List<ClassGroup4MixDto> classGroup4MixDtos){
+    public ClassGroup classGroupAdjust(List<ClassGroup4MixDto> classGroup4MixDtos) {
         Date date = new Date();
         String musicGroupId = classGroup4MixDtos.get(0).getMusicGroupId();
         MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
@@ -1701,7 +1700,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         String subjectIds = subjectList.stream().map(subject -> subject.getId().toString()).collect(Collectors.joining(","));
         String subjectNames = subjectList.stream().map(subject -> subject.getName()).collect(Collectors.joining("/"));
 
-        if(classGroup4MixDtos.get(0).getType().equals(ClassGroupTypeEnum.MUSIC_NETWORK)){
+        if (classGroup4MixDtos.get(0).getType().equals(ClassGroupTypeEnum.MUSIC_NETWORK)) {
             teachMode = TeachModeEnum.ONLINE;
             List<String> studentNames = studentDao.getStudentNames(studentIdList);
             classGroup4MixDtos.get(0).setClassGroupName(subjectNames + "•" + StringUtils.join(studentNames, ","));
@@ -1754,7 +1753,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         List<ClassGroupTeacherMapper> classGroupTeacherMapperList = classGroup4MixDtos.get(0).getClassGroupTeacherMapperList();
 
         Set<Integer> noRepeatTeacherIds = classGroupTeacherMapperList.stream().map(ClassGroupTeacherMapper::getUserId).collect(Collectors.toSet());
-        if(noRepeatTeacherIds.size()!=classGroupTeacherMapperList.size()){
+        if (noRepeatTeacherIds.size() != classGroupTeacherMapperList.size()) {
             throw new BizException("主教与助教存在冲突");
         }
 
@@ -1791,7 +1790,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
         for (ClassGroup4MixDto classGroup4MixDto : classGroup4MixDtos) {
-            if(classGroup4MixDto.getCourseTimeDtoList() == null || classGroup4MixDto.getCourseTimeDtoList().size() == 0){
+            if (classGroup4MixDto.getCourseTimeDtoList() == null || classGroup4MixDto.getCourseTimeDtoList().size() == 0) {
                 break;
             }
             //5、插入班级排课信息
@@ -1799,13 +1798,13 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 
             long totalCourseDuration = 0;
 
-            if(!courseTypeMinutesMap.containsKey(classGroup4MixDto.getCourseType().getCode())){
+            if (!courseTypeMinutesMap.containsKey(classGroup4MixDto.getCourseType().getCode())) {
                 throw new BizException("{}课程类型暂无剩余课程时长", classGroup4MixDto.getCourseType().getMsg());
             }
             Integer totalMinutes = courseTypeMinutesMap.get(classGroup4MixDto.getCourseType().getCode());
 //            classGroup4MixDto.setCourseTimes(totalMinutes/(int)courseDuration);
 
-            if(classGroup4MixDto.getCourseTimes()<=0){
+            if (classGroup4MixDto.getCourseTimes() <= 0) {
                 throw new BizException("{}课程类型剩余课程时长不足", classGroup4MixDto.getCourseType().getMsg());
             }
 
@@ -1838,7 +1837,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 
                     totalCourseDuration += classCourseDuration;
 
-                    if (totalCourseDuration>totalMinutes) {
+                    if (totalCourseDuration > totalMinutes) {
                         break WhileNode;
                     }
 
@@ -1862,7 +1861,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                     courseSchedule.setOrganId(musicGroup.getOrganId());
                     if (classGroup4MixDto.getCourseType().equals(CourseSchedule.CourseScheduleType.MIX)) {
                         courseSchedule.setName(classGroup4MixDto.getCourseType().getMsg());
-                    }else if(classGroup4MixDto.getCourseType().equals(CourseScheduleType.MUSIC_NETWORK)){
+                    } else if (classGroup4MixDto.getCourseType().equals(CourseScheduleType.MUSIC_NETWORK)) {
                         courseSchedule.setName(classGroup.getName());
                     } else {
                         courseSchedule.setName(subjectNames + "-" + classGroup4MixDto.getCourseType().getMsg());
@@ -1892,9 +1891,9 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             }
         }
 
-        if(courseScheduleList.size() > 0){
+        if (courseScheduleList.size() > 0) {
             //检测新排课冲突
-            courseScheduleService.checkNewCourseSchedules(courseScheduleList, false,false);
+            courseScheduleService.checkNewCourseSchedules(courseScheduleList, false, false);
         }
 
         //老师结算表
@@ -1909,7 +1908,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
     }
 
     @Transactional(rollbackFor = Exception.class)
-    public List<CourseSchedule> getCourseSchedules(ClassGroup4MixDto classGroup4MixDto,List<CourseSchedule> courseScheduleList,MusicGroupStudentClassAdjust classAdjust){
+    public List<CourseSchedule> getCourseSchedules(ClassGroup4MixDto classGroup4MixDto, List<CourseSchedule> courseScheduleList, MusicGroupStudentClassAdjust classAdjust) {
         Date date = new Date();
         String musicGroupId = classGroup4MixDto.getMusicGroupId();
         MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
@@ -1918,7 +1917,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         TeachModeEnum teachMode = TeachModeEnum.OFFLINE;
         if (classGroup4MixDto.getType().equals(ClassGroupTypeEnum.HIGH_ONLINE)) {
             teachMode = TeachModeEnum.ONLINE;
-        }else if(classGroup4MixDto.getType().equals(ClassGroupTypeEnum.MUSIC_NETWORK)){
+        } else if (classGroup4MixDto.getType().equals(ClassGroupTypeEnum.MUSIC_NETWORK)) {
             teachMode = TeachModeEnum.ONLINE;
         }
 
@@ -1945,7 +1944,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         long classCourseDuration = Integer.parseInt(jsonObject.get(classGroup4MixDto.getCourseType().getCode()).toString());
 //
         Map<String, Integer> classCourseMinuteMap = JSON.parseObject(classCourseMinute, Map.class);
-        classGroup4MixDto.setCourseTimes(classCourseMinuteMap.get(classGroup4MixDto.getCourseType().getCode())/(int)classCourseDuration);
+        classGroup4MixDto.setCourseTimes(classCourseMinuteMap.get(classGroup4MixDto.getCourseType().getCode()) / (int) classCourseDuration);
 
         List<Integer> studentIdList = classGroup4MixDto.getStudents();
         List<StudentRegistration> studentList = studentRegistrationService.findStudentListByUserIdList(musicGroupId, studentIdList);
@@ -1999,7 +1998,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                 courseSchedule.setClassGroupId(classGroup.getId());
                 if (classGroup4MixDto.getCourseType().equals(CourseSchedule.CourseScheduleType.MIX)) {
                     courseSchedule.setName(classGroup4MixDto.getCourseType().getMsg());
-                }else if(classGroup4MixDto.getCourseType().equals(CourseScheduleType.MUSIC_NETWORK)){
+                } else if (classGroup4MixDto.getCourseType().equals(CourseScheduleType.MUSIC_NETWORK)) {
                     courseSchedule.setName(classGroup.getName());
                 } else {
                     courseSchedule.setName(subjectNames + "-" + classGroup4MixDto.getCourseType().getMsg());
@@ -2018,7 +2017,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
     }
 
     @Transactional(rollbackFor = Exception.class)
-    public ClassGroup createClassGroup(ClassGroup4MixDto classGroup4MixDto){
+    public ClassGroup createClassGroup(ClassGroup4MixDto classGroup4MixDto) {
         Date date = new Date();
         String musicGroupId = classGroup4MixDto.getMusicGroupId();
         List<Integer> studentIdList = classGroup4MixDto.getStudents();
@@ -2032,7 +2031,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 
         List<Subject> subjectList = subjectService.findBySubjectByIdList(subjectIdList);
         String subjectIds = subjectList.stream().map(subject -> subject.getId().toString()).collect(Collectors.joining(","));
-            //1、新建班级
+        //1、新建班级
         ClassGroup classGroup = new ClassGroup();
         classGroup.setMusicGroupId(classGroup4MixDto.getMusicGroupId());
         classGroup.setSubjectIdList(subjectIds);
@@ -2051,22 +2050,22 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
     }
 
     @Transactional(rollbackFor = Exception.class)
-    public List<CourseSchedule> autoAdjust(ClassGroup4MixDto classGroup4MixDto,List<CourseSchedule> courseScheduleList,MusicGroupStudentClassAdjust classAdjust){
+    public List<CourseSchedule> autoAdjust(ClassGroup4MixDto classGroup4MixDto, List<CourseSchedule> courseScheduleList, MusicGroupStudentClassAdjust classAdjust) {
         Boolean checkFlag = courseScheduleService.checkNewCourseSchedules(courseScheduleList, false, true);
-        if(!checkFlag){
+        if (!checkFlag) {
             //排课开始时间加一周
             Date stringToDate = DateUtil.stringToDate(classGroup4MixDto.getStartDate(), DateUtil.ISO_EXPANDED_DATE_FORMAT);
-            classGroup4MixDto.setStartDate(DateUtil.format(DateUtil.addDays(stringToDate, 7),DateUtil.ISO_EXPANDED_DATE_FORMAT));
+            classGroup4MixDto.setStartDate(DateUtil.format(DateUtil.addDays(stringToDate, 7), DateUtil.ISO_EXPANDED_DATE_FORMAT));
             //再次尝试排课
-            courseScheduleList = getCourseSchedules(classGroup4MixDto,courseScheduleList,classAdjust);
-            autoAdjust(classGroup4MixDto,courseScheduleList,classAdjust);
+            courseScheduleList = getCourseSchedules(classGroup4MixDto, courseScheduleList, classAdjust);
+            autoAdjust(classGroup4MixDto, courseScheduleList, classAdjust);
         }
         return courseScheduleList;
     }
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public ClassGroup classGroupAdjust2(ClassGroup4MixDto classGroup4MixDto){
+    public ClassGroup classGroupAdjust2(ClassGroup4MixDto classGroup4MixDto) {
         Date date = new Date();
         String musicGroupId = classGroup4MixDto.getMusicGroupId();
         MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
@@ -2092,7 +2091,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         JSONObject jsonObject = JSON.parseObject(classAdjust.getDefaultCourseTypeMinute());
         long classCourseDuration = Integer.parseInt(jsonObject.get(classGroup4MixDto.getCourseType().getCode()).toString());
         ClassGroup classGroup = classGroup4MixDto.getClassGroup();
-        if(classGroup == null){
+        if (classGroup == null) {
             //建班
             classGroup = createClassGroup(classGroup4MixDto);
             classGroup4MixDto.setClassGroup(classGroup);
@@ -2131,12 +2130,12 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         }
         //排课
         List<CourseSchedule> courseScheduleList = new ArrayList<>();
-        getCourseSchedules(classGroup4MixDto,courseScheduleList,classAdjust);
+        getCourseSchedules(classGroup4MixDto, courseScheduleList, classAdjust);
 
         //自动排课,校验冲突
-        if(courseScheduleList.size() > 0){
+        if (courseScheduleList.size() > 0) {
             //冲突校验
-            courseScheduleList = autoAdjust(classGroup4MixDto,courseScheduleList,classAdjust);
+            courseScheduleList = autoAdjust(classGroup4MixDto, courseScheduleList, classAdjust);
 
             List<Integer> allTeacherIds = classGroupTeacherMapperList.stream()
                     .map(ClassGroupTeacherMapper::getUserId)
@@ -2176,7 +2175,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             }
             Integer musicGroupStudentClassAdjustId = classGroup4MixDto.getMusicGroupStudentClassAdjustId();
             //学生结算表
-            courseScheduleStudentPaymentService.createForMusicGroup(courseScheduleList, studentIdList,musicGroupStudentClassAdjustId);
+            courseScheduleStudentPaymentService.createForMusicGroup(courseScheduleList, studentIdList, musicGroupStudentClassAdjustId);
             return classGroup;
         }
         return null;
@@ -2220,7 +2219,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                 imFeignService.groupJoin(new ImGroupModel(classGroupId.toString(), imGroupMembers, classGroup.getName()));
             });
         }
-        if (Objects.nonNull(classGroup4MixDtos.get(0).getCourseAddType())&&classGroup4MixDtos.get(0).getCourseAddType().equals("onlyUpdateTeacher")) {
+        if (Objects.nonNull(classGroup4MixDtos.get(0).getCourseAddType()) && classGroup4MixDtos.get(0).getCourseAddType().equals("onlyUpdateTeacher")) {
             List<Integer> classGroupIds = new ArrayList<>();
             classGroupIds.add(classGroupId);
             // 删除历史记录
@@ -2244,7 +2243,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 
         MusicGroup musicGroup = musicGroupDao.get(classGroup.getMusicGroupId());
 
-        Integer schoolId = teachMode.equals(TeachModeEnum.ONLINE)? null : musicGroup.getSchoolId();
+        Integer schoolId = teachMode.equals(TeachModeEnum.ONLINE) ? null : musicGroup.getSchoolId();
 
         List<Subject> subjectList = subjectService.findBySubjectByIdList(classGroup.getSubjectIdList());
 
@@ -2254,7 +2253,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         List<ClassGroupTeacherMapper> newClassGroupTeacherMapperList = classGroup4MixDtos.get(0).getClassGroupTeacherMapperList();
 
         Set<Integer> noRepeatTeacherIds = newClassGroupTeacherMapperList.stream().map(ClassGroupTeacherMapper::getUserId).collect(Collectors.toSet());
-        if(noRepeatTeacherIds.size()!=newClassGroupTeacherMapperList.size()){
+        if (noRepeatTeacherIds.size() != newClassGroupTeacherMapperList.size()) {
             throw new BizException("主教与助教存在冲突");
         }
 
@@ -2308,14 +2307,14 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             //3、插入班级排课信息
             LocalDateTime now = LocalDate.parse(classGroup4MixDto.getStartDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd")).atStartOfDay();
 
-            if(!courseTypeMinutesMap.containsKey(classGroup4MixDto.getCourseType().getCode())){
+            if (!courseTypeMinutesMap.containsKey(classGroup4MixDto.getCourseType().getCode())) {
                 throw new BizException("{}课程类型暂无剩余课程时长", classGroup4MixDto.getCourseType().getMsg());
             }
             Integer totalMinutes = courseTypeMinutesMap.get(classGroup4MixDto.getCourseType().getCode());
             long totalCourseDuration = 0;
 //            classGroup4MixDto.setCourseTimes(totalMinutes/(int)courseDuration);
 
-            if(classGroup4MixDto.getCourseTimes()<=0){
+            if (classGroup4MixDto.getCourseTimes() <= 0) {
                 throw new BizException("{}课程类型剩余课程时长不足", classGroup4MixDto.getCourseType().getMsg());
             }
 
@@ -2347,7 +2346,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 
                     totalCourseDuration += classCourseDuration;
 
-                    if (totalCourseDuration>totalMinutes) {
+                    if (totalCourseDuration > totalMinutes) {
                         break WhileNode;
                     }
 
@@ -2403,7 +2402,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 //        if (classGroup.getType().equals(ClassGroupTypeEnum.SNAP)) {
 //            courseScheduleService.checkSnapCourseShchedules(courseScheduleList);
 //        } else {
-        courseScheduleService.checkNewCourseSchedules(courseScheduleList, false,false);
+        courseScheduleService.checkNewCourseSchedules(courseScheduleList, false, false);
 //        }
 
         //老师结算表
@@ -2483,7 +2482,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         List<ClassGroupTeacherMapper> classGroupTeacherMapperList = classGroup4MixDtos.get(0).getClassGroupTeacherMapperList();
 
         Set<Integer> noRepeatTeacherIds = classGroupTeacherMapperList.stream().map(ClassGroupTeacherMapper::getUserId).collect(Collectors.toSet());
-        if(noRepeatTeacherIds.size()!=classGroupTeacherMapperList.size()){
+        if (noRepeatTeacherIds.size() != classGroupTeacherMapperList.size()) {
             throw new BizException("主教与助教存在冲突");
         }
 
@@ -2522,14 +2521,14 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             //5、插入班级排课信息
             LocalDateTime now = LocalDate.parse(classGroup4MixDto.getStartDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd")).atStartOfDay();
 
-            if(!courseTypeMinutesMap.containsKey(classGroup4MixDto.getCourseType().getCode())){
+            if (!courseTypeMinutesMap.containsKey(classGroup4MixDto.getCourseType().getCode())) {
                 throw new BizException("{}课程类型暂无剩余课程时长", classGroup4MixDto.getCourseType().getMsg());
             }
             Integer totalMinutes = courseTypeMinutesMap.get(classGroup4MixDto.getCourseType().getCode());
             long totalCourseDuration = 0;
 //            classGroup4MixDto.setCourseTimes(totalMinutes/(int)courseDuration);
 
-            if(classGroup4MixDto.getCourseTimes()<=0){
+            if (classGroup4MixDto.getCourseTimes() <= 0) {
                 throw new BizException("{}课程类型剩余课程时长不足", classGroup4MixDto.getCourseType().getMsg());
             }
 
@@ -2562,7 +2561,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 
                     totalCourseDuration += classCourseDuration;
 
-                    if (totalCourseDuration>totalMinutes) {
+                    if (totalCourseDuration > totalMinutes) {
                         break WhileNode;
                     }
 
@@ -2618,7 +2617,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 
 //        courseScheduleService.checkSnapCourseShchedules(courseScheduleList);
 
-        courseScheduleService.checkNewCourseSchedules(courseScheduleList, false,false);
+        courseScheduleService.checkNewCourseSchedules(courseScheduleList, false, false);
 
         //老师结算表
         if (courseScheduleTeacherSalaryList.size() > 0) {
@@ -3240,13 +3239,13 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         return classGroup;
     }
 
-	@Override
-	public List<RemainCourseTypeDurationDto> queryRemainCourseTypeDuration(String classGroupIdList) {
-		return courseScheduleDao.queryRemainCourseTypeDuration(classGroupIdList);
-	}
+    @Override
+    public List<RemainCourseTypeDurationDto> queryRemainCourseTypeDuration(String classGroupIdList) {
+        return courseScheduleDao.queryRemainCourseTypeDuration(classGroupIdList);
+    }
 
     @Override
-    public Map<String,Integer> classGroupSubCourseNum(Integer classGroupId) {
+    public Map<String, Integer> classGroupSubCourseNum(Integer classGroupId) {
         return MapUtil.convertIntegerMap(courseScheduleDao.querySubCourseNumMap(classGroupId));
 
 //        List<Map<String,Object>> result = new ArrayList<>();
@@ -3266,43 +3265,43 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
     }
 
     @Override
-    public Map<String,Object> getDefaultPaymentCalender(List<Integer> classGroupIds) {
-        if(classGroupIds == null || classGroupIds.size() == 0){
+    public Map<String, Object> getDefaultPaymentCalender(List<Integer> classGroupIds) {
+        if (classGroupIds == null || classGroupIds.size() == 0) {
             throw new BizException("参数校验失败");
         }
-        Map<String,Object> result = new HashMap<>();
-        Map<Integer,Map<String,MusicGroupOrganizationCourseSettingsDetail>> resultMap = new HashMap<>();
+        Map<String, Object> result = new HashMap<>();
+        Map<Integer, Map<String, MusicGroupOrganizationCourseSettingsDetail>> resultMap = new HashMap<>();
         //获取默认的排课时长
 //        JSONObject jsonObject = JSON.parseObject(classAdjust.getDefaultCourseTypeMinute());
 //        String courseDefaultMinutes = sysConfigDao.findConfigValue("music_course_default_minutes");
 //        JSONObject jsonObject = JSON.parseObject(courseDefaultMinutes);
         //获取所选班级最大剩余课时
-        Map<String,Long> map = MapUtil.convertIntegerMap(courseScheduleDao.findClassMaxCourseNumMap(classGroupIds));
+        Map<String, Long> map = MapUtil.convertIntegerMap(courseScheduleDao.findClassMaxCourseNumMap(classGroupIds));
         //获取分布默认的课程类型单价
         MusicGroup musicGroup = musicGroupDao.findByClassGroupId(classGroupIds.get(0));
-        Map<String,BigDecimal> unitPriceMap = MapUtil.convertIntegerMap(organizationCourseUnitPriceSettingsDao.queryMapByOrganIdAndChargeTypeId(musicGroup.getChargeTypeId(),musicGroup.getOrganId()));
+        Map<String, BigDecimal> unitPriceMap = MapUtil.convertIntegerMap(organizationCourseUnitPriceSettingsDao.queryMapByOrganIdAndChargeTypeId(musicGroup.getChargeTypeId(), musicGroup.getOrganId()));
         Set<String> courseTypes = map.keySet();
         Set<String> groupType = new HashSet<>();
         for (Integer classGroupId : classGroupIds) {
-            Map<String,MusicGroupOrganizationCourseSettingsDetail> courseMap = new HashMap<>();
+            Map<String, MusicGroupOrganizationCourseSettingsDetail> courseMap = new HashMap<>();
             //获取当前班级剩余课次
-            Map<String,Long> subCourseNumMap = MapUtil.convertIntegerMap(courseScheduleDao.querySubCourseNumMap(classGroupId));
+            Map<String, Long> subCourseNumMap = MapUtil.convertIntegerMap(courseScheduleDao.querySubCourseNumMap(classGroupId));
             for (String courseType : courseTypes) {
                 groupType.add(courseType);
                 Long currentNum = subCourseNumMap.get(courseType);
-                if(currentNum == null){
+                if (currentNum == null) {
                     currentNum = 0l;
                 }
                 Long maxNum = map.get(courseType);
                 //如果当前课程类型不需要新增缴费项目
-                if(currentNum >= maxNum){
+                if (currentNum >= maxNum) {
                     continue;
                 }
                 Long subNum = maxNum - currentNum;
                 //生成缴费项目
                 MusicGroupOrganizationCourseSettingsDetail settingsDetail = new MusicGroupOrganizationCourseSettingsDetail();
                 BigDecimal unitPrice = unitPriceMap.get(courseType);
-                if(unitPrice == null){
+                if (unitPrice == null) {
                     throw new BizException("分部默认课程类型单价不存在,请设置");
                 }
                 settingsDetail.setCourseTotalNum(subNum.intValue());
@@ -3311,30 +3310,30 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 //                settingsDetail.setCourseTotalMinuties(Integer.parseInt(jsonObject.get(courseType).toString()) * subNum.intValue());
 //                settingsDetail.setCourseCurrentPrice(unitPrice.multiply(new BigDecimal(settingsDetail.getCourseTotalMinuties())));
 //                settingsDetail.setCourseOriginalPrice(settingsDetail.getCourseCurrentPrice());
-                courseMap.put(courseType,settingsDetail);
+                courseMap.put(courseType, settingsDetail);
             }
-            resultMap.put(classGroupId,courseMap);
+            resultMap.put(classGroupId, courseMap);
         }
-        result.put("defaultPaymentCalender",resultMap);
-        result.put("groupTypeSet",groupType);
-        result.put("classMaxCourseNumMap",map);
+        result.put("defaultPaymentCalender", resultMap);
+        result.put("groupTypeSet", groupType);
+        result.put("classMaxCourseNumMap", map);
         return result;
     }
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public String mergeClassSplitClassAffirm(MergeClassSplitClassAffirmDto mergeClassSplitClassAffirmDto){
+    public String mergeClassSplitClassAffirm(MergeClassSplitClassAffirmDto mergeClassSplitClassAffirmDto) {
         List<Integer> classGroupIds = mergeClassSplitClassAffirmDto.getClassGroupIds();
-        if(classGroupIds == null || classGroupIds.size() == 0){
+        if (classGroupIds == null || classGroupIds.size() == 0) {
             throw new BizException("参数校验失败");
         }
         //班级信息
         List<ClassGroup4MixDto> classGroup4MixDtos = mergeClassSplitClassAffirmDto.getClassGroup4MixDtos();
-        if(CollectionUtils.isEmpty(classGroup4MixDtos)){
+        if (CollectionUtils.isEmpty(classGroup4MixDtos)) {
             throw new BizException("请填写班级信息");
         }
         List<Integer> studentIds = mergeClassSplitClassAffirmDto.getStudentIds();
-        if(CollectionUtils.isEmpty(studentIds)){
+        if (CollectionUtils.isEmpty(studentIds)) {
             throw new BizException("学员列表不可为空");
         }
         SysUser sysUser = sysUserFeignService.queryUserInfo();
@@ -3344,9 +3343,9 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         MusicGroupPaymentCalender.PaymentCalenderStatusEnum status = null;
         List<MusicGroupPaymentCalenderDto> paymentCalenderDtos = mergeClassSplitClassAffirmDto.getMusicGroupPaymentCalenderDtos();
         StringBuffer batchNos = new StringBuffer();
-        if(paymentCalenderDtos != null && paymentCalenderDtos.size() > 0){
+        if (paymentCalenderDtos != null && paymentCalenderDtos.size() > 0) {
             for (MusicGroupPaymentCalenderDto calenderDto : paymentCalenderDtos) {
-                if(status == null || status != AUDITING){
+                if (status == null || status != AUDITING) {
                     List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingsList = calenderDto.getMusicGroupPaymentCalenderCourseSettingsList();
                     for (MusicGroupPaymentCalenderCourseSettings courseSettings : musicGroupPaymentCalenderCourseSettingsList) {
                         OrganizationCourseUnitPriceSettings defaultUnitPrice = organizationCourseUnitPriceSettingsDao.queryByOrganIdAndCourseTypeAndChargeType(
@@ -3366,12 +3365,12 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             List<String> batchNoList = new ArrayList<>();
             //创建缴费项目,  多个缴费项目分成多个批次号
             for (MusicGroupPaymentCalenderDto calenderDto : paymentCalenderDtos) {
-                if(batchNoList.size() > 0){
+                if (batchNoList.size() > 0) {
                     calenderDto.setIgnoreBatchNoList(batchNoList);
                 }
                 calenderDto.setMergeClassFlag(true);
                 musicGroupPaymentCalenderService.create(calenderDto);
-                if(batchNos.length() > 0){
+                if (batchNos.length() > 0) {
                     batchNos.append(",");
                 }
                 batchNoList.add(calenderDto.getBatchNo());
@@ -3388,28 +3387,28 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         musicGroupStudentClassAdjust.setClassGroupIds(JSON.toJSONString(classGroupIds));
         musicGroupStudentClassAdjust.setStudentIds(JSON.toJSONString(studentIds));
         List<Map<Integer, String>> classGroupStudents = mergeClassSplitClassAffirmDto.getClassGroupStudents();
-        if(classGroupStudents != null && classGroupStudents.size() > 0){
+        if (classGroupStudents != null && classGroupStudents.size() > 0) {
             musicGroupStudentClassAdjust.setClassGroupStudents(JSON.toJSONString(mergeClassSplitClassAffirmDto.getClassGroupStudents()));
         }
 
         //获取需要冻结的课程
-        List<Long> allLockCourseIds = courseScheduleDao.queryStudentNotStartByClassIdsAndStudentIds(classGroupIds,null);
+        List<Long> allLockCourseIds = courseScheduleDao.queryStudentNotStartByClassIdsAndStudentIds(classGroupIds, null);
         musicGroupStudentClassAdjust.setAllLockCourseIds(JSON.toJSONString(allLockCourseIds));
         //获取需要删除的学员关联的课程
-        List<Long> courseIds = courseScheduleDao.queryStudentNotStartByClassIdsAndStudentIds(classGroupIds,studentIds);
+        List<Long> courseIds = courseScheduleDao.queryStudentNotStartByClassIdsAndStudentIds(classGroupIds, studentIds);
         musicGroupStudentClassAdjust.setSubLockCourseIds(JSON.toJSONString(courseIds));
-        List<Long> studentPaymentIds = courseScheduleStudentPaymentDao.queryStudentNotStartByClassIdsAndStudentIds(classGroupIds,studentIds);
+        List<Long> studentPaymentIds = courseScheduleStudentPaymentDao.queryStudentNotStartByClassIdsAndStudentIds(classGroupIds, studentIds);
 
         musicGroupStudentClassAdjust.setStudentPaymentIds(JSON.toJSONString(studentPaymentIds));
         //保存老师选择的课程时长
         musicGroupStudentClassAdjust.setDefaultCourseTypeMinute(JSON.toJSONString(mergeClassSplitClassAffirmDto.getClassCourseMinuteMap()));
         //计算新增班级的可排课时长,总课次*默认时长  (用学员剩余的课程时长加上购买的时长,可能导致同一班级学员时长不一致)
-        musicGroupStudentClassAdjust.setClassCourseMinute(JSON.toJSONString(findClassCourseMinuteMap(classGroupIds,mergeClassSplitClassAffirmDto.getClassCourseMinuteMap())));
+        musicGroupStudentClassAdjust.setClassCourseMinute(JSON.toJSONString(findClassCourseMinuteMap(classGroupIds, mergeClassSplitClassAffirmDto.getClassCourseMinuteMap())));
         musicGroupStudentClassAdjustDao.insert(musicGroupStudentClassAdjust);
         //如果需要审核,校验参数配置
         checkMergeClassSplitClassAffirmParam(mergeClassSplitClassAffirmDto);
         //如果缴费项目不需要审核,那么生成班级以及课表
-        if(status == null || status != AUDITING){
+        if (status == null || status != AUDITING) {
             //每种课程类型单独进行排课
             ClassGroup classGroup = null;
             for (ClassGroup4MixDto classGroup4MixDto : classGroup4MixDtos) {
@@ -3419,18 +3418,18 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                 classGroup = classGroupService.classGroupAdjust2(classGroup4MixDto);
             }
             //排课完成后删除所选课程
-            courseScheduleDao.deleteMusicGroupCourseSchedulesWithStudents(courseIds,studentIds);
+            courseScheduleDao.deleteMusicGroupCourseSchedulesWithStudents(courseIds, studentIds);
             //删除班级关联的学员
-            if(classGroupStudents != null && classGroupStudents.size() > 0){
+            if (classGroupStudents != null && classGroupStudents.size() > 0) {
                 for (Map<Integer, String> classGroupStudent : classGroupStudents) {
                     Set<Integer> integers = classGroupStudent.keySet();
                     for (Integer integer : integers) {
-                        classGroupStudentMapperDao.deleteByClassGroupIdAndStudents(integer,classGroupStudent.get(integer));
+                        classGroupStudentMapperDao.deleteByClassGroupIdAndStudents(integer, classGroupStudent.get(integer));
                     }
                 }
             }
             List<Long> delCourseIds = courseScheduleDao.findNoStudentCourseIds(courseIds);
-            if(delCourseIds != null && delCourseIds.size() > 0){
+            if (delCourseIds != null && delCourseIds.size() > 0) {
                 //删除课程
                 courseScheduleDao.deleteCourseSchedulesByClassGroupIds(delCourseIds);
                 //删除教师考勤
@@ -3439,41 +3438,41 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                 courseScheduleTeacherSalaryDao.batchDeleteByCourseScheduleIds(delCourseIds);
             }
             return "学员班级调整完成";
-        }else {
+        } else {
             //冻结班级
-            classGroupDao.batchUpdateLockByClassGroupIds(classGroupIds,1);
+            classGroupDao.batchUpdateLockByClassGroupIds(classGroupIds, 1);
             //冻结所选班级的课程
-            courseScheduleDao.batchUpdateLockByCourseIds(allLockCourseIds,1);
+            courseScheduleDao.batchUpdateLockByCourseIds(allLockCourseIds, 1);
             return "学员班级调整申请已提交,缴费项目审核中";
         }
     }
 
-    public void checkMergeClassSplitClassAffirmParam(MergeClassSplitClassAffirmDto mergeClassSplitClassAffirmDto){
+    public void checkMergeClassSplitClassAffirmParam(MergeClassSplitClassAffirmDto mergeClassSplitClassAffirmDto) {
         ClassGroup4MixDto classGroup4MixDto = mergeClassSplitClassAffirmDto.getClassGroup4MixDtos().get(0);
         if (classGroup4MixDto.getCourseTimes().compareTo(0) <= 0) {
             throw new BizException("排课次数必须大于0");
         }
         List<ClassGroupTeacherMapper> classGroupTeacherMapperList = classGroup4MixDto.getClassGroupTeacherMapperList();
-        if(classGroupTeacherMapperList == null || classGroupTeacherMapperList.size() == 0){
+        if (classGroupTeacherMapperList == null || classGroupTeacherMapperList.size() == 0) {
             throw new BizException("请设置上课老师");
         }
         Set<Integer> noRepeatTeacherIds = classGroupTeacherMapperList.stream().map(ClassGroupTeacherMapper::getUserId).collect(Collectors.toSet());
-        if(noRepeatTeacherIds.size()!=classGroupTeacherMapperList.size()){
+        if (noRepeatTeacherIds.size() != classGroupTeacherMapperList.size()) {
             throw new BizException("主教与助教存在冲突");
         }
         //所选班级不能有未开始的临时合并课程
         List<Integer> classGroupIds = mergeClassSplitClassAffirmDto.getClassGroupIds();
-        if(classGroupIds == null || classGroupIds.size() == 0){
+        if (classGroupIds == null || classGroupIds.size() == 0) {
             throw new BizException("请填写班级信息");
         }
         //所选班级列表,是否包含已冻结的班级
         List<ClassGroup> lockClassGroupIds = classGroupDao.findByClassGroupIds(classGroupIds, 1);
-        if(lockClassGroupIds != null && lockClassGroupIds.size() > 0){
+        if (lockClassGroupIds != null && lockClassGroupIds.size() > 0) {
             throw new BizException("所选班级包含审核中的学员班级调整申请");
         }
         //所选班级不能有未开始的临时合并课程
         int courseNum = courseScheduleDao.findNoStartMasterCourseNum(classGroupIds);
-        if(courseNum > 0){
+        if (courseNum > 0) {
             throw new BizException("所选班级不能有未开始的临时合并课程");
         }
         List<Integer> allTeacherIds = classGroupTeacherMapperList.stream()
@@ -3507,18 +3506,36 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
     }
 
     @Override
-    public Map<String,Long> findClassCourseMinuteMap(List<Integer> classGroupIds,Map<String,Long> classCourseMinuteMap){
-        Map<String,Long> resultMap = new HashMap<>();
+    public Map<String, Long> findClassCourseMinuteMap(List<Integer> classGroupIds, Map<String, Long> classCourseMinuteMap) {
+        Map<String, Long> resultMap = new HashMap<>();
         //获取默认的排课时长
 //        String courseDefaultMinutes = sysConfigDao.findConfigValue("music_course_default_minutes");
 //        JSONObject jsonObject = JSON.parseObject(courseDefaultMinutes);
         //获取所选班级最大剩余课时
-        Map<String,Long> map = MapUtil.convertIntegerMap(courseScheduleDao.findClassMaxCourseNumMap(classGroupIds));
+        Map<String, Long> map = MapUtil.convertIntegerMap(courseScheduleDao.findClassMaxCourseNumMap(classGroupIds));
         Set<String> courseTypes = map.keySet();
         for (String courseType : courseTypes) {
 //            剩余时长*默认排课时长
-            resultMap.put(courseType,classCourseMinuteMap.get(courseType) * map.get(courseType));
+            resultMap.put(courseType, classCourseMinuteMap.get(courseType) * map.get(courseType));
         }
         return resultMap;
     }
+
+    @Override
+    public HighClassGroupNumDto getSubjectMaxHighClassGroupNum(String musicGroupId, ClassGroupTypeEnum type, String subjectIds) {
+        //基础技能班和线上基础技能班,可分班原则为声部人数/6向上取整
+        String[] subjectIdArr = subjectIds.split(",");
+        List<String> subjectIdList = Arrays.asList(subjectIdArr);
+        if (subjectIdList.contains("14") || subjectIdList.contains("15")) {
+            subjectIds += ",14,15";
+        }
+        HighClassGroupNumDto highClassGroupNumDto = new HighClassGroupNumDto();
+        int nowClassGroupNum = classGroupDao.getMusicGroupHighClassNumBySubject(musicGroupId, subjectIds, type);
+        int subjectStudentNum = studentRegistrationDao.getMusicGroupSubjectStudentNum(musicGroupId, subjectIds);
+        int maxClassGroupNum = subjectStudentNum / 6;
+        maxClassGroupNum += (subjectStudentNum % 6) > 0 ? 1 : 0;
+        highClassGroupNumDto.setNowHighClassGroupNum(nowClassGroupNum);
+        highClassGroupNumDto.setMaxHighClassGroupNum(maxClassGroupNum);
+        return highClassGroupNumDto;
+    }
 }

+ 12 - 19
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupStudentMapperServiceImpl.java

@@ -13,6 +13,8 @@ import java.util.Objects;
 import java.util.Set;
 import java.util.stream.Collectors;
 
+import com.ym.mec.biz.dal.dao.*;
+import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -21,22 +23,7 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
 import com.alibaba.fastjson.JSON;
-import com.ym.mec.biz.dal.dao.ClassGroupDao;
-import com.ym.mec.biz.dal.dao.ClassGroupStudentMapperDao;
-import com.ym.mec.biz.dal.dao.CourseScheduleDao;
-import com.ym.mec.biz.dal.dao.CourseScheduleStudentPaymentDao;
-import com.ym.mec.biz.dal.dao.CourseScheduleTeacherSalaryDao;
-import com.ym.mec.biz.dal.dao.StudentDao;
 import com.ym.mec.biz.dal.dto.ClassGroupStudentInfoDto;
-import com.ym.mec.biz.dal.entity.ClassGroup;
-import com.ym.mec.biz.dal.entity.ClassGroupRelation;
-import com.ym.mec.biz.dal.entity.ClassGroupStudentMapper;
-import com.ym.mec.biz.dal.entity.ClassGroupTeacherMapper;
-import com.ym.mec.biz.dal.entity.CourseSchedule;
-import com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment;
-import com.ym.mec.biz.dal.entity.CourseScheduleTeacherSalary;
-import com.ym.mec.biz.dal.entity.StudentRegistration;
-import com.ym.mec.biz.dal.entity.TeacherDefaultMusicGroupSalary;
 import com.ym.mec.biz.service.ClassGroupRelationService;
 import com.ym.mec.biz.service.ClassGroupService;
 import com.ym.mec.biz.service.ClassGroupStudentMapperService;
@@ -86,6 +73,8 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
     private CourseScheduleDao courseScheduleDao;
     @Autowired
     private ClassGroupDao classGroupDao;
+    @Autowired
+    private MusicGroupDao musicGroupDao;
 
     @Autowired
     private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
@@ -409,12 +398,16 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
         }
 
         //线上基础技能班,原始分班人数不能小于3人大于6人
-        if (classGroupStudents.size() <= 0 && classGroup.getType().equals(ClassGroupTypeEnum.HIGH_ONLINE)) {
-            if (studentIds.size() < 3 && oldNormalStudentIds.size() > 0) {
-                throw new BizException("线上基础技能班人数不能小于3人");
+        if (classGroup.getType().equals(ClassGroupTypeEnum.HIGH_ONLINE)) {
+            MusicGroup musicGroup = musicGroupDao.get(classGroup.getMusicGroupId());
+            if (studentIds.size() < 3 && musicGroup.getStatus().equals(MusicGroupStatusEnum.PREPARE)) {
+                throw new BizException("线上基础技能班人数不能少于3人");
+            }
+            if (studentIds.size() < 3 && !musicGroup.getStatus().equals(MusicGroupStatusEnum.PREPARE) && oldNormalStudentIds.size() <= 0) {
+                throw new BizException("线上基础技能班人数不能少于3人");
             }
             if (studentIds.size() > 6) {
-                throw new BizException("线上基础技能班人数不能大于6人");
+                throw new BizException("线上基础技能班人数不能于6人");
             }
         }
 

+ 63 - 13
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -6,32 +6,38 @@ import static com.ym.mec.biz.dal.enums.GroupType.VIP;
 import static com.ym.mec.biz.dal.enums.PracticeGroupType.CHARGE;
 import static com.ym.mec.biz.dal.enums.PracticeGroupType.FREE;
 import static com.ym.mec.biz.dal.enums.PracticeGroupType.TRIAL;
-import static java.math.BigDecimal.ONE;
 
 import java.lang.reflect.InvocationTargetException;
 import java.math.BigDecimal;
-import java.math.BigInteger;
 import java.text.SimpleDateFormat;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.TreeSet;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
-import com.ym.mec.biz.dal.entity.*;
-import com.ym.mec.biz.dal.dto.*;
-import com.ym.mec.biz.dal.enums.*;
-import com.ym.mec.biz.event.source.CourseEventSource;
 import org.apache.commons.collections.ListUtils;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.tomcat.jni.Local;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
@@ -70,7 +76,9 @@ import com.ym.mec.biz.dal.dao.VipGroupDao;
 import com.ym.mec.biz.dal.dto.BatchInsertCoursesDto;
 import com.ym.mec.biz.dal.dto.ClassDateAdjustDto;
 import com.ym.mec.biz.dal.dto.CourseAttendanceDetailHeadInfoDto;
+import com.ym.mec.biz.dal.dto.CourseMergeDto;
 import com.ym.mec.biz.dal.dto.CoursePostponeDto;
+import com.ym.mec.biz.dal.dto.CourseRepeatCheckDto;
 import com.ym.mec.biz.dal.dto.CourseScheduleDto;
 import com.ym.mec.biz.dal.dto.CourseScheduleEndDto;
 import com.ym.mec.biz.dal.dto.CourseScheduleRateDto;
@@ -93,10 +101,49 @@ import com.ym.mec.biz.dal.entity.ClassGroupTeacherSalary;
 import com.ym.mec.biz.dal.entity.CourseGenerateDto;
 import com.ym.mec.biz.dal.entity.CourseSchedule;
 import com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType;
+import com.ym.mec.biz.dal.entity.CourseScheduleAuditDetailDto;
+import com.ym.mec.biz.dal.entity.CourseScheduleComplaints;
+import com.ym.mec.biz.dal.entity.CourseScheduleEvaluate;
+import com.ym.mec.biz.dal.entity.CourseScheduleModifyLog;
+import com.ym.mec.biz.dal.entity.CourseScheduleReview;
+import com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment;
+import com.ym.mec.biz.dal.entity.CourseScheduleTeacherSalary;
+import com.ym.mec.biz.dal.entity.CoursesGroup;
+import com.ym.mec.biz.dal.entity.CoursesGroupModifyLog;
+import com.ym.mec.biz.dal.entity.Group;
+import com.ym.mec.biz.dal.entity.MusicGroup;
+import com.ym.mec.biz.dal.entity.PracticeGroup;
+import com.ym.mec.biz.dal.entity.School;
+import com.ym.mec.biz.dal.entity.StudentAttendance;
+import com.ym.mec.biz.dal.entity.StudentCourseScheduleRecordDto;
+import com.ym.mec.biz.dal.entity.Subject;
+import com.ym.mec.biz.dal.entity.SysConfig;
+import com.ym.mec.biz.dal.entity.Teacher;
+import com.ym.mec.biz.dal.entity.TeacherAttendance;
+import com.ym.mec.biz.dal.entity.TeacherDefaultMusicGroupSalary;
+import com.ym.mec.biz.dal.entity.TeacherDefaultPracticeGroupSalary;
+import com.ym.mec.biz.dal.entity.TeacherDefaultVipGroupSalary;
+import com.ym.mec.biz.dal.entity.VipGroup;
+import com.ym.mec.biz.dal.enums.AuditStatusEnum;
+import com.ym.mec.biz.dal.enums.ClassGroupStudentStatusEnum;
+import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
+import com.ym.mec.biz.dal.enums.CourseStatusEnum;
+import com.ym.mec.biz.dal.enums.GroupStatusEnum;
+import com.ym.mec.biz.dal.enums.GroupType;
+import com.ym.mec.biz.dal.enums.MessageTypeEnum;
+import com.ym.mec.biz.dal.enums.MusicGroupStatusEnum;
+import com.ym.mec.biz.dal.enums.ParamEnum;
+import com.ym.mec.biz.dal.enums.SalarySettlementTypeEnum;
+import com.ym.mec.biz.dal.enums.StudentAttendanceStatusEnum;
+import com.ym.mec.biz.dal.enums.TeachModeEnum;
+import com.ym.mec.biz.dal.enums.TeachTypeEnum;
+import com.ym.mec.biz.dal.enums.VipGroupStatusEnum;
+import com.ym.mec.biz.dal.enums.YesOrNoEnum;
 import com.ym.mec.biz.dal.page.CourseScheduleQueryInfo;
 import com.ym.mec.biz.dal.page.EndCourseScheduleQueryInfo;
 import com.ym.mec.biz.dal.page.StudentCourseScheduleRecordQueryInfo;
 import com.ym.mec.biz.dal.page.VipGroupQueryInfo;
+import com.ym.mec.biz.event.source.CourseEventSource;
 import com.ym.mec.biz.service.ClassGroupService;
 import com.ym.mec.biz.service.ClassGroupTeacherMapperService;
 import com.ym.mec.biz.service.CourseHomeworkService;
@@ -4291,6 +4338,9 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
                 }
                 if (courseTime.getDayOfWeek() == i) {
                     String dateYmdStr = DateUtil.dateToString(calendar.getTime(), DateUtil.ISO_EXPANDED_DATE_FORMAT);
+                    if(StringUtils.isBlank(courseTime.getStartClassTime())){
+                    	throw new BizException("排课循环周期错误");
+					}
                     dateYmdStr = dateYmdStr + " " + courseTime.getStartClassTime();
                     Date courseStartTime = DateUtil.stringToDate(dateYmdStr, "yyyy-MM-dd HH:mm");
                     if(excludePastCourse&&courseStartTime.before(now)){
@@ -4335,10 +4385,10 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
             results = courseScheduleDao.endFindCourseSchedules(params);
             List<Long> courseScheduleIds = results.stream().map(CourseScheduleEndDto::getId).collect(Collectors.toList());
             //Map<Long, String> studentIdMap = MapUtil.convertIntegerMap(courseScheduleStudentPaymentDao.getStudentIdMap(courseScheduleIds));
-            //List<Integer> teacherIds=results.stream().filter(t->Objects.nonNull(t.getActualTeacherId())).map(CourseSchedule::getActualTeacherId).collect(Collectors.toList());
+            List<Integer> teacherIds=results.stream().filter(t->Objects.nonNull(t.getActualTeacherId())).map(CourseSchedule::getActualTeacherId).collect(Collectors.toList());
 
-            //List<Map<Integer, String>> nameIdMaps = teacherDao.queryNameByIdList(teacherIds);
-            //Map<Integer, String> nameIdMap=MapUtil.convertIntegerMap(nameIdMaps);
+            List<Map<Integer, String>> nameIdMaps = teacherDao.queryNameByIdList(teacherIds);
+            Map<Integer, String> nameIdMap=MapUtil.convertIntegerMap(nameIdMaps);
 
 			//List<Map<Long, String>> coursesSettlementTimeMaps = courseScheduleTeacherSalaryDao.getCoursesSettlementTime(courseScheduleIds);
 			//Map<Long, String> coursesSettlementTimeMap = MapUtil.convertIntegerMap(coursesSettlementTimeMaps);
@@ -4362,7 +4412,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
             Map<Integer, String> classGroupSubjectNameMap = MapUtil.convertIntegerMap(classGroupSubjectNameMaps);
 			for (CourseScheduleEndDto result : results) {
 				result.setTeacher(null);
-				//result.setTeacherName(nameIdMap.get(result.getActualTeacherId()));
+				result.setTeacherName(nameIdMap.get(result.getActualTeacherId()));
 				result.setSubjectName(classGroupSubjectNameMap.get(result.getId()));
 				//result.setStudentId(studentIdMap.get(result.getId()));
 				//result.setPracticeGroup(idPracticeMap.get(Long.valueOf(result.getMusicGroupId())));

+ 39 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleTeacherSalaryServiceImpl.java

@@ -144,6 +144,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
                         courseScheduleTeacherSalary.setExpectSalary(offlineTeacherSalary);
                     }
                 }
+                courseScheduleTeacherSalary.setActualSalary(null);
                 if (Objects.isNull(courseScheduleTeacherSalary.getId())) {
                     courseScheduleTeacherSalaries.add(courseScheduleTeacherSalary);
                 } else {
@@ -209,6 +210,10 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
 
         Set<Long> courseScheduleIds = someDayAgoTeacherCourseSalaryNoSettlement.stream().map(CourseScheduleTeacherSalary::getCourseScheduleId).collect(Collectors.toSet());
 
+        Set<Integer> teacherIds = someDayAgoTeacherCourseSalaryNoSettlement.stream().map(CourseScheduleTeacherSalary::getUserId).collect(Collectors.toSet());
+        List<Teacher> teachers = teacherDao.findByTeacherIds(new ArrayList<>(teacherIds));
+        Map<Integer, Teacher> idTeacherMap = teachers.stream().collect(Collectors.toMap(Teacher::getId, t -> t, (t1, t2) -> t1));
+
         //教师签到记录
         List<TeacherAttendance> allTeacherAttendances = teacherAttendanceDao.findByCourseSchedules(new ArrayList<>(courseScheduleIds));
         Map<String, List<TeacherAttendance>> teacherCourseAttendanceMap = allTeacherAttendances.stream().collect(Collectors.groupingBy(ta -> org.apache.commons.lang3.StringUtils.joinWith(":", ta.getCourseScheduleId(), ta.getTeacherId())));
@@ -219,6 +224,11 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
 
         someDayAgoTeacherCourseSalaryNoSettlement.forEach(courseScheduleTeacherSalary -> {
 
+            Teacher teacher = idTeacherMap.get(courseScheduleTeacherSalary.getUserId());
+            if(Objects.isNull(teacher)||Objects.isNull(teacher.getFormalStaffDate())||courseScheduleTeacherSalary.getCourseSchedule().getClassDate().compareTo(teacher.getFormalStaffDate())<0){
+                courseScheduleTeacherSalary.setExpectSalary(courseScheduleTeacherSalary.getExpectSalary().multiply(new BigDecimal("0.8")));
+            }
+
             //扣除费用
             BigDecimal deductCost = new BigDecimal(0);
             List<String> deductReasons = new ArrayList<>();
@@ -288,6 +298,10 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
         // 查询需要修改的课酬记录
         List<TeacherVipSalaryDto> teacherSalaryList = courseScheduleTeacherSalaryDao.queryOnlineCourseByGroupType(startDate, endDate);
 
+        Set<Integer> teacherIds = teacherSalaryList.stream().map(TeacherVipSalaryDto::getUserId).collect(Collectors.toSet());
+        List<Teacher> teachers = teacherDao.findByTeacherIds(new ArrayList<>(teacherIds));
+        Map<Integer, Teacher> idTeacherMap = teachers.stream().collect(Collectors.toMap(Teacher::getId, t -> t, (t1, t2) -> t1));
+
         for (TeacherVipSalaryDto ts : teacherSalaryList) {
             // 修复兼职老师不管1v?和全职老师1vn的课酬为系统默认课酬(不管线上还是线下课)
             if (ts.getTeacherJobNature() != JobNatureEnum.FULL_TIME || !org.apache.commons.lang3.StringUtils.equalsIgnoreCase("1v1", ts.getVipGroupCategoryName())) {
@@ -329,6 +343,11 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
         //处理课酬信息
         someDayAgoTeacherCourseSalaryNoSettlement.forEach(courseScheduleTeacherSalary -> {
 
+            Teacher teacher = idTeacherMap.get(courseScheduleTeacherSalary.getUserId());
+            if(Objects.isNull(teacher)||Objects.isNull(teacher.getFormalStaffDate())||courseScheduleTeacherSalary.getCourseSchedule().getClassDate().compareTo(teacher.getFormalStaffDate())<0){
+                courseScheduleTeacherSalary.setExpectSalary(courseScheduleTeacherSalary.getExpectSalary().multiply(new BigDecimal("0.8")));
+            }
+
             //扣除费用
             BigDecimal deductCost = new BigDecimal(0);
             List<String> deductReasons = new ArrayList<>();
@@ -482,6 +501,10 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
         List<TeacherDefaultMusicGroupSalary> teacherDefaultMusicGroupSalaries = teacherDefaultMusicGroupSalaryDao.findByTeacher(allTeacherIds);
         Map<CourseSchedule.CourseScheduleType, List<TeacherDefaultMusicGroupSalary>> teacherDefaultMusicGroupSalariesGroupByCourseType = teacherDefaultMusicGroupSalaries.stream().collect(Collectors.groupingBy(TeacherDefaultMusicGroupSalary::getCourseScheduleType));
 
+        Set<Integer> teacherIds = courseScheduleTeacherSalaries.stream().map(CourseScheduleTeacherSalary::getUserId).collect(Collectors.toSet());
+        List<Teacher> teachers = teacherDao.findByTeacherIds(new ArrayList<>(teacherIds));
+        Map<Integer, Teacher> idTeacherMap = teachers.stream().collect(Collectors.toMap(Teacher::getId, t -> t, (t1, t2) -> t1));
+
         //计算课酬
         for (CourseScheduleTeacherSalary courseScheduleTeacherSalary : courseScheduleTeacherSalaries) {
             //当前课酬对应的课程信息
@@ -490,6 +513,8 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
             //教师课酬
             BigDecimal teacherSalary = new BigDecimal(0);
 
+            Teacher teacher = idTeacherMap.get(courseScheduleTeacherSalary.getUserId());
+
             if(CourseSchedule.CourseScheduleType.MUSIC_NETWORK.equals(courseSchedule.getType())||CourseSchedule.CourseScheduleType.HIGH_ONLINE.equals(courseSchedule.getType())){
                 //根据课程类型获取对应的默认课酬设置列表
                 List<TeacherDefaultMusicGroupSalary> teacherDefaultMusicGroupSalariesWithCourseType = teacherDefaultMusicGroupSalariesGroupByCourseType.get(courseSchedule.getType());
@@ -517,6 +542,11 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
                     teacherSalary = BigDecimal.ZERO;
                 }
 
+                //如果上课日期在转正日期之前的按80%结算
+                if(Objects.isNull(teacher)||Objects.isNull(teacher.getFormalStaffDate())||courseSchedule.getClassDate().compareTo(teacher.getFormalStaffDate())<0){
+                    teacherSalary = teacherSalary.multiply(new BigDecimal("0.8"));
+                }
+
                 //扣除费用
                 BigDecimal deductCost = new BigDecimal(0);
                 List<String> deductReasons = new ArrayList<>();
@@ -615,6 +645,10 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
                 teacherSalary=courseScheduleTeacherSalary.getExpectSalary();
             }
 
+            if(Objects.isNull(teacher)||Objects.isNull(teacher.getFormalStaffDate())||courseSchedule.getClassDate().compareTo(teacher.getFormalStaffDate())<0){
+                teacherSalary = teacherSalary.multiply(new BigDecimal("0.8"));
+            }
+
             BigDecimal subsidy = courseSubsidyMap.get(courseSchedule.getSchoolId());
             if (Objects.isNull(subsidy)) {
                 subsidy = new BigDecimal(0);
@@ -683,6 +717,8 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
                     deductCost = deductCost.add(new BigDecimal(50));
                     deductReasons.add("签到经纬度异常扣除50");
                 }
+            }else{
+                signInInRange = true;
             }
 
             if(Objects.isNull(teacherAttendance)||Objects.isNull(teacherAttendance.getSignOutStatus())){
@@ -705,6 +741,8 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
                     deductCost = deductCost.add(new BigDecimal(50));
                     deductReasons.add("签退经纬度异常,扣除50元");
                 }
+            }else{
+                signOutInRange = true;
             }
 
             if(!signInInRange&&!signOutInRange){
@@ -1245,6 +1283,7 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
             t.setTeacherRole(courseScheduleTeacherSalary.getTeacherRole());
             if(idTeacherAttendanceMap.containsKey(t.getTeacherId())){
                 TeacherAttendance teacherAttendance = idTeacherAttendanceMap.get(t.getTeacherId());
+                t.setTeacherAttendance(teacherAttendance);
                 t.setSignInTime(teacherAttendance.getSignInTime());
                 t.setSignInStatus(Objects.nonNull(teacherAttendance.getSignInStatus())?(YesOrNoEnum.NO.equals(teacherAttendance.getSignInStatus())?SignInStatusEnum.UNUSUAL:SignInStatusEnum.NORMAL):SignInStatusEnum.NO);
                 t.setSignOutTime(teacherAttendance.getSignOutTime());

+ 3 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentManageServiceImpl.java

@@ -9,6 +9,7 @@ import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.CourseStatusEnum;
 import com.ym.mec.biz.dal.enums.SporadicChargeTypeEnum;
 import com.ym.mec.biz.service.SysConfigService;
+
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -683,8 +684,8 @@ public class StudentManageServiceImpl implements StudentManageService {
     }
 
     @Override
-    public List<BasicUserDto> queryCanAddStudent(String musicGroupId, Long musicGroupPaymentCalenderId,String search,Integer subjectId) {
-        return studentManageDao.queryCanAddStudent(musicGroupId, musicGroupPaymentCalenderId,search,subjectId);
+    public List<BasicUserDto> queryCanAddStudent(String musicGroupId, String batchNo,String search,Integer subjectId) {
+        return studentManageDao.queryCanAddStudent(musicGroupId, batchNo,search,subjectId);
     }
 
     @Override

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentRouteOrderServiceImpl.java

@@ -262,7 +262,7 @@ public class StudentPaymentRouteOrderServiceImpl extends BaseServiceImpl<Long, S
 
                     BigDecimal hasRouteSellOrderActualAmount = BigDecimal.ZERO;
                     for (SellOrder sellOrder : sellOrderList) {
-                        if (!goodsMap.getKey().equals(sellOrder.getParentGoodsId().toString()) && !goodsMap.getKey().equals(sellOrder.getGoodsId().toString())) {
+                        if (Integer.valueOf(goodsMap.getKey()).equals(sellOrder.getParentGoodsId()) && !Integer.valueOf(goodsMap.getKey()).equals(sellOrder.getGoodsId())) {
                             continue;
                         }
                         BigDecimal sellOrderActualAmount = BigDecimal.ZERO;

+ 2 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -1199,7 +1199,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     }
 
     @Override
-    public List<StudentRegistration> findMusicGroupStudent(String musicGroupId, Integer actualSubjectId) {
+    public List<StudentRegistration> findMusicGroupStudent(String musicGroupId, String actualSubjectId) {
         List<Subject> subjectList = subjectService.findAll(new HashMap<>());
         List<StudentRegistration> musicGroupStudents = studentRegistrationDao.findMusicGroupStudent(musicGroupId, actualSubjectId);
         for (StudentRegistration musicGroupStudent : musicGroupStudents) {
@@ -1277,7 +1277,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     }
 
     @Override
-    public List<StudentRegistration> findMusicGroupStuNoClassType(String musicGroupId, Long classGroupId, ClassGroupTypeEnum type, Integer subjectId) {
+    public List<StudentRegistration> findMusicGroupStuNoClassType(String musicGroupId, Long classGroupId, ClassGroupTypeEnum type, String subjectId) {
         List<StudentRegistration> students = studentRegistrationDao.findMusicGroupStudent(musicGroupId, subjectId);
         List<Subject> subjectList = subjectService.findAll(new HashMap<>());
 

+ 28 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -41,6 +41,9 @@ import org.springframework.util.CollectionUtils;
 
 import java.math.BigDecimal;
 import java.math.RoundingMode;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.temporal.ChronoUnit;
 import java.util.*;
 import java.util.function.Function;
 import java.util.stream.Collectors;
@@ -1906,6 +1909,14 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		Map<String, Object> pauseInfos = new HashMap<>();
 		//学生剩余课时
         List<StudentCourseInfoDto> userSurplusCourseInfoByGroup = courseScheduleDao.findUserSurplusCourseInfoByGroup(GroupType.VIP, vipGroupId.toString(), studentId);
+
+		int days = 0;
+        if(!CollectionUtils.isEmpty(userSurplusCourseInfoByGroup)){
+        	LocalDate nowDate = LocalDate.now(DateUtil.zoneId);
+			StudentCourseInfoDto studentCourseInfoDto = userSurplusCourseInfoByGroup.stream().max(Comparator.comparing(StudentCourseInfoDto::getClassDate)).get();
+			days = (int) nowDate
+					.until((LocalDateTime.ofInstant(studentCourseInfoDto.getClassDate().toInstant(), DateUtil.zoneId).toLocalDate()), ChronoUnit.DAYS);
+		}
         int[] teachModeSequence=new int[userSurplusCourseInfoByGroup.size()];
         List<BigDecimal> coursePrices = new ArrayList<>();
         List<Long> courseScheduleIds=new ArrayList<>();
@@ -1916,6 +1927,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
         }
         pauseInfos.put("teaChModeSequence", teachModeSequence);
         pauseInfos.put("coursePriceInfo",coursePrices);
+//        pauseInfos.put("days", days);
 
         StudentPauseInfo  studentPauseInfo=new StudentPauseInfo();
 		studentPauseInfo.setUserId(studentId);
@@ -2051,6 +2063,17 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 				}
 				newCourseSchedules.get(i).setOrganId(vipGroup.getOrganId());
 			}
+
+			if(courseInfo1.containsKey("days")){
+				int surplusDays = Integer.valueOf(courseInfo1.get("days").toString());
+				LocalDate nowDate = LocalDate.now();
+				CourseSchedule courseSchedule = newCourseSchedules.stream().max(Comparator.comparing(CourseSchedule::getClassDate)).get();
+				int days = (int) nowDate.until(LocalDateTime.ofInstant(courseSchedule.getClassDate().toInstant(), DateUtil.zoneId), ChronoUnit.DAYS);
+				if(days>surplusDays){
+					throw new BizException("您必须在{}天内完成剩余课程", surplusDays);
+				}
+			}
+
 			courseScheduleService.batchAddCourseSchedule(newCourseSchedules);
 
 			ClassGroupTeacherMapper oldClassGroupTeacherMapper = classGroupTeacherMapperDao.findByClassGroupAndTeacher(classGroup.getId(),oldTeacherId);
@@ -2152,6 +2175,11 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		Map<BigDecimal, Long> collect = coursePrices.stream().collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
 		studentRecoverInfoDto.setGiveCourseTimes(Objects.isNull(collect.get(new BigDecimal("0.00")))?0:collect.get(new BigDecimal("0.00")).intValue());
 		studentRecoverInfoDto.setTotalCourseTimes(coursePrices.size()-studentRecoverInfoDto.getGiveCourseTimes());
+
+		if(courseInfo.containsKey("days")){
+			int surplusDays = Integer.valueOf(courseInfo.get("days").toString());
+			studentRecoverInfoDto.setExpireDate(LocalDate.now().plusDays(surplusDays));
+		}
 		return studentRecoverInfoDto;
     }
 

+ 2 - 1
mec-biz/src/main/resources/config/mybatis/ClassGroupMapper.xml

@@ -283,6 +283,7 @@
         <result column="id_" property="id"/>
         <result column="music_group_id_" property="musicGroupId"/>
         <result column="subject_id_list_" property="subjectIdList"/>
+        <result column="memo_" property="memo"/>
         <result column="name_" property="name"/>
         <result column="student_num_" property="studentNum"/>
         <result column="create_time_" property="createTime"/>
@@ -1329,7 +1330,7 @@
     <!-- 获取乐团某声部基础技能班或基础技能提高班数量 -->
     <select id="getMusicGroupHighClassNumBySubject" resultType="int">
         SELECT COUNT(*) FROM class_group WHERE music_group_id_=#{musicGroupId}
-        AND type_ IN ('HIGH','HIGH_ONLINE') AND del_flag_ = '0'
+        AND type_ = #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler} AND del_flag_ = '0'
         AND INTE_ARRAY(subject_id_list_,#{subjectIds})
     </select>
 </mapper>

+ 3 - 3
mec-biz/src/main/resources/config/mybatis/StudentAttendanceMapper.xml

@@ -512,7 +512,7 @@
         		and cs.type_ = #{courseScheduleType}
         	</if>
         	<if test="teacherId != null">
-        		and cs.actual_teacher_id_.teacher_id_ = #{teacherId}
+        		and cs.actual_teacher_id_ = #{teacherId}
         	</if>
         	<if test="courseStatus != null">
         		and cs.status_ = #{courseStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
@@ -530,7 +530,7 @@
                 AND FIND_IN_SET(cs.organ_id_,#{organId})
             </if>
         </where>
-        ORDER BY cs.id_ DESC
+        ORDER BY cs.id_ asc
         <include refid="global.limit"/>
     </select>
     
@@ -558,7 +558,7 @@
         		and cs.type_ = #{courseScheduleType}
         	</if>
         	<if test="teacherId != null">
-        		and cs.actual_teacher_id_.teacher_id_ = #{teacherId}
+        		and cs.actual_teacher_id_ = #{teacherId}
         	</if>
         	<if test="courseStatus != null">
         		and cs.status_ = #{courseStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}

+ 9 - 7
mec-biz/src/main/resources/config/mybatis/StudentManageDao.xml

@@ -775,21 +775,23 @@
         </foreach>
 		GROUP BY sr.user_id_
     </select>
+    
     <select id="queryCanAddStudent" resultMap="com.ym.mec.biz.dal.dao.MusicGroupDao.BasicUserDto">
-        SELECT su.id_ user_id_,su.username_,su.phone_,s.name_ subject_name_ FROM music_group_payment_calender mgpc
-        LEFT JOIN student_registration sr ON sr.music_group_id_ = mgpc.music_group_id_
+        select su.id_ user_id_,su.username_,su.phone_,s.name_ subject_name_ from student_registration sr 
         LEFT JOIN sys_user su ON su.id_ = sr.user_id_
-        LEFT JOIN `subject` s ON s.id_ = sr.subject_id_
-        WHERE mgpc.id_ = #{musicGroupPaymentCalenderId} AND mgpc.music_group_id_ = #{musicGroupId} AND sr.music_group_status_ = 'NORMAL' AND sr.user_id_ NOT IN (
-        SELECT DISTINCT user_id_ FROM music_group_payment_calender_detail
-        WHERE music_group_payment_calender_id_ = #{musicGroupPaymentCalenderId})
+        LEFT JOIN `subject` s ON s.id_ = sr.actual_subject_id_
+        where sr.music_group_id_ = #{musicGroupId} AND sr.music_group_status_ = 'NORMAL' AND sr.user_id_ NOT IN (
+        SELECT DISTINCT mgpcd.user_id_ FROM music_group_payment_calender_detail mgpcd left join music_group_payment_calender mgpc on mgpcd.music_group_payment_calender_id_ = mgpc.id_
+        WHERE mgpc.batch_no_ = #{batchNo} and mgpc.music_group_id_ = #{musicGroupId}
+        )
         <if test="search != null and search != ''">
             AND (sr.user_id_ = #{search} OR su.username_ LIKE CONCAT('%',#{search},'%'))
         </if>
         <if test="subjectId != null">
-            AND sr.subject_id_ = #{subjectId}
+            AND sr.actual_subject_id_ = #{subjectId}
         </if>
     </select>
+    
     <select id="queryHasCourseMap" resultType="java.util.Map">
         SELECT su.id_ 'key',COUNT(DISTINCT su.id_) 'value' FROM sys_user su
         LEFT JOIN course_schedule_student_payment cssp ON cssp.user_id_ = su.id_

+ 6 - 3
mec-biz/src/main/resources/config/mybatis/StudentPaymentRouteOrderMapper.xml

@@ -96,7 +96,10 @@
                 fee_flag_ = #{feeFlag},
             </if>
                 user_id_ = #{userId},
-            <if test="schoolId != null">
+            <if test="schoolId != null and schoolId==999999999">
+                school_id_ = null,
+            </if>
+            <if test="schoolId != null and schoolId!=999999999">
                 school_id_ = #{schoolId},
             </if>
             <if test="transNo != null">
@@ -338,7 +341,7 @@
         	<if test="type != null and type != ''">
         		and
         		<if test="type == 'SERVICE'">
-        			(spro.service_amount_ is not null and spro.service_amount_ &gt; 0) 
+        			(spro.service_amount_ is not null and spro.service_amount_ &gt; 0)
         		</if>
         		<if test="type == 'SELL'">
         			(spro.sale_amount_ is not null and spro.sale_amount_ &gt; 0)
@@ -367,7 +370,7 @@
         	<if test="type != null and type != ''">
         		and
         		<if test="type == 'SERVICE'">
-        			(spro.service_amount_ is not null and spro.service_amount_ &gt; 0) 
+        			(spro.service_amount_ is not null and spro.service_amount_ &gt; 0)
         		</if>
         		<if test="type == 'SELL'">
         			(spro.sale_amount_ is not null and spro.sale_amount_ &gt; 0)

+ 3 - 3
mec-biz/src/main/resources/config/mybatis/StudentRegistrationMapper.xml

@@ -448,7 +448,7 @@
         LEFT JOIN sys_user su on sr.user_id_ = su.id_
         WHERE sr.music_group_id_ = #{musicGroupId}
         <if test="actualSubjectId != null">
-            AND sr.actual_subject_id_ = #{actualSubjectId}
+            AND FIND_IN_SET(sr.actual_subject_id_,#{actualSubjectId})
         </if>
         AND payment_status_ = 2 AND sr.music_group_status_ != 'QUIT'
     </select>
@@ -704,8 +704,8 @@
     </select>
 
     <!-- 获取乐团声部学生数量 -->
-    <select id="getMusicGroupSubjectNum" resultType="int">
+    <select id="getMusicGroupSubjectStudentNum" resultType="int">
         SELECT COUNT(*) FROM student_registration WHERE music_group_id_=#{musicGroupId}
-        AND INTE_ARRAY(subject_id_,#{subjectIds}) AND music_group_status_ = 'NORMAL'
+        AND INTE_ARRAY(actual_subject_id_,#{subjectIds}) AND music_group_status_ = 'NORMAL'
     </select>
 </mapper>

+ 6 - 4
mec-biz/src/main/resources/config/mybatis/TeacherMapper.xml

@@ -22,6 +22,7 @@
         <result column="subject_id_" property="subjectId"/>
         <result column="entry_date_" property="entryDate"/>
         <result column="demission_date_" property="demissionDate"/>
+        <result column="formal_staff_date_" property="formalStaffDate"/>
         <result column="certificate_type_" property="certificateType"/>
         <result column="certificate_num_" property="certificateNum"/>
         <result column="flow_organ_range_" property="flowOrganRange"/>
@@ -112,7 +113,7 @@
     <select id="get" resultMap="Teacher">
         SELECT t.id_,t.organ_id_ teacher_organ_id_,t.job_type_,t.job_nature_,t.is_probation_period_,t.education_background_,t.graduate_school_,t.graduate_school_,
         t.technical_titles_,t.work_unit_,t.subject_id_,t.entry_date_,t.certificate_type_,t.certificate_num_,t.flow_organ_range_,t.update_time_,
-        t.create_time_,t.introduction_,t.demission_date_,t.is_support_course_schedule_rewards_rules_,t.is_support_extra_practice_lesson_,
+        t.create_time_,t.introduction_,t.demission_date_,t.formal_staff_date_,t.is_support_course_schedule_rewards_rules_,t.is_support_extra_practice_lesson_,
         t.lecture_num_,t.idcard_front_img_,t.idcard_back_img_,t.idcard_hand_img_,t.memo_,
         su.real_name_,su.id_card_no_,su.password_,su.salt_,su.phone_,su.avatar_,
         su.lock_flag_,su.del_flag_,su.wx_openid_,su.qq_openid_,su.user_type_,
@@ -137,8 +138,8 @@
     <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.Teacher" useGeneratedKeys="true" keyColumn="id"
             keyProperty="id">
         INSERT INTO teacher
-        (id_,organ_id_,job_type_,job_nature_,is_probation_period_,education_background_,graduate_school_,technical_titles_,work_unit_,subject_id_,entry_date_,demission_date_,certificate_type_,certificate_num_,flow_organ_range_,introduction_,update_time_,create_time_,is_support_extra_practice_lesson_,is_support_course_schedule_rewards_rules_,idcard_front_img_,idcard_back_img_,idcard_hand_img_,memo_)
-        VALUES(#{id},#{organId},#{jobType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{jobNature},#{isProbationPeriod,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{educationBackground},#{graduateSchool},#{technicalTitles},#{workUnit},#{subjectId},#{entryDate},#{demissionDate},#{certificateType},#{certificateNum},#{flowOrganRange},#{introduction},now(),now(),#{isSupportExtraPracticeLesson},#{isSupportCourseScheduleRewardsRules},#{idcardFrontImg},#{idcardBackImg},#{idcardHandImg},#{memo})
+        (id_,organ_id_,job_type_,job_nature_,is_probation_period_,education_background_,graduate_school_,technical_titles_,work_unit_,subject_id_,entry_date_,demission_date_,formal_staff_date_,certificate_type_,certificate_num_,flow_organ_range_,introduction_,update_time_,create_time_,is_support_extra_practice_lesson_,is_support_course_schedule_rewards_rules_,idcard_front_img_,idcard_back_img_,idcard_hand_img_,memo_)
+        VALUES(#{id},#{organId},#{jobType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{jobNature},#{isProbationPeriod,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{educationBackground},#{graduateSchool},#{technicalTitles},#{workUnit},#{subjectId},#{entryDate},#{demissionDate},#{formalStaffDate},#{certificateType},#{certificateNum},#{flowOrganRange},#{introduction},now(),now(),#{isSupportExtraPracticeLesson},#{isSupportCourseScheduleRewardsRules},#{idcardFrontImg},#{idcardBackImg},#{idcardHandImg},#{memo})
     </insert>
 
     <insert id="addSysUser" parameterType="com.ym.mec.auth.api.entity.SysUser" useGeneratedKeys="true" keyColumn="id"
@@ -173,6 +174,7 @@
                 entry_date_ = #{entryDate},
             </if>
                 demission_date_ = #{demissionDate},
+                formal_staff_date_ = #{formalStaffDate},
             <if test="jobType != null">
                 job_type_ = #{jobType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
             </if>
@@ -291,7 +293,7 @@
     <!-- 分页查询 -->
     <select id="queryPage" resultMap="Teacher" parameterType="map">
         SELECT t.id_,su.real_name_,su.lock_flag_,t.subject_id_,su.phone_,t.organ_id_ teacher_organ_id_,t.organ_id_,t.is_support_extra_practice_lesson_,
-        t.job_nature_,t.demission_date_,t.is_probation_period_,t.memo_,GROUP_CONCAT(s.name_) subject_name_,su.del_flag_
+        t.job_nature_,t.demission_date_,t.formal_staff_date_,t.is_probation_period_,t.memo_,GROUP_CONCAT(s.name_) subject_name_,su.del_flag_
         FROM teacher t
         LEFT JOIN sys_user su ON t.id_ = su.id_
         LEFT JOIN `subject` s ON FIND_IN_SET(s.id_,t.subject_id_)

+ 26 - 20
mec-web/src/main/java/com/ym/mec/web/controller/ClassGroupController.java

@@ -1,5 +1,7 @@
 package com.ym.mec.web.controller;
 
+import com.ym.mec.biz.dal.dto.*;
+import com.ym.mec.common.exception.BizException;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -22,10 +24,6 @@ import org.springframework.web.bind.annotation.RestController;
 
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
-import com.ym.mec.biz.dal.dto.ClassGroup4MixDto;
-import com.ym.mec.biz.dal.dto.HighClassGroupDto;
-import com.ym.mec.biz.dal.dto.MergeClassSplitClassAffirmDto;
-import com.ym.mec.biz.dal.dto.TestDto;
 import com.ym.mec.biz.dal.entity.ClassGroup;
 import com.ym.mec.biz.dal.entity.ClassGroupTeacherMapper;
 import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
@@ -57,7 +55,7 @@ public class ClassGroupController extends BaseController {
     @GetMapping("/queryPage")
     @PreAuthorize("@pcs.hasPermissions('classGroup/queryPage')")
     public HttpResponseResult<PageInfo<ClassGroup>> queryPage(ClassGroupQueryInfo queryInfo) {
-    	queryInfo.setDelFlag(0);
+        queryInfo.setDelFlag(0);
         return succeed(classGroupService.queryPage(queryInfo));
     }
 
@@ -152,8 +150,8 @@ public class ClassGroupController extends BaseController {
     @ApiOperation(value = "乐团所有班级列表")
     @GetMapping("/findAllClassGroupByMusicGroup")
     @PreAuthorize("@pcs.hasPermissions('classGroup/findAllClassGroupByMusicGroup')")
-    public HttpResponseResult findAllClassGroupByMusicGroup(String musicGroupId,String type) {
-        return succeed(classGroupService.findAllClassGroupByMusicGroup(musicGroupId,type));
+    public HttpResponseResult findAllClassGroupByMusicGroup(String musicGroupId, String type) {
+        return succeed(classGroupService.findAllClassGroupByMusicGroup(musicGroupId, type));
     }
 
     @ApiOperation(value = "乐团详情--班级详情列表")
@@ -185,7 +183,7 @@ public class ClassGroupController extends BaseController {
         if (classGroupTeacherMapperList.size() <= 0) {
             return failed("参数不合法");
         }
-        return succeed(classGroupTeacherMapperService.classGroupTeachersInsert(classGroupTeacherMapperList,true));
+        return succeed(classGroupTeacherMapperService.classGroupTeachersInsert(classGroupTeacherMapperList, true));
     }
 
     @ApiOperation(value = "获取乐团班级老师")
@@ -241,7 +239,7 @@ public class ClassGroupController extends BaseController {
     @PreAuthorize("@pcs.hasPermissions('classGroup/revisionAddClassGroup')")
     @ApiImplicitParams({@ApiImplicitParam(name = "ClassGroup4MixDto", value = "添加班级结构", required = true, dataType = "String")})
     public HttpResponseResult revisionAddClassGroup(@RequestBody List<ClassGroup4MixDto> classGroup4MixDtos) throws Exception {
-        if(CollectionUtils.isEmpty(classGroup4MixDtos)){
+        if (CollectionUtils.isEmpty(classGroup4MixDtos)) {
             return failed("请填写班级信息");
         }
         return succeed(classGroupService.classGroupAdjust(classGroup4MixDtos));
@@ -268,7 +266,7 @@ public class ClassGroupController extends BaseController {
     @PreAuthorize("@pcs.hasPermissions('classGroup/highClassGroups')")
     @ApiImplicitParams({@ApiImplicitParam(name = "musicGroupId", value = "乐团id", required = true, dataType = "String")})
     public HttpResponseResult highClassGroups(String musicGroupId) throws Exception {
-        return succeed(classGroupService.findClassGroupByMusicGroupIdAndSubjectId(musicGroupId,null));
+        return succeed(classGroupService.findClassGroupByMusicGroupIdAndSubjectId(musicGroupId, null));
     }
 
     @ApiOperation(value = "按班级类型查找班级(班级调整)")
@@ -279,7 +277,7 @@ public class ClassGroupController extends BaseController {
             @ApiImplicitParam(name = "type", value = "班级类型", required = true, dataType = "string"),
     })
     public HttpResponseResult classGroupAndTeacher(String musicGroupId, ClassGroupTypeEnum type) throws Exception {
-        return succeed(classGroupService.getClassGroupAndTeacherByType(musicGroupId,type));
+        return succeed(classGroupService.getClassGroupAndTeacherByType(musicGroupId, type));
     }
 
     @ApiOperation(value = "查询是否设置课酬")
@@ -288,17 +286,17 @@ public class ClassGroupController extends BaseController {
     @ApiImplicitParams({
             @ApiImplicitParam(name = "musicGroupId", value = "乐团id", required = true, dataType = "string")
     })
-    public HttpResponseResult checkSetSalary(String musicGroupId){
+    public HttpResponseResult checkSetSalary(String musicGroupId) {
         return succeed(classGroupService.checkSetSalary(musicGroupId));
     }
 
     @PostMapping("/enumTest")
-    public HttpResponseResult enumTest(@RequestBody TestDto testDto){
+    public HttpResponseResult enumTest(@RequestBody TestDto testDto) {
         return succeed(testDto.getDelFlag().getMsg());
     }
 
     @GetMapping("queryUserInfo")
-    public HttpResponseResult queryUserInfo(Integer userId){
+    public HttpResponseResult queryUserInfo(Integer userId) {
         SysUser sysUser = sysUserFeignService.queryUserById(userId);
         return succeed(sysUser.getUsername());
     }
@@ -309,7 +307,7 @@ public class ClassGroupController extends BaseController {
     @ApiImplicitParams({
             @ApiImplicitParam(name = "classGroupId", value = "班级id", required = true, dataType = "int")
     })
-    public HttpResponseResult getClassGroupTeachers(Integer classGroupId){
+    public HttpResponseResult getClassGroupTeachers(Integer classGroupId) {
         return succeed(classGroupTeacherMapperService.getClassGroupTeachers(classGroupId));
     }
 
@@ -324,29 +322,29 @@ public class ClassGroupController extends BaseController {
     @ApiOperation(value = "终极班级信息获取")
     @GetMapping("/superFindClassGroups")
     @PreAuthorize("@pcs.hasPermissions('classGroup/superFindClassGroups')")
-    public HttpResponseResult superFindClassGroups(EndCourseScheduleQueryInfo queryInfo){
+    public HttpResponseResult superFindClassGroups(EndCourseScheduleQueryInfo queryInfo) {
         return succeed(classGroupService.endFindClassGroups(queryInfo));
     }
 
     @ApiOperation(value = "获取班级剩余课程类型对应的时长(分钟)")
     @GetMapping("/queryRemainCourseTypeDuration")
     @PreAuthorize("@pcs.hasPermissions('classGroup/queryRemainCourseTypeDuration')")
-    public HttpResponseResult queryRemainCourseTypeDuration(String classGroupIdList){
-    	
+    public HttpResponseResult queryRemainCourseTypeDuration(String classGroupIdList) {
+
         return succeed(classGroupService.queryRemainCourseTypeDuration(classGroupIdList));
     }
 
     @ApiOperation(value = "进行中乐团-修改-班级详情-学员班级调整-班级剩余课次")
     @GetMapping("/classGroupSubCourseNum")
     @PreAuthorize("@pcs.hasPermissions('classGroup/classGroupSubCourseNum')")
-    public HttpResponseResult classGroupSubCourseNum(Integer classGroupId){
+    public HttpResponseResult classGroupSubCourseNum(Integer classGroupId) {
         return succeed(classGroupService.classGroupSubCourseNum(classGroupId));
     }
 
     @ApiOperation(value = "进行中乐团-修改-班级详情-学员班级调整-生成默认缴费信息")
     @PostMapping("/getDefaultPaymentCalender")
     @PreAuthorize("@pcs.hasPermissions('classGroup/getDefaultPaymentCalender')")
-    public HttpResponseResult studentClassAuditDetail(@RequestBody List<Integer> classGroupIds){
+    public HttpResponseResult studentClassAuditDetail(@RequestBody List<Integer> classGroupIds) {
         return succeed(classGroupService.getDefaultPaymentCalender(classGroupIds));
     }
 
@@ -363,4 +361,12 @@ public class ClassGroupController extends BaseController {
 //    public HttpResponseResult findClassCourseMinuteMap(@RequestBody List<Integer> classGroupIds){
 //        return succeed(classGroupService.findClassCourseMinuteMap(classGroupIds));
 //    }
+
+    @ApiOperation(value = "获取乐团声部现有及容许的最大班级数量")
+    @PostMapping("/getSubjectNowAndMaxHighClassGroupNum")
+    @PreAuthorize("@pcs.hasPermissions('classGroup/getSubjectNowAndMaxHighClassGroupNum')")
+    public HttpResponseResult<HighClassGroupNumDto> getSubjectNowAndMaxHighClassGroupNum(String musicGroupId, ClassGroupTypeEnum type, String subjectIds) {
+        return succeed(classGroupService.getSubjectMaxHighClassGroupNum(musicGroupId, type, subjectIds));
+    }
+
 }

+ 2 - 2
mec-web/src/main/java/com/ym/mec/web/controller/StudentManageController.java

@@ -124,8 +124,8 @@ public class StudentManageController extends BaseController {
     @ApiOperation(value = "乐团修改--学员缴费记录--可新增学员列表")
     @GetMapping("/queryCanAddStudent")
     @PreAuthorize("@pcs.hasPermissions('studentManage/queryCanAddStudent')")
-    public Object queryCanAddStudent(String musicGroupId,Long musicGroupPaymentCalenderId,String search,Integer subjectId){
-        return succeed(studentManageService.queryCanAddStudent(musicGroupId,musicGroupPaymentCalenderId,search,subjectId));
+    public Object queryCanAddStudent(String musicGroupId,String batchNo,String search,Integer subjectId){
+        return succeed(studentManageService.queryCanAddStudent(musicGroupId,batchNo,search,subjectId));
     }
 
     @ApiOperation(value = "乐团管理--乐团详情--学员列表--查看班级")

+ 3 - 0
mec-web/src/main/java/com/ym/mec/web/controller/StudentPaymentRouteOrderController.java

@@ -176,6 +176,9 @@ public class StudentPaymentRouteOrderController extends BaseController {
         	studentPaymentRouteOrder.setSaleAmount(BigDecimal.ZERO);
         }
         studentPaymentRouteOrder.setUpdateBy(sysUser.getId());
+        if(studentPaymentRouteOrder.getSchoolId() == null){
+            studentPaymentRouteOrder.setSchoolId(999999999);
+        }
 
         return succeed(studentPaymentRouteOrderService.updateOutOrder(studentPaymentRouteOrder));
     }

+ 4 - 4
mec-web/src/main/java/com/ym/mec/web/controller/StudentRegistrationController.java

@@ -108,8 +108,8 @@ public class StudentRegistrationController extends BaseController {
     @GetMapping("/getMusicGroupStu")
     @PreAuthorize("@pcs.hasPermissions('studentRegistration/getMusicGroupStu')")
     @ApiImplicitParams({@ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "String"),
-            @ApiImplicitParam(name = "actualSubjectId", value = "科目(声部)id,", required = false, dataType = "int")})
-    public HttpResponseResult getMusicGroupStu(String musicGroupId, Integer actualSubjectId) {
+            @ApiImplicitParam(name = "actualSubjectId", value = "科目(声部)id,", required = false, dataType = "String")})
+    public HttpResponseResult getMusicGroupStu(String musicGroupId, String actualSubjectId) {
         return succeed(studentRegistrationService.findMusicGroupStudent(musicGroupId, actualSubjectId));
     }
 
@@ -135,8 +135,8 @@ public class StudentRegistrationController extends BaseController {
     @PreAuthorize("@pcs.hasPermissions('studentRegistration/getMusicGroupStuNoClassType')")
     @ApiImplicitParams({@ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "String"),
             @ApiImplicitParam(name = "type", value = "类型(MIX,HIGH)", required = true, dataType = "ClassGroupTypeEnum"),
-            @ApiImplicitParam(name = "actualSubjectId", value = "科目(声部)id,", required = false, dataType = "int")})
-    public HttpResponseResult getMusicGroupStuNoClassType(String musicGroupId, Long classGroupId, ClassGroupTypeEnum type, Integer actualSubjectId) {
+            @ApiImplicitParam(name = "actualSubjectId", value = "科目(声部)id,", required = false, dataType = "String")})
+    public HttpResponseResult getMusicGroupStuNoClassType(String musicGroupId, Long classGroupId, ClassGroupTypeEnum type, String actualSubjectId) {
         return succeed(studentRegistrationService.findMusicGroupStuNoClassType(musicGroupId, classGroupId, type, actualSubjectId));
     }
 

+ 13 - 12
mec-web/src/main/java/com/ym/mec/web/controller/TeacherAttendanceController.java

@@ -1,17 +1,11 @@
 package com.ym.mec.web.controller;
 
-import com.ym.mec.auth.api.client.SysUserFeignService;
-import com.ym.mec.auth.api.entity.SysUser;
-import com.ym.mec.biz.dal.dao.EmployeeDao;
-import com.ym.mec.biz.dal.entity.Employee;
-import com.ym.mec.biz.dal.entity.TeacherAttendance;
-import com.ym.mec.biz.dal.enums.UpdateAttendanceEnum;
-import com.ym.mec.biz.dal.page.TeacherAttendanceComplaintsQueryInfo;
-import com.ym.mec.biz.dal.page.TeacherCloseQueryInfo;
-import com.ym.mec.biz.service.TeacherAttendanceService;
-import com.ym.mec.common.controller.BaseController;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+
+import java.util.Arrays;
+import java.util.List;
+
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -20,8 +14,15 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.Arrays;
-import java.util.List;
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.dao.EmployeeDao;
+import com.ym.mec.biz.dal.entity.Employee;
+import com.ym.mec.biz.dal.entity.TeacherAttendance;
+import com.ym.mec.biz.dal.page.TeacherAttendanceComplaintsQueryInfo;
+import com.ym.mec.biz.dal.page.TeacherCloseQueryInfo;
+import com.ym.mec.biz.service.TeacherAttendanceService;
+import com.ym.mec.common.controller.BaseController;
 
 @RequestMapping("teacherAttendance")
 @Api(tags = "教师签到服务")