ソースを参照

学员剩余课时

zouxuan 4 年 前
コミット
5f140ce2fa

+ 20 - 6
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/MusicGroupPaymentStudentCourseDetailDao.java

@@ -3,6 +3,8 @@ package com.ym.mec.biz.dal.dao;
 import com.ym.mec.biz.dal.entity.CourseSchedule;
 
 import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 import com.ym.mec.biz.dal.entity.MusicGroupPaymentStudentCourseDetail;
 import com.ym.mec.common.dal.BaseDAO;
@@ -12,11 +14,11 @@ import org.apache.ibatis.annotations.Param;
 public interface MusicGroupPaymentStudentCourseDetailDao extends BaseDAO<Long, MusicGroupPaymentStudentCourseDetail> {
 
     /**
+     * @param musicGroupPaymentStudentCourseDetails:
+     * @return int
      * @describe 批量更新
      * @author qnc99
      * @date 2020/12/1 0001
-     * @param musicGroupPaymentStudentCourseDetails:
-     * @return int
      */
     int batchUpdate(@Param("paymentCourseDetails") List<MusicGroupPaymentStudentCourseDetail> musicGroupPaymentStudentCourseDetails);
 
@@ -30,8 +32,8 @@ public interface MusicGroupPaymentStudentCourseDetailDao extends BaseDAO<Long, M
      * @date 2020.11.04
      */
     List<MusicGroupPaymentStudentCourseDetail> getUnUseWithStudentAndCourseTypeAndCourseMinutes(@Param("batchNo") String batchNo,
-                                                                                          @Param("studentId") Integer studentId,
-                                                                                          @Param("courseType") CourseSchedule.CourseScheduleType courseType);
+                                                                                                @Param("studentId") Integer studentId,
+                                                                                                @Param("courseType") CourseSchedule.CourseScheduleType courseType);
 
     /**
      * @param studentId:
@@ -59,14 +61,16 @@ public interface MusicGroupPaymentStudentCourseDetailDao extends BaseDAO<Long, M
 
     /**
      * 删除用户购买乐团课程记录
+     *
      * @param userId
      * @param musicGroupId
      * @return
      */
     int deleteByUserIdAndMusicGroupId(@Param("userId") Integer userId, @Param("musicGroupId") String musicGroupId);
-    
+
     /**
      * 根据缴费编号删除信息
+     *
      * @param musicGroupPaymentCalenderId
      * @return
      */
@@ -74,15 +78,25 @@ public interface MusicGroupPaymentStudentCourseDetailDao extends BaseDAO<Long, M
 
     /**
      * 删除信息
+     *
      * @param musicGroupPaymentCalenderDetailIdList
      * @return
      */
     int deleteByMusicGroupPaymentCalenderDetailId(List<Long> musicGroupPaymentCalenderDetailIdList);
-    
+
     /**
      * 查询对象
+     *
      * @param musicGroupPaymentCalenderDetailIdList
      * @return
      */
     List<MusicGroupPaymentStudentCourseDetail> queryByMusicGroupPaymentStudentCourseDetailId(List<Long> musicGroupPaymentCalenderDetailIdList);
+
+    /**
+     * 获取乐团学员剩余可排课时长
+     *
+     * @param studentIds
+     * @return
+     */
+    List<Map<Integer, Integer>> queryStudentSubTotalCourseTime(@Param("studentIds") Set<Integer> studentIds, @Param("musicGroupId") String musicGroupId);
 }

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

@@ -15,6 +15,7 @@ import com.ym.mec.biz.dal.page.StudentOperatingQueryInfo;
 import com.ym.mec.biz.dal.page.StudentSignQueryInfo;
 import com.ym.mec.biz.dal.page.TeacherPaymentRecordInfo;
 import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.common.page.QueryInfo;
 
 /**
  * @Author Joburgess
@@ -200,5 +201,5 @@ public interface StudentManageService {
      * @param groupType
      * @return
      */
-    List<BasicUserDto> queryGroupStudents(String groupType);
+    List<BasicUserDto> queryGroupStudents(QueryInfo groupType);
 }

+ 7 - 23
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentManageServiceImpl.java

@@ -10,6 +10,7 @@ import com.ym.mec.biz.dal.enums.CourseStatusEnum;
 import com.ym.mec.biz.dal.enums.SporadicChargeTypeEnum;
 import com.ym.mec.biz.service.SysConfigService;
 
+import com.ym.mec.common.page.QueryInfo;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -68,7 +69,7 @@ public class StudentManageServiceImpl implements StudentManageService {
     @Autowired
     private StudentManageDao studentManageDao;
     @Autowired
-    private OrganizationDao organizationDao;
+    private MusicGroupPaymentStudentCourseDetailDao musicGroupPaymentStudentCourseDetailDao;
     @Autowired
     private CourseScheduleStudentPaymentDao scheduleStudentPaymentDao;
     @Autowired
@@ -416,18 +417,8 @@ public class StudentManageServiceImpl implements StudentManageService {
         PageInfo<MusicGroupStudentsDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
         Map<String, Object> params = new HashMap<>();
         MapUtil.populateMap(params, queryInfo);
-//        if(StringUtils.isNotEmpty(queryInfo.getPaymentStatus())){
-//            List<Integer> userIds;
-//            if("NON_PAYMENT".equals(queryInfo.getPaymentStatus())){
-//                userIds = musicGroupPaymentCalenderDao.queryUserByNoPayment(queryInfo.getClassGroupId());
-//            }else {
-//                userIds = musicGroupPaymentCalenderDao.queryUserByPayment(queryInfo.getClassGroupId());
-//            }
-//            if(userIds != null && userIds.size() > 0){
-//                params.put("userIds",userIds);
-//            }
-//        }
         List<MusicGroupStudentsDto> dataList = null;
+        String musicGroupId = queryInfo.getMusicGroupId();
         int count = studentManageDao.countMusicGroupStudent(params);
         if (queryInfo.getIsExport() && count > 50000) {
             throw new BizException("数据集太大,不能导出.最大数据集不能超过50000");
@@ -438,6 +429,8 @@ public class StudentManageServiceImpl implements StudentManageService {
             dataList = studentManageDao.queryMusicGroupStudent(params);
             //退团的学生
             List<Integer> quitUserIds = dataList.stream().filter(e -> e.getStudentStatus().equals("QUIT")).map(MusicGroupStudentsDto::getUserId).collect(Collectors.toList());
+            Set<Integer> studentIds = dataList.stream().map(e -> e.getUserId()).collect(Collectors.toSet());
+            List<Map<Integer,Integer>> subTotalCourseTimeMap = musicGroupPaymentStudentCourseDetailDao.queryStudentSubTotalCourseTime(studentIds,musicGroupId);
 
             if (quitUserIds.size() > 0) {
                 List<MusicGroupQuit> quits = musicGroupQuitDao.getQuits(queryInfo.getMusicGroupId(), quitUserIds);
@@ -448,15 +441,6 @@ public class StudentManageServiceImpl implements StudentManageService {
                     }
                 }
             }
-//            Map<Integer,String> maps = MapUtil.convertIntegerMap(musicGroupStudentFeeDao.findPaymentStatusMap(queryInfo.getMusicGroupId()));
-//            dataList.forEach(e->{
-//                e.setPaymentStatus(maps.get(e.getUserId()));
-//            Set<Integer> collect = dataList.stream().map(e -> e.getUserId()).collect(Collectors.toSet());
-//            Map<Integer,String> paymentStatusMap = MapUtil.convertIntegerMap(
-//                    musicGroupPaymentCalenderDao.queryUserCoursePaymentStatus(collect,queryInfo.getMusicGroupId()));
-//            dataList.forEach(e -> {
-//                e.setPaymentStatus(paymentStatusMap.get(e.getUserId()));
-//            });
         }
         if (count == 0) {
             dataList = new ArrayList<>();
@@ -689,12 +673,12 @@ public class StudentManageServiceImpl implements StudentManageService {
     }
 
     @Override
-    public List<BasicUserDto> queryGroupStudents(String groupType) {
+    public List<BasicUserDto> queryGroupStudents(QueryInfo queryInfo) {
         SysUser sysUser = sysUserFeignService.queryUserInfo();
         if(sysUser == null || sysUser.getId() == null){
             throw new BizException("用户信息获取失败");
         }
-        if("VIP".equals(groupType)){
+        if("VIP".equals(queryInfo.getSearch())){
             return studentManageDao.queryVipGroupStudents(sysUser.getId());
         }else {
             return studentManageDao.queryPracticeGroupStudents(sysUser.getId());

+ 4 - 0
mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentStudentCourseDetailMapper.xml

@@ -225,4 +225,8 @@
             WHERE music_group_id_ = #{musicGroupId}
         )
     </delete>
+
+    <select id="queryStudentSubTotalCourseTime" resultType="java.util.Map">
+
+    </select>
 </mapper>

+ 2 - 0
mec-biz/src/main/resources/config/mybatis/StudentManageDao.xml

@@ -822,6 +822,7 @@
         AND vg.educational_teacher_id_ = #{userId}
         AND vg.group_status_ IN (0,1,2,5)
         GROUP BY cgsm.user_id_
+        <include refid="global.limit"/>
     </select>
 
     <select id="queryPracticeGroupStudents" resultMap="com.ym.mec.biz.dal.dao.MusicGroupDao.BasicUserDto">
@@ -833,5 +834,6 @@
         AND pg.educational_teacher_id_ = #{userId}
         AND pg.group_status_ NOT IN ('FINISH','CANCEL')
         GROUP BY cgsm.user_id_
+        <include refid="global.limit"/>
     </select>
 </mapper>

+ 3 - 2
mec-web/src/main/java/com/ym/mec/web/controller/education/EduStudentStudentController.java

@@ -1,6 +1,7 @@
 package com.ym.mec.web.controller.education;
 
 import com.ym.mec.biz.service.StudentManageService;
+import com.ym.mec.common.page.QueryInfo;
 import io.swagger.annotations.ApiOperation;
 
 import org.springframework.beans.factory.annotation.Autowired;
@@ -41,8 +42,8 @@ public class EduStudentStudentController extends BaseController {
 
     @ApiOperation(value = "教务老师关联的学员列表")
     @GetMapping("studentManage/queryGroupStudents")
-    public Object queryGroupStudents(String groupType){
-        return succeed(studentManageService.queryGroupStudents(groupType));
+    public Object queryGroupStudents(QueryInfo queryInfo){
+        return succeed(studentManageService.queryGroupStudents(queryInfo));
     }
 
 }