Просмотр исходного кода

feat:教师端首页课程列表增加是否布置作业标记

Joburgess 4 лет назад
Родитель
Сommit
ee71436f99

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentExtracurricularExercisesSituationDao.java

@@ -10,6 +10,7 @@ import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 public interface StudentExtracurricularExercisesSituationDao extends BaseDAO<Long, StudentExtracurricularExercisesSituation> {
 
@@ -63,6 +64,17 @@ public interface StudentExtracurricularExercisesSituationDao extends BaseDAO<Lon
     List<StudentExtracurricularExercisesSituation> findTeacherNoStartServices(@Param("teacherId") Integer teacherId);
 
     /**
+     * @describe 根据周一日期获取教师应布置课后作业课程编号列表
+     * @author Joburgess
+     * @date 2021/4/29 0029
+     * @param teacherId:
+     * @param monday:
+     * @return java.util.Set<java.lang.Long>
+     */
+    List<String> getTeacherHomeworkCourseIdsWithMonday(@Param("teacherId") Integer teacherId,
+                                                    @Param("monday") String monday);
+
+    /**
      * @describe 统计上周数据今日跟新的条数
      * @author Joburgess
      * @date 2020/4/20

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CourseScheduleDto.java

@@ -97,6 +97,16 @@ public class CourseScheduleDto extends CourseSchedule {
 
     private PracticeGroupType practiceType;
 
+    private int enableAssignHomework;
+
+    public int getEnableAssignHomework() {
+        return enableAssignHomework;
+    }
+
+    public void setEnableAssignHomework(int enableAssignHomework) {
+        this.enableAssignHomework = enableAssignHomework;
+    }
+
     public UpdateAttendanceEnum getComplaintsType() {
         return complaintsType;
     }

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/StudentServeService.java

@@ -1,5 +1,7 @@
 package com.ym.mec.biz.service;
 
+import org.apache.ibatis.annotations.Param;
+
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
@@ -41,6 +43,16 @@ public interface StudentServeService {
      */
     Set<Long> getTeacherServeCourseIds(Integer teacherId);
 
+    /**
+     * @describe 根据周一日期获取教师应布置课后作业课程编号列表
+     * @author Joburgess
+     * @date 2021/4/29 0029
+     * @param teacherId:
+     * @param monday:
+     * @return java.util.Set<java.lang.Long>
+     */
+    Set<Long> getTeacherHomeworkCourseIdsWithMonday(Integer teacherId, String monday);
+
     void updateExercisesSituation(Date date, List<Integer> studentIds, Integer teacherId);
 
     /**

+ 6 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -1205,6 +1205,8 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 			idCourseReview=AllCourseScheduleReviews.stream().collect(Collectors.groupingBy(CourseScheduleReview::getCourseScheduleId));
 		}
 
+		Set<Long> homeworkCourseIds = studentServeService.getTeacherHomeworkCourseIdsWithMonday(userId, DateUtil.dateToString(classDate, DateUtil.ISO_EXPANDED_DATE_FORMAT));
+
 		for (CourseScheduleDto courseScheduleDto : teacherCourseSchedulesWithDate) {
             Long studentNum = studentNumCourseMap.get(courseScheduleDto.getId());
             if (Objects.nonNull(studentNum)) {
@@ -1244,6 +1246,10 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 			}else{
             	courseScheduleDto.setComplaintsStatus(0);
 			}
+
+            if(homeworkCourseIds.contains(courseScheduleDto.getId())){
+				courseScheduleDto.setEnableAssignHomework(1);
+			}
 		}
         return teacherCourseSchedulesWithDate;
     }

+ 16 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServeServiceImpl.java

@@ -959,6 +959,22 @@ public class StudentServeServiceImpl implements StudentServeService {
     }
 
     @Override
+    public Set<Long> getTeacherHomeworkCourseIdsWithMonday(Integer teacherId, String monday) {
+        Set<Long> courseIds = new HashSet<>();
+        if(Objects.isNull(teacherId)){
+            return courseIds;
+        }
+        List<String> courseIdsStrs = studentExtracurricularExercisesSituationDao.getTeacherHomeworkCourseIdsWithMonday(teacherId, monday);
+        if(CollectionUtils.isEmpty(courseIdsStrs)){
+            return courseIds;
+        }
+        for (String courseIdsStr : courseIdsStrs) {
+            courseIds.addAll(Arrays.stream(courseIdsStr.split(",")).mapToLong(Long::valueOf).boxed().collect(Collectors.toSet()));
+        }
+        return courseIds;
+    }
+
+    @Override
     public Set<Integer> getStudentWithCourse(Long courseId) {
         CourseSchedule courseSchedule = courseScheduleDao.get(courseId);
         if(Objects.isNull(courseSchedule)){

+ 10 - 0
mec-biz/src/main/resources/config/mybatis/StudentExtracurricularExercisesSituationMapper.xml

@@ -479,6 +479,16 @@
 		SELECT * FROM student_extracurricular_exercises_situation_ WHERE teacher_id_=#{teacherId} AND actual_exercises_num_&lt;=0 AND serve_type_='HOMEWORK';
 	</select>
 
+
+	<select id="getTeacherHomeworkCourseIdsWithMonday" resultType="string">
+		SELECT course_ids_ FROM student_extracurricular_exercises_situation_
+		WHERE teacher_id_=#{teacherId}
+		  	AND serve_type_='HOMEWORK'
+			<if test="monday!=null and monday!=''">
+				AND monday_=#{monday}
+			</if>
+	</select>
+
 	<select id="findServiceWithCourse"
 			resultMap="StudentExtracurricularExercisesSituation">
 		SELECT * FROM student_extracurricular_exercises_situation_ WHERE monday_=#{monday} AND FIND_IN_SET(#{courseId}, course_ids_)