浏览代码

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

yonge 5 年之前
父节点
当前提交
b00975bb5c

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ClassGroupStudentMapper.java

@@ -53,6 +53,13 @@ public class ClassGroupStudentMapper {
 		this.status = ClassGroupStudentStatusEnum.NORMAL;
 	}
 
+	public ClassGroupStudentMapper(String musicGroupId, Integer userId,GroupType groupType) {
+		this.musicGroupId = musicGroupId;
+		this.userId = userId;
+		this.groupType = groupType;
+		this.status = ClassGroupStudentStatusEnum.NORMAL;
+	}
+
 	public ClassGroupStudentMapper(String musicGroupId, int classGroupId, Integer userId, ClassGroupStudentStatusEnum status) {
 		this.musicGroupId = musicGroupId;
 		this.classGroupId = classGroupId;

+ 3 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/ClassGroupStudentMapperService.java

@@ -3,6 +3,7 @@ package com.ym.mec.biz.service;
 import com.ym.mec.biz.dal.entity.ClassGroupStudentMapper;
 import com.ym.mec.biz.dal.entity.StudentRegistration;
 import com.ym.mec.biz.dal.enums.ClassGroupStudentStatusEnum;
+import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
 import com.ym.mec.biz.dal.enums.GroupType;
 import com.ym.mec.common.service.BaseService;
 
@@ -60,4 +61,6 @@ public interface ClassGroupStudentMapperService extends BaseService<Long, ClassG
      * @return
      */
     Object queryHoliday(String year) throws IOException;
+
+    List<ClassGroupStudentMapper> findMusicGroupClassGroupByType(String musicGroupId, ClassGroupTypeEnum type);
 }

+ 11 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java

@@ -701,6 +701,13 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         //删除班级跟合奏班关系
         classGroupRelationDao.deleteBySubClassId(classGroupId);
         //删除班级未开始课程
+        List<CourseSchedule> courseScheduleList = courseScheduleService.findNoStartCoursesByClassGroupId(classGroupId);
+        if (courseScheduleList.size() > 0) {
+            List<Long> courseScheduleIds = courseScheduleList.stream().map(courseSchedule -> courseSchedule.getId()).collect(Collectors.toList());
+            courseScheduleTeacherSalaryDao.batchDeleteByCourseScheduleIds(courseScheduleIds);
+            teacherAttendanceDao.batchDeleteByCourseSchedules(courseScheduleIds);
+            courseScheduleStudentPaymentDao.deleteByCourseSchedule(courseScheduleIds);
+        }
 
         //删除班级
         classGroupDao.delete(classGroupId);
@@ -1542,14 +1549,14 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             //获取助教老师
             Map<Integer, String> subTeachers = JSONObject.parseObject(JSONObject.toJSONString(MapUtil.convertMybatisMap(classGroupDao.countStudentNum(join, "TEACHING"))), HashMap.class);
             //获取在读人数
-            Map<Integer, Integer> studyNums = JSONObject.parseObject(JSONObject.toJSONString(MapUtil.convertIntegerMap(classGroupDao.countStudyNum(join))), HashMap.class);
+            Map<String, Integer> studyNums = JSONObject.parseObject(JSONObject.toJSONString(MapUtil.convertIntegerMap(classGroupDao.countStudyNum(join))), HashMap.class);
             //获取退班人数
-            Map<Integer, Integer> quitNums = JSONObject.parseObject(JSONObject.toJSONString(MapUtil.convertIntegerMap(classGroupDao.countQuitNum(join))), HashMap.class);
+            Map<String, Integer> quitNums = JSONObject.parseObject(JSONObject.toJSONString(MapUtil.convertIntegerMap(classGroupDao.countQuitNum(join))), HashMap.class);
             dataList.forEach(e -> {
                 e.setMasterTeacher(masterTeachers.get(e.getClassGroupId()));
                 e.setSubTeacher(subTeachers.get(e.getClassGroupId()));
-                e.setStudyNum(studyNums.get(e.getClassGroupId()));
-                e.setQuitNum(quitNums.get(e.getClassGroupId()));
+                e.setStudyNum(studyNums.get(e.getClassGroupId().toString()));
+                e.setQuitNum(quitNums.get(e.getClassGroupId().toString()));
             });
         }
         if (count == 0) {

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

@@ -245,4 +245,9 @@ public class ClassGroupStudentMapperServiceImpl extends BaseServiceImpl<Long, Cl
     public Object queryHoliday(String year) throws IOException {
         return HttpUtil.get(holidayUrl + year,null);
     }
+
+    @Override
+    public List<ClassGroupStudentMapper> findMusicGroupClassGroupByType(String musicGroupId, ClassGroupTypeEnum type) {
+        return classGroupStudentMapperDao.findMusicGroupClassGroupByType(musicGroupId,type);
+    }
 }

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

@@ -54,9 +54,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     @Autowired
     private MusicGroupStudentFeeDao musicGroupStudentFeeDao;
     @Autowired
-    private ClassGroupStudentMapperDao classGroupStudentMapperDao;
-    @Autowired
-    private ClassGroupRelationDao classGroupRelationDao;
+    private ClassGroupStudentMapperService classGroupStudentMapperDao;
     @Autowired
     private SysMessageService sysMessageService;
     @Autowired
@@ -497,10 +495,14 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                     throw new Exception("班级不存在");
                 }
                 //新增班级学生关系(单技班)
-                classGroupStudentMapperDao.insert(new ClassGroupStudentMapper(classGroupId, userId));
+//                ClassGroupStudentMapper classGroupStudentMapper = new ClassGroupStudentMapper(musicGroupId,userId,GroupType.MUSIC);
+//                classGroupStudentMapper.setClassGroupId(classGroupId);
+//                classGroupStudentMapperDao.insert(classGroupStudentMapper);
                 //新增班级学生关系(合奏班)
-                ClassGroupRelation classGroupRelation = classGroupRelationDao.findClassGroupRelation(classGroupId);
-                classGroupStudentMapperDao.insert(new ClassGroupStudentMapper(classGroupRelation.getClassGroupId(), userId));
+//                ClassGroupRelation classGroupRelation = classGroupRelationDao.findClassGroupRelation(classGroupId);
+//                classGroupStudentMapper.setClassGroupId(classGroupRelation.getClassGroupId());
+//                classGroupStudentMapperDao.insert(classGroupStudentMapper);
+                classGroupStudentMapperDao.addStudents(classGroupId,userId.toString(),GroupType.MUSIC);
                 Date date = new Date();
                 //获取当前月
                 Integer month = Integer.parseInt(DateUtil.getMonth(date));
@@ -606,7 +608,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 waitPayOrder.setStatus(DealStatusEnum.CLOSE);
                 studentPaymentOrderService.update(waitPayOrder);
                 //添加学生
-                classGroupStudentMapperService.addStudents(waitPayOrder.getClassGroupId(), studentRegistration.getUserId().toString(), GroupType.MUSIC);
+                //classGroupStudentMapperService.addStudents(waitPayOrder.getClassGroupId(), studentRegistration.getUserId().toString(), GroupType.MUSIC);
             } else {
                 //获取当前月
                 Integer month = Integer.parseInt(DateUtil.getMonth(nowDate));

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

@@ -522,14 +522,14 @@
 
     <select id="countStudyNum" resultType="java.util.Map">
         SELECT cgsm.class_group_id_ 'key',COUNT(cgsm.user_id_) 'value' FROM class_group_student_mapper cgsm
-        LEFT JOIN student_registration sr ON (sr.user_id_ = cgsm.user_id_ AND sr.music_group_id_ = cgsm.music_group_id_)
-        WHERE FIND_IN_SET(cgsm.class_group_id_,#{classGroupIds}) AND cgsm.status_ != 'QUIT' AND sr.music_group_status_ != 'QUIT' GROUP BY cgsm.class_group_id_
+        WHERE FIND_IN_SET(cgsm.class_group_id_,#{classGroupIds}) AND cgsm.status_ != 'QUIT'
+        GROUP BY cgsm.class_group_id_
     </select>
 
     <select id="countQuitNum" resultType="java.util.Map">
-        SELECT sr.class_group_id_ 'key',COUNT(sr.user_id_) 'value' FROM student_registration sr
-        WHERE FIND_IN_SET(sr.class_group_id_,#{classGroupIds}) AND sr.music_group_status_ = 'QUIT'
-        GROUP BY sr.class_group_id_
+        SELECT cgsm.class_group_id_ 'key',COUNT(cgsm.user_id_) 'value' FROM class_group_student_mapper cgsm
+        WHERE FIND_IN_SET(cgsm.class_group_id_,#{classGroupIds}) AND cgsm.status_ = 'QUIT'
+        GROUP BY cgsm.class_group_id_
     </select>
 
     <sql id="queryMusicGroupCourseScheduleSql">