Browse Source

Merge branch 'reg_feature' into maintenance_feature

周箭河 4 years ago
parent
commit
6e67b908e8

+ 63 - 33
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleStudentPaymentDao.java

@@ -26,11 +26,11 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
     int batchInsert(List<CourseScheduleStudentPayment> courseScheduleStudentPayments);
 
     /**
+     * @param courseScheduleStudentPayments:
+     * @return int
      * @describe 批量更新
      * @author Joburgess
      * @date 2020/1/10
-     * @param courseScheduleStudentPayments:
-     * @return int
      */
     int batchUpdate(@Param("courseScheduleStudentPayments") List<CourseScheduleStudentPayment> courseScheduleStudentPayments);
 
@@ -117,15 +117,15 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
                                                                               @Param("userId") Integer userId);
 
     /**
-     * @describe 统计团体下为开始课程学生数量
-     * @author Joburgess
-     * @date 2020.09.27
      * @param groupId:
      * @param groupType:
      * @return int
      * @describe 统计团体下为开始课程学生数量
      * @author Joburgess
      * @date 2020.09.27
+     * @describe 统计团体下为开始课程学生数量
+     * @author Joburgess
+     * @date 2020.09.27
      */
     int countNotStartCourseStudentNumWithGroup(@Param("groupId") String groupId,
                                                @Param("groupType") GroupType groupType);
@@ -145,6 +145,7 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
 
     /**
      * 根据乐团编号删除记录
+     *
      * @param musicGroupId
      * @return
      */
@@ -152,6 +153,7 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
 
     /**
      * 根据乐团编号,和groupTYpe获取学员剩余课程数
+     *
      * @param musicGroupIds
      * @param userId
      * @param groupType
@@ -172,21 +174,24 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
 
     /**
      * 根据乐团,vip状态获取编号
+     *
      * @return
      */
     Set<Integer> queryMusicStudentPer();
+
     /**
      * 根据乐团,vip状态获取编号
+     *
      * @return
      */
     Set<Integer> queryVipStudentPer();
 
     /**
+     * @param courseIds: 统计课程上的学生人数
+     * @return java.util.List<java.util.Map < java.lang.Integer, java.lang.Integer>>
      * @describe
      * @author Joburgess
      * @date 2020/1/8
-     * @param courseIds: 统计课程上的学生人数
-     * @return java.util.List<java.util.Map<java.lang.Integer,java.lang.Integer>>
      */
     List<Map<Integer, Integer>> countCourseStudentNum(@Param("courseIds") List<Long> courseIds);
 
@@ -211,11 +216,11 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
     List<CourseScheduleStudentPayment> findByCourseSchedule(@Param("courseScheduleId") Long courseScheduleId);
 
     /**
+     * @param mainMergeCourseId:
+     * @return java.util.List<com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment>
      * @describe 获取合并课程的学员缴费记录
      * @author Joburgess
      * @date 2021/1/21 0021
-     * @param mainMergeCourseId:
-     * @return java.util.List<com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment>
      */
     List<CourseScheduleStudentPayment> findByMainMergedCourse(@Param("mainMergeCourseId") Long mainMergeCourseId);
 
@@ -230,17 +235,18 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
 
     /**
      * 获取课程学员数量
+     *
      * @param courseScheduleId
      * @return
      */
     Integer countStudentNum(Integer courseScheduleId);
 
     /**
+     * @param courseScheduleId:
+     * @return int
      * @describe 统计课程学员数量
      * @author Joburgess
      * @date 2021/2/9 0009
-     * @param courseScheduleId:
-     * @return int
      */
     int countCourseOnlyStudentNum(@Param("courseScheduleId") Long courseScheduleId);
 
@@ -257,6 +263,7 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
 
     /**
      * 获取当前课程的学员列表
+     *
      * @param courseScheduleId
      * @return
      */
@@ -264,17 +271,18 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
 
     /**
      * 获取课程的学员编号列表
+     *
      * @param courseScheduleIds
      * @return
      */
     List<Map<Integer, String>> getStudentIdMap(@Param("courseScheduleIds") List<Long> courseScheduleIds);
 
     /**
+     * @param monday:
+     * @return java.util.List<java.lang.Integer>
      * @describe 获取在指定时间之后不存在网管课的学员编号列表
      * @author Joburgess
      * @date 2020/4/10
-     * @param monday:
-     * @return java.util.List<java.lang.Integer>
      */
     List<Practice4ExercisesSituationDto> findNoPracticeStudentIdsOnWeek(@Param("monday") String monday,
                                                                         @Param("sunday") String sunday);
@@ -283,6 +291,7 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
 
     /**
      * 从指定时间开始查询学的线上可数
+     *
      * @return
      */
     List<StudentCourseTimesDto> queryStudentNotStartCourseTimesOfOnline();
@@ -300,6 +309,7 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
 
     /**
      * 获取学员指定课程类型的剩余课时数
+     *
      * @param studentId
      * @param courseScheduleType
      * @return
@@ -309,6 +319,7 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
 
     /**
      * 批量操作节拍器状态
+     *
      * @param courseScheduleId
      * @param userId
      */
@@ -316,6 +327,7 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
 
     /**
      * 获取用户的节拍器信息
+     *
      * @param userIds
      * @param courseScheduleId
      * @return
@@ -324,6 +336,7 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
 
     /**
      * 获取用户的曲目下载信息
+     *
      * @param userIds
      * @param courseScheduleId
      * @return
@@ -332,6 +345,7 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
 
     /**
      * 获取单个用户的midi
+     *
      * @param courseScheduleId
      * @param userId
      * @return
@@ -340,6 +354,7 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
 
     /**
      * 获取单个用户的examDownloadJson
+     *
      * @param courseScheduleId
      * @param userId
      * @return
@@ -347,18 +362,19 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
     String getExamJsonByCourseIdAndUserId(@Param("courseScheduleId") Long courseScheduleId, @Param("userId") Integer userId);
 
     /**
+     * @param groupType:
+     * @param groupIds:
+     * @return java.util.List<java.util.Map < java.lang.String, java.math.BigDecimal>>
      * @describe 统计课程组下的课程单价
      * @author Joburgess
      * @date 2020.06.11
-     * @param groupType:
-     * @param groupIds:
-     * @return java.util.List<java.util.Map<java.lang.String,java.math.BigDecimal>>
      */
     List<Map<String, BigDecimal>> findGroupCoursesUnitPrice(@Param("groupType") GroupType groupType,
                                                             @Param("groupIds") List<String> groupIds);
 
     /**
      * 获取未进入教室的学员列表
+     *
      * @param roomId
      * @param courseScheduleId
      * @return
@@ -382,11 +398,11 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
 
 
     /**
+     * @param StudentIds:
+     * @return java.util.List<java.util.Map < java.lang.Integer, java.util.Date>>
      * @describe 获取指定学员的最后一节课时间
      * @author Joburgess
      * @date 2020/11/17 0017
-     * @param StudentIds:
-     * @return java.util.List<java.util.Map<java.lang.Integer,java.util.Date>>
      */
     List<Map<Integer, Date>> findStudentLastCourseSchedule(@Param("studentIds") List<Integer> StudentIds);
 
@@ -396,27 +412,28 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
 
     /**
      * 修改学员曲目下载信息
-     * @author zouxuan
+     *
      * @param roomId
+     * @author zouxuan
      */
     int adjustExamSong(@Param("roomId") Long roomId, @Param("userId") Integer userId, @Param("examSongJson") String examSongJson);
 
     /**
-     * @describe 统计学员通过双十一活动排课的数量
-     * @author qnc99
-     * @date 2020/11/25 0025
      * @param userIds:
      * @param activityIds:
      * @return java.util.List<com.ym.mec.biz.dal.dto.StudentVipDouble11Dto>
+     * @describe 统计学员通过双十一活动排课的数量
+     * @author qnc99
+     * @date 2020/11/25 0025
      */
     List<StudentVipDouble11Dto> countStudentDouble11CourseTime(@Param("userIds") List<Integer> userIds,
                                                                @Param("specialActivityIds") List<Integer> specialActivityIds);
 
     /**
+     * @return java.util.List<com.ym.mec.biz.dal.entity.CourseScheduleStudentPaymentDto>
      * @describe 获取需要更新课营收的课程
      * @author qnc99
      * @date 2020/12/2 0002
-     * @return java.util.List<com.ym.mec.biz.dal.entity.CourseScheduleStudentPaymentDto>
      */
     List<CourseScheduleStudentPaymentDto> findNeedUpdateActualPriceStudentCourses(@Param("groupIds") List<String> groupIds,
                                                                                   @Param("userIds") List<Integer> userIds,
@@ -424,62 +441,75 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
 
     /**
      * 根据课程编号和,学员编号获取列表信息
-     * @author zouxuan
+     *
      * @param courseIds
      * @param studentId
      * @return
+     * @author zouxuan
      */
     List<CourseScheduleStudentPayment> queryCourseByIdsAndStudentId(@Param("courseIds") List<Long> courseIds, @Param("studentId") Integer studentId, @Param("courseType") String courseType);
 
     /**
      * 获取班级学员关联的编号
-     * @zouxuan
+     *
      * @param classGroupIds
      * @param studentIds
      * @return
+     * @zouxuan
      */
     List<Long> queryStudentNotStartByClassIdsAndStudentIds(@Param("classGroupIds") List<Integer> classGroupIds, @Param("studentIds") List<Integer> studentIds);
 
     /**
      * 获取指定列表中学员的费用列表
-     * @author zouxuan
+     *
      * @param studentPaymentIds
      * @param studentId
      * @return
+     * @author zouxuan
      */
     List<CourseScheduleStudentPayment> queryByIdsAndStudentId(@Param("studentPaymentIds") List<Long> studentPaymentIds, @Param("studentId") Integer studentId, @Param("courseType") String courseType);
 
     /**
-     * @describe 统计课程组已经开始的课程的应缴费用
-     * @author qnc99
-     * @date 2020/12/8 0008
      * @param groupId:
      * @param groupType:
      * @return java.math.BigDecimal
+     * @describe 统计课程组已经开始的课程的应缴费用
+     * @author qnc99
+     * @date 2020/12/8 0008
      */
     BigDecimal countFinishCoursePriceWithMusicGroup(@Param("groupId") String groupId,
                                                     @Param("groupType") GroupType groupType,
                                                     @Param("userId") Integer userId);
 
     /**
-     * @describe 获取学生指定日期之前指定类型的最后一节课
-     * @author Joburgess
-     * @date 2020/12/25 0025
      * @param studentId:
      * @param monday:
      * @return com.ym.mec.biz.dal.entity.CourseSchedule
+     * @describe 获取学生指定日期之前指定类型的最后一节课
+     * @author Joburgess
+     * @date 2020/12/25 0025
      */
     CourseSchedule getStudentHistoryLastCourse(@Param("studentId") Integer studentId,
                                                @Param("monday") String monday,
                                                @Param("groupId") String groupId,
-                                               @Param("courseType")CourseSchedule.CourseScheduleType courseType);
+                                               @Param("courseType") CourseSchedule.CourseScheduleType courseType);
 
     /**
      * 获取学员对应课程类型剩余课程价值
+     *
      * @param studentId
      * @param classGroupId
      * @param courseType
      * @return
      */
     BigDecimal querySubCoursePriceMap(@Param("studentId") Integer studentId, @Param("classGroupId") Integer classGroupId, @Param("courseType") String courseType);
+
+
+    /**
+     * 获取课程的人数
+     *
+     * @param courseIds
+     * @return
+     */
+    List<CourseSchedule> getCourseScheduleStudentNum(@Param("courseIds") List<Long> courseIds);
 }

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

@@ -4421,7 +4421,9 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 			if(!CollectionUtils.isEmpty(courseMergeCourseNum)){
 				courseMergeCourseNumMap = MapUtil.convertIntegerMap(courseMergeCourseNum);
 			}
-
+			//获取课程的预计人数
+			List<CourseSchedule> courseScheduleStudentNum = courseScheduleStudentPaymentDao.getCourseScheduleStudentNum(courseScheduleIds);
+			Map<Long, Integer> courseScheduleStudentNumMap = courseScheduleStudentNum.stream().collect(Collectors.toMap(CourseSchedule::getId, CourseSchedule::getStudentNum));
 			//获取班级声部名称
             List<Map<Integer, String>> classGroupSubjectNameMaps = classGroupDao.findClassGroupSubjectNameMaps(courseScheduleIds);
             Map<Integer, String> classGroupSubjectNameMap = MapUtil.convertIntegerMap(classGroupSubjectNameMaps);
@@ -4433,6 +4435,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 				if(courseMergeCourseNumMap.containsKey(result.getId())){
 					result.setBeMerged(courseMergeCourseNumMap.get(result.getId())>0?true:false);
 				}
+				result.setStudentNum(courseScheduleStudentNumMap.getOrDefault(result.getId(), 0));
 			}
         }
         pageInfo.setRows(results);

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

@@ -722,4 +722,11 @@
 		  AND cs.type_ = #{courseType}
 	  </if>
 	</select>
+    <select id="getCourseScheduleStudentNum" resultMap="com.ym.mec.biz.dal.dao.CourseScheduleDao.CourseSchedule">
+		SELECT course_schedule_id_ id_,COUNT(*) student_num_ FROM course_schedule_student_payment WHERE course_schedule_id_ IN
+		<foreach collection="courseIds" item="courseId" open="(" close=")" separator=",">
+			#{courseId}
+		</foreach>
+		GROUP BY course_schedule_id_
+	</select>
 </mapper>

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

@@ -860,9 +860,9 @@ public class ExportController extends BaseController {
         try {
             HSSFWorkbook workbook = POIUtil.exportExcel(new String[]{"分部名称", "课程编号", "开始时间", "结束时间",
                     "班级名称", "班级声部", "课程名称", "课程类型", "教学模式",
-                    "教学点", "课程状态", "指导老师", "学员编号", "是否点名", "是否有考勤申诉"}, new String[]{
+                    "教学点", "课程状态", "指导老师", "学员编号", "是否点名", "是否有考勤申诉","预计上课人数"}, new String[]{
                     "organName", "id", "startClassTime", "endClassTime", "classGroupName", "subjectName", "name",
-                    "groupType.desc", "teachMode.msg", "schoolName", "status.msg", "teacherName", "studentId", "isCallNames.msg", "isComplaints"}, rows);
+                    "groupType.desc", "teachMode.msg", "schoolName", "status.msg", "teacherName", "studentId", "isCallNames.msg", "isComplaints","studentNum"}, rows);
             response.setContentType("application/octet-stream");
             response.setHeader("Content-Disposition", "attachment;filename=lender-" + DateUtil.getDate(new Date()) + ".xls");
             ouputStream = response.getOutputStream();

+ 63 - 0
mec-web/src/main/java/com/ym/mec/web/controller/StudentRegistrationController.java

@@ -1,17 +1,24 @@
 package com.ym.mec.web.controller;
 
 import com.ym.mec.biz.dal.dao.MusicGroupDao;
+import com.ym.mec.biz.dal.dto.StudentPreRegistrationDto;
 import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.common.page.PageInfo;
+import com.ym.mec.util.date.DateUtil;
+import com.ym.mec.util.excel.POIUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 
+import java.io.EOFException;
 import java.io.IOException;
+import java.io.OutputStream;
 import java.util.Date;
 import java.util.List;
 
 import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -34,6 +41,8 @@ import com.ym.mec.biz.service.StudentRegistrationService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 
+import javax.servlet.http.HttpServletResponse;
+
 @RequestMapping("studentRegistration")
 @Api(tags = "学生报名信息服务")
 @RestController
@@ -230,4 +239,58 @@ public class StudentRegistrationController extends BaseController {
         return succeed(studentRegistrationService.getMusicGroupStuReBack(musicGroupId));
     }
 
+
+    @ApiOperation(value = "预报名导出")
+    @GetMapping("/preRegisterExport")
+    @PreAuthorize("@pcs.hasPermissions('studentRegistration/preRegisterExport')")
+    public void queryPreApplyList(StudentPreRegistrationQueryInfo queryInfo, HttpServletResponse response) throws Exception {
+        queryInfo.setPage(1);
+        queryInfo.setRows(49999);
+
+        PageInfo<StudentPreRegistrationDto> studentPreRegistration = studentPreRegistrationService.queryListForPage(queryInfo);
+        if (studentPreRegistration.getTotal() <= 0) {
+            response.setStatus(200);
+            response.setContentType("Content-Type: application/json;charset=UTF-8");
+            response.getOutputStream().write("{\"data\": null, \"code\": 500, \"status\": false, \"msg\": \"没有可导出的记录\"}".getBytes());
+            response.flushBuffer();
+            return;
+        }
+        for (StudentPreRegistrationDto row : studentPreRegistration.getRows()) {
+            if (row.getKitPurchaseMethod().equals("OWNED")) {
+                row.setKitPurchaseMethod("自行准备");
+            } else if (row.getKitPurchaseMethod().equals("GROUP")) {
+                row.setKitPurchaseMethod("团购");
+            }
+            if(row.getSubjectFirst().equals(999)){
+                row.setSubjectFirstName("听从老师安排");
+            }
+            if(row.getSubjectSecond().equals(999)){
+                row.setSubjectSecondName("听从老师安排");
+            }
+            row.setCurrentGrade(row.getCurrentGrade() + row.getCurrentClass());
+        }
+        OutputStream outputStream = response.getOutputStream();
+        try {
+            String[] header = {"学员编号", "学员姓名", "性别", "联系电话", "年级班级", "选报声部1", "选报声部2", "是否服从调剂", "乐器准备方式"};
+            String[] body = {"userId", "userName", "gender ? '男' : '女'", "phone", "currentGrade", "subjectFirstName", "subjectSecondName", "isAllowAdjust ? '是' : '否'", "kitPurchaseMethod"};
+
+            HSSFWorkbook workbook = POIUtil.exportExcel(header, body, studentPreRegistration.getRows());
+            response.setContentType("application/octet-stream");
+            response.setHeader("Content-Disposition", "attachment;filename=pre-register-" + DateUtil.getDate(new Date()) + ".xls");
+            response.flushBuffer();
+            outputStream = response.getOutputStream();
+            workbook.write(outputStream);
+            outputStream.flush();
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            if (outputStream != null) {
+                try {
+                    outputStream.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+    }
 }