|
@@ -142,7 +142,7 @@ public class BandingTaskServiceImpl extends MPJBaseServiceImpl<BandingTaskMapper
|
|
}
|
|
}
|
|
//1、查询需要分班的学生信息
|
|
//1、查询需要分班的学生信息
|
|
List<String> orderColumn = new ArrayList();
|
|
List<String> orderColumn = new ArrayList();
|
|
- orderColumn.add("height");orderColumn.add("score");
|
|
|
|
|
|
+ orderColumn.add("score");
|
|
List<BaseNewStudent> baseNewStudents = newStudentService.selectJoinList(BaseNewStudent.class,
|
|
List<BaseNewStudent> baseNewStudents = newStudentService.selectJoinList(BaseNewStudent.class,
|
|
new MPJLambdaWrapper<BaseNewStudent>()
|
|
new MPJLambdaWrapper<BaseNewStudent>()
|
|
.select(BaseNewStudent::getId)
|
|
.select(BaseNewStudent::getId)
|
|
@@ -420,6 +420,15 @@ public class BandingTaskServiceImpl extends MPJBaseServiceImpl<BandingTaskMapper
|
|
List<BandingTaskClass> classList){
|
|
List<BandingTaskClass> classList){
|
|
Map<Long, List<BaseNewStudent>> classStudentMap = new HashMap<>();
|
|
Map<Long, List<BaseNewStudent>> classStudentMap = new HashMap<>();
|
|
for (Long majorSetId : classConditionMap.keySet()) {
|
|
for (Long majorSetId : classConditionMap.keySet()) {
|
|
|
|
+ //查询该专业下面有几个班级,把这部分学生按照成绩均匀分组
|
|
|
|
+ List<List<BaseNewStudent>> result = new ArrayList<>();
|
|
|
|
+ for (int i = 0; i < classList.size(); i++) {
|
|
|
|
+ result.add(new ArrayList<>());
|
|
|
|
+ }
|
|
|
|
+ if(result.size() == 1){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
// 1、先把每个专业匹配的学生分组存一起,并按照分数高低排序
|
|
// 1、先把每个专业匹配的学生分组存一起,并按照分数高低排序
|
|
List<BaseNewStudent> stuList = new ArrayList<>();
|
|
List<BaseNewStudent> stuList = new ArrayList<>();
|
|
|
|
|
|
@@ -460,15 +469,9 @@ public class BandingTaskServiceImpl extends MPJBaseServiceImpl<BandingTaskMapper
|
|
Collections.sort(stuList, (s1, s2) -> (int) (s2.getScore().doubleValue() - s1.getScore().doubleValue())); //按照成绩降序排序
|
|
Collections.sort(stuList, (s1, s2) -> (int) (s2.getScore().doubleValue() - s1.getScore().doubleValue())); //按照成绩降序排序
|
|
}
|
|
}
|
|
|
|
|
|
- //查询该专业下面有几个班级,把这部分学生按照成绩均匀分组
|
|
|
|
- List<List<BaseNewStudent>> result = new ArrayList<>();
|
|
|
|
- for (int i = 0; i < classList.size(); i++) {
|
|
|
|
- result.add(new ArrayList<>());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
for (int i = 0; i < stuList.size(); i++) {
|
|
for (int i = 0; i < stuList.size(); i++) {
|
|
BaseNewStudent currentStudent = stuList.get(i);
|
|
BaseNewStudent currentStudent = stuList.get(i);
|
|
- int classIndex = i % classList.size(); //分配班级
|
|
|
|
|
|
+ int classIndex = i % result.size(); //分配班级
|
|
result.get(classIndex).add(currentStudent);
|
|
result.get(classIndex).add(currentStudent);
|
|
}
|
|
}
|
|
|
|
|