Browse Source

增加调整班级增加临时班级接口

周箭河 5 years ago
parent
commit
8ea1ad0965

+ 12 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/ClassGroup4MixDto.java

@@ -7,11 +7,14 @@ 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 classGroupId;
+    private Integer mixClassGroupId;
 
     @ApiModelProperty(value = "班级名称", required = true)
     private String classGroupName;
@@ -116,4 +119,12 @@ public class ClassGroup4MixDto {
     public void setCourseTimes(Integer courseTimes) {
         this.courseTimes = courseTimes;
     }
+
+    public Integer getMixClassGroupId() {
+        return mixClassGroupId;
+    }
+
+    public void setMixClassGroupId(Integer mixClassGroupId) {
+        this.mixClassGroupId = mixClassGroupId;
+    }
 }

+ 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;
 

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

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

+ 253 - 41
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java

@@ -876,13 +876,13 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 
         //加入合奏班
         ClassGroupRelation classGroupRelation = new ClassGroupRelation();
-        classGroupRelation.setClassGroupId(classGroup4MixDto.getClassGroupId());
+        classGroupRelation.setClassGroupId(classGroup4MixDto.getMixClassGroupId());
         classGroupRelation.setSubClassGroupId(classGroup.getId());
         classGroupRelation.setCreateTime(date);
         classGroupRelationService.insert(classGroupRelation);
 
         //6、添加学生未上合奏课课程
-        List<CourseSchedule> noStartCourses = courseScheduleDao.findNoStartCoursesByClassGroupId(classGroup4MixDto.getClassGroupId());
+        List<CourseSchedule> noStartCourses = courseScheduleDao.findNoStartCoursesByClassGroupId(classGroup4MixDto.getMixClassGroupId());
         for (CourseSchedule noStartCourse : noStartCourses) {
             for (StudentRegistration studentRegistration : studentList) {
                 CourseScheduleStudentPayment courseScheduleStudentPayment = new CourseScheduleStudentPayment();
@@ -900,67 +900,84 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         return classGroup;
     }
 
-    public ClassGroup classGroupAdjustB(ClassGroupAdjustDto classGroupAdjustDto) throws Exception {
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public ClassGroup classGroupUpdate(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("乐团不存在");
         }
+        ClassGroup classgroup = classGroupDao.get(classGroup4MixDto.getClassGroupId());
+        if(classgroup == 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);
-            }
-            subjectIdList += classGroupStudentMapperDto.actualSubjectId() + ",";
-            subjectNameList += classGroupStudentMapperDto.getSubjectName() + "/";
+        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() + "/";
+        }
 
-        subjectIdList = subjectIdList.substring(0, subjectIdList.length() - 1);
+        subjectIds = subjectIds.substring(0, subjectIds.length() - 1);
+        subjectNames = subjectNames.substring(0, subjectNames.length() - 1);
 
-        //2、新建班级
+
+        //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");
@@ -983,19 +1000,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);
@@ -1008,7 +1206,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);
 
@@ -1025,14 +1223,28 @@ 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;
             }
         }
+        //老师结算表
         courseScheduleTeacherSalaryDao.batchInsert(courseScheduleTeacherSalaryList);
+
+        //学生结算表
+        courseScheduleStudentPaymentDao.batchInsert(courseScheduleStudentPaymentList);
         return classGroup;
     }
 

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

@@ -211,11 +211,10 @@ public class ClassGroupController extends BaseController {
 
     @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));
-        return null;
+    @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));
     }
 
 }