Browse Source

首页新增 新增人数占比

zouxuan 3 years ago
parent
commit
ac6b67e464

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentRegistrationDao.java

@@ -683,4 +683,6 @@ public interface StudentRegistrationDao extends BaseDAO<Long, StudentRegistratio
     List<String> findMusicGroupIds();
 
     List<Integer> findStudentIds();
+
+    List<Integer> findNoCourseStudentIds();
 }

+ 14 - 8
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServiceImpl.java

@@ -548,13 +548,16 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
         List<String> musicGroupIds = studentRegistrationDao.findMusicGroupIds();
         List<Integer> studentIdList = studentRegistrationDao.findStudentIds();
         List<BaseMapDto<Integer, Long>> studentMusicCourseNum = studentDao.getOrganCloudNewStudentNum(musicGroupIds,studentIdList);
-        Map<String, Long> organsNewCloudNewStudentNumMap = new HashMap<>();
+        //获取有乐团没排课的数据
+        List<Integer> noCourseStudentIdList = studentRegistrationDao.findNoCourseStudentIds();
+        List<Integer> userIdList = new ArrayList<>();
         if(!CollectionUtils.isEmpty(studentMusicCourseNum)){
             List<BaseMapDto<Integer, Long>> collect = studentMusicCourseNum.stream().filter(e -> e.getValue() < 5).collect(Collectors.toList());
-            List<Integer> userIdList = collect.stream().map(e -> e.getKey()).collect(Collectors.toList());
-            List<Map<Long, Long>> organsNewCloudNewStudentNumMapList = studentDao.groupOrganId(organIds,userIdList);
-            organsNewCloudNewStudentNumMap = MapUtil.convertIntegerMap(organsNewCloudNewStudentNumMapList);
+            userIdList = collect.stream().map(e -> e.getKey()).collect(Collectors.toList());
         }
+        userIdList.addAll(noCourseStudentIdList);
+        List<Map<Long, Long>> organsNewCloudNewStudentNumMapList = studentDao.groupOrganId(organIds,userIdList);
+        Map<String, Long> organsNewCloudNewStudentNumMap = MapUtil.convertIntegerMap(organsNewCloudNewStudentNumMapList);
 
         List<EduOrganStudentDataDto> result = new ArrayList<>();
 
@@ -647,13 +650,16 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
         List<String> musicGroupIds = studentRegistrationDao.findMusicGroupIds();
         List<Integer> studentIdList = studentRegistrationDao.findStudentIds();
         List<BaseMapDto<Integer, Long>> studentMusicCourseNum = studentDao.getOrganCloudNewStudentNum(musicGroupIds,studentIdList);
-        Map<String, Long> organsNewCloudNewStudentNumMap = new HashMap<>();
+        //获取有乐团没排课的数据
+        List<Integer> noCourseStudentIdList = studentRegistrationDao.findNoCourseStudentIds();
+        List<Integer> userIdList = new ArrayList<>();
         if(!CollectionUtils.isEmpty(studentMusicCourseNum)){
             List<BaseMapDto<Integer, Long>> collect = studentMusicCourseNum.stream().filter(e -> e.getValue() < 5).collect(Collectors.toList());
-            List<Integer> userIdList = collect.stream().map(e -> e.getKey()).collect(Collectors.toList());
-            List<Map<Long, Long>> organsNewCloudNewStudentNumMapList = studentDao.groupOrganId(organIds,userIdList);
-            organsNewCloudNewStudentNumMap = MapUtil.convertIntegerMap(organsNewCloudNewStudentNumMapList);
+            userIdList = collect.stream().map(e -> e.getKey()).collect(Collectors.toList());
         }
+        userIdList.addAll(noCourseStudentIdList);
+        List<Map<Long, Long>> organsNewCloudNewStudentNumMapList = studentDao.groupOrganId(organIds,userIdList);
+        Map<String, Long> organsNewCloudNewStudentNumMap = MapUtil.convertIntegerMap(organsNewCloudNewStudentNumMapList);
 
         List<EduOrganStudentDataDto> result = new ArrayList<>();
 

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

@@ -1191,7 +1191,7 @@
     </select>
     <select id="getOrganCloudNewStudentNum" resultType="com.ym.mec.biz.dal.dto.BaseMapDto">
         SELECT cssp.`user_id_` 'key',count(cs.`id_`) 'value' FROM `course_schedule_student_payment` cssp
-        STRAIGHT_JOIN `course_schedule` cs on cssp.`course_schedule_id_` = cs.`id_`
+        LEFT JOIN `course_schedule` cs on cssp.`course_schedule_id_` = cs.`id_`
         WHERE cs.`status_` = 'OVER' AND cs.`group_type_` = 'MUSIC' AND cs.`del_flag_` = 0
         <if test="musicGroupIds != null and musicGroupIds.size() > 0">
             AND cs.music_group_id_ IN

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

@@ -1697,4 +1697,11 @@
         LEFT JOIN music_group mg ON sr.music_group_id_ = mg.id_
         WHERE sr.music_group_status_ = 'NORMAL' AND mg.status_ = 'PROGRESS'
     </select>
+    <select id="findNoCourseStudentIds" resultType="java.lang.Integer">
+        SELECT DISTINCT sr.user_id_ FROM student_registration sr
+                                             LEFT JOIN sys_user su ON su.id_ = sr.user_id_
+                                             LEFT JOIN organization o ON o.id_ = su.organ_id_
+        WHERE sr.music_group_id_ IN (SELECT mg.id_ FROM music_group mg
+                                     WHERE mg.id_ NOT IN (SELECT DISTINCT music_group_id_ FROM course_schedule WHERE group_type_ = 'MUSIC') AND mg.status_ = 'PROGRESS') AND sr.music_group_status_ = 'NORMAL'
+    </select>
 </mapper>