|
@@ -237,12 +237,12 @@ public class EvaluateObjectServiceImpl extends MPJBaseServiceImpl<EvaluateObject
|
|
|
List<EvaluateExecuterVo> executerList = new ArrayList<>();
|
|
|
if(evaluateExecuterVoMap.get(objectListVo.getClassId()) != null){
|
|
|
dataList.addAll(evaluateExecuterVoMap.get(objectListVo.getClassId()));
|
|
|
- if("random15".equals(dto.getExecuterCount()) && dataList.size() > 0){
|
|
|
+ if("random15".equals(dto.getExecuterCount()) && !dataList.isEmpty()){
|
|
|
List<Integer> randomList = new ArrayList<>();
|
|
|
Random random = new Random();
|
|
|
while(randomList.size() < 15){
|
|
|
int nextInt = random.nextInt(dataList.size());
|
|
|
- if(!randomList.contains(nextInt) && nextInt >= 0){
|
|
|
+ if(!randomList.contains(nextInt)){
|
|
|
randomList.add(nextInt);
|
|
|
}
|
|
|
}
|
|
@@ -310,6 +310,8 @@ public class EvaluateObjectServiceImpl extends MPJBaseServiceImpl<EvaluateObject
|
|
|
EvaluateManage manage = evaluateManageMapper.selectById(dto.getEvaluateManageId());
|
|
|
//查询这个年级的所有学生
|
|
|
List<EvaluateExecuterVo> newExecuterList = evaluateObjectMapper.getNewExecuterList(dto);
|
|
|
+ Map<String, List<EvaluateExecuterVo>> classExcuterMap = newExecuterList.stream().collect(Collectors.groupingBy(EvaluateExecuterVo::getClassId));
|
|
|
+
|
|
|
//查询每个班级的任课教师
|
|
|
List<ClassTeachersListVo> classTeachers = evaluateObjectMapper.getClassTeachers(manage);
|
|
|
List<ClassTeachersListVo> collect = classTeachers.stream().filter(p -> StrUtil.isNotEmpty(p.getTeacherId())).collect(Collectors.collectingAndThen(
|
|
@@ -337,34 +339,25 @@ public class EvaluateObjectServiceImpl extends MPJBaseServiceImpl<EvaluateObject
|
|
|
EvaluateObjectListVo objectListVo = new EvaluateObjectListVo();
|
|
|
|
|
|
Set<Long> classIds = classTeacherMap.get(teacherId).stream().map(ClassTeachersListVo::getClassId).collect(Collectors.toSet());
|
|
|
- List<EvaluateExecuterVo> studentList = new ArrayList<>();
|
|
|
- for (EvaluateExecuterVo el : newExecuterList) {
|
|
|
- if(!classIds.contains(Long.parseLong(el.getClassId()))){
|
|
|
- continue;
|
|
|
- }
|
|
|
- EvaluateExecuterVo evaluateExecuterVo = new EvaluateExecuterVo();
|
|
|
- evaluateExecuterVo.setExecuterId(el.getExecuterId());
|
|
|
- evaluateExecuterVo.setEvaluateObjectId(teacherId.trim());
|
|
|
- evaluateExecuterVo.setExecuterName(el.getExecuterName());
|
|
|
- evaluateExecuterVo.setEvaluateManageId(dto.getEvaluateManageId().toString());
|
|
|
- studentList.add(evaluateExecuterVo);
|
|
|
- }
|
|
|
|
|
|
List<EvaluateExecuterVo> currentExecuterList = new ArrayList<>();
|
|
|
- if("random15".equals(dto.getExecuterCount()) && studentList.size() > 0){
|
|
|
- List<Integer> randomList = new ArrayList<>();
|
|
|
- Random random = new Random();
|
|
|
- while(randomList.size() < 15){
|
|
|
- int nextInt = random.nextInt(studentList.size());
|
|
|
- if(!randomList.contains(nextInt) && nextInt >= 0){
|
|
|
- randomList.add(nextInt);
|
|
|
+ for (Long classId : classIds) {
|
|
|
+ List<EvaluateExecuterVo> studentList = classExcuterMap.get(classId.toString());
|
|
|
+ if("random15".equals(dto.getExecuterCount()) && !studentList.isEmpty()){
|
|
|
+ List<Integer> randomList = new ArrayList<>();
|
|
|
+ Random random = new Random();
|
|
|
+ while(randomList.size() < 15){
|
|
|
+ int nextInt = random.nextInt(studentList.size());
|
|
|
+ if(!randomList.contains(nextInt)){
|
|
|
+ randomList.add(nextInt);
|
|
|
+ }
|
|
|
}
|
|
|
+ for (Integer i : randomList) {
|
|
|
+ currentExecuterList.add(studentList.get(i));
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ currentExecuterList.addAll(studentList);
|
|
|
}
|
|
|
- for (Integer i : randomList) {
|
|
|
- currentExecuterList.add(studentList.get(i));
|
|
|
- }
|
|
|
- }else{
|
|
|
- currentExecuterList.addAll(studentList);
|
|
|
}
|
|
|
|
|
|
objectListVo.setObjectId(teacherId.trim());
|