Explorar o código

feat:首页异常统计导出

Joburgess %!s(int64=4) %!d(string=hai) anos
pai
achega
1a89b66bdf

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

@@ -7,10 +7,7 @@ import com.ym.mec.common.dal.BaseDAO;
 import org.apache.ibatis.annotations.Param;
 import org.apache.poi.ss.formula.functions.Index;
 
-import java.util.Collection;
-import java.util.Date;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
 
 public interface IndexBaseMonthDataDao extends BaseDAO<Long, IndexBaseMonthData> {
 
@@ -145,17 +142,29 @@ public interface IndexBaseMonthDataDao extends BaseDAO<Long, IndexBaseMonthData>
                                                 @Param("courseStatus") CourseStatusEnum courseStatus);
 
     int countLessThenThreeClassGroupNum(@Param("organIds") Set<Integer> organIds, @Param("educationUserId") Integer educationUserId);
+
+    List<Map<Integer, Integer>> countLessThenThreeClassOrganGroupNum(@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);
 
+    List<Map<Integer, Integer>> queryOrganErrInspection(@Param("organIds") Set<Integer> organIds, @Param("startTime") String startTime);
+
     IndexErrInfoDto getNoClassMusicGroupStudentInfo(@Param("organIds") Set<Integer> organIds, @Param("educationUserId") Integer educationUserId);
 
+    List<Map<Integer, Integer>> getOrganNoClassMusicGroupStudentNum(@Param("organIds") Set<Integer> organIds, @Param("educationUserId") Integer educationUserId);
+
     int countNoPaymentStudentNum(@Param("organIds") Set<Integer> organIds, @Param("educationUserId") Integer educationUserId);
+
+    List<Map<Integer, Integer>> countOrganNoPaymentStudentNum(@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, @Param("educationUserId") Integer educationUserId);
 
+    List<Map<Integer, Integer>> queryOrganApplyForQuitGroupNum(@Param("organIds") Set<Integer> organIds, @Param("educationUserId") Integer educationUserId);
+
     int queryStudentAttendanceInfo(@Param("organIds") Set<Integer> organIds,
                                           @Param("type") String type, @Param("startTime") String startTime);
 
@@ -166,6 +175,7 @@ public interface IndexBaseMonthDataDao extends BaseDAO<Long, IndexBaseMonthData>
      * @return
      */
     int getCourseTimeError(@Param("organIds") Set<Integer> organIds, @Param("classGroupIds") List<Long> classGroupIds);
+    List<Map<Integer, Integer>> getOrganCourseTimeError(@Param("organIds") Set<Integer> organIds, @Param("classGroupIds") List<Long> classGroupIds);
 
     /**
      * 获取考勤异常编号
@@ -173,6 +183,7 @@ public interface IndexBaseMonthDataDao extends BaseDAO<Long, IndexBaseMonthData>
      * @return
      */
     int getAttendanceError(@Param("organIds") Set<Integer> organIds, @Param("startTime") String startTime, @Param("classGroupIds") List<Long> classGroupIds);
+    List<Map<Integer, Integer>> getOrganAttendanceError(@Param("organIds") Set<Integer> organIds, @Param("startTime") String startTime, @Param("classGroupIds") List<Long> classGroupIds);
 
     /**
      * 获取旷课考勤
@@ -180,6 +191,7 @@ public interface IndexBaseMonthDataDao extends BaseDAO<Long, IndexBaseMonthData>
      * @return
      */
     int getNoAttendance(@Param("organIds") Set<Integer> organIds, @Param("startTime") String startTime, @Param("classGroupIds") List<Long> classGroupIds);
+    List<Map<Integer, Integer>> getOrganNoAttendance(@Param("organIds") Set<Integer> organIds, @Param("startTime") String startTime, @Param("classGroupIds") List<Long> classGroupIds);
 
     /**
      * 获取老师离职申请数
@@ -197,11 +209,20 @@ public interface IndexBaseMonthDataDao extends BaseDAO<Long, IndexBaseMonthData>
     int queryLowTeacherSalary(@Param("organIdsStr") String organIdsStr, @Param("monthStr") String monthStr);
 
     /**
+     * 获取预计课酬偏低的老师编号
+     * @param organIdsStr
+     * @param monthStr
+     * @return
+     */
+    List<Map<Integer, Integer>> queryOrganLowTeacherSalary(@Param("organIdsStr") String organIdsStr, @Param("monthStr") String monthStr);
+
+    /**
      * 乐团巡查任务未计划
      * @param organIdsStr
      * @return
      */
     int queryInspectionItem(@Param("organIdsStr") String organIdsStr, @Param("startTime") String startTime, @Param("userId") Integer userId);
+    List<Map<Integer, Integer>> queryOrganInspectionItem(@Param("organIdsStr") String organIdsStr, @Param("startTime") String startTime, @Param("userId") Integer userId);
 
     /**
      * 乐团巡查任务未提交
@@ -209,6 +230,7 @@ public interface IndexBaseMonthDataDao extends BaseDAO<Long, IndexBaseMonthData>
      * @return
      */
     int queryInspectionItemPlan(@Param("organIdsStr") String organIdsStr, @Param("startTime") String startTime);
+    List<Map<Integer, Integer>> queryOrganInspectionItemPlan(@Param("organIdsStr") String organIdsStr, @Param("startTime") String startTime);
 
     /**
      * 未完成的回访任务
@@ -216,6 +238,7 @@ public interface IndexBaseMonthDataDao extends BaseDAO<Long, IndexBaseMonthData>
      * @return
      */
     int queryStudentVisit(@Param("organIdsStr") String organIdsStr, @Param("startTime") String startTime, @Param("userId") Integer userId);
+    List<Map<Integer, Integer>> queryOrganStudentVisit(@Param("organIdsStr") String organIdsStr, @Param("startTime") String startTime, @Param("userId") Integer userId);
 
     List<IndexBaseMonthData> getFinancePayData(@Param("dayStr") String dayStr);
 
@@ -234,4 +257,13 @@ public interface IndexBaseMonthDataDao extends BaseDAO<Long, IndexBaseMonthData>
     List<IndexBaseMonthData> getFinanceActualDataWithTimely(@Param("startDate") String startDate,
                                                             @Param("endDate") String endDate,
                                                             @Param("organIds") List<Integer> organIds);
+
+    /**
+     * @describe 各分部教师服务指标异常
+     * @author Joburgess
+     * @date 2021/4/15 0015
+     * @param params:
+     * @return java.util.List<java.util.Map<java.lang.Integer,java.lang.Integer>>
+     */
+    List<Map<Integer, Integer>> countOrganTeacherServeInfo(Map<String, Object> params);
 }

+ 184 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/IndexErrorDataExportDto.java

@@ -0,0 +1,184 @@
+package com.ym.mec.biz.dal.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * @Author Joburgess
+ * @Date 2021/4/15 0015
+ */
+public class IndexErrorDataExportDto {
+
+    private Integer organId;
+
+    private String organName;
+
+    @ApiModelProperty(value = "基础技能班学员数量异常")
+    private int highClassStudentLessThanThreeNum;
+
+    @ApiModelProperty(value = "乐团巡查事项异常")
+    private int musicPatrolItem;
+
+    @ApiModelProperty(value = "未加入任何班级学员")
+    private int noClassMusicGroupStudentInfo;
+
+    @ApiModelProperty(value = "未缴费学员数")
+    private int studentNotPayment;
+
+    @ApiModelProperty(value = "申请退团学员数")
+    private int studentApplyForQuitMusicGroup;
+
+    @ApiModelProperty(value = "预计课酬较低")
+    private int teacherExpectSalaryBeLow;
+
+    @ApiModelProperty(value = "课程时间安排异常")
+    private int courseTimeError;
+
+    @ApiModelProperty(value = "乐团巡查任务未计划")
+    private int inspectionItem;
+
+    @ApiModelProperty(value = "乐团巡查任务未提交")
+    private int inspectionItemPlan;
+
+    @ApiModelProperty(value = "回访任务未完成")
+    private int studentVisit;
+
+    @ApiModelProperty(value = "课程考勤异常")
+    private int teacherExceptionAttendance;
+
+    @ApiModelProperty(value = "课程异常")
+    private int teacherNotAClass;
+
+    @ApiModelProperty(value = "服务指标异常")
+    private int teacherServeError;
+
+    @ApiModelProperty(value = "总计")
+    private int total;
+
+    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 int getHighClassStudentLessThanThreeNum() {
+        return highClassStudentLessThanThreeNum;
+    }
+
+    public void setHighClassStudentLessThanThreeNum(int highClassStudentLessThanThreeNum) {
+        this.highClassStudentLessThanThreeNum = highClassStudentLessThanThreeNum;
+    }
+
+    public int getMusicPatrolItem() {
+        return musicPatrolItem;
+    }
+
+    public void setMusicPatrolItem(int musicPatrolItem) {
+        this.musicPatrolItem = musicPatrolItem;
+    }
+
+    public int getNoClassMusicGroupStudentInfo() {
+        return noClassMusicGroupStudentInfo;
+    }
+
+    public void setNoClassMusicGroupStudentInfo(int noClassMusicGroupStudentInfo) {
+        this.noClassMusicGroupStudentInfo = noClassMusicGroupStudentInfo;
+    }
+
+    public int getStudentNotPayment() {
+        return studentNotPayment;
+    }
+
+    public void setStudentNotPayment(int studentNotPayment) {
+        this.studentNotPayment = studentNotPayment;
+    }
+
+    public int getStudentApplyForQuitMusicGroup() {
+        return studentApplyForQuitMusicGroup;
+    }
+
+    public void setStudentApplyForQuitMusicGroup(int studentApplyForQuitMusicGroup) {
+        this.studentApplyForQuitMusicGroup = studentApplyForQuitMusicGroup;
+    }
+
+    public int getTeacherExpectSalaryBeLow() {
+        return teacherExpectSalaryBeLow;
+    }
+
+    public void setTeacherExpectSalaryBeLow(int teacherExpectSalaryBeLow) {
+        this.teacherExpectSalaryBeLow = teacherExpectSalaryBeLow;
+    }
+
+    public int getCourseTimeError() {
+        return courseTimeError;
+    }
+
+    public void setCourseTimeError(int courseTimeError) {
+        this.courseTimeError = courseTimeError;
+    }
+
+    public int getInspectionItem() {
+        return inspectionItem;
+    }
+
+    public void setInspectionItem(int inspectionItem) {
+        this.inspectionItem = inspectionItem;
+    }
+
+    public int getInspectionItemPlan() {
+        return inspectionItemPlan;
+    }
+
+    public void setInspectionItemPlan(int inspectionItemPlan) {
+        this.inspectionItemPlan = inspectionItemPlan;
+    }
+
+    public int getStudentVisit() {
+        return studentVisit;
+    }
+
+    public void setStudentVisit(int studentVisit) {
+        this.studentVisit = studentVisit;
+    }
+
+    public int getTeacherExceptionAttendance() {
+        return teacherExceptionAttendance;
+    }
+
+    public void setTeacherExceptionAttendance(int teacherExceptionAttendance) {
+        this.teacherExceptionAttendance = teacherExceptionAttendance;
+    }
+
+    public int getTeacherNotAClass() {
+        return teacherNotAClass;
+    }
+
+    public void setTeacherNotAClass(int teacherNotAClass) {
+        this.teacherNotAClass = teacherNotAClass;
+    }
+
+    public int getTeacherServeError() {
+        return teacherServeError;
+    }
+
+    public void setTeacherServeError(int teacherServeError) {
+        this.teacherServeError = teacherServeError;
+    }
+
+    public int getTotal() {
+        return total;
+    }
+
+    public void setTotal(int total) {
+        this.total = total;
+    }
+}

+ 3 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/IndexBaseMonthDataService.java

@@ -4,6 +4,7 @@ import java.util.List;
 import java.util.Map;
 
 import com.ym.mec.biz.dal.dto.IndexBaseDto;
+import com.ym.mec.biz.dal.dto.IndexErrorDataExportDto;
 import com.ym.mec.biz.dal.entity.IndexBaseMonthData;
 import com.ym.mec.biz.dal.entity.IndexErrInfoDto;
 import com.ym.mec.biz.dal.enums.IndexErrorType;
@@ -18,6 +19,8 @@ public interface IndexBaseMonthDataService extends BaseService<Long, IndexBaseMo
 
     Map<String, Object> getIndexErrData(String organIds, IndexErrorType errorType);
 
+    List<IndexErrorDataExportDto> exportIndexErrData(String organIds, IndexErrorType errorType);
+
     /**
      * 事项提醒
      * @param organIds

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

@@ -5,6 +5,7 @@ import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.auth.api.entity.SysUserRole;
 import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.IndexBaseDto;
+import com.ym.mec.biz.dal.dto.IndexErrorDataExportDto;
 import com.ym.mec.biz.dal.entity.IndexErrInfoDto;
 import com.ym.mec.biz.dal.entity.Organization;
 import com.ym.mec.biz.dal.enums.*;
@@ -14,6 +15,7 @@ import com.ym.mec.common.constant.CommonConstants;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -311,10 +313,14 @@ 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,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,educationUserId);
 			noClassMusicGroupStudentInfo.setDesc(IndexErrorType.NO_CLASS_MUSIC_GROUP_STUDENT_INFO.getMsg());
 			oneChild.add(noClassMusicGroupStudentInfo);
@@ -331,7 +337,10 @@ 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,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);
@@ -353,10 +362,13 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 //			threeChild.add(new IndexErrInfoDto(IndexErrorType.TEACHER_LEAVE, IndexErrorType.TEACHER_LEAVE.getMsg(),teacherLeave, null));
 
 			String monthStr = DateUtil.format(date, DateUtil.ISO_YEAR_MONTH_FORMAT);
+
 			//全职未离职老师
+			//预计课酬较低
 			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));
 
+			//课程时间安排异常
 			Integer userId = null;
 			if (!userRole.contains(SysUserRole.SECTION_MANAGER) && !sysUser.getIsSuperAdmin()) {
 				userId = sysUser.getId();
@@ -367,12 +379,15 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			}
 			threeChild.add(new IndexErrInfoDto(IndexErrorType.COURSE_TIME_ERROR, IndexErrorType.COURSE_TIME_ERROR.getMsg(), courseTimeError, null));
 
+			//乐团巡查任务未计划
 			int inspectionItem = indexBaseMonthDataDao.queryInspectionItem(organIdsStr,startTime,userId);
 			threeChild.add(new IndexErrInfoDto(IndexErrorType.INSPECTION_ITEM, IndexErrorType.INSPECTION_ITEM.getMsg(),inspectionItem, null));
 
+			//乐团巡查任务未提交
 			int inspectionItemPlan = indexBaseMonthDataDao.queryInspectionItemPlan(organIdsStr,startTime);
 			threeChild.add(new IndexErrInfoDto(IndexErrorType.INSPECTION_ITEM_PLAN, IndexErrorType.INSPECTION_ITEM_PLAN.getMsg(),inspectionItemPlan, null));
 
+			//回访任务未完成
 			int studentVisit = indexBaseMonthDataDao.queryStudentVisit(organIdsStr,startTime,userId);
 			threeChild.add(new IndexErrInfoDto(IndexErrorType.STUDENT_VISIT, IndexErrorType.STUDENT_VISIT.getMsg(),studentVisit, null));
 
@@ -387,6 +402,7 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			four.setDesc(IndexErrorType.ATTENDANCE_SERVE.getMsg());
 			List<IndexErrInfoDto> fourChild = new ArrayList<>();
 
+			//课程考勤异常
 			int attendanceError = 0;
 			int noAttendance = 0;
 			if(classGroupIds == null || classGroupIds.size() > 0){
@@ -395,8 +411,10 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			}
 			fourChild.add(new IndexErrInfoDto(IndexErrorType.TEACHER_EXCEPTION_ATTENDANCE, IndexErrorType.TEACHER_EXCEPTION_ATTENDANCE.getMsg(), attendanceError, null));
 
+			//课程异常
 			fourChild.add(new IndexErrInfoDto(IndexErrorType.TEACHER_NOT_A_CLASS, IndexErrorType.TEACHER_NOT_A_CLASS.getMsg(), noAttendance, null));
 
+			//服务指标异常
 			Map<String, Object> params = new HashMap<>();
 			LocalDate nowDate = LocalDateTime.now(DateUtil.zoneId).toLocalDate();
 			LocalDate monDayDate = nowDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue());
@@ -421,6 +439,235 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 	}
 
 	@Override
+	public List<IndexErrorDataExportDto> exportIndexErrData(String organIdsStr, IndexErrorType errorType) {
+		List<IndexErrorDataExportDto> results = new ArrayList<>();
+
+		//只筛选指定时间之后的数据
+		String startTime = DateUtil.format(DateUtil.getFirstDayOfMonth(DateUtil.addMonths(new Date(), -2)),DateUtil.ISO_EXPANDED_DATE_FORMAT);
+
+		Set<Integer> organIds = null;
+		if(StringUtils.isNotBlank(organIdsStr)){
+			organIds = Arrays.stream(organIdsStr.split(",")).map(Integer::new).collect(Collectors.toSet());
+		}
+		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();
+		}
+
+		//基础技能班学员数量异常
+		Map<Integer, Integer> highClassStudentLessThanThreeMap = new HashMap<>();
+		//乐团巡查事项异常
+		Map<Integer, Integer> musicPatrolItemMap = new HashMap<>();
+		//未加入任何班级学员
+		Map<Integer, Integer> organNoClassMusicGroupStudentNumMap = new HashMap<>();
+		//未缴费学员数
+		Map<Integer, Integer> studentNotPaymentMap = new HashMap<>();
+		//申请退团学员数
+		Map<Integer, Integer> studentApplyForQuitMusicGroupMap = new HashMap<>();
+		//预计课酬较低
+		Map<Integer, Integer> teacherExpectSalaryBeLowMap = new HashMap<>();
+		//课程时间安排异常
+		Map<Integer, Integer> courseTimeErrorMap = new HashMap<>();
+		//乐团巡查任务未计划
+		Map<Integer, Integer> inspectionItemMap = new HashMap<>();
+		//乐团巡查任务未提交
+		Map<Integer, Integer> inspectionItemPlanMap = new HashMap<>();
+		//回访任务未完成
+		Map<Integer, Integer> studentVisitMap = new HashMap<>();
+		//课程考勤异常
+		Map<Integer, Integer> teacherExceptionAttendanceMap = new HashMap<>();
+		//课程异常
+		Map<Integer, Integer> teacherNotAClassMap = new HashMap<>();
+		//服务指标异常
+		Map<Integer, Integer> teacherServeErrorMap = new HashMap<>();
+
+		if(IndexErrorType.MUSIC_PATROL.equals(errorType)||Objects.isNull(errorType)){
+			//基础技能班学员数量异常
+			List<Map<Integer, Integer>> highClassStudentLessThanThreeMapList = indexBaseMonthDataDao.countLessThenThreeClassOrganGroupNum(organIds, educationUserId);
+			highClassStudentLessThanThreeMap = MapUtil.mapListToMap(highClassStudentLessThanThreeMapList, Integer.class, Integer.class);
+
+			//乐团巡查事项异常
+			List<Map<Integer, Integer>> musicPatrolItemMapList = indexBaseMonthDataDao.queryOrganErrInspection(organIds, startTime);
+			musicPatrolItemMap = MapUtil.mapListToMap(musicPatrolItemMapList, Integer.class, Integer.class);
+
+			//未加入任何班级学员
+			List<Map<Integer, Integer>> organNoClassMusicGroupStudentNumMapList = indexBaseMonthDataDao.getOrganNoClassMusicGroupStudentNum(organIds, educationUserId);
+			organNoClassMusicGroupStudentNumMap = MapUtil.mapListToMap(organNoClassMusicGroupStudentNumMapList, Integer.class, Integer.class);
+		}
+
+		if(IndexErrorType.STUDENT_INFO.equals(errorType)||Objects.isNull(errorType)){
+			//未缴费学员数
+			List<Map<Integer, Integer>> studentNotPaymentMapList = indexBaseMonthDataDao.countOrganNoPaymentStudentNum(organIds, educationUserId);
+			studentNotPaymentMap = MapUtil.mapListToMap(studentNotPaymentMapList, Integer.class, Integer.class);
+
+			//申请退团学员数
+			List<Map<Integer, Integer>> studentApplyForQuitMusicGroupMapList = indexBaseMonthDataDao.queryOrganApplyForQuitGroupNum(organIds, educationUserId);
+			studentApplyForQuitMusicGroupMap = MapUtil.mapListToMap(studentApplyForQuitMusicGroupMapList, Integer.class, Integer.class);
+		}
+
+		if(IndexErrorType.TEACHER_INFO.equals(errorType)||Objects.isNull(errorType)){
+			String monthStr = DateUtil.format(date, DateUtil.ISO_YEAR_MONTH_FORMAT);
+
+			//全职未离职老师
+			//预计课酬较低
+			List<Map<Integer, Integer>> teacherExpectSalaryBeLowMapList = indexBaseMonthDataDao.queryOrganLowTeacherSalary(organIdsStr, monthStr);
+			teacherExpectSalaryBeLowMap = MapUtil.mapListToMap(teacherExpectSalaryBeLowMapList, Integer.class, Integer.class);
+
+			//课程时间安排异常
+			Integer userId = null;
+			if (!userRole.contains(SysUserRole.SECTION_MANAGER) && !sysUser.getIsSuperAdmin()) {
+				userId = sysUser.getId();
+			}
+			if(classGroupIds == null || classGroupIds.size() > 0){
+				List<Map<Integer, Integer>> courseTimeErrorMapList = indexBaseMonthDataDao.getOrganCourseTimeError(organIds, classGroupIds);
+				courseTimeErrorMap = MapUtil.mapListToMap(courseTimeErrorMapList, Integer.class, Integer.class);
+			}
+
+			//乐团巡查任务未计划
+			List<Map<Integer, Integer>> inspectionItemMapList = indexBaseMonthDataDao.queryOrganInspectionItem(organIdsStr, startTime, userId);
+			inspectionItemMap = MapUtil.mapListToMap(inspectionItemMapList, Integer.class, Integer.class);
+
+			//乐团巡查任务未提交
+			List<Map<Integer, Integer>> inspectionItemPlanMapList = indexBaseMonthDataDao.queryOrganInspectionItemPlan(organIdsStr, startTime);
+			inspectionItemPlanMap = MapUtil.mapListToMap(inspectionItemPlanMapList, Integer.class, Integer.class);
+
+			//回访任务未完成
+			List<Map<Integer, Integer>> studentVisitMapList = indexBaseMonthDataDao.queryOrganStudentVisit(organIdsStr, startTime, userId);
+			studentVisitMap = MapUtil.mapListToMap(studentVisitMapList, Integer.class, Integer.class);
+		}
+
+		if(IndexErrorType.ATTENDANCE_SERVE.equals(errorType)||Objects.isNull(errorType)){
+			if(classGroupIds == null || classGroupIds.size() > 0){
+				//课程考勤异常
+				List<Map<Integer, Integer>> teacherExceptionAttendanceMapList = indexBaseMonthDataDao.getOrganAttendanceError(organIds, startTime, classGroupIds);
+				teacherExceptionAttendanceMap = MapUtil.mapListToMap(teacherExceptionAttendanceMapList, Integer.class, Integer.class);
+
+				//课程异常
+				List<Map<Integer, Integer>> teacherNotAClassMapList = indexBaseMonthDataDao.getOrganNoAttendance(organIds, startTime, classGroupIds);
+				teacherNotAClassMap = MapUtil.mapListToMap(teacherNotAClassMapList, Integer.class, Integer.class);
+			}
+
+			//服务指标异常
+			Map<String, Object> params = new HashMap<>();
+			LocalDate nowDate = LocalDateTime.now(DateUtil.zoneId).toLocalDate();
+			LocalDate monDayDate = nowDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue());
+			LocalDate sunDayDate = nowDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.SUNDAY.getValue());
+			params.put("organIds", organIds);
+			params.put("monday",monDayDate.toString());
+			params.put("sunday",sunDayDate.toString());
+			params.put("jobNature", JobNatureEnum.FULL_TIME);
+			params.put("unDone",1);
+			List<Map<Integer, Integer>> teacherServeErrorMapList = indexBaseMonthDataDao.countOrganTeacherServeInfo(params);
+			teacherServeErrorMap = MapUtil.mapListToMap(teacherServeErrorMapList, Integer.class, Integer.class);
+		}
+
+		List<Organization> organs = organizationDao.findOrgans(new ArrayList<>(organIds));
+
+		IndexErrorDataExportDto totalData = new IndexErrorDataExportDto();
+		totalData.setOrganName("总计");
+		for (Organization organ : organs) {
+			IndexErrorDataExportDto indexErrorData = new IndexErrorDataExportDto();
+			indexErrorData.setOrganId(organ.getId());
+			indexErrorData.setOrganName(organ.getName());
+
+			int total = 0;
+			//基础技能班学员数量异常
+			if(highClassStudentLessThanThreeMap.containsKey(organ.getId())){
+				indexErrorData.setHighClassStudentLessThanThreeNum(highClassStudentLessThanThreeMap.get(organ.getId()));
+			}
+			total += indexErrorData.getHighClassStudentLessThanThreeNum();
+			totalData.setHighClassStudentLessThanThreeNum(totalData.getHighClassStudentLessThanThreeNum() + indexErrorData.getHighClassStudentLessThanThreeNum());
+			//乐团巡查事项异常
+			if(musicPatrolItemMap.containsKey(organ.getId())){
+				indexErrorData.setMusicPatrolItem(musicPatrolItemMap.get(organ.getId()));
+			}
+			total += indexErrorData.getMusicPatrolItem();
+			totalData.setMusicPatrolItem(totalData.getMusicPatrolItem() + indexErrorData.getMusicPatrolItem());
+			//未加入任何班级学员
+			if(organNoClassMusicGroupStudentNumMap.containsKey(organ.getId())){
+				indexErrorData.setNoClassMusicGroupStudentInfo(organNoClassMusicGroupStudentNumMap.get(organ.getId()));
+			}
+			total += indexErrorData.getNoClassMusicGroupStudentInfo();
+			totalData.setNoClassMusicGroupStudentInfo(totalData.getNoClassMusicGroupStudentInfo() + indexErrorData.getNoClassMusicGroupStudentInfo());
+			//未缴费学员数
+			if(studentNotPaymentMap.containsKey(organ.getId())){
+				indexErrorData.setStudentNotPayment(studentNotPaymentMap.get(organ.getId()));
+			}
+			total += indexErrorData.getStudentNotPayment();
+			totalData.setStudentNotPayment(totalData.getStudentNotPayment() + indexErrorData.getStudentNotPayment());
+			//申请退团学员数
+			if(studentApplyForQuitMusicGroupMap.containsKey(organ.getId())){
+				indexErrorData.setStudentApplyForQuitMusicGroup(studentApplyForQuitMusicGroupMap.get(organ.getId()));
+			}
+			total += indexErrorData.getStudentApplyForQuitMusicGroup();
+			totalData.setStudentApplyForQuitMusicGroup(totalData.getStudentApplyForQuitMusicGroup() + indexErrorData.getStudentApplyForQuitMusicGroup());
+			//预计课酬较低
+			if(teacherExpectSalaryBeLowMap.containsKey(organ.getId())){
+				indexErrorData.setTeacherExpectSalaryBeLow(teacherExpectSalaryBeLowMap.get(organ.getId()));
+			}
+			total += indexErrorData.getTeacherExpectSalaryBeLow();
+			totalData.setTeacherExpectSalaryBeLow(totalData.getTeacherExpectSalaryBeLow() + indexErrorData.getTeacherExpectSalaryBeLow());
+			//课程时间安排异常
+			if(courseTimeErrorMap.containsKey(organ.getId())){
+				indexErrorData.setCourseTimeError(courseTimeErrorMap.get(organ.getId()));
+			}
+			total += indexErrorData.getCourseTimeError();
+			totalData.setCourseTimeError(totalData.getCourseTimeError() + indexErrorData.getCourseTimeError());
+			//乐团巡查任务未计划
+			if(inspectionItemMap.containsKey(organ.getId())){
+				indexErrorData.setInspectionItem(inspectionItemMap.get(organ.getId()));
+			}
+			total += indexErrorData.getInspectionItem();
+			totalData.setInspectionItem(totalData.getInspectionItem() + indexErrorData.getInspectionItem());
+			//乐团巡查任务未提交
+			if(inspectionItemPlanMap.containsKey(organ.getId())){
+				indexErrorData.setInspectionItemPlan(inspectionItemPlanMap.get(organ.getId()));
+			}
+			total += indexErrorData.getInspectionItemPlan();
+			totalData.setInspectionItemPlan(totalData.getInspectionItemPlan() + indexErrorData.getInspectionItemPlan());
+			//回访任务未完成
+			if(studentVisitMap.containsKey(organ.getId())){
+				indexErrorData.setStudentVisit(studentVisitMap.get(organ.getId()));
+			}
+			total += indexErrorData.getStudentVisit();
+			totalData.setStudentVisit(totalData.getStudentVisit() + indexErrorData.getStudentVisit());
+			//课程考勤异常
+			if(teacherExceptionAttendanceMap.containsKey(organ.getId())){
+				indexErrorData.setTeacherExceptionAttendance(teacherExceptionAttendanceMap.get(organ.getId()));
+			}
+			total += indexErrorData.getTeacherExceptionAttendance();
+			totalData.setTeacherExceptionAttendance(totalData.getTeacherExceptionAttendance() + indexErrorData.getTeacherExceptionAttendance());
+			//课程异常
+			if(teacherNotAClassMap.containsKey(organ.getId())){
+				indexErrorData.setTeacherNotAClass(teacherNotAClassMap.get(organ.getId()));
+			}
+			total += indexErrorData.getTeacherNotAClass();
+			totalData.setTeacherNotAClass(totalData.getTeacherNotAClass() + indexErrorData.getTeacherNotAClass());
+			//服务指标异常
+			if(teacherServeErrorMap.containsKey(organ.getId())){
+				indexErrorData.setTeacherServeError(teacherServeErrorMap.get(organ.getId()));
+			}
+			total += indexErrorData.getTeacherServeError();
+			totalData.setTeacherServeError(totalData.getTeacherServeError() + indexErrorData.getTeacherServeError());
+			indexErrorData.setTotal(total);
+			totalData.setTotal(totalData.getTotal() + indexErrorData.getTotal());
+			results.add(indexErrorData);
+		}
+		results.add(totalData);
+
+		return results;
+	}
+
+	@Override
 	public List<IndexErrInfoDto> getRemindMatterData(String organIds) {
 		SysUser sysUser = sysUserFeignService.queryUserInfo();
 		if (sysUser == null) {

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

@@ -650,6 +650,36 @@
 		) t
 	</select>
 
+	<select id="countLessThenThreeClassOrganGroupNum" resultType="map">
+		SELECT t.organ_id_ AS 'key',
+		       COUNT(t.id_) AS 'value'
+		FROM (
+		SELECT mg.organ_id_,cg.id_ FROM
+		class_group cg
+		LEFT JOIN class_group_student_mapper cgsm ON cg.id_ = cgsm.class_group_id_
+		LEFT JOIN music_group mg ON cg.music_group_id_=mg.id_
+		LEFT JOIN course_schedule cs ON cs.class_group_id_=cg.id_
+		WHERE
+		cg.type_ IN ('HIGH', 'HIGH_ONLINE')
+		AND mg.status_ = 'PROGRESS' AND cg.del_flag_ = 0
+		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=",">
+				#{organId}
+			</foreach>
+		</if>
+		GROUP BY cg.id_
+		HAVING
+		COUNT(DISTINCT CASE WHEN cgsm.status_ = 'NORMAL' THEN cgsm.user_id_ ELSE NULL END) &lt; 3
+		) t GROUP BY t.organ_id_
+	</select>
+
     <select id="getLessThenThreeMusicGroup" resultType="java.lang.String">
 		SELECT cg.music_group_id_ FROM
 		class_group cg
@@ -691,6 +721,30 @@
 		</if>
 	</select>
 
+	<select id="countOrganNoPaymentStudentNum" resultType="map">
+		SELECT
+		    mg.organ_id_ AS 'key',
+			COUNT(DISTINCT mgpc.music_group_id_,mgpcd.user_id_) AS 'value'
+		FROM
+		music_group_payment_calender_detail mgpcd
+		LEFT JOIN music_group_payment_calender mgpc ON mgpcd.music_group_payment_calender_id_ = mgpc.id_
+		LEFT JOIN music_group mg ON mgpc.music_group_id_ = mg.id_
+		WHERE
+		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=",">
+				#{organId}
+			</foreach>
+		</if>
+		GROUP BY mg.organ_id_
+	</select>
+
 	<select id="getNoPaymentMusicGroup" resultType="java.lang.String">
 		SELECT
 			DISTINCT mg.id_
@@ -729,6 +783,26 @@
 		</if>
 	</select>
 
+	<select id="queryOrganApplyForQuitGroupNum" resultType="map">
+		SELECT
+			mg.organ_id_ AS 'key',
+		    COUNT(mgq.id_) AS 'value'
+		FROM music_group_quit mgq
+		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=",">
+				#{organId}
+			</foreach>
+		</if>
+		GROUP BY mg.organ_id_
+	</select>
+
 	<select id="queryStudentAttendanceInfo" resultType="int">
 		SELECT
 			COUNT(DISTINCT cssp.id_)
@@ -770,6 +844,29 @@
 			</foreach>
 		</if>
 	</select>
+
+	<select id="getOrganCourseTimeError" resultType="map">
+		SELECT
+		       cs.organ_id_ AS 'key',
+		       COUNT(cs.id_) AS 'value'
+		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=",">
+				#{organId}
+			</foreach>
+		</if>
+		GROUP BY cs.organ_id_
+	</select>
+
     <select id="getAttendanceError" resultType="int">
 		SELECT COUNT(DISTINCT c.id_) FROM (SELECT cs.id_ FROM course_schedule cs
 		LEFT JOIN teacher_attendance ta ON ta.course_schedule_id_ = cs.id_
@@ -794,6 +891,35 @@
 		</if>
 		GROUP BY cs.id_) c
 	</select>
+
+	<select id="getOrganAttendanceError" resultType="map">
+		SELECT
+			c.organ_id_ AS 'key',
+		    COUNT(DISTINCT c.id_) AS 'value'
+		FROM (SELECT cs.organ_id_,cs.id_ FROM course_schedule cs
+		LEFT JOIN teacher_attendance ta ON ta.course_schedule_id_ = cs.id_
+		LEFT JOIN course_schedule_student_payment cssp ON cssp.course_schedule_id_ = cs.id_
+		LEFT JOIN student_attendance sa ON sa.course_schedule_id_ = cssp.course_schedule_id_ AND cssp.user_id_ = sa.user_id_
+		WHERE ta.teacher_id_ = cs.actual_teacher_id_
+		AND cs.status_ = 'OVER' AND cs.del_flag_ = 0 AND cs.class_date_ >= '2021-02-01'
+		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=",">
+				#{organId}
+			</foreach>
+		</if>
+		GROUP BY cs.id_) c GROUP BY c.organ_id_
+	</select>
+
 	<select id="getNoAttendance" resultType="int">
 		SELECT COUNT(DISTINCT cs.id_) FROM course_schedule cs
 		LEFT JOIN teacher_attendance ta ON ta.course_schedule_id_ = cs.id_
@@ -814,6 +940,32 @@
 			</foreach>
 		</if>
 	</select>
+
+	<select id="getOrganNoAttendance" resultType="map">
+		SELECT
+		    cs.organ_id_ AS 'key',
+		    COUNT(DISTINCT cs.id_) AS 'value'
+		FROM course_schedule cs
+		LEFT JOIN teacher_attendance ta ON ta.course_schedule_id_ = cs.id_
+		WHERE ta.teacher_id_ = cs.actual_teacher_id_
+		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=",">
+				#{organId}
+			</foreach>
+		</if>
+		GROUP BY cs.organ_id_
+	</select>
+
 	<select id="queryTeacherLeave" resultType="int">
 		SELECT COUNT(DISTINCT tlr.id_) FROM teacher_leave_record tlr
 		LEFT JOIN teacher t ON t.id_ = tlr.user_id_
@@ -832,6 +984,22 @@
 			AND FIND_IN_SET(tcs.organ_id_,#{organIdsStr})
 		</if>
 	</select>
+
+	<select id="queryOrganLowTeacherSalary" resultType="map">
+		SELECT
+			tcs.organ_id_ AS 'key',
+			COUNT(DISTINCT tcs.user_id_) AS 'value'
+		FROM teacher_course_statistics tcs
+		LEFT JOIN teacher t ON t.id_ = tcs.user_id_
+		LEFT JOIN sys_user su ON su.id_ = tcs.user_id_
+		WHERE su.lock_flag_ = 0 AND su.del_flag_ = 0 AND t.job_nature_ = 'FULL_TIME' AND t.demission_date_ IS NULL
+		AND 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>
+		GROUP BY tcs.organ_id_
+	</select>
+
 	<select id="queryInspectionItem" resultType="int">
 		SELECT COUNT(DISTINCT ii.id_) FROM inspection_item ii
 		LEFT JOIN inspection i ON ii.inspection_id_ = i.id_
@@ -844,6 +1012,24 @@
 			AND ii.user_id_ = #{userId}
 		</if>
 	</select>
+
+	<select id="queryOrganInspectionItem" resultType="map">
+		SELECT
+		       ii.organ_id_ AS 'key',
+		       COUNT(DISTINCT ii.id_) AS 'value'
+		FROM inspection_item ii
+		LEFT JOIN inspection i ON ii.inspection_id_ = i.id_
+		WHERE ii.times_ > planned_times_ AND ii.item_ = 'INSPECT' AND ii.memo_ =''
+		AND DATE_FORMAT(i.month_,'%Y-%m-%d') >= #{startTime}
+		<if test="organIdsStr != null and organIdsStr != ''">
+			AND FIND_IN_SET(ii.organ_id_,#{organIdsStr})
+		</if>
+		<if test="userId != null">
+			AND ii.user_id_ = #{userId}
+		</if>
+		GROUP BY ii.organ_id_
+	</select>
+
 	<select id="queryInspectionItemPlan" resultType="int">
 		SELECT COUNT(DISTINCT iip.id_) FROM inspection_item_plan iip
 		WHERE iip.status_ = 0 AND iip.memo_ = '' AND DATE_FORMAT(iip.plan_start_,'%Y-%m-%d') &lt; DATE_FORMAT(NOW(),'%Y-%m-%d')
@@ -852,6 +1038,20 @@
 			AND FIND_IN_SET(iip.organ_id_,#{organIdsStr})
 		</if>
 	</select>
+
+	<select id="queryOrganInspectionItemPlan" resultType="map">
+		SELECT
+			iip.organ_id_ AS 'key',
+		    COUNT(DISTINCT iip.id_) AS 'value'
+		FROM inspection_item_plan iip
+		WHERE iip.status_ = 0 AND iip.memo_ = '' AND DATE_FORMAT(iip.plan_start_,'%Y-%m-%d') &lt; DATE_FORMAT(NOW(),'%Y-%m-%d')
+		AND DATE_FORMAT(iip.plan_start_,'%Y-%m-%d') >= #{startTime} AND DATE_FORMAT(iip.plan_start_,'%Y-%m-%d') &lt;= DATE_FORMAT(NOW(),'%Y-%m-%d')
+		<if test="organIdsStr != null and organIdsStr != ''">
+			AND FIND_IN_SET(iip.organ_id_,#{organIdsStr})
+		</if>
+		GROUP BY iip.organ_id_
+	</select>
+
 	<select id="queryStudentVisit" resultType="int">
 		SELECT COUNT(DISTINCT ii.id_) FROM inspection_item ii
 		LEFT JOIN inspection i ON ii.inspection_id_ = i.id_
@@ -867,6 +1067,25 @@
 		</if>
 	</select>
 
+	<select id="queryOrganStudentVisit" resultType="map">
+		SELECT
+			ii.organ_id_ AS 'key',
+		    COUNT(DISTINCT ii.id_) AS 'value'
+		FROM inspection_item ii
+		LEFT JOIN inspection i ON ii.inspection_id_ = i.id_
+		WHERE ii.item_ = 'VISIT' AND ii.memo_ =''
+		AND ii.times_ > (SELECT COUNT(DISTINCT sv.id_) FROM student_visit sv
+		WHERE sv.teacher_id_ = ii.user_id_ AND DATE_FORMAT(i.month_,'%Y-%m') = DATE_FORMAT(sv.visit_time_,'%Y-%m'))
+		AND i.month_ >= #{startTime} AND i.month_ &lt;= DATE_FORMAT(NOW(),'%Y-%m-%d')
+		<if test="organIdsStr != null and organIdsStr != ''">
+			AND FIND_IN_SET(ii.organ_id_,#{organIdsStr})
+		</if>
+		<if test="userId != null">
+			AND ii.user_id_ = #{userId}
+		</if>
+		GROUP BY ii.organ_id_
+	</select>
+
     <select id="queryErrInspection" resultType="int">
 		SELECT
 			COUNT(id_)
@@ -882,6 +1101,23 @@
 		</if>
 	</select>
 
+	<select id="queryOrganErrInspection" resultType="map">
+		SELECT
+			organ_id_ AS 'key',
+		    COUNT(id_) AS 'value'
+		FROM
+		inspection_item_plan
+		WHERE
+		conclusion_status_ = 1 AND memo_ = '' AND DATE_FORMAT(plan_start_,'%Y-%m-%d') >= #{startTime}
+		<if test="organIds!=null and organIds.size()>0">
+			AND organ_id_ IN
+			<foreach collection="organIds" item="organId" open="(" close=")" separator=",">
+				#{organId}
+			</foreach>
+		</if>
+		GROUP BY organ_id_
+	</select>
+
 	<select id="getNoClassMusicGroupStudentInfo" resultType="com.ym.mec.biz.dal.entity.IndexErrInfoDto">
 		SELECT
 			'NO_CLASS_MUSIC_GROUP_STUDENT_INFO' errorType,
@@ -906,6 +1142,30 @@
 			</if>
 	</select>
 
+	<select id="getOrganNoClassMusicGroupStudentNum" resultType="map">
+		SELECT
+		mg.organ_id_ AS 'key',
+		COUNT( sr.user_id_ ) AS 'value'
+		FROM
+		student_registration sr
+		LEFT JOIN music_group mg ON sr.music_group_id_ = mg.id_
+		LEFT JOIN class_group_student_mapper cgsm ON cgsm.group_type_='MUSIC' AND cgsm.music_group_id_=sr.music_group_id_ AND cgsm.user_id_=sr.user_id_ AND cgsm.status_='NORMAL'
+		WHERE
+		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=",">
+				#{organId}
+			</foreach>
+		</if>
+		GROUP BY mg.organ_id_
+	</select>
+
 	<select id="getFinancePayData"  resultMap="IndexBaseMonthData">
 		SELECT SUM(fe.amount_) total_num_,SUM(fe.amount_) activate_num_,SUM(fe.amount_) percent_,fe.organ_id_,#{dayStr} month_ FROM financial_expenditure fe
 		WHERE DATE_FORMAT(fe.create_time_,'%Y-%m-%d') = #{dayStr}
@@ -969,4 +1229,59 @@
 		</if>
 		GROUP BY DATE_FORMAT(spo.pay_time_,'%Y-%m-%d')
 	</select>
+
+	<sql id="queryTeacherServeInfoCondition">
+		<where>
+			<if test="organIds!=null and organIds.size()>0">
+				AND tea.organ_id_ IN
+				<foreach collection="organIds" item="organId" open="(" close=")" separator=",">
+					#{organId}
+				</foreach>
+			</if>
+			<if test="monday!=null and monday!='' and sunday!=null and sunday!=''">
+				AND sees.monday_ BETWEEN #{monday} AND #{sunday}
+			</if>
+			<if test="teacherId!=null">
+				AND sees.teacher_id_ = #{teacherId}
+			</if>
+			<if test="reminded!=null and reminded==0">
+				AND NOT EXISTS (SELECT id_ FROM teacher_remind WHERE teacher_id_=sees.teacher_id_ AND monday_ = sees.monday_ AND type_='SERVICE')
+			</if>
+			<if test="reminded!=null and reminded==1">
+				AND EXISTS (SELECT id_ FROM teacher_remind WHERE teacher_id_=sees.teacher_id_ AND monday_ = sees.monday_ AND type_='SERVICE')
+			</if>
+			<if test="operatorId!=null">
+				AND EXISTS (SELECT id_ FROM teacher_remind WHERE operator_id_=#{operatorId} AND teacher_id_=sees.teacher_id_ AND monday_ = sees.monday_ AND type_='SERVICE')
+			</if>
+			<if test="jobNature!=null">
+				AND tea.job_nature_=#{jobNature,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+			</if>
+		</where>
+	</sql>
+
+	<select id="countOrganTeacherServeInfo" resultType="map">
+		SELECT
+		    e.organ_id_ AS 'key',
+		    COUNT(1) AS 'value'
+		FROM (
+		SELECT
+			tea.organ_id_,
+			sees.id_
+		FROM
+		student_extracurricular_exercises_situation_ sees
+		LEFT JOIN teacher tea ON tea.id_=sees.teacher_id_
+		<include refid="queryTeacherServeInfoCondition" />
+		GROUP BY sees.monday_,sees.sunday_,sees.teacher_id_
+		<if test="unDone!=null">
+			HAVING
+			<if test="unDone==1">
+				SUM( sees.expect_exercises_num_-sees.not_over_course_num_ ) &gt; SUM( sees.actual_exercises_num_ )
+			</if>
+			<if test="unDone==0">
+				SUM( sees.expect_exercises_num_-sees.not_over_course_num_ ) &lt;= SUM( sees.actual_exercises_num_ )
+			</if>
+		</if>
+		ORDER BY sees.monday_,sees.sunday_,sees.teacher_id_
+		) e GROUP BY e.organ_id_
+	</select>
 </mapper>

+ 35 - 0
mec-util/src/main/java/com/ym/mec/util/collection/MapUtil.java

@@ -2,6 +2,7 @@ package com.ym.mec.util.collection;
 
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.springframework.util.CollectionUtils;
 
 import java.beans.BeanInfo;
 import java.beans.IntrospectionException;
@@ -9,6 +10,10 @@ import java.beans.Introspector;
 import java.beans.PropertyDescriptor;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
+import java.math.BigDecimal;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -153,6 +158,36 @@ public class MapUtil {
 		return result;
 	}
 
+
+	public static <Y, Z> Map<Y,Z> mapListToMap(List<Map<Y, Z>> maps, Class<Y> keyType, Class<Z> valueType){
+		Map<Y,Z> result = new HashMap();
+		try {
+			for (Map map : maps) {
+				Y key;
+				Z value;
+				if(keyType.isAssignableFrom(BigDecimal.class)){
+					key = (Y) BigDecimal.class.getDeclaredConstructor(String.class).newInstance(map.get("key"));
+				}else if(keyType.isAssignableFrom(String.class)){
+					key = (Y) String.valueOf(map.get("key"));
+				}else{
+					key = (Y) keyType.getMethod("valueOf", String.class).invoke(null, String.valueOf(map.get("key")));
+				}
+				if(valueType.isAssignableFrom(BigDecimal.class)){
+					value = (Z) BigDecimal.class.getDeclaredConstructor(String.class).newInstance(map.get("value"));
+				}else if(valueType.isAssignableFrom(String.class)){
+					value = (Z) String.valueOf(map.get("value"));
+				}else{
+					value = (Z) valueType.getMethod("valueOf", String.class).invoke(null, String.valueOf(map.get("value")));
+				}
+				result.put(key, value);
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+
+		return result;
+	}
+
 	/**
 	 * 经纬度转化成弧度
 	 * @param d

+ 58 - 0
mec-web/src/main/java/com/ym/mec/web/controller/ExportController.java

@@ -139,6 +139,8 @@ public class ExportController extends BaseController {
     private IdGeneratorService idGeneratorService;
     @Autowired
     private MusicGroupQuitService musicGroupQuitService;
+    @Autowired
+    private IndexBaseMonthDataService indexService;
 
     @ApiOperation(value = "班级列表导出")
     @PostMapping("export/classGroup")
@@ -2559,4 +2561,60 @@ public class ExportController extends BaseController {
             }
         }
     }
+
+    @ApiOperation(value = "首页异常统计导出")
+    @RequestMapping("export/exportIndexErrData")
+    @PreAuthorize("@pcs.hasPermissions('export/exportIndexErrData')")
+    public void exportIndexErrData(String organId, HttpServletResponse response) throws IOException {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            throw new BizException("用户信息获取失败");
+        }
+        Employee employee = employeeService.get(sysUser.getId());
+        if (StringUtils.isBlank(organId)) {
+            organId = employee.getOrganIdList();
+        }else if(StringUtils.isEmpty(employee.getOrganIdList())){
+            throw new BizException("用户所在分部异常");
+        }else {
+            List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+            if(!list.containsAll(Arrays.asList(organId.split(",")))){
+                throw new BizException("非法请求");
+            }
+        }
+        List<IndexErrorDataExportDto> result = indexService.exportIndexErrData(organId, null);
+        if (CollectionUtils.isEmpty(result)) {
+            response.setStatus(200);
+            response.setContentType("Content-Type: application/json;charset=UTF-8");
+            response.getOutputStream().write("{\"data\": null, \"code\": 500, \"status\": false, \"msg\": \"没有可导出的记录\"}".getBytes());
+            response.flushBuffer();
+            return;
+        }
+        OutputStream outputStream = response.getOutputStream();
+
+        try {
+            String[] header = {"分部", "基础技能班学员数量异常", "乐团巡查事项异常", "未在班级学员数", "未缴费学员数",
+                    "申请退团学员数", "预计课酬较低", "课程时间安排异常", "乐团巡查未计划", "乐团巡查任务未提交",
+                    "回访任务未完成", "课程考勤异常", "课程异常", "服务指标异常", "总计",};
+            String[] body = {"organName", "highClassStudentLessThanThreeNum", "musicPatrolItem", "noClassMusicGroupStudentInfo", "studentNotPayment",
+                    "studentApplyForQuitMusicGroup", "teacherExpectSalaryBeLow", "courseTimeError", "inspectionItem", "inspectionItemPlan",
+                    "studentVisit", "teacherExceptionAttendance", "teacherNotAClass", "teacherServeError", "total",};
+            HSSFWorkbook workbook = POIUtil.exportExcel(header, body, result);
+            response.setContentType("application/octet-stream");
+            response.setHeader("Content-Disposition", "attachment;filename=teacherDefaultSalary-" + DateUtil.getDate(new Date()) + ".xls");
+            response.flushBuffer();
+            outputStream = response.getOutputStream();
+            workbook.write(outputStream);
+            outputStream.flush();
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            if (outputStream != null) {
+                try {
+                    outputStream.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+    }
 }

+ 20 - 0
mec-web/src/main/java/com/ym/mec/web/controller/IndexController.java

@@ -177,6 +177,26 @@ public class IndexController extends BaseController {
 		return succeed(indexService.getIndexErrData(organId, errorType));
 	}
 
+	@GetMapping("/exportIndexErrData")
+	public HttpResponseResult exportIndexErrData(String organId, IndexErrorType errorType){
+		SysUser sysUser = sysUserFeignService.queryUserInfo();
+		if (sysUser == null) {
+			return failed("用户信息获取失败");
+		}
+		Employee employee = employeeService.get(sysUser.getId());
+		if (StringUtils.isBlank(organId)) {
+			organId = employee.getOrganIdList();
+		}else if(StringUtils.isEmpty(employee.getOrganIdList())){
+			return failed("用户所在分部异常");
+		}else {
+			List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
+			if(!list.containsAll(Arrays.asList(organId.split(",")))){
+				return failed("非法请求");
+			}
+		}
+		return succeed(indexService.exportIndexErrData(organId, errorType));
+	}
+
 	@GetMapping("/getRemindMatterData")
 	public HttpResponseResult getRemindMatterData(String organId){
 		SysUser sysUser = sysUserFeignService.queryUserInfo();