|
|
|
@ -8,6 +8,7 @@ import cn.teammodel.model.dto.admin.teacher.GpTeacherDto;
|
|
|
|
|
import cn.teammodel.model.dto.admin.teacher.TeacherDto;
|
|
|
|
|
import cn.teammodel.model.entity.common.GroupList;
|
|
|
|
|
import cn.teammodel.model.entity.school.*;
|
|
|
|
|
import cn.teammodel.model.entity.teacher.HonorInfo;
|
|
|
|
|
import cn.teammodel.model.vo.admin.GpTeacherVo;
|
|
|
|
|
import cn.teammodel.model.vo.admin.SugVo;
|
|
|
|
|
import cn.teammodel.model.vo.admin.TeacherGradeVo;
|
|
|
|
@ -60,7 +61,7 @@ public class TeacherServiceImpl implements TeacherService {
|
|
|
|
|
private PaperTeacherRepository paperTeacherRepository;
|
|
|
|
|
@Autowired
|
|
|
|
|
private Environment env;
|
|
|
|
|
|
|
|
|
|
private static final double K = 0.08; // 衰减系数常量
|
|
|
|
|
@Override
|
|
|
|
|
public List<Map<String, Integer>> getTeacherList(TeacherDto teacherDto) {
|
|
|
|
|
List<Map<String, Integer>> result = new ArrayList<>();
|
|
|
|
@ -911,40 +912,8 @@ public class TeacherServiceImpl implements TeacherService {
|
|
|
|
|
mapTeach.put("Lessons",records.size());
|
|
|
|
|
//资源数量:试卷数量
|
|
|
|
|
mapTeach.put("paperCount",count);
|
|
|
|
|
|
|
|
|
|
return mapTeach;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Map<String, Object> map = new HashMap<>();
|
|
|
|
|
/*//录课数
|
|
|
|
|
map.put("Lessons",new Random().nextInt(100) + 1);
|
|
|
|
|
//T(数据)
|
|
|
|
|
map.put("TData",new Random().nextInt(100) + 1);
|
|
|
|
|
//T(绿灯)
|
|
|
|
|
map.put("TGreen",new Random().nextInt(100) + 1);
|
|
|
|
|
//双绿灯
|
|
|
|
|
map.put("DoubleGreen",new Random().nextInt(100) + 1);
|
|
|
|
|
//观课数
|
|
|
|
|
map.put("WLessons",new Random().nextInt(100) + 1);
|
|
|
|
|
//议课数
|
|
|
|
|
map.put("TLessons",new Random().nextInt(100) + 1);
|
|
|
|
|
//频道数
|
|
|
|
|
map.put("Channels",new Random().nextInt(20) + 1);
|
|
|
|
|
//公开课
|
|
|
|
|
map.put("OLessons",new Random().nextInt(100) + 1);
|
|
|
|
|
//课件数
|
|
|
|
|
map.put("Coursewares",new Random().nextInt(100) + 1);
|
|
|
|
|
//教案数
|
|
|
|
|
map.put("TeachingPlan",new Random().nextInt(40) + 1);
|
|
|
|
|
//公开标记
|
|
|
|
|
map.put("OMarkers",new Random().nextInt(30) + 1);
|
|
|
|
|
//个人标记
|
|
|
|
|
map.put("PMarkers",new Random().nextInt(30) + 1);
|
|
|
|
|
//被标记数
|
|
|
|
|
map.put("TMarkers",new Random().nextInt(30) + 1);
|
|
|
|
|
//被点阅数
|
|
|
|
|
map.put("ClickAndRead",new Random().nextInt(100) + 1);*/
|
|
|
|
|
//return map;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -1032,6 +1001,130 @@ public class TeacherServiceImpl implements TeacherService {
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> getTeacherOfCapabilityAssessment(TeacherDto teacherDto, HttpServletRequest request) {
|
|
|
|
|
Map<String, Object> result = new HashMap<>();
|
|
|
|
|
try {
|
|
|
|
|
// 初始化四项数据
|
|
|
|
|
double TData = 0, TGreen = 0, Lessons = 0, paperCount = 0,LessonCount = 0,DoubleGreenCount = 0,MaterialCount = 0,PublicCount = 0;
|
|
|
|
|
|
|
|
|
|
// 获取原始数据集合
|
|
|
|
|
Map<String, Object> resMap = getTeachingAndResearch(teacherDto, request);
|
|
|
|
|
Map<String, Object> detailMap = getTeacherDetail(teacherDto, request);
|
|
|
|
|
GpTeacherDto gpTeacherDto = new GpTeacherDto();
|
|
|
|
|
List<String> ownerIds = gpTeacherDto.getOwnerIds(); // 假设有一个 getOwnerIds 方法
|
|
|
|
|
if (ownerIds == null) {
|
|
|
|
|
ownerIds = new ArrayList<>();
|
|
|
|
|
}
|
|
|
|
|
ownerIds.add(teacherDto.getTmdId());
|
|
|
|
|
gpTeacherDto.setOwnerIds(ownerIds);
|
|
|
|
|
|
|
|
|
|
List<GpTeacherVo> teachersList = new ArrayList<>();
|
|
|
|
|
teachersList = (List<GpTeacherVo>) detailMap.get("info");
|
|
|
|
|
// 遍历并提取八项数据
|
|
|
|
|
for (Map.Entry<String, Object> entry : resMap.entrySet()) {
|
|
|
|
|
String key = entry.getKey();
|
|
|
|
|
Object value = entry.getValue();
|
|
|
|
|
if (value instanceof Integer) { // 类型安全校验
|
|
|
|
|
switch (key) {
|
|
|
|
|
case "TData": TData = (Integer) value; break;
|
|
|
|
|
case "TGreen": TGreen = (Integer) value; break;
|
|
|
|
|
case "Lessons": Lessons = (Integer) value; break;
|
|
|
|
|
case "paperCount": paperCount = (Integer) value; break;
|
|
|
|
|
case "LessonCount": LessonCount = (Integer) value; break;
|
|
|
|
|
case "DoubleGreenCount": DoubleGreenCount = (Integer) value; break;
|
|
|
|
|
case "MaterialCount": MaterialCount = (Integer) value; break;
|
|
|
|
|
case "PublicCount": PublicCount = (Integer) value; break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!StringUtils.isNotEmpty(teacherDto.getTmdId())) {
|
|
|
|
|
TData = Math.round((TData / teachersList.size()) * 100.0) / 100.0;
|
|
|
|
|
TGreen = Math.round((TGreen / teachersList.size()) * 100.0) / 100.0;
|
|
|
|
|
Lessons = Math.round((Lessons / teachersList.size()) * 100.0) / 100.0;
|
|
|
|
|
paperCount = Math.round((paperCount / teachersList.size()) * 100.0) / 100.0;
|
|
|
|
|
LessonCount = Math.round((LessonCount / teachersList.size()) * 100.0) / 100.0;
|
|
|
|
|
DoubleGreenCount = Math.round((DoubleGreenCount / teachersList.size()) * 100.0) / 100.0;
|
|
|
|
|
MaterialCount = Math.round((MaterialCount / teachersList.size()) * 100.0) / 100.0;
|
|
|
|
|
PublicCount = Math.round((PublicCount / teachersList.size()) * 100.0) / 100.0;
|
|
|
|
|
List<String> ids = teachersList.stream()
|
|
|
|
|
.map(GpTeacherVo::getId)
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
gpTeacherDto.setOwnerIds(ids);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<String, Object> honor = getTeacherHonors(gpTeacherDto, request);
|
|
|
|
|
List<HonorInfo> honors = new ArrayList<>();
|
|
|
|
|
Object honorsObj = honor.get("honors");
|
|
|
|
|
if (honorsObj instanceof List<?>) {
|
|
|
|
|
List<?> rawHonors = (List<?>) honorsObj;
|
|
|
|
|
|
|
|
|
|
for (Object item : rawHonors) {
|
|
|
|
|
if (item instanceof Map) {
|
|
|
|
|
Map<String, Object> map = (Map<String, Object>) item;
|
|
|
|
|
HonorInfo info = new HonorInfo();
|
|
|
|
|
|
|
|
|
|
// 手动设置属性,假设 HonorInfo 有对应的 setter 方法
|
|
|
|
|
info.setScore((Integer) map.get("score")); // 根据字段名称匹配
|
|
|
|
|
// 设置其他字段
|
|
|
|
|
// info.setHonorName((String) map.get("honorName"));
|
|
|
|
|
honors.add(info);
|
|
|
|
|
} else if (item instanceof HonorInfo) {
|
|
|
|
|
honors.add((HonorInfo) item);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
double honorScores = 0;
|
|
|
|
|
for (HonorInfo honorInfo : honors) {
|
|
|
|
|
double score = honorInfo.getScore().doubleValue();
|
|
|
|
|
honorScores += score;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 基础分计算
|
|
|
|
|
double honorScore = (honorScores > 0) ? 100.0 - 20.0 / honorScores : 60;
|
|
|
|
|
|
|
|
|
|
// 计算各维度贡献值(使用指数衰减函数)
|
|
|
|
|
double tDataScore = 25 * (1 - Math.exp(-K * TData));
|
|
|
|
|
double tGreenScore = 50 * (1 - Math.exp(-K * TGreen));
|
|
|
|
|
double lessonsScore = 15 * (1 - Math.exp(-K * Lessons));
|
|
|
|
|
double paperScore = 10 * (1 - Math.exp(-K * paperCount));
|
|
|
|
|
//计算教学贡献值
|
|
|
|
|
// 基础分计算
|
|
|
|
|
double baseScore = (DoubleGreenCount > 0) ? 100.0 - 40.0 / DoubleGreenCount : 0;
|
|
|
|
|
|
|
|
|
|
// 附加分计算
|
|
|
|
|
double lessonScore = (LessonCount >= 1) ? (5.0 - 3.0 / LessonCount) : 0;
|
|
|
|
|
double materialScore = (MaterialCount >= 1) ? (3.0 - 1.0 / MaterialCount) : 0;
|
|
|
|
|
double publicScore = (PublicCount >= 1) ? (2.0 - 1.0 / PublicCount) : 0;
|
|
|
|
|
|
|
|
|
|
// 总分计算(不超过100)
|
|
|
|
|
double totalTeachingScore = baseScore + lessonScore + materialScore + publicScore;
|
|
|
|
|
totalTeachingScore = Math.round(totalTeachingScore * 100.0) / 100.0;
|
|
|
|
|
totalTeachingScore = Math.min(totalTeachingScore, 100.0);
|
|
|
|
|
|
|
|
|
|
// 计算总分(保留两位小数)
|
|
|
|
|
double totalScore = tDataScore + tGreenScore + lessonsScore + paperScore;
|
|
|
|
|
totalScore = Math.round(totalScore * 100.0) / 100.0; // 四舍五入
|
|
|
|
|
|
|
|
|
|
// 特殊规则处理:TGreen>1时最低60分
|
|
|
|
|
if (TGreen > 1 && totalScore < 60) {
|
|
|
|
|
totalScore = 60.0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 构建返回结果
|
|
|
|
|
result.put("teachingScore", totalScore);
|
|
|
|
|
result.put("researchScore", totalTeachingScore);
|
|
|
|
|
result.put("honorScore", honorScore);
|
|
|
|
|
result.put("trainingScore", 0);
|
|
|
|
|
result.put("scientificScore", 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
throw new ServiceException(ErrorCode.SYSTEM_ERROR.getCode(), "数据转换错误: " + ex.getMessage());
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private @NotNull List<SugVo> getSugVos(TeacherDto teacherDto, HttpServletRequest request) {
|
|
|
|
|
String url = env.getProperty("ies.server-url-get-channel-data");
|
|
|
|
|
Map<String, Object> overView;
|
|
|
|
@ -1125,7 +1218,24 @@ public class TeacherServiceImpl implements TeacherService {
|
|
|
|
|
|
|
|
|
|
Map<String, Object> gradeMap;
|
|
|
|
|
try {
|
|
|
|
|
gradeMap = GroupUtil.getTeacherInfo(gpTeacherDto,new GroupUtil(env), request);
|
|
|
|
|
String url = "open_teacher/find";
|
|
|
|
|
gpTeacherDto.setGrant_type("mobiles_infos");
|
|
|
|
|
gradeMap = GroupUtil.getTeacherInfo(gpTeacherDto,new GroupUtil(env), request, url);
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
|
throw new ServiceException(ErrorCode.SYSTEM_ERROR.getCode(), "国培数据转换错误");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return gradeMap;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取教师荣誉
|
|
|
|
|
public Map<String, Object> getTeacherHonors(GpTeacherDto gpTeacherDto, HttpServletRequest request) {
|
|
|
|
|
|
|
|
|
|
Map<String, Object> gradeMap;
|
|
|
|
|
try {
|
|
|
|
|
String url = "open_honor/find";
|
|
|
|
|
gpTeacherDto.setGrant_type("list");
|
|
|
|
|
gradeMap = GroupUtil.getTeacherInfo(gpTeacherDto,new GroupUtil(env), request, url);
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
|
throw new ServiceException(ErrorCode.SYSTEM_ERROR.getCode(), "国培数据转换错误");
|
|
|
|
|
|
|
|
|
|