update 教研组

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

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

@ -8,6 +8,6 @@ import com.azure.spring.data.cosmos.repository.Query;
import java.util.List; import java.util.List;
public interface SchoolGroupListRepository extends CosmosRepository<GroupList, String> { 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); List<GroupList> findAllByCode(String code);
} }

Loading…
Cancel
Save