Browse Source

Merge branch '20210409' of http://git.dayaedu.com/yonge/mec

zouxuan 4 years ago
parent
commit
6a5837b994

+ 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<Long> queryGroupClassGroupIds(Integer userId);
 }

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

@@ -144,17 +144,17 @@ public interface IndexBaseMonthDataDao extends BaseDAO<Long, IndexBaseMonthData>
                                                 @Param("groupType")GroupType groupType,
                                                 @Param("courseStatus") CourseStatusEnum courseStatus);
 
-    int countLessThenThreeClassGroupNum(@Param("organIds") Set<Integer> organIds);
+    int countLessThenThreeClassGroupNum(@Param("organIds") Set<Integer> organIds, @Param("educationUserId") Integer educationUserId);
     List<String> getLessThenThreeMusicGroup(@Param("organIds") Set<Integer> organIds);
 
     int queryErrInspection(@Param("organIds") Set<Integer> organIds, @Param("startTime") String startTime);
 
-    IndexErrInfoDto getNoClassMusicGroupStudentInfo(@Param("organIds") Set<Integer> organIds);
+    IndexErrInfoDto getNoClassMusicGroupStudentInfo(@Param("organIds") Set<Integer> organIds, @Param("educationUserId") Integer educationUserId);
 
-    int countNoPaymentStudentNum(@Param("organIds") Set<Integer> organIds);
-    List<String> getNoPaymentMusicGroup(@Param("organIds") Set<Integer> organIds);
+    int countNoPaymentStudentNum(@Param("organIds") Set<Integer> organIds, @Param("educationUserId") Integer educationUserId);
+    List<String> getNoPaymentMusicGroup(@Param("organIds") Set<Integer> organIds, @Param("educationUserId") Integer educationUserId);
 
-    List<Long> queryApplyForQuitGroupNum(@Param("organIds") Set<Integer> organIds);
+    List<Long> queryApplyForQuitGroupNum(@Param("organIds") Set<Integer> organIds, @Param("educationUserId") Integer educationUserId);
 
     int queryStudentAttendanceInfo(@Param("organIds") Set<Integer> organIds,
                                           @Param("type") String type, @Param("startTime") String startTime);
@@ -165,21 +165,21 @@ public interface IndexBaseMonthDataDao extends BaseDAO<Long, IndexBaseMonthData>
      * @param organIds
      * @return
      */
-    int getCourseTimeError(@Param("organIds") Set<Integer> organIds);
+    int getCourseTimeError(@Param("organIds") Set<Integer> organIds, @Param("classGroupIds") List<Long> classGroupIds);
 
     /**
      * 获取考勤异常编号
      * @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<Long> classGroupIds);
 
     /**
      * 获取旷课考勤
      * @param organIds
      * @return
      */
-    int getNoAttendance(@Param("organIds") Set<Integer> organIds, @Param("startTime") String startTime);
+    int getNoAttendance(@Param("organIds") Set<Integer> organIds, @Param("startTime") String startTime, @Param("classGroupIds") List<Long> classGroupIds);
 
     /**
      * 获取老师离职申请数

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/MusicGroupQuitQueryInfo.java

@@ -12,6 +12,16 @@ public class MusicGroupQuitQueryInfo extends QueryInfo {
 
     private ApprovalStatus status;
 
+    private Integer educationUserId;
+
+    public Integer getEducationUserId() {
+        return educationUserId;
+    }
+
+    public void setEducationUserId(Integer educationUserId) {
+        this.educationUserId = educationUserId;
+    }
+
     public ApprovalStatus getStatus() {
         return status;
     }

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

@@ -93,4 +93,6 @@ public interface EmployeeService extends BaseService<Integer, Employee> {
      * @return java.util.List<com.ym.mec.biz.dal.dto.SimpleUserDto>
      */
     List<SimpleUserDto> findAllByRole(String roleIds,String organIds);
+
+    List<Integer> queryUserRole(Integer sysUserId);
 }

+ 12 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java

@@ -21,6 +21,7 @@ import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.stream.Collectors;
 
+import com.ym.mec.auth.api.entity.SysUserRole;
 import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.*;
@@ -160,6 +161,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
     private MusicGroupStudentClassAdjustDao musicGroupStudentClassAdjustDao;
     @Autowired
     private MusicGroupPaymentCalenderDetailDao musicGroupPaymentCalenderDetailDao;
+    @Autowired
+    private EmployeeDao employeeDao;
 
     @Override
     public BaseDAO<Integer, ClassGroup> getDAO() {
@@ -3062,16 +3065,23 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
         params.put("groupType", queryInfo.getGroupType().getCode());
 
         List<ClassGroupTeachersDto> dataList = null;
-        int count = classGroupDao.countClassGroup(params);
-
+        int count;
         if (Objects.nonNull(queryInfo.getLessThenThreeHighOnline())) {
             List<Long> lessThenThreeClassGroupIds = classGroupStudentMapperDao.getLessThenThreeClassGroupIds(queryInfo.getOrganIdList());
+            SysUser sysUser = sysUserFeignService.queryUserInfo();
+            List<Integer> userRole = employeeDao.queryUserRole(sysUser.getId());
+            //如果当前用户只有教务老师角色,那么只能看到他所管理的课程组的信息
+            if (userRole.size() == 1 && userRole.contains(SysUserRole.EDUCATIONAL_TEACHER)) {
+                params.put("educationUserId", sysUser.getId());
+            }
             params.put("classGroupIds", lessThenThreeClassGroupIds);
             if (CollectionUtils.isEmpty(lessThenThreeClassGroupIds)) {
                 count = 0;
             } else {
                 count = classGroupDao.countClassGroup(params);
             }
+        }else {
+            count = classGroupDao.countClassGroup(params);
         }
 
         if (count > 0) {

+ 13 - 26
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -28,6 +28,7 @@ import java.util.TreeSet;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
+import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.service.*;
@@ -52,32 +53,6 @@ import com.alibaba.fastjson.JSONObject;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.auth.api.entity.SysUserRole;
-import com.ym.mec.biz.dal.dao.ClassGroupDao;
-import com.ym.mec.biz.dal.dao.ClassGroupStudentMapperDao;
-import com.ym.mec.biz.dal.dao.ClassGroupTeacherMapperDao;
-import com.ym.mec.biz.dal.dao.ClassGroupTeacherSalaryDao;
-import com.ym.mec.biz.dal.dao.CourseScheduleComplaintsDao;
-import com.ym.mec.biz.dal.dao.CourseScheduleDao;
-import com.ym.mec.biz.dal.dao.CourseScheduleEvaluateDao;
-import com.ym.mec.biz.dal.dao.CourseScheduleModifyLogDao;
-import com.ym.mec.biz.dal.dao.CourseScheduleReviewDao;
-import com.ym.mec.biz.dal.dao.CourseScheduleStudentPaymentDao;
-import com.ym.mec.biz.dal.dao.CourseScheduleTeacherSalaryDao;
-import com.ym.mec.biz.dal.dao.CoursesGroupDao;
-import com.ym.mec.biz.dal.dao.CoursesGroupModifyLogDao;
-import com.ym.mec.biz.dal.dao.GroupDao;
-import com.ym.mec.biz.dal.dao.MusicGroupDao;
-import com.ym.mec.biz.dal.dao.PracticeGroupDao;
-import com.ym.mec.biz.dal.dao.SchoolDao;
-import com.ym.mec.biz.dal.dao.StudentAttendanceDao;
-import com.ym.mec.biz.dal.dao.SubjectDao;
-import com.ym.mec.biz.dal.dao.SysConfigDao;
-import com.ym.mec.biz.dal.dao.TeacherAttendanceDao;
-import com.ym.mec.biz.dal.dao.TeacherDao;
-import com.ym.mec.biz.dal.dao.TeacherDefaultMusicGroupSalaryDao;
-import com.ym.mec.biz.dal.dao.TeacherDefaultPracticeGroupSalaryDao;
-import com.ym.mec.biz.dal.dao.TeacherDefaultVipGroupSalaryDao;
-import com.ym.mec.biz.dal.dao.VipGroupDao;
 import com.ym.mec.biz.dal.entity.ClassGroup;
 import com.ym.mec.biz.dal.entity.ClassGroupStudentMapper;
 import com.ym.mec.biz.dal.entity.ClassGroupTeacherMapper;
@@ -214,6 +189,8 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 	private CourseEventSource courseEventSource;
     @Autowired
 	private StudentServeService studentServeService;
+    @Autowired
+	private EmployeeDao employeeDao;
 
     private final Logger LOGGER = LoggerFactory
             .getLogger(this.getClass());
@@ -4442,6 +4419,16 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
         MapUtil.populateMap(params, queryInfo);
 
         List<CourseScheduleEndDto> results = new ArrayList<>();
+		SysUser sysUser = sysUserFeignService.queryUserInfo();
+		List<Integer> userRole = employeeDao.queryUserRole(sysUser.getId());
+		//如果当前用户只有教务老师角色,那么只能看到他所管理的课程组的信息
+		if (!sysUser.getIsSuperAdmin() && userRole.size() == 1 && userRole.contains(SysUserRole.EDUCATIONAL_TEACHER)) {
+			List<Long> classGroupIds = classGroupDao.queryGroupClassGroupIds(sysUser.getId());
+			if(classGroupIds.size() == 0){
+				return pageInfo;
+			}
+			params.put("classGroupIds",classGroupIds);
+		}
         int count = courseScheduleDao.endCountCourseSchedules(params);
         if(queryInfo.getIsExport() && count > 50000){
             throw new BizException("数据集太大,不能导出.最大数据集不能超过50000");

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/EmployeeServiceImpl.java

@@ -366,4 +366,9 @@ public class EmployeeServiceImpl extends BaseServiceImpl<Integer, Employee>  imp
 	public List<SimpleUserDto> findAllByRole(String roleIds, String organIds) {
 		return employeeDao.findAllByRole(roleIds,organIds);
 	}
+
+	@Override
+	public List<Integer> queryUserRole(Integer sysUserId) {
+		return employeeDao.queryUserRole(sysUserId);
+	}
 }

+ 52 - 19
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,16 @@ 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<Long> classGroupIds = null;
+		Integer educationUserId = null;
+		if (!sysUser.getIsSuperAdmin() && userRole.size() == 1 && userRole.contains(SysUserRole.EDUCATIONAL_TEACHER)) {
+			//获取教务老师关联的班级列表
+			classGroupIds = classGroupDao.queryGroupClassGroupIds(sysUser.getId());
+			educationUserId = sysUser.getId();
+		}
 
 		if(IndexErrorType.MUSIC_PATROL.equals(errorType)){
 			IndexErrInfoDto<IndexErrInfoDto> one = new IndexErrInfoDto<>();
@@ -299,11 +311,11 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			one.setDesc(IndexErrorType.MUSIC_PATROL.getMsg());
 			List<IndexErrInfoDto> oneChild = new ArrayList<>();
 
-			oneChild.add(new IndexErrInfoDto(IndexErrorType.HIGH_CLASS_STUDENT_LESS_THAN_THREE, IndexErrorType.HIGH_CLASS_STUDENT_LESS_THAN_THREE.getMsg(), indexBaseMonthDataDao.countLessThenThreeClassGroupNum(organIds), null));
+			oneChild.add(new IndexErrInfoDto(IndexErrorType.HIGH_CLASS_STUDENT_LESS_THAN_THREE, IndexErrorType.HIGH_CLASS_STUDENT_LESS_THAN_THREE.getMsg(), indexBaseMonthDataDao.countLessThenThreeClassGroupNum(organIds,educationUserId), null));
 			int errInspection = indexBaseMonthDataDao.queryErrInspection(organIds,startTime);
 			oneChild.add(new IndexErrInfoDto(IndexErrorType.MUSIC_PATROL_ITEM, IndexErrorType.MUSIC_PATROL_ITEM.getMsg(),errInspection, null));
 
-			IndexErrInfoDto noClassMusicGroupStudentInfo = indexBaseMonthDataDao.getNoClassMusicGroupStudentInfo(organIds);
+			IndexErrInfoDto noClassMusicGroupStudentInfo = indexBaseMonthDataDao.getNoClassMusicGroupStudentInfo(organIds,educationUserId);
 			noClassMusicGroupStudentInfo.setDesc(IndexErrorType.NO_CLASS_MUSIC_GROUP_STUDENT_INFO.getMsg());
 			oneChild.add(noClassMusicGroupStudentInfo);
 
@@ -319,8 +331,8 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			two.setDesc(IndexErrorType.STUDENT_INFO.getMsg());
 			List<IndexErrInfoDto> twoChild = new ArrayList<>();
 
-			twoChild.add(new IndexErrInfoDto(IndexErrorType.STUDENT_NOT_PAYMENT, IndexErrorType.STUDENT_NOT_PAYMENT.getMsg(), indexBaseMonthDataDao.countNoPaymentStudentNum(organIds), indexBaseMonthDataDao.getNoPaymentMusicGroup(organIds)));
-			List<Long> quitGroupNum = indexBaseMonthDataDao.queryApplyForQuitGroupNum(organIds);
+			twoChild.add(new IndexErrInfoDto(IndexErrorType.STUDENT_NOT_PAYMENT, IndexErrorType.STUDENT_NOT_PAYMENT.getMsg(), indexBaseMonthDataDao.countNoPaymentStudentNum(organIds,educationUserId), Arrays.asList(educationUserId)));
+			List<Long> quitGroupNum = indexBaseMonthDataDao.queryApplyForQuitGroupNum(organIds,educationUserId);
 			twoChild.add(new IndexErrInfoDto(IndexErrorType.STUDENT_APPLY_FOR_QUIT_MUSIC_GROUP, IndexErrorType.STUDENT_APPLY_FOR_QUIT_MUSIC_GROUP.getMsg(), quitGroupNum.size(),  quitGroupNum));
 //			int attendanceInfo = indexBaseMonthDataDao.queryStudentAttendanceInfo(organIds, StudentAttendanceStatusEnum.TRUANT.getCode(),startTime);
 //			twoChild.add(new IndexErrInfoDto(IndexErrorType.COURSE_TRUANT_STUDENT_NUM, IndexErrorType.COURSE_TRUANT_STUDENT_NUM.getMsg(), attendanceInfo, null));
@@ -345,14 +357,14 @@ 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();
 			}
-
-			int courseTimeError = indexBaseMonthDataDao.getCourseTimeError(organIds);
+			int courseTimeError = 0;
+			if(classGroupIds == null || classGroupIds.size() > 0){
+				courseTimeError = indexBaseMonthDataDao.getCourseTimeError(organIds,classGroupIds);
+			}
 			threeChild.add(new IndexErrInfoDto(IndexErrorType.COURSE_TIME_ERROR, IndexErrorType.COURSE_TIME_ERROR.getMsg(), courseTimeError, null));
 
 			int inspectionItem = indexBaseMonthDataDao.queryInspectionItem(organIdsStr,startTime,userId);
@@ -375,10 +387,14 @@ 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 = 0;
+			int noAttendance = 0;
+			if(classGroupIds == null || classGroupIds.size() > 0){
+				attendanceError = indexBaseMonthDataDao.getAttendanceError(organIds,startTime,classGroupIds);
+				noAttendance = indexBaseMonthDataDao.getNoAttendance(organIds,startTime,classGroupIds);
+			}
 			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<>();
@@ -441,9 +457,19 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 		if(StringUtils.isNotBlank(organIdsStr)){
 			organIds = Arrays.stream(organIdsStr.split(",")).map(Integer::new).collect(Collectors.toSet());
 		}
+		SysUser sysUser = sysUserFeignService.queryUserInfo();
+		List<Integer> userRole = employeeDao.queryUserRole(sysUser.getId());
+		//如果当前用户只有教务老师角色,那么只能看到他所管理的课程组的信息
+		List<Long> classGroupIds = null;
+		Integer educationUserId = null;
+		if (!sysUser.getIsSuperAdmin() && userRole.size() == 1 && userRole.contains(SysUserRole.EDUCATIONAL_TEACHER)) {
+			//获取教务老师关联的班级列表
+			classGroupIds = classGroupDao.queryGroupClassGroupIds(sysUser.getId());
+			educationUserId = sysUser.getId();
+		}
 		Date date = new Date();
 		boolean flag1 = false;
-		int countLessThenThreeClassGroupNum = indexBaseMonthDataDao.countLessThenThreeClassGroupNum(organIds);
+		int countLessThenThreeClassGroupNum = indexBaseMonthDataDao.countLessThenThreeClassGroupNum(organIds,educationUserId);
 		if(countLessThenThreeClassGroupNum > 0){
 			flag1 = true;
 		}
@@ -454,7 +480,7 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			}
 		}
 		if(!flag1){
-			IndexErrInfoDto noClassMusicGroupStudentInfo = indexBaseMonthDataDao.getNoClassMusicGroupStudentInfo(organIds);
+			IndexErrInfoDto noClassMusicGroupStudentInfo = indexBaseMonthDataDao.getNoClassMusicGroupStudentInfo(organIds,educationUserId);
 			if(Objects.nonNull(noClassMusicGroupStudentInfo) && noClassMusicGroupStudentInfo.getNum() > 0){
 				flag1 = true;
 			}
@@ -462,13 +488,13 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 		resultMap.put("musicPatrol",flag1);
 		boolean flag2 = false;
 		if(!flag2){
-			int countNoPaymentStudentNum = indexBaseMonthDataDao.countNoPaymentStudentNum(organIds);
+			int countNoPaymentStudentNum = indexBaseMonthDataDao.countNoPaymentStudentNum(organIds,educationUserId);
 			if(countNoPaymentStudentNum > 0){
 				flag2 = true;
 			}
 		}
 		if(!flag2){
-			List<Long> quitGroupNum = indexBaseMonthDataDao.queryApplyForQuitGroupNum(organIds);
+			List<Long> quitGroupNum = indexBaseMonthDataDao.queryApplyForQuitGroupNum(organIds,educationUserId);
 			if(quitGroupNum.size() > 0){
 				flag2 = true;
 			}
@@ -488,14 +514,15 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 				flag3 = true;
 			}
 		}
-		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();
 		}
 		if(!flag3){
-			int courseTimeError = indexBaseMonthDataDao.getCourseTimeError(organIds);
+			int courseTimeError = 0;
+			if(classGroupIds == null || classGroupIds.size() > 0){
+				courseTimeError = indexBaseMonthDataDao.getCourseTimeError(organIds,classGroupIds);
+			}
 			if(courseTimeError > 0){
 				flag3 = true;
 			}
@@ -522,13 +549,19 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 
 		boolean flag4 = false;
 		if(!flag4){
-			int attendanceError = indexBaseMonthDataDao.getAttendanceError(organIds,startTime);
+			int attendanceError = 0;
+			if(classGroupIds == null || classGroupIds.size() > 0){
+				attendanceError = indexBaseMonthDataDao.getAttendanceError(organIds,startTime,classGroupIds);
+			}
 			if(attendanceError > 0){
 				flag4 = true;
 			}
 		}
 		if(!flag4){
-			int noAttendance = indexBaseMonthDataDao.getNoAttendance(organIds,startTime);
+			int noAttendance = 0;
+			if(classGroupIds == null || classGroupIds.size() > 0){
+				noAttendance = indexBaseMonthDataDao.getNoAttendance(organIds,startTime,classGroupIds);
+			}
 			if(noAttendance > 0){
 				flag4 = true;
 			}

+ 8 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -144,6 +144,8 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     private StudentService studentService;
     @Autowired
     private ImGroupDao imGroupDao;
+    @Autowired
+    private EmployeeDao employeeDao;
 
     @Override
     public BaseDAO<Long, StudentRegistration> getDAO() {
@@ -1711,6 +1713,12 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             List<Integer> organIds = Arrays.stream(queryInfo.getOrganIds().split(",")).map(id -> Integer.valueOf(id)).collect(Collectors.toList());
             params.put("organIds", organIds);
         }
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        List<Integer> userRole = employeeDao.queryUserRole(sysUser.getId());
+        //如果当前用户只有教务老师角色,那么只能看到他所管理的课程组的信息
+        if (userRole.size() == 1 && userRole.contains(SysUserRole.EDUCATIONAL_TEACHER)) {
+            params.put("educationUserId", sysUser.getId());
+        }
 
         List<NoClassMusicStudentDto> dataList = new ArrayList<>();
         int count = studentRegistrationDao.countNoClassMusicStudents(params);

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

@@ -1424,6 +1424,9 @@
             <if test="organIdList != null and organIdList != ''">
                 AND FIND_IN_SET(mg.organ_id_,#{organIdList})
             </if>
+            <if test="educationUserId != null">
+                AND mg.educational_teacher_id_ = #{educationUserId}
+            </if>
             <if test="search != null and search != ''">
                 AND (cg.id_ LIKE CONCAT('%',#{search},'%') OR cg.name_ LIKE CONCAT('%',#{search},'%') OR mg.name_ LIKE CONCAT('%',#{search},'%') OR cg.music_group_id_ LIKE CONCAT('%',#{search},'%'))
             </if>
@@ -1464,4 +1467,17 @@
         ORDER BY cg.id_ DESC
         <include refid="global.limit"/>
     </select>
+    <select id="queryGroupClassGroupIds" resultType="java.lang.Long">
+        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'
+    </select>
 </mapper>

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

@@ -2594,6 +2594,12 @@
             AND cs.status_ = 'NOT_START' AND cs.is_lock_ = 0 AND cs.start_class_time_ &lt; '06:00:00'
             AND (cs.new_course_id_ IS NULL OR cs.new_course_id_ = cs.id_)
         </if>
+        <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>
     </sql>
     <select id="queryPracticeCourseScheduleIds" resultType="java.lang.Integer">
         SELECT cs.id_ FROM course_schedule cs

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

@@ -633,6 +633,9 @@
 		AND cs.del_flag_=0
 		AND cs.status_='NOT_START'
 		AND ( cs.new_course_id_ IS NULL OR cs.new_course_id_ = cs.id_ )
+		<if test="educationUserId != null">
+			AND mg.educational_teacher_id_ = #{educationUserId}
+		</if>
 		<if test="organIds!=null and organIds.size()>0">
 			AND mg.organ_id_ IN
 			<foreach collection="organIds" item="organId" open="(" close=")" separator=",">
@@ -675,6 +678,9 @@
 		mg.status_ = 'PROGRESS'
 		AND DATE_FORMAT(NOW(),'%Y-%m-%d') >= DATE_FORMAT(mgpc.payment_valid_start_date_,'%Y-%m-%d')
 		AND mgpcd.payment_status_ = 'NON_PAYMENT' AND mgpcd.expect_amount_ > 0 AND mgpc.batch_no_ IS NOT NULL AND mgpc.pay_user_type_ = 'STUDENT'
+		<if test="educationUserId != null">
+			AND mg.educational_teacher_id_ = #{educationUserId}
+		</if>
 		<if test="organIds!=null and organIds.size()>0">
 			AND mg.organ_id_ IN
 			<foreach collection="organIds" item="organId" open="(" close=")" separator=",">
@@ -694,6 +700,9 @@
 			mg.status_ = 'PROGRESS'
 			AND DATE_FORMAT(NOW(),'%Y-%m-%d') >= DATE_FORMAT(mgpc.payment_valid_start_date_,'%Y-%m-%d')
 			AND mgpcd.payment_status_ = 'NON_PAYMENT'
+			<if test="educationUserId != null">
+				AND mg.educational_teacher_id_ = #{educationUserId}
+			</if>
 			<if test="organIds!=null and organIds.size()>0">
 				AND mg.organ_id_ IN
 				<foreach collection="organIds" item="organId" open="(" close=")" separator=",">
@@ -707,6 +716,9 @@
 			LEFT JOIN music_group mg ON mgq.music_group_id_=mg.id_
 		WHERE mg.status_='PROGRESS'
 		  AND mgq.status_='PROCESSING'
+		<if test="educationUserId != null">
+			AND mg.educational_teacher_id_ = #{educationUserId}
+		</if>
 		<if test="organIds!=null and organIds.size() > 0">
 			AND mg.organ_id_ IN
 			<foreach collection="organIds" item="organId" open="(" close=")" separator=",">
@@ -743,6 +755,12 @@
 		SELECT COUNT(cs.id_) FROM course_schedule cs
 		WHERE cs.status_ = 'NOT_START' AND cs.del_flag_ = 0 AND cs.is_lock_ = 0 AND cs.start_class_time_ &lt; '06:00:00'
 		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=",">
@@ -760,6 +778,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=",">
@@ -775,6 +799,12 @@
 		AND cs.status_ = 'OVER' AND cs.del_flag_ = 0 AND cs.class_date_>='2021-02-01'
 		AND ta.sign_in_time_ IS NULL AND ta.sign_out_time_ IS NULL AND ta.dispose_content_ IS 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=",">
@@ -863,6 +893,9 @@
 			sr.music_group_status_ = 'NORMAL'
 			AND mg.status_ = 'PROGRESS'
 			AND cgsm.id_ IS NULL
+			<if test="educationUserId != null">
+				AND mg.educational_teacher_id_ = #{educationUserId}
+			</if>
 			<if test="organIds!=null and organIds.size()>0">
 				AND mg.organ_id_ IN
 				<foreach collection="organIds" item="organId" open="(" close=")" separator=",">

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

@@ -114,7 +114,9 @@
             <if test="organId != null and organId != ''">
                 AND FIND_IN_SET(mg.organ_id_,#{organId})
             </if>
-
+            <if test="educationUserId != null">
+                AND mg.educational_teacher_id_ = #{educationUserId}
+            </if>
             <if test="status != null">
                 AND mgq.status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
             </if>

+ 3 - 0
mec-biz/src/main/resources/config/mybatis/StudentRegistrationMapper.xml

@@ -873,6 +873,9 @@
                     #{organId}
                 </foreach>
             </if>
+            <if test="educationUserId != null">
+                AND mg.educational_teacher_id_ = #{educationUserId}
+            </if>
             <if test="musicGroupSearch!=null and musicGroupSearch!=''">
                 AND (sr.music_group_id_ = #{musicGroupSearch} OR mg.name_ LIKE CONCAT('%', #{musicGroupSearch}, '%'))
             </if>

+ 16 - 10
mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupQuitController.java

@@ -1,5 +1,6 @@
 package com.ym.mec.web.controller;
 
+import com.ym.mec.auth.api.entity.SysUserRole;
 import com.ym.mec.biz.dal.entity.Employee;
 import com.ym.mec.biz.dal.page.MusicGroupQuitQueryInfo;
 import com.ym.mec.biz.service.EmployeeService;
@@ -55,17 +56,22 @@ public class MusicGroupQuitController extends BaseController {
 		if (sysUser == null) {
 			return failed("用户信息获取失败");
 		}
-			Employee employee = employeeService.get(sysUser.getId());
-			if (StringUtils.isBlank(queryInfo.getOrganId())) {
-				queryInfo.setOrganId(employee.getOrganIdList());
-			}else if(StringUtils.isEmpty(employee.getOrganIdList())){
-				return failed("用户所在分部异常");
-			}else {
-				List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
-				if(!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))){
-					return failed("非法请求");
-				}
+		Employee employee = employeeService.get(sysUser.getId());
+		if (StringUtils.isBlank(queryInfo.getOrganId())) {
+			queryInfo.setOrganId(employee.getOrganIdList());
+		}else if(StringUtils.isEmpty(employee.getOrganIdList())){
+			return failed("用户所在分部异常");
+		}else {
+			List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+			if(!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))){
+				return failed("非法请求");
 			}
+		}
+		List<Integer> userRole = employeeService.queryUserRole(sysUser.getId());
+		//如果当前用户只有教务老师角色,那么只能看到他所管理的课程组的信息
+		if (userRole.size() == 1 && userRole.contains(SysUserRole.EDUCATIONAL_TEACHER)) {
+			queryInfo.setEducationUserId(sysUser.getId());
+		}
 		return succeed(musicGroupQuitService.queryPage(queryInfo));
 	}