瀏覽代碼

增加班级调整接口

周箭河 5 年之前
父節點
當前提交
e817e2933e

+ 69 - 65
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ClassGroupStudentMapperDao.java

@@ -11,77 +11,81 @@ import java.util.Map;
 
 public interface ClassGroupStudentMapperDao extends BaseDAO<Long, ClassGroupStudentMapper> {
 
-	/**
-	 * 批量插入学生
-	 * @param classGroupStudentMapperList
-	 * @return
-	 */
-	int classGroupStudentsInsert(@Param("classGroupStudentMapperList") List<ClassGroupStudentMapper> classGroupStudentMapperList);
+    /**
+     * 批量插入学生
+     *
+     * @param classGroupStudentMapperList
+     * @return
+     */
+    int classGroupStudentsInsert(@Param("classGroupStudentMapperList") List<ClassGroupStudentMapper> classGroupStudentMapperList);
 
-	/**
-	 * 根据班级和学生编号查询
-	 * @param classGroupId
-	 * @param userId
-	 * @return
-	 */
-	ClassGroupStudentMapper query(@Param("classGroupId") int classGroupId, @Param("userId") Integer userId);
+    /**
+     * 根据班级和学生编号查询
+     *
+     * @param classGroupId
+     * @param userId
+     * @return
+     */
+    ClassGroupStudentMapper query(@Param("classGroupId") int classGroupId, @Param("userId") Integer userId);
 
-	/**
-	 * 根据乐团编号删除指定学生
-	 * @param musicGroupId 乐团编号
-	 * @param userId 学生编号
-	 * @return
-	 */
-	int deleteStudentByMusicGroupId(@Param("musicGroupId") String musicGroupId, @Param("userId") Integer userId);
+    /**
+     * 根据乐团编号删除指定学生
+     *
+     * @param musicGroupId 乐团编号
+     * @param userId       学生编号
+     * @return
+     */
+    int deleteStudentByMusicGroupId(@Param("musicGroupId") String musicGroupId, @Param("userId") Integer userId);
 
-	/**
-	 * 根据班级编号删除关联
-	 * @param classGroupId
-	 */
-	void deleteByClassId(Integer classGroupId);
+    /**
+     * 根据班级编号删除关联
+     *
+     * @param classGroupId
+     */
+    void deleteByClassId(Integer classGroupId);
 
-	/**
-	 * @Author: Joburgess
-	 * @Date: 2019/10/17
-	 * @params [classGroupId, userId]
-	 * @return int
-	 * @describe 删除班级上的指定学生
-	 */
-	int deleteStudentByClassGroupId(@Param("classGroupId") Long classGroupId,@Param("userId") Long userId);
+    /**
+     * @return int
+     * @Author: Joburgess
+     * @Date: 2019/10/17
+     * @params [classGroupId, userId]
+     * @describe 删除班级上的指定学生
+     */
+    int deleteStudentByClassGroupId(@Param("classGroupId") Long classGroupId, @Param("userId") Long userId);
 
-	/**
-	 * @describe 根据班级编号获取班级学生名称列表
-	 * @author Joburgess
-	 * @date 2019/10/18
-	 * @param classGroupId: 班级编号
-	 * @return java.lang.String[]
-	 */
-	String[] findStudentNumByClassGroupId(@Param("classGroupId") Long classGroupId);
+    /**
+     * @param classGroupId: 班级编号
+     * @return java.lang.String[]
+     * @describe 根据班级编号获取班级学生名称列表
+     * @author Joburgess
+     * @date 2019/10/18
+     */
+    String[] findStudentNumByClassGroupId(@Param("classGroupId") Long classGroupId);
 
-	/**
-	 * @describe 获取班级学生
-	 * @author Joburgess
-	 * @date 2019/10/18
-	 * @param params:
-	 * @return java.util.List<com.ym.mec.biz.dal.dto.TeacherClassStudentDto>
-	 */
-	List<TeacherClassStudentDto> findClassStudent(Map<String,Object> params);
+    /**
+     * @param params:
+     * @return java.util.List<com.ym.mec.biz.dal.dto.TeacherClassStudentDto>
+     * @describe 获取班级学生
+     * @author Joburgess
+     * @date 2019/10/18
+     */
+    List<TeacherClassStudentDto> findClassStudent(Map<String, Object> params);
 
-	/**
-	 * @describe 统计班级学生数量
-	 * @author Joburgess
-	 * @date 2019/10/18
-	 * @param params:
-	 * @return int
-	 */
-	int findClassStudentNum(Map<String,Object> params);
+    /**
+     * @param params:
+     * @return int
+     * @describe 统计班级学生数量
+     * @author Joburgess
+     * @date 2019/10/18
+     */
+    int findClassStudentNum(Map<String, Object> params);
 
-	/**
-	 * @describe 获取点名列表
-	 * @author Joburgess
-	 * @date 2019/10/19
-	 * @param courseScheduleId: 课程编号
-	 * @return java.util.List<com.ym.mec.biz.dal.entity.StudentAttendance>
-	 */
-	List<StudentAttendanceViewDto> findStudentByCourse(Long courseScheduleId);
+    /**
+     * @param courseScheduleId: 课程编号
+     * @return java.util.List<com.ym.mec.biz.dal.entity.StudentAttendance>
+     * @describe 获取点名列表
+     * @author Joburgess
+     * @date 2019/10/19
+     */
+    List<StudentAttendanceViewDto> findStudentByCourse(Long courseScheduleId);
 }

+ 92 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/ClassGroupAdjustDto.java

@@ -0,0 +1,92 @@
+package com.ym.mec.biz.dal.dto;
+
+import com.ym.mec.biz.dal.entity.ClassGroupStudentMapper;
+import com.ym.mec.biz.dal.entity.ClassGroupTeacherMapper;
+import com.ym.mec.biz.dal.enums.YesOrNoEnum;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * 班级调整
+ */
+public class ClassGroupAdjustDto {
+
+    @ApiModelProperty(value = "乐团id", required = true)
+    private String musicGroupId;
+
+    @ApiModelProperty(value = "班级名称", required = true)
+    private String classGroupName;
+
+    @ApiModelProperty(value = "学生-班级", required = true)
+    private List<ClassGroupStudentMapperDto> classGroupStudentMapperDtoList;
+
+    @ApiModelProperty(value = "老师设置", required = true)
+    private List<ClassGroupTeacherMapper> classGroupTeacherMapperList;
+
+    @ApiModelProperty(value = "是否永久 方式1-永久 0-临时", required = true)
+    private YesOrNoEnum type;
+
+    @ApiModelProperty(value = "开始时间", required = true)
+    private LocalDateTime startDate;
+
+    @ApiModelProperty(value = "结束时间", required = true)
+    private LocalDateTime endDate;
+
+    public String getClassGroupName() {
+        return classGroupName;
+    }
+
+    public void setClassGroupName(String classGroupName) {
+        this.classGroupName = classGroupName;
+    }
+
+    public YesOrNoEnum getType() {
+        return type;
+    }
+
+    public void setType(YesOrNoEnum type) {
+        this.type = type;
+    }
+
+    public LocalDateTime getStartDate() {
+        return startDate;
+    }
+
+    public void setStartDate(LocalDateTime startDate) {
+        this.startDate = startDate;
+    }
+
+    public LocalDateTime getEndDate() {
+        return endDate;
+    }
+
+    public void setEndDate(LocalDateTime endDate) {
+        this.endDate = endDate;
+    }
+
+    public List<ClassGroupTeacherMapper> getClassGroupTeacherMapperList() {
+        return classGroupTeacherMapperList;
+    }
+
+    public void setClassGroupTeacherMapperList(List<ClassGroupTeacherMapper> classGroupTeacherMapperList) {
+        this.classGroupTeacherMapperList = classGroupTeacherMapperList;
+    }
+
+    public List<ClassGroupStudentMapperDto> getClassGroupStudentMapperDtoList() {
+        return classGroupStudentMapperDtoList;
+    }
+
+    public void setClassGroupStudentMapperDtoList(List<ClassGroupStudentMapperDto> classGroupStudentMapperDtoList) {
+        this.classGroupStudentMapperDtoList = classGroupStudentMapperDtoList;
+    }
+
+    public String getMusicGroupId() {
+        return musicGroupId;
+    }
+
+    public void setMusicGroupId(String musicGroupId) {
+        this.musicGroupId = musicGroupId;
+    }
+}

+ 17 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/ClassGroupStudentMapperDto.java

@@ -0,0 +1,17 @@
+package com.ym.mec.biz.dal.dto;
+
+import com.ym.mec.biz.dal.entity.ClassGroupStudentMapper;
+import io.swagger.annotations.ApiModelProperty;
+
+public class ClassGroupStudentMapperDto extends ClassGroupStudentMapper {
+    @ApiModelProperty(value = "科目编号",required = true)
+    private Integer actual_subject_id_;
+
+    public Integer getActual_subject_id_() {
+        return actual_subject_id_;
+    }
+
+    public void setActual_subject_id_(Integer actual_subject_id_) {
+        this.actual_subject_id_ = actual_subject_id_;
+    }
+}

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

@@ -78,8 +78,8 @@ public class StudentRegistration {
     @ApiModelProperty(value = "用户所在乐团状态)",required = false)
     private ClassGroupStudentStatusEnum musicGroupStatus;
 
-    @ApiModelProperty(value = "班级id", hidden = true)
-    private Integer classGroupId;
+    @ApiModelProperty(value = "班级ids", hidden = true)
+    private String classGroupId;
 
     @ApiModelProperty(value = "零时课程费用", hidden = true)
     private BigDecimal temporaryCourseFee;
@@ -228,11 +228,11 @@ public class StudentRegistration {
         return paymentStatus;
     }
 
-    public Integer getClassGroupId() {
+    public String getClassGroupId() {
         return classGroupId;
     }
 
-    public void setClassGroupId(Integer classGroupId) {
+    public void setClassGroupId(String classGroupId) {
         this.classGroupId = classGroupId;
     }
 

+ 20 - 20
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/ClassGroupStudentStatusEnum.java

@@ -6,31 +6,31 @@ import com.ym.mec.common.enums.BaseEnum;
  * 班级类型(普通班级、合奏班级)
  */
 public enum ClassGroupStudentStatusEnum implements BaseEnum<String, ClassGroupStudentStatusEnum> {
-	NORMAL("NORMAL", "在读"), LEAVE("LEAVE", "请假"), QUIT("QUIT", "退团");
+    NORMAL("NORMAL", "在读"), LEAVE("LEAVE", "请假"), QUIT("QUIT", "退班");
 
-	private String code;
+    private String code;
 
-	private String msg;
+    private String msg;
 
-	ClassGroupStudentStatusEnum(String code, String msg) {
-		this.code = code;
-		this.msg = msg;
-	}
+    ClassGroupStudentStatusEnum(String code, String msg) {
+        this.code = code;
+        this.msg = msg;
+    }
 
-	public void setCode(String code) {
-		this.code = code;
-	}
+    public void setCode(String code) {
+        this.code = code;
+    }
 
-	public String getMsg() {
-		return msg;
-	}
+    public String getMsg() {
+        return msg;
+    }
 
-	public void setMsg(String msg) {
-		this.msg = msg;
-	}
+    public void setMsg(String msg) {
+        this.msg = msg;
+    }
 
-	@Override
-	public String getCode() {
-		return this.code;
-	}
+    @Override
+    public String getCode() {
+        return this.code;
+    }
 }

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/ClassGroupService.java

@@ -237,4 +237,11 @@ public interface ClassGroupService extends BaseService<Integer, ClassGroup> {
      * @return java.util.List<com.ym.mec.biz.dal.dto.StudentAttendanceViewDto>
      */
     List<StudentAttendanceViewDto> findAttendanceStudentByCourse(Long courseScheduleId);
+
+    /**
+     * 班级调整
+     * @param classGroupAdjustDto
+     * @return
+     */
+    ClassGroup classGroupAdjust(ClassGroupAdjustDto classGroupAdjustDto) throws Exception;
 }

+ 115 - 63
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java

@@ -131,7 +131,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
             classGroupStudentList.add(classGroupStudentMapper);
             StudentRegistration studentRegistration = new StudentRegistration();
-            studentRegistration.setClassGroupId(classGroup.getId());
+            studentRegistration.setClassGroupId(classGroup.getId().toString());
             studentRegistration.setUserId(Integer.getInteger(userId));
             studentRegistration.setMusicGroupId(classGroup.getMusicGroupId());
             studentRegistrationDao.updateByUserIdAndMusicGroupId(studentRegistration);
@@ -187,18 +187,18 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
     @Override
     @Transactional(rollbackFor = Exception.class)
     public List<HighClassGroupDto> addHighClassGroup(List<HighClassGroupDto> highClassGroupList) throws Exception {
-    	
-    	Integer schoolId = null;
-    	
+
+        Integer schoolId = null;
+
         for (HighClassGroupDto highClassGroup : highClassGroupList) {
-        	
-			if (schoolId == null) {
-				MusicGroup musicGroup = musicGroupDao.get(highClassGroup.getMusicGroupId());
-				if (musicGroup != null) {
-					schoolId = musicGroup.getSchoolId();
-				}
-			}
-        	
+
+            if (schoolId == null) {
+                MusicGroup musicGroup = musicGroupDao.get(highClassGroup.getMusicGroupId());
+                if (musicGroup != null) {
+                    schoolId = musicGroup.getSchoolId();
+                }
+            }
+
             //1、插入班级信息
             Date date;
             date = new Date();
@@ -266,11 +266,11 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             pageInfo.setTotal(count);
             params.put("offset", pageInfo.getOffset());
             dataList = classGroupDao.queryGroupCourses(params);
-            HashMap<String,Object> param = new HashMap<>();
-            param.put("teacherId",queryInfo.getSearch());
-            param.put("attendanceStatus",YesOrNoEnum.YES);
-            dataList.forEach(e->{
-                param.put("musicGroupId",e.getMusicGroupId());
+            HashMap<String, Object> param = new HashMap<>();
+            param.put("teacherId", queryInfo.getSearch());
+            param.put("attendanceStatus", YesOrNoEnum.YES);
+            dataList.forEach(e -> {
+                param.put("musicGroupId", e.getMusicGroupId());
                 e.setAttendanceNum(teacherAttendanceDao.getTeacherPersonalAttendancesCount(param));
             });
         }
@@ -293,17 +293,17 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             params.put("offset", pageInfo.getOffset());
             dataList = vipGroupDao.getTeacherVipClass(params);
             Set<Integer> activityIds = dataList.stream().map(e -> e.getActivityId()).collect(Collectors.toSet());
-            List<Map<Integer,String>> names = vipGroupActivityDao.queryNamesById(StringUtils.join(activityIds,","));
-            Map<Integer,String> nameMap = MapUtil.convertMybatisMap(names);
+            List<Map<Integer, String>> names = vipGroupActivityDao.queryNamesById(StringUtils.join(activityIds, ","));
+            Map<Integer, String> nameMap = MapUtil.convertMybatisMap(names);
             //计算月度平均消耗值(已上课时 / 消耗月份)
             Date date = new Date();
-            dataList.forEach(e->{
+            dataList.forEach(e -> {
                 e.setActivityName(nameMap.get(e.getActivityId()));
                 int days = DateUtil.daysBetween(e.getPaymentExpireDate(), date);
-                if(days <= 0){
+                if (days <= 0) {
                     e.setMonthAvg(0f);
-                }else {
-                    e.setMonthAvg(e.getCurrentClassTimes()/(days/30));
+                } else {
+                    e.setMonthAvg(e.getCurrentClassTimes() / (days / 30));
                 }
             });
 
@@ -316,8 +316,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
     }
 
     @Override
-    public List<ClassGroupTeachersDto> getClassGroupAndTeachers(String musicGroupId,String type) {
-        List<ClassGroupTeachersDto> classGroupAndTeachersList = classGroupDao.findClassGroupByMusicGroupId(musicGroupId,type);
+    public List<ClassGroupTeachersDto> getClassGroupAndTeachers(String musicGroupId, String type) {
+        List<ClassGroupTeachersDto> classGroupAndTeachersList = classGroupDao.findClassGroupByMusicGroupId(musicGroupId, type);
 
         List<ClassGroupTeacherMapper> classGroupTeacherMapperList = classGroupTeacherMapperService.findClassGroupTeachers(classGroupAndTeachersList);
 
@@ -336,7 +336,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
     @Override
     public List<ClassGroupTeachersDto> getClassGroupAndTeacherSalary(String musicGroupId, SalarySettlementTypeEnum type) throws Exception {
         //乐团班级及班级老师
-        List<ClassGroupTeachersDto> classGroupAndTeachers = getClassGroupAndTeachers(musicGroupId,"NORMAL,MIX,HIGH");
+        List<ClassGroupTeachersDto> classGroupAndTeachers = getClassGroupAndTeachers(musicGroupId, "NORMAL,MIX,HIGH");
 
         for (ClassGroupTeachersDto classGroupAndTeacher : classGroupAndTeachers) {
             //班级的教师列表
@@ -346,7 +346,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                 String courseType = classGroupAndTeacher.getType().equals(ClassGroupTypeEnum.NORMAL) ? "SINGLE" : classGroupAndTeacher.getType().getCode();
                 List<TeacherDefaultMusicGroupSalary> teacherSalaryByUserIdAndType = teacherDefaultMusicGroupSalaryService.getTeacherSalaryByUserIdAndType(classGroupTeacherMapper.getUserId(), courseType, type);
                 if (teacherSalaryByUserIdAndType == null) {
-                    throw new Exception("userId:"+classGroupTeacherMapper.getUserId()+"名字:"+classGroupTeacherMapper.getUserName()+" 老师没有设置课酬");
+                    throw new Exception("userId:" + classGroupTeacherMapper.getUserId() + "名字:" + classGroupTeacherMapper.getUserName() + " 老师没有设置课酬");
                 }
                 classGroupTeacherMapper.setTeacherDefaultMusicGroupSalaryList(teacherSalaryByUserIdAndType);
             }
@@ -368,19 +368,19 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             params.put("offset", pageInfo.getOffset());
             courseListDtos = classGroupDao.queryCoursePage(params);
             courseListDtos.forEach(e -> {
-                if (ClassGroupTypeEnum.VIP==e.getType()) {
+                if (ClassGroupTypeEnum.VIP == e.getType()) {
                     //获取vip课的学生名称列表
                     List<String> vipStuNames = classGroupDao.findVipStuNames(e.getMusicGroupId());
                     if (vipStuNames != null && vipStuNames.size() > 0) {
                         e.setStudentNames(StringUtils.join(vipStuNames, ","));
                     }
-                    if(e.getOffLineClassesNum()>0&&e.getOffLineClassesNum()<=0){
+                    if (e.getOffLineClassesNum() > 0 && e.getOffLineClassesNum() <= 0) {
                         e.setClassMode(1);
-                    }else if(e.getOffLineClassesNum()>0&&e.getOffLineClassesNum()>0){
+                    } else if (e.getOffLineClassesNum() > 0 && e.getOffLineClassesNum() > 0) {
                         e.setClassMode(3);
-                    }else if(e.getOnlineClassesNum()<0&&e.getOffLineClassesNum()>=0){
+                    } else if (e.getOnlineClassesNum() < 0 && e.getOffLineClassesNum() >= 0) {
                         e.setClassMode(2);
-                    }else{
+                    } else {
                         e.setClassMode(0);
                     }
                 } else {
@@ -422,7 +422,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
                 teachers.removeAll(Collections.singleton(null));
                 //获取乐团群用户总数
                 BigDecimal count = musicGroupUserNumMap.get(e.getId());
-                e.setCount(count == null?0:count.intValue() + teachers.size());
+                e.setCount(count == null ? 0 : count.intValue() + teachers.size());
                 e.setId("mg" + e.getId());
             });
         } else {
@@ -432,11 +432,11 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         if (imGroupModels1 != null && imGroupModels1.size() > 0) {
             Set<String> classGroupIds = imGroupModels1.stream().map(e -> e.getId()).collect(Collectors.toSet());
             //获取班级老师总数map
-            List<Map<Integer, Integer>> nums = classGroupDao.countTeacherNums(StringUtils.join(classGroupIds,","));
+            List<Map<Integer, Integer>> nums = classGroupDao.countTeacherNums(StringUtils.join(classGroupIds, ","));
             Map<Integer, Integer> numsMap = MapUtil.convertMybatisMap(nums);
             imGroupModels1.forEach(e -> {
                 Integer num = numsMap.get(e.getId());
-                e.setCount(num == null?0:num + e.getCount());
+                e.setCount(num == null ? 0 : num + e.getCount());
                 e.setId("cg" + e.getId());
             });
             imGroupModels.addAll(imGroupModels1);
@@ -513,15 +513,15 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public void addMusicGroupTeam(Integer teacherId, String musicGroupId,Integer improventClassesNum) throws Exception {
+    public void addMusicGroupTeam(Integer teacherId, String musicGroupId, Integer improventClassesNum) throws Exception {
         //所有学员都已经分配
         List<StudentRegistration> students = studentRegistrationDao.getNoClassStuBySubjectId(musicGroupId, null);
-        if(students != null && students.size() > 0){
+        if (students != null && students.size() > 0) {
             throw new Exception("还有学员未分配班级");
         }
         //所有单技班都有合奏班
         List<ClassGroup> classGroupList = classGroupDao.findNoClassSubjects(musicGroupId);
-        if(classGroupList != null && classGroupList.size() > 0){
+        if (classGroupList != null && classGroupList.size() > 0) {
             throw new Exception("还有单技班未分配合奏");
         }
         //设置教学主管
@@ -536,12 +536,12 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
     @Override
     public List<TeacherClassGroupDto> findTeacherClassGroups(String type) {
         SysUser user = sysUserFeignService.queryUserInfo();
-        if(Objects.isNull(user)){
+        if (Objects.isNull(user)) {
             throw new BizException("请登录");
         }
 
         List<TeacherClassGroupDto> teacherMusicClassGroup;
-        switch (type){
+        switch (type) {
             case "VIP":
                 teacherMusicClassGroup = classGroupDao.findTeacherVipClassGroup(user.getId().longValue());
                 break;
@@ -551,7 +551,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             default:
                 throw new BizException("请指定课程类型");
         }
-        if(CollectionUtils.isEmpty(teacherMusicClassGroup)){
+        if (CollectionUtils.isEmpty(teacherMusicClassGroup)) {
             return teacherMusicClassGroup;
         }
 
@@ -564,30 +564,30 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 
         teacherMusicClassGroup.forEach(teacherClassGroupDto -> {
 
-            if(teacherClassGroupDto.getType()==ClassGroupTypeEnum.VIP){
+            if (teacherClassGroupDto.getType() == ClassGroupTypeEnum.VIP) {
                 String[] studentNums = classGroupStudentMapperDao.findStudentNumByClassGroupId(teacherClassGroupDto.getClassGroupId());
-                teacherClassGroupDto.setStudentNames(StringUtils.join(studentNums,","));
-                if(teacherClassGroupDto.getOffLineClassesNum()>0&&teacherClassGroupDto.getOffLineClassesNum()<=0){
+                teacherClassGroupDto.setStudentNames(StringUtils.join(studentNums, ","));
+                if (teacherClassGroupDto.getOffLineClassesNum() > 0 && teacherClassGroupDto.getOffLineClassesNum() <= 0) {
                     teacherClassGroupDto.setClassMode(1);
-                }else if(teacherClassGroupDto.getOffLineClassesNum()>0&&teacherClassGroupDto.getOffLineClassesNum()>0){
+                } else if (teacherClassGroupDto.getOffLineClassesNum() > 0 && teacherClassGroupDto.getOffLineClassesNum() > 0) {
                     teacherClassGroupDto.setClassMode(3);
-                }else if(teacherClassGroupDto.getOnlineClassesNum()<0&&teacherClassGroupDto.getOffLineClassesNum()>=0){
+                } else if (teacherClassGroupDto.getOnlineClassesNum() < 0 && teacherClassGroupDto.getOffLineClassesNum() >= 0) {
                     teacherClassGroupDto.setClassMode(2);
-                }else{
+                } else {
                     teacherClassGroupDto.setClassMode(0);
                 }
             }
-            String subjectIdList=teacherClassGroupDto.getSubjectIdList();
-            if(StringUtils.isNotEmpty(subjectIdList)){
-                if(Objects.nonNull(musicGroupIdAndNum)&&Objects.nonNull(musicGroupIdAndNum.get(teacherClassGroupDto.getMusicGroupId()))){
+            String subjectIdList = teacherClassGroupDto.getSubjectIdList();
+            if (StringUtils.isNotEmpty(subjectIdList)) {
+                if (Objects.nonNull(musicGroupIdAndNum) && Objects.nonNull(musicGroupIdAndNum.get(teacherClassGroupDto.getMusicGroupId()))) {
                     teacherClassGroupDto.setThreeClassNoAttendanceStudentNum(musicGroupIdAndNum.get(teacherClassGroupDto.getMusicGroupId()));
                 }
                 String[] subjectIds = subjectIdList.split(",");
-                List<String> subjectNameList=new ArrayList<>();
+                List<String> subjectNameList = new ArrayList<>();
                 for (String subjectId : subjectIds) {
                     subjectNameList.add(subjectMapBySubjectIdsList.get(Integer.parseInt(subjectId)));
                 }
-                teacherClassGroupDto.setSubjectNames(StringUtils.join(subjectNameList,","));
+                teacherClassGroupDto.setSubjectNames(StringUtils.join(subjectNameList, ","));
             }
         });
 
@@ -597,11 +597,11 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
     @Override
     @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
     public boolean updateClassStudentNum(Long classGroupId, Integer num) {
-        ClassGroup classGroup=classGroupDao.lockClassGroup(classGroupId);
-        if(Objects.isNull(classGroup)){
+        ClassGroup classGroup = classGroupDao.lockClassGroup(classGroupId);
+        if (Objects.isNull(classGroup)) {
             throw new BizException("班级不存在");
         }
-        classGroup.setStudentNum(classGroup.getStudentNum()+num);
+        classGroup.setStudentNum(classGroup.getStudentNum() + num);
         classGroup.setUpdateTime(new Date());
 
         classGroupDao.update(classGroup);
@@ -611,34 +611,34 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 
     @Override
     public TeacherClassHeadInfo findTeacherClassGroupInfo(Long classGroupId) {
-        if(Objects.isNull(classGroupId)){
+        if (Objects.isNull(classGroupId)) {
             throw new BizException("请指定班级");
         }
 
         ClassGroup classGroup = classGroupDao.get(classGroupId.intValue());
 
-        if(Objects.isNull(classGroup)){
+        if (Objects.isNull(classGroup)) {
             throw new BizException("未找到该班级");
         }
 
-        TeacherClassHeadInfo teacherClassHeadInfo=new TeacherClassHeadInfo();
+        TeacherClassHeadInfo teacherClassHeadInfo = new TeacherClassHeadInfo();
         teacherClassHeadInfo.setStudentNum(classGroup.getStudentNum());
         teacherClassHeadInfo.setCurrentClassTimes(classGroup.getCurrentClassTimes());
         teacherClassHeadInfo.setTotalClassTimes(classGroup.getTotalClassTimes());
         ClassGroupTeacherMapper bishopTeacher = classGroupTeacherMapperDao.findByClassGroupAndRole(classGroupId, TeachTypeEnum.BISHOP);
-        if(Objects.nonNull(bishopTeacher)){
+        if (Objects.nonNull(bishopTeacher)) {
             teacherClassHeadInfo.setBishopTeacherId(bishopTeacher.getId());
             teacherClassHeadInfo.setBishopTeacher(bishopTeacher.getUserName());
         }
         ClassGroupTeacherMapper teachingTeacher = classGroupTeacherMapperDao.findByClassGroupAndRole(classGroupId, TeachTypeEnum.TEACHING);
-        if(Objects.nonNull(teachingTeacher)){
+        if (Objects.nonNull(teachingTeacher)) {
             teacherClassHeadInfo.setTeachingTeacherId(teachingTeacher.getId());
             teacherClassHeadInfo.setTeachingTeacher(teachingTeacher.getUserName());
         }
 
-        if(classGroup.getType()==ClassGroupTypeEnum.VIP){
+        if (classGroup.getType() == ClassGroupTypeEnum.VIP) {
             String[] studentNums = classGroupStudentMapperDao.findStudentNumByClassGroupId(classGroupId);
-            teacherClassHeadInfo.setStudentNames(StringUtils.join(studentNums,","));
+            teacherClassHeadInfo.setStudentNames(StringUtils.join(studentNums, ","));
         }
 
         return teacherClassHeadInfo;
@@ -665,9 +665,61 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
 
     @Override
     public List<StudentAttendanceViewDto> findAttendanceStudentByCourse(Long courseScheduleId) {
-        if(Objects.isNull(courseScheduleId)){
+        if (Objects.isNull(courseScheduleId)) {
             throw new BizException("请指定课程编号");
         }
         return classGroupStudentMapperDao.findStudentByCourse(courseScheduleId);
     }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public ClassGroup classGroupAdjust(ClassGroupAdjustDto classGroupAdjustDto) throws Exception {
+        Date date = new Date();
+
+        List<ClassGroupStudentMapperDto> classGroupStudentMapperDtoList = classGroupAdjustDto.getClassGroupStudentMapperDtoList();
+        String subject_id_list_ = "";
+        for (ClassGroupStudentMapper classGroupStudentMapperDto : classGroupStudentMapperDtoList) {
+            //1、永久调整,删除学生班级关联关系
+            if (classGroupAdjustDto.getType().equals(YesOrNoEnum.YES)) {
+                ClassGroupStudentMapper classStudentMapper = classGroupStudentMapperDao.query(classGroupStudentMapperDto.getClassGroupId(), classGroupStudentMapperDto.getUserId());
+                classStudentMapper.setStatus(ClassGroupStudentStatusEnum.QUIT);
+                classGroupStudentMapperDao.update(classStudentMapper);
+            }
+            subject_id_list_ += classGroupStudentMapperDto.getUserId() + ",";
+        }
+
+
+        subject_id_list_ = subject_id_list_.substring(0, subject_id_list_.length() - 1);
+
+        //2、新建班级
+        ClassGroup classGroup = new ClassGroup();
+        classGroup.setMusicGroupId(classGroupAdjustDto.getMusicGroupId());
+        classGroup.setSubjectIdList(subject_id_list_);
+        classGroup.setName(classGroupAdjustDto.getClassGroupName());
+        classGroup.setExpectStudentNum(classGroupStudentMapperDtoList.size());
+        classGroup.setStudentNum(classGroupStudentMapperDtoList.size());
+        classGroup.setType(ClassGroupTypeEnum.NORMAL);
+        classGroup.setDelFlag(YesOrNoEnum.NO);
+        classGroup.setCreateTime(date);
+        classGroup.setUpdateTime(date);
+        classGroupDao.insert(classGroup);
+
+        //3、将学生加入新班级(学生注册表,关联表)
+        List<ClassGroupStudentMapper> classGroupStudentMapperList = new ArrayList<>();
+        for (ClassGroupStudentMapperDto classGroupStudentMapperDto : classGroupStudentMapperDtoList) {
+            classGroupStudentMapperDto.setClassGroupId(classGroup.getId());
+            classGroupStudentMapperList.add(classGroupStudentMapperDto);
+        }
+        classGroupStudentMapperDao.classGroupStudentsInsert(classGroupStudentMapperList);
+
+
+        //4、将老师加入关联关系
+        List<ClassGroupTeacherMapper> classGroupTeacherMapperList = classGroupAdjustDto.getClassGroupTeacherMapperList();
+        for (ClassGroupTeacherMapper classGroupTeacherMapper : classGroupTeacherMapperList) {
+            classGroupTeacherMapper.setClassGroupId(classGroup.getId());
+            classGroupTeacherMapper.setMusicGroupId(classGroupAdjustDto.getMusicGroupId());
+        }
+        classGroupTeacherMapperDao.classGroupTeachersInsert(classGroupTeacherMapperList);
+        return classGroup;
+    }
 }

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

@@ -46,19 +46,10 @@ public class PayServiceImpl implements PayService {
         //支付通道决策
         SysAccount routingAccount = getRoutingAccount(amount);
         HashMap<String, Object> unionPay = new HashMap<>();
-        String type = "YQPAY";
         Map payMap;
-//        if (routingAccount != null) {
-//            //易乾支付
-//            payMap = YqPayUtil.getPayMap(amount, orderNo, notifyUrl, returnUrl, orderSubject, orderBody, routingAccount.getMerNo());
-//        } else {
-//            type = "UNIONPAY";
-//            payMap = UnionPay.getPayMap(amount, orderNo, notifyUrl, returnUrl, orderSubject);
-//        }
-        type = "UNIONPAY";
         payMap = UnionPay.getPayMap(amount, orderNo, notifyUrl, returnUrl, orderSubject);
         unionPay.put("orderNo", orderNo);
-        unionPay.put("type", type);
+        unionPay.put("type", "UNIONPAY");
         unionPay.put("payMap", payMap);
         return unionPay;
     }

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

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

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

@@ -77,7 +77,7 @@
     </insert>
     
     <select id="query" resultMap="ClassGroupStudentMapper" parameterType="map">
-		SELECT * FROM class_group_student_mapper where class_group_id_ = #{classGroupId} and user_id_ = #{userId}
+		SELECT * FROM class_group_student_mapper where class_group_id_ = #{classGroupId} and user_id_ = #{userId} AND status_ IN ('NORMAL','LEAVE')
 	</select>
     <select id="findStudentNumByClassGroupId" resultType="string">
         SELECT

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

@@ -28,8 +28,6 @@
         <result column="parents_company_" property="parentsCompany"/>
         <result column="payment_status_" property="paymentStatus"
                 typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
-        <result column="last_payment_date_" property="lastPaymentDate"/>
-        <result column="next_payment_date_" property="nextPaymentDate"/>
         <result column="music_group_status_" property="musicGroupStatus"/>
     </resultMap>
     
@@ -297,6 +295,6 @@
 
     <!-- 获取班级下的学生 -->
     <select id="findClassGroupStu" resultMap="StudentRegistration">
-        SELECT * FROM student_registration WHERE music_group_id_= #{musicGroupId} AND class_group_id_=#{classGroupId}
+        SELECT * FROM student_registration WHERE music_group_id_= #{musicGroupId} AND FIND_IN_SET(#{classGroupId},class_group_id_)
     </select>
 </mapper>

+ 1 - 1
mec-web/src/main/java/com/ym/mec/web/config/ResourceServerConfig.java

@@ -24,7 +24,7 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
 
 	@Override
 	public void configure(HttpSecurity http) throws Exception {
-		http.csrf().disable().exceptionHandling().accessDeniedHandler(baseAccessDeniedHandler).authenticationEntryPoint(baseAuthenticationEntryPoint).and().authorizeRequests().antMatchers("/v2/api-docs").permitAll().anyRequest().authenticated().and().httpBasic();
+		http.csrf().disable().exceptionHandling().accessDeniedHandler(baseAccessDeniedHandler).authenticationEntryPoint(baseAuthenticationEntryPoint).and().authorizeRequests().antMatchers("/v2/api-docs","/classGroup/revisionClassGroup").permitAll().anyRequest().authenticated().and().httpBasic();
 	}
 
 	@Override

+ 11 - 12
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.ClassGroupAdjustDto;
 import com.ym.mec.biz.dal.dto.HighClassGroupDto;
 import com.ym.mec.biz.dal.entity.ClassGroup;
 import com.ym.mec.biz.dal.entity.ClassGroupTeacherMapper;
@@ -93,7 +94,7 @@ public class ClassGroupController extends BaseController {
     @GetMapping("/findClassGroupAboutMix")
     @PreAuthorize("@pcs.hasPermissions('classGroup/findClassGroupAboutMix')")
     public HttpResponseResult findClassGroupAboutMix(@ApiParam(value = "乐团编号", required = true) @RequestParam String musicGroupId,
-                                         @ApiParam(value = "班级编号", required = false) Integer mixClassGroupId) {
+                                                     @ApiParam(value = "班级编号", required = false) Integer mixClassGroupId) {
         return succeed(classGroupService.findClassGroup(musicGroupId, mixClassGroupId));
     }
 
@@ -140,7 +141,7 @@ public class ClassGroupController extends BaseController {
     @GetMapping("/findMusicGroupClassTeacher")
     @PreAuthorize("@pcs.hasPermissions('classGroup/findMusicGroupClassTeacher')")
     public HttpResponseResult findMusicGroupClassTeacher(@ApiParam(value = "乐团编号", required = true) @RequestParam String musicGroupId) {
-        return succeed(classGroupService.getClassGroupAndTeachers(musicGroupId,"NORMAL,MIX"));
+        return succeed(classGroupService.getClassGroupAndTeachers(musicGroupId, "NORMAL,MIX"));
     }
 
     @ApiOperation(value = "获取乐团班级老师课酬")
@@ -182,23 +183,21 @@ public class ClassGroupController extends BaseController {
     @PreAuthorize("@pcs.hasPermissions('classGroup/addMusicGroupTeam')")
     @ApiImplicitParams({@ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "String"),
             @ApiImplicitParam(name = "teacherId", value = "老师编号", required = true, dataType = "Integer")})
-    public Object addMusicGroupTeam(Integer teacherId,String musicGroupId,Integer improventClassesNum) throws Exception {
-        if(teacherId == null || StringUtils.isEmpty(musicGroupId) || improventClassesNum == null){
+    public Object addMusicGroupTeam(Integer teacherId, String musicGroupId, Integer improventClassesNum) throws Exception {
+        if (teacherId == null || StringUtils.isEmpty(musicGroupId) || improventClassesNum == null) {
             return failed("参数校验错误");
         }
-        classGroupService.addMusicGroupTeam(teacherId,musicGroupId,improventClassesNum);
+        classGroupService.addMusicGroupTeam(teacherId, musicGroupId, improventClassesNum);
         return succeed();
     }
 
 
-    @ApiOperation(value = "合并班级")
-    @PostMapping("/mergeClassGroup")
-    @PreAuthorize("@pcs.hasPermissions('classGroup/mergeClassGroup')")
+    @ApiOperation(value = "调整班级")
+    @PostMapping("/revisionClassGroup")
+    @PreAuthorize("@pcs.hasPermissions('classGroup/revisionClassGroup')")
     @ApiImplicitParams({@ApiImplicitParam(name = "classGroupIds", value = "班级编号,号分割", required = true, dataType = "String")})
-    public HttpResponseResult mergeClassGroup(String classGroupIds) throws Exception {
-        //软删除班级
-
-        return succeed();
+    public HttpResponseResult revisionClassGroup(@RequestBody ClassGroupAdjustDto classGroupAdjustDto) throws Exception {
+        return succeed(classGroupService.classGroupAdjust(classGroupAdjustDto));
     }
 
 }