|
|
@ -5,12 +5,12 @@ import cn.teammodel.common.PK;
|
|
|
|
import cn.teammodel.config.exception.ServiceException;
|
|
|
|
import cn.teammodel.config.exception.ServiceException;
|
|
|
|
import cn.teammodel.controller.admin.service.CommonService;
|
|
|
|
import cn.teammodel.controller.admin.service.CommonService;
|
|
|
|
import cn.teammodel.controller.admin.service.LaborEducationService;
|
|
|
|
import cn.teammodel.controller.admin.service.LaborEducationService;
|
|
|
|
|
|
|
|
import cn.teammodel.model.dto.admin.Moral.MoralDto;
|
|
|
|
import cn.teammodel.model.dto.admin.common.GCDto;
|
|
|
|
import cn.teammodel.model.dto.admin.common.GCDto;
|
|
|
|
import cn.teammodel.model.dto.admin.common.GroupDto;
|
|
|
|
import cn.teammodel.model.dto.admin.common.GroupDto;
|
|
|
|
import cn.teammodel.model.dto.admin.common.RGroupList;
|
|
|
|
import cn.teammodel.model.dto.admin.common.RGroupList;
|
|
|
|
import cn.teammodel.model.dto.admin.common.RMember;
|
|
|
|
import cn.teammodel.model.dto.admin.common.RMember;
|
|
|
|
import cn.teammodel.model.dto.admin.labor.FindDto;
|
|
|
|
import cn.teammodel.model.dto.admin.labor.FindDto;
|
|
|
|
import cn.teammodel.model.dto.admin.labor.LaborDto;
|
|
|
|
|
|
|
|
import cn.teammodel.model.entity.appraise.Appraise;
|
|
|
|
import cn.teammodel.model.entity.appraise.Appraise;
|
|
|
|
import cn.teammodel.model.entity.appraise.AppraiseTreeNode;
|
|
|
|
import cn.teammodel.model.entity.appraise.AppraiseTreeNode;
|
|
|
|
import cn.teammodel.model.entity.common.Exam;
|
|
|
|
import cn.teammodel.model.entity.common.Exam;
|
|
|
@ -82,7 +82,7 @@ public class LaborEducationServiceImpl implements LaborEducationService {
|
|
|
|
LaborEducationServiceImpl.environment = env; // 在初始化时将非静态字段赋值给静态字段
|
|
|
|
LaborEducationServiceImpl.environment = env; // 在初始化时将非静态字段赋值给静态字段
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public Map<String, Object> getAnalysis(LaborDto laborDto, HttpServletRequest request) {
|
|
|
|
public Map<String, Object> getAnalysis(MoralDto laborDto, HttpServletRequest request) {
|
|
|
|
|
|
|
|
|
|
|
|
//根据具体参数查询相关课列内容
|
|
|
|
//根据具体参数查询相关课列内容
|
|
|
|
List<LessonRecord> records;
|
|
|
|
List<LessonRecord> records;
|
|
|
@ -184,6 +184,7 @@ public class LaborEducationServiceImpl implements LaborEducationService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
List<ExamClassResult> examResults = new ArrayList<>();
|
|
|
|
List<ExamClassResult> examResults = new ArrayList<>();
|
|
|
|
if (!examIds.isEmpty()) {
|
|
|
|
if (!examIds.isEmpty()) {
|
|
|
|
examResults = examClassResultRepository.findAll(String.format(PK.CLASS_RESULT, laborDto.getCode()),examIds);
|
|
|
|
examResults = examClassResultRepository.findAll(String.format(PK.CLASS_RESULT, laborDto.getCode()),examIds);
|
|
|
@ -242,7 +243,7 @@ public class LaborEducationServiceImpl implements LaborEducationService {
|
|
|
|
return resMap;
|
|
|
|
return resMap;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public Map<String, Object> getExamDetails(LaborDto laborDto, HttpServletRequest request) {
|
|
|
|
public Map<String, Object> getExamDetails(MoralDto laborDto, HttpServletRequest request) {
|
|
|
|
Map<String, Object> resMap = new HashMap<>();
|
|
|
|
Map<String, Object> resMap = new HashMap<>();
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
List<ExamClassResult> examResults = new ArrayList<>();
|
|
|
|
List<ExamClassResult> examResults = new ArrayList<>();
|
|
|
@ -668,8 +669,8 @@ public class LaborEducationServiceImpl implements LaborEducationService {
|
|
|
|
double defaultScore = 60.0;
|
|
|
|
double defaultScore = 60.0;
|
|
|
|
if (parentNode == null) {
|
|
|
|
if (parentNode == null) {
|
|
|
|
// 若知识块无对应父节点,归入全局默认块
|
|
|
|
// 若知识块无对应父节点,归入全局默认块
|
|
|
|
parentNodeScoreRates.merge("默认块", defaultScore, Double::sum);
|
|
|
|
//parentNodeScoreRates.merge("默认块", defaultScore, Double::sum);
|
|
|
|
parentNodeScoreCount.merge("默认块", 1, Integer::sum);
|
|
|
|
//parentNodeScoreCount.merge("默认块", 1, Integer::sum);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
// 归入知识块对应的父节点
|
|
|
|
// 归入知识块对应的父节点
|
|
|
|
parentNodeScoreRates.merge(parentNode.getName(), defaultScore, Double::sum);
|
|
|
|
parentNodeScoreRates.merge(parentNode.getName(), defaultScore, Double::sum);
|
|
|
@ -1502,7 +1503,7 @@ public class LaborEducationServiceImpl implements LaborEducationService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取每月各个知识库综合得分以及整体得分内容
|
|
|
|
//获取每月各个知识库综合得分以及整体得分内容
|
|
|
|
public Map<String,List<Map<String, Object>>> getStudentMonthlyScores(LaborDto laborDto,HttpServletRequest request) {
|
|
|
|
public Map<String,List<Map<String, Object>>> getStudentMonthlyScores(MoralDto laborDto,HttpServletRequest request) {
|
|
|
|
// 1. 获取基础信息
|
|
|
|
// 1. 获取基础信息
|
|
|
|
String schoolId = SecurityUtil.getLoginUser().getSchoolId();
|
|
|
|
String schoolId = SecurityUtil.getLoginUser().getSchoolId();
|
|
|
|
String studentId = laborDto.getStudentId();
|
|
|
|
String studentId = laborDto.getStudentId();
|
|
|
@ -1677,7 +1678,7 @@ public Map<String,List<Map<String, Object>>> getStudentMonthlyScores(LaborDto la
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private List<LessonRecord> getLessonRecords(LaborDto laborDto, String schoolId) {
|
|
|
|
private List<LessonRecord> getLessonRecords(MoralDto laborDto, String schoolId) {
|
|
|
|
LessonRecordQueryService queryService = new LessonRecordQueryService(lessonRecordRepository);
|
|
|
|
LessonRecordQueryService queryService = new LessonRecordQueryService(lessonRecordRepository);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return queryService.queryLessonsInParallel(
|
|
|
|
return queryService.queryLessonsInParallel(
|
|
|
@ -1696,7 +1697,7 @@ public Map<String,List<Map<String, Object>>> getStudentMonthlyScores(LaborDto la
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private List<ExamVo> getExamsWithKnowledge(LaborDto laborDto, List<LessonRecord> records,
|
|
|
|
private List<ExamVo> getExamsWithKnowledge(MoralDto laborDto, List<LessonRecord> records,
|
|
|
|
Map<String, List<List<String>>> examKnowledgeMap,
|
|
|
|
Map<String, List<List<String>>> examKnowledgeMap,
|
|
|
|
Map<String, List<Double>> points) {
|
|
|
|
Map<String, List<Double>> points) {
|
|
|
|
if (records == null || records.isEmpty()) {
|
|
|
|
if (records == null || records.isEmpty()) {
|
|
|
@ -1912,7 +1913,21 @@ public Map<String,List<Map<String, Object>>> getStudentMonthlyScores(LaborDto la
|
|
|
|
|
|
|
|
|
|
|
|
// 按知识块名称排序(可选)
|
|
|
|
// 按知识块名称排序(可选)
|
|
|
|
scoreList.sort(Comparator.comparing(m -> (String) m.get("name")));
|
|
|
|
scoreList.sort(Comparator.comparing(m -> (String) m.get("name")));
|
|
|
|
|
|
|
|
//所有知识块score求平均
|
|
|
|
|
|
|
|
double totalScore = 0.0;
|
|
|
|
|
|
|
|
int count = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (Map<String, Object> scoreEntry : scoreList) {
|
|
|
|
|
|
|
|
if (scoreEntry.get("score") instanceof Double) {
|
|
|
|
|
|
|
|
totalScore += (Double) scoreEntry.get("score");
|
|
|
|
|
|
|
|
count++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
double averageScore = count > 0 ? totalScore / count : 0.0;
|
|
|
|
|
|
|
|
//保留两位小数
|
|
|
|
|
|
|
|
averageScore = Double.parseDouble(String.format("%.2f", averageScore));
|
|
|
|
|
|
|
|
monthEntry.put("averageScore", averageScore);
|
|
|
|
monthEntry.put("types", scoreList);
|
|
|
|
monthEntry.put("types", scoreList);
|
|
|
|
return monthEntry;
|
|
|
|
return monthEntry;
|
|
|
|
}).sorted(Comparator.comparingInt(m -> (Integer) m.get("month")))
|
|
|
|
}).sorted(Comparator.comparingInt(m -> (Integer) m.get("month")))
|
|
|
@ -2084,7 +2099,7 @@ public Map<String,List<Map<String, Object>>> getStudentMonthlyScores(LaborDto la
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 分学期比对,分析 学期数据
|
|
|
|
// 分学期比对,分析 学期数据
|
|
|
|
public Map<String, Object> getStudentSemesterScores(LaborDto laborDto,HttpServletRequest request) {
|
|
|
|
public Map<String, Object> getStudentSemesterScores(MoralDto laborDto,HttpServletRequest request) {
|
|
|
|
// 1. 获取学期配置
|
|
|
|
// 1. 获取学期配置
|
|
|
|
List<School.Semester> semesters = schoolRepository.findSemestersById(laborDto.getCode(), laborDto.getPeriodId());
|
|
|
|
List<School.Semester> semesters = schoolRepository.findSemestersById(laborDto.getCode(), laborDto.getPeriodId());
|
|
|
|
List<SemesterConfig> configs = new ArrayList<>();
|
|
|
|
List<SemesterConfig> configs = new ArrayList<>();
|
|
|
@ -2111,7 +2126,7 @@ public Map<String,List<Map<String, Object>>> getStudentMonthlyScores(LaborDto la
|
|
|
|
return combineAllResults(laborDto, studentResult, classResult);
|
|
|
|
return combineAllResults(laborDto, studentResult, classResult);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private Map<String, Object> combineAllResults(LaborDto dto,
|
|
|
|
private Map<String, Object> combineAllResults(MoralDto dto,
|
|
|
|
Map<String, Object> studentResult,
|
|
|
|
Map<String, Object> studentResult,
|
|
|
|
Map<String, Object> classResult) {
|
|
|
|
Map<String, Object> classResult) {
|
|
|
|
Map<String, Object> finalResult = new LinkedHashMap<>();
|
|
|
|
Map<String, Object> finalResult = new LinkedHashMap<>();
|
|
|
@ -2127,7 +2142,7 @@ public Map<String,List<Map<String, Object>>> getStudentMonthlyScores(LaborDto la
|
|
|
|
return finalResult;
|
|
|
|
return finalResult;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private Map<String, Object> processIndividual(LaborDto dto,
|
|
|
|
private Map<String, Object> processIndividual(MoralDto dto,
|
|
|
|
SemesterPeriod current,
|
|
|
|
SemesterPeriod current,
|
|
|
|
SemesterPeriod last,
|
|
|
|
SemesterPeriod last,
|
|
|
|
HttpServletRequest request) {
|
|
|
|
HttpServletRequest request) {
|
|
|
@ -2137,12 +2152,12 @@ public Map<String,List<Map<String, Object>>> getStudentMonthlyScores(LaborDto la
|
|
|
|
return combineResults(dto, currentData, lastData);
|
|
|
|
return combineResults(dto, currentData, lastData);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private Map<String, Object> processClass(LaborDto dto,
|
|
|
|
private Map<String, Object> processClass(MoralDto dto,
|
|
|
|
SemesterPeriod current,
|
|
|
|
SemesterPeriod current,
|
|
|
|
SemesterPeriod last,
|
|
|
|
SemesterPeriod last,
|
|
|
|
HttpServletRequest request) {
|
|
|
|
HttpServletRequest request) {
|
|
|
|
// 克隆DTO并清除学生ID
|
|
|
|
// 克隆DTO并清除学生ID
|
|
|
|
LaborDto classDto = new LaborDto();
|
|
|
|
MoralDto classDto = new MoralDto();
|
|
|
|
classDto.setCode(dto.getCode());
|
|
|
|
classDto.setCode(dto.getCode());
|
|
|
|
classDto.setPeriodId(dto.getPeriodId());
|
|
|
|
classDto.setPeriodId(dto.getPeriodId());
|
|
|
|
classDto.setClassId(dto.getClassId());
|
|
|
|
classDto.setClassId(dto.getClassId());
|
|
|
@ -2164,7 +2179,7 @@ public Map<String,List<Map<String, Object>>> getStudentMonthlyScores(LaborDto la
|
|
|
|
return combineClassResults(classDto, currentData, lastData);
|
|
|
|
return combineClassResults(classDto, currentData, lastData);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private Map<String, Object> combineClassResults(LaborDto dto,
|
|
|
|
private Map<String, Object> combineClassResults(MoralDto dto,
|
|
|
|
Map<String, Object> current,
|
|
|
|
Map<String, Object> current,
|
|
|
|
Map<String, Object> last) {
|
|
|
|
Map<String, Object> last) {
|
|
|
|
Map<String, Object> result = new LinkedHashMap<>();
|
|
|
|
Map<String, Object> result = new LinkedHashMap<>();
|
|
|
@ -2177,7 +2192,7 @@ public Map<String,List<Map<String, Object>>> getStudentMonthlyScores(LaborDto la
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private List<Map<String, Object>> buildClassScoreBlocks(LaborDto dto,
|
|
|
|
private List<Map<String, Object>> buildClassScoreBlocks(MoralDto dto,
|
|
|
|
Map<String, Object> current,
|
|
|
|
Map<String, Object> current,
|
|
|
|
Map<String, Object> last) {
|
|
|
|
Map<String, Object> last) {
|
|
|
|
|
|
|
|
|
|
|
@ -2342,7 +2357,7 @@ public Map<String,List<Map<String, Object>>> getStudentMonthlyScores(LaborDto la
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 处理学期数据
|
|
|
|
// 处理学期数据
|
|
|
|
private Map<String, Object> processSemesterData(LaborDto laborDto,
|
|
|
|
private Map<String, Object> processSemesterData(MoralDto laborDto,
|
|
|
|
SemesterPeriod semester,
|
|
|
|
SemesterPeriod semester,
|
|
|
|
HttpServletRequest request,
|
|
|
|
HttpServletRequest request,
|
|
|
|
boolean isCurrent,
|
|
|
|
boolean isCurrent,
|
|
|
@ -2443,7 +2458,7 @@ public Map<String,List<Map<String, Object>>> getStudentMonthlyScores(LaborDto la
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 结果合并方法
|
|
|
|
// 结果合并方法
|
|
|
|
private Map<String, Object> combineResults(LaborDto laborDto,
|
|
|
|
private Map<String, Object> combineResults(MoralDto laborDto,
|
|
|
|
Map<String, Object> currentData,
|
|
|
|
Map<String, Object> currentData,
|
|
|
|
Map<String, Object> lastData) {
|
|
|
|
Map<String, Object> lastData) {
|
|
|
|
Map<String, Object> result = new LinkedHashMap<>();
|
|
|
|
Map<String, Object> result = new LinkedHashMap<>();
|
|
|
|