|
|
@@ -24,10 +24,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import javax.validation.ValidationException;
|
|
|
-import java.util.Calendar;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Set;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
import java.util.stream.Stream;
|
|
|
|
|
|
@@ -300,13 +297,9 @@ public class LearnTeacherService {
|
|
|
dkCond.setLocations(sysUser.getLocation());
|
|
|
dkCond.setExamineeTypes(sysUser.getExamType().name());
|
|
|
Map<String, LearnDirectedKnowledge> directedKnowledgeMap = learnDirectedKnowledgeMapper.selectLearnDirectedKnowledgeList(dkCond).stream().collect(Collectors.toMap(LearnDirectedKnowledge::getDirectKey, t -> t));
|
|
|
- LearnDirectedKnowledge directedKnowledge = null;
|
|
|
- String groupName = StringUtils.trimToEmpty(plan.getMajorGroup());
|
|
|
+ LearnDirectedKnowledge directedKnowledge = getBestLearnDirectedKnowledge(plan, directedKnowledgeMap);
|
|
|
String modules = null;
|
|
|
- if(null != (directedKnowledge = directedKnowledgeMap.get(groupName + "_" + plan.getMajorName()))) {
|
|
|
- upStudent.setDirectKey(directedKnowledge.getDirectKey());
|
|
|
- modules = directedKnowledge.getModules();
|
|
|
- } else if(null != (directedKnowledge = directedKnowledgeMap.get(groupName))) {
|
|
|
+ if(null != directedKnowledge) {
|
|
|
upStudent.setDirectKey(directedKnowledge.getDirectKey());
|
|
|
modules = directedKnowledge.getModules();
|
|
|
}
|
|
|
@@ -315,6 +308,29 @@ public class LearnTeacherService {
|
|
|
return moduleSet.size() == 1 && moduleSet.contains("技能展示") ? "专业只考技能展示" : "";
|
|
|
}
|
|
|
|
|
|
+ private LearnDirectedKnowledge getBestLearnDirectedKnowledge(AMarjorPlan plan, Map<String, LearnDirectedKnowledge> directedKnowledgeMap) {
|
|
|
+ LearnDirectedKnowledge directedKnowledge = null;
|
|
|
+ String groupName = StringUtils.trimToEmpty(plan.getMajorGroup());
|
|
|
+ if(null != (directedKnowledge = directedKnowledgeMap.get(groupName + "_" + plan.getMajorName()))) {
|
|
|
+ return directedKnowledge;
|
|
|
+ }
|
|
|
+ for(String directKey : directedKnowledgeMap.keySet()) {
|
|
|
+ if(directKey.contains("、") && (directKey.startsWith(groupName + "_"))) {
|
|
|
+ Set<String> marjorSet = Arrays.stream(directKey.split("_|、")).filter(t -> !t.isEmpty()).collect(Collectors.toSet());
|
|
|
+ if(marjorSet.contains(plan.getMajorName())) {
|
|
|
+ return directedKnowledgeMap.get(directKey);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(null != (directedKnowledge = directedKnowledgeMap.get(groupName))) {
|
|
|
+ return directedKnowledge;
|
|
|
+ }
|
|
|
+ if(null != (directedKnowledge = directedKnowledgeMap.get(""))) {
|
|
|
+ return directedKnowledge;
|
|
|
+ }
|
|
|
+ return directedKnowledge;
|
|
|
+ }
|
|
|
+
|
|
|
public Set<Long> getSubjectIdSet(Long[] planIds) {
|
|
|
Set<Long> subjectIdSet = Sets.newHashSet();
|
|
|
if(ArrayUtils.isNotEmpty(planIds)) {
|
|
|
@@ -329,10 +345,7 @@ public class LearnTeacherService {
|
|
|
Map<String, LearnDirectedKnowledge> directedKnowledgeMap = learnDirectedKnowledgeMapper.selectLearnDirectedKnowledgeList(dkCond).stream().collect(Collectors.toMap(LearnDirectedKnowledge::getDirectKey, t -> t));
|
|
|
LearnDirectedKnowledge directedKnowledge = null;
|
|
|
for(AMarjorPlan plan : planList) {
|
|
|
- String groupName = StringUtils.trimToEmpty(plan.getMajorGroup());
|
|
|
- if(null != (directedKnowledge = directedKnowledgeMap.get(groupName + "_" + plan.getMajorName()))) {
|
|
|
- subjectIdSet.addAll(Stream.of(directedKnowledge.getSubjects().split(",")).map(t -> Long.parseLong(t.trim())).collect(Collectors.toList()));
|
|
|
- } else if(null != (directedKnowledge = directedKnowledgeMap.get(groupName))) {
|
|
|
+ if(null != (directedKnowledge = getBestLearnDirectedKnowledge(plan, directedKnowledgeMap))) {
|
|
|
subjectIdSet.addAll(Stream.of(directedKnowledge.getSubjects().split(",")).map(t -> Long.parseLong(t.trim())).collect(Collectors.toList()));
|
|
|
}
|
|
|
}
|
|
|
@@ -354,10 +367,7 @@ public class LearnTeacherService {
|
|
|
Map<String, LearnDirectedKnowledge> directedKnowledgeMap = learnDirectedKnowledgeMapper.selectLearnDirectedKnowledgeList(dkCond).stream().collect(Collectors.toMap(LearnDirectedKnowledge::getDirectKey, t -> t));
|
|
|
LearnDirectedKnowledge directedKnowledge = null;
|
|
|
for(AMarjorPlan plan : planList) {
|
|
|
- String groupName = StringUtils.trimToEmpty(plan.getMajorGroup());
|
|
|
- if(null != (directedKnowledge = directedKnowledgeMap.get(groupName + "_" + plan.getMajorName()))) {
|
|
|
- knowledgeIdSet.addAll(Stream.of(directedKnowledge.getKnowledges().split(",")).map(t -> Long.parseLong(t.trim())).collect(Collectors.toList()));
|
|
|
- } else if(null != (directedKnowledge = directedKnowledgeMap.get(groupName))) {
|
|
|
+ if(null != (directedKnowledge = getBestLearnDirectedKnowledge(plan, directedKnowledgeMap))) {
|
|
|
knowledgeIdSet.addAll(Stream.of(directedKnowledge.getKnowledges().split(",")).map(t -> Long.parseLong(t.trim())).collect(Collectors.toList()));
|
|
|
}
|
|
|
}
|