Explorar o código

管乐迷需求一大堆

zouxuan %!s(int64=2) %!d(string=hai) anos
pai
achega
aa43529508

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

@@ -444,10 +444,7 @@ public interface IndexBaseMonthDataDao extends BaseDAO<Long, IndexBaseMonthData>
     List<IndexBaseMonthData> getStudentPracticeOrderNum(@Param("dayStr") String dayStr,@Param("tenantId") Integer tenantId);
 
     //当月排课异常
-    int getCurrentCourseError(@Param("userIdList") List<Integer> userIdList);
-
-    //当月排课异常
-    List<Integer> getCurrentCourseErrorUserIdList(@Param("month") String month,@Param("organIdList") Set<Integer> organIdList);
+    int getCurrentCourseError(@Param("month") String month,@Param("organIdList") Set<Integer> organIdList);
 
     //待续费学员提醒
     int getWaitRenewInfo(@Param("organIdList") Set<Integer> organIdList);

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

@@ -855,12 +855,13 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			four.setErrorType(IndexErrorType.ATTENDANCE_SERVE);
 			four.setDesc(IndexErrorType.ATTENDANCE_SERVE.getMsg());
 			List<IndexErrInfoDto> fourChild = new ArrayList<>();
-			//获取有排课异常的学员列表
-			String month = DateUtil.format(date,DateUtil.ISO_YEAR_MONTH_FORMAT);
-			CompletableFuture<List<Integer>> future = CompletableFuture.supplyAsync(() -> {
-                return indexBaseMonthDataDao.getCurrentCourseErrorUserIdList(month, organIdList);
-            });
 
+			CompletableFuture future1 = this.async(() -> {
+				String month = DateUtil.format(date,DateUtil.ISO_YEAR_MONTH_FORMAT);
+				//当月排课异常: (1)剩余课时(未开始+排课资格)4的学员,本月排课节数少于4节
+				int currentCourseError = indexBaseMonthDataDao.getCurrentCourseError(month,organIdList);
+				fourChild.add(new IndexErrInfoDto(IndexErrorType.CURRENT_COURSE_ERROR, currentCourseError));
+			});
 			CompletableFuture future2 = null;
 			CompletableFuture future3 = null;
 			if(classGroupIds == null || classGroupIds.size() > 0) {
@@ -882,17 +883,10 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 				//课程异常
 				fourChild.add(new IndexErrInfoDto(IndexErrorType.TEACHER_NOT_A_CLASS, 0));
 			}
-			List<Integer> userIdList = future.join();
-			if(CollectionUtils.isEmpty(userIdList)){
-				fourChild.add(new IndexErrInfoDto(IndexErrorType.CURRENT_COURSE_ERROR, 0));
-			}else {
-				//当月排课异常: (1)剩余课时(未开始+排课资格)4的学员,本月排课节数少于4节
-				int currentCourseError = indexBaseMonthDataDao.getCurrentCourseError(userIdList);
-				fourChild.add(new IndexErrInfoDto(IndexErrorType.CURRENT_COURSE_ERROR, currentCourseError));
-			}
 			if(classGroupIds == null || classGroupIds.size() > 0) {
 				future2.join();future3.join();
 			}
+			future1.join();
 			four.setNum(fourChild.stream().mapToInt(IndexErrInfoDto::getNum).sum());
 			four.setResult(fourChild);
 			all.add(four);

+ 5 - 10
mec-biz/src/main/resources/config/mybatis/IndexBaseMonthDataMapper.xml

@@ -2143,17 +2143,10 @@
 	</select>
     <select id="getCurrentCourseError" resultType="java.lang.Integer">
 		select COUNT(DISTINCT ss.user_id_) from student_statistics ss
-		where ss.no_schedule_num_ + ss.sub_course_num_ > 4 and (((ss.no_schedule_num_ > 0 OR ss.sub_course_num_) AND ss.lately_year_course_consumer_ > 0 AND ss.last_visit_status_ IS NULL) OR ss.last_visit_status_ = 'NORMAL')
-		AND ss.group_type_ = 'VIP' AND ss.user_id_ IN
-		<foreach collection="userIdList" open="(" close=")" item="item" separator=",">
-			#{item}
-		</foreach>
-	</select>
-    <select id="getCurrentCourseErrorUserIdList" resultType="java.lang.Integer">
-		select su.id_ from sys_user su
+		left join (select su.id_ from sys_user su
 		left join course_schedule_student_payment cssp ON cssp.user_id_ = su.id_
 		left join course_schedule cs ON cs.id_ = cssp.course_schedule_id_
-		AND DATE_FORMAT(cs.class_date_,'%Y-%m') = #{month} AND cs.type_ = 'VIP' AND cssp.group_type_ = 'VIP'
+		AND DATE_FORMAT(cs.class_date_,'%Y-%m') = #{month} AND cs.type_ = 'VIP' AND cssp.group_type_ = 'VIP' and cssp.user_id_ IS NOT NULL
 		where
 		<if test="organIdList != null and organIdList.size > 0">
 			su.organ_id_ IN
@@ -2161,7 +2154,9 @@
 				#{item}
 			</foreach>
 		</if>
-		group by su.id_ having COUNT(distinct cs.id_) &lt; 4 OR COUNT(distinct cs.id_) IS NULL
+		group by su.id_ having COUNT(distinct cs.id_) &lt; 4 OR COUNT(distinct cs.id_) IS NULL) cs ON cs.id_ = ss.user_id_
+		where ss.no_schedule_num_ + ss.sub_course_num_ > 4 and (((ss.no_schedule_num_ > 0 OR ss.sub_course_num_) AND ss.lately_year_course_consumer_ > 0 AND ss.last_visit_status_ IS NULL) OR ss.last_visit_status_ = 'NORMAL')
+		AND cs.id_ = ss.user_id_ and ss.group_type_ = 'VIP'
 	</select>
 	<select id="getWaitRenewInfo" resultType="java.lang.Integer">
 		select COUNT(ss.user_id_) from student_statistics ss

+ 1 - 1
mec-biz/src/main/resources/config/mybatis/StudentStatisticsMapper.xml

@@ -253,7 +253,7 @@
 					AND (ss.no_schedule_num_ > 0 OR ss.sub_course_num_ > 0) AND ss.lately_year_course_consumer_ > 0))
 				</if>
 				<if test="studentStatus == 'SLEEPY'">
-					AND (ss.last_visit_status_ = #{studentStatus} OR (ss.last_visit_status_ IS NULL AND ss.over_course_num_ > 0 AND (ss.sub_course_num_ > 0 OR ss.no_schedule_num_ > 0) AND ss.lately_year_course_consumer_ &lt;= 0))
+					AND (ss.last_visit_status_ = #{studentStatus} OR (ss.last_visit_status_ IS NULL AND (ss.no_schedule_num_ > 0 OR suca.course_balance_ > 0) AND (ss.over_course_num_ &lt;= 0 OR ss.lately_year_course_consumer_ &lt;= 0)))
 				</if>
 				<if test="studentStatus == 'LOST'">
 					AND (ss.last_visit_status_ = #{studentStatus} OR (ss.last_visit_status_ IS NULL AND ss.over_course_num_ > 0 AND ss.sub_course_num_ &lt;= 0 AND ss.no_schedule_num_ &lt;= 0 AND suca.course_balance_ &lt;= 0))