压缩包导入修改

This commit is contained in:
18792927508
2024-01-04 10:01:59 +08:00
parent 2253984352
commit 1ea9767674
3 changed files with 17 additions and 16 deletions
@@ -92,7 +92,7 @@ public class CaseZipImportImpl {
// 申请人角色id // 申请人角色id
private long roleId; private long roleId;
private Integer maxCaseNum; private Integer maxCaseNum;
private Integer maxBatchNumber;
@Transactional @Transactional
public AjaxResult zipImport(MultipartFile file, Long templateId) { public AjaxResult zipImport(MultipartFile file, Long templateId) {
@@ -166,10 +166,18 @@ public class CaseZipImportImpl {
if (!directory.isDirectory() || directory.listFiles() == null) { if (!directory.isDirectory() || directory.listFiles() == null) {
throw new ServiceException("未找到文件夹"); throw new ServiceException("未找到文件夹");
} }
Integer maxBatchNumber = caseApplicationMapper.selectBatchNumberLike();
if (maxBatchNumber == null) {
maxBatchNumber = 1;
} else {
maxBatchNumber = maxBatchNumber + 1;
}
File[] files = directory.listFiles(); File[] files = directory.listFiles();
CaseZipImportTask caseZipImportTask = null; CaseZipImportTask caseZipImportTask = null;
try { 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) { } catch (Exception e) {
return error("导入失败"); return error("导入失败");
} }
@@ -191,7 +199,7 @@ public class CaseZipImportImpl {
} }
@Transactional @Transactional
public CaseApplication buildCaseInfo(File file, Long templateId, List<FatchRule> fatchRuleList, Map<String, List<FatchRule>> fatchRuleMap, Map<String, String> fatchMap, Map<String, SysUser> userMap, List<SysDictData> dictDataList, Map<String, Long> deptMap,LoginUser loginUser) { public CaseApplication buildCaseInfo(File file, Long templateId, List<FatchRule> fatchRuleList, Map<String, List<FatchRule>> fatchRuleMap, Map<String, String> fatchMap, Map<String, SysUser> userMap, List<SysDictData> dictDataList, Map<String, Long> deptMap,LoginUser loginUser, Integer maxBatchNumber) {
// fileMap<caseId, List<File>> // fileMap<caseId, List<File>>
Map<String, String> fileMap = findFile(file, fatchRuleList); Map<String, String> fileMap = findFile(file, fatchRuleList);
if (fileMap != null && fileMap.size()> 0) { if (fileMap != null && fileMap.size()> 0) {
@@ -248,16 +256,7 @@ public class CaseZipImportImpl {
caseApplication.setCaseAppliId(caseApplication.getId()); caseApplication.setCaseAppliId(caseApplication.getId());
// 设置批号 // 设置批号
if (caseApplication.getBatchNumber()==null) { caseApplication.setBatchNumber(maxBatchNumber);
maxBatchNumber = caseApplicationMapper.selectBatchNumberLike();
if (maxBatchNumber == null) {
maxBatchNumber = 1;
caseApplication.setBatchNumber(maxBatchNumber);
} else {
maxBatchNumber = maxBatchNumber + 1;
caseApplication.setBatchNumber(maxBatchNumber);
}
}
// 设置编号 // 设置编号
String maxCaseNumStr = generateCaseNum(); String maxCaseNumStr = generateCaseNum();
caseApplication.setCaseNum(maxCaseNumStr); caseApplication.setCaseNum(maxCaseNumStr);
@@ -32,8 +32,9 @@ public class CaseZipImportTask implements Callable<List<CaseApplication>> {
private File[] files; private File[] files;
private Map<String, Long> deptMap; private Map<String, Long> deptMap;
private LoginUser loginUser; private LoginUser loginUser;
private Integer maxBatchNumber;
public CaseZipImportTask(CaseZipImportImpl caseZipImportImpl, Long templateId, List<FatchRule> fatchRuleList, Map<String, String> fatchMap, Map<String, List<FatchRule>> fatchRuleMap, Map<String, SysUser> userMap, List<SysDictData> dictDataList, File[] files, Map<String, Long> deptMap, LoginUser loginUser) { public CaseZipImportTask(CaseZipImportImpl caseZipImportImpl, Long templateId, List<FatchRule> fatchRuleList, Map<String, String> fatchMap, Map<String, List<FatchRule>> fatchRuleMap, Map<String, SysUser> userMap, List<SysDictData> dictDataList, File[] files, Map<String, Long> deptMap, LoginUser loginUser,Integer maxBatchNumber) {
this.caseZipImportImpl = caseZipImportImpl; this.caseZipImportImpl = caseZipImportImpl;
this.templateId = templateId; this.templateId = templateId;
this.fatchRuleList = fatchRuleList; this.fatchRuleList = fatchRuleList;
@@ -44,6 +45,7 @@ public class CaseZipImportTask implements Callable<List<CaseApplication>> {
this.files = files; this.files = files;
this.deptMap = deptMap; this.deptMap = deptMap;
this.loginUser = loginUser; this.loginUser = loginUser;
this.maxBatchNumber = maxBatchNumber;
} }
@Override @Override
@@ -54,7 +56,7 @@ public class CaseZipImportTask implements Callable<List<CaseApplication>> {
if (file1.isDirectory() && file1.listFiles() != null) { if (file1.isDirectory() && file1.listFiles() != null) {
for (File file2 : file1.listFiles()) { 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) { if (caseApplication != null) {
caseApplications.add(caseApplication); caseApplications.add(caseApplication);
} }
@@ -803,7 +803,7 @@
</select> </select>
<select id="selectAdminCaseApplicationList" parameterType="CaseApplication" resultMap="CaseApplicationResult"> <select id="selectAdminCaseApplicationList" parameterType="CaseApplication" resultMap="CaseApplicationResult">
select DISTINCT(c.id) id,c.case_num ,c.case_subject_amount ,c.register_date ,c.arbitrat_method , select DISTINCT(c.id) id,0 as pendingStatus,c.case_num ,c.case_subject_amount ,c.register_date ,c.arbitrat_method ,
CASE c.arbitrat_method when 1 then '开庭审理' when 2 then '书面审理' CASE c.arbitrat_method when 1 then '开庭审理' when 2 then '书面审理'
ELSE '无审理方式' ELSE '无审理方式'
END arbitratMethodName, END arbitratMethodName,