案件bug修复
This commit is contained in:
+3
-1
@@ -1093,7 +1093,9 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
||||
if(CollectionUtil.isNotEmpty(caseApplication.getColumnValues())) {
|
||||
// 修改自定义字段
|
||||
for (ColumnValue columnValue : caseApplication.getColumnValues()) {
|
||||
columnValueMapper.updateColumnValue(columnValue);
|
||||
if(StrUtil.isNotEmpty(columnValue.getValue())) {
|
||||
columnValueMapper.updateColumnValue(columnValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 修改记录表状态为同意提交修改的内容
|
||||
|
||||
+104
-46
@@ -32,6 +32,7 @@ import com.ruoyi.wisdomarbitrate.utils.UnZipFileUtils;
|
||||
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.*;
|
||||
@@ -93,7 +94,7 @@ public class CaseZipImportImpl {
|
||||
private Integer maxCaseNum;
|
||||
private Integer maxBatchNumber;
|
||||
|
||||
|
||||
@Transactional
|
||||
public AjaxResult zipImport(MultipartFile file, Long templateId) {
|
||||
UUID uuid = UUID.randomUUID();
|
||||
// todo
|
||||
@@ -166,22 +167,30 @@ public class CaseZipImportImpl {
|
||||
throw new ServiceException("未找到文件夹");
|
||||
}
|
||||
File[] files = directory.listFiles();
|
||||
CaseZipImportTask caseZipImportTask = new CaseZipImportTask(this, templateId, fatchRuleList, fatchMap, fatchRuleMap, userMap, dictDataList, files , deptMap,SecurityUtils.getLoginUser());
|
||||
Future<List<CaseApplication>> future = ThreadPoolUtil.submit(caseZipImportTask);
|
||||
CaseZipImportTask caseZipImportTask = null;
|
||||
try {
|
||||
caseZipImportTask = new CaseZipImportTask(this, templateId, fatchRuleList, fatchMap, fatchRuleMap, userMap, dictDataList, files , deptMap, SecurityUtils.getLoginUser());
|
||||
} catch (Exception e) {
|
||||
return error("导入失败");
|
||||
}
|
||||
Future<List<CaseApplication>> future = ThreadPoolUtil.submit(caseZipImportTask);
|
||||
try {
|
||||
if(future.get()!=null){
|
||||
return success("导入成功");
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
return success("导入失败");
|
||||
} catch (ExecutionException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
return success("导入失败");
|
||||
}
|
||||
return error("无可导入的案件");
|
||||
return error("导入失败");
|
||||
|
||||
|
||||
}
|
||||
|
||||
@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) {
|
||||
// fileMap<caseId, List<File>>
|
||||
Map<String, String> fileMap = findFile(file, fatchRuleList);
|
||||
@@ -288,57 +297,106 @@ public class CaseZipImportImpl {
|
||||
caseApplication.setCaseAttachList(caseAttachs);
|
||||
// 案件压缩包导入
|
||||
caseApplication.setImportFlag(2);
|
||||
caseApplicationMapper.insertCaseApplication(caseApplication);
|
||||
// 多线程执行
|
||||
// List<MultipleThreadListParam> execList = new ArrayList<>();
|
||||
// if (CollectionUtil.isNotEmpty(addUsers)) {
|
||||
// Function<List<SysUser>, Integer> function = userMapper::batchSave;
|
||||
// execList.add(new MultipleThreadListParam(function, addUsers));
|
||||
// }
|
||||
// if (CollectionUtil.isNotEmpty(userRoleList)) {
|
||||
// Function<List<SysUserRole>, Integer> function = userRoleMapper::batchUserRole;
|
||||
// execList.add(new MultipleThreadListParam(function, userRoleList));
|
||||
//
|
||||
// }
|
||||
// if (CollectionUtil.isNotEmpty(sysDepts)) {
|
||||
// Function<List<SysDept>, Integer> function = sysDeptMapper::batchSave;
|
||||
// execList.add(new MultipleThreadListParam(function, sysDepts));
|
||||
//
|
||||
// }
|
||||
// if (CollectionUtil.isNotEmpty(caseApplications)) {
|
||||
// Function<List<CaseApplication>, Integer> function = caseApplicationMapper::batchSave;
|
||||
// execList.add(new MultipleThreadListParam(function, caseApplications));
|
||||
// Function<List<CaseApplication>, Integer> functionLog = caseApplicationLogMapper::batchSave;
|
||||
// execList.add(new MultipleThreadListParam(functionLog, caseApplications));
|
||||
//
|
||||
// }
|
||||
// if (CollectionUtil.isNotEmpty(caseAffiliates)) {
|
||||
// Function<List<CaseAffiliate>, Integer> function = caseAffiliateMapper::batchCaseAffiliate;
|
||||
// execList.add(new MultipleThreadListParam(function, caseAffiliates));
|
||||
// Function<List<CaseAffiliate>, Integer> functionLog = caseAffiliateLogMapper::batchCaseAffiliate;
|
||||
// execList.add(new MultipleThreadListParam(functionLog, caseAffiliates));
|
||||
// }
|
||||
// if (CollectionUtil.isNotEmpty(caseAttachs)) {
|
||||
// Function<List<CaseAttach>, Integer> function = caseAttachMapper::batchSave;
|
||||
// execList.add(new MultipleThreadListParam(function, caseAttachs));
|
||||
// Function<List<CaseAttach>, Integer> functionLog = caseAttachLogMapper::batchSave;
|
||||
// execList.add(new MultipleThreadListParam(functionLog, caseAttachs));
|
||||
// }
|
||||
// if (CollectionUtil.isNotEmpty(columnValueList)) {
|
||||
// Function<List<ColumnValue>, Integer> function = columnValueMapper::batchSave;
|
||||
// execList.add(new MultipleThreadListParam(function, columnValueList));
|
||||
// Function<List<ColumnValue>, Integer> functionLog = columnValueLogMapper::batchSave;
|
||||
// execList.add(new MultipleThreadListParam(functionLog, columnValueList));
|
||||
// }
|
||||
// if (CollectionUtil.isNotEmpty(execList)) {
|
||||
// MultipleThreadWorkUtil.execListFun(execList.toArray(new MultipleThreadListParam[execList.size()]));
|
||||
// }
|
||||
// 多线程执行
|
||||
ThreadPoolUtil.execute(() -> {
|
||||
caseApplicationLogMapper.insert(caseApplication);
|
||||
// 多线程执行
|
||||
if (CollectionUtil.isNotEmpty(addUsers)) {
|
||||
userMapper.batchSave(addUsers);
|
||||
try {
|
||||
caseApplicationMapper.insertCaseApplication(caseApplication);
|
||||
caseApplicationLogMapper.insert(caseApplication);
|
||||
// 多线程执行
|
||||
if (CollectionUtil.isNotEmpty(addUsers)) {
|
||||
userMapper.batchSave(addUsers);
|
||||
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(userRoleList)) {
|
||||
userRoleMapper.batchUserRole(userRoleList);
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(userRoleList)) {
|
||||
userRoleMapper.batchUserRole(userRoleList);
|
||||
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(sysDepts)) {
|
||||
sysDeptMapper.batchSave(sysDepts);
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(sysDepts)) {
|
||||
sysDeptMapper.batchSave(sysDepts);
|
||||
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(caseApplication.getCaseAffiliates())) {
|
||||
caseAffiliateMapper.batchCaseAffiliate(caseApplication.getCaseAffiliates());
|
||||
caseAffiliateLogMapper.batchCaseAffiliate(caseApplication.getCaseAffiliates());
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(caseAttachs)) {
|
||||
caseAttachMapper.batchSave(caseAttachs);
|
||||
caseAttachLogMapper.batchSave(caseAttachs);
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(caseApplication.getCaseAffiliates())) {
|
||||
caseAffiliateMapper.batchCaseAffiliate(caseApplication.getCaseAffiliates());
|
||||
caseAffiliateLogMapper.batchCaseAffiliate(caseApplication.getCaseAffiliates());
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(caseAttachs)) {
|
||||
caseAttachMapper.batchSave(caseAttachs);
|
||||
caseAttachLogMapper.batchSave(caseAttachs);
|
||||
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(columnValueList)) {
|
||||
columnValueMapper.batchSave(columnValueList);
|
||||
columnValueLogMapper.batchSave(columnValueList);
|
||||
}
|
||||
// 新增日志
|
||||
CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_APPLICATION, "",loginUser);
|
||||
// 发送短信
|
||||
if (CollectionUtil.isNotEmpty(smsRequestList)) {
|
||||
Map<Long, SmsSendRecord> sendRecordMap = null;
|
||||
if (CollectionUtil.isNotEmpty(smsSendRecordList)) {
|
||||
sendRecordMap = smsSendRecordList.stream().collect(Collectors.toMap(SmsSendRecord::getCaseId, Function.identity()));
|
||||
for (SmsUtils.SendSmsRequest sendSmsRequest : smsRequestList) {
|
||||
Boolean aBoolean = SmsUtils.sendSms(request);
|
||||
if (sendRecordMap != null && sendRecordMap.containsKey(sendSmsRequest.getCaseId())) {
|
||||
if (aBoolean) {
|
||||
sendRecordMap.get(sendSmsRequest.getCaseId()).setSendStatus(1);
|
||||
} else {
|
||||
sendRecordMap.get(sendSmsRequest.getCaseId()).setSendStatus(0);
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(columnValueList)) {
|
||||
columnValueMapper.batchSave(columnValueList);
|
||||
columnValueLogMapper.batchSave(columnValueList);
|
||||
}
|
||||
// 新增日志
|
||||
CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_APPLICATION, "",loginUser);
|
||||
// 发送短信
|
||||
if (CollectionUtil.isNotEmpty(smsRequestList)) {
|
||||
Map<Long, SmsSendRecord> sendRecordMap = null;
|
||||
if (CollectionUtil.isNotEmpty(smsSendRecordList)) {
|
||||
sendRecordMap = smsSendRecordList.stream().collect(Collectors.toMap(SmsSendRecord::getCaseId, Function.identity()));
|
||||
for (SmsUtils.SendSmsRequest sendSmsRequest : smsRequestList) {
|
||||
Boolean aBoolean = SmsUtils.sendSms(request);
|
||||
if (sendRecordMap != null && sendRecordMap.containsKey(sendSmsRequest.getCaseId())) {
|
||||
if (aBoolean) {
|
||||
sendRecordMap.get(sendSmsRequest.getCaseId()).setSendStatus(1);
|
||||
} else {
|
||||
sendRecordMap.get(sendSmsRequest.getCaseId()).setSendStatus(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
smsRecordMapper.batchSaveSmsSendRecord(smsSendRecordList);
|
||||
}
|
||||
smsRecordMapper.batchSaveSmsSendRecord(smsSendRecordList);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException("导入失败,请检查抓取规则是否正确");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -49,16 +49,20 @@ public class CaseZipImportTask implements Callable<List<CaseApplication>> {
|
||||
@Override
|
||||
public List<CaseApplication> call() {
|
||||
List<CaseApplication> caseApplications = new ArrayList<>();
|
||||
for (File file1 : files) {
|
||||
if (file1.isDirectory() && file1.listFiles() != null) {
|
||||
try {
|
||||
for (File file1 : files) {
|
||||
if (file1.isDirectory() && file1.listFiles() != null) {
|
||||
|
||||
for (File file2 : file1.listFiles()) {
|
||||
CaseApplication caseApplication = caseZipImportImpl.buildCaseInfo(file2, templateId, fatchRuleList, fatchRuleMap, fatchMap, userMap, dictDataList, deptMap, loginUser);
|
||||
if (caseApplication != null) {
|
||||
caseApplications.add(caseApplication);
|
||||
for (File file2 : file1.listFiles()) {
|
||||
CaseApplication caseApplication = caseZipImportImpl.buildCaseInfo(file2, templateId, fatchRuleList, fatchRuleMap, fatchMap, userMap, dictDataList, deptMap, loginUser);
|
||||
if (caseApplication != null) {
|
||||
caseApplications.add(caseApplication);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("导入失败");
|
||||
}
|
||||
|
||||
return caseApplications;
|
||||
|
||||
Reference in New Issue
Block a user