|
|
@@ -8,7 +8,6 @@ import com.xjrsoft.common.enums.GenderDictionaryEnum;
|
|
|
import com.xjrsoft.common.exception.MyException;
|
|
|
import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
|
import com.xjrsoft.module.banding.dto.AutomaticBandingTaskDto;
|
|
|
-import com.xjrsoft.module.banding.dto.BandingTaskMajorConditionDto;
|
|
|
import com.xjrsoft.module.banding.dto.SureBandingTaskDto;
|
|
|
import com.xjrsoft.module.banding.entity.BandingRule;
|
|
|
import com.xjrsoft.module.banding.entity.BandingTask;
|
|
|
@@ -36,6 +35,7 @@ import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.Objects;
|
|
|
import java.util.Random;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -170,10 +170,46 @@ public class BandingTaskServiceImpl extends MPJBaseServiceImpl<BandingTaskMapper
|
|
|
classConditionMap.put(conditionDto.getMajorSetId(), conditionDto);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ Map<Long, List<BaseNewStudent>> majorStudentMap = new HashMap<>();
|
|
|
if(ruleCodes.contains("BR0002")){
|
|
|
/**
|
|
|
- * 1、先把每个专业匹配的学生
|
|
|
+ * 1、先把每个专业匹配的学生分组存一起,并按照分数高低排序
|
|
|
+ *
|
|
|
*/
|
|
|
+ for (Long majorSetId : classConditionMap.keySet()) {
|
|
|
+ List<BaseNewStudent> stuList = new ArrayList<>();
|
|
|
+ for (BaseNewStudent newStudent : baseNewStudents) {
|
|
|
+ if(!Objects.equals(majorSetId, newStudent.getFirstAmbitionId()) && !Objects.equals(majorSetId, newStudent.getSecondAmbitionId())){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Boolean> conditionList = new ArrayList<>();
|
|
|
+ BandingTaskMajorCondition condition = classConditionMap.get(majorSetId);
|
|
|
+ if(condition.getHeight() !=null && newStudent.getHeight() != null && newStudent.getHeight().compareTo(condition.getHeight()) >= 0 ){
|
|
|
+ conditionList.add(true);
|
|
|
+ }else if(condition.getHeight() !=null && newStudent.getHeight() != null && newStudent.getHeight().compareTo(condition.getHeight()) < 0){
|
|
|
+ conditionList.add(false);
|
|
|
+ }else if(condition.getHeight() !=null && newStudent.getHeight() == null){
|
|
|
+ conditionList.add(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(condition.getScore() !=null && newStudent.getScore() != null && newStudent.getScore().compareTo(condition.getScore()) >= 0 ){
|
|
|
+ conditionList.add(true);
|
|
|
+ }else if(condition.getScore() !=null && newStudent.getScore() != null && newStudent.getScore().compareTo(condition.getScore()) < 0){
|
|
|
+ conditionList.add(false);
|
|
|
+ }else if(condition.getScore() !=null && newStudent.getScore() == null){
|
|
|
+ conditionList.add(false);
|
|
|
+ }
|
|
|
+ //如果包含false,则表明不符合条件,这个学生跳过
|
|
|
+ if(conditionList.contains(false)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ stuList.add(newStudent);
|
|
|
+ }
|
|
|
+ stuList.sort((x1, x2) -> x1.getScore().compareTo(x2.getScore()));
|
|
|
+ majorStudentMap.put(majorSetId, stuList);
|
|
|
+ }
|
|
|
}
|
|
|
//存班级和学生的关系
|
|
|
Map<Long, Long> studentClassMap = new HashMap<>();
|
|
|
@@ -219,7 +255,7 @@ public class BandingTaskServiceImpl extends MPJBaseServiceImpl<BandingTaskMapper
|
|
|
continue;
|
|
|
}
|
|
|
//专业不匹配,直接跳过
|
|
|
- if(taskClass.getMajorSetId() != newStudent.getFirstAmbitionId() && taskClass.getMajorSetId() != newStudent.getSecondAmbitionId()){
|
|
|
+ if(!Objects.equals(taskClass.getMajorSetId(), newStudent.getFirstAmbitionId()) && !Objects.equals(taskClass.getMajorSetId(), newStudent.getSecondAmbitionId())){
|
|
|
continue;
|
|
|
}
|
|
|
//判断该班性别是否已满
|