update 学段内容

develop
hhb@hotmail.com 1 month ago
parent 5933e2daee
commit 6e1bfdc6c9

@ -82,7 +82,7 @@ public class TeacherServiceImpl implements TeacherService {
}
}
jobCountMap.entrySet().removeIf(entry -> entry.getKey().isEmpty());
Map<String, Integer> periodCountMap = getPeriodCountMap(groupLists, periods);
Map<String, Integer> periodCountMap = getPeriodCountMap(periods,schoolTeachers);
periodCountMap.entrySet().removeIf(entry -> entry.getKey().isEmpty());
updatedSubjectCountMap.entrySet().removeIf(entry -> entry.getKey().isEmpty());
@ -230,15 +230,25 @@ public class TeacherServiceImpl implements TeacherService {
return updatedSubjectCountMap;
}
private static @NotNull Map<String, Integer> getPeriodCountMap(List<GroupList> groupLists,List<School.Period> periods) {
private static @NotNull Map<String, Integer> getPeriodCountMap(List<School.Period> periods,List<SchoolTeacher> schoolTeachers) {
Map<String, Integer> periodCountMap = new HashMap<>();
for (School.Period period : periods) {
for ( School.Subject subject : period.getSubjects()) {
for (SchoolTeacher schoolTeacher : schoolTeachers) {
if (schoolTeacher.getSubjectIds().contains(subject.getId())) {
periodCountMap.put(period.getId(), periodCountMap.getOrDefault(period.getId(), 0) + 1);
}
}
}
}
Map<String, String> periodNameMap = new HashMap<>();
List<String> periodNames = new ArrayList<>();
for (School.Period period : periods) {
periodNameMap.put(period.getId(), period.getName());
periodNames.add(period.getName());
}
Map<String, Integer> periodCountMap = getStringIntegerMap(groupLists);
//Map<String, Integer> periodCountMap = getStringIntegerMap(groupLists);
// 更新 periodCountMap 的 key 为 period 名称
Map<String, Integer> updatedPeriodCountMap = new HashMap<>();
for (Map.Entry<String, Integer> entry : periodCountMap.entrySet()) {
@ -249,14 +259,10 @@ public class TeacherServiceImpl implements TeacherService {
updatedPeriodCountMap.put(periodName, count);
}
}
for(Map.Entry<String, Integer> entry : updatedPeriodCountMap.entrySet()) {
String name = entry.getKey();
for (String periodName : periodNames) {
if(!name.equals(periodName)){
updatedPeriodCountMap.put(periodName, 0);
}
}
for (String periodName : periodNames) {
if(!updatedPeriodCountMap.containsKey(periodName)) {
updatedPeriodCountMap.put(periodName, 0);
}
}
return updatedPeriodCountMap;
}

@ -18,7 +18,7 @@ import java.util.Map;
/**
* ,,
* @author winter
* @create 2023-11-28 10:15
* &#064;create 2023-11-28 10:15
*/
public class SchoolDateUtil {

Loading…
Cancel
Save