|  | @@ -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;
 | 
	
	
		
			
				|  | @@ -32,11 +34,12 @@ import java.time.format.DateTimeFormatter;
 | 
	
		
			
				|  |  |  import java.util.*;
 | 
	
		
			
				|  |  |  import java.util.stream.Collectors;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import static com.ym.mec.biz.dal.enums.IndexDataType.FINANCE_AMOUNT;
 | 
	
		
			
				|  |  |  import static com.ym.mec.biz.dal.enums.IndexErrorType.WAIT_CREATE_PAYMENT_CALENDER;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  @Service
 | 
	
		
			
				|  |  |  public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBaseMonthData> implements IndexBaseMonthDataService {
 | 
	
		
			
				|  |  | -	
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  	@Autowired
 | 
	
		
			
				|  |  |  	private IndexBaseMonthDataDao indexBaseMonthDataDao;
 | 
	
		
			
				|  |  |  	@Autowired
 | 
	
	
		
			
				|  | @@ -105,10 +108,43 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  		Map<IndexDataType, List<IndexBaseMonthData>> typeDateMap = indexBaseDatas.stream().filter(d->Objects.nonNull(d.getDataType())).collect(Collectors.groupingBy(IndexBaseMonthData::getDataType));
 | 
	
		
			
				|  |  | -		typeDateMap.put(IndexDataType.FINANCE_PAY,indexBaseMonthDataDao.getFinancePayDataWithTimely(startDate.toString(), endDate.toString(), new ArrayList<>(organIds)));
 | 
	
		
			
				|  |  | +		List<IndexBaseMonthData> financePayDataWithTimely = indexBaseMonthDataDao.getFinancePayDataWithTimely(startDate.toString(), endDate.toString(), new ArrayList<>(organIds));
 | 
	
		
			
				|  |  | +		typeDateMap.put(IndexDataType.FINANCE_PAY,financePayDataWithTimely);
 | 
	
		
			
				|  |  |  		typeDateMap.put(IndexDataType.FINANCE_BALANCE_AMOUNT,indexBaseMonthDataDao.getFinanceBalanceDataWithTimely(startDate.toString(), endDate.toString(), new ArrayList<>(organIds)));
 | 
	
		
			
				|  |  | -		typeDateMap.put(IndexDataType.FINANCE_AMOUNT,indexBaseMonthDataDao.getFinanceActualDataWithTimely(startDate.toString(), endDate.toString(), new ArrayList<>(organIds)));
 | 
	
		
			
				|  |  | -		typeDateMap.put(IndexDataType.TOTAL_AMOUNT,indexBaseMonthDataDao.getTotalAmountDataWithTimely(startDate.toString(), endDate.toString(), new ArrayList<>(organIds)));
 | 
	
		
			
				|  |  | +		typeDateMap.put(FINANCE_AMOUNT,indexBaseMonthDataDao.getFinanceActualDataWithTimely(startDate.toString(), endDate.toString(), new ArrayList<>(organIds)));
 | 
	
		
			
				|  |  | +		List<IndexBaseMonthData> totalAmountDataWithTimely = indexBaseMonthDataDao.getTotalAmountDataWithTimely(startDate.toString(), endDate.toString(), new ArrayList<>(organIds));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		/*if(financePayDataWithTimely.size() > 0){
 | 
	
		
			
				|  |  | +			for (IndexBaseMonthData indexBaseMonthData : financePayDataWithTimely) {
 | 
	
		
			
				|  |  | +				BigDecimal percent = indexBaseMonthData.getPercent();
 | 
	
		
			
				|  |  | +				if(percent != null && percent.doubleValue() != 0d){
 | 
	
		
			
				|  |  | +					List<IndexBaseMonthData> collect = totalAmountDataWithTimely.stream().filter(e -> DateUtil.format(e.getMonth(), DateUtil.ISO_EXPANDED_DATE_FORMAT).
 | 
	
		
			
				|  |  | +							equals(DateUtil.format(indexBaseMonthData.getMonth(), DateUtil.ISO_EXPANDED_DATE_FORMAT))).collect(Collectors.toList());
 | 
	
		
			
				|  |  | +					IndexBaseMonthData totalAmountDate = null;
 | 
	
		
			
				|  |  | +					if(collect != null && collect.size() > 0){
 | 
	
		
			
				|  |  | +						totalAmountDate = collect.get(0);
 | 
	
		
			
				|  |  | +					}
 | 
	
		
			
				|  |  | +					if(totalAmountDate == null){
 | 
	
		
			
				|  |  | +						totalAmountDate = new IndexBaseMonthData();
 | 
	
		
			
				|  |  | +						totalAmountDate.setTotalNum(percent.negate());
 | 
	
		
			
				|  |  | +						totalAmountDate.setDataType(FINANCE_AMOUNT);
 | 
	
		
			
				|  |  | +						totalAmountDate.setActivateNum(percent.negate());
 | 
	
		
			
				|  |  | +						totalAmountDate.setOrganId(indexBaseMonthData.getOrganId());
 | 
	
		
			
				|  |  | +						totalAmountDate.setMonth(indexBaseMonthData.getMonth());
 | 
	
		
			
				|  |  | +						totalAmountDate.setPercent(percent.negate());
 | 
	
		
			
				|  |  | +						totalAmountDataWithTimely.add(totalAmountDate);
 | 
	
		
			
				|  |  | +					}else {
 | 
	
		
			
				|  |  | +						BigDecimal totalAmount = totalAmountDate.getPercent();
 | 
	
		
			
				|  |  | +						totalAmountDate.setActivateNum(totalAmount.subtract(percent));
 | 
	
		
			
				|  |  | +						totalAmountDate.setTotalNum(totalAmount.subtract(percent));
 | 
	
		
			
				|  |  | +						totalAmountDate.setPercent(totalAmount.subtract(percent));
 | 
	
		
			
				|  |  | +					}
 | 
	
		
			
				|  |  | +				}
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +			totalAmountDataWithTimely = totalAmountDataWithTimely.stream().sorted(Comparator.comparing(IndexBaseMonthData::getMonth)).collect(Collectors.toList());
 | 
	
		
			
				|  |  | +		}*/
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		typeDateMap.put(IndexDataType.TOTAL_AMOUNT,totalAmountDataWithTimely);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  		for (IndexDataType dataType : IndexDataType.values()) {
 | 
	
	
		
			
				|  | @@ -130,7 +166,7 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 | 
	
		
			
				|  |  |  			typeDateMap.put(dataType, new ArrayList<>(Arrays.asList(indexBaseMonthData)));
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -		BigDecimal totalAmount = BigDecimal.ZERO;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  		for (Map.Entry<IndexDataType, List<IndexBaseMonthData>> typeDateMapEntry : typeDateMap.entrySet()) {
 | 
	
		
			
				|  |  |  			Set<String> hasMonths = typeDateMapEntry.getValue().stream().map(d -> DateUtil.dateToString(d.getMonth(), "yyyy-MM-dd")).collect(Collectors.toSet());
 | 
	
		
			
				|  |  |  			LocalDate currentMonthDate = startDate;
 | 
	
	
		
			
				|  | @@ -167,7 +203,7 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 | 
	
		
			
				|  |  |  			}
 | 
	
		
			
				|  |  |  			IndexBaseDto indexBaseData = new IndexBaseDto(typeDateMapEntry.getKey(),typeDateMapEntry.getKey().getMsg());
 | 
	
		
			
				|  |  |  			indexBaseData.setIndexMonthData(typeDateMapEntry.getValue(), currentMonth);
 | 
	
		
			
				|  |  | -			if(IndexDataType.FINANCE_PAY.equals(typeDateMapEntry.getKey()) || IndexDataType.FINANCE_AMOUNT.equals(typeDateMapEntry.getKey()) ||
 | 
	
		
			
				|  |  | +			if(IndexDataType.FINANCE_PAY.equals(typeDateMapEntry.getKey()) || FINANCE_AMOUNT.equals(typeDateMapEntry.getKey()) ||
 | 
	
		
			
				|  |  |  				IndexDataType.FINANCE_BALANCE_AMOUNT.equals(typeDateMapEntry.getKey()) ||
 | 
	
		
			
				|  |  |  					IndexDataType.TOTAL_AMOUNT.equals(typeDateMapEntry.getKey())){
 | 
	
		
			
				|  |  |  				indexBaseData.setPercent(typeDateMapEntry.getValue().stream().map(IndexBaseMonthData::getPercent).reduce(BigDecimal.ZERO, BigDecimal::add));
 | 
	
	
		
			
				|  | @@ -223,10 +259,15 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 | 
	
		
			
				|  |  |  		saveData(indexBaseMonthDataDao.getGroupSurplusCourseData(dayStr, GroupType.PRACTICE, CourseStatusEnum.OVER), dayStr, IndexDataType.OVER_PRACTICE_COURSE_NUM);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  		//经营数据
 | 
	
		
			
				|  |  | -		saveData(indexBaseMonthDataDao.getFinancePayData(dayStr),dayStr,IndexDataType.FINANCE_PAY);
 | 
	
		
			
				|  |  | -		saveData(indexBaseMonthDataDao.getFinanceBalanceData(dayStr),dayStr,IndexDataType.FINANCE_BALANCE_AMOUNT);
 | 
	
		
			
				|  |  | -		saveData(indexBaseMonthDataDao.getFinanceActualData(dayStr),dayStr,IndexDataType.FINANCE_AMOUNT);
 | 
	
		
			
				|  |  | -		saveData(indexBaseMonthDataDao.getTotalAmountData(dayStr),dayStr,IndexDataType.TOTAL_AMOUNT);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +//		List<IndexBaseMonthData> financePayData = indexBaseMonthDataDao.getFinancePayData(dayStr);
 | 
	
		
			
				|  |  | +//		List<IndexBaseMonthData> financeBalanceData = indexBaseMonthDataDao.getFinanceBalanceData(dayStr);
 | 
	
		
			
				|  |  | +//		List<IndexBaseMonthData> financeActualData = indexBaseMonthDataDao.getFinanceActualData(dayStr);
 | 
	
		
			
				|  |  | +//
 | 
	
		
			
				|  |  | +//		saveData(financePayData,dayStr,IndexDataType.FINANCE_PAY);
 | 
	
		
			
				|  |  | +//		saveData(financeBalanceData,dayStr,IndexDataType.FINANCE_BALANCE_AMOUNT);
 | 
	
		
			
				|  |  | +//		saveData(financeActualData,dayStr,IndexDataType.FINANCE_AMOUNT);
 | 
	
		
			
				|  |  | +//		saveData(totalAmountData,dayStr,IndexDataType.TOTAL_AMOUNT);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  		//业务数据
 | 
	
		
			
				|  |  |  		saveData(indexBaseMonthDataDao.getHomeworkData(dayStr, null), monday.toString(), IndexDataType.HOMEWORK_CREATE_RATE);
 | 
	
	
		
			
				|  | @@ -315,10 +356,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);
 | 
	
	
		
			
				|  | @@ -335,7 +380,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);
 | 
	
	
		
			
				|  | @@ -357,10 +405,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();
 | 
	
	
		
			
				|  | @@ -371,12 +422,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));
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -391,6 +445,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){
 | 
	
	
		
			
				|  | @@ -399,8 +454,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());
 | 
	
	
		
			
				|  | @@ -425,6 +482,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) {
 |