zouxuan hace 5 meses
padre
commit
6bb7031d1a

+ 10 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServeServiceImpl.java

@@ -1,6 +1,7 @@
 package com.ym.mec.biz.service.impl;
 
 import com.alibaba.fastjson.JSON;
+import com.google.common.collect.Lists;
 import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.*;
@@ -14,6 +15,7 @@ import com.ym.mec.biz.service.SysTenantConfigService;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.tenant.TenantContextHolder;
 import com.ym.mec.util.date.DateUtil;
+import org.apache.commons.collections.ListUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -93,7 +95,7 @@ public class StudentServeServiceImpl implements StudentServeService {
         
         //查询进行中乐团在读的学生列表
         List<StudentRegistration> studentRegistrationList = studentRegistrationDao.queryServiceStudentByMusicGroupStatus(DateUtil.dateToString(nextMonday, "yyyy-MM-dd"), tenantId);
-        if(studentRegistrationList == null || studentRegistrationList.size() == 0){
+        if(CollectionUtils.isEmpty(studentRegistrationList)){
         	return;
         }
         
@@ -121,10 +123,13 @@ public class StudentServeServiceImpl implements StudentServeService {
             studentExtracurricularExercisesSituationService.deleteByMonday(monDayDate.toString(), studentIds);
             return;
         }
-        
-        //查询截止到本周有课的信息
-        List<StudentServeCourseDto> studentCutoffWeekCourseInfo = studentDao.getStudentFutureCourseInfo("2019-01-01", sunDayDate.toString(), studentIds, tenantId);
-        
+        //拆分studentIds,每次查询1000个学生
+        List<List<Integer>> partition = Lists.partition(studentIds, 1000);
+        List<StudentServeCourseDto> studentCutoffWeekCourseInfo = new ArrayList<>();
+        for (List<Integer> integers : partition) {
+            //查询截止到本周有课的信息
+            studentCutoffWeekCourseInfo.addAll(studentDao.getStudentFutureCourseInfo("2019-01-01", sunDayDate.toString(), integers, tenantId));
+        }
         Map<String,List<Integer>> musicGroupStudentIdListMap = new HashMap<String, List<Integer>>();
         
         Map<String, List<StudentServeCourseDto>> musicGroupStudentServiceCourseMap = studentCutoffWeekCourseInfo.stream().collect((Collectors.groupingBy(StudentServeCourseDto::getMusicGroupId)));