瀏覽代碼

作业提交

zouxuan 3 年之前
父節點
當前提交
840b577408

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

@@ -184,4 +184,10 @@ public interface StudentExtracurricularExercisesSituationDao extends BaseDAO<Lon
     List<TeacherServeDto> queryTeacherPerformanceIndicator(Map<String, Object> params);
 
     void batchDelete(@Param("situationIds") List<Long> situationIds);
+
+    Date getHomeworkSituations(@Param("courseScheduleId") Long courseScheduleId,
+                                                                   @Param("musicGroupId") String musicGroupId,
+                                                                   @Param("serveType") String serveType,
+                                                                   @Param("month") Date month,
+                                                                   @Param("userId") Integer userId);
 }

+ 14 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentCourseHomeworkServiceImpl.java

@@ -140,8 +140,21 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
             throw new BizException("作业不存在");
         }
         Date now = new Date();
+
+        if (DateUtil.daysBetween(existHomework.getCreateTime(), now) >= 7) {
+            throw new BizException("该作业已超出可提交时间范围,无法提交作业。");
+        }
+        CourseSchedule courseSchedule = courseScheduleDao.get(bean.getCourseScheduleId());
         //若本周有当前课程所在乐团的服务指标,那么在课程开始当天之后不能再提交作业
-//        studentExtracurricularExercisesSituationDao.getHomeworkSituations(existHomework.getCourseScheduleId(),);
+        DateUtil.getFirstDayOfMonth(now);
+        Date classDate = studentExtracurricularExercisesSituationDao.getHomeworkSituations(courseSchedule.getId(),courseSchedule.getMusicGroupId(),"HOMEWORK",
+                        DateUtil.getFirstDayOfMonth(now),bean.getUserId());
+        if(Objects.nonNull(classDate)){
+            int i = classDate.compareTo(DateUtil.stringToDate(DateUtil.format(now, DateUtil.ISO_EXPANDED_DATE_FORMAT), DateUtil.ISO_EXPANDED_DATE_FORMAT));
+            if(i <= 0){
+                throw new BizException("该作业已超出可提交时间范围,无法提交作业。");
+            }
+        }
 //        List<StudentExtracurricularExercisesSituation> exercisesSituations = studentExtracurricularExercisesSituationDao.findServiceWithCourse(
 //                DateUtil.format(DateUtil.addDays(DateUtil.getLastDayOfMonth(now), 1), DateUtil.ISO_EXPANDED_DATE_FORMAT),
 //                existHomework.getCourseScheduleId());
@@ -152,16 +165,12 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
 //                throw new BizException("该作业已超出可提交时间范围,无法提交作业。");
 //            }
 //        }
-        if (DateUtil.daysBetween(existHomework.getCreateTime(), now) >= 7) {
-            throw new BizException("该作业已超出可提交时间范围,无法提交作业。");
-        }
 
 //        boolean push = Objects.isNull(existHomework.getAttachments());
         boolean push = true;
         bean.setSubmitTime(now);
         super.update(bean);
         bean = studentCourseHomeworkDao.get(bean.getId());
-        CourseSchedule courseSchedule = courseScheduleDao.get(bean.getCourseScheduleId());
 
         CourseHomework courseHomework = courseHomeworkDao.get(bean.getCourseHomeworkId());
         courseHomework.setGroupType(courseSchedule.getGroupType());

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

@@ -799,4 +799,10 @@
 		ORDER BY sees.teacher_id_
 		<include refid="global.limit"></include>
 	</select>
+	<select id="getHomeworkSituations" resultType="java.util.Date">
+		SELECT cs.class_date_ FROM student_extracurricular_exercises_situation_ sees
+		LEFT JOIN course_schedule cs ON FIND_IN_SET(cs.id_,sees.course_ids_)
+		WHERE sees.serve_type_ = #{serveType} AND cs.id_ != #{courseScheduleId} AND cs.music_group_id_ = #{musicGroupId}
+		AND sees.monday_ = #{month} AND sees.student_id_ = #{userId}
+	</select>
 </mapper>