| 
					
				 | 
			
			
				@@ -7,10 +7,7 @@ import com.ym.mec.biz.dal.dto.CourseHomeworkStudentDetailDto; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.biz.dal.dto.SimpleUserDto; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.biz.dal.dto.StudentCourseHomeworkDto; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.biz.dal.dto.StudentHomeworkRecordDto; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.entity.CourseHomework; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.entity.CourseSchedule; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.entity.CourseScheduleReview; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.entity.StudentCourseHomework; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.ym.mec.biz.dal.entity.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.biz.dal.enums.MessageTypeEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.biz.dal.enums.YesOrNoEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ym.mec.biz.dal.page.CourseHomeworkQueryInfo; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -32,6 +29,9 @@ import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.transaction.annotation.Transactional; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.util.CollectionUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.time.DayOfWeek; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.time.LocalDate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.time.LocalDateTime; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.stream.Collectors; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -57,6 +57,8 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private TeacherDao teacherDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private SysConfigDao sysConfigDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private StudentExtracurricularExercisesSituationDao studentExtracurricularExercisesSituationDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public BaseDAO<Long, StudentCourseHomework> getDAO() { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -104,6 +106,18 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         courseHomework.setCompletedNum(studentCourseHomeworkDao.countCompletedStudentNum(bean.getCourseHomeworkId())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         courseHomeworkService.update(courseHomework); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        LocalDate nowDate = LocalDateTime.now(DateUtil.zoneId).toLocalDate(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        LocalDate monDayDate = nowDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        LocalDate createDateTime = LocalDateTime.ofInstant(existHomework.getCreateTime().toInstant(), DateUtil.zoneId).toLocalDate(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        LocalDate createMonday = createDateTime.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(createDateTime.isBefore(monDayDate)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            StudentExtracurricularExercisesSituation studentExercisesSituation = studentExtracurricularExercisesSituationDao.findStudentExercisesSituationsWithMonDay(createMonday.toString(), existHomework.getUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(Objects.nonNull(studentExercisesSituation)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                studentExercisesSituation.setExercisesReplyNum(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                studentExtracurricularExercisesSituationDao.update(studentExercisesSituation); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         CourseHomework temp = courseHomeworkService.get(courseHomework.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (temp.getExpectNum().equals(courseHomework.getCompletedNum())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             CourseScheduleReview review = courseScheduleReviewDao.findByCourseScheduleAndStudent(bean.getCourseScheduleId(), bean.getUserId()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -169,6 +183,23 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (Objects.nonNull(byTeacherAndCourseHomewok)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             byStudentAndCourseHomewok.setIsReplied(YesOrNoEnum.YES); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             studentCourseHomeworkDao.update(byStudentAndCourseHomewok); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            LocalDate nowDate = LocalDateTime.now(DateUtil.zoneId).toLocalDate(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            LocalDate monDayDate = nowDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            LocalDate createDateTime = LocalDateTime.ofInstant(byStudentAndCourseHomewok.getCreateTime().toInstant(), DateUtil.zoneId).toLocalDate(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            LocalDate createMonday = createDateTime.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(createDateTime.isBefore(monDayDate)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                StudentExtracurricularExercisesSituation studentExercisesSituation = studentExtracurricularExercisesSituationDao.findStudentExercisesSituationsWithMonDay(createMonday.toString(), byStudentAndCourseHomewok.getUserId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if(Objects.nonNull(studentExercisesSituation)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if(new Integer(1).equals(byStudentAndCourseHomewok.getIsReplied())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        studentExercisesSituation.setExercisesMessageNum(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if(new Integer(1).equals(byStudentAndCourseHomewok.getIsRepliedTimely())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        studentExercisesSituation.setExercisesMessageTimelyNum(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    studentExtracurricularExercisesSituationDao.update(studentExercisesSituation); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 |