Browse Source

feat:服务指标明细

Joburgess 4 năm trước cách đây
mục cha
commit
d8e12c5153

+ 1 - 1
mec-auth/mec-auth-server/src/main/resources/bootstrap-test.properties

@@ -3,7 +3,7 @@
 #\u670d\u52a1\u5668\u5730\u5740
 spring.cloud.nacos.config.server-addr=47.114.1.200:8848
 #\u9ed8\u8ba4\u4e3aPublic\u547d\u540d\u7a7a\u95f4,\u53ef\u4ee5\u7701\u7565\u4e0d\u5199
-spring.cloud.nacos.config.namespace=f9d46b0a-9847-48ae-8e4b-216c7a3eb466
+spring.cloud.nacos.config.namespace=f753d9d9-4bb2-4df6-a483-da9e169617c4
 #\u6307\u5b9a\u914d\u7f6e\u7fa4\u7ec4 --\u5982\u679c\u662fPublic\u547d\u540d\u7a7a\u95f4 \u5219\u53ef\u4ee5\u7701\u7565\u7fa4\u7ec4\u914d\u7f6e
 spring.cloud.nacos.config.group=DEFAULT_GROUP
 #\u6587\u4ef6\u540d -- \u5982\u679c\u6ca1\u6709\u914d\u7f6e\u5219\u9ed8\u8ba4\u4e3a ${spring.appliction.name}

+ 5 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/IndexErrorType.java

@@ -20,13 +20,16 @@ public enum IndexErrorType implements BaseEnum<String, IndexErrorType> {
     COURSE_LEAVE_STUDENT_NUM("COURSE_LEAVE_STUDENT_NUM", "学员请假"),
 
     TEACHER_INFO("TEACHER_INFO", "日常行政"),
-    TEACHER_EXCEPTION_ATTENDANCE("TEACHER_EXCEPTION_ATTENDANCE", "课程考勤异常"),
-    TEACHER_NOT_A_CLASS("TEACHER_NOT_A_CLASS", "课程异常"),
     TEACHER_LEAVE("TEACHER_LEAVE", "老师请假"),
     TEACHER_EXPECT_SALARY_BE_LOW("TEACHER_EXPECT_SALARY_BE_LOW", "预计课酬较低"),
     INSPECTION_ITEM("INSPECTION_ITEM", "乐团巡查任务未计划"),
     INSPECTION_ITEM_PLAN("INSPECTION_ITEM_PLAN", "乐团巡查任务未提交"),
     STUDENT_VISIT("STUDENT_VISIT", "回访任务未完成"),
+
+    ATTENDANCE_SERVE("ATTENDANCE_SERVE", "考勤及服务"),
+    TEACHER_EXCEPTION_ATTENDANCE("TEACHER_EXCEPTION_ATTENDANCE", "课程考勤异常"),
+    TEACHER_NOT_A_CLASS("TEACHER_NOT_A_CLASS", "课程异常"),
+    TEACHER_SERVE_ERROR("TEACHER_SERVE_ERROR", "服务指标异常"),
     ;
 
     private String code;

+ 60 - 18
mec-biz/src/main/java/com/ym/mec/biz/service/impl/IndexBaseMonthDataServiceImpl.java

@@ -51,6 +51,8 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 	private SysUserFeignService sysUserFeignService;
 	@Autowired
 	private SysMessageDao sysMessageDao;
+	@Autowired
+	private StudentExtracurricularExercisesSituationDao studentExtracurricularExercisesSituationDao;
 
 	private static ThreadLocal<Set<Integer>> organIds = new ThreadLocal<Set<Integer>>(){
 		@Override
@@ -323,12 +325,6 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			three.setDesc(IndexErrorType.TEACHER_INFO.getMsg());
 			List<IndexErrInfoDto> threeChild = new ArrayList<>();
 
-			int attendanceError = indexBaseMonthDataDao.getAttendanceError(organIds,startTime);
-			threeChild.add(new IndexErrInfoDto(IndexErrorType.TEACHER_EXCEPTION_ATTENDANCE, IndexErrorType.TEACHER_EXCEPTION_ATTENDANCE.getMsg(), attendanceError, null));
-
-			int noAttendance = indexBaseMonthDataDao.getNoAttendance(organIds,startTime);
-			threeChild.add(new IndexErrInfoDto(IndexErrorType.TEACHER_NOT_A_CLASS, IndexErrorType.TEACHER_NOT_A_CLASS.getMsg(), noAttendance, null));
-
 //			int teacherLeave = indexBaseMonthDataDao.queryTeacherLeave(organIdsStr,startTime);
 //			threeChild.add(new IndexErrInfoDto(IndexErrorType.TEACHER_LEAVE, IndexErrorType.TEACHER_LEAVE.getMsg(),teacherLeave, null));
 
@@ -351,6 +347,34 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			all.add(three);
 		}
 
+		if(IndexErrorType.ATTENDANCE_SERVE.equals(errorType)){
+			IndexErrInfoDto<IndexErrInfoDto> four = new IndexErrInfoDto<>();
+			four.setErrorType(IndexErrorType.ATTENDANCE_SERVE);
+			four.setDesc(IndexErrorType.ATTENDANCE_SERVE.getMsg());
+			List<IndexErrInfoDto> fourChild = new ArrayList<>();
+
+			int attendanceError = indexBaseMonthDataDao.getAttendanceError(organIds,startTime);
+			fourChild.add(new IndexErrInfoDto(IndexErrorType.TEACHER_EXCEPTION_ATTENDANCE, IndexErrorType.TEACHER_EXCEPTION_ATTENDANCE.getMsg(), attendanceError, null));
+
+			int noAttendance = indexBaseMonthDataDao.getNoAttendance(organIds,startTime);
+			fourChild.add(new IndexErrInfoDto(IndexErrorType.TEACHER_NOT_A_CLASS, IndexErrorType.TEACHER_NOT_A_CLASS.getMsg(), noAttendance, null));
+
+			Map<String, Object> params = new HashMap<>();
+			LocalDate nowDate = LocalDateTime.now(DateUtil.zoneId).toLocalDate();
+			LocalDate monDayDate = nowDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue());
+			LocalDate sunDayDate = nowDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.SUNDAY.getValue());
+			params.put("organIds", organIds);
+			params.put("monday",monDayDate.toString());
+			params.put("sunday",sunDayDate.toString());
+			params.put("unDone",1);
+			int serveErrTeacherNum = studentExtracurricularExercisesSituationDao.countTeacherServeInfo(params);
+			fourChild.add(new IndexErrInfoDto(IndexErrorType.TEACHER_SERVE_ERROR, IndexErrorType.TEACHER_SERVE_ERROR.getMsg(), serveErrTeacherNum, null));
+
+			four.setNum(fourChild.stream().mapToInt(IndexErrInfoDto::getNum).sum());
+			four.setResult(fourChild);
+			all.add(four);
+		}
+
 		Map<String, Object> result = new HashMap<>(2);
 		result.put("totalNum", all.stream().mapToInt(IndexErrInfoDto::getNum).sum());
 		result.put("data", all);
@@ -424,18 +448,6 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 		resultMap.put("studentInfo",flag2);
 		boolean flag3 = false;
 		if(!flag3){
-			int attendanceError = indexBaseMonthDataDao.getAttendanceError(organIds,startTime);
-			if(attendanceError > 0){
-				flag3 = true;
-			}
-		}
-		if(!flag3){
-			int noAttendance = indexBaseMonthDataDao.getNoAttendance(organIds,startTime);
-			if(noAttendance > 0){
-				flag3 = true;
-			}
-		}
-		if(!flag3){
 			int teacherLeave = indexBaseMonthDataDao.queryTeacherLeave(organIdsStr,startTime);
 			if(teacherLeave > 0){
 				flag3 = true;
@@ -467,6 +479,36 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			}
 		}
 		resultMap.put("teacherInfo",flag3);
+
+		boolean flag4 = false;
+		if(!flag4){
+			int attendanceError = indexBaseMonthDataDao.getAttendanceError(organIds,startTime);
+			if(attendanceError > 0){
+				flag4 = true;
+			}
+		}
+		if(!flag4){
+			int noAttendance = indexBaseMonthDataDao.getNoAttendance(organIds,startTime);
+			if(noAttendance > 0){
+				flag4 = true;
+			}
+		}
+		if(!flag4){
+			Map<String, Object> params = new HashMap<>();
+			LocalDate nowDate = LocalDateTime.now(DateUtil.zoneId).toLocalDate();
+			LocalDate monDayDate = nowDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue());
+			LocalDate sunDayDate = nowDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.SUNDAY.getValue());
+			params.put("organIds", organIds);
+			params.put("monday",monDayDate.toString());
+			params.put("sunday",sunDayDate.toString());
+			params.put("unDone",1);
+			int serveErrTeacherNum = studentExtracurricularExercisesSituationDao.countTeacherServeInfo(params);
+			if(serveErrTeacherNum > 0){
+				flag4 = true;
+			}
+		}
+		resultMap.put("attendanceServe",flag4);
+
 		SysUser sysUser = sysUserFeignService.queryUserInfo();
 		if (sysUser == null) {
 			throw new BizException("用户信息获取失败");

+ 36 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentExtracurricularExercisesSituationServiceImpl.java

@@ -58,6 +58,8 @@ public class StudentExtracurricularExercisesSituationServiceImpl extends BaseSer
 	private SubjectDao subjectDao;
 	@Autowired
 	private CourseHomeworkDao courseHomeworkDao;
+	@Autowired
+	private ClassGroupDao classGroupDao;
 
 	@Override
 	public BaseDAO<Long, StudentExtracurricularExercisesSituation> getDAO() {
@@ -328,12 +330,21 @@ public class StudentExtracurricularExercisesSituationServiceImpl extends BaseSer
 			pageInfo.setTotal(count);
 			params.put("offset", pageInfo.getOffset());
 			List<CourseSchedule> courseSchedules = courseScheduleDao.queryByCourseScheduleIds(params);
+			List<Integer> classGroupIds = courseSchedules.stream().map(CourseSchedule::getClassGroupId).collect(Collectors.toList());
+			List<ClassGroup> classGroups = classGroupDao.findByClassGroupIds(classGroupIds, null);
+			Map<Integer, ClassGroup> idClassGroupMap = classGroups.stream().collect(Collectors.toMap(ClassGroup::getId, c -> c, (c1, c2) -> c1));
+
 			List<CourseHomework> courseHomeworks = courseHomeworkDao.findByCourseSchedules(new ArrayList<>(courseIds));
 			Map<Long, Long> courseHomeworkMap = new HashMap<>();
 			if(!CollectionUtils.isEmpty(courseHomeworks)){
 				courseHomeworkMap = courseHomeworks.stream().collect(Collectors.groupingBy(CourseHomework::getCourseScheduleId, Collectors.counting()));
 			}
+			List<Integer> subjectIds = new ArrayList<>();
 			for (CourseSchedule courseSchedule : courseSchedules) {
+				if(idClassGroupMap.containsKey(courseSchedule.getClassGroupId())){
+					List<Integer> ids = Arrays.stream(idClassGroupMap.get(courseSchedule.getClassGroupId()).getSubjectIdList().split(",")).map(id -> Integer.valueOf(id)).collect(Collectors.toList());
+					subjectIds.addAll(ids);
+				}
 				TeacherServeHomeworkDto tshd = new TeacherServeHomeworkDto();
 				BeanUtils.copyProperties(courseSchedule,tshd);
 				tshd.setStudentNum(courseNumMap.get(courseSchedule.getId()).intValue());
@@ -342,6 +353,17 @@ public class StudentExtracurricularExercisesSituationServiceImpl extends BaseSer
 				}
 				dataList.add(tshd);
 			}
+			List<Subject> subjects = subjectDao.findBySubjectIds(new ArrayList<>(subjectIds));
+			for (TeacherServeHomeworkDto teacherServeHomeworkDto : dataList) {
+				if(idClassGroupMap.containsKey(teacherServeHomeworkDto.getClassGroupId())){
+					ClassGroup classGroup = idClassGroupMap.get(teacherServeHomeworkDto.getClassGroupId());
+					if(StringUtils.isNotBlank(classGroup.getSubjectIdList())){
+						Set<Integer> sids = Arrays.stream(classGroup.getSubjectIdList().split(",")).map(id -> Integer.valueOf(id)).collect(Collectors.toSet());
+						List<String> subjectNames = subjects.stream().filter(s -> sids.contains(s.getId())).map(Subject::getName).collect(Collectors.toList());
+						teacherServeHomeworkDto.setSubjectName(StringUtils.join(subjectNames, ","));
+					}
+				}
+			}
 		}
 		if (count == 0) {
 			dataList = new ArrayList<>();
@@ -379,6 +401,11 @@ public class StudentExtracurricularExercisesSituationServiceImpl extends BaseSer
 			pageInfo.setTotal(count);
 			params.put("offset", pageInfo.getOffset());
 			List<Student> students = studentDao.queryByIds(params);
+			List<SimpleUserDto> usersSimpleInfo = teacherDao.getUsersSimpleInfo(new ArrayList<>(studentIds));
+			Map<Integer, String> idNameMap = new HashMap<>();
+			if(!CollectionUtils.isEmpty(usersSimpleInfo)){
+				idNameMap = usersSimpleInfo.stream().collect(Collectors.toMap(SimpleUserDto::getUserId, s -> s.getNickName(), (s1, s2) -> s1));
+			}
 			Set<Integer> subjectIds = new HashSet<>();
 			for (Student student : students) {
 				if(StringUtils.isNotBlank(student.getSubjectIdList())){
@@ -397,9 +424,15 @@ public class StudentExtracurricularExercisesSituationServiceImpl extends BaseSer
 				dataList.add(tsed);
 			}
 			List<Subject> subjects = subjectDao.findBySubjectIds(new ArrayList<>(subjectIds));
-			Map<Integer, Subject> idSubjectMap = new HashMap<>();
-			if(!CollectionUtils.isEmpty(subjects)){
-				idSubjectMap = subjects.stream().collect(Collectors.toMap(Subject::getId, s->s, (s1, s2)->s1));
+			for (TeacherServeExtraDto teacherServeExtraDto : dataList) {
+				if(idNameMap.containsKey(teacherServeExtraDto.getUserId())){
+					teacherServeExtraDto.setUsername(idNameMap.get(teacherServeExtraDto.getUserId()));
+				}
+				if(StringUtils.isNotBlank(teacherServeExtraDto.getSubjectIdList())){
+					Set<Integer> sids = Arrays.stream(teacherServeExtraDto.getSubjectIdList().split(",")).map(id -> Integer.valueOf(id)).collect(Collectors.toSet());
+					List<String> subjectNames = subjects.stream().filter(s -> sids.contains(s.getId())).map(Subject::getName).collect(Collectors.toList());
+					teacherServeExtraDto.setSubjectNames(StringUtils.join(subjectNames, ","));
+				}
 			}
 		}
 		if (count == 0) {

+ 1 - 1
mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -3630,7 +3630,7 @@
         GROUP BY cssp.user_id_
     </select>
 
-    <select id="queryByCourseScheduleIds" resultType="com.ym.mec.biz.dal.entity.CourseSchedule">
+    <select id="queryByCourseScheduleIds" resultMap="CourseSchedule">
         SELECT
         <include refid="resultSql" />
         FROM course_schedule cs

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

@@ -497,20 +497,20 @@
 			<if test="teacherId!=null">
 				AND sees.teacher_id_ = #{teacherId}
 			</if>
-			<if test="unDone!=null and unDone==0">
+			<if test="unDone!=null and unDone==1">
 				AND sees.expect_exercises_num_>sees.actual_exercises_num_
 			</if>
-			<if test="unDone!=null and unDone==1">
+			<if test="unDone!=null and unDone==0">
 				AND sees.expect_exercises_num_=sees.actual_exercises_num_
 			</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_='SERVE')
+				AND NOT EXISTS (SELECT id_ FROM teacher_remind WHERE teacher_id_=sees.teacher_id_ AND monday_ BETWEEN #{monday} AND #{sunday} AND type_='SERVE')
 			</if>
 			<if test="reminded!=null and reminded==1">
-				AND EXISTS (SELECT id_ FROM teacher_remind WHERE teacher_id_=sees.teacher_id_ AND monday_=sees.monday_ AND type_='SERVE')
+				AND EXISTS (SELECT id_ FROM teacher_remind WHERE teacher_id_=sees.teacher_id_ AND monday_ BETWEEN #{monday} AND #{sunday} AND type_='SERVE')
 			</if>
 			<if test="operatorId!=null">
-				AND EXISTS (SELECT id_ FROM teacher_remind WHERE operator_id_=#{operatorId} AND teacher_id_=sees.teacher_id_ AND monday_=sees.monday_ AND type_='SERVE')
+				AND EXISTS (SELECT id_ FROM teacher_remind WHERE operator_id_=#{operatorId} AND teacher_id_=sees.teacher_id_ AND monday_ BETWEEN #{monday} AND #{sunday} AND type_='SERVE')
 			</if>
 		</where>
 	</sql>

+ 2 - 4
mec-web/src/main/java/com/ym/mec/web/controller/StudentExtracurricularExercisesSituationController.java

@@ -152,8 +152,7 @@ public class StudentExtracurricularExercisesSituationController extends BaseCont
         if (sysUser == null) {
             return failed("用户信息获取失败");
         }
-        studentExtracurricularExercisesSituationService.queryTeacherServeHomeworkDetail(queryInfo);
-        return succeed();
+        return succeed(studentExtracurricularExercisesSituationService.queryTeacherServeHomeworkDetail(queryInfo));
     }
 
     @ApiOperation(value = "教师服务课外作业")
@@ -164,8 +163,7 @@ public class StudentExtracurricularExercisesSituationController extends BaseCont
         if (sysUser == null) {
             return failed("用户信息获取失败");
         }
-        studentExtracurricularExercisesSituationService.queryTeacherServeExtraDetail(queryInfo);
-        return succeed();
+        return succeed(studentExtracurricularExercisesSituationService.queryTeacherServeExtraDetail(queryInfo));
     }
 
 }