From 1ea9767674fd01cb0a66a70be2ef2078210c6ba5 Mon Sep 17 00:00:00 2001 From: 18792927508 <1322446236@qq.com> Date: Thu, 4 Jan 2024 10:01:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=8B=E7=BC=A9=E5=8C=85=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/CaseZipImportImpl.java | 25 +++++++++---------- .../task/CaseZipImportTask.java | 6 +++-- .../wisdomarbitrate/CaseApplicationMapper.xml | 2 +- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseZipImportImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseZipImportImpl.java index 9eb1fe4..b67e8c4 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseZipImportImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseZipImportImpl.java @@ -92,7 +92,7 @@ public class CaseZipImportImpl { // 申请人角色id private long roleId; private Integer maxCaseNum; - private Integer maxBatchNumber; + @Transactional public AjaxResult zipImport(MultipartFile file, Long templateId) { @@ -166,10 +166,18 @@ public class CaseZipImportImpl { if (!directory.isDirectory() || directory.listFiles() == null) { throw new ServiceException("未找到文件夹"); } + Integer maxBatchNumber = caseApplicationMapper.selectBatchNumberLike(); + if (maxBatchNumber == null) { + maxBatchNumber = 1; + + } else { + maxBatchNumber = maxBatchNumber + 1; + + } File[] files = directory.listFiles(); CaseZipImportTask caseZipImportTask = null; try { - caseZipImportTask = new CaseZipImportTask(this, templateId, fatchRuleList, fatchMap, fatchRuleMap, userMap, dictDataList, files , deptMap, SecurityUtils.getLoginUser()); + caseZipImportTask = new CaseZipImportTask(this, templateId, fatchRuleList, fatchMap, fatchRuleMap, userMap, dictDataList, files , deptMap, SecurityUtils.getLoginUser(),maxBatchNumber); } catch (Exception e) { return error("导入失败"); } @@ -191,7 +199,7 @@ public class CaseZipImportImpl { } @Transactional - public CaseApplication buildCaseInfo(File file, Long templateId, List fatchRuleList, Map> fatchRuleMap, Map fatchMap, Map userMap, List dictDataList, Map deptMap,LoginUser loginUser) { + public CaseApplication buildCaseInfo(File file, Long templateId, List fatchRuleList, Map> fatchRuleMap, Map fatchMap, Map userMap, List dictDataList, Map deptMap,LoginUser loginUser, Integer maxBatchNumber) { // fileMap> Map fileMap = findFile(file, fatchRuleList); if (fileMap != null && fileMap.size()> 0) { @@ -248,16 +256,7 @@ public class CaseZipImportImpl { caseApplication.setCaseAppliId(caseApplication.getId()); // 设置批号 - if (caseApplication.getBatchNumber()==null) { - maxBatchNumber = caseApplicationMapper.selectBatchNumberLike(); - if (maxBatchNumber == null) { - maxBatchNumber = 1; - caseApplication.setBatchNumber(maxBatchNumber); - } else { - maxBatchNumber = maxBatchNumber + 1; - caseApplication.setBatchNumber(maxBatchNumber); - } - } + caseApplication.setBatchNumber(maxBatchNumber); // 设置编号 String maxCaseNumStr = generateCaseNum(); caseApplication.setCaseNum(maxCaseNumStr); diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/task/CaseZipImportTask.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/task/CaseZipImportTask.java index a1d04ec..74409fb 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/task/CaseZipImportTask.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/task/CaseZipImportTask.java @@ -32,8 +32,9 @@ public class CaseZipImportTask implements Callable> { private File[] files; private Map deptMap; private LoginUser loginUser; + private Integer maxBatchNumber; - public CaseZipImportTask(CaseZipImportImpl caseZipImportImpl, Long templateId, List fatchRuleList, Map fatchMap, Map> fatchRuleMap, Map userMap, List dictDataList, File[] files, Map deptMap, LoginUser loginUser) { + public CaseZipImportTask(CaseZipImportImpl caseZipImportImpl, Long templateId, List fatchRuleList, Map fatchMap, Map> fatchRuleMap, Map userMap, List dictDataList, File[] files, Map deptMap, LoginUser loginUser,Integer maxBatchNumber) { this.caseZipImportImpl = caseZipImportImpl; this.templateId = templateId; this.fatchRuleList = fatchRuleList; @@ -44,6 +45,7 @@ public class CaseZipImportTask implements Callable> { this.files = files; this.deptMap = deptMap; this.loginUser = loginUser; + this.maxBatchNumber = maxBatchNumber; } @Override @@ -54,7 +56,7 @@ public class CaseZipImportTask implements Callable> { if (file1.isDirectory() && file1.listFiles() != null) { for (File file2 : file1.listFiles()) { - CaseApplication caseApplication = caseZipImportImpl.buildCaseInfo(file2, templateId, fatchRuleList, fatchRuleMap, fatchMap, userMap, dictDataList, deptMap, loginUser); + CaseApplication caseApplication = caseZipImportImpl.buildCaseInfo(file2, templateId, fatchRuleList, fatchRuleMap, fatchMap, userMap, dictDataList, deptMap, loginUser,maxBatchNumber); if (caseApplication != null) { caseApplications.add(caseApplication); } diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml index eae5404..71c28e9 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml @@ -803,7 +803,7 @@