Bladeren bron

Merge branch 'master' of http://git.dayaedu.com/yonge/mec

zouxuan 5 jaren geleden
bovenliggende
commit
a112b0e1d5
18 gewijzigde bestanden met toevoegingen van 682 en 95 verwijderingen
  1. 10 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentRegistrationDao.java
  2. 14 3
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SubjectDao.java
  3. 95 9
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/ClassGroup4MixDto.java
  4. 3 3
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentRegistration.java
  5. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/ClassGroupTypeEnum.java
  6. 18 3
      mec-biz/src/main/java/com/ym/mec/biz/service/ClassGroupService.java
  7. 9 0
      mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupService.java
  8. 8 0
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentRegistrationService.java
  9. 4 0
      mec-biz/src/main/java/com/ym/mec/biz/service/SubjectService.java
  10. 466 61
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java
  11. 5 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java
  12. 7 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java
  13. 5 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/SubjectServiceImpl.java
  14. 8 0
      mec-biz/src/main/resources/config/mybatis/StudentRegistrationMapper.xml
  15. 7 0
      mec-biz/src/main/resources/config/mybatis/SubjectMapper.xml
  16. 8 7
      mec-web/src/main/java/com/ym/mec/web/controller/ClassGroupController.java
  17. 0 5
      mec-web/src/main/java/com/ym/mec/web/controller/ClassGroupStudentController.java
  18. 13 0
      mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupController.java

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

@@ -163,7 +163,16 @@ public interface StudentRegistrationDao extends BaseDAO<Long, StudentRegistratio
 
     /**
      * 查询乐团声部下的学生
+     *
+     * @return
+     */
+    List<StudentRegistration> findMusicGroupStudent(String musicGroupId, Integer actualSubjectId);
+
+    /**
+     * 查询乐团userIdList的学生
+     * @param musicGroupId
+     * @param userIdList
      * @return
      */
-    List<StudentRegistration> findMusicGroupStudent(String musicGroupId,Integer actualSubjectId);
+    List<StudentRegistration> findStudentListByUserIdList(@Param("musicGroupId") String musicGroupId, @Param("userIdList") List<Integer> userIdList);
 }

+ 14 - 3
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SubjectDao.java

@@ -15,6 +15,7 @@ public interface SubjectDao extends BaseDAO<Integer, Subject> {
 
     /**
      * 通过乐团编号查询科目列表
+     *
      * @param musicGroupId
      * @return
      */
@@ -22,6 +23,7 @@ public interface SubjectDao extends BaseDAO<Integer, Subject> {
 
     /**
      * 通过乐团收费方式,获取默认的声部列表
+     *
      * @param chargeTypeId
      * @return
      */
@@ -29,6 +31,7 @@ public interface SubjectDao extends BaseDAO<Integer, Subject> {
 
     /**
      * 根据科目code查科目
+     *
      * @param code
      * @return Subject
      */
@@ -36,6 +39,7 @@ public interface SubjectDao extends BaseDAO<Integer, Subject> {
 
     /**
      * 根据父级id查询子级列表
+     *
      * @param parentId
      * @return
      */
@@ -43,6 +47,7 @@ public interface SubjectDao extends BaseDAO<Integer, Subject> {
 
     /**
      * 通过乐团收费类型,获取默认的声部列表
+     *
      * @param chargeTypeId
      * @return
      */
@@ -50,6 +55,7 @@ public interface SubjectDao extends BaseDAO<Integer, Subject> {
 
     /**
      * 通过乐团编号获取声部列表以及声部报名、缴费、计划人数
+     *
      * @param musicGroupId
      * @return
      */
@@ -57,6 +63,7 @@ public interface SubjectDao extends BaseDAO<Integer, Subject> {
 
     /**
      * 根据声部id字符串查询
+     *
      * @param subIds
      * @return
      */
@@ -73,23 +80,27 @@ public interface SubjectDao extends BaseDAO<Integer, Subject> {
 
     /**
      * 根据声部编号列表获取声部名称map
+     *
      * @param subjectIds
      * @return
      */
     List<Map<Integer, String>> queryNameByIds(@Param("subjectIds") String subjectIds);
 
     /**
+     * @return java.util.List<java.util.Map < java.lang.Integer, java.lang.String>>
      * @Author: Joburgess
      * @Date: 2019/10/17
      * @params [subjectIds]
-     * @return java.util.List<java.util.Map<java.lang.Integer,java.lang.String>>
-     * @describe 根据科目编号获取部门编号,部门名称
+     * @describe 根据科目编号获取部门编号, 部门名称
      */
-    List<Map<Long,String>> findBySubjecIds(@Param("subjectIds") List<String> subjectIds);
+    List<Map<Long, String>> findBySubjecIds(@Param("subjectIds") List<String> subjectIds);
 
     /**
      * 获取子级列表
+     *
      * @return
      */
     List<Subject> findSubSubjects();
+
+    List<Subject> findBySubjectByIdList(@Param("subjectIdList") List<Integer> subjectIdList);
 }

+ 95 - 9
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/ClassGroup4MixDto.java

@@ -1,31 +1,30 @@
 package com.ym.mec.biz.dal.dto;
 
 import com.ym.mec.biz.dal.entity.ClassGroupTeacherMapper;
-import com.ym.mec.biz.dal.enums.YesOrNoEnum;
 import io.swagger.annotations.ApiModelProperty;
 
 import java.util.List;
 
 public class ClassGroup4MixDto {
 
+    @ApiModelProperty(value = "班级id", required = true)
+    private Integer classGroupId;
+
     @ApiModelProperty(value = "乐团id", required = true)
     private String musicGroupId;
 
+    @ApiModelProperty(value = "合奏班id", required = true)
+    private Integer mixClassGroupId;
+
     @ApiModelProperty(value = "班级名称", required = true)
     private String classGroupName;
 
-    @ApiModelProperty(value = "班级id", required = true)
-    private Integer classGroupId;
-
-    @ApiModelProperty(value = "学生-班级", required = true)
-    private List<ClassGroupStudentMapperDto> classGroupStudentMapperDtoList;
+    @ApiModelProperty(value = "学生ids", required = true)
+    private List<Integer> students;
 
     @ApiModelProperty(value = "老师设置", required = true)
     private List<ClassGroupTeacherMapper> classGroupTeacherMapperList;
 
-    @ApiModelProperty(value = "是否永久 方式1-永久 0-临时", required = true)
-    private YesOrNoEnum type;
-
     @ApiModelProperty(value = "开始时间", required = true)
     private String startDate;
 
@@ -41,4 +40,91 @@ public class ClassGroup4MixDto {
     @ApiModelProperty(value = "排课次数", required = true)
     private Integer courseTimes;
 
+    public String getMusicGroupId() {
+        return musicGroupId;
+    }
+
+    public void setMusicGroupId(String musicGroupId) {
+        this.musicGroupId = musicGroupId;
+    }
+
+    public Integer getClassGroupId() {
+        return classGroupId;
+    }
+
+    public void setClassGroupId(Integer classGroupId) {
+        this.classGroupId = classGroupId;
+    }
+
+    public String getClassGroupName() {
+        return classGroupName;
+    }
+
+    public void setClassGroupName(String classGroupName) {
+        this.classGroupName = classGroupName;
+    }
+
+    public List<Integer> getStudents() {
+        return students;
+    }
+
+    public void setStudents(List<Integer> students) {
+        this.students = students;
+    }
+
+    public List<ClassGroupTeacherMapper> getClassGroupTeacherMapperList() {
+        return classGroupTeacherMapperList;
+    }
+
+    public void setClassGroupTeacherMapperList(List<ClassGroupTeacherMapper> classGroupTeacherMapperList) {
+        this.classGroupTeacherMapperList = classGroupTeacherMapperList;
+    }
+
+    public String getStartDate() {
+        return startDate;
+    }
+
+    public void setStartDate(String startDate) {
+        this.startDate = startDate;
+    }
+
+    public Integer getDayOfWeek() {
+        return dayOfWeek;
+    }
+
+    public void setDayOfWeek(Integer dayOfWeek) {
+        this.dayOfWeek = dayOfWeek;
+    }
+
+    public String getStartClassTime() {
+        return startClassTime;
+    }
+
+    public void setStartClassTime(String startClassTime) {
+        this.startClassTime = startClassTime;
+    }
+
+    public String getEndClassTime() {
+        return endClassTime;
+    }
+
+    public void setEndClassTime(String endClassTime) {
+        this.endClassTime = endClassTime;
+    }
+
+    public Integer getCourseTimes() {
+        return courseTimes;
+    }
+
+    public void setCourseTimes(Integer courseTimes) {
+        this.courseTimes = courseTimes;
+    }
+
+    public Integer getMixClassGroupId() {
+        return mixClassGroupId;
+    }
+
+    public void setMixClassGroupId(Integer mixClassGroupId) {
+        this.mixClassGroupId = mixClassGroupId;
+    }
 }

+ 3 - 3
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentRegistration.java

@@ -85,7 +85,7 @@ public class StudentRegistration {
     private ClassGroupStudentStatusEnum musicGroupStatus;
 
     @ApiModelProperty(value = "班级ids", required = true)
-    private String classGroupId;
+    private Integer classGroupId;
 
     @ApiModelProperty(value = "零时课程费用", required = true)
     private BigDecimal temporaryCourseFee;
@@ -243,11 +243,11 @@ public class StudentRegistration {
         return paymentStatus;
     }
 
-    public String getClassGroupId() {
+    public Integer getClassGroupId() {
         return classGroupId;
     }
 
-    public void setClassGroupId(String classGroupId) {
+    public void setClassGroupId(Integer classGroupId) {
         this.classGroupId = classGroupId;
     }
 

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/ClassGroupTypeEnum.java

@@ -10,7 +10,8 @@ public enum ClassGroupTypeEnum implements BaseEnum<String, ClassGroupTypeEnum> {
 	MIX("MIX", "合奏班级"),
 	HIGH("HIGH", "提高班"),
 	VIP("VIP", "vip课"),
-	DEMO("DEMO", "试听课");
+	DEMO("DEMO", "试听课"),
+	SNAP("SNAP", "临时班级");
 
 	private String code;
 

+ 18 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/ClassGroupService.java

@@ -241,11 +241,26 @@ public interface ClassGroupService extends BaseService<Integer, ClassGroup> {
     List<StudentAttendanceViewDto> findAttendanceStudentByCourse(Long courseScheduleId);
 
     /**
-     * 班级调整
-     * @param classGroupAdjustDto
+     * 班级调整(新增班级)
+     * @param classGroup4MixDto
      * @return
      */
-    ClassGroup classGroupAdjust(ClassGroupAdjustDto classGroupAdjustDto) throws Exception;
+    ClassGroup classGroupAdjust(ClassGroup4MixDto classGroup4MixDto) throws Exception;
+
+    /**
+     * 班级调整(修改班级)
+     * @param classGroup4MixDto
+     * @return
+     */
+    ClassGroup classGroupUpdate(ClassGroup4MixDto classGroup4MixDto) throws Exception;
+
+    /**
+     * 班级调整(增加临时班级)
+     * @param classGroup4MixDto
+     * @return
+     */
+    ClassGroup classGroupSnap(ClassGroup4MixDto classGroup4MixDto) throws Exception;
+
 
     /**
      * 乐团详情--班级详情列表

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/MusicGroupService.java

@@ -4,6 +4,7 @@ import java.math.BigDecimal;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dto.BasicUserDto;
@@ -16,6 +17,7 @@ import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.page.QueryInfo;
 import com.ym.mec.common.service.BaseService;
+import org.apache.ibatis.annotations.Param;
 
 public interface MusicGroupService extends BaseService<String, MusicGroup> {
 	/**
@@ -144,6 +146,13 @@ public interface MusicGroupService extends BaseService<String, MusicGroup> {
 	SubFeeSettingDto findMusicGroupBasicInfo(String musicGroupId);
 
 	/**
+	 * 获取乐团列表
+	 * @param musicGroupIds
+	 * @return
+	 */
+	List<MusicGroup> queryListByIds(Set<String> musicGroupIds);
+
+	/**
 	 * 乐团详情--课酬调整--课程教师列表
 	 * @param courseScheduleId
 	 * @return

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

@@ -189,5 +189,13 @@ public interface StudentRegistrationService extends BaseService<Long, StudentReg
 	 */
 	List<StudentRegistration> findMusicGroupStudent(String musicGroupId,Integer actualSubjectId);
 
+	/**
+	 * 查询乐团userIdList的学生
+	 * @param musicGroupId
+	 * @param userIdList
+	 * @return
+	 */
+	List<StudentRegistration> findStudentListByUserIdList(String musicGroupId, List<Integer> userIdList);
+
 
 }

+ 4 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/SubjectService.java

@@ -7,6 +7,7 @@ import com.ym.mec.biz.dal.entity.SubjectGoodsMapper;
 import com.ym.mec.biz.dal.page.SubjectQueryInfo;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 import java.util.Map;
@@ -82,4 +83,7 @@ public interface SubjectService extends BaseService<Integer, Subject> {
      * @return
      */
     List<Subject> findSubSubjects();
+
+    List<Subject> findBySubjectByIdList(List<Integer> subjectIdList);
+
 }

+ 466 - 61
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java

@@ -34,6 +34,8 @@ import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.stream.Collectors;
 
+import static com.timevale.tgtext.text.pdf.df.*;
+
 @Service
 public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup> implements ClassGroupService {
 
@@ -75,6 +77,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
     private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
     @Autowired
     private CourseScheduleTeacherSalaryDao courseScheduleTeacherSalaryDao;
+    @Autowired
+    private StudentRegistrationService studentRegistrationService;
 
     @Override
     public BaseDAO<Integer, ClassGroup> getDAO() {
@@ -137,7 +141,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
             classGroupStudentList.add(classGroupStudentMapper);
             StudentRegistration studentRegistration = new StudentRegistration();
-            studentRegistration.setClassGroupId(classGroup.getId().toString());
+            studentRegistration.setClassGroupId(classGroup.getId());
             studentRegistration.setUserId(Integer.getInteger(userId));
             studentRegistration.setMusicGroupId(classGroup.getMusicGroupId());
             studentRegistrationDao.updateByUserIdAndMusicGroupId(studentRegistration);
@@ -337,8 +341,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
     }
 
     @Override
-    public List<ClassGroupTeachersDto> getClassGroupAndTeachers(String musicGroupId, String type,Integer classGroupId) {
-        List<ClassGroupTeachersDto> classGroupAndTeachersList = classGroupDao.findClassGroupByMusicGroupId(musicGroupId, type,classGroupId);
+    public List<ClassGroupTeachersDto> getClassGroupAndTeachers(String musicGroupId, String type, Integer classGroupId) {
+        List<ClassGroupTeachersDto> classGroupAndTeachersList = classGroupDao.findClassGroupByMusicGroupId(musicGroupId, type, classGroupId);
 
         List<ClassGroupTeacherMapper> classGroupTeacherMapperList = classGroupTeacherMapperService.findClassGroupTeachers(classGroupAndTeachersList);
 
@@ -355,9 +359,9 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
     }
 
     @Override
-    public List<ClassGroupTeachersDto> getClassGroupAndTeacherSalary(String musicGroupId, SalarySettlementTypeEnum type,Integer classGroupId) throws Exception {
+    public List<ClassGroupTeachersDto> getClassGroupAndTeacherSalary(String musicGroupId, SalarySettlementTypeEnum type, Integer classGroupId) throws Exception {
         //乐团班级及班级老师
-        List<ClassGroupTeachersDto> classGroupAndTeachers = getClassGroupAndTeachers(musicGroupId, "NORMAL,MIX,HIGH",classGroupId);
+        List<ClassGroupTeachersDto> classGroupAndTeachers = getClassGroupAndTeachers(musicGroupId, "NORMAL,MIX,HIGH", classGroupId);
 
         for (ClassGroupTeachersDto classGroupAndTeacher : classGroupAndTeachers) {
             //班级的教师列表
@@ -567,7 +571,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             throw new BizException("请登录");
         }
 
-        if(StringUtils.isBlank(type)){
+        if (StringUtils.isBlank(type)) {
             throw new BizException("请指定课程类型");
         }
 
@@ -722,67 +726,266 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public ClassGroup classGroupAdjust(ClassGroupAdjustDto classGroupAdjustDto) throws Exception {
+    public ClassGroup classGroupAdjust(ClassGroup4MixDto classGroup4MixDto) throws Exception {
         Date date = new Date();
-        MusicGroup musicGroup = musicGroupDao.get(classGroupAdjustDto.getMusicGroupId());
+        String musicGroupId = classGroup4MixDto.getMusicGroupId();
+        MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
         if (musicGroup != null) {
             throw new Exception("乐团不存在");
         }
         Integer schoolId = musicGroup.getSchoolId();
 
-        List<ClassGroupStudentMapperDto> classGroupStudentMapperDtoList = classGroupAdjustDto.getClassGroupStudentMapperDtoList();
-        String subjectIdList = "";
-        String subjectNameList = "";
-        for (ClassGroupStudentMapperDto classGroupStudentMapperDto : classGroupStudentMapperDtoList) {
-            //1、永久调整,删除学生班级关联关系
-            if (classGroupAdjustDto.getType().equals(YesOrNoEnum.YES)) {
-                ClassGroupStudentMapper classStudentMapper = classGroupStudentMapperDao.query(classGroupStudentMapperDto.getClassGroupId(), classGroupStudentMapperDto.getUserId());
-                classStudentMapper.setStatus(ClassGroupStudentStatusEnum.QUIT);
-                classGroupStudentMapperDao.update(classStudentMapper);
-            } else { //临时删除学生对应时间段的课程
-                List<CourseSchedule> courseScheduleList = courseScheduleDao.findCourseScheduleByClassGroupIdAndDate(classGroupStudentMapperDto.getClassGroupId(), classGroupAdjustDto.getStartDate(), classGroupAdjustDto.getCourseTimes());
-                courseScheduleStudentPaymentDao.deleteStudentCourseSchedule(classGroupStudentMapperDto.getUserId(), courseScheduleList);
+        List<Integer> subjectIdSet = new ArrayList<>();
+
+        List<Integer> studentIdList = classGroup4MixDto.getStudents();
+        List<StudentRegistration> studentList = studentRegistrationService.findStudentListByUserIdList(musicGroupId, studentIdList);
+        for (StudentRegistration student : studentList) {
+            subjectIdSet.add(student.getSubjectId());
+        }
+        List<Subject> subjectList = subjectService.findBySubjectByIdList(subjectIdSet);
+
+        String subjectIds = "";
+        String subjectNames = "";
+        for (Subject subject : subjectList) {
+            subjectIds += subject.getId() + ",";
+            subjectNames += subject.getName() + "/";
+        }
+
+        subjectIds = subjectIds.substring(0, subjectIds.length() - 1);
+        subjectNames = subjectNames.substring(0, subjectNames.length() - 1);
+
+
+        //1、新建班级
+        ClassGroup classGroup = new ClassGroup();
+        classGroup.setMusicGroupId(classGroup4MixDto.getMusicGroupId());
+        classGroup.setSubjectIdList(subjectIds);
+        classGroup.setName(classGroup4MixDto.getClassGroupName());
+        classGroup.setExpectStudentNum(studentList.size());
+        classGroup.setStudentNum(studentList.size());
+        classGroup.setType(ClassGroupTypeEnum.NORMAL);
+        classGroup.setDelFlag(YesOrNoEnum.NO);
+        classGroup.setCreateTime(date);
+        classGroup.setUpdateTime(date);
+        classGroupDao.insert(classGroup);
+
+
+        //2、将学生加入新班级(学生注册表,关联表
+        List<ClassGroupStudentMapper> classGroupStudentMapperList = new ArrayList<>();
+        for (StudentRegistration studentRegistration : studentList) {
+            studentRegistration.setClassGroupId(classGroup.getId());
+            studentRegistrationService.update(studentRegistration);
+
+            ClassGroupStudentMapper classGroupStudentMapper = new ClassGroupStudentMapper();
+            classGroupStudentMapper.setClassGroupId(classGroup.getId());
+            classGroupStudentMapper.setUserId(studentRegistration.getUserId());
+            classGroupStudentMapper.setCreateTime(date);
+            classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
+
+            classGroupStudentMapperList.add(classGroupStudentMapper);
+        }
+        classGroupStudentMapperDao.classGroupStudentsInsert(classGroupStudentMapperList);
+
+
+        //3、将老师加入关联关系
+        List<ClassGroupTeacherMapper> classGroupTeacherMapperList = classGroup4MixDto.getClassGroupTeacherMapperList();
+
+        //课时长度
+        long classCourseDuration = Duration.between(LocalDateTime.parse(classGroup4MixDto.getStartDate() + " " + classGroup4MixDto.getStartClassTime() + ":00"),
+                LocalDateTime.parse(classGroup4MixDto.getStartDate() + " " + classGroup4MixDto.getEndClassTime() + ":00"))
+                .toMinutes();
+
+        for (ClassGroupTeacherMapper classGroupTeacherMapper : classGroupTeacherMapperList) {
+            classGroupTeacherMapper.setClassGroupId(classGroup.getId());
+            classGroupTeacherMapper.setMusicGroupId(classGroup4MixDto.getMusicGroupId());
+
+            List<TeacherDefaultMusicGroupSalary> teacherSalaryList = teacherDefaultMusicGroupSalaryService.getTeacherSalaryByUserIdAndType(classGroupTeacherMapper.getUserId(), "SINGLE", musicGroup.getSettlementType());
+            BigDecimal salary = new BigDecimal("0");
+            for (TeacherDefaultMusicGroupSalary teacherDefaultMusicGroupSalary : teacherSalaryList) {
+                //对应基准课酬
+                BigDecimal baseSalary = classGroupTeacherMapper.getTeacherRole().equals(TeachTypeEnum.BISHOP) ? teacherDefaultMusicGroupSalary.getMainTeacherSalary() : teacherDefaultMusicGroupSalary.getAssistantTeacherSalary();
+                //基准课酬
+                if (teacherDefaultMusicGroupSalary.getSettlementType().equals(SalarySettlementTypeEnum.TEACHER_DEFAULT)) {
+                    salary = new BigDecimal(classCourseDuration).divide(new BigDecimal(30)).multiply(baseSalary).setScale(2, BigDecimal.ROUND_HALF_UP);
+                    break;
+                }
+                //阶梯课酬
+                if (classCourseDuration >= teacherDefaultMusicGroupSalary.getDurationMin() && classCourseDuration <= teacherDefaultMusicGroupSalary.getDurationMin()) {
+                    salary = baseSalary;
+                    break;
+                }
+            }
+            classGroupTeacherMapper.setSalary(salary);
+        }
+        classGroupTeacherMapperDao.classGroupTeachersInsert(classGroupTeacherMapperList);
+
+        //5、插入班级排课信息
+        LocalDateTime now = LocalDate.parse(classGroup4MixDto.getStartDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd")).atStartOfDay();
+
+        //计算每节课的课酬
+        List<CourseScheduleTeacherSalary> courseScheduleTeacherSalaryList = new ArrayList<>();
+        List<CourseScheduleStudentPayment> courseScheduleStudentPaymentList = new ArrayList<>();
+        BigDecimal expectPrice = new BigDecimal("0");
+        int times = 0;
+        while (true) {
+            int dayOfWeek = now.getDayOfWeek().getValue();
+            if (classGroup4MixDto.getDayOfWeek().equals(dayOfWeek)) {
+                Instant instant = now.atZone(ZoneId.systemDefault()).toInstant();
+                Date classDate = Date.from(instant);
+                String startClassTime = DateUtil.getDate(classDate) + " " + classGroup4MixDto.getStartClassTime() + ":00";
+                String endClassTime = DateUtil.getDate(classDate) + " " + classGroup4MixDto.getEndClassTime() + ":00";
+
+                CourseSchedule courseSchedule = new CourseSchedule();
+                courseSchedule.setSchoolId(schoolId);
+                courseSchedule.setClassGroupId(classGroup.getId());
+                courseSchedule.setStatus(CourseStatusEnum.NOT_START);
+                courseSchedule.setClassDate(classDate);
+                courseSchedule.setStartClassTime(DateUtil.stringToDate(startClassTime));
+                courseSchedule.setEndClassTime(DateUtil.stringToDate(endClassTime));
+                courseSchedule.setCreateTime(date);
+                courseSchedule.setUpdateTime(date);
+                courseSchedule.setTeachMode(TeachModeEnum.OFFLINE);
+                courseSchedule.setType(CourseSchedule.CourseScheduleType.SINGLE);
+                courseSchedule.setName(subjectNames + "-" + CourseSchedule.CourseScheduleType.SINGLE.getMsg());
+
+                courseScheduleDao.insert(courseSchedule);
+
+                times++;
+
+                for (ClassGroupTeacherMapper classGroupTeacherMapper : classGroupTeacherMapperList) {
+                    CourseScheduleTeacherSalary courseScheduleTeacherSalary = new CourseScheduleTeacherSalary();
+                    courseScheduleTeacherSalary.setCourseScheduleId(courseSchedule.getId());
+                    courseScheduleTeacherSalary.setTeacherRole(classGroupTeacherMapper.getTeacherRole());
+                    courseScheduleTeacherSalary.setUserId(classGroupTeacherMapper.getUserId());
+                    courseScheduleTeacherSalary.setExpectSalary(classGroupTeacherMapper.getSalary());
+                    courseScheduleTeacherSalary.setClassGroupId(classGroup.getId());
+                    courseScheduleTeacherSalary.setCreateTime(date);
+                    courseScheduleTeacherSalary.setUpdateTime(date);
+                    courseScheduleTeacherSalaryList.add(courseScheduleTeacherSalary);
+                }
+                for (StudentRegistration studentRegistration : studentList) {
+                    CourseScheduleStudentPayment courseScheduleStudentPayment = new CourseScheduleStudentPayment();
+                    courseScheduleStudentPayment.setCourseScheduleId(courseSchedule.getId());
+                    courseScheduleStudentPayment.setUserId(studentRegistration.getUserId());
+                    courseScheduleStudentPayment.setExpectPrice(expectPrice);
+                    courseScheduleStudentPayment.setCreateTime(date);
+                    courseScheduleStudentPayment.setUpdateTime(date);
+                    courseScheduleStudentPayment.setClassGroupId(classGroup.getId());
+                    courseScheduleStudentPaymentList.add(courseScheduleStudentPayment);
+                }
+
+            }
+            now = now.plusDays(1);
+            if (classGroup4MixDto.getCourseTimes().equals(times)) {
+                break;
             }
-            subjectIdList += classGroupStudentMapperDto.actualSubjectId() + ",";
-            subjectNameList += classGroupStudentMapperDto.getSubjectName() + "/";
         }
+        //老师结算表
+        courseScheduleTeacherSalaryDao.batchInsert(courseScheduleTeacherSalaryList);
 
+        //加入合奏班
+        ClassGroupRelation classGroupRelation = new ClassGroupRelation();
+        classGroupRelation.setClassGroupId(classGroup4MixDto.getMixClassGroupId());
+        classGroupRelation.setSubClassGroupId(classGroup.getId());
+        classGroupRelation.setCreateTime(date);
+        classGroupRelationService.insert(classGroupRelation);
+
+        //6、添加学生未上合奏课课程
+        List<CourseSchedule> noStartCourses = courseScheduleDao.findNoStartCoursesByClassGroupId(classGroup4MixDto.getMixClassGroupId());
+        for (CourseSchedule noStartCourse : noStartCourses) {
+            for (StudentRegistration studentRegistration : studentList) {
+                CourseScheduleStudentPayment courseScheduleStudentPayment = new CourseScheduleStudentPayment();
+                courseScheduleStudentPayment.setCourseScheduleId(noStartCourse.getId());
+                courseScheduleStudentPayment.setUserId(studentRegistration.getUserId());
+                courseScheduleStudentPayment.setExpectPrice(expectPrice);
+                courseScheduleStudentPayment.setCreateTime(date);
+                courseScheduleStudentPayment.setUpdateTime(date);
+                courseScheduleStudentPayment.setClassGroupId(noStartCourse.getClassGroupId());
+                courseScheduleStudentPaymentList.add(courseScheduleStudentPayment);
+            }
+        }
+        //学生结算表
+        courseScheduleStudentPaymentDao.batchInsert(courseScheduleStudentPaymentList);
+        return classGroup;
+    }
 
-        subjectIdList = subjectIdList.substring(0, subjectIdList.length() - 1);
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public ClassGroup classGroupUpdate(ClassGroup4MixDto classGroup4MixDto) throws Exception {
+        Date date = new Date();
+        String musicGroupId = classGroup4MixDto.getMusicGroupId();
+        MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
+        if (musicGroup != null) {
+            throw new Exception("乐团不存在");
+        }
+        ClassGroup classgroup = classGroupDao.get(classGroup4MixDto.getClassGroupId());
+        if(classgroup == null){
+            throw new Exception("班级不存在");
+        }
+
+        Integer schoolId = musicGroup.getSchoolId();
 
-        //2、新建班级
+        List<Integer> subjectIdSet = new ArrayList<>();
+
+        List<Integer> studentIdList = classGroup4MixDto.getStudents();
+        List<StudentRegistration> studentList = studentRegistrationService.findStudentListByUserIdList(musicGroupId, studentIdList);
+        for (StudentRegistration student : studentList) {
+            subjectIdSet.add(student.getSubjectId());
+        }
+        List<Subject> subjectList = subjectService.findBySubjectByIdList(subjectIdSet);
+
+        String subjectIds = "";
+        String subjectNames = "";
+        for (Subject subject : subjectList) {
+            subjectIds += subject.getId() + ",";
+            subjectNames += subject.getName() + "/";
+        }
+
+        subjectIds = subjectIds.substring(0, subjectIds.length() - 1);
+        subjectNames = subjectNames.substring(0, subjectNames.length() - 1);
+
+
+        //1、新建班级
         ClassGroup classGroup = new ClassGroup();
-        classGroup.setMusicGroupId(classGroupAdjustDto.getMusicGroupId());
-        classGroup.setSubjectIdList(subjectIdList);
-        classGroup.setName(classGroupAdjustDto.getClassGroupName());
-        classGroup.setExpectStudentNum(classGroupStudentMapperDtoList.size());
-        classGroup.setStudentNum(classGroupStudentMapperDtoList.size());
+        classGroup.setMusicGroupId(classGroup4MixDto.getMusicGroupId());
+        classGroup.setSubjectIdList(subjectIds);
+        classGroup.setName(classGroup4MixDto.getClassGroupName());
+        classGroup.setExpectStudentNum(studentList.size());
+        classGroup.setStudentNum(studentList.size());
         classGroup.setType(ClassGroupTypeEnum.NORMAL);
         classGroup.setDelFlag(YesOrNoEnum.NO);
         classGroup.setCreateTime(date);
         classGroup.setUpdateTime(date);
         classGroupDao.insert(classGroup);
 
-        //3、将学生加入新班级(学生注册表,关联表
+
+        //2、将学生加入新班级(学生注册表,关联表
         List<ClassGroupStudentMapper> classGroupStudentMapperList = new ArrayList<>();
-        for (ClassGroupStudentMapperDto classGroupStudentMapperDto : classGroupStudentMapperDtoList) {
-            classGroupStudentMapperDto.setClassGroupId(classGroup.getId());
-            classGroupStudentMapperList.add(classGroupStudentMapperDto);
+        for (StudentRegistration studentRegistration : studentList) {
+            studentRegistration.setClassGroupId(classGroup.getId());
+            studentRegistrationService.update(studentRegistration);
+
+            ClassGroupStudentMapper classGroupStudentMapper = new ClassGroupStudentMapper();
+            classGroupStudentMapper.setClassGroupId(classGroup.getId());
+            classGroupStudentMapper.setUserId(studentRegistration.getUserId());
+            classGroupStudentMapper.setCreateTime(date);
+            classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
+
+            classGroupStudentMapperList.add(classGroupStudentMapper);
         }
         classGroupStudentMapperDao.classGroupStudentsInsert(classGroupStudentMapperList);
 
 
-        //4、将老师加入关联关系
-        List<ClassGroupTeacherMapper> classGroupTeacherMapperList = classGroupAdjustDto.getClassGroupTeacherMapperList();
+        //3、将老师加入关联关系
+        List<ClassGroupTeacherMapper> classGroupTeacherMapperList = classGroup4MixDto.getClassGroupTeacherMapperList();
 
         //课时长度
-        long classCourseDuration = Duration.between(LocalDateTime.parse(classGroupAdjustDto.getStartDate() + " " + classGroupAdjustDto.getStartClassTime() + ":00"),
-                LocalDateTime.parse(classGroupAdjustDto.getStartDate() + " " + classGroupAdjustDto.getEndClassTime() + ":00"))
+        long classCourseDuration = Duration.between(LocalDateTime.parse(classGroup4MixDto.getStartDate() + " " + classGroup4MixDto.getStartClassTime() + ":00"),
+                LocalDateTime.parse(classGroup4MixDto.getStartDate() + " " + classGroup4MixDto.getEndClassTime() + ":00"))
                 .toMinutes();
 
         for (ClassGroupTeacherMapper classGroupTeacherMapper : classGroupTeacherMapperList) {
             classGroupTeacherMapper.setClassGroupId(classGroup.getId());
-            classGroupTeacherMapper.setMusicGroupId(classGroupAdjustDto.getMusicGroupId());
+            classGroupTeacherMapper.setMusicGroupId(classGroup4MixDto.getMusicGroupId());
 
             List<TeacherDefaultMusicGroupSalary> teacherSalaryList = teacherDefaultMusicGroupSalaryService.getTeacherSalaryByUserIdAndType(classGroupTeacherMapper.getUserId(), "SINGLE", musicGroup.getSettlementType());
             BigDecimal salary = new BigDecimal("0");
@@ -805,19 +1008,200 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         classGroupTeacherMapperDao.classGroupTeachersInsert(classGroupTeacherMapperList);
 
         //5、插入班级排课信息
-        LocalDateTime now = LocalDate.parse(classGroupAdjustDto.getStartDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd")).atStartOfDay();
+        LocalDateTime now = LocalDate.parse(classGroup4MixDto.getStartDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd")).atStartOfDay();
 
         //计算每节课的课酬
         List<CourseScheduleTeacherSalary> courseScheduleTeacherSalaryList = new ArrayList<>();
+        List<CourseScheduleStudentPayment> courseScheduleStudentPaymentList = new ArrayList<>();
+        BigDecimal expectPrice = new BigDecimal("0");
+        int times = 0;
+        while (true) {
+            int dayOfWeek = now.getDayOfWeek().getValue();
+            if (classGroup4MixDto.getDayOfWeek().equals(dayOfWeek)) {
+                Instant instant = now.atZone(ZoneId.systemDefault()).toInstant();
+                Date classDate = Date.from(instant);
+                String startClassTime = DateUtil.getDate(classDate) + " " + classGroup4MixDto.getStartClassTime() + ":00";
+                String endClassTime = DateUtil.getDate(classDate) + " " + classGroup4MixDto.getEndClassTime() + ":00";
+
+                CourseSchedule courseSchedule = new CourseSchedule();
+                courseSchedule.setSchoolId(schoolId);
+                courseSchedule.setClassGroupId(classGroup.getId());
+                courseSchedule.setStatus(CourseStatusEnum.NOT_START);
+                courseSchedule.setClassDate(classDate);
+                courseSchedule.setStartClassTime(DateUtil.stringToDate(startClassTime));
+                courseSchedule.setEndClassTime(DateUtil.stringToDate(endClassTime));
+                courseSchedule.setCreateTime(date);
+                courseSchedule.setUpdateTime(date);
+                courseSchedule.setTeachMode(TeachModeEnum.OFFLINE);
+                courseSchedule.setType(CourseSchedule.CourseScheduleType.SINGLE);
+                courseSchedule.setName(subjectNames + "-" + CourseSchedule.CourseScheduleType.SINGLE.getMsg());
+
+                courseScheduleDao.insert(courseSchedule);
+
+                times++;
+
+                for (ClassGroupTeacherMapper classGroupTeacherMapper : classGroupTeacherMapperList) {
+                    CourseScheduleTeacherSalary courseScheduleTeacherSalary = new CourseScheduleTeacherSalary();
+                    courseScheduleTeacherSalary.setCourseScheduleId(courseSchedule.getId());
+                    courseScheduleTeacherSalary.setTeacherRole(classGroupTeacherMapper.getTeacherRole());
+                    courseScheduleTeacherSalary.setUserId(classGroupTeacherMapper.getUserId());
+                    courseScheduleTeacherSalary.setExpectSalary(classGroupTeacherMapper.getSalary());
+                    courseScheduleTeacherSalary.setClassGroupId(classGroup.getId());
+                    courseScheduleTeacherSalary.setCreateTime(date);
+                    courseScheduleTeacherSalary.setUpdateTime(date);
+                    courseScheduleTeacherSalaryList.add(courseScheduleTeacherSalary);
+                }
+                for (StudentRegistration studentRegistration : studentList) {
+                    CourseScheduleStudentPayment courseScheduleStudentPayment = new CourseScheduleStudentPayment();
+                    courseScheduleStudentPayment.setCourseScheduleId(courseSchedule.getId());
+                    courseScheduleStudentPayment.setUserId(studentRegistration.getUserId());
+                    courseScheduleStudentPayment.setExpectPrice(expectPrice);
+                    courseScheduleStudentPayment.setCreateTime(date);
+                    courseScheduleStudentPayment.setUpdateTime(date);
+                    courseScheduleStudentPayment.setClassGroupId(classGroup.getId());
+                    courseScheduleStudentPaymentList.add(courseScheduleStudentPayment);
+                }
+
+            }
+            now = now.plusDays(1);
+            if (classGroup4MixDto.getCourseTimes().equals(times)) {
+                break;
+            }
+        }
+        //老师结算表
+        courseScheduleTeacherSalaryDao.batchInsert(courseScheduleTeacherSalaryList);
+
+        //加入合奏班
+        ClassGroupRelation classGroupRelation = new ClassGroupRelation();
+        classGroupRelation.setClassGroupId(classGroup4MixDto.getClassGroupId());
+        classGroupRelation.setSubClassGroupId(classGroup.getId());
+        classGroupRelation.setCreateTime(date);
+        classGroupRelationService.insert(classGroupRelation);
+
+        //6、添加学生未上合奏课课程
+        List<CourseSchedule> noStartCourses = courseScheduleDao.findNoStartCoursesByClassGroupId(classGroup4MixDto.getClassGroupId());
+        for (CourseSchedule noStartCourse : noStartCourses) {
+            for (StudentRegistration studentRegistration : studentList) {
+                CourseScheduleStudentPayment courseScheduleStudentPayment = new CourseScheduleStudentPayment();
+                courseScheduleStudentPayment.setCourseScheduleId(noStartCourse.getId());
+                courseScheduleStudentPayment.setUserId(studentRegistration.getUserId());
+                courseScheduleStudentPayment.setExpectPrice(expectPrice);
+                courseScheduleStudentPayment.setCreateTime(date);
+                courseScheduleStudentPayment.setUpdateTime(date);
+                courseScheduleStudentPayment.setClassGroupId(noStartCourse.getClassGroupId());
+                courseScheduleStudentPaymentList.add(courseScheduleStudentPayment);
+            }
+        }
+        //学生结算表
+        courseScheduleStudentPaymentDao.batchInsert(courseScheduleStudentPaymentList);
+        return classGroup;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public ClassGroup classGroupSnap(ClassGroup4MixDto classGroup4MixDto) throws Exception {
+        Date date = new Date();
+        String musicGroupId = classGroup4MixDto.getMusicGroupId();
+        MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
+        if (musicGroup != null) {
+            throw new Exception("乐团不存在");
+        }
+        Integer schoolId = musicGroup.getSchoolId();
+
+        List<Integer> subjectIdSet = new ArrayList<>();
+
+        List<Integer> studentIdList = classGroup4MixDto.getStudents();
+        List<StudentRegistration> studentList = studentRegistrationService.findStudentListByUserIdList(musicGroupId, studentIdList);
+        for (StudentRegistration student : studentList) {
+            subjectIdSet.add(student.getSubjectId());
+        }
+        List<Subject> subjectList = subjectService.findBySubjectByIdList(subjectIdSet);
 
+        String subjectIds = "";
+        String subjectNames = "";
+        for (Subject subject : subjectList) {
+            subjectIds += subject.getId() + ",";
+            subjectNames += subject.getName() + "/";
+        }
+
+        subjectIds = subjectIds.substring(0, subjectIds.length() - 1);
+        subjectNames = subjectNames.substring(0, subjectNames.length() - 1);
+
+
+        //1、新建班级
+        ClassGroup classGroup = new ClassGroup();
+        classGroup.setMusicGroupId(classGroup4MixDto.getMusicGroupId());
+        classGroup.setSubjectIdList(subjectIds);
+        classGroup.setName(classGroup4MixDto.getClassGroupName());
+        classGroup.setExpectStudentNum(studentList.size());
+        classGroup.setStudentNum(studentList.size());
+        classGroup.setType(ClassGroupTypeEnum.SNAP);
+        classGroup.setDelFlag(YesOrNoEnum.NO);
+        classGroup.setCreateTime(date);
+        classGroup.setUpdateTime(date);
+        classGroupDao.insert(classGroup);
+
+
+        //2、将学生加入新班级,关联表
+        List<ClassGroupStudentMapper> classGroupStudentMapperList = new ArrayList<>();
+        for (StudentRegistration studentRegistration : studentList) {
+            ClassGroupStudentMapper classGroupStudentMapper = new ClassGroupStudentMapper();
+            classGroupStudentMapper.setClassGroupId(classGroup.getId());
+            classGroupStudentMapper.setUserId(studentRegistration.getUserId());
+            classGroupStudentMapper.setCreateTime(date);
+            classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
+
+            classGroupStudentMapperList.add(classGroupStudentMapper);
+        }
+        classGroupStudentMapperDao.classGroupStudentsInsert(classGroupStudentMapperList);
+
+        //3、将老师加入关联关系
+        List<ClassGroupTeacherMapper> classGroupTeacherMapperList = classGroup4MixDto.getClassGroupTeacherMapperList();
+
+        //课时长度
+        long classCourseDuration = Duration.between(LocalDateTime.parse(classGroup4MixDto.getStartDate() + " " + classGroup4MixDto.getStartClassTime() + ":00"),
+                LocalDateTime.parse(classGroup4MixDto.getStartDate() + " " + classGroup4MixDto.getEndClassTime() + ":00"))
+                .toMinutes();
+
+        for (ClassGroupTeacherMapper classGroupTeacherMapper : classGroupTeacherMapperList) {
+            classGroupTeacherMapper.setClassGroupId(classGroup.getId());
+            classGroupTeacherMapper.setMusicGroupId(classGroup4MixDto.getMusicGroupId());
+
+            List<TeacherDefaultMusicGroupSalary> teacherSalaryList = teacherDefaultMusicGroupSalaryService.getTeacherSalaryByUserIdAndType(classGroupTeacherMapper.getUserId(), "SINGLE", musicGroup.getSettlementType());
+            BigDecimal salary = new BigDecimal("0");
+            for (TeacherDefaultMusicGroupSalary teacherDefaultMusicGroupSalary : teacherSalaryList) {
+                //对应基准课酬
+                BigDecimal baseSalary = classGroupTeacherMapper.getTeacherRole().equals(TeachTypeEnum.BISHOP) ? teacherDefaultMusicGroupSalary.getMainTeacherSalary() : teacherDefaultMusicGroupSalary.getAssistantTeacherSalary();
+                //基准课酬
+                if (teacherDefaultMusicGroupSalary.getSettlementType().equals(SalarySettlementTypeEnum.TEACHER_DEFAULT)) {
+                    salary = new BigDecimal(classCourseDuration).divide(new BigDecimal(30)).multiply(baseSalary).setScale(2, BigDecimal.ROUND_HALF_UP);
+                    break;
+                }
+                //阶梯课酬
+                if (classCourseDuration >= teacherDefaultMusicGroupSalary.getDurationMin() && classCourseDuration <= teacherDefaultMusicGroupSalary.getDurationMin()) {
+                    salary = baseSalary;
+                    break;
+                }
+            }
+            classGroupTeacherMapper.setSalary(salary);
+        }
+        classGroupTeacherMapperDao.classGroupTeachersInsert(classGroupTeacherMapperList);
+
+        //5、插入班级排课信息
+        LocalDateTime now = LocalDate.parse(classGroup4MixDto.getStartDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd")).atStartOfDay();
+
+        //计算每节课的课酬
+        List<CourseScheduleTeacherSalary> courseScheduleTeacherSalaryList = new ArrayList<>();
+        List<CourseScheduleStudentPayment> courseScheduleStudentPaymentList = new ArrayList<>();
+        BigDecimal expectPrice = new BigDecimal("0");
         int times = 0;
         while (true) {
             int dayOfWeek = now.getDayOfWeek().getValue();
-            if (classGroupAdjustDto.getDayOfWeek().equals(dayOfWeek)) {
+            if (classGroup4MixDto.getDayOfWeek().equals(dayOfWeek)) {
                 Instant instant = now.atZone(ZoneId.systemDefault()).toInstant();
                 Date classDate = Date.from(instant);
-                String startClassTime = DateUtil.getDate(classDate) + " " + classGroupAdjustDto.getStartClassTime() + ":00";
-                String endClassTime = DateUtil.getDate(classDate) + " " + classGroupAdjustDto.getEndClassTime() + ":00";
+                String startClassTime = DateUtil.getDate(classDate) + " " + classGroup4MixDto.getStartClassTime() + ":00";
+                String endClassTime = DateUtil.getDate(classDate) + " " + classGroup4MixDto.getEndClassTime() + ":00";
 
                 CourseSchedule courseSchedule = new CourseSchedule();
                 courseSchedule.setSchoolId(schoolId);
@@ -830,7 +1214,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                 courseSchedule.setUpdateTime(date);
                 courseSchedule.setTeachMode(TeachModeEnum.OFFLINE);
                 courseSchedule.setType(CourseSchedule.CourseScheduleType.SINGLE);
-                courseSchedule.setName(subjectNameList + "-" + CourseSchedule.CourseScheduleType.SINGLE.getMsg());
+                courseSchedule.setName(subjectNames + "-" + CourseSchedule.CourseScheduleType.SINGLE.getMsg());
 
                 courseScheduleDao.insert(courseSchedule);
 
@@ -847,14 +1231,35 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                     courseScheduleTeacherSalary.setUpdateTime(date);
                     courseScheduleTeacherSalaryList.add(courseScheduleTeacherSalary);
                 }
+                for (StudentRegistration studentRegistration : studentList) {
+                    CourseScheduleStudentPayment courseScheduleStudentPayment = new CourseScheduleStudentPayment();
+                    courseScheduleStudentPayment.setCourseScheduleId(courseSchedule.getId());
+                    courseScheduleStudentPayment.setUserId(studentRegistration.getUserId());
+                    courseScheduleStudentPayment.setExpectPrice(expectPrice);
+                    courseScheduleStudentPayment.setCreateTime(date);
+                    courseScheduleStudentPayment.setUpdateTime(date);
+                    courseScheduleStudentPayment.setClassGroupId(classGroup.getId());
+                    courseScheduleStudentPaymentList.add(courseScheduleStudentPayment);
+                }
 
             }
             now = now.plusDays(1);
-            if (classGroupAdjustDto.getCourseTimes().equals(times)) {
+            if (classGroup4MixDto.getCourseTimes().equals(times)) {
                 break;
             }
         }
+        //加入合奏班
+        ClassGroupRelation classGroupRelation = new ClassGroupRelation();
+        classGroupRelation.setClassGroupId(classGroup4MixDto.getMixClassGroupId());
+        classGroupRelation.setSubClassGroupId(classGroup.getId());
+        classGroupRelation.setCreateTime(date);
+        classGroupRelationService.insert(classGroupRelation);
+
+        //老师结算表
         courseScheduleTeacherSalaryDao.batchInsert(courseScheduleTeacherSalaryList);
+
+        //学生结算表
+        courseScheduleStudentPaymentDao.batchInsert(courseScheduleStudentPaymentList);
         return classGroup;
     }
 
@@ -872,14 +1277,14 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             Set<Integer> classGroups = dataList.stream().map(e -> e.getClassGroupId()).collect(Collectors.toSet());
             String join = StringUtils.join(classGroups, ",");
             //获取主教老师
-            Map<Integer,String> masterTeachers = MapUtil.convertMybatisMap(classGroupDao.countStudentNum(join, "BISHOP"));
+            Map<Integer, String> masterTeachers = MapUtil.convertMybatisMap(classGroupDao.countStudentNum(join, "BISHOP"));
             //获取助教老师
-            Map<Integer,String> subTeachers = MapUtil.convertMybatisMap(classGroupDao.countStudentNum(join, "TEACHING"));
+            Map<Integer, String> subTeachers = MapUtil.convertMybatisMap(classGroupDao.countStudentNum(join, "TEACHING"));
             //获取在读人数
-            Map<Integer,String> studyNums = MapUtil.convertMybatisMap(classGroupDao.countStudyNum(join));
+            Map<Integer, String> studyNums = MapUtil.convertMybatisMap(classGroupDao.countStudyNum(join));
             //获取退班人数
-            Map<Integer,String> quitNums = MapUtil.convertMybatisMap(classGroupDao.countQuitNum(join));
-            dataList.forEach(e->{
+            Map<Integer, String> quitNums = MapUtil.convertMybatisMap(classGroupDao.countQuitNum(join));
+            dataList.forEach(e -> {
                 e.setMasterTeacher(masterTeachers.get(e.getClassGroupId()));
                 e.setSubTeacher(subTeachers.get(e.getClassGroupId()));
                 e.setStudyNum(studyNums.get(e.getClassGroupId()));
@@ -910,7 +1315,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             //所有课程编号的列表
             List<Integer> couseScheduleIds = dataList.stream().map(MusicGroupCourseScheduleDto::getCourseScheduleId).distinct().collect(Collectors.toList());
             //获取合奏班名称
-            Map<Integer,String> classGroupNames = MapUtil.convertMybatisMap(classGroupDao.findNameById(mixClassGroupIdsStr));
+            Map<Integer, String> classGroupNames = MapUtil.convertMybatisMap(classGroupDao.findNameById(mixClassGroupIdsStr));
 
             //主教老师
             List<CourseScheduleTeacherSalary> bishopTeachers = courseScheduleTeacherSalaryDao.findByCourseScheduleIdsAndTeacherRole(couseScheduleIds, "BISHOP");
@@ -918,23 +1323,23 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 
             //助教老师
             List<CourseScheduleTeacherSalary> teachingTeachers = courseScheduleTeacherSalaryDao.findByCourseScheduleIdsAndTeacherRole(couseScheduleIds, "TEACHING");
-            Map<Long, List<CourseScheduleTeacherSalary>> courseScheduleTeachingTeacherMaps=teachingTeachers.stream().collect(Collectors.groupingBy(CourseScheduleTeacherSalary::getCourseScheduleId));
+            Map<Long, List<CourseScheduleTeacherSalary>> courseScheduleTeachingTeacherMaps = teachingTeachers.stream().collect(Collectors.groupingBy(CourseScheduleTeacherSalary::getCourseScheduleId));
 
-            dataList.forEach(e->{
+            dataList.forEach(e -> {
                 e.setMixClassGroupName(classGroupNames.get(e.getMixClassGroupId()));
                 CourseScheduleTeacherSalary currentBishopTeacher = courseScheduleBishopTeacherMaps.get(e.getCourseScheduleId().longValue());
-                if(!Objects.isNull(currentBishopTeacher)){
+                if (!Objects.isNull(currentBishopTeacher)) {
                     e.setMasterTeacherId(currentBishopTeacher.getUserId());
                     e.setMasterTeacherName(currentBishopTeacher.getUserName());
                     e.setTeacherNum(1);
                 }
 
                 List<CourseScheduleTeacherSalary> currentCourseTeachingTeachers = courseScheduleTeachingTeacherMaps.get(e.getCourseScheduleId().longValue());
-                if(CollectionUtils.isEmpty(currentCourseTeachingTeachers)){
+                if (CollectionUtils.isEmpty(currentCourseTeachingTeachers)) {
                     e.setTeachingTeachers(new ArrayList<>());
-                }else{
+                } else {
                     e.setTeachingTeachers(currentCourseTeachingTeachers);
-                    e.setTeacherNum(e.getTeacherNum()==null?0:e.getTeacherNum() + currentCourseTeachingTeachers.size());
+                    e.setTeacherNum(e.getTeacherNum() == null ? 0 : e.getTeacherNum() + currentCourseTeachingTeachers.size());
                 }
 
             });
@@ -946,9 +1351,9 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         return pageInfo;
     }
 
-	@Override
-	public boolean batchIncreaseClassTimes(List<Integer> classGroupList) {
-		classGroupDao.batchIncreaseClassTimes(classGroupList);
-		return true;
-	}
+    @Override
+    public boolean batchIncreaseClassTimes(List<Integer> classGroupList) {
+        classGroupDao.batchIncreaseClassTimes(classGroupList);
+        return true;
+    }
 }

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -601,6 +601,11 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
     }
 
     @Override
+    public List<MusicGroup> queryListByIds(Set<String> musicGroupIds) {
+        return musicGroupDao.queryListByIds(musicGroupIds);
+    }
+
+    @Override
     public List<CourseScheduleTeachersDto> queryTeacherSalary(Integer courseScheduleId) {
         return courseScheduleTeacherSalaryDao.queryTeacherSalary(courseScheduleId);
     }

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

@@ -384,7 +384,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             //学生报名表
             studentRegistrationDao.insert(studentRegistration);
             if (studentRegistration.getClassGroupId() != null) {
-                ClassGroup classGroup = classGroupDao.get(Integer.parseInt(studentRegistration.getClassGroupId()));
+                ClassGroup classGroup = classGroupDao.get(studentRegistration.getClassGroupId());
                 if (classGroup != null) {
                     if (classGroup.getMusicGroupId().equals(studentRegistration.getMusicGroupId())) {
                         throw new Exception("班级录入错误");
@@ -398,7 +398,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                     throw new Exception("班级不存在");
                 }
                 //新增班级学生关系
-                classGroupStudentMapperDao.insert(new ClassGroupStudentMapper(Integer.parseInt(studentRegistration.getClassGroupId()), userId));
+                classGroupStudentMapperDao.insert(new ClassGroupStudentMapper(studentRegistration.getClassGroupId(), userId));
                 //乐团学生费用表
                 MusicGroupSubjectPlan musicOneSubjectClassPlan = musicGroupSubjectPlanDao.getMusicOneSubjectClassPlan(studentRegistration.getMusicGroupId(), studentRegistration.getActualSubjectId());
                 //获取当前月
@@ -488,4 +488,9 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     public List<StudentRegistration> findMusicGroupStudent(String musicGroupId, Integer actualSubjectId) {
         return studentRegistrationDao.findMusicGroupStudent(musicGroupId,actualSubjectId);
     }
+
+    @Override
+    public List<StudentRegistration> findStudentListByUserIdList(String musicGroupId, List<Integer> userIdList) {
+        return studentRegistrationDao.findStudentListByUserIdList(musicGroupId,userIdList);
+    }
 }

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SubjectServiceImpl.java

@@ -160,4 +160,9 @@ public class SubjectServiceImpl extends BaseServiceImpl<Integer, Subject>  imple
     public List<Subject> findSubSubjects() {
         return subjectDao.findSubSubjects();
     }
+
+    @Override
+    public List<Subject> findBySubjectByIdList(List<Integer> subjectIdList) {
+        return subjectDao.findBySubjectByIdList(subjectIdList);
+    }
 }

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

@@ -355,4 +355,12 @@
             #{item.remark},now(),now(),#{item.parentsName},#{item.parentsCompany},#{item.paymentStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{item.subjectId},#{item.musicGroupStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler})
         </foreach>
     </insert>
+
+    <!-- 查询乐团userIdList的学生 -->
+    <select id="findStudentListByUserIdList" resultMap="StudentRegistration">
+        SELECT * FROM student_registration WHERE music_group_id_ = #{musicGroupId} AND user_id_ IN
+        <foreach collection="userIdList" item="userId" index="index" open="(" close=")" separator=",">
+            #{userId}
+        </foreach>
+    </select>
 </mapper>

+ 7 - 0
mec-biz/src/main/resources/config/mybatis/SubjectMapper.xml

@@ -147,4 +147,11 @@
             </if>
         </where>
     </sql>
+
+    <select id="findBySubjectByIdList" resultMap="Subject">
+        SELECT * FROM `subject` WHERE id_ IN
+        <foreach collection="subjectIdList" item="subjectId" open="(" close=")" separator=",">
+            #{subjectId}
+        </foreach>
+    </select>
 </mapper>

+ 8 - 7
mec-web/src/main/java/com/ym/mec/web/controller/ClassGroupController.java

@@ -1,5 +1,6 @@
 package com.ym.mec.web.controller;
 
+import com.ym.mec.biz.dal.dto.ClassGroup4MixDto;
 import com.ym.mec.biz.dal.dto.ClassGroupAdjustDto;
 import com.ym.mec.biz.dal.dto.HighClassGroupDto;
 import com.ym.mec.biz.dal.entity.ClassGroup;
@@ -203,17 +204,17 @@ public class ClassGroupController extends BaseController {
     @ApiOperation(value = "调整班级(添加班级)")
     @PostMapping("/revisionAddClassGroup")
     @PreAuthorize("@pcs.hasPermissions('classGroup/revisionAddClassGroup')")
-    @ApiImplicitParams({@ApiImplicitParam(name = "classGroupIds", value = "班级编号,号分割", required = true, dataType = "String")})
-    public HttpResponseResult revisionAddClassGroup(@RequestBody ClassGroupAdjustDto classGroupAdjustDto) throws Exception {
-        return succeed(classGroupService.classGroupAdjust(classGroupAdjustDto));
+    @ApiImplicitParams({@ApiImplicitParam(name = "ClassGroup4MixDto", value = "添加班级结构", required = true, dataType = "String")})
+    public HttpResponseResult revisionAddClassGroup(@RequestBody ClassGroup4MixDto classGroup4MixDto) throws Exception {
+        return succeed(classGroupService.classGroupAdjust(classGroup4MixDto));
     }
 
     @ApiOperation(value = "调整班级(临时调整)")
     @PostMapping("/revisionClassGroup")
-    @PreAuthorize("@pcs.hasPermissions('classGroup/revisionClassGroup')")
-    @ApiImplicitParams({@ApiImplicitParam(name = "classGroupIds", value = "班级编号,号分割", required = true, dataType = "String")})
-    public HttpResponseResult revisionClassGroup(@RequestBody ClassGroupAdjustDto classGroupAdjustDto) throws Exception {
-        return succeed(classGroupService.classGroupAdjust(classGroupAdjustDto));
+    @PreAuthorize("@pcs.hasPermissions('classGroup/classGroupSnap')")
+    @ApiImplicitParams({@ApiImplicitParam(name = "classGroupIds", value = "添加班级结构", required = true, dataType = "String")})
+    public HttpResponseResult revisionClassGroup(@RequestBody ClassGroup4MixDto classGroup4MixDto) throws Exception {
+        return succeed(classGroupService.classGroupSnap(classGroup4MixDto));
     }
 
 }

+ 0 - 5
mec-web/src/main/java/com/ym/mec/web/controller/ClassGroupStudentController.java

@@ -1,9 +1,5 @@
 package com.ym.mec.web.controller;
 
-
-import com.ym.mec.biz.dal.entity.ClassGroup;
-import com.ym.mec.biz.dal.entity.ClassGroupStudentMapper;
-import com.ym.mec.biz.dal.enums.ClassGroupStudentStatusEnum;
 import com.ym.mec.biz.service.ClassGroupStudentMapperService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
@@ -12,7 +8,6 @@ import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 

+ 13 - 0
mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupController.java

@@ -13,6 +13,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.Set;
+
 @RequestMapping("musicGroup")
 @Api(tags = "乐团服务")
 @RestController
@@ -65,4 +67,15 @@ public class MusicGroupController extends BaseController {
         }
         return succeed(musicGroupService.createGroup(subFeeSettingDto,sysUser.getId()));
     }
+
+    @ApiOperation(value = "根据乐团ids获取乐团列表")
+    @PostMapping("/queryListByIds")
+    @PreAuthorize("@pcs.hasPermissions('musicGroup/queryListByIds')")
+    public Object queryListByIds(@RequestBody Set<String> musicGroupIds){
+        if(musicGroupIds.isEmpty()){
+            return failed("参数校验失败");
+        }
+        return succeed(musicGroupService.queryListByIds(musicGroupIds));
+    }
+
 }