Просмотр исходного кода

首页改造--异常处理--日常行政

zouxuan 4 лет назад
Родитель
Сommit
3d7c083cfc

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

@@ -111,4 +111,55 @@ public interface IndexBaseMonthDataDao extends BaseDAO<Long, IndexBaseMonthData>
 
     int countStudentAttendanceInfo(@Param("organIds") Set<Integer> organIds,
                                    @Param("type") String type);
+
+
+    /**
+     * 获取考勤异常编号
+     * @param organIds
+     * @return
+     */
+    List<Long> getAttendanceError(@Param("organIds") String organIds);
+
+    /**
+     * 获取旷课考勤
+     * @param organIds
+     * @return
+     */
+    List<Long> getNoAttendance(@Param("organIds") String organIds);
+
+    /**
+     * 获取老师离职申请数
+     * @param organIdsStr
+     * @return
+     */
+    List<Long> queryTeacherLeave(@Param("organIdsStr") String organIdsStr);
+
+    /**
+     * 获取预计课酬偏低的老师编号
+     * @param organIdsStr
+     * @param monthStr
+     * @return
+     */
+    List<Long> queryLowTeacherSalary(@Param("organIdsStr") String organIdsStr, @Param("monthStr") String monthStr);
+
+    /**
+     * 乐团巡查任务未计划
+     * @param organIdsStr
+     * @return
+     */
+    List<Long> queryInspectionItem(@Param("organIdsStr") String organIdsStr);
+
+    /**
+     * 乐团巡查任务未提交
+     * @param organIdsStr
+     * @return
+     */
+    List<Long> queryInspectionItemPlan(@Param("organIdsStr") String organIdsStr);
+
+    /**
+     * 未完成的回访任务
+     * @param organIdsStr
+     * @return
+     */
+    List<Long> queryStudentVisit(@Param("organIdsStr") String organIdsStr);
 }

+ 3 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/IndexErrorType.java

@@ -23,6 +23,9 @@ public enum IndexErrorType implements BaseEnum<String, IndexErrorType> {
     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", "回访任务未完成"),
     ;
 
     private String code;

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/TeacherCourseStatisticsQueryInfo.java

@@ -27,6 +27,17 @@ public class TeacherCourseStatisticsQueryInfo extends QueryInfo {
     @ApiModelProperty(value = "最大课酬")
     private BigDecimal maxSalary;
 
+    @ApiModelProperty(value = "是否预警")
+    private Integer lowSalary;
+
+    public Integer getLowSalary() {
+        return lowSalary;
+    }
+
+    public void setLowSalary(Integer lowSalary) {
+        this.lowSalary = lowSalary;
+    }
+
     public String getOrganId() {
         return organId;
     }

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

@@ -16,6 +16,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import com.ym.mec.biz.dal.entity.IndexBaseMonthData;
 import com.ym.mec.biz.service.IndexBaseMonthDataService;
+import org.springframework.http.HttpStatus;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
@@ -45,6 +46,8 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 	private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
 	@Autowired
 	private SysUserFeignService sysUserFeignService;
+	@Autowired
+	private SysMessageDao sysMessageDao;
 
 	private static ThreadLocal<Set<Integer>> organIds = new ThreadLocal<Set<Integer>>(){
 		@Override
@@ -310,6 +313,7 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 		if(StringUtils.isNotBlank(organIdsStr)){
 			organIds = Arrays.stream(organIdsStr.split(",")).map(Integer::new).collect(Collectors.toSet());
 		}
+		Date date = new Date();
 
 		List<IndexErrInfoDto> all = new ArrayList<>();
 
@@ -343,11 +347,33 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 		three.setDesc(IndexErrorType.TEACHER_INFO.getMsg());
 		List<IndexErrInfoDto> threeChild = new ArrayList<>();
 
+		List<Long> attendanceError = indexBaseMonthDataDao.getAttendanceError(organIdsStr);
+		threeChild.add(new IndexErrInfoDto(IndexErrorType.TEACHER_EXCEPTION_ATTENDANCE, IndexErrorType.TEACHER_EXCEPTION_ATTENDANCE.getMsg(), attendanceError.size(), attendanceError));
+
+		List<Long> noAttendance = indexBaseMonthDataDao.getNoAttendance(organIdsStr);
+		threeChild.add(new IndexErrInfoDto(IndexErrorType.TEACHER_NOT_A_CLASS, IndexErrorType.TEACHER_NOT_A_CLASS.getMsg(), noAttendance.size(), noAttendance));
+
+		List<Long> teacherLeave = indexBaseMonthDataDao.queryTeacherLeave(organIdsStr);
+		threeChild.add(new IndexErrInfoDto(IndexErrorType.TEACHER_LEAVE, IndexErrorType.TEACHER_LEAVE.getMsg(),teacherLeave.size(), teacherLeave));
+
+		String monthStr = DateUtil.format(date, DateUtil.ISO_YEAR_MONTH_FORMAT);
+		List<Long> lowTeacherSalary = indexBaseMonthDataDao.queryLowTeacherSalary(organIdsStr,monthStr);
+		threeChild.add(new IndexErrInfoDto(IndexErrorType.TEACHER_EXPECT_SALARY_BE_LOW, IndexErrorType.TEACHER_EXPECT_SALARY_BE_LOW.getMsg(),lowTeacherSalary.size(), null));
+
+		List<Long> inspectionItem = indexBaseMonthDataDao.queryInspectionItem(organIdsStr);
+		threeChild.add(new IndexErrInfoDto(IndexErrorType.INSPECTION_ITEM, IndexErrorType.INSPECTION_ITEM.getMsg(),inspectionItem.size(), inspectionItem));
+
+		List<Long> inspectionItemPlan = indexBaseMonthDataDao.queryInspectionItemPlan(organIdsStr);
+		threeChild.add(new IndexErrInfoDto(IndexErrorType.INSPECTION_ITEM_PLAN, IndexErrorType.INSPECTION_ITEM_PLAN.getMsg(),inspectionItemPlan.size(), inspectionItemPlan));
+
+		List<Long> studentVisit = indexBaseMonthDataDao.queryStudentVisit(organIdsStr);
+		threeChild.add(new IndexErrInfoDto(IndexErrorType.STUDENT_VISIT, IndexErrorType.STUDENT_VISIT.getMsg(),studentVisit.size(), studentVisit));
+
 		three.setNum(threeChild.stream().mapToInt(IndexErrInfoDto::getNum).sum());
 		three.setResult(threeChild);
 		all.add(three);
 
-		Map<String, Object> result = new HashMap<>();
+		Map<String, Object> result = new HashMap<>(2);
 		result.put("totalNum", all.stream().mapToInt(IndexErrInfoDto::getNum).sum());
 		result.put("data", all);
 		return result;

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

@@ -550,4 +550,59 @@
 				</foreach>
 			</if>
 	</select>
+    <select id="getAttendanceError" resultType="java.lang.Long">
+		SELECT DISTINCT ta.id_ FROM teacher_attendance ta
+		LEFT JOIN course_schedule cs ON ta.course_schedule_id_ = cs.id_
+		WHERE (ta.sign_in_status_ = 0 OR ta.sign_out_status_ = 0)
+		AND (ta.sign_in_time_ IS NOT NULL OR ta.sign_out_time_ IS NOT NULL) AND ta.dispose_content_ IS NULL
+		<if test="organIds != null and organIds != ''">
+			AND FIND_IN_SET(cs.organ_id_,#{organIds})
+		</if>
+	</select>
+	<select id="getNoAttendance" resultType="java.lang.Long">
+		SELECT DISTINCT ta.id_ FROM teacher_attendance ta
+		LEFT JOIN course_schedule cs ON ta.course_schedule_id_ = cs.id_
+		WHERE ta.sign_in_time_ IS NULL AND ta.sign_out_time_ IS NULL AND ta.dispose_content_ IS NULL
+		<if test="organIds != null and organIds != ''">
+			AND FIND_IN_SET(cs.organ_id_,#{organIds})
+		</if>
+	</select>
+	<select id="queryTeacherLeave" resultType="java.lang.Long">
+		SELECT DISTINCT tlr.id_ FROM teacher_leave_record tlr
+		LEFT JOIN teacher t ON t.id_ = tlr.user_id_
+		WHERE tlr.status_ = 'ING'
+		<if test="organIdsStr != null and organIdsStr != ''">
+			AND FIND_IN_SET(t.organ_id_,#{organIdsStr})
+		</if>
+	</select>
+	<select id="queryLowTeacherSalary" resultType="java.lang.Long">
+		SELECT DISTINCT tcs.user_id_ FROM teacher_course_statistics tcs
+		WHERE DATE_FORMAT(tcs.month_,'%Y-%m') = #{monthStr} AND tcs.low_salary = 1
+		<if test="organIdsStr != null and organIdsStr != ''">
+			AND FIND_IN_SET(tcs.organ_id_,#{organIdsStr})
+		</if>
+	</select>
+	<select id="queryInspectionItem" resultType="java.lang.Long">
+		SELECT DISTINCT ii.id_ FROM inspection_item ii
+		WHERE ii.times_ > planned_times_ AND ii.item_ = 'INSPECT' AND ii.memo_ IS NULL
+		<if test="organIdsStr != null and organIdsStr != ''">
+			AND FIND_IN_SET(ii.organ_id_,#{organIdsStr})
+		</if>
+	</select>
+	<select id="queryInspectionItemPlan" resultType="java.lang.Long">
+		SELECT DISTINCT iip.id_ FROM inspection_item_plan iip
+		WHERE iip.status_ = 0 AND iip.memo_ IS NULL
+		<if test="organIdsStr != null and organIdsStr != ''">
+			AND FIND_IN_SET(iip.organ_id_,#{organIdsStr})
+		</if>
+	</select>
+	<select id="queryStudentVisit" resultType="java.lang.Long">
+		SELECT DISTINCT ii.id_ FROM inspection_item ii
+		WHERE ii.item_ = 'VISIT' AND ii.memo_ IS NULL
+		AND ii.times_ > (SELECT COUNT(DISTINCT sv.id_) FROM student_visit sv
+		WHERE sv.teacher_id_ = ii.user_id_ AND DATE_FORMAT(ii.create_time_,'%Y-%m') = DATE_FORMAT(sv.visit_time_,'%Y-%m'))
+		<if test="organIdsStr != null and organIdsStr != ''">
+			AND FIND_IN_SET(ii.organ_id_,#{organIdsStr})
+		</if>
+	</select>
 </mapper>

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

@@ -122,6 +122,9 @@
             <if test="userId != null">
                 AND tcs.user_id_ = #{userId}
             </if>
+            <if test="lowSalary != null">
+                AND tcs.low_salary_ = #{lowSalary}
+            </if>
             <if test="minSalary != null">
                 AND tcs.expect_total_salary_ &gt; #{minSalary}
             </if>

+ 5 - 0
mec-util/pom.xml

@@ -96,5 +96,10 @@
 			<artifactId>commons-io</artifactId>
 			<version>2.8.0</version>
 		</dependency>
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-expression</artifactId>
+			<version>5.1.18.RELEASE</version>
+		</dependency>
 	</dependencies>
 </project>