|
@@ -1,6 +1,5 @@
|
|
package com.qmth.distributed.print.business.service.impl;
|
|
package com.qmth.distributed.print.business.service.impl;
|
|
|
|
|
|
-import com.alibaba.fastjson.JSONArray;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.qmth.distributed.print.business.bean.dto.report.*;
|
|
import com.qmth.distributed.print.business.bean.dto.report.*;
|
|
@@ -9,15 +8,15 @@ import com.qmth.distributed.print.business.entity.TRBasicInfo;
|
|
import com.qmth.distributed.print.business.entity.TRExamStudent;
|
|
import com.qmth.distributed.print.business.entity.TRExamStudent;
|
|
import com.qmth.distributed.print.business.mapper.TRExamStudentMapper;
|
|
import com.qmth.distributed.print.business.mapper.TRExamStudentMapper;
|
|
import com.qmth.distributed.print.business.service.TRExamStudentService;
|
|
import com.qmth.distributed.print.business.service.TRExamStudentService;
|
|
|
|
+import com.qmth.teachcloud.common.util.JacksonUtil;
|
|
|
|
+import org.slf4j.Logger;
|
|
|
|
+import org.slf4j.LoggerFactory;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.util.CollectionUtils;
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.Collections;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Map;
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
/**
|
|
* <p>
|
|
* <p>
|
|
@@ -29,6 +28,7 @@ import java.util.Map;
|
|
*/
|
|
*/
|
|
@Service
|
|
@Service
|
|
public class TRExamStudentServiceImpl extends ServiceImpl<TRExamStudentMapper, TRExamStudent> implements TRExamStudentService {
|
|
public class TRExamStudentServiceImpl extends ServiceImpl<TRExamStudentMapper, TRExamStudent> implements TRExamStudentService {
|
|
|
|
+ private final static Logger log = LoggerFactory.getLogger(TRExamStudentServiceImpl.class);
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取考生详细报告
|
|
* 获取考生详细报告
|
|
@@ -43,30 +43,72 @@ public class TRExamStudentServiceImpl extends ServiceImpl<TRExamStudentMapper, T
|
|
List<ReportExamStudentDto> examStudentList = (List<ReportExamStudentDto>) paramsMap.get("examStudentList");
|
|
List<ReportExamStudentDto> examStudentList = (List<ReportExamStudentDto>) paramsMap.get("examStudentList");
|
|
Map<String, Map<Long, Map<Long, DimensionDto>>> finalScoreExamStudentDimensionMap = (Map<String, Map<Long, Map<Long, DimensionDto>>>) paramsMap.get("finalScoreExamStudentDimensionMap");
|
|
Map<String, Map<Long, Map<Long, DimensionDto>>> finalScoreExamStudentDimensionMap = (Map<String, Map<Long, Map<Long, DimensionDto>>>) paramsMap.get("finalScoreExamStudentDimensionMap");
|
|
Map<String, FinalScoreResult> finalScoreResultMap = (Map<String, FinalScoreResult>) paramsMap.get("finalScoreResultMap");
|
|
Map<String, FinalScoreResult> finalScoreResultMap = (Map<String, FinalScoreResult>) paramsMap.get("finalScoreResultMap");
|
|
-// Map<String, PaperStructResult> paperStructResultMap = (Map<String, PaperStructResult>) paramsMap.get("paperStructResultMap");
|
|
|
|
Map<Long, CourseTargetWordDto> targetWordMap = (Map<Long, CourseTargetWordDto>) paramsMap.get("targetWordMap");
|
|
Map<Long, CourseTargetWordDto> targetWordMap = (Map<Long, CourseTargetWordDto>) paramsMap.get("targetWordMap");
|
|
- Map<Long, CourseTargetWebDto> targetWebMap = (Map<Long, CourseTargetWebDto>) paramsMap.get("targetWebMap");
|
|
|
|
Map<Long, Map<Long, DimensionDto>> finalScoreExamStudentDimensionSumMap = (Map<Long, Map<Long, DimensionDto>>) paramsMap.get("finalScoreExamStudentDimensionSumMap");
|
|
Map<Long, Map<Long, DimensionDto>> finalScoreExamStudentDimensionSumMap = (Map<Long, Map<Long, DimensionDto>>) paramsMap.get("finalScoreExamStudentDimensionSumMap");
|
|
if (!CollectionUtils.isEmpty(examStudentList)) {
|
|
if (!CollectionUtils.isEmpty(examStudentList)) {
|
|
BigDecimal bigDecimal = new BigDecimal(100);
|
|
BigDecimal bigDecimal = new BigDecimal(100);
|
|
List<TRExamStudent> trExamStudentList = new ArrayList<>(examStudentList.size());
|
|
List<TRExamStudent> trExamStudentList = new ArrayList<>(examStudentList.size());
|
|
|
|
+ Map<Long, ReportExamStudentTargetDto> reportExamStudentTargetDtoMap = new LinkedHashMap<>();
|
|
for (ReportExamStudentDto reportExamStudentDto : examStudentList) {
|
|
for (ReportExamStudentDto reportExamStudentDto : examStudentList) {
|
|
Map<Long, Map<Long, DimensionDto>> map = finalScoreExamStudentDimensionMap.get(reportExamStudentDto.getStudentCode());
|
|
Map<Long, Map<Long, DimensionDto>> map = finalScoreExamStudentDimensionMap.get(reportExamStudentDto.getStudentCode());
|
|
FinalScoreResult finalScoreResult = finalScoreResultMap.get(reportExamStudentDto.getStudentCode());
|
|
FinalScoreResult finalScoreResult = finalScoreResultMap.get(reportExamStudentDto.getStudentCode());
|
|
- ReportExamStudentUsualScoreDto reportExamStudentUsualScoreDto = finalScoreResult.getUsualScoreDto();
|
|
|
|
|
|
+ ReportExamStudentUsualScoreDto reportExamStudentUsualScoreSumDto = finalScoreResult.getUsualScoreDto();
|
|
map.forEach((k, v) -> {
|
|
map.forEach((k, v) -> {
|
|
List<DimensionDto> dimensionDtoList = new ArrayList<>(v.values());
|
|
List<DimensionDto> dimensionDtoList = new ArrayList<>(v.values());
|
|
List<ReportExamStudentTargetDto> targetList = CollectionUtils.isEmpty(reportExamStudentDto.getTargetList()) ? new ArrayList<>() : reportExamStudentDto.getTargetList();
|
|
List<ReportExamStudentTargetDto> targetList = CollectionUtils.isEmpty(reportExamStudentDto.getTargetList()) ? new ArrayList<>() : reportExamStudentDto.getTargetList();
|
|
- if (targetWebMap.containsKey(k)) {
|
|
|
|
- List<ReportExamStudentUsualScoreObjDto> scoreObjDtoList = reportExamStudentUsualScoreDto.getScoreMap().get(k);
|
|
|
|
|
|
+ if (targetWordMap.containsKey(k)) {
|
|
|
|
+ List<ReportExamStudentUsualScoreObjDto> scoreObjDtoList = reportExamStudentUsualScoreSumDto.getScoreMap().get(k);
|
|
CourseTargetWordDto courseTargetWordDto = targetWordMap.get(k);
|
|
CourseTargetWordDto courseTargetWordDto = targetWordMap.get(k);
|
|
ReportExamStudentFinalScoreDto reportExamStudentFinalScoreDto = new ReportExamStudentFinalScoreDto(courseTargetWordDto.getFinalScoreDto(), dimensionDtoList);
|
|
ReportExamStudentFinalScoreDto reportExamStudentFinalScoreDto = new ReportExamStudentFinalScoreDto(courseTargetWordDto.getFinalScoreDto(), dimensionDtoList);
|
|
- //各知识点转换分数
|
|
|
|
- for (DimensionDto dimensionDto : dimensionDtoList) {
|
|
|
|
- Double matrixScore = new BigDecimal(dimensionDto.getDimensionScore()).multiply(courseTargetWordDto.getFinalScoreDto().getFinalScoreSumWeight()).divide(bigDecimal, 2, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
|
- dimensionDto.setMatrixScore(matrixScore);
|
|
|
|
|
|
+ ReportExamStudentUsualScoreDto reportExamStudentUsualScoreDto = new ReportExamStudentUsualScoreDto(scoreObjDtoList);
|
|
|
|
+
|
|
|
|
+ if (!reportExamStudentTargetDtoMap.containsKey(k)) {
|
|
|
|
+ //各知识点转换分数
|
|
|
|
+ List<DimensionDto> dimensionDtoTempList = new ArrayList<>(v.values());
|
|
|
|
+ Double dimensionMatrixSumScore = 0.0d;
|
|
|
|
+ for (DimensionDto dimensionDto : dimensionDtoList) {
|
|
|
|
+ Double matrixScore = new BigDecimal(dimensionDto.getDimensionScore()).multiply(courseTargetWordDto.getFinalScoreDto().getFinalScoreSumWeight()).divide(bigDecimal, 2, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
|
+ dimensionDto.setMatrixScore(matrixScore);
|
|
|
|
+ dimensionMatrixSumScore = dimensionMatrixSumScore + matrixScore;
|
|
|
|
+ dimensionDtoTempList.add(new DimensionDto(dimensionDto));
|
|
|
|
+ }
|
|
|
|
+ reportExamStudentFinalScoreDto.setDimensionMatrixSumScore(dimensionMatrixSumScore);
|
|
|
|
+
|
|
|
|
+ List<ReportExamStudentUsualScoreObjDto> scoreObjDtoTempList = new ArrayList<>();
|
|
|
|
+ for (ReportExamStudentUsualScoreObjDto r : scoreObjDtoList) {
|
|
|
|
+ scoreObjDtoTempList.add(new ReportExamStudentUsualScoreObjDto(r));
|
|
|
|
+ }
|
|
|
|
+ ReportExamStudentFinalScoreDto reportExamStudentFinalScoreTempDto = new ReportExamStudentFinalScoreDto(courseTargetWordDto.getFinalScoreDto(), dimensionDtoTempList);
|
|
|
|
+ reportExamStudentFinalScoreTempDto.setDimensionMatrixSumScore(dimensionMatrixSumScore);
|
|
|
|
+ ReportExamStudentTargetDto reportExamStudentTargetDto = new ReportExamStudentTargetDto(courseTargetWordDto, reportExamStudentFinalScoreTempDto, new ReportExamStudentUsualScoreDto(scoreObjDtoTempList));
|
|
|
|
+ reportExamStudentTargetDtoMap.put(k, reportExamStudentTargetDto);
|
|
|
|
+ } else {
|
|
|
|
+ ReportExamStudentTargetDto reportExamStudentTargetDto = reportExamStudentTargetDtoMap.get(k);
|
|
|
|
+ ReportExamStudentFinalScoreDto reportExamStudentFinalScoreAvgDto = reportExamStudentTargetDto.getFinalScore();
|
|
|
|
+ List<DimensionDto> dimensionDtos = reportExamStudentFinalScoreAvgDto.getDimensionList();
|
|
|
|
+ //各知识点转换分数
|
|
|
|
+ Double dimensionMatrixSumScore = 0.0d;
|
|
|
|
+ for (int i = 0; i < dimensionDtoList.size(); i++) {
|
|
|
|
+ DimensionDto dimensionDto = dimensionDtoList.get(i);
|
|
|
|
+ Double matrixScore = new BigDecimal(dimensionDto.getDimensionScore()).multiply(courseTargetWordDto.getFinalScoreDto().getFinalScoreSumWeight()).divide(bigDecimal, 2, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
|
+ dimensionDtos.get(i).setMatrixScore(dimensionDtos.get(i).getMatrixScore() + matrixScore);
|
|
|
|
+ dimensionDtos.get(i).setDimensionScore(dimensionDtos.get(i).getDimensionScore() + dimensionDto.getDimensionScore());
|
|
|
|
+ dimensionMatrixSumScore = dimensionMatrixSumScore + matrixScore;
|
|
|
|
+ }
|
|
|
|
+ reportExamStudentFinalScoreAvgDto.setDimensionMatrixSumScore(reportExamStudentFinalScoreAvgDto.getDimensionMatrixSumScore() + dimensionMatrixSumScore);
|
|
|
|
+ ReportExamStudentUsualScoreDto reportExamStudentUsualScoreAvgDto = reportExamStudentTargetDto.getUsualScore();
|
|
|
|
+
|
|
|
|
+ List<ReportExamStudentUsualScoreObjDto> reportExamStudentUsualScoreObjDtoList = reportExamStudentUsualScoreDto.getScoreList();
|
|
|
|
+ for (int i = 0; i < reportExamStudentUsualScoreObjDtoList.size(); i++) {
|
|
|
|
+ ReportExamStudentUsualScoreObjDto reportExamStudentUsualScoreObjDto = reportExamStudentUsualScoreObjDtoList.get(i);
|
|
|
|
+ reportExamStudentUsualScoreAvgDto.getScoreList().get(i).setMatrixScore(reportExamStudentUsualScoreAvgDto.getScoreList().get(i).getMatrixScore() + reportExamStudentUsualScoreObjDto.getMatrixScore());
|
|
|
|
+ reportExamStudentUsualScoreAvgDto.getScoreList().get(i).setScore(reportExamStudentUsualScoreAvgDto.getScoreList().get(i).getScore() + reportExamStudentUsualScoreObjDto.getScore());
|
|
|
|
+ }
|
|
|
|
+ reportExamStudentTargetDtoMap.put(k, reportExamStudentTargetDto);
|
|
}
|
|
}
|
|
- targetList.add(new ReportExamStudentTargetDto(courseTargetWordDto, reportExamStudentFinalScoreDto, new ReportExamStudentUsualScoreDto(scoreObjDtoList)));
|
|
|
|
|
|
+ log.info("reportExamStudentTargetDtoMap:{}", JacksonUtil.parseJson(reportExamStudentTargetDtoMap));
|
|
|
|
+ targetList.add(new ReportExamStudentTargetDto(courseTargetWordDto, reportExamStudentFinalScoreDto, reportExamStudentUsualScoreDto));
|
|
|
|
+ log.info("targetList:{}", JacksonUtil.parseJson(targetList));
|
|
}
|
|
}
|
|
reportExamStudentDto.setTargetList(targetList);
|
|
reportExamStudentDto.setTargetList(targetList);
|
|
});
|
|
});
|
|
@@ -74,39 +116,40 @@ public class TRExamStudentServiceImpl extends ServiceImpl<TRExamStudentMapper, T
|
|
trExamStudentList.add(new TRExamStudent(trBasicInfo.getId(), reportExamStudentDto));
|
|
trExamStudentList.add(new TRExamStudent(trBasicInfo.getId(), reportExamStudentDto));
|
|
}
|
|
}
|
|
//加入平均分
|
|
//加入平均分
|
|
- Double avgScore = new BigDecimal(examStudentList.stream().mapToDouble(ReportExamStudentDto::getScore).average().orElse(0d)).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
|
- ReportExamStudentDto reportExamStudentDto = new ReportExamStudentDto("平均分", "平均分", examStudentList.get(0).getAdministrativeClass(), avgScore);
|
|
|
|
- List<ReportExamStudentTargetDto> reportExamStudentTargetDtoList = new ArrayList<>();
|
|
|
|
- reportExamStudentTargetDtoList.addAll(examStudentList.get(0).getTargetList());
|
|
|
|
-
|
|
|
|
- BigDecimal size = new BigDecimal(examStudentList.size());
|
|
|
|
- ReportExamStudentFinalScoreDto finalScoreAvgDto = reportExamStudentTargetDtoList.get(0).getFinalScore();
|
|
|
|
- Map<Long, DimensionDto> dimensionFinalScoreDtoMap = finalScoreExamStudentDimensionSumMap.get(reportExamStudentTargetDtoList.get(0).getTargetId());
|
|
|
|
- List<DimensionDto> dimensionFinalScoreDtoList = finalScoreAvgDto.getDimensionList();
|
|
|
|
- for (DimensionDto dimensionFinalScoreDto : dimensionFinalScoreDtoList) {
|
|
|
|
- if (dimensionFinalScoreDtoMap.containsKey(dimensionFinalScoreDto.getDimensionId())) {
|
|
|
|
- Double avg = new BigDecimal(dimensionFinalScoreDto.getDimensionScore()).divide(size, 2, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
|
- dimensionFinalScoreDto.setDimensionScore(avg);
|
|
|
|
- } else {
|
|
|
|
- dimensionFinalScoreDto.setDimensionScore(0d);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- ReportExamStudentUsualScoreDto usualScoreAvgDto = reportExamStudentTargetDtoList.get(0).getUsualScore();
|
|
|
|
- List<ReportExamStudentUsualScoreObjDto> reportExamStudentUsualScoreObjDtoList = usualScoreAvgDto.getScoreList();
|
|
|
|
- for (ReportExamStudentUsualScoreObjDto reportExamStudentUsualScoreObjDto : reportExamStudentUsualScoreObjDtoList) {
|
|
|
|
-// if (usualScoreOverviewDtoMap.containsKey(reportExamStudentUsualScoreObjDto.getName())) {
|
|
|
|
-// UsualScoreOverviewDto usualScoreOverviewDto = usualScoreOverviewDtoMap.get(reportExamStudentUsualScoreObjDto.getName());
|
|
|
|
-// Double avg = new BigDecimal(usualScoreOverviewDto.getSumScore()).divide(size, 2, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
|
-// reportExamStudentUsualScoreObjDto.setScore(avg);
|
|
|
|
|
|
+// Double avgScore = new BigDecimal(examStudentList.stream().mapToDouble(ReportExamStudentDto::getScore).average().orElse(0d)).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
|
+// ReportExamStudentDto reportExamStudentDto = new ReportExamStudentDto("平均分", "平均分", examStudentList.get(0).getAdministrativeClass(), avgScore);
|
|
|
|
+// List<ReportExamStudentTargetDto> reportExamStudentTargetDtoList = new ArrayList<>();
|
|
|
|
+// reportExamStudentTargetDtoList.addAll(examStudentList.get(0).getTargetList());
|
|
|
|
+//
|
|
|
|
+// BigDecimal size = new BigDecimal(examStudentList.size());
|
|
|
|
+// ReportExamStudentFinalScoreDto finalScoreAvgDto = reportExamStudentTargetDtoList.get(0).getFinalScore();
|
|
|
|
+// Map<Long, DimensionDto> dimensionFinalScoreDtoMap = finalScoreExamStudentDimensionSumMap.get(reportExamStudentTargetDtoList.get(0).getTargetId());
|
|
|
|
+// List<DimensionDto> dimensionFinalScoreDtoList = finalScoreAvgDto.getDimensionList();
|
|
|
|
+// for (DimensionDto dimensionFinalScoreDto : dimensionFinalScoreDtoList) {
|
|
|
|
+// if (dimensionFinalScoreDtoMap.containsKey(dimensionFinalScoreDto.getDimensionId())) {
|
|
|
|
+// Double avg = new BigDecimal(dimensionFinalScoreDto.getDimensionScore()).divide(size, 2, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
|
+// dimensionFinalScoreDto.setDimensionScore(avg);
|
|
// } else {
|
|
// } else {
|
|
-// reportExamStudentUsualScoreObjDto.setScore(0d);
|
|
|
|
|
|
+// dimensionFinalScoreDto.setDimensionScore(0d);
|
|
// }
|
|
// }
|
|
- }
|
|
|
|
- reportExamStudentDto.setTargetList(reportExamStudentTargetDtoList);
|
|
|
|
- examStudentList.get(0).setTargetList(JSONArray.parseArray(trExamStudentList.get(0).getResultDetail(), ReportExamStudentTargetDto.class));
|
|
|
|
- examStudentList.add(reportExamStudentDto);
|
|
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// ReportExamStudentUsualScoreDto usualScoreAvgDto = reportExamStudentTargetDtoList.get(0).getUsualScore();
|
|
|
|
+// List<ReportExamStudentUsualScoreObjDto> reportExamStudentUsualScoreObjDtoList = usualScoreAvgDto.getScoreList();
|
|
|
|
+// for (ReportExamStudentUsualScoreObjDto reportExamStudentUsualScoreObjDto : reportExamStudentUsualScoreObjDtoList) {
|
|
|
|
+//// if (usualScoreOverviewDtoMap.containsKey(reportExamStudentUsualScoreObjDto.getName())) {
|
|
|
|
+//// UsualScoreOverviewDto usualScoreOverviewDto = usualScoreOverviewDtoMap.get(reportExamStudentUsualScoreObjDto.getName());
|
|
|
|
+//// Double avg = new BigDecimal(usualScoreOverviewDto.getSumScore()).divide(size, 2, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
|
+//// reportExamStudentUsualScoreObjDto.setScore(avg);
|
|
|
|
+//// } else {
|
|
|
|
+//// reportExamStudentUsualScoreObjDto.setScore(0d);
|
|
|
|
+//// }
|
|
|
|
+// }
|
|
|
|
+// reportExamStudentDto.setTargetList(reportExamStudentTargetDtoList);
|
|
|
|
+// examStudentList.get(0).setTargetList(JSONArray.parseArray(trExamStudentList.get(0).getResultDetail(), ReportExamStudentTargetDto.class));
|
|
|
|
+// examStudentList.add(reportExamStudentDto);
|
|
|
|
|
|
|
|
+ ReportExamStudentDto reportExamStudentDto = new ReportExamStudentDto("平均分", "平均分", null, null);
|
|
trExamStudentList.add(new TRExamStudent(trBasicInfo.getId(), reportExamStudentDto));
|
|
trExamStudentList.add(new TRExamStudent(trBasicInfo.getId(), reportExamStudentDto));
|
|
this.remove(new QueryWrapper<TRExamStudent>().lambda().eq(TRExamStudent::getrBasicInfoId, trBasicInfo.getId()));
|
|
this.remove(new QueryWrapper<TRExamStudent>().lambda().eq(TRExamStudent::getrBasicInfoId, trBasicInfo.getId()));
|
|
this.saveBatch(trExamStudentList);
|
|
this.saveBatch(trExamStudentList);
|