Przeglądaj źródła

1、课程调整时排除自动补签记录
2、删除请假时班级学生状态更新代码
3、小课过期课程调整生成后加入学生缴费信息
4、vip课点名添加开课前时间限制
5、学生端可购买小课获取条件调整
6、学员请假课程调整限制

Joburgess 5 lat temu
rodzic
commit
d864157e48

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentAttendanceDao.java

@@ -36,6 +36,15 @@ public interface StudentAttendanceDao extends BaseDAO<Long, StudentAttendance> {
     int deleteStudentAttendancesByCourse(Long courseScheduleId);
 
     /**
+     * @describe 根据课程删除考情记录
+     * @author Joburgess
+     * @date 2020/1/11
+     * @param courseScheduleIds:
+     * @return int
+     */
+    int deleteByCourseSchedules(@Param("courseScheduleIds") List<Long> courseScheduleIds);
+
+    /**
      * 统计学生各种状态人数
      * @param classId
      * @return

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

@@ -1446,9 +1446,6 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 
             if (newCourseSchedule.getStartClassTime().after(now)){
                 teacherAttendanceDao.cleanCourseTeacherSignInfo(newCourseSchedule.getId());
-            }
-
-            if (oldCourseSchedule.getEndClassTime().before(now)&&newCourseSchedule.getStartClassTime().after(now)){
                 needCreateStudentPaymentCourses.add(oldCourseSchedule);
             }
 
@@ -1593,6 +1590,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
         }
         if(!CollectionUtils.isEmpty(needCreateStudentPaymentCourses)){
             courseScheduleStudentPaymentService.createCourseScheduleStudentPaymentByCourseSchedules(needCreateStudentPaymentCourses);
+            studentAttendanceDao.deleteByCourseSchedules(needCreateStudentPaymentCourses.stream().map(CourseSchedule::getId).collect(Collectors.toList()));
         }
 
         if(oldCourseScheduleList.get(0).getGroupType().equals(GroupType.VIP)){

+ 2 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleStudentPaymentServiceImpl.java

@@ -227,8 +227,8 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
 		Map<BigDecimal, Long> expectPriceCountMap = vipGroupSortCourseByGroup.stream()
 				.collect(Collectors.groupingBy(VipGroupGiveCourseSortDto::getExpectPrice, Collectors.counting()));
 		BigDecimal zero = new BigDecimal("0.00");
-		int zeroPriceNum = expectPriceCountMap.get(zero).intValue();
-		if(zeroPriceNum<=0){
+		Long zeroPriceNum = expectPriceCountMap.get(zero);
+		if(Objects.isNull(zeroPriceNum)||zeroPriceNum<=0){
 			return;
 		}
 

+ 15 - 3
mec-biz/src/main/resources/config/mybatis/StudentAttendanceMapper.xml

@@ -129,6 +129,12 @@
     <delete id="delete">
 		DELETE FROM student_attendance WHERE id_ = #{id} 
 	</delete>
+    <delete id="deleteByCourseSchedules">
+        DELETE FROM student_attendance WHERE course_schedule_id_ IN
+        <foreach collection="courseScheduleIds" item="courseScheduleId" open="(" close=")" separator=",">
+            #{courseScheduleId}
+        </foreach>
+    </delete>
 
     <resultMap id="studentAttendanceViewUtilEntity" type="com.ym.mec.biz.dal.dto.StudentAttendanceViewDto">
         <result property="classGroupId" column="class_group_id_"/>
@@ -360,9 +366,15 @@
         AND cssp.course_schedule_id_ = #{courseScheduleId}
     </select>
     <select id="countStudentAttendenceNum" resultType="int">
-        SELECT COUNT(*) FROM student_attendance sa
-        WHERE course_schedule_id_ = #{courseScheduleId}
-        AND (update_time_!='1970-01-01 00:00:00' OR update_time_ IS NULL)
+        SELECT
+            COUNT( sa.user_id_ )
+        FROM
+            student_attendance sa
+            LEFT JOIN course_schedule cs ON cs.id_ = sa.course_schedule_id_
+        WHERE
+            sa.create_time_ &gt; DATE_ADD( CONCAT( cs.class_date_, ' ', cs.start_class_time_ ), INTERVAL - 4 HOUR )
+            AND sa.course_schedule_id_ = #{courseScheduleId}
+            AND (sa.update_time_!='1970-01-01 00:00:00' OR sa.update_time_ IS NULL)
     </select>
     <select id="countStudentAttendancesByCourses" resultType="java.util.Map">
         SELECT

+ 0 - 15
mec-teacher/src/main/java/com/ym/mec/teacher/controller/TeacherCourseScheduleController.java

@@ -15,11 +15,9 @@ import com.ym.mec.biz.service.CourseScheduleService;
 import com.ym.mec.biz.service.StudentAttendanceService;
 import com.ym.mec.biz.service.SysConfigService;
 import com.ym.mec.common.controller.BaseController;
-import com.ym.mec.util.date.DateUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
-import org.apache.commons.lang3.time.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.MediaType;
@@ -156,19 +154,6 @@ public class TeacherCourseScheduleController extends BaseController {
         if(Objects.isNull(classDateAdjustDto.getClassGroupId())){
             classDateAdjustDto.setClassGroupId(oldCourseSchedule.getClassGroupId());
         }
-        Date now=new Date();
-        if(DateUtils.isSameDay(now,oldCourseSchedule.getClassDate())){
-            return failed("不能调整今天的课程");
-        }
-        Date tomorrow = DateUtil.addDays1(now, 1);
-        if(DateUtils.isSameDay(tomorrow,oldCourseSchedule.getClassDate())){
-            Calendar calendar=Calendar.getInstance();
-            calendar.setTime(now);
-            System.out.println(calendar.get(Calendar.HOUR_OF_DAY));
-            if(calendar.get(Calendar.HOUR_OF_DAY)>22){
-                return failed("当前时间不可对此课程进行课程调整");
-            }
-        }
         List<CourseSchedule> courseSchedules=new ArrayList<>();
         courseSchedules.add(classDateAdjustDto);
         scheduleService.courseAdjust(courseSchedules);