Bläddra i källkod

修复成绩查询标准模式导出加入试卷ID和名称

wangliang 2 år sedan
förälder
incheckning
0fd739025a

+ 12 - 0
themis-business/src/main/java/com/qmth/themis/business/dto/MarkResultSimpleExportDto.java

@@ -78,6 +78,18 @@ public class MarkResultSimpleExportDto implements Serializable {
     @ExcelNotExport
     private Long examId;
 
+    @ApiModelProperty(value = "试卷名称")
+    @ExcelNotExport
+    private String paperName;
+
+    public String getPaperName() {
+        return paperName;
+    }
+
+    public void setPaperName(String paperName) {
+        this.paperName = paperName;
+    }
+
     public Long getExamId() {
         return examId;
     }

+ 13 - 1
themis-business/src/main/java/com/qmth/themis/business/dto/MarkResultStandardExportDto.java

@@ -16,7 +16,7 @@ import java.util.Map;
  * @Author: wangliang
  * @Date: 2020/7/20
  */
-public class MarkResultStandardExportDto implements Serializable{
+public class MarkResultStandardExportDto implements Serializable {
 
     @ExcelNote(value = "批次名称")
     private String examName;
@@ -83,6 +83,18 @@ public class MarkResultStandardExportDto implements Serializable{
     @ExcelNotExport
     private Long examId;
 
+    @ApiModelProperty(value = "试卷名称")
+    @ExcelNotExport
+    private String paperName;
+
+    public String getPaperName() {
+        return paperName;
+    }
+
+    public void setPaperName(String paperName) {
+        this.paperName = paperName;
+    }
+
     public Long getExamId() {
         return examId;
     }

+ 1 - 1
themis-business/src/main/java/com/qmth/themis/business/templete/impl/TaskExamPaperImportTemplete.java

@@ -209,7 +209,7 @@ public class TaskExamPaperImportTemplete implements TaskImportTemplete {
         teExamPaperService.disposePaperCacheOnPaperImport(teExam.getId(), paperIds);
 
         //清除考试科目缓存
-        teExamCourseService.updateExamCourseCacheBean(teExam.getId(), courseCode);
+        teExamCourseService.deleteExamCourseCacheBean(teExam.getId(), courseCode);
     }
 
     private Map<Long, Double> paperWeight(List<TEExamPaper> list) {

+ 11 - 6
themis-business/src/main/java/com/qmth/themis/business/templete/impl/TaskMarkResultStandardExportTemplete.java

@@ -9,6 +9,7 @@ import com.qmth.themis.business.annotation.ExcelDynamicExport;
 import com.qmth.themis.business.annotation.ExcelNotExport;
 import com.qmth.themis.business.annotation.ExcelNote;
 import com.qmth.themis.business.cache.bean.ExamCacheBean;
+import com.qmth.themis.business.cache.bean.ExamPaperCacheBean;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.dto.ExcelDto;
 import com.qmth.themis.business.dto.MarkResultSimpleExportDto;
@@ -128,10 +129,14 @@ public class TaskMarkResultStandardExportTemplete implements TaskExportTemplete
                         TOeExamRecord tOeExamRecord = tOeExamRecordService
                                 .findMarkResult(markResultDto, examCacheBean.getRecordSelectStrategy());
                         if (Objects.nonNull(tOeExamRecord)) {
+                            ExamPaperCacheBean examPaperCacheBean = teExamPaperService.getExamPaperCacheBean(tOeExamRecord.getPaperId());
                             examRecordIdsSet.add(String.valueOf(tOeExamRecord.getId()));
                             markResultSimpleExportDto.setObjectiveScore(Objects.isNull(tOeExamRecord.getObjectiveScore()) ? "0" : String.valueOf(tOeExamRecord.getObjectiveScore()));
                             markResultSimpleExportDto.setRecordId(tOeExamRecord.getId());
                             markResultSimpleExportDto.setPaperId(tOeExamRecord.getPaperId());
+                            if (Objects.nonNull(examPaperCacheBean)) {
+                                markResultSimpleExportDto.setPaperName(examPaperCacheBean.getName());
+                            }
                             markResultSimpleExportDto.setSubjectiveScore(Objects.isNull(markResultSimpleExportDto.getSubjectiveScore()) ? "0" : String.valueOf(markResultSimpleExportDto.getSubjectiveScore()));
                             markResultSimpleExportDto.setSumScore(String.valueOf(Double.parseDouble(markResultSimpleExportDto.getObjectiveScore()) + Double.parseDouble(markResultSimpleExportDto.getSubjectiveScore())));
                         }
@@ -363,7 +368,7 @@ public class TaskMarkResultStandardExportTemplete implements TaskExportTemplete
                     byte[] bookByteAry = out.toByteArray();
                     inputStream = new ByteArrayInputStream(bookByteAry);
                     StringBuilder stringBuilder = new StringBuilder(excelSj.toString());
-                    File finalFile = new File(stringBuilder.append(File.separator).append(markResultStandardExportDtoTempList.get(0).getCourseName() + "_" + markResultStandardExportDtoTempList.get(0).getCourseCode()).append(SystemConstant.EXCEL_PREFIX).toString());
+                    File finalFile = new File(stringBuilder.append(File.separator).append(markResultStandardExportDtoTempList.get(0).getPaperId() + "_" + markResultStandardExportDtoTempList.get(0).getPaperName() + "_" + markResultStandardExportDtoTempList.get(0).getCourseName() + "_" + markResultStandardExportDtoTempList.get(0).getCourseCode()).append(SystemConstant.EXCEL_PREFIX).toString());
                     if (!finalFile.exists()) {
                         finalFile.getParentFile().mkdirs();
                         finalFile.createNewFile();
@@ -409,11 +414,11 @@ public class TaskMarkResultStandardExportTemplete implements TaskExportTemplete
             taskExportCommon.getTxtList().removeAll(taskExportCommon.getTxtList().subList(1, taskExportCommon.getTxtList().size()));
             taskExportCommon.getTxtList().add(DateUtil.format(new Date(), Constants.DEFAULT_DATE_PATTERN) + "->数据导出完毕," + taskExportCommon.getTbTaskHistory().getSummary());
             taskExportCommon.writeExportResultTxt(stringJoiner.toString(), taskExportCommon.getTxtList().toString(), zipPath);
-            if (Objects.nonNull(files)) {
-                for (File file : files) {
-                    file.delete();
-                }
-            }
+//            if (Objects.nonNull(files)) {
+//                for (File file : files) {
+//                    file.delete();
+//                }
+//            }
         }
         return ResultUtil.ok(true);
     }