|
|
|
@ -1,5 +1,7 @@
|
|
|
|
|
package cn.teammodel.controller.admin.service.impl;
|
|
|
|
|
|
|
|
|
|
import cn.teammodel.common.ErrorCode;
|
|
|
|
|
import cn.teammodel.config.exception.ServiceException;
|
|
|
|
|
import cn.teammodel.controller.admin.service.TeacherService;
|
|
|
|
|
import cn.teammodel.model.dto.admin.teacher.TeacherDto;
|
|
|
|
|
import cn.teammodel.model.entity.common.GroupList;
|
|
|
|
@ -8,10 +10,14 @@ import cn.teammodel.model.entity.school.SchoolTeacher;
|
|
|
|
|
import cn.teammodel.repository.SchoolGroupListRepository;
|
|
|
|
|
import cn.teammodel.repository.SchoolRepository;
|
|
|
|
|
import cn.teammodel.repository.SchoolTeacherRepository;
|
|
|
|
|
import cn.teammodel.utils.GroupUtil;
|
|
|
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.core.env.Environment;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
@Service
|
|
|
|
|
public class TeacherServiceImpl implements TeacherService {
|
|
|
|
@ -21,11 +27,15 @@ public class TeacherServiceImpl implements TeacherService {
|
|
|
|
|
private SchoolTeacherRepository schoolTeacherRepository;
|
|
|
|
|
@Resource
|
|
|
|
|
private SchoolRepository schoolRepository;
|
|
|
|
|
@Autowired
|
|
|
|
|
private Environment env;
|
|
|
|
|
@Override
|
|
|
|
|
public List<Map<String, Integer>> getTeacherList(TeacherDto teacherDto) {
|
|
|
|
|
List<Map<String, Integer>> result = new ArrayList<>();
|
|
|
|
|
Map<String, Integer> teacherCountMap = new HashMap<>();
|
|
|
|
|
List<GroupList> groupLists = schoolGroupListRepository.findAllByCode("GroupList-" + teacherDto.getCode());
|
|
|
|
|
List<SchoolTeacher> schoolTeachers = schoolTeacherRepository.findAllByCode("Teacher-" + teacherDto.getCode());
|
|
|
|
|
teacherCountMap.put("教师总人数", schoolTeachers.size());
|
|
|
|
|
List<School> school = schoolRepository.findBaseById(teacherDto.getCode());
|
|
|
|
|
List<School.Subject> subjects = new ArrayList<>();
|
|
|
|
|
List<School.Period> periods = new ArrayList<>();
|
|
|
|
@ -66,9 +76,25 @@ public class TeacherServiceImpl implements TeacherService {
|
|
|
|
|
result.add(updatedSubjectCountMap);
|
|
|
|
|
result.add(jobCountMap);
|
|
|
|
|
result.add(periodCountMap);
|
|
|
|
|
result.add(teacherCountMap);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> getTeacherDetail(TeacherDto teacherDto, HttpServletRequest request) {
|
|
|
|
|
|
|
|
|
|
Map<String, Object> teachers;
|
|
|
|
|
//获取全学校教师名单详情
|
|
|
|
|
String url = env.getProperty("ies.server-url-get-teacher-all");
|
|
|
|
|
try {
|
|
|
|
|
teachers = GroupUtil.getGroupId(teacherDto,new GroupUtil(env), request,url);
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
|
throw new ServiceException(ErrorCode.SYSTEM_ERROR.getCode(), "数据转换错误");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return teachers;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static @NotNull Map<String, Integer> getStringIntegerMap(List<School.Subject> subjects, List<SchoolTeacher> schoolTeachers) {
|
|
|
|
|
Map<String, String> subjectNameMap = new HashMap<>();
|
|
|
|
|
for (School.Subject subject : subjects) {
|
|
|
|
|