update 教师信息

develop
hhb@hotmail.com 4 weeks ago
parent ab78ec557f
commit e746605ee0

@ -31,7 +31,7 @@ public class TeacherController {
return R.success(res);
}
@PostMapping("getTeacherDetail")
@ApiOperation("获取教师素质素养数据")
@ApiOperation("获取教师详细数据")
public R<Map<String, Object>> getTeacherDetail(@Valid @RequestBody TeacherDto teacherDto, HttpServletRequest request) {
Map<String, Object> res = teacherService.getTeacherDetail(teacherDto,request);
return R.success(res);

@ -146,9 +146,49 @@ public class TeacherServiceImpl implements TeacherService {
.collect(Collectors.groupingBy(GpTeacher::getDegree, Collectors.counting()));
Map<String, Integer> 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<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("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<String>) map.get("subjectIds"));
teacher.setSubjectNames((List<String>) 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);

@ -19,6 +19,8 @@ public class GpTeacher {
/// </summary>
public String depict ;
public String mobile;
/// <summary>
/// 学段
/// </summary>

@ -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<String> subjectIds ;
public List<String> subjectNames ;
public String note ;
public String degree;
public Long practiceTime ;
public String gender ;
}

Loading…
Cancel
Save