Переглянути джерело

1、服务指标导出增加作业提交时间;
2、vip课休学状态增加退学操作;

Joburgess 5 роки тому
батько
коміт
5f96be40be

+ 4 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentDao.java

@@ -96,6 +96,10 @@ public interface StudentDao extends com.ym.mec.common.dal.BaseDAO<Integer, Stude
                                                @Param("courseExpireDate")Date courseExpireDate,
                                                @Param("studentIds") List<Integer> studentIds);
 
+    List<StudentServeDto> getBeServiceStudentsInfoWithStudentsForHistory(@Param("monday") String monday,
+                                                               @Param("courseExpireDate")Date courseExpireDate,
+                                                               @Param("studentIds") List<Integer> studentIds);
+
     /**
      * @describe 更新指定学员的服务指标或运营指标
      * @author Joburgess

+ 13 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPauseInfoDao.java

@@ -37,4 +37,17 @@ public interface StudentPauseInfoDao extends BaseDAO<Long, StudentPauseInfo> {
     List<StudentPauseInfo> findByGroup(@Param("groupType") GroupType groupType,
                                        @Param("groupId") String groupId);
 
+    /**
+     * @describe 删除学员在指定课程组下的休学信息
+     * @author Joburgess
+     * @date 2020.06.04
+     * @param groupType:
+     * @param groupId:
+     * @param userId:
+     * @return int
+     */
+    int deleteUserPauseInfoWithGroup(@Param("groupType") GroupType groupType,
+                                     @Param("groupId") String groupId,
+                                     @Param("userId") Integer userId);
+
 }

+ 20 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServeServiceImpl.java

@@ -67,12 +67,17 @@ public class StudentServeServiceImpl implements StudentServeService {
                 total=new BigDecimal(beServeStudentIds.size()),
                 totalPage=total.divide(pageSize, BigDecimal.ROUND_UP);
 
-        studentExtracurricularExercisesSituationDao.deleteByMonday(monDayDate.toString());
+        List<StudentExtracurricularExercisesSituation> results=new ArrayList<>();
 
         while (currentPage.compareTo(totalPage)<=0){
             List<Integer> studentIds=beServeStudentIds.stream().skip(pageSize.multiply(currentPage.subtract(BigDecimal.ONE)).longValue()).limit(pageSize.longValue()).collect(Collectors.toList());
 
-            List<StudentServeDto> serviceStudents = studentDao.getBeServiceStudentsInfoWithStudents(monDayDate.toString(), sunDayDate.isBefore(LocalDate.now())?nextMonday:new Date(),studentIds);
+            List<StudentServeDto> serviceStudents;
+            if(sunDayDate.isBefore(LocalDate.now())){
+                serviceStudents = studentDao.getBeServiceStudentsInfoWithStudentsForHistory(monDayDate.toString(), nextMonday,studentIds);
+            }else{
+                serviceStudents = studentDao.getBeServiceStudentsInfoWithStudents(monDayDate.toString(), new Date(),studentIds);
+            }
             if(CollectionUtils.isEmpty(serviceStudents)){
                 return;
             }
@@ -128,7 +133,6 @@ public class StudentServeServiceImpl implements StudentServeService {
                 studentExercisesMap = studentExercises.stream().collect(Collectors.groupingBy(ExtracurricularExercisesReply::getUserId));
             }
 
-            List<StudentExtracurricularExercisesSituation> results=new ArrayList<>();
             for (Map.Entry<Integer, List<StudentServeDto>> studentCoursesEntry : studentCoursesMap.entrySet()) {
 
                 if(dontServeInCurrentWeekStudentIds.contains(studentCoursesEntry.getKey())){
@@ -221,9 +225,20 @@ public class StudentServeServiceImpl implements StudentServeService {
                 results.add(studentExtracurricularExercisesSituation);
             }
 
-//            List<StudentExtracurricularExercisesSituation> rows=results.stream().skip(pageSize.multiply(currentPage.subtract(BigDecimal.ONE)).longValue()).limit(pageSize.longValue()).collect(Collectors.toList());
-            studentExtracurricularExercisesSituationDao.batchInsert(results);
             currentPage=currentPage.add(BigDecimal.ONE);
         }
+
+        studentExtracurricularExercisesSituationDao.deleteByMonday(monDayDate.toString());
+
+        BigDecimal currentPage1=BigDecimal.ONE,
+                pageSize1=new BigDecimal(10000),
+                total1=new BigDecimal(results.size()),
+                totalPage1=total1.divide(pageSize1, BigDecimal.ROUND_UP);
+
+        while (currentPage1.compareTo(totalPage1)<=0){
+            List<StudentExtracurricularExercisesSituation> rows=results.stream().skip(pageSize1.multiply(currentPage1.subtract(BigDecimal.ONE)).longValue()).limit(pageSize1.longValue()).collect(Collectors.toList());
+            studentExtracurricularExercisesSituationDao.batchInsert(rows);
+            currentPage1=currentPage1.add(BigDecimal.ONE);
+        }
     }
 }

+ 1 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -1543,6 +1543,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
         if(classStudentMapperByUserIdAndClassGroupId.getStatus().equals(ClassGroupStudentStatusEnum.QUIT_SCHOOL)){
 			classStudentMapperByUserIdAndClassGroupId.setStatus(ClassGroupStudentStatusEnum.QUIT);
 			classGroupStudentMapperDao.update(classStudentMapperByUserIdAndClassGroupId);
+			studentPauseInfoDao.deleteUserPauseInfoWithGroup(GroupType.VIP, vipGroupId.toString(), studentId);
 			return;
         }
 

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

@@ -408,13 +408,13 @@
     </select>
     <select id="getBeServiceStudentsInfoWithStudents" resultMap="StudentServeDto">
         SELECT
-        s.user_id_,
-        s.teacher_id_,
-        cs.group_type_,
-        cs.teach_mode_,
-        IF(CONCAT( cs.class_date_, ' ', cs.end_class_time_ )&lt;#{courseExpireDate} AND (sa.status_ != 'NORMAL' OR sa.status_ IS NULL), NULL, cs.class_date_) course_start_time_
+            s.user_id_,
+            s.teacher_id_,
+            cs.group_type_,
+            cs.teach_mode_,
+            IF(CONCAT( cs.class_date_, ' ', cs.end_class_time_ )&lt;#{courseExpireDate} AND (sa.status_ != 'NORMAL' OR sa.status_ IS NULL), NULL, cs.class_date_) course_start_time_
         FROM
-        student s
+          student s
         LEFT JOIN course_schedule_student_payment cssp ON cssp.user_id_ = s.user_id_
         LEFT JOIN student_attendance sa ON cssp.course_schedule_id_=sa.course_schedule_id_ AND sa.user_id_=cssp.user_id_
         LEFT JOIN course_schedule cs ON cs.id_ = cssp.course_schedule_id_
@@ -426,6 +426,26 @@
             #{studentId}
         </foreach>
     </select>
+    <select id="getBeServiceStudentsInfoWithStudentsForHistory" resultMap="StudentServeDto">
+        SELECT
+            s.student_id_ user_id_,
+            s.teacher_id_,
+            cs.group_type_,
+            cs.teach_mode_,
+            IF(CONCAT( cs.class_date_, ' ', cs.end_class_time_ )&lt;#{courseExpireDate} AND (sa.status_ != 'NORMAL' OR sa.status_ IS NULL), NULL, cs.class_date_) course_start_time_
+        FROM
+          student_extracurricular_exercises_situation_ s
+        LEFT JOIN course_schedule_student_payment cssp ON cssp.user_id_ = s.student_id_
+        LEFT JOIN student_attendance sa ON cssp.course_schedule_id_=sa.course_schedule_id_ AND sa.user_id_=cssp.user_id_
+        LEFT JOIN course_schedule cs ON cs.id_ = cssp.course_schedule_id_
+        AND cs.group_type_ IN ('VIP', 'PRACTICE')
+        AND CONCAT( cs.class_date_, ' ', cs.start_class_time_ ) > #{monday}
+        WHERE
+        s.monday_ = #{monday} AND s.student_id_ IN
+        <foreach collection="studentIds" item="studentId" open="(" close=")" separator=",">
+            #{studentId}
+        </foreach>
+    </select>
     <select id="getServeStudentIds" resultType="int">
         SELECT user_id_ FROM student WHERE service_tag_=1
     </select>

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

@@ -71,6 +71,13 @@
     <delete id="delete">
 		DELETE FROM student_pause_info WHERE id_ = #{id}
 	</delete>
+    <update id="deleteUserPauseInfoWithGroup">
+        UPDATE student_pause_info SET del_flag_ = 1
+        WHERE
+            group_type_ = #{groupType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+            AND music_group_id_ = #{groupId}
+            AND user_id_ = #{userId}
+    </update>
 
     <!-- 分页查询 -->
     <select id="queryPage" resultMap="StudentPauseInfo" parameterType="map">