Bläddra i källkod

fix:1、作业改造

Joburgess 4 år sedan
förälder
incheckning
fa239e1f78

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

@@ -56,6 +56,8 @@ public interface StudentExtracurricularExercisesSituationDao extends BaseDAO<Lon
     List<TeacherExercisesServiceDto> findTeacherExercisesServiceSituations(@Param("monday") String monday,
                                                                            @Param("teacherIds") List<Integer> teacherIds);
 
+    List<StudentExtracurricularExercisesSituation> findTeacherNoStartServices(@Param("teacherId") Integer teacherId);
+
     /**
      * @describe 统计上周数据今日跟新的条数
      * @author Joburgess

+ 11 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/StudentServeService.java

@@ -2,6 +2,7 @@ package com.ym.mec.biz.service;
 
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 /**
  * @Author Joburgess
@@ -28,6 +29,15 @@ public interface StudentServeService {
      * @param studentIds:
      * @return int
      */
-    Map<String, Object> checkeIsAssignHomework(Long courseScheduleId, String studentIds);
+    Map<String, Object> checkeIsAssignHomework(Long courseScheduleId, String studentIds, Integer teacherId);
+
+    /**
+     * @describe 获取教师应布置课程编号列表
+     * @author Joburgess
+     * @date 2020/12/25 0025
+     * @param teacherId:
+     * @return java.util.Set<java.lang.Long>
+     */
+    Set<Long> getTeacherServeCourseIds(Integer teacherId);
 
 }

+ 9 - 12
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -30,6 +30,7 @@ import java.util.TreeSet;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
+import com.ym.mec.biz.service.*;
 import org.apache.commons.collections.ListUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
@@ -144,17 +145,6 @@ import com.ym.mec.biz.dal.page.EndCourseScheduleQueryInfo;
 import com.ym.mec.biz.dal.page.StudentCourseScheduleRecordQueryInfo;
 import com.ym.mec.biz.dal.page.VipGroupQueryInfo;
 import com.ym.mec.biz.event.source.CourseEventSource;
-import com.ym.mec.biz.service.ClassGroupService;
-import com.ym.mec.biz.service.ClassGroupTeacherMapperService;
-import com.ym.mec.biz.service.CourseHomeworkService;
-import com.ym.mec.biz.service.CourseScheduleService;
-import com.ym.mec.biz.service.CourseScheduleStudentPaymentService;
-import com.ym.mec.biz.service.CourseScheduleTeacherSalaryService;
-import com.ym.mec.biz.service.MusicGroupService;
-import com.ym.mec.biz.service.PracticeGroupService;
-import com.ym.mec.biz.service.SysConfigService;
-import com.ym.mec.biz.service.SysMessageService;
-import com.ym.mec.biz.service.VipGroupService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.entity.ImGroupMember;
 import com.ym.mec.common.entity.ImGroupModel;
@@ -252,6 +242,8 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 	private ClassGroupTeacherMapperDao classGroupTeacherMapperDao;
     @Autowired
 	private CourseEventSource courseEventSource;
+    @Autowired
+	private StudentServeService studentServeService;
 
     private final Logger LOGGER = LoggerFactory
             .getLogger(this.getClass());
@@ -297,7 +289,12 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
             currentCourseDetail.setOnlyNormal(YesOrNoEnum.NO);
         }
 
-        currentCourseDetail.setCurrentClassTimes(courseScheduleDao.countClassGroupOverCourseNum(currentCourseDetail.getClassId()));
+		Set<Long> teacherServeCourseIds = studentServeService.getTeacherServeCourseIds(user.getId());
+        if(teacherServeCourseIds.contains(courseID)){
+			currentCourseDetail.setEnableAssignHomework(1);
+		}
+
+		currentCourseDetail.setCurrentClassTimes(courseScheduleDao.countClassGroupOverCourseNum(currentCourseDetail.getClassId()));
         SysConfig sysConfig = sysConfigService.findByParamName(SysConfigService.ENABLE_STUDENT_ATTENDANCE_TIME_RANGE);
         SysConfig sysConfigVip = sysConfigService.findByParamName(SysConfigService.ENABLE_STUDENT_ATTENDANCE_TIME_RANGE_VIP);
         currentCourseDetail.setEnableStudentAttendanceTimeRange(sysConfig.getParanValue(Integer.class));

+ 22 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServeServiceImpl.java

@@ -45,6 +45,8 @@ public class StudentServeServiceImpl implements StudentServeService {
     private ExtracurricularExercisesReplyDao extracurricularExercisesReplyDao;
     @Autowired
     private StudentExtracurricularExercisesSituationDao studentExtracurricularExercisesSituationDao;
+    @Autowired
+    private StudentServeService studentServeService;
 
     @Override
     @Transactional(rollbackFor = Exception.class)
@@ -469,8 +471,16 @@ public class StudentServeServiceImpl implements StudentServeService {
     }
 
     @Override
-    public Map<String, Object> checkeIsAssignHomework(Long courseScheduleId, String studentIdsStr) {
+    public Map<String, Object> checkeIsAssignHomework(Long courseScheduleId, String studentIdsStr, Integer teacherId) {
         Map<String, Object> result=new HashMap<>();
+
+        Set<Long> teacherServeCourseIds = studentServeService.getTeacherServeCourseIds(teacherId);
+        if(teacherServeCourseIds.contains(courseScheduleId)){
+            result.put("enableAssignHomework", 0);
+        }else{
+            result.put("enableAssignHomework", 0);
+        }
+
         if(Objects.isNull(courseScheduleId)&&Objects.isNull(studentIdsStr)){
             result.put("isAssignHomework", 0);
             return result;
@@ -511,4 +521,15 @@ public class StudentServeServiceImpl implements StudentServeService {
         result.put("isAssignHomework", 1);
         return result;
     }
+
+    @Override
+    public Set<Long> getTeacherServeCourseIds(Integer teacherId) {
+        List<StudentExtracurricularExercisesSituation> teacherNoStartServices = studentExtracurricularExercisesSituationDao.findTeacherNoStartServices(teacherId);
+        List<String> courseIdsList = teacherNoStartServices.stream().filter(s->StringUtils.isNotBlank(s.getCourseIds())).map(StudentExtracurricularExercisesSituation::getCourseIds).collect(Collectors.toList());
+        Set<Long> courseIds = new HashSet<>();
+        for (String courseIdStr : courseIdsList) {
+            courseIds.addAll(Arrays.stream(courseIdStr.split(",")).mapToLong(Long::valueOf).boxed().collect(Collectors.toSet()));
+        }
+        return courseIds;
+    }
 }

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

@@ -443,4 +443,7 @@
 			#{studentId}
 		</foreach>
 	</select>
+    <select id="findTeacherNoStartServices" resultMap="StudentExtracurricularExercisesSituation">
+		SELECT * FROM student_extracurricular_exercises_situation_ WHERE teacher_id_=#{teacherId} AND actual_exercises_num_&lt;=0 AND serve_type_='HOMEWORK';
+	</select>
 </mapper>

+ 5 - 1
mec-teacher/src/main/java/com/ym/mec/teacher/controller/TeacherCourseHomeworkReplyController.java

@@ -97,7 +97,11 @@ public class TeacherCourseHomeworkReplyController extends BaseController {
     @ApiOperation(value = "检测是否都布置了作业")
     @GetMapping("/checkeIsAssignHomework")
     public HttpResponseResult checkeIsAssignHomework(Long courseScheduleId, String studentIds){
-        return succeed(studentServeService.checkeIsAssignHomework(courseScheduleId, studentIds));
+        SysUser user = sysUserFeignService.queryUserInfo();
+        if(Objects.isNull(user)){
+            return failed(HttpStatus.FORBIDDEN,"请登录");
+        }
+        return succeed(studentServeService.checkeIsAssignHomework(courseScheduleId, studentIds, user.getId()));
     }
 
 }