zouxuan 5 tahun lalu
induk
melakukan
35e38c26eb

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentManageDao.java

@@ -206,7 +206,7 @@ public interface StudentManageDao {
      * 获取未激活,有课的列表
      * @return
      */
-    List<StudentHasCourseDto> queryHasCourseStudent(@Param("organId") String organId);
+    List<StudentManageListDto> queryHasCourseStudent(Map<String, Object> params);
 
     /**
      * 当前用户是否有课

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

@@ -137,7 +137,7 @@ public interface StudentManageService {
      * 获取有课没有激活的列表(变更为所有有课学生)
      * @return
      */
-    List<StudentHasCourseDto> queryHasCourseStudent(String organId);
+    List<StudentManageListDto> queryHasCourseStudent(StudentManageQueryInfo queryInfo);
 
     /**
      * 课表列表签到详情统计接口

+ 11 - 9
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentManageServiceImpl.java

@@ -104,13 +104,13 @@ public class StudentManageServiceImpl implements StudentManageService {
             pageInfo.setTotal(count);
             dataList = studentManageDao.findStudentsByOrganId(params);
             Set<Integer> userIds = dataList.stream().map(StudentManageListDto::getUserId).collect(Collectors.toSet());
-            Set<Integer> organIds = dataList.stream().map(StudentManageListDto::getOrganId).collect(Collectors.toSet());
+//            Set<Integer> organIds = dataList.stream().map(StudentManageListDto::getOrganId).collect(Collectors.toSet());
             List<SysUserCashAccount> byUserIds = sysUserCashAccountDao.findByUserIds(userIds);
             Map<Integer, SysUserCashAccount> collect = byUserIds.stream()
                     .collect(Collectors.toMap(SysUserCashAccount::getUserId, sysUserCashAccount -> sysUserCashAccount));
             Map<Integer,Integer> hasPracticeCourseMap = MapUtil.convertIntegerMap(studentManageDao.getHasPracticeCourse(userIds));
             //获取用户分部
-            Map<Integer,String> organNames = MapUtil.convertMybatisMap(organizationDao.findOrganNameMapList(organIds));
+            /*Map<Integer,String> organNames = MapUtil.convertMybatisMap(organizationDao.findOrganNameMapList(organIds));
             //获取所在乐团
             Map<Integer,String> musicGroupNames = MapUtil.convertMybatisMap(musicGroupDao.queryUserMusicNames(userIds));
             //获取所在vip
@@ -120,9 +120,9 @@ public class StudentManageServiceImpl implements StudentManageService {
             //获取所在vip状态
             Map<Integer,String> vipGroupStatus = MapUtil.convertMybatisMap(vipGroupDao.queryUserVipStatus(userIds));
             //获取所在声部
-            Map<Integer,String> subjectNames = MapUtil.convertMybatisMap(studentManageDao.querySubjectNames(userIds));
+            Map<Integer,String> subjectNames = MapUtil.convertMybatisMap(studentManageDao.querySubjectNames(userIds));*/
             dataList.forEach(e -> {
-                e.setOrganName(organNames.get(e.getOrganId()));
+                /*e.setOrganName(organNames.get(e.getOrganId()));
                 e.setMusicGroupName(musicGroupNames.get(e.getUserId()));
                 e.setVipGroupName(vipGroupNames.get(e.getUserId()));
                 e.setSubjectName(subjectNames.get(e.getUserId()));
@@ -139,7 +139,7 @@ public class StudentManageServiceImpl implements StudentManageService {
                     for (int i = 0;i < split.length;i++){
                         e.setVipGroupStatus(ClassGroupStudentStatusEnum.valueOf(split[i]).getMsg()+" ");
                     }
-                }
+                }*/
                 if(hasCourse == null){
                     Integer course = studentManageDao.getHasCourse(e.getUserId());
                     e.setHasCourse(course==null?YesOrNoEnum.NO:course==0?YesOrNoEnum.NO:YesOrNoEnum.YES);
@@ -414,9 +414,11 @@ public class StudentManageServiceImpl implements StudentManageService {
     }
 
     @Override
-    public List<StudentHasCourseDto> queryHasCourseStudent(String organId) {
-        List<StudentHasCourseDto> studentHasCourseDtos = studentManageDao.queryHasCourseStudent(organId);
-        Set<Integer> userIds = studentHasCourseDtos.stream().map(e -> e.getUserId()).collect(Collectors.toSet());
+    public List<StudentManageListDto> queryHasCourseStudent(StudentManageQueryInfo queryInfo) {
+        Map<String, Object> params = new HashMap<>();
+        MapUtil.populateMap(params, queryInfo);
+        List<StudentManageListDto> studentHasCourseDtos = studentManageDao.queryHasCourseStudent(params);
+        /*Set<Integer> userIds = studentHasCourseDtos.stream().map(e -> e.getUserId()).collect(Collectors.toSet());
         Map<Integer,Integer> hasPracticeCourseMap = MapUtil.convertIntegerMap(studentManageDao.getHasPracticeCourse(userIds));
         Map<Integer,Integer> isActiveMap = MapUtil.convertIntegerMap(studentManageDao.getIsActive(userIds));
         Map<Integer,Integer> isMakeMap = MapUtil.convertIntegerMap(studentManageDao.getIsMake(userIds));
@@ -424,7 +426,7 @@ public class StudentManageServiceImpl implements StudentManageService {
             e.setHasPracticeCourse(hasPracticeCourseMap.get(e.getUserId()) == null?YesOrNoEnum.NO:YesOrNoEnum.YES);
             e.setIsActive(isActiveMap.get(e.getUserId()) == null?YesOrNoEnum.YES:YesOrNoEnum.NO);
             e.setIsMake(isMakeMap.get(e.getUserId()) == null?YesOrNoEnum.NO:YesOrNoEnum.YES);
-        });
+        });*/
         return studentHasCourseDtos;
     }
 

+ 72 - 22
mec-biz/src/main/resources/config/mybatis/StudentManageDao.xml

@@ -2,22 +2,6 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
 <mapper namespace="com.ym.mec.biz.dal.dao.StudentManageDao">
 
-    <resultMap id="studentManageListDto" type="com.ym.mec.biz.dal.dto.StudentManageListDto">
-        <result property="userId" column="user_id_"/>
-        <result property="realName" column="real_name_"/>
-        <result property="nation" column="nation_"/>
-        <result property="organId" column="organ_id_"/>
-        <result property="parentsPhone" column="parents_phone_"/>
-        <result property="parentsName" column="real_name_"/>
-        <result property="gender" column="gender_" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
-        <result property="username" column="username_"/>
-        <result property="birthdate" column="birthdate_"/>
-        <result property="currentGrade" column="current_grade_"/>
-        <result property="currentClass" column="current_class_"/>
-        <result property="isActive" column="isActive_" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
-        <result property="isMake" column="isMake_" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
-        <!--<collection property="musicGroups" resultMap="musicGroup" javaType="list"/>-->
-    </resultMap>
 
     <resultMap id="studentManageCourseListDto" type="com.ym.mec.biz.dal.dto.StudentManageCourseListDto">
         <result property="classGroupId" column="class_group_id_" />
@@ -702,9 +686,47 @@
             #{item}
         </foreach>
     </select>
-    <select id="queryHasCourseStudent" resultMap="StudentHasCourseDtoMap">
-        SELECT su.id_,GROUP_CONCAT(DISTINCT su.username_) username_,GROUP_CONCAT(DISTINCT mg.name_) music_group_name_,
-        GROUP_CONCAT(DISTINCT vg.name_) vip_group_name_,GROUP_CONCAT(DISTINCT o.name_) organ_name_,GROUP_CONCAT(DISTINCT s.name_) music_group_subject_
+    <resultMap id="studentManageListDto" type="com.ym.mec.biz.dal.dto.StudentManageListDto">
+        <result property="userId" column="user_id_"/>
+        <result property="realName" column="real_name_"/>
+        <result property="nation" column="nation_"/>
+        <result property="parentsPhone" column="parents_phone_"/>
+        <result property="parentsName" column="real_name_"/>
+        <result property="gender" column="gender_" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+        <result property="username" column="username_"/>
+        <result property="birthdate" column="birthdate_"/>
+        <result property="currentGrade" column="current_grade_"/>
+        <result property="currentClass" column="current_class_"/>
+        <result property="isActive" column="isActive_" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+        <result property="isMake" column="isMake_" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+        <result property="hasCourse" column="hasCourse_" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+        <result property="hasPracticeCourse" column="hasPracticeCourse_" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+        <result property="musicGroupName" column="music_group_name_"/>
+        <result property="musicGroupStatus" column="music_group_status_"/>
+        <result property="vipGroupName" column="vip_group_name_"/>
+        <result property="vipGroupStatus" column="vip_group_status_"/>
+        <result property="organName" column="organ_name_"/>
+        <result property="subjectName" column="music_group_subject_"/>
+    </resultMap>
+    <select id="queryHasCourseStudent" resultMap="studentManageListDto">
+        SELECT su.id_ user_id_,su.username_,su.gender_,GROUP_CONCAT(DISTINCT sr.parents_name_)parents_name_,
+        GROUP_CONCAT(DISTINCT sr.parents_phone_)parents_phone_,
+        GROUP_CONCAT(DISTINCT mg.name_) music_group_name_,
+        GROUP_CONCAT(DISTINCT CASE WHEN sr.music_group_status_ = 'NORMAL' THEN '在读'
+        WHEN sr.music_group_status_ = 'LEAVE' THEN '请假'
+        WHEN sr.music_group_status_ = 'QUIT' THEN '退班'
+        WHEN sr.music_group_status_ = 'QUIT_SCHOOL' THEN '休学' ELSE NULL END) music_group_status_,
+        GROUP_CONCAT(DISTINCT vg.name_) vip_group_name_,
+        GROUP_CONCAT(DISTINCT CASE WHEN cgsm.status_ = 'NORMAL' THEN '在读'
+        WHEN cgsm.status_ = 'LEAVE' THEN '请假'
+        WHEN cgsm.status_ = 'QUIT' THEN '退班'
+        WHEN cgsm.status_ = 'QUIT_SCHOOL' THEN '休学' ELSE NULL END) vip_group_status_,
+        GROUP_CONCAT(DISTINCT o.name_) organ_name_,
+        GROUP_CONCAT(s.name_) music_group_subject_,
+        CASE WHEN GROUP_CONCAT(DISTINCT cssp.id_) IS NULL THEN 0 ELSE 1 END hasCourse_,
+        CASE WHEN GROUP_CONCAT(DISTINCT pla.id_) IS NULL THEN 0 ELSE 1 END isMake_,
+        CASE WHEN su.password_ IS NULL THEN 0 ELSE 1 END isActive_,
+        CASE WHEN GROUP_CONCAT(DISTINCT cssp1.id_) IS NULL THEN 0 ELSE 1 END hasPracticeCourse_
         FROM sys_user su
         LEFT JOIN course_schedule_student_payment cssp ON su.id_ = cssp.user_id_
         LEFT JOIN music_group mg ON cssp.music_group_id_ = mg.id_ AND cssp.group_type_ = 'MUSIC'
@@ -712,12 +734,40 @@
         LEFT JOIN organization o ON su.organ_id_ = o.id_
         LEFT JOIN student_registration sr ON su.id_ = sr.user_id_ AND cssp.music_group_id_ = sr.music_group_id_
         LEFT JOIN `subject` s ON s.id_ = sr.actual_subject_id_
-        WHERE cssp.id_ IS NOT NULL AND su.user_type_ LIKE '%STUDENT%'
-        AND (sr.music_group_status_ != 'QUIT' OR sr.id_ IS NULL)
-        AND (mg.status_ = 'PROGRESS' OR vg.group_status_ IN (2,4))
+        LEFT JOIN practice_lesson_apply pla on pla.user_id_ = su.id_
+        LEFT JOIN course_schedule_student_payment cssp1 ON su.id_ = cssp1.user_id_ AND cssp1.group_type_ = 'PRACTICE'
+        LEFT JOIN class_group_student_mapper cgsm ON su.id_ = cgsm.user_id_ AND cgsm.group_type_ = 'VIP'
+        WHERE su.user_type_ LIKE '%STUDENT%'
+        <if test="hasPracticeCourse != null and hasPracticeCourse == true">
+            AND cssp1.id_ IS NOT NULL
+        </if>
+        <if test="hasPracticeCourse != null and hasPracticeCourse == false">
+            AND cssp1.id_ IS NULL
+        </if>
+        <if test="hasCourse != null and hasCourse == true">
+            AND cssp.id_ IS NOT NULL
+        </if>
+        <if test="hasCourse != null and hasCourse == false">
+            AND cssp.id_ IS NULL
+        </if>
+        <if test="isActive != null and isActive == true">
+            AND su.password_ IS NOT NULL
+        </if>
+        <if test="isActive != null and isActive == false">
+            AND su.password_ IS NULL
+        </if>
         <if test="organId != null and organId != ''">
             AND FIND_IN_SET(su.organ_id_,#{organId})
         </if>
+        <if test="search != null and search != ''">
+            AND (su.phone_ LIKE CONCAT('%',#{search},'%') OR su.username_ LIKE CONCAT('%',#{search},'%') OR su.id_ LIKE CONCAT('%',#{search},'%'))
+        </if>
+        <if test="isMake != null and isMake == true">
+            AND pla.id_ IS NOT NULL
+        </if>
+        <if test="isMake != null and isMake == false">
+            AND pla.id_ IS NULL
+        </if>
         GROUP BY su.id_
     </select>
     <select id="getHasCourse" resultType="java.lang.Integer">

+ 2 - 2
mec-util/src/main/java/com/ym/mec/util/excel/POIUtil.java

@@ -193,9 +193,9 @@ public class POIUtil {
 		if (dataset == null) {
 			throw new UtilException("数据集不能为空");
 		}
-		if (dataset.size() > MAX_DATA_SIZE) {
+		/*if (dataset.size() > MAX_DATA_SIZE) {
 			throw new UtilException("数据集太大,不能导出.最大数据集不能超过" + MAX_DATA_SIZE);
-		}
+		}*/
 		HSSFWorkbook workbook = new HSSFWorkbook();
 		HSSFCellStyle style = workbook.createCellStyle(); // 获取单元格样式
 		/************** 设置单元格样式 *************/

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

@@ -233,7 +233,6 @@ public class ExportController extends BaseController {
     @PostMapping("export/studentHasCourse")
     @PreAuthorize("@pcs.hasPermissions('export/studentHasCourse')")
     public void studentHasCourse(HttpServletResponse response,StudentManageQueryInfo queryInfo) {
-        queryInfo.setRows(999999999);
         SysUser sysUser = sysUserFeignService.queryUserInfo();
         if (sysUser == null) {
             throw new BizException("用户信息获取失败");
@@ -251,13 +250,14 @@ public class ExportController extends BaseController {
                 }
             }
         }
-        List<StudentManageListDto> rows = studentManageService.findStudentsByOrganId(queryInfo).getRows();
+        List<StudentManageListDto> rows = studentManageService.queryHasCourseStudent(queryInfo);
+//        List<StudentManageListDto> rows = studentManageService.findStudentsByOrganId(queryInfo).getRows();
         try {
             HSSFWorkbook workbook = POIUtil.exportExcel(new String[]{"分部", "学员编号", "学员姓名", "性别", "家长姓名",
-                    "家长联系电话", "是否激活", "是否有课", "是否预约陪练课","是否有陪练课", "课程余额(元)",
+                    "家长联系电话", "是否激活", "是否有课", "是否预约陪练课","是否有陪练课",
                     "所在乐团", "乐团所属声部", "所在乐团状态", "所在vip课", "所在VIP状态"}, new String[]{
                     "organName", "userId", "username", "gender.description", "parentsName", "parentsPhone",
-                    "isActive.msg","hasCourse.msg","isMake.msg","hasPracticeCourse.msg","courseBalance","musicGroupName",
+                    "isActive.msg","hasCourse.msg","isMake.msg","hasPracticeCourse.msg","musicGroupName",
                     "subjectName","musicGroupStatus","vipGroupName","vipGroupStatus"}, rows);
             response.setContentType("application/octet-stream");
             response.setHeader("Content-Disposition", "attachment;filename=lender-" + DateUtil.getDate(new Date()) + ".xls");