|
@@ -1,15 +1,17 @@
|
|
|
package com.qmth.distributed.print.api;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.google.gson.reflect.TypeToken;
|
|
|
import com.qmth.boot.api.constant.ApiConstant;
|
|
|
+import com.qmth.distributed.print.business.bean.dto.report.*;
|
|
|
import com.qmth.distributed.print.business.bean.result.ScoreResult;
|
|
|
+import com.qmth.distributed.print.business.bean.result.report.PaperStructResult;
|
|
|
import com.qmth.distributed.print.business.bean.result.report.ReportResult;
|
|
|
+import com.qmth.distributed.print.business.entity.TCPaperStruct;
|
|
|
import com.qmth.distributed.print.business.entity.TRBasicInfo;
|
|
|
-import com.qmth.distributed.print.business.service.BasicExamService;
|
|
|
-import com.qmth.distributed.print.business.service.ExamStudentService;
|
|
|
-import com.qmth.distributed.print.business.service.PrintCommonService;
|
|
|
-import com.qmth.distributed.print.business.service.TRBasicInfoService;
|
|
|
+import com.qmth.distributed.print.business.service.*;
|
|
|
import com.qmth.teachcloud.common.annotation.OperationLogDetail;
|
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
|
import com.qmth.teachcloud.common.entity.BasicExam;
|
|
@@ -17,12 +19,22 @@ import com.qmth.teachcloud.common.entity.BasicSemester;
|
|
|
import com.qmth.teachcloud.common.entity.SysUser;
|
|
|
import com.qmth.teachcloud.common.enums.log.CustomizedOperationTypeEnum;
|
|
|
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.common.util.ResultUtil;
|
|
|
import com.qmth.teachcloud.common.util.ServletUtil;
|
|
|
+import com.qmth.teachcloud.mark.bean.archivescore.OverViewVo;
|
|
|
+import com.qmth.teachcloud.mark.bean.archivescore.ScoreRangeVo;
|
|
|
+import com.qmth.teachcloud.mark.bean.archivescore.ScoreReportVo;
|
|
|
import com.qmth.teachcloud.mark.entity.MarkPaper;
|
|
|
+import com.qmth.teachcloud.mark.entity.MarkStudent;
|
|
|
+import com.qmth.teachcloud.mark.mapper.MarkStudentMapper;
|
|
|
import com.qmth.teachcloud.mark.service.MarkPaperService;
|
|
|
+import com.qmth.teachcloud.mark.service.MarkStudentService;
|
|
|
+import com.qmth.teachcloud.mark.utils.Calculator;
|
|
|
import io.swagger.annotations.*;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.validation.BindingResult;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
@@ -31,7 +43,9 @@ import javax.validation.Valid;
|
|
|
import javax.validation.constraints.Max;
|
|
|
import javax.validation.constraints.Min;
|
|
|
import java.io.IOException;
|
|
|
-import java.util.Objects;
|
|
|
+import java.util.*;
|
|
|
+import java.util.concurrent.atomic.AtomicInteger;
|
|
|
+import java.util.concurrent.atomic.AtomicReference;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -64,6 +78,15 @@ public class TRBasicInfoController {
|
|
|
@Resource
|
|
|
BasicExamService basicExamService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ TCPaperStructService tcPaperStructService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ MarkStudentMapper markStudentMapper;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ MarkStudentService markStudentService;
|
|
|
+
|
|
|
@ApiOperation(value = "报告管理列表")
|
|
|
@RequestMapping(value = "/report/list", method = RequestMethod.POST)
|
|
|
@OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.SEARCH)
|
|
@@ -97,9 +120,75 @@ public class TRBasicInfoController {
|
|
|
|
|
|
//TODO 有测试数据,待肖飞补充授课对象和任课老师数据
|
|
|
trBasicInfo = new TRBasicInfo(examId, courseCode, markPaper.getCourseName(), paperNumber, basicSemester.getName(), "测试班级1", "测试老师1", 40, sysUser.getId());
|
|
|
- trBasicInfoService.save(trBasicInfo);
|
|
|
}
|
|
|
- return ResultUtil.ok(trBasicInfo);
|
|
|
+ //测试数据
|
|
|
+
|
|
|
+ //公共信息
|
|
|
+ ReportCommonDto reportCommonDto = new ReportCommonDto(examId, courseCode, markPaper.getCourseName(), paperNumber);
|
|
|
+ //课程基本情况
|
|
|
+ ReportCourseBasicInfoDto reportCourseBasicInfoDto = new ReportCourseBasicInfoDto(trBasicInfo);
|
|
|
+
|
|
|
+ //课程目标考核分布-题目信息
|
|
|
+ TCPaperStruct tcPaperStruct = tcPaperStructService.getOne(new QueryWrapper<TCPaperStruct>().lambda().eq(TCPaperStruct::getExamId, examId).eq(TCPaperStruct::getCourseCode, courseCode).eq(TCPaperStruct::getPaperNumber, paperNumber));
|
|
|
+ Objects.requireNonNull(tcPaperStruct, "未找到试卷蓝图信息");
|
|
|
+ List<PaperStructResult> paperStructResultList = GsonUtil.fromJson(tcPaperStruct.getPaperStruct(), new TypeToken<List<PaperStructResult>>() {
|
|
|
+ }.getType());
|
|
|
+
|
|
|
+ ReportCourseEvaluationSpreadDto reportCourseEvaluationSpreadDto = new ReportCourseEvaluationSpreadDto(paperStructResultList);
|
|
|
+
|
|
|
+ //课程目标考核分布-分数图
|
|
|
+ OverViewVo overViewVo = markStudentMapper.overview(examId, paperNumber);
|
|
|
+ Objects.requireNonNull(overViewVo, "未找到分数信息");
|
|
|
+
|
|
|
+ ScoreReportVo ret = new ScoreReportVo();
|
|
|
+ fillScoreRange(ret, examId, paperNumber, markPaper);
|
|
|
+ List<ScoreRangeVo> scoreRangeVoList = ret.getScoreRange();
|
|
|
+ if (!CollectionUtils.isEmpty(scoreRangeVoList)) {
|
|
|
+ Integer failCount = scoreRangeVoList.get(0).getStudentCount();//第一行数据默认为不及格
|
|
|
+ Double failRate = scoreRangeVoList.get(0).getRate();
|
|
|
+
|
|
|
+ scoreRangeVoList.remove(0);
|
|
|
+ List<ReportScoreRangeViewDto> scoreRangeViewDtoList = GsonUtil.fromJson(JacksonUtil.parseJson(scoreRangeVoList), new TypeToken<List<ReportScoreRangeViewDto>>() {
|
|
|
+ }.getType());
|
|
|
+ ReportScoreViewDto reportScoreViewDto = new ReportScoreViewDto(failCount, failRate, scoreRangeViewDtoList);
|
|
|
+ reportCourseEvaluationSpreadDto.setScoreList(reportScoreViewDto);
|
|
|
+ }
|
|
|
+ trBasicInfo.setCourseEvaluationSpread(JacksonUtil.parseJson(reportCourseEvaluationSpreadDto));
|
|
|
+
|
|
|
+ //TODO 课程考核成绩评价结果-待曹子轩补充目标/评价方式数据,有测试数据
|
|
|
+ ReportCourseEvaluationResultDto reportCourseEvaluationResultDto = null;
|
|
|
+ if (!CollectionUtils.isEmpty(paperStructResultList)) {
|
|
|
+ Map<Long, String> targetMap = new LinkedHashMap<>();
|
|
|
+ for (PaperStructResult paperStructResult : paperStructResultList) {
|
|
|
+ List<CourseTargetDto> courseTargetDtoList = paperStructResult.getTargetList();
|
|
|
+ for (CourseTargetDto courseTargetDto : courseTargetDtoList) {
|
|
|
+ targetMap.put(courseTargetDto.getTargetId(), courseTargetDto.getTargetName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<CourseTargetDto> targetList = new ArrayList<>(targetMap.size());
|
|
|
+ AtomicInteger sequenceId = new AtomicInteger(1);//流程连接id
|
|
|
+ AtomicReference<Double> targetValue = new AtomicReference<>(0.0d);
|
|
|
+ targetMap.forEach((k, v) -> {
|
|
|
+ List<ReportEvaluationDto> reportEvaluationDtoList = new ArrayList<>();
|
|
|
+ reportEvaluationDtoList.add(new ReportEvaluationDto("平时作业" + sequenceId.get(), "30%", 40d, 25d));
|
|
|
+ reportEvaluationDtoList.add(new ReportEvaluationDto("期末考试", "70%", 60d, 40d));
|
|
|
+ CourseTargetDto courseTargetDto = new CourseTargetDto(k, v, Long.parseLong(String.valueOf(sequenceId.get())), "评价方式" + sequenceId.get(), "评价方式描述" + sequenceId.get(), reportEvaluationDtoList, 0.5d + sequenceId.get());
|
|
|
+ targetList.add(courseTargetDto);
|
|
|
+ targetValue.set(targetValue.get().doubleValue() + courseTargetDto.getEvaluationValue().doubleValue());
|
|
|
+ sequenceId.incrementAndGet();
|
|
|
+ });
|
|
|
+ reportCourseEvaluationResultDto = new ReportCourseEvaluationResultDto("测试课程总目标1", targetValue.get(), targetList);
|
|
|
+ trBasicInfo.setCourseEvaluationResult(JacksonUtil.parseJson(reportCourseEvaluationResultDto));
|
|
|
+ }
|
|
|
+
|
|
|
+ //课程目标达成评价明细结果-考生集合
|
|
|
+
|
|
|
+
|
|
|
+ //课程目标达成评价明细结果-课程目标达成评价值图
|
|
|
+ trBasicInfoService.saveOrUpdate(trBasicInfo);
|
|
|
+
|
|
|
+ trBasicInfo.setReportResult(new ReportResult(reportCommonDto, reportCourseBasicInfoDto, reportCourseEvaluationSpreadDto, reportCourseEvaluationResultDto, null));
|
|
|
+ return ResultUtil.ok(trBasicInfo.getReportResult());
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "保存报告")
|
|
@@ -130,4 +219,94 @@ public class TRBasicInfoController {
|
|
|
TRBasicInfo trBasicInfo = trBasicInfoService.getOne(new QueryWrapper<TRBasicInfo>().lambda().eq(TRBasicInfo::getExamId, examId).eq(TRBasicInfo::getCourseCode, courseCode).eq(TRBasicInfo::getPaperNumber, paperNumber));
|
|
|
Objects.requireNonNull(trBasicInfo, "没有报告信息");
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 计算分数范围
|
|
|
+ *
|
|
|
+ * @param ret
|
|
|
+ * @param examId
|
|
|
+ * @param paperNumber
|
|
|
+ * @param markPaper
|
|
|
+ */
|
|
|
+ private void fillScoreRange(ScoreReportVo ret, Long examId, String paperNumber, MarkPaper markPaper) {
|
|
|
+ int toltal = getCountByPaperNumber(examId, paperNumber);
|
|
|
+ //分数区间
|
|
|
+ Double passScore = markPaper.getPassScore();//及格分
|
|
|
+ Objects.requireNonNull(passScore, "及格分为空");
|
|
|
+
|
|
|
+ Double totalScore = markPaper.getTotalScore();
|
|
|
+ Objects.requireNonNull(totalScore, "试卷满分为空");
|
|
|
+
|
|
|
+ List<ScoreRangeVo> scoreRange = new ArrayList<>();
|
|
|
+ ret.setScoreRange(scoreRange);
|
|
|
+
|
|
|
+ //开始、结束分数区间
|
|
|
+ Double startInterval = 0.5d, endInterval = 9.5d, increaseStartScore = passScore - startInterval,
|
|
|
+ increaseEndScore = increaseStartScore + startInterval + endInterval;
|
|
|
+ scoreRange.add(getScoreRangeVo(toltal, examId, paperNumber, 1.0d, increaseStartScore));
|
|
|
+ increaseStartScore = increaseStartScore + startInterval;
|
|
|
+ increaseEndScore = increaseStartScore + endInterval;
|
|
|
+ if (totalScore.doubleValue() - increaseEndScore.doubleValue() == startInterval || increaseEndScore.doubleValue() >= totalScore.doubleValue()) {
|
|
|
+ increaseEndScore = totalScore;
|
|
|
+ scoreRange.add(getScoreRangeVo(toltal, examId, paperNumber, increaseStartScore, increaseEndScore));
|
|
|
+ } else {
|
|
|
+ while (increaseEndScore.doubleValue() < totalScore.doubleValue()) {
|
|
|
+ scoreRange.add(getScoreRangeVo(toltal, examId, paperNumber, increaseStartScore, increaseEndScore));
|
|
|
+ increaseStartScore = increaseEndScore + startInterval;
|
|
|
+ increaseEndScore = increaseStartScore + endInterval;
|
|
|
+ if (totalScore.doubleValue() - increaseEndScore.doubleValue() == startInterval || increaseEndScore.doubleValue() >= totalScore.doubleValue()) {
|
|
|
+ increaseEndScore = totalScore;
|
|
|
+ scoreRange.add(getScoreRangeVo(toltal, examId, paperNumber, increaseStartScore, increaseEndScore));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取考生人数
|
|
|
+ *
|
|
|
+ * @param examId
|
|
|
+ * @param paperNumber
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private int getCountByPaperNumber(Long examId, String paperNumber) {
|
|
|
+ QueryWrapper<MarkStudent> wrapper = new QueryWrapper<>();
|
|
|
+ LambdaQueryWrapper<MarkStudent> lw = wrapper.lambda();
|
|
|
+ lw.eq(MarkStudent::getExamId, examId);
|
|
|
+ lw.eq(MarkStudent::getPaperNumber, paperNumber);
|
|
|
+ return markStudentService.count(wrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 计算分数比率
|
|
|
+ *
|
|
|
+ * @param toltal
|
|
|
+ * @param examId
|
|
|
+ * @param paperNumber
|
|
|
+ * @param start
|
|
|
+ * @param end
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private ScoreRangeVo getScoreRangeVo(int toltal, Long examId, String paperNumber, Double start, Double end) {
|
|
|
+ int count = getCount(examId, paperNumber, start, end);
|
|
|
+ Double rate = null;
|
|
|
+ if (toltal != 0) {
|
|
|
+ rate = Calculator.multiply(count, toltal, 2);
|
|
|
+ }
|
|
|
+ ScoreRangeVo vo = new ScoreRangeVo(count, start, end, rate);
|
|
|
+ return vo;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 计算分数范围人数
|
|
|
+ *
|
|
|
+ * @param examId
|
|
|
+ * @param paperNumber
|
|
|
+ * @param start
|
|
|
+ * @param end
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private int getCount(Long examId, String paperNumber, Double start, Double end) {
|
|
|
+ return markStudentMapper.getCountByScoreRange(examId, paperNumber, start, end);
|
|
|
+ }
|
|
|
}
|