wangliang 1 рік тому
батько
коміт
d92dc54d13

+ 14 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/entity/TRBasicInfo.java

@@ -128,6 +128,7 @@ public class TRBasicInfo implements Serializable {
         this.enable = true;
         this.createId = userId;
         this.createTime = System.currentTimeMillis();
+        this.reportResult = new ReportResult();
     }
 
     public TRBasicInfo(TRBasicInfo trBasicInfo, Long userId) {
@@ -171,6 +172,19 @@ public class TRBasicInfo implements Serializable {
         this.courseEvaluationResultDetail = trBasicInfo.getCourseEvaluationResultDetail();
     }
 
+    public void setBasicInfo(Long examId, String courseCode, String courseName, String paperNumber, String openTime, String teachingObject, String teacher, Integer participantCount) {
+        this.examId = examId;
+        this.courseCode = courseCode;
+        this.courseName = courseName;
+        this.paperNumber = paperNumber;
+        this.openTime = openTime;
+        this.teachingObject = teachingObject;
+        this.teacher = teacher;
+        this.participantCount = participantCount;
+        this.enable = true;
+        this.reportResult = new ReportResult();
+    }
+
     public ReportResult getReportResult() {
         return reportResult;
     }

+ 11 - 2
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TRBasicInfoService.java

@@ -1,8 +1,7 @@
 package com.qmth.distributed.print.business.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.qmth.distributed.print.business.bean.dto.report.ReportCourseEvaluationResultDto;
-import com.qmth.distributed.print.business.bean.dto.report.ReportScoreViewDto;
+import com.qmth.distributed.print.business.bean.dto.report.*;
 import com.qmth.distributed.print.business.bean.result.report.PaperStructResult;
 import com.qmth.distributed.print.business.entity.TRBasicInfo;
 import com.qmth.teachcloud.mark.entity.MarkPaper;
@@ -53,4 +52,14 @@ public interface TRBasicInfoService extends IService<TRBasicInfo> {
      * @return
      */
     public ReportCourseEvaluationResultDto reportCalculateCourseEvaluationResult(Map<String, Object> paramsMap);
+
+    /**
+     * 获取报告
+     *
+     * @param trBasicInfo
+     * @param markPaper
+     * @param userId
+     * @return
+     */
+    public TRBasicInfo getReportView(TRBasicInfo trBasicInfo, MarkPaper markPaper, Long userId);
 }

+ 110 - 26
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TRBasicInfoServiceImpl.java

@@ -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;
+    }
+
     /**
      * 计算分数范围
      *

+ 20 - 64
distributed-print/src/main/java/com/qmth/distributed/print/api/TRBasicInfoController.java

@@ -3,25 +3,19 @@ package com.qmth.distributed.print.api;
 import com.alibaba.fastjson.JSONObject;
 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.entity.TRExamStudent;
-import com.qmth.distributed.print.business.service.*;
+import com.qmth.distributed.print.business.service.PrintCommonService;
+import com.qmth.distributed.print.business.service.TRBasicInfoService;
+import com.qmth.distributed.print.business.service.TRExamStudentService;
 import com.qmth.teachcloud.common.annotation.OperationLogDetail;
 import com.qmth.teachcloud.common.contant.SystemConstant;
-import com.qmth.teachcloud.common.entity.BasicExam;
-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.entity.MarkPaper;
@@ -39,7 +33,6 @@ import javax.validation.constraints.Min;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Map;
 import java.util.Objects;
 
 /**
@@ -64,15 +57,6 @@ public class TRBasicInfoController {
     @Resource
     TRBasicInfoService trBasicInfoService;
 
-    @Resource
-    BasicSemesterService basicSemesterService;
-
-    @Resource
-    BasicExamService basicExamService;
-
-    @Resource
-    TCPaperStructService tcPaperStructService;
-
     @Resource
     TRExamStudentService trExamStudentService;
 
@@ -101,50 +85,20 @@ public class TRBasicInfoController {
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         TRBasicInfo trBasicInfo = trBasicInfoService.getOne(new QueryWrapper<TRBasicInfo>().lambda().eq(TRBasicInfo::getExamId, examId).eq(TRBasicInfo::getCourseCode, courseCode).eq(TRBasicInfo::getPaperNumber, paperNumber));
 
-        ReportCourseBasicInfoDto reportCourseBasicInfoDto = null;//课程基本情况
-        ReportCourseEvaluationSpreadDto reportCourseEvaluationSpreadDto = null;//课程目标考核分布
-        ReportCourseEvaluationResultDto reportCourseEvaluationResultDto = null;//课程考核成绩评价结果
-        ReportCourseEvaluationResultDetailDto reportCourseEvaluationResultDetailDto = null;//课程目标达成评价明细结果
         if (Objects.isNull(trBasicInfo)) {
-            BasicExam basicExam = basicExamService.getById(examId);
-            Objects.requireNonNull(basicExam, "未找到考试信息");
-
-            BasicSemester basicSemester = basicSemesterService.getById(basicExam.getSemesterId());
-            Objects.requireNonNull(basicSemester, "未找到学期信息");
-
-            //TODO 有测试数据,待肖飞补充授课对象和任课老师数据
-            trBasicInfo = new TRBasicInfo(examId, courseCode, markPaper.getCourseName(), paperNumber, basicSemester.getName(), "测试班级1", "测试老师1", 40, sysUser.getId());
-
-            //测试数据
-            //课程基本情况
-            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 = new ReportCourseEvaluationSpreadDto(paperStructResultList);
-
-            //课程目标考核分布-分数图
-            reportCourseEvaluationSpreadDto.setScoreList(trBasicInfoService.getScoreList(trBasicInfo, markPaper));
-            trBasicInfo.setCourseEvaluationSpread(JacksonUtil.parseJson(reportCourseEvaluationSpreadDto));
-
-            Map<String, Object> paramsMap = trBasicInfoService.getReportCalculateParams(trBasicInfo, paperStructResultList);
-            paramsMap = trBasicInfoService.reportCalculateMaxMinAvgSumScore(paramsMap);
-            reportCourseEvaluationResultDto = trBasicInfoService.reportCalculateCourseEvaluationResult(paramsMap);
-
-            trBasicInfo.setCourseEvaluationResult(JacksonUtil.parseJson(reportCourseEvaluationResultDto));
-            //课程目标达成评价明细结果-考生集合
-            List<ReportExamStudentDto> examStudentNewList = trExamStudentService.getExamStudentReportDetail(trBasicInfo, paramsMap);
-            reportCourseEvaluationResultDetailDto = new ReportCourseEvaluationResultDetailDto(examStudentNewList);
+            trBasicInfo = trBasicInfoService.getReportView(trBasicInfo, markPaper, sysUser.getId());
         } else {
-            reportCourseBasicInfoDto = new ReportCourseBasicInfoDto(trBasicInfo);
-            reportCourseEvaluationSpreadDto = JSONObject.parseObject(trBasicInfo.getCourseEvaluationSpread(), ReportCourseEvaluationSpreadDto.class);
-            reportCourseEvaluationResultDto = JSONObject.parseObject(trBasicInfo.getCourseEvaluationResult(), ReportCourseEvaluationResultDto.class);
+            ReportCourseBasicInfoDto reportCourseBasicInfoDto = new ReportCourseBasicInfoDto(trBasicInfo);
+            ReportCourseEvaluationSpreadDto reportCourseEvaluationSpreadDto = null;
+            if (Objects.nonNull(trBasicInfo.getCourseEvaluationSpread())) {
+                reportCourseEvaluationSpreadDto = JSONObject.parseObject(trBasicInfo.getCourseEvaluationSpread(), ReportCourseEvaluationSpreadDto.class);
+            }
+            ReportCourseEvaluationResultDto reportCourseEvaluationResultDto = null;
+            if (Objects.nonNull(trBasicInfo.getCourseEvaluationResult())) {
+                reportCourseEvaluationResultDto = JSONObject.parseObject(trBasicInfo.getCourseEvaluationResult(), ReportCourseEvaluationResultDto.class);
+            }
 
+            ReportCourseEvaluationResultDetailDto reportCourseEvaluationResultDetailDto = null;
             List<TRExamStudent> trExamStudentList = trExamStudentService.list(new QueryWrapper<TRExamStudent>().lambda().eq(TRExamStudent::getrBasicInfoId, trBasicInfo.getId()));
             if (!CollectionUtils.isEmpty(trExamStudentList)) {
                 List<ReportExamStudentDto> examStudentList = new ArrayList<>(trExamStudentList.size());
@@ -153,14 +107,12 @@ public class TRBasicInfoController {
                 }
                 reportCourseEvaluationResultDetailDto = new ReportCourseEvaluationResultDetailDto(examStudentList);
             }
+            trBasicInfo.setReportResult(new ReportResult(new ReportCommonDto(examId, courseCode, markPaper.getCourseName(), paperNumber), reportCourseBasicInfoDto, reportCourseEvaluationSpreadDto, reportCourseEvaluationResultDto, reportCourseEvaluationResultDetailDto));
         }
 
         trBasicInfo.updateInfo(sysUser.getId());
         //课程目标达成评价明细结果-课程目标达成评价值图
         trBasicInfoService.saveOrUpdate(trBasicInfo);
-
-        ReportCommonDto reportCommonDto = new ReportCommonDto(examId, courseCode, markPaper.getCourseName(), paperNumber);//公共信息
-        trBasicInfo.setReportResult(new ReportResult(reportCommonDto, reportCourseBasicInfoDto, reportCourseEvaluationSpreadDto, reportCourseEvaluationResultDto, reportCourseEvaluationResultDetailDto));
         return ResultUtil.ok(trBasicInfo.getReportResult());
     }
 
@@ -175,7 +127,11 @@ public class TRBasicInfoController {
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         TRBasicInfo trBasicInfoDb = trBasicInfoService.getOne(new QueryWrapper<TRBasicInfo>().lambda().eq(TRBasicInfo::getExamId, trBasicInfo.getExamId()).eq(TRBasicInfo::getCourseCode, trBasicInfo.getCourseCode()).eq(TRBasicInfo::getPaperNumber, trBasicInfo.getPaperNumber()));
         if (Objects.isNull(trBasicInfoDb)) {
-            trBasicInfoDb = new TRBasicInfo(trBasicInfoDb, sysUser.getId());
+            trBasicInfoDb = new TRBasicInfo(trBasicInfo, sysUser.getId());
+            MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(trBasicInfo.getExamId(), trBasicInfo.getPaperNumber());
+            Objects.requireNonNull(markPaper, "未找到科目信息");
+
+            trBasicInfo = trBasicInfoService.getReportView(trBasicInfoDb, markPaper, sysUser.getId());
         } else {
             trBasicInfoDb.updateInfo(trBasicInfo, sysUser.getId());
         }