zouxuan пре 5 година
родитељ
комит
9304acdd75

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

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

@@ -1562,14 +1562,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);
+    }
 }

+ 8 - 6
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));

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

@@ -527,9 +527,9 @@
     </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">