|
@@ -2,22 +2,27 @@ package com.qmth.distributed.print.business.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.google.gson.reflect.TypeToken;
|
|
|
import com.qmth.distributed.print.business.bean.dto.FinalScoreDto;
|
|
|
import com.qmth.distributed.print.business.bean.dto.report.*;
|
|
|
import com.qmth.distributed.print.business.bean.result.FinalScoreResult;
|
|
|
import com.qmth.distributed.print.business.bean.result.report.PaperStructResult;
|
|
|
+import com.qmth.distributed.print.business.entity.TCPaperStruct;
|
|
|
import com.qmth.distributed.print.business.entity.TRBasicInfo;
|
|
|
import com.qmth.distributed.print.business.mapper.TRBasicInfoMapper;
|
|
|
-import com.qmth.distributed.print.business.service.TCFinalScoreService;
|
|
|
-import com.qmth.distributed.print.business.service.TRBasicInfoService;
|
|
|
+import com.qmth.distributed.print.business.service.*;
|
|
|
+import com.qmth.teachcloud.common.entity.BasicExam;
|
|
|
+import com.qmth.teachcloud.common.entity.BasicSemester;
|
|
|
+import com.qmth.teachcloud.common.service.BasicSemesterService;
|
|
|
import com.qmth.teachcloud.common.util.GsonUtil;
|
|
|
import com.qmth.teachcloud.common.util.JacksonUtil;
|
|
|
import com.qmth.teachcloud.mark.bean.archivescore.ScoreRangeVo;
|
|
|
import com.qmth.teachcloud.mark.entity.MarkPaper;
|
|
|
import com.qmth.teachcloud.mark.utils.Calculator;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
@@ -42,6 +47,21 @@ public class TRBasicInfoServiceImpl extends ServiceImpl<TRBasicInfoMapper, TRBas
|
|
|
@Resource
|
|
|
TCFinalScoreService tcFinalScoreService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ BasicExamService basicExamService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ BasicSemesterService basicSemesterService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ TCPaperStructService tcPaperStructService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ TRBasicInfoService trBasicInfoService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ TRExamStudentService trExamStudentService;
|
|
|
+
|
|
|
/**
|
|
|
* 获取课程目标考核分布-分数图
|
|
|
*
|
|
@@ -255,37 +275,39 @@ public class TRBasicInfoServiceImpl extends ServiceImpl<TRBasicInfoMapper, TRBas
|
|
|
Map<Long, FinalScoreOverviewDto> finalScoreOverviewDtoMap = (Map<Long, FinalScoreOverviewDto>) paramsMap.get("finalScoreOverviewDtoMap");
|
|
|
|
|
|
//TODO 课程考核成绩评价结果-待曹子轩补充目标/评价方式数据,有测试数据
|
|
|
- if (!CollectionUtils.isEmpty(paperStructResultList)) {
|
|
|
+ if (!CollectionUtils.isEmpty(paperStructResultList) && !CollectionUtils.isEmpty(targetMap)) {
|
|
|
List<CourseTargetDto> targetList = new ArrayList<>(targetMap.size());
|
|
|
AtomicInteger sequenceId = new AtomicInteger(1);//流程连接id
|
|
|
AtomicReference<Double> targetValue = new AtomicReference<>(0.0d);
|
|
|
targetMap.forEach((k, v) -> {
|
|
|
Double evaluationValue = 0.0d;
|
|
|
List<ReportEvaluationDto> reportEvaluationDtoList = new ArrayList<>();
|
|
|
- UsualScoreOverviewDto usualScoreOverviewDto = usualScoreOverviewDtoMap.get("作业" + sequenceId.get());
|
|
|
- FinalScoreOverviewDto finalScoreOverviewDto = finalScoreOverviewDtoMap.get(k);
|
|
|
-
|
|
|
- ReportEvaluationDto reportEvaluationDto = new ReportEvaluationDto(usualScoreOverviewDto.getName(), new BigDecimal(30), 40d, usualScoreOverviewDto.getAvgScore());
|
|
|
- reportEvaluationDtoList.add(reportEvaluationDto);
|
|
|
-
|
|
|
- //课程目标-平时作业达成度计算
|
|
|
- if (Objects.nonNull(reportEvaluationDto.getWeight()) && reportEvaluationDto.getWeight().doubleValue() > 0d) {
|
|
|
- Double evaluationValueTemp = new BigDecimal(reportEvaluationDto.getAvg().doubleValue() + reportEvaluationDto.getScore().doubleValue()).divide(reportEvaluationDto.getWeight(), 2, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
- evaluationValue = evaluationValue.doubleValue() + evaluationValueTemp.doubleValue();
|
|
|
- Map<String, BigDecimal> usualScoreWeight = v.getUsualScoreWeight();
|
|
|
- usualScoreWeight = CollectionUtils.isEmpty(usualScoreWeight) ? new LinkedHashMap<>() : usualScoreWeight;
|
|
|
- usualScoreWeight.put(reportEvaluationDto.getName(), reportEvaluationDto.getWeight().add(new BigDecimal(new Random().nextInt(10))));
|
|
|
- v.setUsualScoreWeight(usualScoreWeight);
|
|
|
+ if (!CollectionUtils.isEmpty(usualScoreOverviewDtoMap)) {
|
|
|
+ UsualScoreOverviewDto usualScoreOverviewDto = usualScoreOverviewDtoMap.get("作业" + sequenceId.get());
|
|
|
+ ReportEvaluationDto reportEvaluationDto = new ReportEvaluationDto(usualScoreOverviewDto.getName(), new BigDecimal(30), 40d, usualScoreOverviewDto.getAvgScore());
|
|
|
+ reportEvaluationDtoList.add(reportEvaluationDto);
|
|
|
+
|
|
|
+ //课程目标-平时作业达成度计算
|
|
|
+ if (Objects.nonNull(reportEvaluationDto.getWeight()) && reportEvaluationDto.getWeight().doubleValue() > 0d) {
|
|
|
+ Double evaluationValueTemp = new BigDecimal(reportEvaluationDto.getAvg().doubleValue() + reportEvaluationDto.getScore().doubleValue()).divide(reportEvaluationDto.getWeight(), 2, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
+ evaluationValue = evaluationValue.doubleValue() + evaluationValueTemp.doubleValue();
|
|
|
+ Map<String, BigDecimal> usualScoreWeight = v.getUsualScoreWeight();
|
|
|
+ usualScoreWeight = CollectionUtils.isEmpty(usualScoreWeight) ? new LinkedHashMap<>() : usualScoreWeight;
|
|
|
+ usualScoreWeight.put(reportEvaluationDto.getName(), reportEvaluationDto.getWeight().add(new BigDecimal(new Random().nextInt(10))));
|
|
|
+ v.setUsualScoreWeight(usualScoreWeight);
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- ReportEvaluationDto reportEvaluationDto1 = new ReportEvaluationDto("期末考试", new BigDecimal(70), 60d, finalScoreOverviewDto.getAvgScore());
|
|
|
- reportEvaluationDtoList.add(reportEvaluationDto1);
|
|
|
-
|
|
|
- //课程目标-期末成绩达成度计算
|
|
|
- if (Objects.nonNull(reportEvaluationDto1.getWeight()) && reportEvaluationDto1.getWeight().doubleValue() > 0d) {
|
|
|
- Double evaluationValueTemp = new BigDecimal(reportEvaluationDto1.getAvg().doubleValue() + reportEvaluationDto1.getScore().doubleValue()).divide(reportEvaluationDto1.getWeight(), 2, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
- evaluationValue = evaluationValue.doubleValue() + evaluationValueTemp.doubleValue();
|
|
|
- v.setFinalScoreWeight(reportEvaluationDto1.getWeight().subtract(new BigDecimal(new Random().nextInt(10))));
|
|
|
+ if (!CollectionUtils.isEmpty(finalScoreOverviewDtoMap)) {
|
|
|
+ FinalScoreOverviewDto finalScoreOverviewDto = finalScoreOverviewDtoMap.get(k);
|
|
|
+ ReportEvaluationDto reportEvaluationDto1 = new ReportEvaluationDto("期末考试", new BigDecimal(70), 60d, finalScoreOverviewDto.getAvgScore());
|
|
|
+ reportEvaluationDtoList.add(reportEvaluationDto1);
|
|
|
+
|
|
|
+ //课程目标-期末成绩达成度计算
|
|
|
+ if (Objects.nonNull(reportEvaluationDto1.getWeight()) && reportEvaluationDto1.getWeight().doubleValue() > 0d) {
|
|
|
+ Double evaluationValueTemp = new BigDecimal(reportEvaluationDto1.getAvg().doubleValue() + reportEvaluationDto1.getScore().doubleValue()).divide(reportEvaluationDto1.getWeight(), 2, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
+ evaluationValue = evaluationValue.doubleValue() + evaluationValueTemp.doubleValue();
|
|
|
+ v.setFinalScoreWeight(reportEvaluationDto1.getWeight().subtract(new BigDecimal(new Random().nextInt(10))));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
CourseTargetDto courseTargetDto = new CourseTargetDto(k, v.getTargetName(), Long.parseLong(String.valueOf(sequenceId.get())), "评价方式" + sequenceId.get(), "评价方式描述" + sequenceId.get(), reportEvaluationDtoList, evaluationValue);
|
|
@@ -293,10 +315,72 @@ public class TRBasicInfoServiceImpl extends ServiceImpl<TRBasicInfoMapper, TRBas
|
|
|
targetValue.set(targetValue.get().doubleValue() + courseTargetDto.getEvaluationValue().doubleValue());
|
|
|
sequenceId.incrementAndGet();
|
|
|
});
|
|
|
+ reportCourseEvaluationResultDto = new ReportCourseEvaluationResultDto("测试课程总目标1", targetValue.get(), targetList);
|
|
|
}
|
|
|
return reportCourseEvaluationResultDto;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取报告
|
|
|
+ *
|
|
|
+ * @param trBasicInfo
|
|
|
+ * @param markPaper
|
|
|
+ * @param userId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public TRBasicInfo getReportView(TRBasicInfo trBasicInfo, MarkPaper markPaper, Long userId) {
|
|
|
+ BasicExam basicExam = basicExamService.getById(markPaper.getExamId());
|
|
|
+ Objects.requireNonNull(basicExam, "未找到考试信息");
|
|
|
+
|
|
|
+ BasicSemester basicSemester = basicSemesterService.getById(basicExam.getSemesterId());
|
|
|
+ Objects.requireNonNull(basicSemester, "未找到学期信息");
|
|
|
+
|
|
|
+ //TODO 有测试数据,待肖飞补充授课对象和任课老师数据
|
|
|
+ if (Objects.isNull(trBasicInfo)) {
|
|
|
+ trBasicInfo = new TRBasicInfo(markPaper.getExamId(), markPaper.getCourseCode(), markPaper.getCourseName(), markPaper.getPaperNumber(), basicSemester.getName(), "测试班级1", "测试老师1", 40, userId);
|
|
|
+ } else {
|
|
|
+ trBasicInfo.setBasicInfo(markPaper.getExamId(), markPaper.getCourseCode(), markPaper.getCourseName(), markPaper.getPaperNumber(), basicSemester.getName(), "测试班级1", "测试老师1", 40);
|
|
|
+ }
|
|
|
+ //测试数据
|
|
|
+ //课程基本情况
|
|
|
+ ReportCourseBasicInfoDto reportCourseBasicInfoDto = new ReportCourseBasicInfoDto(trBasicInfo);
|
|
|
+ trBasicInfo.getReportResult().setCourseBasicInfo(reportCourseBasicInfoDto);
|
|
|
+
|
|
|
+ //课程目标考核分布-题目信息
|
|
|
+ TCPaperStruct tcPaperStruct = tcPaperStructService.getOne(new QueryWrapper<TCPaperStruct>().lambda().eq(TCPaperStruct::getExamId, markPaper.getExamId()).eq(TCPaperStruct::getCourseCode, markPaper.getCourseCode()).eq(TCPaperStruct::getPaperNumber, markPaper.getPaperNumber()));
|
|
|
+ Objects.requireNonNull(tcPaperStruct, "未找到试卷蓝图信息");
|
|
|
+
|
|
|
+ List<PaperStructResult> paperStructResultList = GsonUtil.fromJson(tcPaperStruct.getPaperStruct(), new TypeToken<List<PaperStructResult>>() {
|
|
|
+ }.getType());
|
|
|
+
|
|
|
+ ReportCourseEvaluationSpreadDto reportCourseEvaluationSpreadDto = new ReportCourseEvaluationSpreadDto(paperStructResultList);
|
|
|
+ if (Objects.nonNull(reportCourseEvaluationSpreadDto)) {
|
|
|
+ //课程目标考核分布-分数图
|
|
|
+ reportCourseEvaluationSpreadDto.setScoreList(trBasicInfoService.getScoreList(trBasicInfo, markPaper));
|
|
|
+ trBasicInfo.setCourseEvaluationSpread(JacksonUtil.parseJson(reportCourseEvaluationSpreadDto));
|
|
|
+ trBasicInfo.getReportResult().setCourseEvaluationSpreadInfo(reportCourseEvaluationSpreadDto);
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, Object> paramsMap = trBasicInfoService.getReportCalculateParams(trBasicInfo, paperStructResultList);
|
|
|
+ paramsMap = trBasicInfoService.reportCalculateMaxMinAvgSumScore(paramsMap);
|
|
|
+ ReportCourseEvaluationResultDto reportCourseEvaluationResultDto = trBasicInfoService.reportCalculateCourseEvaluationResult(paramsMap);
|
|
|
+ if (Objects.nonNull(reportCourseEvaluationResultDto)) {
|
|
|
+ trBasicInfo.setCourseEvaluationResult(JacksonUtil.parseJson(reportCourseEvaluationResultDto));
|
|
|
+ trBasicInfo.getReportResult().setCourseEvaluationResultInfo(reportCourseEvaluationResultDto);
|
|
|
+ }
|
|
|
+ //课程目标达成评价明细结果-考生集合
|
|
|
+ List<ReportExamStudentDto> examStudentNewList = trExamStudentService.getExamStudentReportDetail(trBasicInfo, paramsMap);
|
|
|
+ ReportCourseEvaluationResultDetailDto reportCourseEvaluationResultDetailDto = new ReportCourseEvaluationResultDetailDto(examStudentNewList);
|
|
|
+ if (Objects.nonNull(reportCourseEvaluationResultDetailDto)) {
|
|
|
+ trBasicInfo.getReportResult().setCourseEvaluationResultDetailInfo(reportCourseEvaluationResultDetailDto);
|
|
|
+ }
|
|
|
+
|
|
|
+ trBasicInfo.getReportResult().setCommonInfo(new ReportCommonDto(markPaper.getExamId(), markPaper.getCourseCode(), markPaper.getCourseName(), markPaper.getPaperNumber()));
|
|
|
+ return trBasicInfo;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 计算分数范围
|
|
|
*
|