Browse Source

首页异常提醒关联教务老师显示

zouxuan 4 years ago
parent
commit
addf3328d8

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ClassGroupDao.java

@@ -811,4 +811,11 @@ public interface ClassGroupDao extends BaseDAO<Integer, ClassGroup> {
      * @return
      */
     List<ClassGroupTeachersDto> queryClassGroupPage(Map<String, Object> params);
+
+    /**
+     * 获取教务老师关联的班级列表
+     * @param userId
+     * @return
+     */
+    List<Integer> queryGroupClassGroupIds(Integer userId);
 }

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

@@ -165,7 +165,7 @@ public interface IndexBaseMonthDataDao extends BaseDAO<Long, IndexBaseMonthData>
      * @param organIds
      * @return
      */
-    int getAttendanceError(@Param("organIds") Set<Integer> organIds,@Param("startTime") String startTime);
+    int getAttendanceError(@Param("organIds") Set<Integer> organIds, @Param("startTime") String startTime, @Param("classGroupIds") List<Integer> classGroupIds);
 
     /**
      * 获取旷课考勤

+ 11 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/IndexBaseMonthDataServiceImpl.java

@@ -57,6 +57,8 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 	private StudentExtracurricularExercisesSituationDao studentExtracurricularExercisesSituationDao;
 	@Autowired
 	private StudentExtracurricularExercisesSituationService studentExtracurricularExercisesSituationService;
+	@Autowired
+	private ClassGroupDao classGroupDao;
 
 	private static ThreadLocal<Set<Integer>> organIds = new ThreadLocal<Set<Integer>>(){
 		@Override
@@ -292,6 +294,14 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 		Date date = new Date();
 
 		List<IndexErrInfoDto> all = new ArrayList<>();
+		SysUser sysUser = sysUserFeignService.queryUserInfo();
+		List<Integer> userRole = employeeDao.queryUserRole(sysUser.getId());
+		//如果当前用户只有教务老师角色,那么只能看到他所管理的课程组的信息
+		List<Integer> classGroupIds = null;
+		if (userRole.size() == 1 && userRole.contains(SysUserRole.EDUCATIONAL_TEACHER)) {
+			//获取教务老师关联的班级列表
+			classGroupIds = classGroupDao.queryGroupClassGroupIds(sysUser.getId());
+		}
 
 		if(IndexErrorType.MUSIC_PATROL.equals(errorType)){
 			IndexErrInfoDto<IndexErrInfoDto> one = new IndexErrInfoDto<>();
@@ -345,8 +355,6 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			int lowTeacherSalary = indexBaseMonthDataDao.queryLowTeacherSalary(organIdsStr,monthStr);
 			threeChild.add(new IndexErrInfoDto(IndexErrorType.TEACHER_EXPECT_SALARY_BE_LOW, IndexErrorType.TEACHER_EXPECT_SALARY_BE_LOW.getMsg(),lowTeacherSalary, null));
 
-			SysUser sysUser = sysUserFeignService.queryUserInfo();
-			List<Integer> userRole = employeeDao.queryUserRole(sysUser.getId());
 			Integer userId = null;
 			if (!userRole.contains(SysUserRole.SECTION_MANAGER) && !sysUser.getIsSuperAdmin()) {
 				userId = sysUser.getId();
@@ -371,7 +379,7 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			four.setDesc(IndexErrorType.ATTENDANCE_SERVE.getMsg());
 			List<IndexErrInfoDto> fourChild = new ArrayList<>();
 
-			int attendanceError = indexBaseMonthDataDao.getAttendanceError(organIds,startTime);
+			int attendanceError = indexBaseMonthDataDao.getAttendanceError(organIds,startTime,classGroupIds);
 			fourChild.add(new IndexErrInfoDto(IndexErrorType.TEACHER_EXCEPTION_ATTENDANCE, IndexErrorType.TEACHER_EXCEPTION_ATTENDANCE.getMsg(), attendanceError, null));
 
 			int noAttendance = indexBaseMonthDataDao.getNoAttendance(organIds,startTime);

+ 14 - 0
mec-biz/src/main/resources/config/mybatis/ClassGroupMapper.xml

@@ -1464,4 +1464,18 @@
         ORDER BY cg.id_ DESC
         <include refid="global.limit"/>
     </select>
+    <select id="queryGroupClassGroupIds" resultType="java.lang.Integer">
+        SELECT GROUP_CONCAT(c.id_) FROM (
+        SELECT cg.id_ FROM music_group mg
+        LEFT JOIN class_group cg ON cg.music_group_id_ = mg.id_
+        WHERE mg.educational_teacher_id_ = #{userId} AND cg.group_type_ = 'MUSIC' AND mg.status_ = 'PROGRESS'
+        UNION
+        SELECT cg.id_ FROM vip_group vg
+        LEFT JOIN class_group cg ON cg.music_group_id_ = vg.id_
+        WHERE vg.educational_teacher_id_ = #{userId} AND cg.group_type_ = 'VIP' AND vg.group_status_ = 2
+        UNION
+        SELECT cg.id_ FROM practice_group pg
+        LEFT JOIN class_group cg ON cg.music_group_id_ = pg.id_
+        WHERE pg.educational_teacher_id_ = #{userId} AND cg.group_type_ = 'PRACTICE' AND pg.group_status_ = 'NORMAL')c
+    </select>
 </mapper>

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

@@ -749,6 +749,12 @@
 		AND (((ta.sign_in_status_ = 0 OR ta.sign_out_status_ = 0) AND ta.dispose_content_ IS NULL) OR (sa.id_ IS NULL OR (sa.status_ != 'NORMAL' AND sa.visit_flag_ = 0)))
 		AND ta.sign_in_status_ IS NOT NULL AND ta.sign_out_status_ IS NOT NULL
 		AND (cs.new_course_id_ IS NULL OR cs.new_course_id_=cs.id_)
+		<if test="classGroupIds != null and classGroupIds.size() > 0">
+			AND cs.class_group_id_ IN
+			<foreach collection="classGroupIds" item="classGroupId" open="(" close=")" separator=",">
+				#{classGroupId}
+			</foreach>
+		</if>
 		<if test="organIds != null and organIds.size()>0">
 			AND cs.organ_id_ IN
 			<foreach collection="organIds" item="organId" open="(" close=")" separator=",">