Bläddra i källkod

Merge branch 'dev' of http://git.qmth.com.cn/themis/backend-service.git into dev

xiatian 4 år sedan
förälder
incheckning
ba3a47f162

+ 3 - 6
themis-backend/src/main/java/com/qmth/themis/backend/api/TBExamInvigilateUserController.java

@@ -9,10 +9,7 @@ import com.qmth.themis.business.config.SystemConfig;
 import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.dto.response.TBExamInvigilateUserDto;
 import com.qmth.themis.business.entity.*;
-import com.qmth.themis.business.enums.FieldUniqueEnum;
-import com.qmth.themis.business.enums.MqEnum;
-import com.qmth.themis.business.enums.TaskStatusEnum;
-import com.qmth.themis.business.enums.TaskTypeEnum;
+import com.qmth.themis.business.enums.*;
 import com.qmth.themis.business.service.TBAttachmentService;
 import com.qmth.themis.business.service.TBExamInvigilateUserService;
 import com.qmth.themis.business.service.TBTaskHistoryService;
@@ -134,11 +131,11 @@ public class TBExamInvigilateUserController {
     @RequestMapping(value = "/import", method = RequestMethod.POST)
     @Transactional
     @ApiResponses({@ApiResponse(code = 200, message = "{\"taskId\":0}", response = Result.class)})
-    public Result importData(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file, @ApiParam(value = "上传文件类型", required = true) @RequestParam Integer type) {
+    public Result importData(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file) {
         if (Objects.isNull(file) || Objects.equals(file, "")) {
             throw new BusinessException(ExceptionResultEnum.ATTACHMENT_IS_NULL);
         }
-        Map<String, Object> mapParameter = systemConfig.getOssEnv(type);
+        Map<String, Object> mapParameter = systemConfig.getOssEnv(UploadFileEnum.file.getId());
         TBAttachment tbAttachment = null;
         TBTaskHistory tbTaskHistory = null;
         Map transMap = new HashMap();

+ 3 - 2
themis-backend/src/main/java/com/qmth/themis/backend/api/TEExamStudentController.java

@@ -12,6 +12,7 @@ import com.qmth.themis.business.entity.*;
 import com.qmth.themis.business.enums.MqEnum;
 import com.qmth.themis.business.enums.TaskStatusEnum;
 import com.qmth.themis.business.enums.TaskTypeEnum;
+import com.qmth.themis.business.enums.UploadFileEnum;
 import com.qmth.themis.business.service.*;
 import com.qmth.themis.business.util.JacksonUtil;
 import com.qmth.themis.business.util.ServletUtil;
@@ -141,14 +142,14 @@ public class TEExamStudentController {
     @RequestMapping(value = "/import", method = RequestMethod.POST)
     @Transactional
     @ApiResponses({@ApiResponse(code = 200, message = "{\"taskId\":0}", response = Result.class)})
-    public Result importData(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file, @ApiParam(value = "上传文件类型", required = true) @RequestParam Integer type, @ApiParam(value = "考试批次id", required = true) @RequestParam Long examId) throws IOException {
+    public Result importData(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file, @ApiParam(value = "考试批次id", required = true) @RequestParam Long examId) throws IOException {
         if (Objects.isNull(file) || Objects.equals(file, "")) {
             throw new BusinessException(ExceptionResultEnum.ATTACHMENT_IS_NULL);
         }
         if (Objects.isNull(examId) || Objects.equals(examId, "")) {
             throw new BusinessException(ExceptionResultEnum.EXAM_ID_IS_NULL);
         }
-        Map<String, Object> mapParameter = systemConfig.getOssEnv(type);
+        Map<String, Object> mapParameter = systemConfig.getOssEnv(UploadFileEnum.file.getId());
         TBAttachment tbAttachment = null;
         TBTaskHistory tbTaskHistory = null;
         Map transMap = new HashMap();

+ 1 - 28
themis-business/src/main/java/com/qmth/themis/business/templete/TaskExportCommon.java

@@ -160,33 +160,6 @@ public class TaskExportCommon {
         }
     }
 
-    /**
-     * 换算进度
-     *
-     * @param max
-     * @param min
-     * @param size
-     * @param txtList
-     * @return
-     */
-    public List<String> progress(int max, int min, int size, List<String> txtList) {
-        BigDecimal bigDecimal = new BigDecimal(100);
-        BigDecimal progress = new BigDecimal(Double.valueOf(new BigDecimal(max).divide(new BigDecimal(size), 2, BigDecimal.ROUND_HALF_UP).multiply(bigDecimal).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue())).setScale(0, BigDecimal.ROUND_HALF_UP);
-        if (progress.intValue() == 100) {
-            this.tbTaskHistory.setStatus(TaskStatusEnum.FINISH);
-            this.tbTaskHistory.setSummary("共导出了" + size + "条数据");
-            this.tbTaskHistory.setFinishTime(new Date());
-            txtList.add(DateUtil.format(new Date(), this.timeFormat) + "->数据导出完毕," + this.tbTaskHistory.getSummary());
-        } else {
-            this.tbTaskHistory.setStatus(TaskStatusEnum.RUNNING);
-            this.tbTaskHistory.setSummary("正在导出第" + min + "条至" + max + "条数据");
-            txtList.add(DateUtil.format(new Date(), this.timeFormat) + "->数据导出中," + this.tbTaskHistory.getSummary());
-        }
-        this.tbTaskHistory.setProgress(progress.doubleValue());
-        this.tbTaskHistoryService.updateById(this.tbTaskHistory);
-        return txtList;
-    }
-
     /**
      * 异常处理
      *
@@ -201,7 +174,7 @@ public class TaskExportCommon {
         String exceptionStr = "数据导出到第" + (y == 0 ? y + 1 : y) + "条时发生异常:" + e.getMessage();
         txtList.add(DateUtil.format(new Date(), this.timeFormat) + "->" + exceptionStr);
         this.tbTaskHistory.setSummary(exceptionStr);
-        this.tbTaskHistoryService.updateById(this.tbTaskHistory);
+//        this.tbTaskHistoryService.updateById(this.tbTaskHistory);
         return txtList;
     }
 

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

@@ -153,7 +153,7 @@ public class TaskImportCommon {
         String exceptionStr = "数据处理到第" + (y == 0 ? y + 1 : y) + "条时发生异常:" + e.getMessage();
         txtList.add(DateUtil.format(new Date(), this.timeFormat) + "->" + exceptionStr);
         this.tbTaskHistory.setSummary(exceptionStr);
-        this.tbTaskHistoryService.updateById(this.tbTaskHistory);
+//        this.tbTaskHistoryService.updateById(this.tbTaskHistory);
         return txtList;
     }
 

+ 2 - 2
themis-business/src/main/java/com/qmth/themis/business/templete/service/impl/TempleteLogicServiceImpl.java

@@ -290,7 +290,7 @@ public class TempleteLogicServiceImpl implements TempleteLogicService {
             txtList.add(DateUtil.format(new Date(), timeFormat) + "->数据处理中," + tbTaskHistory.getSummary());
         }
         tbTaskHistory.setProgress(progress.doubleValue());
-        tbTaskHistoryService.updateById(tbTaskHistory);
+//        tbTaskHistoryService.updateById(tbTaskHistory);
         return txtList;
     }
 
@@ -319,7 +319,7 @@ public class TempleteLogicServiceImpl implements TempleteLogicService {
             txtList.add(DateUtil.format(new Date(), timeFormat) + "->数据导出中," + tbTaskHistory.getSummary());
         }
         tbTaskHistory.setProgress(progress.doubleValue());
-        tbTaskHistoryService.updateById(tbTaskHistory);
+//        tbTaskHistoryService.updateById(tbTaskHistory);
         return txtList;
     }
 }