Просмотр исходного кода

fix:模式四试卷结构导入改成异步任务

caozixuan 11 месяцев назад
Родитель
Сommit
70ce7d3eb8

+ 11 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/ObjectiveStructDto.java

@@ -2,6 +2,7 @@ package com.qmth.distributed.print.business.bean.dto;
 
 import com.qmth.boot.tools.excel.annotation.ExcelColumn;
 import com.qmth.teachcloud.common.annotation.ExcelError;
+import com.qmth.teachcloud.common.annotation.ExcelProperty;
 import io.swagger.annotations.ApiModelProperty;
 
 /**
@@ -13,42 +14,52 @@ public class ObjectiveStructDto {
 
     @ApiModelProperty(value = "课程代码")
     @ExcelColumn(name = "课程代码", index = 1, nullable = true)
+    @ExcelProperty(name = "课程代码", width = 20, index = 1)
     private String courseCode;
 
     @ApiModelProperty(value = "课程名称")
     @ExcelColumn(name = "课程名称", index = 2, nullable = true)
+    @ExcelProperty(name = "课程名称", width = 20, index = 2)
     private String courseName;
 
     @ApiModelProperty(value = "试卷编号")
     @ExcelColumn(name = "试卷编号", index = 3, nullable = true)
+    @ExcelProperty(name = "试卷编号", width = 20, index = 3)
     private String paperNumber;
 
     @ApiModelProperty(value = "大题名称")
     @ExcelColumn(name = "大题名称", index = 4, nullable = true)
+    @ExcelProperty(name = "大题名称", width = 20, index = 4)
     private String mainTitle;
 
     @ApiModelProperty(value = "大题号(只能用小写数字)")
     @ExcelColumn(name = "大题号(只能用小写数字)", index = 5, nullable = true)
+    @ExcelProperty(name = "大题号(只能用小写数字)", width = 20, index = 5)
     private Integer mainNumber;
 
     @ApiModelProperty(value = "小题号(只能用小写数字)")
     @ExcelColumn(name = "小题号(只能用小写数字)", index = 6, nullable = true)
+    @ExcelProperty(name = "小题号(只能用小写数字)", width = 20, index = 6)
     private Integer subNumber;
 
     @ApiModelProperty(value = "标准答案")
     @ExcelColumn(name = "标准答案", index = 7, nullable = true)
+    @ExcelProperty(name = "标准答案", width = 20, index = 7)
     private String answer;
 
     @ApiModelProperty(value = "选项个数")
     @ExcelColumn(name = "选项个数", index = 8, nullable = true)
+    @ExcelProperty(name = "选项个数", width = 20, index = 8)
     private Integer optionCount;
 
     @ApiModelProperty(value = "小题满分")
     @ExcelColumn(name = "小题满分", index = 9, nullable = true)
+    @ExcelProperty(name = "小题满分", width = 20, index = 9)
     private Double totalScore;
 
     @ApiModelProperty(value = "题型(1-单选,2-多选,3-判断)")
     @ExcelColumn(name = "题型(1-单选,2-多选,3-判断)", index = 10, nullable = true)
+    @ExcelProperty(name = "题型(1-单选,2-多选,3-判断)", width = 20, index = 10)
     private Integer questionType;
 
     @ApiModelProperty(value = "错误信息")

+ 12 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/SubjectiveStructDto.java

@@ -2,6 +2,7 @@ package com.qmth.distributed.print.business.bean.dto;
 
 import com.qmth.boot.tools.excel.annotation.ExcelColumn;
 import com.qmth.teachcloud.common.annotation.ExcelError;
+import com.qmth.teachcloud.common.annotation.ExcelProperty;
 import io.swagger.annotations.ApiModelProperty;
 
 /**
@@ -13,46 +14,57 @@ public class SubjectiveStructDto {
 
     @ApiModelProperty(value = "课程代码")
     @ExcelColumn(name = "课程代码", index = 1, nullable = true)
+    @ExcelProperty(name = "课程代码", width = 20, index = 1)
     private String courseCode;
 
     @ApiModelProperty(value = "课程名称")
     @ExcelColumn(name = "课程名称", index = 2, nullable = true)
+    @ExcelProperty(name = "课程名称", width = 20, index = 2)
     private String courseName;
 
     @ApiModelProperty(value = "试卷编号")
     @ExcelColumn(name = "试卷编号", index = 3, nullable = true)
+    @ExcelProperty(name = "试卷编号", width = 20, index = 3)
     private String paperNumber;
 
     @ApiModelProperty(value = "大题名称")
     @ExcelColumn(name = "大题名称", index = 4, nullable = true)
+    @ExcelProperty(name = "大题名称", width = 20, index = 4)
     private String mainTitle;
 
     @ApiModelProperty(value = "大题号(只能用小写数字)")
     @ExcelColumn(name = "大题号(只能用小写数字)", index = 5, nullable = true)
+    @ExcelProperty(name = "大题号(只能用小写数字)", width = 20, index = 5)
     private Integer mainNumber;
 
     @ApiModelProperty(value = "小题号(只能用小写数字)")
     @ExcelColumn(name = "小题号(只能用小写数字)", index = 6, nullable = true)
+    @ExcelProperty(name = "小题号(只能用小写数字)", width = 20, index = 6)
     private Integer subNumber;
 
     @ApiModelProperty(value = "小题满分")
     @ExcelColumn(name = "小题满分", index = 7, nullable = true)
+    @ExcelProperty(name = "小题满分", width = 20, index = 7)
     private Double totalScore;
 
     @ApiModelProperty(value = "评卷间隔分")
     @ExcelColumn(name = "间隔分", index = 8, nullable = true)
+    @ExcelProperty(name = "间隔分", width = 20, index = 8)
     private Double intervalScore;
 
     @ApiModelProperty(value = "评卷分组序号")
     @ExcelColumn(name = "评卷分组(只能用小写数字)", index = 9, nullable = true)
+    @ExcelProperty(name = "评卷分组(只能用小写数字)", width = 20, index = 9)
     private Integer groupNumber;
 
     @ApiModelProperty(value = "评卷员数量(系统生成)")
     @ExcelColumn(name = "评卷员数量(系统生成)", index = 10)
+    @ExcelProperty(name = "评卷员数量(系统生成)", width = 20, index = 10)
     private Integer markerCount;
 
     @ApiModelProperty(value = "绑定工号(英文逗号分隔)")
     @ExcelColumn(name = "绑定工号(英文逗号分隔)", index = 11)
+    @ExcelProperty(name = "绑定工号(英文逗号分隔)", width = 20, index = 11)
     private String markerCodes;
 
     @ApiModelProperty(value = "错误信息")

+ 2 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/execute/SyncObjectiveStructImportService.java → distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/execute/AsyncObjectiveStructImportService.java

@@ -1,6 +1,7 @@
 package com.qmth.distributed.print.business.templete.execute;
 
 import cn.hutool.core.date.DateUtil;
+import com.qmth.distributed.print.business.templete.importData.AsyncImportTaskTemplete;
 import com.qmth.distributed.print.business.templete.importData.SyncImportTaskTemplate;
 import com.qmth.distributed.print.business.templete.service.ImportLogicService;
 import com.qmth.distributed.print.business.templete.service.TaskLogicService;
@@ -27,7 +28,7 @@ import java.util.StringJoiner;
  * @Date: 2024/04/08
  */
 @Service
-public class SyncObjectiveStructImportService extends SyncImportTaskTemplate {
+public class AsyncObjectiveStructImportService extends AsyncImportTaskTemplete {
 
     public static final String OBJ_TITLE = "客观题结构导入";
 

+ 2 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/execute/SyncSubjectiveStructImportService.java → distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/execute/AsyncSubjectiveStructImportService.java

@@ -1,6 +1,7 @@
 package com.qmth.distributed.print.business.templete.execute;
 
 import cn.hutool.core.date.DateUtil;
+import com.qmth.distributed.print.business.templete.importData.AsyncImportTaskTemplete;
 import com.qmth.distributed.print.business.templete.importData.SyncImportTaskTemplate;
 import com.qmth.distributed.print.business.templete.service.ImportLogicService;
 import com.qmth.distributed.print.business.templete.service.TaskLogicService;
@@ -27,7 +28,7 @@ import java.util.StringJoiner;
  * @Date: 2024/04/09
  */
 @Service
-public class SyncSubjectiveStructImportService extends SyncImportTaskTemplate {
+public class AsyncSubjectiveStructImportService extends AsyncImportTaskTemplete {
 
     public static final String OBJ_TITLE = "主观题结构导入";
 

+ 0 - 3
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/ImportLogicService.java

@@ -1,9 +1,7 @@
 package com.qmth.distributed.print.business.templete.service;
 
-import com.qmth.teachcloud.common.entity.BasicExamStudent;
 import com.qmth.teachcloud.common.entity.TBTask;
 
-import java.util.List;
 import java.util.Map;
 import java.util.StringJoiner;
 
@@ -45,5 +43,4 @@ public interface ImportLogicService {
      * @throws Exception 异常
      */
     Map<String, Object> executeImportSubjectiveStructLogic(Map<String, Object> map) throws Exception;
-
 }

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/ImportLogicServiceImpl.java

@@ -1236,7 +1236,7 @@ public class ImportLogicServiceImpl implements ImportLogicService {
                                     userSaveParams.setEnable(true);
                                     userSaveParams.setRoleIds(new Long[]{markerRole.getId()});
                                     try {
-                                        markUser.setUserId(sysUserService.saveUser(userSaveParams));
+                                        markUser.setUserId(sysUserService.saveUser(userSaveParams, requestUser.getId()));
                                         markUser.setName(markerCode);
                                     } catch (IllegalAccessException e) {
                                         e.printStackTrace();

+ 9 - 9
distributed-print/src/main/java/com/qmth/distributed/print/api/mark/MarkSettingController.java

@@ -1,12 +1,14 @@
 package com.qmth.distributed.print.api.mark;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.qmth.boot.api.annotation.Aac;
 import com.qmth.boot.api.constant.ApiConstant;
 import com.qmth.distributed.print.business.entity.ExamTaskDetail;
 import com.qmth.distributed.print.business.service.ExamTaskDetailService;
 import com.qmth.distributed.print.business.service.PrintCommonService;
-import com.qmth.distributed.print.business.templete.execute.SyncObjectiveStructImportService;
-import com.qmth.distributed.print.business.templete.execute.SyncSubjectiveStructImportService;
+import com.qmth.distributed.print.business.templete.execute.AsyncObjectiveStructImportService;
+import com.qmth.distributed.print.business.templete.execute.AsyncSubjectiveStructImportService;
+import com.qmth.distributed.print.business.templete.service.ImportLogicService;
 import com.qmth.teachcloud.common.annotation.OperationLogDetail;
 import com.qmth.teachcloud.common.bean.dto.mark.MarkSettingDto;
 import com.qmth.teachcloud.common.bean.params.mark.setting.MarkPaperSettingParam;
@@ -23,9 +25,7 @@ import com.qmth.teachcloud.mark.dto.mark.score.CheckScoreListDto;
 import com.qmth.teachcloud.mark.entity.MarkPaper;
 import com.qmth.teachcloud.mark.service.MarkPaperService;
 import com.qmth.teachcloud.mark.service.MarkTaskService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
+import io.swagger.annotations.*;
 import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
@@ -59,9 +59,9 @@ public class MarkSettingController {
     @Resource
     private PrintCommonService printCommonService;
     @Resource
-    private SyncObjectiveStructImportService syncObjectiveStructImportService;
+    private AsyncObjectiveStructImportService asyncObjectiveStructImportService;
     @Resource
-    private SyncSubjectiveStructImportService syncSubjectiveStructImportService;
+    private AsyncSubjectiveStructImportService asyncSubjectiveStructImportService;
 
     /**
      * 评卷设置数据列表
@@ -193,7 +193,7 @@ public class MarkSettingController {
                                         @ApiParam(value = "标答excel文件", required = true) @RequestParam MultipartFile file) throws Exception {
         Map<String, Object> map = printCommonService.saveTask(file, SystemConstant.convertIdToLong(examId), TaskTypeEnum.OBJECTIVE_STRUCT_IMPORT);
         map.put("examId", SystemConstant.convertIdToLong(examId));
-        return syncObjectiveStructImportService.importTask(map);
+        return asyncObjectiveStructImportService.importTask(map);
     }
 
     @ApiOperation(value = "主观题导入")
@@ -202,6 +202,6 @@ public class MarkSettingController {
                                          @ApiParam(value = "标答excel文件", required = true) @RequestParam MultipartFile file) throws Exception {
         Map<String, Object> map = printCommonService.saveTask(file, SystemConstant.convertIdToLong(examId), TaskTypeEnum.SUBJECTIVE_STRUCT_IMPORT);
         map.put("examId", SystemConstant.convertIdToLong(examId));
-        return syncSubjectiveStructImportService.importTask(map);
+        return asyncSubjectiveStructImportService.importTask(map);
     }
 }

+ 2 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/SysUserService.java

@@ -59,6 +59,8 @@ public interface SysUserService extends IService<SysUser> {
 
     Long saveUser(UserSaveParams userSaveParams) throws IllegalAccessException;
 
+    Long saveUser(UserSaveParams userSaveParams,Long requestUserId) throws IllegalAccessException;
+
     /**
      * 保存用户
      *

+ 6 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/SysUserServiceImpl.java

@@ -140,6 +140,12 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
         return saveUserCommon(userSaveParams, null);
     }
 
+    @Transactional
+    @Override
+    public Long saveUser(UserSaveParams userSaveParams, Long requestUserId) {
+        return saveUserCommon(userSaveParams, requestUserId);
+    }
+
     /**
      * 保存用户
      *