|
|
@ -4,14 +4,13 @@ import cn.teammodel.common.ErrorCode;
|
|
|
|
import cn.teammodel.common.PK;
|
|
|
|
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.MoralEducationService;
|
|
|
|
import cn.teammodel.controller.admin.service.MoralEducationService;
|
|
|
|
|
|
|
|
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;
|
|
|
@ -83,20 +82,20 @@ public class MoralEducationServiceImpl implements MoralEducationService {
|
|
|
|
MoralEducationServiceImpl.environment = env; // 在初始化时将非静态字段赋值给静态字段
|
|
|
|
MoralEducationServiceImpl.environment = env; // 在初始化时将非静态字段赋值给静态字段
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public Map<String, Object> getAnalysis(LaborDto laborDto, HttpServletRequest request) {
|
|
|
|
public Map<String, Object> getAnalysis(MoralDto moralDto, HttpServletRequest request) {
|
|
|
|
|
|
|
|
|
|
|
|
//根据具体参数查询相关课列内容
|
|
|
|
//根据具体参数查询相关课列内容
|
|
|
|
List<LessonRecord> records;
|
|
|
|
List<LessonRecord> records;
|
|
|
|
LessonRecordQueryService queryService = new LessonRecordQueryService(lessonRecordRepository);
|
|
|
|
LessonRecordQueryService queryService = new LessonRecordQueryService(lessonRecordRepository);
|
|
|
|
String schoolId = SecurityUtil.getLoginUser().getSchoolId();
|
|
|
|
String schoolId = SecurityUtil.getLoginUser().getSchoolId();
|
|
|
|
String lessonRecordKey = String.format(PK.PK_LESSON_RECORD, laborDto.getCode());
|
|
|
|
String lessonRecordKey = String.format(PK.PK_LESSON_RECORD, moralDto.getCode());
|
|
|
|
Long startTime = laborDto.getStartTime();
|
|
|
|
Long startTime = moralDto.getStartTime();
|
|
|
|
Long endTime = laborDto.getEndTime();
|
|
|
|
Long endTime = moralDto.getEndTime();
|
|
|
|
String subjectId = laborDto.getSubjectId();
|
|
|
|
String subjectId = moralDto.getSubjectId();
|
|
|
|
//String tmdId = laborDto.getTmdId();
|
|
|
|
//String tmdId = moralDto.getTmdId();
|
|
|
|
String grade = laborDto.getGrade();
|
|
|
|
String grade = moralDto.getGrade();
|
|
|
|
String periodId = laborDto.getPeriodId();
|
|
|
|
String periodId = moralDto.getPeriodId();
|
|
|
|
String academicYearId = laborDto.getAcademicYearId();
|
|
|
|
String academicYearId = moralDto.getAcademicYearId();
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
|
|
records = queryService.queryLessonsInParallel(
|
|
|
|
records = queryService.queryLessonsInParallel(
|
|
|
@ -127,7 +126,7 @@ public class MoralEducationServiceImpl implements MoralEducationService {
|
|
|
|
queryService.shutdown();
|
|
|
|
queryService.shutdown();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//总评价数
|
|
|
|
//总评价数
|
|
|
|
List<ClassInfo> classes = classRepository.findClassBySchoolIdAndPeriodId(laborDto.getPeriodId(), String.format(PK.CLASS, schoolId));
|
|
|
|
List<ClassInfo> classes = classRepository.findClassBySchoolIdAndPeriodId(moralDto.getPeriodId(), String.format(PK.CLASS, schoolId));
|
|
|
|
if (classes.isEmpty()) {
|
|
|
|
if (classes.isEmpty()) {
|
|
|
|
throw new ServiceException(ErrorCode.SYSTEM_ERROR.getCode(), "暂无班级");
|
|
|
|
throw new ServiceException(ErrorCode.SYSTEM_ERROR.getCode(), "暂无班级");
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -159,7 +158,7 @@ public class MoralEducationServiceImpl implements MoralEducationService {
|
|
|
|
//获取所有课程下的课中活动
|
|
|
|
//获取所有课程下的课中活动
|
|
|
|
List<ExamVo> exams = new ArrayList<>();
|
|
|
|
List<ExamVo> exams = new ArrayList<>();
|
|
|
|
if (!recordIds.isEmpty()) {
|
|
|
|
if (!recordIds.isEmpty()) {
|
|
|
|
exams = examRepository.findExamsByIds(laborDto.getSource(),recordIds);
|
|
|
|
exams = examRepository.findExamsByIds(moralDto.getSource(),recordIds);
|
|
|
|
exams = exams.stream()
|
|
|
|
exams = exams.stream()
|
|
|
|
.filter(exam -> !exam.getClasses().isEmpty())
|
|
|
|
.filter(exam -> !exam.getClasses().isEmpty())
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
.collect(Collectors.toList());
|
|
|
@ -187,7 +186,7 @@ public class MoralEducationServiceImpl implements MoralEducationService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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, moralDto.getCode()),examIds);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//获取学校基础信息
|
|
|
|
//获取学校基础信息
|
|
|
|
List<School.Period> period = schoolRepository.findPeriodById(schoolId,periodId);
|
|
|
|
List<School.Period> period = schoolRepository.findPeriodById(schoolId,periodId);
|
|
|
@ -208,11 +207,11 @@ public class MoralEducationServiceImpl implements MoralEducationService {
|
|
|
|
Map<String, List<String>> knowledgeBlockToPointsMap = getKnowledgeBlockToPointsMap(appraise);
|
|
|
|
Map<String, List<String>> knowledgeBlockToPointsMap = getKnowledgeBlockToPointsMap(appraise);
|
|
|
|
Map<String, Object> classScoreRate = new HashMap<>();
|
|
|
|
Map<String, Object> classScoreRate = new HashMap<>();
|
|
|
|
Map<String, Object> gradeScoreRate = new HashMap<>();
|
|
|
|
Map<String, Object> gradeScoreRate = new HashMap<>();
|
|
|
|
if (laborDto.getClassId() != null) {
|
|
|
|
if (moralDto.getClassId() != null) {
|
|
|
|
classScoreRate = calculateKnowledgeScoreRateForClass(laborDto.getClassId(), examResults, knowledgeMap, appraise, point,res,request);
|
|
|
|
classScoreRate = calculateKnowledgeScoreRateForClass(moralDto.getClassId(), examResults, knowledgeMap, appraise, point,res,request);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (laborDto.getGrade() != null) {
|
|
|
|
if (moralDto.getGrade() != null) {
|
|
|
|
gradeScoreRate = calculateKnowledgeScoreForGrade(laborDto.getGrade(), examResults, knowledgeMap,appraise, point,res,gradeAndClassVos,request);
|
|
|
|
gradeScoreRate = calculateKnowledgeScoreForGrade(moralDto.getGrade(), examResults, knowledgeMap,appraise, point,res,gradeAndClassVos,request);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Map<String,Object> schoolScoreRate = calculateKnowledgeScoreForSchool(examResults, knowledgeMap,appraise, point,res,period,gradeAndClassVos,request);
|
|
|
|
Map<String,Object> schoolScoreRate = calculateKnowledgeScoreForSchool(examResults, knowledgeMap,appraise, point,res,period,gradeAndClassVos,request);
|
|
|
|
resMap.put("gradeScoreRate", gradeScoreRate);
|
|
|
|
resMap.put("gradeScoreRate", gradeScoreRate);
|
|
|
@ -243,16 +242,16 @@ public class MoralEducationServiceImpl implements MoralEducationService {
|
|
|
|
return resMap;
|
|
|
|
return resMap;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public Map<String, Object> getExamDetails(LaborDto laborDto, HttpServletRequest request) {
|
|
|
|
public Map<String, Object> getExamDetails(MoralDto moralDto, 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<>();
|
|
|
|
if (!laborDto.getExamId().isEmpty()) {
|
|
|
|
if (!moralDto.getExamId().isEmpty()) {
|
|
|
|
Map<String, List<List<String>>> knowledgeMap = new HashMap<>();
|
|
|
|
Map<String, List<List<String>>> knowledgeMap = new HashMap<>();
|
|
|
|
Map<String, List<Double>> points = new HashMap<>();
|
|
|
|
Map<String, List<Double>> points = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
|
|
// 1. 查询考试信息
|
|
|
|
// 1. 查询考试信息
|
|
|
|
Exam exam = examRepository.findExamById(String.format(PK.EXAM, laborDto.getTmdId()), laborDto.getExamId()).get(0);
|
|
|
|
Exam exam = examRepository.findExamById(String.format(PK.EXAM, moralDto.getTmdId()), moralDto.getExamId()).get(0);
|
|
|
|
if (exam.getPapers() != null && !exam.getPapers().isEmpty()) {
|
|
|
|
if (exam.getPapers() != null && !exam.getPapers().isEmpty()) {
|
|
|
|
knowledgeMap.put(exam.getId(), exam.getPapers().get(0).getKnowledge());
|
|
|
|
knowledgeMap.put(exam.getId(), exam.getPapers().get(0).getKnowledge());
|
|
|
|
points.put(exam.getId(), exam.getPapers().get(0).getPoint());
|
|
|
|
points.put(exam.getId(), exam.getPapers().get(0).getPoint());
|
|
|
@ -260,15 +259,15 @@ public class MoralEducationServiceImpl implements MoralEducationService {
|
|
|
|
|
|
|
|
|
|
|
|
// 2. 查询考试结果
|
|
|
|
// 2. 查询考试结果
|
|
|
|
examResults = examClassResultRepository.findById(
|
|
|
|
examResults = examClassResultRepository.findById(
|
|
|
|
String.format(PK.CLASS_RESULT, laborDto.getCode()),
|
|
|
|
String.format(PK.CLASS_RESULT, moralDto.getCode()),
|
|
|
|
laborDto.getClassId(),
|
|
|
|
moralDto.getClassId(),
|
|
|
|
laborDto.getExamId()
|
|
|
|
moralDto.getExamId()
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
// 3. 查询知识块-知识点映射关系
|
|
|
|
// 3. 查询知识块-知识点映射关系
|
|
|
|
Appraise appraise = appraiseRepository.findAppraiseBySchoolIdAndPeriodIdAndCode(
|
|
|
|
Appraise appraise = appraiseRepository.findAppraiseBySchoolIdAndPeriodIdAndCode(
|
|
|
|
laborDto.getCode(),
|
|
|
|
moralDto.getCode(),
|
|
|
|
laborDto.getPeriodId(),
|
|
|
|
moralDto.getPeriodId(),
|
|
|
|
PK.PK_APPRAISE
|
|
|
|
PK.PK_APPRAISE
|
|
|
|
);
|
|
|
|
);
|
|
|
|
appraise = evaluationService.buildTree(appraise);
|
|
|
|
appraise = evaluationService.buildTree(appraise);
|
|
|
@ -278,7 +277,7 @@ public class MoralEducationServiceImpl implements MoralEducationService {
|
|
|
|
Map<String, Double> knowledgeTotalScore = new HashMap<>();
|
|
|
|
Map<String, Double> knowledgeTotalScore = new HashMap<>();
|
|
|
|
if (!examResults.isEmpty()) {
|
|
|
|
if (!examResults.isEmpty()) {
|
|
|
|
// 假设计算所有学生的平均分(或指定某个学生)
|
|
|
|
// 假设计算所有学生的平均分(或指定某个学生)
|
|
|
|
String studentId = laborDto.getStudentId(); // 如果传入了学生ID
|
|
|
|
String studentId = moralDto.getStudentId(); // 如果传入了学生ID
|
|
|
|
calculateStudentScoreRates(studentId, examResults, knowledgeMap, points, knowledgeTotalScore);
|
|
|
|
calculateStudentScoreRates(studentId, examResults, knowledgeMap, points, knowledgeTotalScore);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
// 如果没有考试数据,默认所有知识点60分
|
|
|
|
// 如果没有考试数据,默认所有知识点60分
|
|
|
@ -1503,23 +1502,23 @@ public class MoralEducationServiceImpl implements MoralEducationService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取每月各个知识库综合得分以及整体得分内容
|
|
|
|
//获取每月各个知识库综合得分以及整体得分内容
|
|
|
|
public Map<String,List<Map<String, Object>>> getStudentMonthlyScores(LaborDto laborDto,HttpServletRequest request) {
|
|
|
|
public Map<String,List<Map<String, Object>>> getStudentMonthlyScores(MoralDto moralDto,HttpServletRequest request) {
|
|
|
|
// 1. 获取基础信息
|
|
|
|
// 1. 获取基础信息
|
|
|
|
String schoolId = SecurityUtil.getLoginUser().getSchoolId();
|
|
|
|
String schoolId = SecurityUtil.getLoginUser().getSchoolId();
|
|
|
|
String studentId = laborDto.getStudentId();
|
|
|
|
String studentId = moralDto.getStudentId();
|
|
|
|
List<String> classStudentIds = Collections.emptyList();
|
|
|
|
List<String> classStudentIds = Collections.emptyList();
|
|
|
|
// 2. 获取相关开课记录
|
|
|
|
// 2. 获取相关开课记录
|
|
|
|
List<LessonRecord> records = getLessonRecords(laborDto, schoolId);
|
|
|
|
List<LessonRecord> records = getLessonRecords(moralDto, schoolId);
|
|
|
|
List<RecordVo> res;
|
|
|
|
List<RecordVo> res;
|
|
|
|
int rightCount = 0;
|
|
|
|
int rightCount = 0;
|
|
|
|
int wrongCount = 0;
|
|
|
|
int wrongCount = 0;
|
|
|
|
if (laborDto.getClassId() == null) {
|
|
|
|
if (moralDto.getClassId() == null) {
|
|
|
|
res = appraiseRecordRepository.getStudentRecords(
|
|
|
|
res = appraiseRecordRepository.getStudentRecords(
|
|
|
|
String.format(PK.PK_APPRAISE_RECORD, schoolId),
|
|
|
|
String.format(PK.PK_APPRAISE_RECORD, schoolId),
|
|
|
|
laborDto.getAcademicYearId(),
|
|
|
|
moralDto.getAcademicYearId(),
|
|
|
|
laborDto.getStudentId(),
|
|
|
|
moralDto.getStudentId(),
|
|
|
|
laborDto.getStartTime(),
|
|
|
|
moralDto.getStartTime(),
|
|
|
|
laborDto.getEndTime(),
|
|
|
|
moralDto.getEndTime(),
|
|
|
|
"劳育"
|
|
|
|
"劳育"
|
|
|
|
);
|
|
|
|
);
|
|
|
|
//表扬的次数
|
|
|
|
//表扬的次数
|
|
|
@ -1528,10 +1527,10 @@ public class MoralEducationServiceImpl implements MoralEducationService {
|
|
|
|
wrongCount = (int) res.stream().filter(record -> !record.isPraise()).count();
|
|
|
|
wrongCount = (int) res.stream().filter(record -> !record.isPraise()).count();
|
|
|
|
}else {
|
|
|
|
}else {
|
|
|
|
//当班级ID 存在时 获取该班级下所有名单即学生Id
|
|
|
|
//当班级ID 存在时 获取该班级下所有名单即学生Id
|
|
|
|
List<String> classIds = Collections.singletonList(laborDto.getClassId());
|
|
|
|
List<String> classIds = Collections.singletonList(moralDto.getClassId());
|
|
|
|
GroupDto groupDto = new GroupDto();
|
|
|
|
GroupDto groupDto = new GroupDto();
|
|
|
|
groupDto.setIds(classIds);
|
|
|
|
groupDto.setIds(classIds);
|
|
|
|
groupDto.setSchoolId(laborDto.getCode());
|
|
|
|
groupDto.setSchoolId(moralDto.getCode());
|
|
|
|
String url = environment.getProperty("ies.server-url-group");
|
|
|
|
String url = environment.getProperty("ies.server-url-group");
|
|
|
|
Map<String, Object> groupId = GroupUtil.getGroupId(groupDto, new GroupUtil(environment), request, url);
|
|
|
|
Map<String, Object> groupId = GroupUtil.getGroupId(groupDto, new GroupUtil(environment), request, url);
|
|
|
|
List<RGroupList> rGroupList = new ArrayList<>();
|
|
|
|
List<RGroupList> rGroupList = new ArrayList<>();
|
|
|
@ -1546,7 +1545,7 @@ public class MoralEducationServiceImpl implements MoralEducationService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
rMembers = rGroupList.stream()
|
|
|
|
rMembers = rGroupList.stream()
|
|
|
|
.flatMap(rGroupList1 -> rGroupList1.getMembers().stream())
|
|
|
|
.flatMap(rGroupList1 -> rGroupList1.getMembers().stream())
|
|
|
|
.filter(rMember -> rMember.getClassId().equals(laborDto.getClassId()))
|
|
|
|
.filter(rMember -> rMember.getClassId().equals(moralDto.getClassId()))
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
classStudentIds = rMembers.stream().map(RMember::getId).collect(Collectors.toList());
|
|
|
|
classStudentIds = rMembers.stream().map(RMember::getId).collect(Collectors.toList());
|
|
|
|
/*String className = rGroupList.stream()
|
|
|
|
/*String className = rGroupList.stream()
|
|
|
@ -1556,9 +1555,9 @@ public class MoralEducationServiceImpl implements MoralEducationService {
|
|
|
|
.orElse("未知班级"); // 如果未找到则返回默认值 "未知班级"*/
|
|
|
|
.orElse("未知班级"); // 如果未找到则返回默认值 "未知班级"*/
|
|
|
|
res = appraiseRecordRepository.getRecords(
|
|
|
|
res = appraiseRecordRepository.getRecords(
|
|
|
|
String.format(PK.PK_APPRAISE_RECORD, schoolId),
|
|
|
|
String.format(PK.PK_APPRAISE_RECORD, schoolId),
|
|
|
|
laborDto.getAcademicYearId(),
|
|
|
|
moralDto.getAcademicYearId(),
|
|
|
|
laborDto.getClassId(),
|
|
|
|
moralDto.getClassId(),
|
|
|
|
laborDto.getStudentId(),
|
|
|
|
moralDto.getStudentId(),
|
|
|
|
"劳育"
|
|
|
|
"劳育"
|
|
|
|
);
|
|
|
|
);
|
|
|
|
//表扬的次数
|
|
|
|
//表扬的次数
|
|
|
@ -1570,20 +1569,20 @@ public class MoralEducationServiceImpl implements MoralEducationService {
|
|
|
|
// 3. 获取考试及知识点映射
|
|
|
|
// 3. 获取考试及知识点映射
|
|
|
|
Map<String, List<List<String>>> examKnowledgeMap = new HashMap<>();
|
|
|
|
Map<String, List<List<String>>> examKnowledgeMap = new HashMap<>();
|
|
|
|
Map<String, List<Double>> points = new HashMap<>();
|
|
|
|
Map<String, List<Double>> points = new HashMap<>();
|
|
|
|
List<ExamVo> exams = getExamsWithKnowledge(laborDto, records, examKnowledgeMap, points);
|
|
|
|
List<ExamVo> exams = getExamsWithKnowledge(moralDto, records, examKnowledgeMap, points);
|
|
|
|
|
|
|
|
|
|
|
|
// 4. 获取考试结果并按月份分组
|
|
|
|
// 4. 获取考试结果并按月份分组
|
|
|
|
List<String> targetStudents = laborDto.getClassId() != null ?
|
|
|
|
List<String> targetStudents = moralDto.getClassId() != null ?
|
|
|
|
classStudentIds : Collections.singletonList(studentId);
|
|
|
|
classStudentIds : Collections.singletonList(studentId);
|
|
|
|
|
|
|
|
|
|
|
|
Map<Integer, List<ExamResultWrapper>> monthlyResults = getMonthlyExamResults(
|
|
|
|
Map<Integer, List<ExamResultWrapper>> monthlyResults = getMonthlyExamResults(
|
|
|
|
schoolId, laborDto.getClassId(), exams, records,
|
|
|
|
schoolId, moralDto.getClassId(), exams, records,
|
|
|
|
examKnowledgeMap, points, targetStudents // 传入目标学生列表
|
|
|
|
examKnowledgeMap, points, targetStudents // 传入目标学生列表
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
// 5. 获取知识块配置
|
|
|
|
// 5. 获取知识块配置
|
|
|
|
Appraise appraise = appraiseRepository.findAppraiseBySchoolIdAndPeriodIdAndCode(
|
|
|
|
Appraise appraise = appraiseRepository.findAppraiseBySchoolIdAndPeriodIdAndCode(
|
|
|
|
schoolId, laborDto.getPeriodId(), PK.PK_APPRAISE
|
|
|
|
schoolId, moralDto.getPeriodId(), PK.PK_APPRAISE
|
|
|
|
);
|
|
|
|
);
|
|
|
|
appraise = evaluationService.buildTree(appraise);
|
|
|
|
appraise = evaluationService.buildTree(appraise);
|
|
|
|
Map<String, List<String>> knowledgeBlockMap = getKnowledgeBlockToPointsMap(appraise);
|
|
|
|
Map<String, List<String>> knowledgeBlockMap = getKnowledgeBlockToPointsMap(appraise);
|
|
|
@ -1599,7 +1598,7 @@ public class MoralEducationServiceImpl implements MoralEducationService {
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Map<Integer, Integer>> finalBlockMonthlyCounts = blockMonthlyCounts;
|
|
|
|
Map<String, Map<Integer, Integer>> finalBlockMonthlyCounts = blockMonthlyCounts;
|
|
|
|
res.stream()
|
|
|
|
res.stream()
|
|
|
|
.filter(vo -> laborDto.getClassId() != null ?
|
|
|
|
.filter(vo -> moralDto.getClassId() != null ?
|
|
|
|
targetStudents.contains(vo.getTargetId()) :
|
|
|
|
targetStudents.contains(vo.getTargetId()) :
|
|
|
|
studentId.equals(vo.getTargetId()))
|
|
|
|
studentId.equals(vo.getTargetId()))
|
|
|
|
.forEach(vo -> {
|
|
|
|
.forEach(vo -> {
|
|
|
@ -1634,7 +1633,7 @@ public class MoralEducationServiceImpl implements MoralEducationService {
|
|
|
|
targetStudents,
|
|
|
|
targetStudents,
|
|
|
|
monthlyResults,
|
|
|
|
monthlyResults,
|
|
|
|
knowledgeBlockMap,
|
|
|
|
knowledgeBlockMap,
|
|
|
|
getMonthsBetween(laborDto.getStartTime(), laborDto.getEndTime()),
|
|
|
|
getMonthsBetween(moralDto.getStartTime(), moralDto.getEndTime()),
|
|
|
|
blockMonthlyCounts
|
|
|
|
blockMonthlyCounts
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1676,17 +1675,17 @@ public class MoralEducationServiceImpl implements MoralEducationService {
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private List<LessonRecord> getLessonRecords(LaborDto laborDto, String schoolId) {
|
|
|
|
private List<LessonRecord> getLessonRecords(MoralDto moralDto, String schoolId) {
|
|
|
|
LessonRecordQueryService queryService = new LessonRecordQueryService(lessonRecordRepository);
|
|
|
|
LessonRecordQueryService queryService = new LessonRecordQueryService(lessonRecordRepository);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return queryService.queryLessonsInParallel(
|
|
|
|
return queryService.queryLessonsInParallel(
|
|
|
|
String.format(PK.PK_LESSON_RECORD, schoolId),
|
|
|
|
String.format(PK.PK_LESSON_RECORD, schoolId),
|
|
|
|
laborDto.getStartTime(),
|
|
|
|
moralDto.getStartTime(),
|
|
|
|
laborDto.getEndTime(),
|
|
|
|
moralDto.getEndTime(),
|
|
|
|
laborDto.getSubjectId(),
|
|
|
|
moralDto.getSubjectId(),
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
laborDto.getPeriodId()
|
|
|
|
moralDto.getPeriodId()
|
|
|
|
);
|
|
|
|
);
|
|
|
|
} catch (InterruptedException | ExecutionException e) {
|
|
|
|
} catch (InterruptedException | ExecutionException e) {
|
|
|
|
throw new ServiceException(ErrorCode.SYSTEM_ERROR.getCode(), "课程查询异常");
|
|
|
|
throw new ServiceException(ErrorCode.SYSTEM_ERROR.getCode(), "课程查询异常");
|
|
|
@ -1695,11 +1694,11 @@ public class MoralEducationServiceImpl implements MoralEducationService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private List<ExamVo> getExamsWithKnowledge(LaborDto laborDto, List<LessonRecord> records,
|
|
|
|
private List<ExamVo> getExamsWithKnowledge(MoralDto moralDto, 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) {
|
|
|
|
List<String> lessonRecordIds = records.stream().map(LessonRecord::getId).collect(Collectors.toList());
|
|
|
|
List<String> lessonRecordIds = records.stream().map(LessonRecord::getId).collect(Collectors.toList());
|
|
|
|
List<ExamVo> exams = examRepository.findExamsByIds(laborDto.getSource(), lessonRecordIds);
|
|
|
|
List<ExamVo> exams = examRepository.findExamsByIds(moralDto.getSource(), lessonRecordIds);
|
|
|
|
|
|
|
|
|
|
|
|
exams.forEach(exam -> {
|
|
|
|
exams.forEach(exam -> {
|
|
|
|
if (!exam.getPapers().isEmpty() && exam.getPapers().get(0).getKnowledge() != null) {
|
|
|
|
if (!exam.getPapers().isEmpty() && exam.getPapers().get(0).getKnowledge() != null) {
|
|
|
@ -2067,9 +2066,9 @@ public class MoralEducationServiceImpl implements MoralEducationService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 分学期比对,分析 学期数据
|
|
|
|
// 分学期比对,分析 学期数据
|
|
|
|
public Map<String, Object> getStudentSemesterScores(LaborDto laborDto,HttpServletRequest request) {
|
|
|
|
public Map<String, Object> getStudentSemesterScores(MoralDto moralDto,HttpServletRequest request) {
|
|
|
|
// 1. 获取学期配置
|
|
|
|
// 1. 获取学期配置
|
|
|
|
List<School.Semester> semesters = schoolRepository.findSemestersById(laborDto.getCode(), laborDto.getPeriodId());
|
|
|
|
List<School.Semester> semesters = schoolRepository.findSemestersById(moralDto.getCode(), moralDto.getPeriodId());
|
|
|
|
List<SemesterConfig> configs = new ArrayList<>();
|
|
|
|
List<SemesterConfig> configs = new ArrayList<>();
|
|
|
|
for (School.Semester semester : semesters) {
|
|
|
|
for (School.Semester semester : semesters) {
|
|
|
|
configs.add(new SemesterConfig(semester.getName(), semester.getStart(), semester.getMonth(), semester.getDay(), semester.getId()));
|
|
|
|
configs.add(new SemesterConfig(semester.getName(), semester.getStart(), semester.getMonth(), semester.getDay(), semester.getId()));
|
|
|
@ -2081,20 +2080,20 @@ public class MoralEducationServiceImpl implements MoralEducationService {
|
|
|
|
|
|
|
|
|
|
|
|
// 学生数据处理
|
|
|
|
// 学生数据处理
|
|
|
|
Map<String, Object> studentResult = Collections.emptyMap();
|
|
|
|
Map<String, Object> studentResult = Collections.emptyMap();
|
|
|
|
if (StringUtils.isNotBlank(laborDto.getStudentId())) {
|
|
|
|
if (StringUtils.isNotBlank(moralDto.getStudentId())) {
|
|
|
|
studentResult = processIndividual(laborDto, current, last, request);
|
|
|
|
studentResult = processIndividual(moralDto, current, last, request);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 班级数据处理
|
|
|
|
// 班级数据处理
|
|
|
|
Map<String, Object> classResult = Collections.emptyMap();
|
|
|
|
Map<String, Object> classResult = Collections.emptyMap();
|
|
|
|
if (StringUtils.isNotBlank(laborDto.getClassId())) {
|
|
|
|
if (StringUtils.isNotBlank(moralDto.getClassId())) {
|
|
|
|
classResult = processClass(laborDto, current, last, request);
|
|
|
|
classResult = processClass(moralDto, current, last, request);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 组合最终结果
|
|
|
|
// 组合最终结果
|
|
|
|
return combineAllResults(laborDto, studentResult, classResult);
|
|
|
|
return combineAllResults(moralDto, 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<>();
|
|
|
@ -2110,7 +2109,7 @@ public class MoralEducationServiceImpl implements MoralEducationService {
|
|
|
|
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) {
|
|
|
@ -2120,12 +2119,12 @@ public class MoralEducationServiceImpl implements MoralEducationService {
|
|
|
|
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());
|
|
|
@ -2147,7 +2146,7 @@ public class MoralEducationServiceImpl implements MoralEducationService {
|
|
|
|
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<>();
|
|
|
@ -2160,7 +2159,7 @@ public class MoralEducationServiceImpl implements MoralEducationService {
|
|
|
|
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) {
|
|
|
|
|
|
|
|
|
|
|
@ -2325,7 +2324,7 @@ public class MoralEducationServiceImpl implements MoralEducationService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 处理学期数据
|
|
|
|
// 处理学期数据
|
|
|
|
private Map<String, Object> processSemesterData(LaborDto laborDto,
|
|
|
|
private Map<String, Object> processSemesterData(MoralDto moralDto,
|
|
|
|
SemesterPeriod semester,
|
|
|
|
SemesterPeriod semester,
|
|
|
|
HttpServletRequest request,
|
|
|
|
HttpServletRequest request,
|
|
|
|
boolean isCurrent,
|
|
|
|
boolean isCurrent,
|
|
|
@ -2333,11 +2332,11 @@ public class MoralEducationServiceImpl implements MoralEducationService {
|
|
|
|
Map<String, Object> result = new HashMap<>();
|
|
|
|
Map<String, Object> result = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
|
|
// 1. 设置时间范围查询条件
|
|
|
|
// 1. 设置时间范围查询条件
|
|
|
|
laborDto.setStartTime(convertToTimestamp(semester.startDate));
|
|
|
|
moralDto.setStartTime(convertToTimestamp(semester.startDate));
|
|
|
|
laborDto.setEndTime(convertToTimestamp(semester.endDate));
|
|
|
|
moralDto.setEndTime(convertToTimestamp(semester.endDate));
|
|
|
|
|
|
|
|
|
|
|
|
// 2. 获取原始分析数据
|
|
|
|
// 2. 获取原始分析数据
|
|
|
|
Map<String, Object> analysisData = getAnalysis(laborDto, request);
|
|
|
|
Map<String, Object> analysisData = getAnalysis(moralDto, request);
|
|
|
|
|
|
|
|
|
|
|
|
if (isClassMod) {
|
|
|
|
if (isClassMod) {
|
|
|
|
// 班级知识点统计
|
|
|
|
// 班级知识点统计
|
|
|
@ -2359,7 +2358,7 @@ public class MoralEducationServiceImpl implements MoralEducationService {
|
|
|
|
if (isCurrent) {
|
|
|
|
if (isCurrent) {
|
|
|
|
List<Map<String, Object>> scores = (List<Map<String, Object>>) analysisData.get("scores");
|
|
|
|
List<Map<String, Object>> scores = (List<Map<String, Object>>) analysisData.get("scores");
|
|
|
|
Map<String, Integer> knowledgeCounts = scores.stream()
|
|
|
|
Map<String, Integer> knowledgeCounts = scores.stream()
|
|
|
|
.filter(s -> laborDto.getStudentId().equals(s.get("studentId")))
|
|
|
|
.filter(s -> moralDto.getStudentId().equals(s.get("studentId")))
|
|
|
|
.findFirst()
|
|
|
|
.findFirst()
|
|
|
|
.map(s -> (List<Map<String, Object>>) s.get("appraises"))
|
|
|
|
.map(s -> (List<Map<String, Object>>) s.get("appraises"))
|
|
|
|
.map(appraises -> appraises.stream()
|
|
|
|
.map(appraises -> appraises.stream()
|
|
|
@ -2373,7 +2372,7 @@ public class MoralEducationServiceImpl implements MoralEducationService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 4. 提取综合得分
|
|
|
|
// 4. 提取综合得分
|
|
|
|
Map<String, Double> blockScores = extractBlockScores(analysisData, laborDto.getStudentId());
|
|
|
|
Map<String, Double> blockScores = extractBlockScores(analysisData, moralDto.getStudentId());
|
|
|
|
result.put("blockScores", blockScores);
|
|
|
|
result.put("blockScores", blockScores);
|
|
|
|
|
|
|
|
|
|
|
|
// 5. 提取班级均分
|
|
|
|
// 5. 提取班级均分
|
|
|
@ -2426,14 +2425,14 @@ public class MoralEducationServiceImpl implements MoralEducationService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 结果合并方法
|
|
|
|
// 结果合并方法
|
|
|
|
private Map<String, Object> combineResults(LaborDto laborDto,
|
|
|
|
private Map<String, Object> combineResults(MoralDto moralDto,
|
|
|
|
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<>();
|
|
|
|
result.put("studentId", laborDto.getStudentId());
|
|
|
|
result.put("studentId", moralDto.getStudentId());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Appraise appraise = appraiseRepository.findAppraiseBySchoolIdAndPeriodIdAndCode(laborDto.getCode(), laborDto.getPeriodId(), PK.PK_APPRAISE);
|
|
|
|
Appraise appraise = appraiseRepository.findAppraiseBySchoolIdAndPeriodIdAndCode(moralDto.getCode(), moralDto.getPeriodId(), PK.PK_APPRAISE);
|
|
|
|
// 获取知识块配置
|
|
|
|
// 获取知识块配置
|
|
|
|
appraise = evaluationService.buildTree(appraise);
|
|
|
|
appraise = evaluationService.buildTree(appraise);
|
|
|
|
Set<String> knowledgeBlocks = loadKnowledgeBlocks(appraise);
|
|
|
|
Set<String> knowledgeBlocks = loadKnowledgeBlocks(appraise);
|
|
|
|