diff --git a/src/main/java/cn/teammodel/controller/admin/controller/TeacherController.java b/src/main/java/cn/teammodel/controller/admin/controller/TeacherController.java index 2540a4c..37199f0 100644 --- a/src/main/java/cn/teammodel/controller/admin/controller/TeacherController.java +++ b/src/main/java/cn/teammodel/controller/admin/controller/TeacherController.java @@ -31,7 +31,7 @@ public class TeacherController { return R.success(res); } @PostMapping("getTeacherDetail") - @ApiOperation("获取教师素质素养数据") + @ApiOperation("获取教师详细数据") public R> getTeacherDetail(@Valid @RequestBody TeacherDto teacherDto, HttpServletRequest request) { Map res = teacherService.getTeacherDetail(teacherDto,request); return R.success(res); diff --git a/src/main/java/cn/teammodel/controller/admin/service/impl/TeacherServiceImpl.java b/src/main/java/cn/teammodel/controller/admin/service/impl/TeacherServiceImpl.java index 0b652fd..6805213 100644 --- a/src/main/java/cn/teammodel/controller/admin/service/impl/TeacherServiceImpl.java +++ b/src/main/java/cn/teammodel/controller/admin/service/impl/TeacherServiceImpl.java @@ -146,9 +146,49 @@ public class TeacherServiceImpl implements TeacherService { .collect(Collectors.groupingBy(GpTeacher::getDegree, Collectors.counting())); Map practiceCount = getStringIntegerMap(teacherDto, gpTeachers); + 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 genderMap = new HashMap<>(); + Map 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("degree", degreeCount); + teachers.put("info", teachersList); + teachers.remove("teachers"); }catch (Exception e) { throw new ServiceException(ErrorCode.SYSTEM_ERROR.getCode(), "数据转换错误"); @@ -181,6 +221,16 @@ public class TeacherServiceImpl implements TeacherService { teacher.setName((String) map.get("name")); teacher.setPhone((String) map.get("phone")); 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.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) map.get("subjectIds")); + teacher.setSubjectNames((List) map.get("subjectNames")); // 根据实际属性进行转换 return teacher; } @@ -214,6 +264,12 @@ public class TeacherServiceImpl implements TeacherService { } else { 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"); if (degreeObj instanceof String) { teacher.setDegree((String) degreeObj); diff --git a/src/main/java/cn/teammodel/model/entity/school/GpTeacher.java b/src/main/java/cn/teammodel/model/entity/school/GpTeacher.java index ff09116..787b9f8 100644 --- a/src/main/java/cn/teammodel/model/entity/school/GpTeacher.java +++ b/src/main/java/cn/teammodel/model/entity/school/GpTeacher.java @@ -19,6 +19,8 @@ public class GpTeacher { /// public String depict ; + public String mobile; + /// /// 学段 /// diff --git a/src/main/java/cn/teammodel/model/vo/admin/GpTeacherVo.java b/src/main/java/cn/teammodel/model/vo/admin/GpTeacherVo.java index 941e401..e6e1342 100644 --- a/src/main/java/cn/teammodel/model/vo/admin/GpTeacherVo.java +++ b/src/main/java/cn/teammodel/model/vo/admin/GpTeacherVo.java @@ -2,9 +2,22 @@ package cn.teammodel.model.vo.admin; import lombok.Data; +import java.util.List; + @Data public class GpTeacherVo { public String id ; public String name ; public String phone ; + public String email ; + public String picture ; + public String iname ; + public String job ; + public List subjectIds ; + public List subjectNames ; + public String note ; + public String degree; + public Long practiceTime ; + public String gender ; + }