|
@@ -12,8 +12,10 @@ 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.TCPaperStruct;
|
|
import com.qmth.distributed.print.business.entity.TRBasicInfo;
|
|
import com.qmth.distributed.print.business.entity.TRBasicInfo;
|
|
import com.qmth.distributed.print.business.mapper.TRBasicInfoMapper;
|
|
import com.qmth.distributed.print.business.mapper.TRBasicInfoMapper;
|
|
-import com.qmth.distributed.print.business.service.*;
|
|
|
|
-import com.qmth.teachcloud.common.entity.BasicExam;
|
|
|
|
|
|
+import com.qmth.distributed.print.business.service.TCFinalScoreService;
|
|
|
|
+import com.qmth.distributed.print.business.service.TCPaperStructService;
|
|
|
|
+import com.qmth.distributed.print.business.service.TRBasicInfoService;
|
|
|
|
+import com.qmth.distributed.print.business.service.TRExamStudentService;
|
|
import com.qmth.teachcloud.common.entity.BasicSemester;
|
|
import com.qmth.teachcloud.common.entity.BasicSemester;
|
|
import com.qmth.teachcloud.common.service.BasicSemesterService;
|
|
import com.qmth.teachcloud.common.service.BasicSemesterService;
|
|
import com.qmth.teachcloud.common.util.GsonUtil;
|
|
import com.qmth.teachcloud.common.util.GsonUtil;
|
|
@@ -24,6 +26,7 @@ import com.qmth.teachcloud.mark.utils.Calculator;
|
|
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 org.springframework.util.LinkedMultiValueMap;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
@@ -46,9 +49,6 @@ public class TRBasicInfoServiceImpl extends ServiceImpl<TRBasicInfoMapper, TRBas
|
|
@Resource
|
|
@Resource
|
|
TCFinalScoreService tcFinalScoreService;
|
|
TCFinalScoreService tcFinalScoreService;
|
|
|
|
|
|
- @Resource
|
|
|
|
- BasicExamService basicExamService;
|
|
|
|
-
|
|
|
|
@Resource
|
|
@Resource
|
|
BasicSemesterService basicSemesterService;
|
|
BasicSemesterService basicSemesterService;
|
|
|
|
|
|
@@ -110,6 +110,7 @@ public class TRBasicInfoServiceImpl extends ServiceImpl<TRBasicInfoMapper, TRBas
|
|
Map<String, PaperStructResult> paperStructResultMap = null;//试卷蓝图map
|
|
Map<String, PaperStructResult> paperStructResultMap = null;//试卷蓝图map
|
|
Map<Long, CourseTargetWeightDto> targetMap = null;
|
|
Map<Long, CourseTargetWeightDto> targetMap = null;
|
|
|
|
|
|
|
|
+ LinkedMultiValueMap<Long, DimensionDto> targetDimensionMap = new LinkedMultiValueMap<>();//课程目标知识点
|
|
if (!CollectionUtils.isEmpty(finalScoreResultList)) {
|
|
if (!CollectionUtils.isEmpty(finalScoreResultList)) {
|
|
//期末成绩明细map
|
|
//期末成绩明细map
|
|
paperStructResultMap = paperStructResultList.stream().collect(Collectors.toMap(k -> k.getMainNumber() + "-" + k.getSubNumber(), Function.identity(), (dto1, dto2) -> dto1));
|
|
paperStructResultMap = paperStructResultList.stream().collect(Collectors.toMap(k -> k.getMainNumber() + "-" + k.getSubNumber(), Function.identity(), (dto1, dto2) -> dto1));
|
|
@@ -128,7 +129,7 @@ public class TRBasicInfoServiceImpl extends ServiceImpl<TRBasicInfoMapper, TRBas
|
|
List<CourseTargetDto> courseTargetDtoList = paperStructResult.getTargetList();
|
|
List<CourseTargetDto> courseTargetDtoList = paperStructResult.getTargetList();
|
|
|
|
|
|
for (CourseTargetDto courseTargetDto : courseTargetDtoList) {
|
|
for (CourseTargetDto courseTargetDto : courseTargetDtoList) {
|
|
- targetMap.put(courseTargetDto.getTargetId(), new CourseTargetWeightDto(courseTargetDto.getTargetId(), courseTargetDto.getTargetName()));
|
|
|
|
|
|
+ targetMap.put(courseTargetDto.getTargetId(), new CourseTargetWeightDto(courseTargetDto));
|
|
|
|
|
|
//课程目标
|
|
//课程目标
|
|
if (!finalScoreTargetMap.containsKey(courseTargetDto.getTargetId())) {
|
|
if (!finalScoreTargetMap.containsKey(courseTargetDto.getTargetId())) {
|
|
@@ -141,6 +142,7 @@ public class TRBasicInfoServiceImpl extends ServiceImpl<TRBasicInfoMapper, TRBas
|
|
//知识点
|
|
//知识点
|
|
List<DimensionDto> dimensionDtoList = courseTargetDto.getDimensionList();
|
|
List<DimensionDto> dimensionDtoList = courseTargetDto.getDimensionList();
|
|
for (DimensionDto dimensionDto : dimensionDtoList) {
|
|
for (DimensionDto dimensionDto : dimensionDtoList) {
|
|
|
|
+ targetDimensionMap.add(courseTargetDto.getTargetId(), dimensionDto);
|
|
//考生知识点
|
|
//考生知识点
|
|
if (!finalScoreExamStudentDimensionMap.containsKey(finalScoreResult.getStudentCode())) {
|
|
if (!finalScoreExamStudentDimensionMap.containsKey(finalScoreResult.getStudentCode())) {
|
|
Map<Long, Map<Long, DimensionDto>> map = new LinkedHashMap<>();
|
|
Map<Long, Map<Long, DimensionDto>> map = new LinkedHashMap<>();
|
|
@@ -278,7 +280,8 @@ public class TRBasicInfoServiceImpl extends ServiceImpl<TRBasicInfoMapper, TRBas
|
|
List<CourseTargetDto> targetList = new ArrayList<>(targetMap.size());
|
|
List<CourseTargetDto> targetList = new ArrayList<>(targetMap.size());
|
|
AtomicReference<Double> targetValue = new AtomicReference<>(0.0d);
|
|
AtomicReference<Double> targetValue = new AtomicReference<>(0.0d);
|
|
targetMap.forEach((k, v) -> {
|
|
targetMap.forEach((k, v) -> {
|
|
- Double evaluationValue = 0.0d;
|
|
|
|
|
|
+ Double evaluationAvg = 0.0d, evaluationScore = 0.0d;
|
|
|
|
+ BigDecimal evaluationWeight = new BigDecimal(0);
|
|
List<ReportEvaluationDto> reportEvaluationDtoList = new ArrayList<>();
|
|
List<ReportEvaluationDto> reportEvaluationDtoList = new ArrayList<>();
|
|
if (!CollectionUtils.isEmpty(usualScoreOverviewDtoMap)) {
|
|
if (!CollectionUtils.isEmpty(usualScoreOverviewDtoMap)) {
|
|
UsualScoreOverviewDto usualScoreOverviewDto = usualScoreOverviewDtoMap.get("作业" + k);
|
|
UsualScoreOverviewDto usualScoreOverviewDto = usualScoreOverviewDtoMap.get("作业" + k);
|
|
@@ -287,8 +290,9 @@ public class TRBasicInfoServiceImpl extends ServiceImpl<TRBasicInfoMapper, TRBas
|
|
|
|
|
|
//课程目标-平时作业达成度计算
|
|
//课程目标-平时作业达成度计算
|
|
if (Objects.nonNull(reportEvaluationDto.getWeight()) && reportEvaluationDto.getWeight().doubleValue() > 0d) {
|
|
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();
|
|
|
|
|
|
+ evaluationAvg = evaluationAvg.doubleValue() + reportEvaluationDto.getAvg();
|
|
|
|
+ evaluationScore = evaluationScore.doubleValue() + reportEvaluationDto.getScore();
|
|
|
|
+ evaluationWeight = evaluationWeight.add(reportEvaluationDto.getWeight());
|
|
Map<String, BigDecimal> usualScoreWeight = v.getUsualScoreWeight();
|
|
Map<String, BigDecimal> usualScoreWeight = v.getUsualScoreWeight();
|
|
usualScoreWeight = CollectionUtils.isEmpty(usualScoreWeight) ? new LinkedHashMap<>() : usualScoreWeight;
|
|
usualScoreWeight = CollectionUtils.isEmpty(usualScoreWeight) ? new LinkedHashMap<>() : usualScoreWeight;
|
|
usualScoreWeight.put(reportEvaluationDto.getName(), reportEvaluationDto.getWeight().add(new BigDecimal(new Random().nextInt(10))));
|
|
usualScoreWeight.put(reportEvaluationDto.getName(), reportEvaluationDto.getWeight().add(new BigDecimal(new Random().nextInt(10))));
|
|
@@ -302,15 +306,17 @@ public class TRBasicInfoServiceImpl extends ServiceImpl<TRBasicInfoMapper, TRBas
|
|
|
|
|
|
//课程目标-期末成绩达成度计算
|
|
//课程目标-期末成绩达成度计算
|
|
if (Objects.nonNull(reportEvaluationDto1.getWeight()) && reportEvaluationDto1.getWeight().doubleValue() > 0d) {
|
|
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();
|
|
|
|
|
|
+ evaluationAvg = evaluationAvg.doubleValue() + reportEvaluationDto1.getAvg();
|
|
|
|
+ evaluationScore = evaluationScore.doubleValue() + reportEvaluationDto1.getScore();
|
|
|
|
+ evaluationWeight = evaluationWeight.add(reportEvaluationDto1.getWeight());
|
|
v.setFinalScoreWeight(reportEvaluationDto1.getWeight().subtract(new BigDecimal(new Random().nextInt(10))));
|
|
v.setFinalScoreWeight(reportEvaluationDto1.getWeight().subtract(new BigDecimal(new Random().nextInt(10))));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ Double evaluationValue = new BigDecimal(evaluationAvg).add(new BigDecimal(evaluationScore)).divide(evaluationWeight, 2, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
|
|
|
CourseTargetDto courseTargetDto = new CourseTargetDto(k, v.getTargetName(), k, "评价方式" + k, "评价方式描述" + k, reportEvaluationDtoList, evaluationValue);
|
|
CourseTargetDto courseTargetDto = new CourseTargetDto(k, v.getTargetName(), k, "评价方式" + k, "评价方式描述" + k, reportEvaluationDtoList, evaluationValue);
|
|
targetList.add(courseTargetDto);
|
|
targetList.add(courseTargetDto);
|
|
- targetValue.set(targetValue.get().doubleValue() + courseTargetDto.getEvaluationValue().doubleValue());
|
|
|
|
|
|
+ targetValue.set(new BigDecimal(targetValue.get()).add(new BigDecimal(courseTargetDto.getEvaluationValue())).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
|
|
});
|
|
});
|
|
Collections.sort(targetList);
|
|
Collections.sort(targetList);
|
|
reportCourseEvaluationResultDto = new ReportCourseEvaluationResultDto("测试课程总目标1", targetValue.get(), targetList);
|
|
reportCourseEvaluationResultDto = new ReportCourseEvaluationResultDto("测试课程总目标1", targetValue.get(), targetList);
|
|
@@ -329,10 +335,7 @@ public class TRBasicInfoServiceImpl extends ServiceImpl<TRBasicInfoMapper, TRBas
|
|
@Override
|
|
@Override
|
|
@Transactional
|
|
@Transactional
|
|
public TRBasicInfo getReportView(TRBasicInfo trBasicInfo, MarkPaper markPaper, Long userId) {
|
|
public TRBasicInfo getReportView(TRBasicInfo trBasicInfo, MarkPaper markPaper, Long userId) {
|
|
- BasicExam basicExam = basicExamService.getById(markPaper.getExamId());
|
|
|
|
- Objects.requireNonNull(basicExam, "未找到考试信息");
|
|
|
|
-
|
|
|
|
- BasicSemester basicSemester = basicSemesterService.getById(basicExam.getSemesterId());
|
|
|
|
|
|
+ BasicSemester basicSemester = basicSemesterService.selectByExamId(markPaper.getExamId());
|
|
Objects.requireNonNull(basicSemester, "未找到学期信息");
|
|
Objects.requireNonNull(basicSemester, "未找到学期信息");
|
|
|
|
|
|
//TODO 有测试数据,待肖飞补充授课对象和任课老师数据
|
|
//TODO 有测试数据,待肖飞补充授课对象和任课老师数据
|