Browse Source

首页学员异常考勤处理

zouxuan 4 years ago
parent
commit
18d5293f90

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

@@ -287,7 +287,7 @@ public interface IndexBaseMonthDataDao extends BaseDAO<Long, IndexBaseMonthData>
                                                             @Param("endDate") String endDate,
                                                             @Param("endDate") String endDate,
                                                             @Param("organIds") List<Integer> organIds);
                                                             @Param("organIds") List<Integer> organIds);
 
 
-    int countStudentErrorLeave(@Param("organIdList") Set<Integer> organIdList, @Param("format") String format);
+    int countStudentErrorLeave(@Param("organIdList") Set<Integer> organIdList, @Param("format") String format, @Param("classGroupIds") List<Long> classGroupIds);
 
 
     int countStudentErrorLeave1(Map<String, Object> params);
     int countStudentErrorLeave1(Map<String, Object> params);
 
 

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

@@ -485,6 +485,9 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			two.setErrorType(IndexErrorType.STUDENT_INFO);
 			two.setErrorType(IndexErrorType.STUDENT_INFO);
 			two.setDesc(IndexErrorType.STUDENT_INFO.getMsg());
 			two.setDesc(IndexErrorType.STUDENT_INFO.getMsg());
 			List<IndexErrInfoDto> twoChild = new ArrayList<>();
 			List<IndexErrInfoDto> twoChild = new ArrayList<>();
+			//学员请假异常提醒(获取前两个月的)
+			String format1 = DateUtil.format(DateUtil.addMonths(new Date(), -1), DateUtil.ISO_YEAR_MONTH_FORMAT);
+			twoChild.add(new IndexErrInfoDto(IndexErrorType.STUDENT_ERROR_LEAVE, IndexErrorType.STUDENT_ERROR_LEAVE.getMsg(), indexBaseMonthDataDao.countStudentErrorLeave(organIds,format1,classGroupIds), null));
 
 
 			//未缴费学员数
 			//未缴费学员数
 			twoChild.add(new IndexErrInfoDto(IndexErrorType.STUDENT_ARREARAGE, IndexErrorType.STUDENT_ARREARAGE.getMsg(), indexBaseMonthDataDao.countNoPaymentStudentNum(organIds,educationUserId,0), Arrays.asList(educationUserId)));
 			twoChild.add(new IndexErrInfoDto(IndexErrorType.STUDENT_ARREARAGE, IndexErrorType.STUDENT_ARREARAGE.getMsg(), indexBaseMonthDataDao.countNoPaymentStudentNum(organIds,educationUserId,0), Arrays.asList(educationUserId)));
@@ -824,6 +827,7 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 		List<Integer> userRole = employeeDao.queryUserRole(sysUser.getId());
 		List<Integer> userRole = employeeDao.queryUserRole(sysUser.getId());
 		Integer educationUserId = null;
 		Integer educationUserId = null;
 		if (!sysUser.getIsSuperAdmin() && userRole.size() == 1 && userRole.contains(SysUserRole.EDUCATIONAL_TEACHER)) {
 		if (!sysUser.getIsSuperAdmin() && userRole.size() == 1 && userRole.contains(SysUserRole.EDUCATIONAL_TEACHER)) {
+			//获取教务老师关联的班级列表
 			educationUserId = sysUser.getId();
 			educationUserId = sysUser.getId();
 		}
 		}
 		//获取关联的乐团列表
 		//获取关联的乐团列表
@@ -848,10 +852,6 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 		//未缴费学员数
 		//未缴费学员数
 		result.add(new IndexErrInfoDto(IndexErrorType.STUDENT_NOT_PAYMENT, IndexErrorType.STUDENT_NOT_PAYMENT.getMsg(), indexBaseMonthDataDao.countNoPaymentStudentNum(organIdSet,educationUserId, 1), Arrays.asList(educationUserId)));
 		result.add(new IndexErrInfoDto(IndexErrorType.STUDENT_NOT_PAYMENT, IndexErrorType.STUDENT_NOT_PAYMENT.getMsg(), indexBaseMonthDataDao.countNoPaymentStudentNum(organIdSet,educationUserId, 1), Arrays.asList(educationUserId)));
 
 
-		//学员请假异常提醒(获取前两个月的)
-		String format1 = DateUtil.format(DateUtil.addMonths(date, -1), DateUtil.ISO_YEAR_MONTH_FORMAT);
-		result.add(new IndexErrInfoDto(IndexErrorType.STUDENT_ERROR_LEAVE, IndexErrorType.STUDENT_ERROR_LEAVE.getMsg(), indexBaseMonthDataDao.countStudentErrorLeave(organIdSet,format1), null));
-
 		String monthStr = DateUtil.format(date, DateUtil.ISO_YEAR_MONTH_FORMAT);
 		String monthStr = DateUtil.format(date, DateUtil.ISO_YEAR_MONTH_FORMAT);
 		//全职未离职老师
 		//全职未离职老师
 		//预计课酬较低
 		//预计课酬较低
@@ -902,6 +902,14 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 		resultMap.put("musicPatrol",flag1);
 		resultMap.put("musicPatrol",flag1);
 		boolean flag2 = false;
 		boolean flag2 = false;
 		if(!flag2){
 		if(!flag2){
+			//学员请假异常提醒(获取前两个月的)
+			String format1 = DateUtil.format(DateUtil.addMonths(date, -1), DateUtil.ISO_YEAR_MONTH_FORMAT);
+			int studentErrorLeaveNum = indexBaseMonthDataDao.countStudentErrorLeave(organIds,format1,classGroupIds);
+			if(studentErrorLeaveNum > 0){
+				flag2 = true;
+			}
+		}
+		if(!flag2){
 			List<Long> quitGroupNum = indexBaseMonthDataDao.queryApplyForQuitGroupNum(organIds,educationUserId);
 			List<Long> quitGroupNum = indexBaseMonthDataDao.queryApplyForQuitGroupNum(organIds,educationUserId);
 			if(quitGroupNum.size() > 0){
 			if(quitGroupNum.size() > 0){
 				flag2 = true;
 				flag2 = true;
@@ -1004,14 +1012,6 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			}
 			}
 		}
 		}
 		if(!flag5){
 		if(!flag5){
-			//学员请假异常提醒(获取前两个月的)
-			String format1 = DateUtil.format(DateUtil.addMonths(date, -1), DateUtil.ISO_YEAR_MONTH_FORMAT);
-			int studentErrorLeaveNum = indexBaseMonthDataDao.countStudentErrorLeave(organIds,format1);
-			if(studentErrorLeaveNum > 0){
-				flag5 = true;
-			}
-		}
-		if(!flag5){
 			int countNoPaymentStudentNum = indexBaseMonthDataDao.countNoPaymentStudentNum(organIds,educationUserId, 1);
 			int countNoPaymentStudentNum = indexBaseMonthDataDao.countNoPaymentStudentNum(organIds,educationUserId, 1);
 			if(countNoPaymentStudentNum > 0){
 			if(countNoPaymentStudentNum > 0){
 				flag5 = true;
 				flag5 = true;

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentManageServiceImpl.java

@@ -7,6 +7,7 @@ import java.time.LocalDateTime;
 import java.util.*;
 import java.util.*;
 import java.util.stream.Collectors;
 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.dao.*;
 import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.entity.*;
@@ -115,6 +116,8 @@ public class StudentManageServiceImpl implements StudentManageService {
     private StudentInstrumentDao studentInstrumentDao;
     private StudentInstrumentDao studentInstrumentDao;
     @Autowired
     @Autowired
     private CloudTeacherOrderService cloudTeacherOrderService;
     private CloudTeacherOrderService cloudTeacherOrderService;
+    @Autowired
+    private EmployeeDao employeeDao;
 
 
     @Override
     @Override
     public PageInfo<StudentManageListDto> findStudentsByOrganId(StudentManageQueryInfo queryInfo) {
     public PageInfo<StudentManageListDto> findStudentsByOrganId(StudentManageQueryInfo queryInfo) {
@@ -861,6 +864,14 @@ public class StudentManageServiceImpl implements StudentManageService {
         String currentMonth = DateUtil.format(date, DateUtil.ISO_YEAR_MONTH_FORMAT);
         String currentMonth = DateUtil.format(date, DateUtil.ISO_YEAR_MONTH_FORMAT);
         params.put("totalMonth", totalMonth);
         params.put("totalMonth", totalMonth);
         params.put("currentMonth", currentMonth);
         params.put("currentMonth", currentMonth);
+        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());
+            params.put("classGroupIds", classGroupIds);
+        }
         int count = indexBaseMonthDataDao.countStudentErrorLeave1(params);
         int count = indexBaseMonthDataDao.countStudentErrorLeave1(params);
         List<StudentErrorLeaveDto> dataList = new ArrayList<>();
         List<StudentErrorLeaveDto> dataList = new ArrayList<>();
         if (count > 0) {
         if (count > 0) {

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

@@ -1398,6 +1398,12 @@
 				#{item}
 				#{item}
 			</foreach>
 			</foreach>
 		</if>
 		</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>
 		GROUP BY sa.user_id_,DATE_FORMAT(cs.class_date_,'%Y-%m')
 		GROUP BY sa.user_id_,DATE_FORMAT(cs.class_date_,'%Y-%m')
 		HAVING COUNT(sa.id_) > 1 AND COUNT(sa.id_) > SUM(sa.leave_visit_flag_)) c
 		HAVING COUNT(sa.id_) > 1 AND COUNT(sa.id_) > SUM(sa.leave_visit_flag_)) c
 	</select>
 	</select>
@@ -1410,6 +1416,12 @@
 		<if test="organId != null">
 		<if test="organId != null">
 			AND FIND_IN_SET(cs.organ_id_,#{organId})
 			AND FIND_IN_SET(cs.organ_id_,#{organId})
 		</if>
 		</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>
 		<if test="search != null and search != ''">
 		<if test="search != null and search != ''">
 			AND (sa.user_id_ = #{search} OR su.username_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%'))
 			AND (sa.user_id_ = #{search} OR su.username_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%'))
 		</if>
 		</if>
@@ -1436,6 +1448,12 @@
 		<if test="organId != null">
 		<if test="organId != null">
 			AND FIND_IN_SET(cs.organ_id_,#{organId})
 			AND FIND_IN_SET(cs.organ_id_,#{organId})
 		</if>
 		</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>
 		<if test="search != null and search != ''">
 		<if test="search != null and search != ''">
 			AND (sa.user_id_ = #{search} OR su.username_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%'))
 			AND (sa.user_id_ = #{search} OR su.username_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%'))
 		</if>
 		</if>