wangliang преди 4 години
родител
ревизия
c53523ce6b

+ 1 - 1
themis-backend/src/main/java/com/qmth/themis/backend/api/SysController.java

@@ -164,7 +164,7 @@ public class SysController {
                 jsonObject = JSONObject.parseObject(tbTaskHistory.getImportFilePath());
                 break;
             case 1:
-                jsonObject = JSONObject.parseObject(tbTaskHistory.getErrorFilePath());
+                jsonObject = JSONObject.parseObject(tbTaskHistory.getReportFilePath());
                 break;
             default:
                 jsonObject = JSONObject.parseObject(tbTaskHistory.getResultFilePath());

+ 8 - 8
themis-business/src/main/java/com/qmth/themis/business/entity/TBTaskHistory.java

@@ -55,13 +55,13 @@ public class TBTaskHistory implements Serializable {
     @TableField("import_file_path")
     private String importFilePath;
 
-    @ApiModelProperty(value = "结果文件路径")
+    @ApiModelProperty(value = "导出文件路径")
     @TableField("result_file_path")
     private String resultFilePath;
 
-    @ApiModelProperty(value = "错误记录路径")
-    @TableField("error_file_path")
-    private String errorFilePath;
+    @ApiModelProperty(value = "报告路径")
+    @TableField("report_file_path")
+    private String reportFilePath;
 
     @ApiModelProperty(value = "创建人id")
     @TableField("create_id")
@@ -182,12 +182,12 @@ public class TBTaskHistory implements Serializable {
         this.resultFilePath = resultFilePath;
     }
 
-    public String getErrorFilePath() {
-        return errorFilePath;
+    public String getReportFilePath() {
+        return reportFilePath;
     }
 
-    public void setErrorFilePath(String errorFilePath) {
-        this.errorFilePath = errorFilePath;
+    public void setReportFilePath(String reportFilePath) {
+        this.reportFilePath = reportFilePath;
     }
 
     public Long getCreateId() {

+ 3 - 3
themis-business/src/main/java/com/qmth/themis/business/enums/DownloadFileEnum.java

@@ -14,12 +14,12 @@ public enum DownloadFileEnum {
     IMPORTFILE(0),
 
     /**
-     * 错误文件
+     * 报告文件
      */
-    ERROR(1),
+    REPORT(1),
 
     /**
-     * result
+     * 导出文件
      */
     RESULT(2);
 

+ 8 - 5
themis-business/src/main/java/com/qmth/themis/business/templete/TaskExportCommon.java

@@ -121,9 +121,10 @@ public class TaskExportCommon {
      *
      * @param path
      * @param txtStr
+     * @param excelFile
      * @throws IOException
      */
-    public void writeExportResultTxt(String path, String txtStr) throws IOException {
+    public void writeExportResultTxt(String path, String txtStr, File excelFile) throws IOException {
         FileWriter fileWriter = null;
         try {
             File file = new File(path + File.separator + String.valueOf(UUID.randomUUID()).replaceAll("-", "") + SystemConstant.TXT_PREFIX);
@@ -136,10 +137,12 @@ public class TaskExportCommon {
             JSONObject json = new JSONObject();
             json.put("path", file.getPath().replaceAll(SystemConstant.FILES_DIR + File.separator, ""));
             json.put("type", this.type);
-            if (this.exception) {
-                this.tbTaskHistory.setErrorFilePath(json.toJSONString());
-            } else {
-                this.tbTaskHistory.setResultFilePath(json.toJSONString());
+            this.tbTaskHistory.setReportFilePath(json.toJSONString());
+            if (Objects.nonNull(excelFile)) {
+                JSONObject excelJson = new JSONObject();
+                excelJson.put("path", excelFile.getPath().replaceAll(SystemConstant.FILES_DIR + File.separator, ""));
+                excelJson.put("type", this.type);
+                this.tbTaskHistory.setResultFilePath(excelJson.toJSONString());
             }
             if (Objects.equals(this.type, SystemConstant.OSS)) {
                 this.ossUtil.ossUpload(this.ossEnv, file.getPath(), txtStr);

+ 1 - 5
themis-business/src/main/java/com/qmth/themis/business/templete/TaskImportCommon.java

@@ -121,11 +121,7 @@ public class TaskImportCommon {
             JSONObject json = new JSONObject();
             json.put("path", file.getPath().replaceAll(SystemConstant.FILES_DIR + File.separator, ""));
             json.put("type", this.type);
-            if (this.exception) {
-                this.tbTaskHistory.setErrorFilePath(json.toJSONString());
-            } else {
-                this.tbTaskHistory.setResultFilePath(json.toJSONString());
-            }
+            this.tbTaskHistory.setReportFilePath(json.toJSONString());
             if (Objects.equals(this.type, SystemConstant.OSS)) {
                 this.ossUtil.ossUpload(this.ossEnv, file.getPath(), txtStr);
                 file.delete();

+ 3 - 3
themis-business/src/main/java/com/qmth/themis/business/templete/impl/TaskRoomCodeExportTemplete.java

@@ -58,7 +58,7 @@ public class TaskRoomCodeExportTemplete implements TaskExportTemplete {
         taskExportCommon.setTxtList(new ArrayList());
         FileOutputStream fos = null;
         SXSSFWorkbook wb = null;
-        File mkdir = null;
+        File mkdir = null, file = null;
         int y = 0, min = 0;
         try {
             taskExportCommon.getTxtList().add(DateUtil.format(new Date(), timeFormat) + "->开始准备处理导出的考场数据");
@@ -122,7 +122,7 @@ public class TaskRoomCodeExportTemplete implements TaskExportTemplete {
                     max = size;
                 }
             }
-            File file = taskExportCommon.createExcel(mkdir.getPath());
+            file = taskExportCommon.createExcel(mkdir.getPath());
             //写入excel并上传附件
             fos = new FileOutputStream(file);
             wb.write(fos);
@@ -141,7 +141,7 @@ public class TaskRoomCodeExportTemplete implements TaskExportTemplete {
                 fos.close();
             }
             //这里写入txt文件
-            taskExportCommon.writeExportResultTxt(mkdir.getPath(), taskExportCommon.getTxtList().toString());
+            taskExportCommon.writeExportResultTxt(mkdir.getPath(), taskExportCommon.getTxtList().toString(), file);
         }
         return ResultUtil.ok(JacksonUtil.parseJson(SystemConstant.SUCCESS));
     }

+ 2 - 2
themis-business/src/main/resources/db/init.sql

@@ -627,8 +627,8 @@ CREATE TABLE `t_b_task_history` (
   `progress` double DEFAULT NULL COMMENT '执行进度',
   `import_file_name` varchar(100) DEFAULT NULL COMMENT '导入文件名',
   `import_file_path` varchar(500) DEFAULT NULL COMMENT '导入文件路径',
-  `result_file_path` varchar(500) DEFAULT NULL COMMENT '结果文件路径',
-  `error_file_path` varchar(500) DEFAULT NULL COMMENT '错误记录路径',
+  `result_file_path` varchar(500) DEFAULT NULL COMMENT '导出文件路径',
+  `report_file_path` varchar(500) DEFAULT NULL COMMENT '报告路径',
   `create_id` bigint DEFAULT NULL COMMENT '创建人id',
   `create_time` datetime DEFAULT NULL COMMENT '创建时间',
   `start_time` datetime DEFAULT NULL COMMENT '开始时间',

+ 1 - 1
themis-mq/src/main/java/com/qmth/themis/mq/service/impl/MqLogicServiceImpl.java

@@ -165,7 +165,7 @@ public class MqLogicServiceImpl implements MqLogicService {
         Map<String, Object> map = (Map<String, Object>) mqDto.getBody();
         String tag = mqDto.getTag();
         myThreadPool.arbitratePoolTaskExecutor.execute(() -> {
-            if (tag.contains("Import")) {
+            if (tag.contains("Import".toUpperCase())) {
                 TaskImportTemplete taskImportTemplete = null;
                 if (tag.contains(MqTagEnum.EXAM_STUDENT_IMPORT.name())) {
                     taskImportTemplete = SpringContextHolder.getBean(TaskExamStudentImportTemplete.class);