Pārlūkot izejas kodu

feat:服务指标未完成提醒

Joburgess 4 gadi atpakaļ
vecāks
revīzija
10ce5b4317

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

@@ -120,6 +120,7 @@ public interface StudentExtracurricularExercisesSituationDao extends BaseDAO<Lon
 
     List<StudentExtracurricularExercisesSituation> findTeacherServeWithDate(@Param("monday") String monday,
                                                                             @Param("sunday") String sunday,
-                                                                            @Param("teacherIds") List<Integer> teacherIds);
+                                                                            @Param("teacherIds") List<Integer> teacherIds,
+                                                                            @Param("serveType") String serveType);
 
 }

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/StudentExtracurricularExercisesSituationService.java

@@ -47,6 +47,8 @@ public interface StudentExtracurricularExercisesSituationService extends BaseSer
      */
     PageInfo<TeacherServeDto> queryTeacherServeInfo(TeacherServeQueryInfo queryInfo);
 
+    List<Long> findTeacherRightServeIds(String monday, String sunday);
+
     /**
      * @describe 教师作业布置提醒
      * @author Joburgess

+ 4 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/IndexBaseMonthDataServiceImpl.java

@@ -8,6 +8,7 @@ import com.ym.mec.biz.dal.entity.IndexErrInfoDto;
 import com.ym.mec.biz.dal.entity.Organization;
 import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.dal.page.IndexDataQueryInfo;
+import com.ym.mec.biz.service.StudentExtracurricularExercisesSituationService;
 import com.ym.mec.common.constant.CommonConstants;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
@@ -53,6 +54,8 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 	private SysMessageDao sysMessageDao;
 	@Autowired
 	private StudentExtracurricularExercisesSituationDao studentExtracurricularExercisesSituationDao;
+	@Autowired
+	private StudentExtracurricularExercisesSituationService studentExtracurricularExercisesSituationService;
 
 	private static ThreadLocal<Set<Integer>> organIds = new ThreadLocal<Set<Integer>>(){
 		@Override
@@ -367,6 +370,7 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			params.put("monday",monDayDate.toString());
 			params.put("sunday",sunDayDate.toString());
 			params.put("unDone",1);
+			params.put("rightServeIds", studentExtracurricularExercisesSituationService.findTeacherRightServeIds(monDayDate.toString(), sunDayDate.toString()));
 			int serveErrTeacherNum = studentExtracurricularExercisesSituationDao.countTeacherServeInfo(params);
 			fourChild.add(new IndexErrInfoDto(IndexErrorType.TEACHER_SERVE_ERROR, IndexErrorType.TEACHER_SERVE_ERROR.getMsg(), serveErrTeacherNum, null));
 

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

@@ -3,6 +3,7 @@ package com.ym.mec.biz.service.impl;
 import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.biz.dal.enums.CourseStatusEnum;
 import com.ym.mec.biz.dal.enums.GroupType;
 import com.ym.mec.biz.dal.enums.MessageTypeEnum;
 import com.ym.mec.biz.dal.enums.TeacherRemindTypeEnum;
@@ -184,6 +185,10 @@ public class StudentExtracurricularExercisesSituationServiceImpl extends BaseSer
 		PageInfo<TeacherServeDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
 		Map<String, Object> params = new HashMap<>();
 		MapUtil.populateMap(params, queryInfo);
+		if(Objects.nonNull(queryInfo.getUnDone())){
+			List<Long> serveIds = findTeacherRightServeIds(queryInfo.getMonday(), queryInfo.getSunday());
+			params.put("rightServeIds", serveIds);
+		}
 
 		List<TeacherServeDto> dataList = null;
 		int count = studentExtracurricularExercisesSituationDao.countTeacherServeInfo(params);
@@ -197,7 +202,7 @@ public class StudentExtracurricularExercisesSituationServiceImpl extends BaseSer
 			if(!CollectionUtils.isEmpty(teacherReminds)){
 				mondayTeacherRemindMap = teacherReminds.stream().collect(Collectors.groupingBy(e -> DateUtil.dateToString(e.getMonday(), "yyyy-MM-dd"), Collectors.groupingBy(TeacherRemind::getTeacherId)));
 			}
-			List<StudentExtracurricularExercisesSituation> teacherServeWithDate = studentExtracurricularExercisesSituationDao.findTeacherServeWithDate(queryInfo.getMonday(), queryInfo.getSunday(), teacherIds);
+			List<StudentExtracurricularExercisesSituation> teacherServeWithDate = studentExtracurricularExercisesSituationDao.findTeacherServeWithDate(queryInfo.getMonday(), queryInfo.getSunday(), teacherIds, null);
 			Map<Integer, List<StudentExtracurricularExercisesSituation>> teacherServeMap = teacherServeWithDate.stream().filter(s -> "HOMEWORK".equals(s.getServeType())).collect(Collectors.groupingBy(StudentExtracurricularExercisesSituation::getTeacherId));
 			for (TeacherServeDto teacherServeDto : dataList) {
 				if(teacherServeMap.containsKey(teacherServeDto.getTeacherId())){
@@ -232,6 +237,44 @@ public class StudentExtracurricularExercisesSituationServiceImpl extends BaseSer
 		return pageInfo;
 	}
 
+	public List<Long> findTeacherRightServeIds(String monday, String sunday){
+		List<Long> serveIds = new ArrayList<>();
+		List<StudentExtracurricularExercisesSituation> teacherServeWithDate = studentExtracurricularExercisesSituationDao.findTeacherServeWithDate(monday, sunday, null, null);
+		if(CollectionUtils.isEmpty(teacherServeWithDate)){
+			return serveIds;
+		}
+		Set<Long> courseIds = new HashSet<>();
+		for (StudentExtracurricularExercisesSituation studentExtracurricularExercisesSituation : teacherServeWithDate) {
+			if(StringUtils.isBlank(studentExtracurricularExercisesSituation.getCourseIds())){
+				continue;
+			}
+			Set<Long> ids = Arrays.stream(studentExtracurricularExercisesSituation.getCourseIds().split(",")).map(s -> Long.valueOf(s)).collect(Collectors.toSet());
+			courseIds.addAll(ids);
+		}
+		List<CourseSchedule> courseSchedules = courseScheduleDao.findByCourseScheduleIds(new ArrayList<>(courseIds));
+		Set<Long> overCourseIds = courseSchedules.stream().filter(c->CourseStatusEnum.OVER.equals(c.getStatus())).map(CourseSchedule::getId).collect(Collectors.toSet());
+		for (StudentExtracurricularExercisesSituation sees : teacherServeWithDate) {
+			if(sees.getExpectExercisesNum()>=sees.getActualExercisesNum()){
+				serveIds.add(sees.getId());
+			}else{
+				if(StringUtils.isBlank(sees.getCourseIds())){
+					continue;
+				}
+				Set<Long> ids = Arrays.stream(sees.getCourseIds().split(",")).map(s -> Long.valueOf(s)).collect(Collectors.toSet());
+				int overCourseNum = 0;
+				for (Long courseId : ids) {
+					if(overCourseIds.contains(courseId)){
+						overCourseNum+=1;
+					}
+				}
+				if(sees.getExpectExercisesNum()>=overCourseNum){
+					serveIds.add(sees.getId());
+				}
+			}
+		}
+		return serveIds;
+	}
+
 	@Override
 	public List<Map<String, Object>> findServiceStudentDetail(StudentServiceDetailQueryInfo queryInfo) {
 		PageInfo<StudentServiceDetailDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
@@ -443,7 +486,10 @@ public class StudentExtracurricularExercisesSituationServiceImpl extends BaseSer
 				}
 				dataList.add(tsed);
 			}
-			List<Subject> subjects = subjectDao.findBySubjectIds(new ArrayList<>(subjectIds));
+			List<Subject> subjects = new ArrayList<>();
+			if(!CollectionUtils.isEmpty(subjectIds)){
+				subjectDao.findBySubjectIds(new ArrayList<>(subjectIds));
+			}
 			for (TeacherServeExtraDto teacherServeExtraDto : dataList) {
 				if(idNameMap.containsKey(teacherServeExtraDto.getUserId())){
 					teacherServeExtraDto.setUsername(idNameMap.get(teacherServeExtraDto.getUserId()));

+ 23 - 4
mec-biz/src/main/resources/config/mybatis/StudentExtracurricularExercisesSituationMapper.xml

@@ -499,9 +499,21 @@
 			</if>
 			<if test="unDone!=null and unDone==1">
 				AND sees.expect_exercises_num_>sees.actual_exercises_num_
+				<if test="rightServeIds!=null and rightServeIds.size()>0">
+					AND sees.id_ NOT IN
+					<foreach collection="rightServeIds" item="rightServeId" open="(" close=")" separator=",">
+						#{rightServeId}
+					</foreach>
+				</if>
 			</if>
 			<if test="unDone!=null and unDone==0">
 				AND sees.expect_exercises_num_=sees.actual_exercises_num_
+				<if test="rightServeIds!=null and rightServeIds.size()>0">
+					AND sees.id_ IN
+					<foreach collection="rightServeIds" item="rightServeId" open="(" close=")" separator=",">
+						#{rightServeId}
+					</foreach>
+				</if>
 			</if>
 			<if test="reminded!=null and reminded==0">
 				AND NOT EXISTS (SELECT id_ FROM teacher_remind WHERE teacher_id_=sees.teacher_id_ AND monday_ = sees.monday_ AND type_='SERVICE')
@@ -548,9 +560,16 @@
 	</select>
 
 	<select id="findTeacherServeWithDate" resultMap="StudentExtracurricularExercisesSituation">
-		SELECT * FROM student_extracurricular_exercises_situation_ WHERE monday_ BETWEEN #{monday} AND #{sunday} AND teacher_id_ IN
-		<foreach collection="teacherIds" item="teacherId" open="(" close=")" separator=",">
-			#{teacherId}
-		</foreach>
+		SELECT * FROM student_extracurricular_exercises_situation_
+		WHERE monday_ BETWEEN #{monday} AND #{sunday}
+			<if test="serveType!=null and serveType!=''">
+				AND serve_type_=#{serveType}
+			</if>
+		  <if test="teacherIds!=null and teacherIds.size()>0">
+			  AND teacher_id_ IN
+			  <foreach collection="teacherIds" item="teacherId" open="(" close=")" separator=",">
+				  #{teacherId}
+			  </foreach>
+		  </if>
 	</select>
 </mapper>