|
|
@ -12,6 +12,7 @@ import cn.teammodel.model.entity.school.LessonRecord;
|
|
|
|
import cn.teammodel.model.entity.school.School;
|
|
|
|
import cn.teammodel.model.entity.school.School;
|
|
|
|
import cn.teammodel.model.entity.school.SchoolTeacher;
|
|
|
|
import cn.teammodel.model.entity.school.SchoolTeacher;
|
|
|
|
import cn.teammodel.model.vo.admin.GpTeacherVo;
|
|
|
|
import cn.teammodel.model.vo.admin.GpTeacherVo;
|
|
|
|
|
|
|
|
import cn.teammodel.model.vo.admin.TeacherGradeVo;
|
|
|
|
import cn.teammodel.repository.LessonRecordRepository;
|
|
|
|
import cn.teammodel.repository.LessonRecordRepository;
|
|
|
|
import cn.teammodel.repository.SchoolGroupListRepository;
|
|
|
|
import cn.teammodel.repository.SchoolGroupListRepository;
|
|
|
|
import cn.teammodel.repository.SchoolRepository;
|
|
|
|
import cn.teammodel.repository.SchoolRepository;
|
|
|
@ -144,11 +145,51 @@ public class TeacherServiceImpl implements TeacherService {
|
|
|
|
Map<String, Long> degreeCount = gpTeachers.stream()
|
|
|
|
Map<String, Long> degreeCount = gpTeachers.stream()
|
|
|
|
.filter(gpTeacher -> gpTeacher.getDegree() != null)
|
|
|
|
.filter(gpTeacher -> gpTeacher.getDegree() != null)
|
|
|
|
.collect(Collectors.groupingBy(GpTeacher::getDegree, Collectors.counting()));
|
|
|
|
.collect(Collectors.groupingBy(GpTeacher::getDegree, Collectors.counting()));
|
|
|
|
Map<String, Integer> practiceCount = getStringIntegerMap(teacherDto, gpTeachers);
|
|
|
|
//Map<String, Integer> practiceCount = getStringIntegerMap(teacherDto, gpTeachers);
|
|
|
|
|
|
|
|
|
|
|
|
teachers.put("practice", practiceCount);
|
|
|
|
if(!genderCount.containsKey("F")) {
|
|
|
|
|
|
|
|
genderCount.put("F",0L);
|
|
|
|
|
|
|
|
}else if (!genderCount.containsKey("S")) {
|
|
|
|
|
|
|
|
genderCount.put("S",0L);
|
|
|
|
|
|
|
|
}else if (!genderCount.containsKey("M")){
|
|
|
|
|
|
|
|
genderCount.put("M",0L);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Map<String, Object> genderMap = new HashMap<>();
|
|
|
|
|
|
|
|
Map<String, Object> practiceMap = new HashMap<>();
|
|
|
|
|
|
|
|
for (GpTeacher gpTeacher : gpTeachers) {
|
|
|
|
|
|
|
|
genderMap.put(gpTeacher.basic.name, gpTeacher.basic.gender);
|
|
|
|
|
|
|
|
practiceMap.put(gpTeacher.basic.name, gpTeacher.practiceTime);
|
|
|
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (GpTeacherVo teacher : teachersList) {
|
|
|
|
|
|
|
|
for(GpTeacher gpTeacher : gpTeachers) {
|
|
|
|
|
|
|
|
if(StringUtils.isNotEmpty(teacher.phone) && teacher.phone.equalsIgnoreCase(gpTeacher.mobile)) {
|
|
|
|
|
|
|
|
if(gpTeacher.basic.gender != null) {
|
|
|
|
|
|
|
|
teacher.setGender(gpTeacher.basic.gender);
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
teacher.setGender("");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gpTeacher.getPracticeTime() != null && gpTeacher.getPracticeTime() > 0) {
|
|
|
|
|
|
|
|
teacher.setPracticeTime(gpTeacher.getPracticeTime());
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
teacher.setPracticeTime(0L);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(gpTeacher.degree != null) {
|
|
|
|
|
|
|
|
teacher.setDegree(gpTeacher.degree);
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
teacher.setDegree("");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//teachers.put("practice", practiceCount);
|
|
|
|
|
|
|
|
//teachers.put("practiceMap", practiceMap);
|
|
|
|
|
|
|
|
//teachers.put("genderMap", genderMap);
|
|
|
|
teachers.put("gender", genderCount);
|
|
|
|
teachers.put("gender", genderCount);
|
|
|
|
teachers.put("degree", degreeCount);
|
|
|
|
teachers.put("degree", degreeCount);
|
|
|
|
|
|
|
|
teachers.put("info", teachersList);
|
|
|
|
|
|
|
|
teachers.remove("teachers");
|
|
|
|
|
|
|
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
}catch (Exception e) {
|
|
|
|
throw new ServiceException(ErrorCode.SYSTEM_ERROR.getCode(), "数据转换错误");
|
|
|
|
throw new ServiceException(ErrorCode.SYSTEM_ERROR.getCode(), "数据转换错误");
|
|
|
@ -181,6 +222,54 @@ public class TeacherServiceImpl implements TeacherService {
|
|
|
|
teacher.setName((String) map.get("name"));
|
|
|
|
teacher.setName((String) map.get("name"));
|
|
|
|
teacher.setPhone((String) map.get("phone"));
|
|
|
|
teacher.setPhone((String) map.get("phone"));
|
|
|
|
teacher.setId((String) map.get("id"));
|
|
|
|
teacher.setId((String) map.get("id"));
|
|
|
|
|
|
|
|
teacher.setEmail((String) map.get("email"));
|
|
|
|
|
|
|
|
teacher.setPicture((String) map.get("picture"));
|
|
|
|
|
|
|
|
teacher.setIname((String) map.get("iname"));
|
|
|
|
|
|
|
|
teacher.setJob((String) map.get("job"));
|
|
|
|
|
|
|
|
teacher.setRoles((List<String>) map.get("roles"));
|
|
|
|
|
|
|
|
//teacher.setGroups((List<GpTeacherVo.IdNameCode>) map.get("groups"));
|
|
|
|
|
|
|
|
List<Map<String, Object>> groupList = (List<Map<String, Object>>) map.get("groups");
|
|
|
|
|
|
|
|
if (groupList != null) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<GpTeacherVo.IdNameCode> groups = new ArrayList<>();
|
|
|
|
|
|
|
|
for (Map<String, Object> groupMap : groupList) {
|
|
|
|
|
|
|
|
GpTeacherVo.IdNameCode group = new GpTeacherVo.IdNameCode();
|
|
|
|
|
|
|
|
group.setId((String) groupMap.get("id"));
|
|
|
|
|
|
|
|
group.setName((String) groupMap.get("name"));
|
|
|
|
|
|
|
|
group.setCode((String) groupMap.get("code"));
|
|
|
|
|
|
|
|
group.setPicture((String) groupMap.get("picture"));
|
|
|
|
|
|
|
|
group.setNickname((String) groupMap.get("nickname"));
|
|
|
|
|
|
|
|
groups.add(group);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
teacher.setGroups(groups);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//teacher.setDegree((String) map.get("degree"));
|
|
|
|
|
|
|
|
//teacher.setPracticeTime((String) map.get("practiceTime"));
|
|
|
|
|
|
|
|
//teacher.setGender((String) map.get("gender"));
|
|
|
|
|
|
|
|
teacher.setNote((String) map.get("note"));
|
|
|
|
|
|
|
|
teacher.setSubjectIds((List<String>) map.get("subjectIds"));
|
|
|
|
|
|
|
|
teacher.setSubjectNames((List<String>) map.get("subjectNames"));
|
|
|
|
|
|
|
|
// 根据实际属性进行转换
|
|
|
|
|
|
|
|
return teacher;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private TeacherGradeVo convertToTeacherGradeVo(Map<String, Object> map) {
|
|
|
|
|
|
|
|
TeacherGradeVo teacher = new TeacherGradeVo();
|
|
|
|
|
|
|
|
teacher.setName((String) map.get("name"));
|
|
|
|
|
|
|
|
teacher.setId((String) map.get("tmdId"));
|
|
|
|
|
|
|
|
teacher.setPeriodId((String) map.get("periodId"));
|
|
|
|
|
|
|
|
// 处理 grade 字段
|
|
|
|
|
|
|
|
List<Map<String, Object>> gradeList = (List<Map<String, Object>>) map.get("grade");
|
|
|
|
|
|
|
|
if (gradeList != null) {
|
|
|
|
|
|
|
|
List<TeacherGradeVo.IdAndName> grades = new ArrayList<>();
|
|
|
|
|
|
|
|
for (Map<String, Object> gradeMap : gradeList) {
|
|
|
|
|
|
|
|
TeacherGradeVo.IdAndName grade = new TeacherGradeVo.IdAndName();
|
|
|
|
|
|
|
|
grade.setGrade((Integer) gradeMap.get("grade"));
|
|
|
|
|
|
|
|
grade.setGradeName((String) gradeMap.get("gradeName"));
|
|
|
|
|
|
|
|
grades.add(grade);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
teacher.setGrade(grades);
|
|
|
|
|
|
|
|
}
|
|
|
|
// 根据实际属性进行转换
|
|
|
|
// 根据实际属性进行转换
|
|
|
|
return teacher;
|
|
|
|
return teacher;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -193,6 +282,12 @@ public class TeacherServiceImpl implements TeacherService {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
teacher.setDescribe(null); // 或者设置一个默认值
|
|
|
|
teacher.setDescribe(null); // 或者设置一个默认值
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Object IdObj = map.get("id");
|
|
|
|
|
|
|
|
if (describeObj instanceof String) {
|
|
|
|
|
|
|
|
teacher.setId((String) IdObj);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
teacher.setId(null); // 或者设置一个默认值
|
|
|
|
|
|
|
|
}
|
|
|
|
Object depictObj = map.get("depict");
|
|
|
|
Object depictObj = map.get("depict");
|
|
|
|
if (depictObj instanceof String) {
|
|
|
|
if (depictObj instanceof String) {
|
|
|
|
teacher.setDepict((String) depictObj);
|
|
|
|
teacher.setDepict((String) depictObj);
|
|
|
@ -214,6 +309,12 @@ public class TeacherServiceImpl implements TeacherService {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
teacher.setTitle(null); // 或者设置一个默认值
|
|
|
|
teacher.setTitle(null); // 或者设置一个默认值
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Object mobileObj = map.get("mobile");
|
|
|
|
|
|
|
|
if (mobileObj instanceof String) {
|
|
|
|
|
|
|
|
teacher.setMobile((String) mobileObj);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
teacher.setMobile(null); // 或者设置一个默认值
|
|
|
|
|
|
|
|
}
|
|
|
|
Object degreeObj = map.get("degree");
|
|
|
|
Object degreeObj = map.get("degree");
|
|
|
|
if (degreeObj instanceof String) {
|
|
|
|
if (degreeObj instanceof String) {
|
|
|
|
teacher.setDegree((String) degreeObj);
|
|
|
|
teacher.setDegree((String) degreeObj);
|
|
|
@ -372,6 +473,261 @@ public class TeacherServiceImpl implements TeacherService {
|
|
|
|
return gradeMap;
|
|
|
|
return gradeMap;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public List<Map<String,Map<String, Long>>> getDistributionOfTeachers(TeacherDto teacherDto, HttpServletRequest request) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Map<String,Map<String, Long>>> distributionList = new ArrayList<>();
|
|
|
|
|
|
|
|
Map<String,Map<String, Long>> gradesMap = new HashMap<>();
|
|
|
|
|
|
|
|
Map<String,Map<String, Long>> degreesMap = new HashMap<>();
|
|
|
|
|
|
|
|
Map<String,Map<String, Long>> subjectsMap= new HashMap<>();
|
|
|
|
|
|
|
|
Map<String,Map<String, Long>> groupsMap = new HashMap<>();
|
|
|
|
|
|
|
|
Map<String, Object> teachers;
|
|
|
|
|
|
|
|
//获取全学校教师名单详情
|
|
|
|
|
|
|
|
String url = env.getProperty("ies.server-url-get-teacher-all");
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
teachers = GroupUtil.getGroupId(teacherDto,new GroupUtil(env), request,url);
|
|
|
|
|
|
|
|
List<GpTeacherVo> teachersList = new ArrayList<>();
|
|
|
|
|
|
|
|
for (Map.Entry<String, Object> entry : teachers.entrySet()) {
|
|
|
|
|
|
|
|
// 假设 entry.getValue() 返回的是 List<Map<String, Object>>
|
|
|
|
|
|
|
|
List<Map<String, Object>> mapList = (List<Map<String, Object>>) entry.getValue();
|
|
|
|
|
|
|
|
for (Map<String, Object> map : mapList) {
|
|
|
|
|
|
|
|
// 将 Map 转换为 GpTeacherVo 对象
|
|
|
|
|
|
|
|
GpTeacherVo teacher = convertToGpTeacherVo(map);
|
|
|
|
|
|
|
|
teachersList.add(teacher);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
List<String> phones = new ArrayList<>();
|
|
|
|
|
|
|
|
// 进一步处理 teachersList
|
|
|
|
|
|
|
|
for (GpTeacherVo teacher : teachersList) {
|
|
|
|
|
|
|
|
phones.add(teacher.getPhone());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
GpTeacherDto gpTeacherDto = new GpTeacherDto();
|
|
|
|
|
|
|
|
gpTeacherDto.setMobiles(phones);
|
|
|
|
|
|
|
|
Map<String, Object> tBase = getTeacherBase(gpTeacherDto, request);
|
|
|
|
|
|
|
|
List<GpTeacher> gpTeachers = new ArrayList<>();
|
|
|
|
|
|
|
|
for (Map.Entry<String, Object> entry : tBase.entrySet()) {
|
|
|
|
|
|
|
|
if (entry.getKey().equals("teachers")) {
|
|
|
|
|
|
|
|
List<Map<String, Object>> dataList = (List<Map<String, Object>>) entry.getValue();
|
|
|
|
|
|
|
|
for (Map<String, Object> dataMap : dataList) {
|
|
|
|
|
|
|
|
GpTeacher gpTeacher = convertToGpTeacher(dataMap);
|
|
|
|
|
|
|
|
gpTeachers.add(gpTeacher);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//把对应年级的信息进行映射
|
|
|
|
|
|
|
|
List<TeacherGradeVo> gradeList = new ArrayList<>();
|
|
|
|
|
|
|
|
Map<String,Object> gradeInfo = getTeacherGradeCount(teacherDto, request);
|
|
|
|
|
|
|
|
for (Map.Entry<String, Object> entry : gradeInfo.entrySet()) {
|
|
|
|
|
|
|
|
if (entry.getKey().equals("teacher")) {
|
|
|
|
|
|
|
|
List<Map<String, Object>> dataList = (List<Map<String, Object>>) entry.getValue();
|
|
|
|
|
|
|
|
for (Map<String, Object> dataMap : dataList) {
|
|
|
|
|
|
|
|
TeacherGradeVo teacherGradeVo = convertToTeacherGradeVo(dataMap);
|
|
|
|
|
|
|
|
gradeList.add(teacherGradeVo);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for (GpTeacherVo teacher : teachersList) {
|
|
|
|
|
|
|
|
for(GpTeacher gpTeacher : gpTeachers) {
|
|
|
|
|
|
|
|
if(StringUtils.isNotEmpty(teacher.phone) && teacher.phone.equalsIgnoreCase(gpTeacher.mobile)) {
|
|
|
|
|
|
|
|
if(gpTeacher.basic.gender != null) {
|
|
|
|
|
|
|
|
teacher.setGender(gpTeacher.basic.gender);
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
teacher.setGender("");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gpTeacher.getPracticeTime() != null && gpTeacher.getPracticeTime() > 0) {
|
|
|
|
|
|
|
|
teacher.setPracticeTime(gpTeacher.getPracticeTime());
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
teacher.setPracticeTime(0L);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(gpTeacher.degree != null) {
|
|
|
|
|
|
|
|
teacher.setDegree(gpTeacher.degree);
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
teacher.setDegree("");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for (TeacherGradeVo grade : gradeList) {
|
|
|
|
|
|
|
|
if(StringUtils.isNotEmpty(teacher.getId()) && teacher.getId().equals(grade.getId())) {
|
|
|
|
|
|
|
|
if(StringUtils.isNotEmpty(grade.getPeriodId())) {
|
|
|
|
|
|
|
|
teacher.setPeriodId(grade.getPeriodId());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
List<TeacherGradeVo.IdAndName> grades = grade.getGrade();
|
|
|
|
|
|
|
|
for (TeacherGradeVo.IdAndName gg : grades) {
|
|
|
|
|
|
|
|
String id = String.valueOf(teacherDto.year - gg.getGrade());
|
|
|
|
|
|
|
|
if (teacher.grade == null) {
|
|
|
|
|
|
|
|
teacher.setGrade(new ArrayList<>());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
teacher.grade.add(id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
teachersList = teachersList.stream()
|
|
|
|
|
|
|
|
.filter(teacher -> teacherDto.periodId.equals(teacher.getPeriodId()))
|
|
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
Map<String, Long> gradeCount = new HashMap<>();
|
|
|
|
|
|
|
|
Map<String, Long> degreeCount = new HashMap<>();
|
|
|
|
|
|
|
|
Map<String, Long> subjectCount = new HashMap<>();
|
|
|
|
|
|
|
|
Map<String, Long> GroupCount = new HashMap<>();
|
|
|
|
|
|
|
|
if(StringUtils.isNotEmpty(teacherDto.getGrade()) && StringUtils.isNotEmpty(teacherDto.getSubjectId())) {
|
|
|
|
|
|
|
|
for (GpTeacherVo teacher : teachersList) {
|
|
|
|
|
|
|
|
if(teacher.getGrade() != null &&teacher.getSubjectIds() != null &&teacher.getGrade().contains(teacherDto.getGrade()) && teacher.getSubjectIds().contains(teacherDto.getSubjectId())) {
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Long count = gradeCount.getOrDefault(teacherDto.getGrade(), 0L);
|
|
|
|
|
|
|
|
gradeCount.put(teacherDto.getGrade(), count + 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(StringUtils.isNotEmpty(teacher.getDegree())) {
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Long count = degreeCount.getOrDefault(teacher.getDegree(), 0L);
|
|
|
|
|
|
|
|
degreeCount.put(teacher.getDegree(), count + 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int index = teacher.subjectIds.indexOf(teacherDto.getSubjectId());
|
|
|
|
|
|
|
|
String name = "";
|
|
|
|
|
|
|
|
if (index >= 0) {
|
|
|
|
|
|
|
|
name = teacher.subjectNames.get(index);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Long count = subjectCount.getOrDefault(name, 0L);
|
|
|
|
|
|
|
|
subjectCount.put(name, count + 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(teacher.getGroups() != null) {
|
|
|
|
|
|
|
|
for (GpTeacherVo.IdNameCode group : teacher.getGroups()) {
|
|
|
|
|
|
|
|
Long count = GroupCount.getOrDefault(group.getName(), 0L);
|
|
|
|
|
|
|
|
GroupCount.put(group.getName(), count + 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}else if(StringUtils.isEmpty(teacherDto.getGrade()) && StringUtils.isNotEmpty(teacherDto.getSubjectId())) {
|
|
|
|
|
|
|
|
for (GpTeacherVo teacher : teachersList) {
|
|
|
|
|
|
|
|
if(teacher.getSubjectIds() != null && teacher.getSubjectIds().contains(teacherDto.getSubjectId())) {
|
|
|
|
|
|
|
|
if(teacher.getGrade() != null) {
|
|
|
|
|
|
|
|
for (String grade : teacher.getGrade()) {
|
|
|
|
|
|
|
|
Long count = gradeCount.getOrDefault(grade, 0L);
|
|
|
|
|
|
|
|
gradeCount.put(grade, count + 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(StringUtils.isNotEmpty(teacher.getDegree())) {
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Long count = degreeCount.getOrDefault(teacher.getDegree(), 0L);
|
|
|
|
|
|
|
|
degreeCount.put(teacher.getDegree(), count + 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int index = teacher.subjectIds.indexOf(teacherDto.getSubjectId());
|
|
|
|
|
|
|
|
String name = "";
|
|
|
|
|
|
|
|
if (index >= 0) {
|
|
|
|
|
|
|
|
name = teacher.subjectNames.get(index);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Long count = subjectCount.getOrDefault(name, 0L);
|
|
|
|
|
|
|
|
subjectCount.put(name, count + 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(teacher.getGroups() != null) {
|
|
|
|
|
|
|
|
for (GpTeacherVo.IdNameCode group : teacher.getGroups()) {
|
|
|
|
|
|
|
|
Long count = GroupCount.getOrDefault(group.getName(), 0L);
|
|
|
|
|
|
|
|
GroupCount.put(group.getName(), count + 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}else if(StringUtils.isNotEmpty(teacherDto.getGrade()) && StringUtils.isEmpty(teacherDto.getSubjectId())) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (GpTeacherVo teacher : teachersList) {
|
|
|
|
|
|
|
|
if(teacher.getGrade() != null && teacher.getGrade().contains(teacherDto.getGrade())) {
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Long count = gradeCount.getOrDefault(teacherDto.getGrade(), 0L);
|
|
|
|
|
|
|
|
gradeCount.put(teacherDto.getGrade(), count + 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(StringUtils.isNotEmpty(teacher.getDegree())) {
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Long count = degreeCount.getOrDefault(teacher.getDegree(), 0L);
|
|
|
|
|
|
|
|
degreeCount.put(teacher.getDegree(), count + 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(teacher.getSubjectIds()!= null) {
|
|
|
|
|
|
|
|
for (String subjectId : teacher.getSubjectIds()) {
|
|
|
|
|
|
|
|
int index = teacher.subjectIds.indexOf(subjectId);
|
|
|
|
|
|
|
|
String name = "";
|
|
|
|
|
|
|
|
if (index >= 0) {
|
|
|
|
|
|
|
|
name = teacher.subjectNames.get(index);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Long count = subjectCount.getOrDefault(name, 0L);
|
|
|
|
|
|
|
|
subjectCount.put(name, count + 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(teacher.getGroups() != null) {
|
|
|
|
|
|
|
|
for (GpTeacherVo.IdNameCode group : teacher.getGroups()) {
|
|
|
|
|
|
|
|
Long count = GroupCount.getOrDefault(group.getName(), 0L);
|
|
|
|
|
|
|
|
GroupCount.put(group.getName(), count + 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
for (GpTeacherVo teacher : teachersList) {
|
|
|
|
|
|
|
|
if(teacher.getGrade() != null) {
|
|
|
|
|
|
|
|
for (String grade : teacher.getGrade()) {
|
|
|
|
|
|
|
|
Long count = gradeCount.getOrDefault(grade, 0L);
|
|
|
|
|
|
|
|
gradeCount.put(grade, count + 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(StringUtils.isNotEmpty(teacher.getDegree())) {
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Long count = degreeCount.getOrDefault(teacher.getDegree(), 0L);
|
|
|
|
|
|
|
|
degreeCount.put(teacher.getDegree(), count + 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(teacher.getSubjectIds()!= null) {
|
|
|
|
|
|
|
|
for (String subjectId : teacher.getSubjectIds()) {
|
|
|
|
|
|
|
|
int index = teacher.subjectIds.indexOf(subjectId);
|
|
|
|
|
|
|
|
String name = "";
|
|
|
|
|
|
|
|
if (index >= 0) {
|
|
|
|
|
|
|
|
name = teacher.subjectNames.get(index);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Long count = subjectCount.getOrDefault(name, 0L);
|
|
|
|
|
|
|
|
subjectCount.put(name, count + 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(teacher.getGroups() != null) {
|
|
|
|
|
|
|
|
for (GpTeacherVo.IdNameCode group : teacher.getGroups()) {
|
|
|
|
|
|
|
|
Long count = GroupCount.getOrDefault(group.getName(), 0L);
|
|
|
|
|
|
|
|
GroupCount.put(group.getName(), count + 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
gradeCount.keySet().removeIf(key -> key.startsWith("20"));
|
|
|
|
|
|
|
|
gradesMap.put("grade", gradeCount);
|
|
|
|
|
|
|
|
degreesMap.put("degree", degreeCount);
|
|
|
|
|
|
|
|
subjectsMap.put("subject", subjectCount);
|
|
|
|
|
|
|
|
groupsMap.put("group", GroupCount);
|
|
|
|
|
|
|
|
distributionList.add(gradesMap);
|
|
|
|
|
|
|
|
distributionList.add(degreesMap);
|
|
|
|
|
|
|
|
distributionList.add(subjectsMap);
|
|
|
|
|
|
|
|
distributionList.add(groupsMap);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Map<String, Long> genderCount = gpTeachers.stream()
|
|
|
|
|
|
|
|
.collect(Collectors.groupingBy(gpTeacher -> gpTeacher.getBasic().getGender(), Collectors.counting()));
|
|
|
|
|
|
|
|
Map<String, Long> degreeCount = gpTeachers.stream()
|
|
|
|
|
|
|
|
.filter(gpTeacher -> gpTeacher.getDegree() != null)
|
|
|
|
|
|
|
|
.collect(Collectors.groupingBy(GpTeacher::getDegree, Collectors.counting()));*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
|
|
|
|
throw new ServiceException(ErrorCode.SYSTEM_ERROR.getCode(), "数据转换错误");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return distributionList;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Map<String, Object> getTeacherBase(GpTeacherDto gpTeacherDto, HttpServletRequest request) {
|
|
|
|
public Map<String, Object> getTeacherBase(GpTeacherDto gpTeacherDto, HttpServletRequest request) {
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> gradeMap;
|
|
|
|
Map<String, Object> gradeMap;
|
|
|
|