瀏覽代碼

首页学员异常考勤处理

zouxuan 4 年之前
父節點
當前提交
1df9a06ede

+ 30 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentErrorLeaveDto.java

@@ -2,6 +2,12 @@ package com.ym.mec.biz.dal.dto;
 
 public class StudentErrorLeaveDto {
 
+    private String phone;
+
+    private Integer organId;
+
+    private String organName;
+
     private String studentName;
 
     private Integer userId;
@@ -10,6 +16,30 @@ public class StudentErrorLeaveDto {
 
     private Integer currentNum;
 
+    public String getPhone() {
+        return phone;
+    }
+
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
+
+    public Integer getOrganId() {
+        return organId;
+    }
+
+    public void setOrganId(Integer organId) {
+        this.organId = organId;
+    }
+
+    public String getOrganName() {
+        return organName;
+    }
+
+    public void setOrganName(String organName) {
+        this.organName = organName;
+    }
+
     public String getStudentName() {
         return studentName;
     }

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

@@ -849,7 +849,7 @@ 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)));
 
 		//学员请假异常提醒(获取前两个月的)
-		String format1 = DateUtil.format(DateUtil.addMonths(date, 1), DateUtil.ISO_YEAR_MONTH_FORMAT);
+		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);
@@ -1004,6 +1004,14 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			}
 		}
 		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);
 			if(countNoPaymentStudentNum > 0){
 				flag5 = true;

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

@@ -857,7 +857,7 @@ public class StudentManageServiceImpl implements StudentManageService {
         Map<String, Object> params = new HashMap<>();
         MapUtil.populateMap(params, queryInfo);
         params.put("offset", pageInfo.getOffset());
-        String totalMonth = DateUtil.format(DateUtil.addMonths(date, 1), DateUtil.ISO_YEAR_MONTH_FORMAT);
+        String totalMonth = DateUtil.format(DateUtil.addMonths(date, -1), DateUtil.ISO_YEAR_MONTH_FORMAT);
         String currentMonth = DateUtil.format(date, DateUtil.ISO_YEAR_MONTH_FORMAT);
         params.put("totalMonth", totalMonth);
         params.put("currentMonth", currentMonth);

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

@@ -1405,28 +1405,42 @@
 		SELECT COUNT(DISTINCT c.user_id_) FROM (
 		SELECT sa.user_id_ FROM student_attendance sa
 		LEFT JOIN course_schedule cs ON cs.id_ = sa.course_schedule_id_
+		LEFT JOIN sys_user su ON su.id_ = sa.user_id_
 		WHERE DATE_FORMAT(cs.class_date_,'%Y-%m') >= #{totalMonth} AND sa.status_ = 'LEAVE'
 		<if test="organId != null">
-			AND FIND_IN_SET(cs.organ_id_,organId)
+			AND FIND_IN_SET(cs.organ_id_,#{organId})
+		</if>
+		<if test="search != null and search != ''">
+			AND (sa.user_id_ = #{search} OR su.username_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%'))
 		</if>
 		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
 	</select>
 	<resultMap id="StudentErrorLeaveDto" type="com.ym.mec.biz.dal.dto.StudentErrorLeaveDto">
-		<result property="currentNum" column="currentNum"/>
-		<result property="totalNum" column="totalNum"/>
+		<result property="currentNum" column="current_num_"/>
+		<result property="totalNum" column="total_num_"/>
 		<result property="userId" column="user_id_"/>
 		<result property="studentName" column="username_"/>
+		<result property="phone" column="phone_"/>
+		<result property="organId" column="organ_id_"/>
+		<result property="organName" column="organ_name_"/>
 	</resultMap>
 	<select id="queryStudentErrorLeave" resultMap="StudentErrorLeaveDto">
-		SELECT * FROM (SELECT sa.user_id_,su.username_,COUNT(sa.id_) total_num_,
+		SELECT * FROM (SELECT cs.organ_id_,o.name_ organ_name_,sa.user_id_,su.username_,su.phone_,COUNT(sa.id_) total_num_,
 		COUNT(CASE WHEN DATE_FORMAT(cs.class_date_,'%Y-%m') = #{currentMonth} THEN 1 ELSE NULL END) current_num_,cs.class_date_
 		FROM student_attendance sa
+		LEFT JOIN course_schedule cs ON cs.id_ = sa.course_schedule_id_
+		LEFT JOIN organization o ON o.id_ = cs.organ_id_
+		LEFT JOIN sys_user su ON su.id_ = sa.user_id_
 		WHERE DATE_FORMAT(cs.class_date_,'%Y-%m') >= #{totalMonth} AND sa.status_ = 'LEAVE'
 		<if test="organId != null">
-			AND FIND_IN_SET(cs.organ_id_,organId)
+			AND FIND_IN_SET(cs.organ_id_,#{organId})
+		</if>
+		<if test="search != null and search != ''">
+			AND (sa.user_id_ = #{search} OR su.username_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%'))
 		</if>
-		GROUP BY sa.user_id_,DATE_FORMAT(cs.class_date_,'%Y-%m') HAVING COUNT(sa.id_) > 1)c
+		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
 		WHERE DATE_FORMAT(c.class_date_ ,'%Y-%m') = #{currentMonth}
+		<include refid="global.limit"/>
 	</select>
 </mapper>