案件压缩包导入修改

This commit is contained in:
18792927508
2024-04-26 16:45:07 +08:00
parent 03bc65284d
commit b7f1e265f9
6 changed files with 96 additions and 174 deletions
@@ -419,4 +419,8 @@ public class CaseApplication extends BaseEntity {
private Integer pendingStatus;
/** e签宝流程id */
private String signFlowId;
/**
* 登录用户名
*/
private String userName;
}
@@ -12,7 +12,6 @@ import java.util.List;
public interface CaseApplicationMapper {
List<CaseApplication> selectCaseApplicationList(CaseApplication caseApplication);
List<CaseApplication> selectCaseApplicationList1(CaseApplication caseApplication);
int selectCaseApplicationCount(CaseApplication caseApplication);
@@ -40,6 +40,8 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import tk.mybatis.mapper.entity.Example;
import java.io.*;
import java.math.BigDecimal;
import java.math.RoundingMode;
@@ -138,6 +140,68 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
// 被申请人字段校验
private static final String[] dectborAffiliateColumns = {"name", "identityNum","contactTelphone","contactAddress","workTelphone","workAddress",
"residenAffili","responSex","responBirth","email","nameAgent", "identityNumAgent","contactTelphoneAgent","contactAddressAgent"};
/**
* 案件列表查询
*
* @param req
* @return
*/
// public List<CaseApplication> list(CaseApplication req) {
// // 查询的案件状态
// List<String> caseStatusList=new ArrayList<>();
// // 根据用户查询角色
// LoginUser loginUser = SecurityUtils.getLoginUser();
// // 根据id查询用户
// SysUser sysUser = sysUserMapper.selectUserById(loginUser.getUserId());
// List<SysRole> roles = sysUser.getRoles();
// req.setUserName(sysUser.getUserName());
// if (StrUtil.equals(SecurityUtils.getUsername(), "admin")) {
// startPage();
// List<CaseApplication> list = caseApplicationMapper.list(req, null,null);
// // 设置申请人被申请人及签名按钮限
// // setAfflicate(new HashMap<>(),list,loginUser.getUserId(),roles);
// return list;
// }
// if(CollectionUtil.isEmpty(roles) ){
// throw new RuntimeException("用户未分配角色,请联系管理员");
// }
// List<Long> roleIds = roles.stream().map(SysRole::getRoleId).collect(Collectors.toList());
//
// // 流程名称分组
// Map<String, Integer> flowNameMap = allCaseFlows.stream().collect(Collectors.toMap(MsCaseFlow::getCaseStatusName, MsCaseFlow::getSort, (k1, k2) -> k2));
//
// // 是否查询所有
// boolean isSelectAll = false;
//
// for (SysRole role : roles) {
// if(StrUtil.isNotEmpty(role.getRoleName())){
// if(StrUtil.contains(role.getRoleName(),"财务")
// ||StrUtil.contains(role.getRoleName(),"法律顾问")
// ||StrUtil.contains(role.getRoleName(),"部门长")
// ){
// isSelectAll=true;
// roleIds=null;
// }
// if(StrUtil.equals(role.getRoleName(),"调解员")) {
// req.setMediatorId(String.valueOf(sysUser.getUserId()));
// }
// }
// }
// if(!isSelectAll){
// req.setUserId(String.valueOf(loginUser.getUserId()));
// }
// if(req.getMediationMethod()!=null){
// // 查询视频审理
// req.setCaseFlowId(9);
// }
// startPage();
//
// // 查询案件列表
// List<CaseApplication> list = caseApplicationMapper.list(req, caseFlowIds,roleIds);
// // 设置申请人被申请人及签名按钮限
// // setAfflicate(flowNameMap,list,loginUser.getUserId(),roles);
// return list;
// }
/**
* 数据权限:1.每个人不同的角色,而每个角色可以操作不同的案件状态
@@ -261,7 +325,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
// 根据条件查询申请人,被申请人,仲裁员,法律顾问案件
// return caseApplicationMapper.selectCaseApplicationList(caseApplication);
List<CaseApplication> caseApplications = caseApplicationMapper.selectCaseApplicationList1(caseApplication);
List<CaseApplication> caseApplications = caseApplicationMapper.selectCaseApplicationList(caseApplication);
if(caseApplications!=null&&caseApplications.size()>0){
for(CaseApplication caseApplicationsel : caseApplications){
Integer caseStatus = caseApplicationsel.getCaseStatus();
@@ -41,6 +41,7 @@ import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -97,17 +98,14 @@ public class CaseZipImportImpl {
@Transactional
public AjaxResult zipImport(MultipartFile file, Long templateId) {
UUID uuid = UUID.randomUUID();
// todo
String targetPath = "/home/ruoyi/uploadPath/upload/unzipFile/" + uuid + "/";
// String targetPath = "D:/home/ruoyi/uploadPath/upload/unzipFile/"+uuid+ "/";
File zipFile = null;
InputStream ins = null;
try {
ins = file.getInputStream();
//上传的压缩包保存的路径
// todo
String savePath = "/home/ruoyi/uploadPath/upload/zipFile/";
// String savePath = "D:/home/ruoyi/uploadPath/upload/zipFile/";
String saveName = uuid + "_" + file.getOriginalFilename();
zipFile = new File(savePath + saveName);
inputChangeToFile(ins, zipFile);
@@ -121,7 +119,6 @@ public class CaseZipImportImpl {
throw new ServiceException("解压失败");
}
// 查询抓取规则
// todo 批次需要再上传压缩包时用户填写
List<FatchRule> fatchRuleList = fatchRuleMapper.listByTemplateId(templateId);
if (CollectionUtil.isEmpty(fatchRuleList)) {
throw new ServiceException("未设置抓取规则");
@@ -166,18 +163,19 @@ public class CaseZipImportImpl {
if (!directory.isDirectory() || directory.listFiles() == null) {
throw new ServiceException("未找到文件夹");
}
Integer maxBatchNumber = caseApplicationMapper.selectBatchNumberLike();
if (maxBatchNumber == null) {
maxBatchNumber = 1;
Integer batchNumber = caseApplicationMapper.selectBatchNumberLike();
AtomicInteger maxBatchNumber = new AtomicInteger();
if (batchNumber == null) {
maxBatchNumber.set(1);
} else {
maxBatchNumber = maxBatchNumber + 1;
maxBatchNumber.set(batchNumber+1);
}
File[] files = directory.listFiles();
File[] files = directory.listFiles();
CaseZipImportTask caseZipImportTask = null;
try {
caseZipImportTask = new CaseZipImportTask(this, templateId, fatchRuleList, fatchMap, fatchRuleMap, userMap, dictDataList, files , deptMap, SecurityUtils.getLoginUser(),maxBatchNumber);
caseZipImportTask = new CaseZipImportTask(this, templateId, fatchRuleList, fatchMap, fatchRuleMap, userMap, dictDataList, files , deptMap, SecurityUtils.getLoginUser(),maxBatchNumber.get());
} catch (Exception e) {
return error("导入失败");
}
@@ -298,44 +296,7 @@ public class CaseZipImportImpl {
// 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(() -> {
try {
@@ -414,6 +375,7 @@ public class CaseZipImportImpl {
for (Map.Entry<String, String> entry : andConvertPDF.entrySet()) {
if(entry.getKey().contains(mapKey)){
fileURL=entry.getValue();
break;
}
}
if (StrUtil.isEmpty(fileURL)) {
@@ -808,8 +770,8 @@ public class CaseZipImportImpl {
dept.setOrderNum(1);
dept.setStatus("0");
dept.setDelFlag("0");
dept.setCreateBy(getUsername());
dept.setUpdateBy(getUsername());
// dept.setCreateBy(getUsername());
// dept.setUpdateBy(getUsername());
dept.setDeptId(Long.valueOf(IdWorkerUtil.getId()));
sysDepts.add(dept);
deptMap.put(dept.getDeptName(), dept.getDeptId());
@@ -897,7 +859,7 @@ public class CaseZipImportImpl {
smsSendRecord.setSendTime(new Date());
String content = "尊敬的" + agentUser.getNickName() + ",您的代理的案件已接入仲裁系统,复制访问https://miniapp-3gpama6l759911ef-1321289474.tcloudbaseapp.com/jump-mp.html 进入小程序进行认证注册。如非本人操作,请忽略本短信";
smsSendRecord.setSendContent(content);
smsSendRecord.setCreateBy(getUsername());
// smsSendRecord.setCreateBy(getUsername());
smsSendRecords.add(smsSendRecord);
}
@@ -181,6 +181,7 @@ public class OCRUtils {
// 开始为空结束不为空
int endContIndex = StrUtil.ordinalIndexOf(text, endContent, fatchRule.getEndContentRepeatOrder());
if (endContIndex != -1) {
// todo
String substring = text.substring(0, endContIndex);
fatchMap.put(fatchRule.getColumnName(), trimStr(substring));
}