update 教研组

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

@ -32,11 +32,11 @@ import static cn.teammodel.utils.SchoolDateUtil.calculateWeekNum;
@Service
public class TeacherServiceImpl implements TeacherService {
@Resource
private SchoolGroupListRepository schoolGroupListRepository;
@Resource
private SchoolTeacherRepository schoolTeacherRepository;
@Resource
private SchoolGroupListRepository schoolGroupListRepository;
@Resource
private SchoolRepository schoolRepository;
@Resource
private LessonRecordRepository lessonRecordRepository;
@ -46,6 +46,7 @@ public class TeacherServiceImpl implements TeacherService {
public List<Map<String, Integer>> getTeacherList(TeacherDto teacherDto) {
List<Map<String, Integer>> result = new ArrayList<>();
Map<String, Integer> teacherCountMap = new HashMap<>();
Map<String, Integer> groupCountMap = new HashMap<>();
List<GroupList> groupLists = schoolGroupListRepository.findAllByCode("GroupList-" + teacherDto.getCode());
List<SchoolTeacher> schoolTeachers = schoolTeacherRepository.findAllByCode("Teacher-" + teacherDto.getCode());
teacherCountMap.put("教师总人数", schoolTeachers.size());
@ -83,13 +84,16 @@ public class TeacherServiceImpl implements TeacherService {
}
jobCountMap.entrySet().removeIf(entry -> entry.getKey().isEmpty());
Map<String, Integer> periodCountMap = getPeriodCountMap(periods,schoolTeachers);
for (GroupList groupList : groupLists) {
groupCountMap.put(groupList.getName(), groupList.getMembers().size());
}
periodCountMap.entrySet().removeIf(entry -> entry.getKey().isEmpty());
updatedSubjectCountMap.entrySet().removeIf(entry -> entry.getKey().isEmpty());
result.add(updatedSubjectCountMap);
result.add(jobCountMap);
result.add(periodCountMap);
result.add(teacherCountMap);
result.add(groupCountMap);
return result;
}
@ -267,7 +271,7 @@ public class TeacherServiceImpl implements TeacherService {
return updatedPeriodCountMap;
}
private static @NotNull Map<String, Integer> getStringIntegerMap(List<GroupList> groupLists) {
/*private static @NotNull Map<String, Integer> getStringIntegerMap(List<GroupList> groupLists) {
Map<String, Integer> periodCountMap = new HashMap<>();
// 遍历所有 GroupList 对象
for (GroupList group : groupLists) {
@ -282,5 +286,5 @@ public class TeacherServiceImpl implements TeacherService {
}
}
return periodCountMap;
}
}*/
}

@ -8,6 +8,6 @@ import com.azure.spring.data.cosmos.repository.Query;
import java.util.List;
public interface SchoolGroupListRepository extends CosmosRepository<GroupList, String> {
@Query("select * from GroupList as c where c.code = @code")
@Query("select * from GroupList as c where c.code = @code and c.type = 'research' and c.scope = 'school' ")
List<GroupList> findAllByCode(String code);
}

Loading…
Cancel
Save