Procházet zdrojové kódy

首页优化,以及bug修改

zouxuan před 2 roky
rodič
revize
5c97473a6b

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

@@ -798,36 +798,38 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 		Integer educationId = educationUserId;
 		List<Long> classGroupIdList = classGroupIds;
 		Integer tenantId = TenantContextHolder.getTenantId();
+		List<Runnable> tasks;
 		if(IndexErrorType.MUSIC_PATROL.equals(errorType)){
 			IndexErrInfoDto<IndexErrInfoDto> one = new IndexErrInfoDto<>();
 			one.setErrorType(IndexErrorType.MUSIC_PATROL);
 			one.setDesc(IndexErrorType.MUSIC_PATROL.getMsg());
 			List<IndexErrInfoDto> oneChild = new ArrayList<>();
+			tasks = new ArrayList<>();
 			//基础技能班学员数量异常
-			CompletableFuture future1 = this.async(()->{
+			tasks.add(()->{
 					oneChild.add(new IndexErrInfoDto(IndexErrorType.HIGH_CLASS_STUDENT_LESS_THAN_THREE,
 						indexBaseMonthDataDao.countLessThenThreeClassGroupNum(organIdList,educationId,tenantId,false)));
 			});
 			//乐团巡查事项异常
-			CompletableFuture future2 = this.async(()->{
+			tasks.add(()->{
 					oneChild.add(new IndexErrInfoDto(IndexErrorType.MUSIC_PATROL_ITEM,
 						indexBaseMonthDataDao.queryErrInspection(organIdList,startTime,tenantId)));
 			});
 			//未加入任何班级学员
-			CompletableFuture future3 = this.async(()-> {
+			tasks.add(()-> {
 				IndexErrInfoDto noClassMusicGroupStudentInfo = indexBaseMonthDataDao.getNoClassMusicGroupStudentInfo(organIdList,educationId,tenantId,true);
 				noClassMusicGroupStudentInfo.setErrorType(IndexErrorType.NO_CLASS_MUSIC_GROUP_STUDENT_ERROR);
 				noClassMusicGroupStudentInfo.setDesc(IndexErrorType.NO_CLASS_MUSIC_GROUP_STUDENT_ERROR.getMsg());
 				oneChild.add(noClassMusicGroupStudentInfo);
 			});
             //学校巡堂
-            CompletableFuture future4 = this.async(()-> {
+			tasks.add(()-> {
                 IndexErrInfoDto schoolPatrolError = indexBaseMonthDataDao.getSchoolPatrolError(organIdList,tenantId);
                 schoolPatrolError.setErrorType(IndexErrorType.SCHOOL_PATROL);
                 schoolPatrolError.setDesc(IndexErrorType.SCHOOL_PATROL.getMsg());
                 oneChild.add(schoolPatrolError);
             });
-			future1.join();future2.join();future3.join();future4.join();
+			this.runByBewTransactional(tasks);
 			one.setNum(oneChild.stream().mapToInt(IndexErrInfoDto::getNum).sum());
 			one.setResult(oneChild);
 			all.add(one);
@@ -839,8 +841,9 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			two.setErrorType(IndexErrorType.STUDENT_INFO);
 			two.setDesc(IndexErrorType.STUDENT_INFO.getMsg());
 			List<IndexErrInfoDto> twoChild = new ArrayList<>();
+			tasks = new ArrayList<>();
 			//学员请假异常提醒(只提醒本月的异常)
-			CompletableFuture future1 = this.async(() -> {
+			tasks.add(() -> {
 				int studentErrorLeave = 0;
 				String studentErrorLeaveNum = sysTenantConfigService.getTenantConfigValue(SysConfigService.STUDENT_ERROR_LEAVE_NUM, tenantId);
 				if (StringUtils.isNotEmpty(studentErrorLeaveNum)) {
@@ -849,7 +852,7 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 				}
 				twoChild.add(new IndexErrInfoDto(IndexErrorType.STUDENT_ERROR_LEAVE,studentErrorLeave));
 			});
-			CompletableFuture future2 = this.async(() -> {
+			tasks.add(() -> {
 				//未缴费学员数
 				twoChild.add(new IndexErrInfoDto(IndexErrorType.STUDENT_ARREARAGE,
 						indexBaseMonthDataDao.countNoPaymentStudentNum(organIdList,educationId,tenantId,true), Arrays.asList(educationId)));
@@ -861,14 +864,14 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			});
 
 			//合作单位回款异常
-			CompletableFuture future3 = this.async(() -> {
+			tasks.add(() -> {
 				Map<String, Object> params1 = new HashMap<>();
 				params1.put("organId", organIdsStr);
 				params1.put("errorType", "COOPERATION_PAYMENT_ERROR");
 				twoChild.add(new IndexErrInfoDto(IndexErrorType.COOPERATION_PAYMENT_ERROR
 						, musicGroupCalenderRefundPeriodDao.countCoopRefund(params1)));
 			});
-			future1.join();future2.join();future3.join();
+			this.runByBewTransactional(tasks);
 			two.setNum(twoChild.stream().mapToInt(IndexErrInfoDto::getNum).sum());
 			two.setResult(twoChild);
 			all.add(two);
@@ -885,24 +888,24 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 				userId = sysUser.getId();
 			}
 			Integer userId1 = userId;
-			CompletableFuture future1 = this.async(() -> {
+			tasks = new ArrayList<>();
+			tasks.add(() -> {
 				//乐团巡查任务未计划
 				int inspectionItem = indexBaseMonthDataDao.queryInspectionItem(organIdsStr,startTime,userId1,tenantId);
 				threeChild.add(new IndexErrInfoDto(IndexErrorType.INSPECTION_ITEM,inspectionItem));
 			});
-			CompletableFuture future2 = this.async(() -> {
+			tasks.add(() -> {
 				//乐团巡查任务未提交
 				int inspectionItemPlan = indexBaseMonthDataDao.queryInspectionItemPlan(organIdsStr,startTime,tenantId);
 				threeChild.add(new IndexErrInfoDto(IndexErrorType.INSPECTION_ITEM_PLAN,inspectionItemPlan));
 
 			});
-			CompletableFuture future3 = this.async(() -> {
+			tasks.add(() -> {
 				//回访任务未完成
 				int studentVisit = indexBaseMonthDataDao.queryStudentVisit(organIdsStr,startTime,userId1,tenantId);
 				threeChild.add(new IndexErrInfoDto(IndexErrorType.STUDENT_VISIT,studentVisit));
 			});
-			future1.join();future2.join();future3.join();
-
+			this.runByBewTransactional(tasks);
 			three.setNum(threeChild.stream().mapToInt(IndexErrInfoDto::getNum).sum());
 			three.setResult(threeChild);
 			all.add(three);
@@ -913,8 +916,8 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			four.setErrorType(IndexErrorType.ATTENDANCE_SERVE);
 			four.setDesc(IndexErrorType.ATTENDANCE_SERVE.getMsg());
 			List<IndexErrInfoDto> fourChild = new ArrayList<>();
-
-			CompletableFuture future1 = this.async(() -> {
+			tasks = new ArrayList<>();
+			tasks.add(() -> {
 				String month = DateUtil.format(date,DateUtil.ISO_YEAR_MONTH_FORMAT);
 				//当月排课异常: (1)剩余课时(未开始+排课资格)4的学员,本月排课节数少于4节
 				int currentCourseError = indexBaseMonthDataDao.getCurrentCourseError(month,organIdList);
@@ -923,14 +926,14 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			CompletableFuture future2 = null;
 			CompletableFuture future3 = null;
 			if(classGroupIds == null || classGroupIds.size() > 0) {
-				future2 = this.async(() -> {
+				tasks.add(() -> {
 					//课程考勤异常
 					int teacherAttendanceError = indexBaseMonthDataDao.getTeacherAttendanceError(organIdList, startTime, classGroupIdList, tenantId);
 					int studentAttendanceError = indexBaseMonthDataDao.getStudentAttendanceError(organIdList, startTime, classGroupIdList, tenantId);
 					fourChild.add(new IndexErrInfoDto(IndexErrorType.TEACHER_EXCEPTION_ATTENDANCE, teacherAttendanceError));
 					fourChild.add(new IndexErrInfoDto(IndexErrorType.STUDENT_EXCEPTION_ATTENDANCE, studentAttendanceError));
 				});
-				future3 = this.async(() -> {
+				tasks.add(() -> {
 					int noAttendance = indexBaseMonthDataDao.getNoAttendance(organIdList, startTime, classGroupIdList, tenantId);
 					//课程异常
 					fourChild.add(new IndexErrInfoDto(IndexErrorType.TEACHER_NOT_A_CLASS, noAttendance));
@@ -941,10 +944,7 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 				//课程异常
 				fourChild.add(new IndexErrInfoDto(IndexErrorType.TEACHER_NOT_A_CLASS, 0));
 			}
-			if(classGroupIds == null || classGroupIds.size() > 0) {
-				future2.join();future3.join();
-			}
-			future1.join();
+			this.runByBewTransactional(tasks);
 			four.setNum(fourChild.stream().mapToInt(IndexErrInfoDto::getNum).sum());
 			four.setResult(fourChild);
 			all.add(four);