Browse Source

代码调试

wangliang 1 year ago
parent
commit
12545693ad

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/report/CourseTargetWebDto.java

@@ -57,7 +57,7 @@ public class CourseTargetWebDto implements Serializable, Comparable<CourseTarget
         this.targetId = courseWeightDto.getCourseTargetId();
         this.targetName = courseWeightDto.getCourseTargetName();
         this.graduationRequirement = courseWeightDto.getDegreeRequirement();
-        this.graduationRequirementPoint = courseWeightDto.getDegreeRequirement();
+        this.graduationRequirementPoint = courseWeightDto.getDimensionStr();
         this.targetSumWeight = courseWeightDto.getTotalWeight();
         this.targetSumScore = courseWeightDto.getTotalScore();
     }

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/report/CourseTargetWordDto.java

@@ -59,7 +59,7 @@ public class CourseTargetWordDto implements Serializable, Comparable<CourseTarge
         this.targetId = courseWeightDto.getCourseTargetId();
         this.targetName = courseWeightDto.getCourseTargetName();
         this.graduationRequirement = courseWeightDto.getDegreeRequirement();
-        this.graduationRequirementPoint = courseWeightDto.getDegreeRequirement();
+        this.graduationRequirementPoint = courseWeightDto.getDimensionStr();
         this.targetSumScore = courseWeightDto.getTotalScore();
         this.targetSumWeight = courseWeightDto.getTotalWeight();
     }

+ 10 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TCFinalScoreService.java

@@ -86,4 +86,14 @@ public interface TCFinalScoreService extends IService<TCFinalScore> {
      * @throws IOException
      */
     public Map<String, String> finalScoreExcelSync(Long examId, String courseCode, String paperNumber) throws IOException;
+
+    /**
+     * 根据考试id/课程编码/试卷编码删除数据
+     *
+     * @param examId
+     * @param courseCode
+     * @param paperNumber
+     * @return
+     */
+    public Boolean remove(Long examId, String courseCode, String paperNumber);
 }

+ 10 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TRBasicInfoService.java

@@ -111,4 +111,14 @@ public interface TRBasicInfoService extends IService<TRBasicInfo> {
      * @return
      */
     public TableRenderData buildWordTable5(TRBasicInfo trBasicInfo, CourseReportBean courseReportBean);
+
+    /**
+     * 根据考试id/课程编码/试卷编码删除数据
+     *
+     * @param examId
+     * @param courseCode
+     * @param paperNumber
+     * @return
+     */
+    public Boolean remove(Long examId, String courseCode, String paperNumber);
 }

+ 18 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/TRExamStudentService.java

@@ -26,4 +26,22 @@ public interface TRExamStudentService extends IService<TRExamStudent> {
      * @return
      */
     public List<ReportExamStudentDto> getExamStudentReportDetail(TRBasicInfo trBasicInfo, Map<String, Object> paramsMap);
+
+    /**
+     * 根据报告id删除数据
+     *
+     * @param rBasicInfoId
+     * @return
+     */
+    public Boolean remove(Long rBasicInfoId);
+
+    /**
+     * 根据考试id/课程编码/试卷编码删除数据
+     *
+     * @param examId
+     * @param courseCode
+     * @param paperNumber
+     * @return
+     */
+    public Boolean remove(Long examId, String courseCode, String paperNumber);
 }

+ 30 - 8
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TCFinalScoreServiceImpl.java

@@ -15,6 +15,8 @@ import com.qmth.distributed.print.business.enums.SourceEnum;
 import com.qmth.distributed.print.business.mapper.TCFinalScoreMapper;
 import com.qmth.distributed.print.business.service.PrintCommonService;
 import com.qmth.distributed.print.business.service.TCFinalScoreService;
+import com.qmth.distributed.print.business.service.TRBasicInfoService;
+import com.qmth.distributed.print.business.service.TRExamStudentService;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
@@ -63,6 +65,12 @@ public class TCFinalScoreServiceImpl extends ServiceImpl<TCFinalScoreMapper, TCF
     @Resource
     MarkStudentService markStudentService;
 
+    @Resource
+    TRBasicInfoService trBasicInfoService;
+
+    @Resource
+    TRExamStudentService trExamStudentService;
+
     /**
      * 导入期末成绩excel
      *
@@ -140,11 +148,10 @@ public class TCFinalScoreServiceImpl extends ServiceImpl<TCFinalScoreMapper, TCF
                 }
                 if (!CollectionUtils.isEmpty(tcFinalScoreList)) {
                     successData.add("共导入" + tcFinalScoreList.size() + "条数据");
-                    tcFinalScoreService.remove(new QueryWrapper<TCFinalScore>().lambda().eq(TCFinalScore::getExamId, examId)
-                            .eq(TCFinalScore::getCourseCode, courseCode)
-                            .eq(TCFinalScore::getCourseName, markPaper.getCourseName())
-                            .eq(TCFinalScore::getPaperNumber, paperNumber));
+                    tcFinalScoreService.remove(examId, courseCode, paperNumber);
                     tcFinalScoreService.saveBatch(tcFinalScoreList);
+                    trExamStudentService.remove(examId, courseCode, paperNumber);
+                    trBasicInfoService.remove(examId, courseCode, paperNumber);
                 }
             }
             messageMap.put(SystemConstant.SUCCESS, successData.length() > 0 ? successData.toString() : "无");
@@ -260,11 +267,10 @@ public class TCFinalScoreServiceImpl extends ServiceImpl<TCFinalScoreMapper, TCF
                 }
                 if (!CollectionUtils.isEmpty(tcFinalScoreList)) {
                     successData.add("共同步" + tcFinalScoreList.size() + "条数据");
-                    tcFinalScoreService.remove(new QueryWrapper<TCFinalScore>().lambda().eq(TCFinalScore::getExamId, examId)
-                            .eq(TCFinalScore::getCourseCode, courseCode)
-                            .eq(TCFinalScore::getCourseName, markPaper.getCourseName())
-                            .eq(TCFinalScore::getPaperNumber, paperNumber));
+                    tcFinalScoreService.remove(examId, courseCode, paperNumber);
                     tcFinalScoreService.saveBatch(tcFinalScoreList);
+                    trExamStudentService.remove(examId, courseCode, paperNumber);
+                    trBasicInfoService.remove(examId, courseCode, paperNumber);
                 }
             }
             messageMap.put(SystemConstant.SUCCESS, successData.length() > 0 ? successData.toString() : "无");
@@ -283,4 +289,20 @@ public class TCFinalScoreServiceImpl extends ServiceImpl<TCFinalScoreMapper, TCF
         }
         return messageMap;
     }
+
+    /**
+     * 根据考试id/课程编码/试卷编码删除数据
+     *
+     * @param examId
+     * @param courseCode
+     * @param paperNumber
+     * @return
+     */
+    @Override
+    @Transactional
+    public Boolean remove(Long examId, String courseCode, String paperNumber) {
+        return tcFinalScoreService.remove(new QueryWrapper<TCFinalScore>().lambda().eq(TCFinalScore::getExamId, examId)
+                .eq(TCFinalScore::getCourseCode, courseCode)
+                .eq(TCFinalScore::getPaperNumber, paperNumber));
+    }
 }

+ 10 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TCUsualScoreServiceImpl.java

@@ -12,6 +12,8 @@ import com.qmth.distributed.print.business.entity.TCUsualScore;
 import com.qmth.distributed.print.business.mapper.TCUsualScoreMapper;
 import com.qmth.distributed.print.business.service.PrintCommonService;
 import com.qmth.distributed.print.business.service.TCUsualScoreService;
+import com.qmth.distributed.print.business.service.TRBasicInfoService;
+import com.qmth.distributed.print.business.service.TRExamStudentService;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
@@ -50,6 +52,12 @@ public class TCUsualScoreServiceImpl extends ServiceImpl<TCUsualScoreMapper, TCU
     @Resource
     TCUsualScoreService tcUsualScoreService;
 
+    @Resource
+    TRBasicInfoService trBasicInfoService;
+
+    @Resource
+    TRExamStudentService trExamStudentService;
+
     /**
      * 导入平时成绩excel
      *
@@ -128,6 +136,8 @@ public class TCUsualScoreServiceImpl extends ServiceImpl<TCUsualScoreMapper, TCU
                             .eq(TCUsualScore::getCourseName, markPaper.getCourseName())
                             .eq(TCUsualScore::getPaperNumber, paperNumber));
                     tcUsualScoreService.saveBatch(tcUsualScoreList);
+                    trExamStudentService.remove(examId, courseCode, paperNumber);
+                    trBasicInfoService.remove(examId, courseCode, paperNumber);
                 }
             }
             messageMap.put(SystemConstant.SUCCESS, successData.length() > 0 ? successData.toString() : "无");

+ 42 - 25
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TRBasicInfoServiceImpl.java

@@ -24,6 +24,7 @@ import com.qmth.distributed.print.business.entity.TRBasicInfo;
 import com.qmth.distributed.print.business.entity.TRExamStudent;
 import com.qmth.distributed.print.business.mapper.TRBasicInfoMapper;
 import com.qmth.distributed.print.business.service.*;
+import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.entity.BasicSemester;
 import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
@@ -140,29 +141,29 @@ public class TRBasicInfoServiceImpl extends ServiceImpl<TRBasicInfoMapper, TRBas
             //TODO 获取曹子轩课程目标信息
             List<CourseWeightDto> courseWeightDtoList = courseWeightService.findCourseWeight(trBasicInfo.getExamId(), trBasicInfo.getCourseCode(), sysUser.getId()).getSubmitForm();
             if (CollectionUtils.isEmpty(courseWeightDtoList)) {
-                throw ExceptionResultEnum.ERROR.exception("未设置课程目标平时作业1");
+                throw ExceptionResultEnum.ERROR.exception("未设置课程目标评价方式");
             }
 
-            courseWeightDtoList.clear();
-            //测试数据,默认平时作业30%权重,期末考试70%权重
-            int f = 5, s = 6;
-            for (int i = 0; i < 2; i++) {
-                int y = i == 0 ? f : s;
-                List<CourseWeightDetailDto> courseWeightDetailDtoList = new ArrayList<>();
-                for (int k = 0; k < y; k++) {
-                    if (y == 5) {
-                        courseWeightDetailDtoList.add(new CourseWeightDetailDto("作业" + (i + 1) + "-" + (k + 1), new BigDecimal(20), new BigDecimal(2.4).setScale(2, BigDecimal.ROUND_HALF_UP)));
-                    } else {
-                        courseWeightDetailDtoList.add(new CourseWeightDetailDto("作业" + (i + 1) + "-" + (k + 1), new BigDecimal(16.66).setScale(2, BigDecimal.ROUND_HALF_UP), new BigDecimal(3)));
-                    }
-                }
-                if (y == 5) {
-                    courseWeightDetailDtoList.add(new CourseWeightDetailDto("期末考试", new BigDecimal(70), new BigDecimal(28)));
-                } else {
-                    courseWeightDetailDtoList.add(new CourseWeightDetailDto("期末考试", new BigDecimal(70), new BigDecimal(42)));
-                }
-                courseWeightDtoList.add(new CourseWeightDto(Long.parseLong((i + 1) + ""), "课程目标" + (i + 1), "测试毕业要求" + (i + 1), new BigDecimal(50), new BigDecimal(50), courseWeightDetailDtoList));
-            }
+//            courseWeightDtoList.clear();
+//            //测试数据,默认平时作业30%权重,期末考试70%权重
+//            int f = 5, s = 6;
+//            for (int i = 0; i < 2; i++) {
+//                int y = i == 0 ? f : s;
+//                List<CourseWeightDetailDto> courseWeightDetailDtoList = new ArrayList<>();
+//                for (int k = 0; k < y; k++) {
+//                    if (y == 5) {
+//                        courseWeightDetailDtoList.add(new CourseWeightDetailDto("作业" + (i + 1) + "-" + (k + 1), new BigDecimal(20), new BigDecimal(2.4).setScale(2, BigDecimal.ROUND_HALF_UP)));
+//                    } else {
+//                        courseWeightDetailDtoList.add(new CourseWeightDetailDto("作业" + (i + 1) + "-" + (k + 1), new BigDecimal(16.66).setScale(2, BigDecimal.ROUND_HALF_UP), new BigDecimal(3)));
+//                    }
+//                }
+//                if (y == 5) {
+//                    courseWeightDetailDtoList.add(new CourseWeightDetailDto("期末考试", new BigDecimal(70), new BigDecimal(28)));
+//                } else {
+//                    courseWeightDetailDtoList.add(new CourseWeightDetailDto("期末考试", new BigDecimal(70), new BigDecimal(42)));
+//                }
+//                courseWeightDtoList.add(new CourseWeightDto(Long.parseLong((i + 1) + ""), "课程目标" + (i + 1), "测试毕业要求" + (i + 1), new BigDecimal(50), new BigDecimal(50), courseWeightDetailDtoList));
+//            }
 
             for (CourseWeightDto courseWeightDto : courseWeightDtoList) {
                 List<CourseWeightDetailDto> courseWeightDetailDtoList = courseWeightDto.getEvaluationList();
@@ -180,13 +181,13 @@ public class TRBasicInfoServiceImpl extends ServiceImpl<TRBasicInfoMapper, TRBas
                     BigDecimal usualScoreTargetSumScore = new BigDecimal(0);//平常作业目标总分
                     for (CourseWeightDetailDto courseWeightDetailDto : courseWeightDetailDtoList) {
                         //期末考试
-                        if (courseWeightDetailDto.getEnable() && courseWeightDetailDto.getEvaluationName().startsWith("期末考试")) {
+                        if (courseWeightDetailDto.getEnable() && Objects.equals(courseWeightDetailDto.getEvaluationName(), SystemConstant.FINAL_SCORE_STR)) {
                             FinalScoreWordDto finalScoreWordDto = new FinalScoreWordDto(courseWeightDto.getCourseTargetId(), courseWeightDetailDto);
                             courseTargetWordDto.setFinalScoreDto(finalScoreWordDto);
                             ReportEvaluationDto reportEvaluationDto = new ReportEvaluationDto(courseWeightDto.getCourseTargetId(), courseWeightDetailDto);
                             reportEvaluationDtoList.add(reportEvaluationDto);
                         }//非期末考试
-                        else if (courseWeightDetailDto.getEnable() && !courseWeightDetailDto.getEvaluationName().startsWith("期末考试")) {
+                        else if (courseWeightDetailDto.getEnable() && !Objects.equals(courseWeightDetailDto.getEvaluationName(), SystemConstant.FINAL_SCORE_STR)) {
                             ReportEvaluationDto reportEvaluationDto = new ReportEvaluationDto(courseWeightDto.getCourseTargetId(), courseWeightDetailDto);
                             usualScoreTargetSumScore = usualScoreTargetSumScore.add(reportEvaluationDto.getTargetScore());
                             usualScoreDetailList.add(reportEvaluationDto);
@@ -442,7 +443,7 @@ public class TRBasicInfoServiceImpl extends ServiceImpl<TRBasicInfoMapper, TRBas
             tableBuilder1.addRow(row);
         }
         header2_1List.add("目标分值统计");
-        header2_2List.add("期末考试");
+        header2_2List.add(SystemConstant.FINAL_SCORE_STR);
         header2_2List.add("目标分值统计");
         return tableBuilder1.left().create();
     }
@@ -673,7 +674,7 @@ public class TRBasicInfoServiceImpl extends ServiceImpl<TRBasicInfoMapper, TRBas
                     //期末考试
                     ReportExamStudentFinalScoreDto reportExamStudentFinalScoreDto = reportExamStudentTargetDto.getFinalScore();
                     if (Objects.nonNull(reportExamStudentFinalScoreDto) && !CollectionUtils.isEmpty(reportExamStudentFinalScoreDto.getDimensionList())) {
-                        examStudent_cells_2.add(Cells.of("期末考试").center().create());
+                        examStudent_cells_2.add(Cells.of(SystemConstant.FINAL_SCORE_STR).center().create());
                     }
                 }
                 examStudent_cells_1.add(Cells.of("综合成绩").center().create());
@@ -819,6 +820,22 @@ public class TRBasicInfoServiceImpl extends ServiceImpl<TRBasicInfoMapper, TRBas
         return tableRenderDataExamStudent;
     }
 
+    /**
+     * 根据考试id/课程编码/试卷编码删除数据
+     *
+     * @param examId
+     * @param courseCode
+     * @param paperNumber
+     * @return
+     */
+    @Override
+    @Transactional
+    public Boolean remove(Long examId, String courseCode, String paperNumber) {
+        return trBasicInfoService.remove(new QueryWrapper<TRBasicInfo>().lambda().eq(TRBasicInfo::getExamId, examId)
+                .eq(TRBasicInfo::getCourseCode, courseCode)
+                .eq(TRBasicInfo::getPaperNumber, paperNumber));
+    }
+
     /**
      * 获取行样式
      *

+ 36 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/TRExamStudentServiceImpl.java

@@ -7,6 +7,7 @@ import com.qmth.distributed.print.business.bean.result.FinalScoreResult;
 import com.qmth.distributed.print.business.entity.TRBasicInfo;
 import com.qmth.distributed.print.business.entity.TRExamStudent;
 import com.qmth.distributed.print.business.mapper.TRExamStudentMapper;
+import com.qmth.distributed.print.business.service.TRBasicInfoService;
 import com.qmth.distributed.print.business.service.TRExamStudentService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -14,6 +15,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
+import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -30,6 +32,12 @@ import java.util.stream.Collectors;
 public class TRExamStudentServiceImpl extends ServiceImpl<TRExamStudentMapper, TRExamStudent> implements TRExamStudentService {
     private final static Logger log = LoggerFactory.getLogger(TRExamStudentServiceImpl.class);
 
+    @Resource
+    TRExamStudentService trExamStudentService;
+
+    @Resource
+    TRBasicInfoService trBasicInfoService;
+
     /**
      * 获取考生详细报告
      *
@@ -129,6 +137,34 @@ public class TRExamStudentServiceImpl extends ServiceImpl<TRExamStudentMapper, T
         return examStudentList;
     }
 
+    /**
+     * 根据报告id删除数据
+     *
+     * @param rBasicInfoId
+     * @return
+     */
+    @Override
+    @Transactional
+    public Boolean remove(Long rBasicInfoId) {
+        return trExamStudentService.remove(new QueryWrapper<TRExamStudent>().lambda().eq(TRExamStudent::getrBasicInfoId, rBasicInfoId));
+    }
+
+    /**
+     * 根据考试id/课程编码/试卷编码删除数据
+     *
+     * @param examId
+     * @param courseCode
+     * @param paperNumber
+     * @return
+     */
+    @Override
+    @Transactional
+    public Boolean remove(Long examId, String courseCode, String paperNumber) {
+        TRBasicInfo trBasicInfo = trBasicInfoService.getOne(new QueryWrapper<TRBasicInfo>().lambda().eq(TRBasicInfo::getExamId, examId)
+                .eq(TRBasicInfo::getCourseCode, courseCode).eq(TRBasicInfo::getPaperNumber, paperNumber));
+        return Objects.nonNull(trBasicInfo) ? trExamStudentService.remove(trBasicInfo.getId()) : false;
+    }
+
     /**
      * 处理目标分&平均分&各课程目标平均分参数
      *

+ 2 - 9
distributed-print/src/main/java/com/qmth/distributed/print/api/TCFinalScoreController.java

@@ -38,10 +38,7 @@ import javax.validation.Valid;
 import javax.validation.constraints.Max;
 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;
+import java.util.*;
 
 /**
  * <p>
@@ -88,9 +85,7 @@ public class TCFinalScoreController {
         }
 
         List<ExcelField> excelFieldList = new ArrayList<>();
-        excelFieldList.add(new ExcelField("studentCode", "学号", true));
-        excelFieldList.add(new ExcelField("name", "姓名", true));
-        excelFieldList.add(new ExcelField("score", "成绩", true));
+        excelFieldList.addAll(new ArrayList<>(Arrays.asList(new ExcelField("studentCode", "学号", true), new ExcelField("name", "姓名", true), new ExcelField("score", "成绩", true))));
 
         for (int i = 0; i < markQuestionList.size(); i++) {
             MarkQuestion markQuestion = markQuestionList.get(i);
@@ -260,8 +255,6 @@ public class TCFinalScoreController {
             if (CollectionUtils.isEmpty(markQuestionList)) {
                 throw ExceptionResultEnum.ERROR.exception("未找到试卷结构");
             }
-
-            //TODO 待曹子轩补充接口
             paperStructResultList = new ArrayList<>(markQuestionList.size());
             for (MarkQuestion markQuestion : markQuestionList) {
                 paperStructResultList.add(new PaperStructResult(markQuestion.getMainNumber(), markQuestion.getSubNumber(), markQuestion.getTotalScore()));

+ 14 - 13
distributed-print/src/main/java/com/qmth/distributed/print/api/TCUsualScoreController.java

@@ -2,8 +2,8 @@ package com.qmth.distributed.print.api;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.qmth.boot.api.constant.ApiConstant;
+import com.qmth.distributed.print.business.bean.dto.CourseWeightDetailDto;
 import com.qmth.distributed.print.business.bean.dto.CourseWeightDto;
-import com.qmth.distributed.print.business.bean.dto.CourseWeightFormDto;
 import com.qmth.distributed.print.business.bean.excel.ExcelField;
 import com.qmth.distributed.print.business.bean.result.EditResult;
 import com.qmth.distributed.print.business.bean.result.ScoreResult;
@@ -33,8 +33,10 @@ import javax.validation.constraints.Max;
 import javax.validation.constraints.Min;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 import java.util.Objects;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -77,22 +79,21 @@ public class TCUsualScoreController {
     public void usualScoreTemplateDownload(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
                                            @ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
                                            @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber) throws IOException {
-        //TODO 待曹子轩补充接口
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
-        List<CourseWeightDto> courseWeightDtoList = courseWeightService.findCourseWeight(examId, courseCode, sysUser.getId()).getSubmitForm();
+        List<CourseWeightDto> courseWeightDtoList = courseWeightService.findCourseWeightReport(examId, courseCode, sysUser.getId()).getSubmitForm();
         if (CollectionUtils.isEmpty(courseWeightDtoList)) {
-            throw ExceptionResultEnum.ERROR.exception("未设置课程目标平时作业1");
-        }
-        List<CourseWeightFormDto> courseWeightFormDtoList = courseWeightService.findCourseWeightForm(examId, courseCode, sysUser.getId());
-        if (CollectionUtils.isEmpty(courseWeightFormDtoList)) {
-            throw ExceptionResultEnum.ERROR.exception("未设置课程目标平时作业2");
+            throw ExceptionResultEnum.ERROR.exception("未设置课程目标评价方式");
         }
         List<ExcelField> excelFieldList = new ArrayList<>();
-        excelFieldList.add(new ExcelField("studentCode", "学号", true));
-        excelFieldList.add(new ExcelField("name", "姓名", true));
-        excelFieldList.add(new ExcelField("score1", "作业1", true));
-        excelFieldList.add(new ExcelField("score2", "作业2", true));
-        excelFieldList.add(new ExcelField("score3", "作业3", false));
+        excelFieldList.addAll(new ArrayList<>(Arrays.asList(new ExcelField("studentCode", "学号", true), new ExcelField("name", "姓名", true))));
+        courseWeightDtoList.stream().peek(e -> {
+            List<CourseWeightDetailDto> courseWeightDetailDtoList = e.getEvaluationList();
+            courseWeightDetailDtoList.stream().peek(s -> {
+                if (Objects.nonNull(s.getEnable()) && s.getEnable() && !Objects.equals(s.getEvaluationName(), SystemConstant.FINAL_SCORE_STR)) {
+                    excelFieldList.add(new ExcelField(s.getEvaluationName(), s.getEvaluationName(), true));
+                }
+            }).collect(Collectors.toList());
+        }).collect(Collectors.toList());
         printCommonService.scoreDownLoadExaminationTemplate("1、所有字段均为必填字段;\n" +
                 "2、平时成绩各项数据均需要填写;\n" +
                 "3、请不要删除此行,也不要删除模板中的任何列。\n" +

+ 1 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/contant/SystemConstant.java

@@ -306,6 +306,7 @@ public class SystemConstant {
     public static final String REGULAR_EXPRESSION_OF_CODE_PRIMARY_DIMENSION = "[A-Z]";
     public static final String REGULAR_EXPRESSION_OF_CODE_SECOND_DIMENSION = "[A-Z][1-9][0-9]*";
     public static final String SYS_USER = "sysUser";
+    public static final String FINAL_SCORE_STR = "期末考试";
 
     public static final String ERROR_DATA_LIST = "errorDataList";
     public static final String DATASOURCE = "datasource";