案件压缩包导入
This commit is contained in:
@@ -15,7 +15,7 @@ public interface FatchRuleMapper {
|
|||||||
/**
|
/**
|
||||||
* 根据批次查询
|
* 根据批次查询
|
||||||
*/
|
*/
|
||||||
List<FatchRule> listByTemplateId(@Param("templateId")String templateId);
|
List<FatchRule> listByTemplateId(@Param("templateId")Long templateId);
|
||||||
|
|
||||||
List<FatchRule> selectFatchRuleList(FatchRule fatchRule);
|
List<FatchRule> selectFatchRuleList(FatchRule fatchRule);
|
||||||
|
|
||||||
|
|||||||
+116
-112
@@ -14,6 +14,7 @@ import com.documents4j.job.LocalConverter;
|
|||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonArray;
|
import com.google.gson.JsonArray;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
import com.ruoyi.common.annotation.DataScope;
|
import com.ruoyi.common.annotation.DataScope;
|
||||||
import com.ruoyi.common.config.RuoYiConfig;
|
import com.ruoyi.common.config.RuoYiConfig;
|
||||||
import com.ruoyi.common.constant.CaseApplicationConstants;
|
import com.ruoyi.common.constant.CaseApplicationConstants;
|
||||||
@@ -37,7 +38,6 @@ import com.ruoyi.system.mapper.SysUserRoleMapper;
|
|||||||
import com.ruoyi.wisdomarbitrate.domain.vo.ColumnValue;
|
import com.ruoyi.wisdomarbitrate.domain.vo.ColumnValue;
|
||||||
import com.ruoyi.wisdomarbitrate.domain.vo.ReservedConferenceVO;
|
import com.ruoyi.wisdomarbitrate.domain.vo.ReservedConferenceVO;
|
||||||
import com.ruoyi.wisdomarbitrate.domain.vo.ToDoCount;
|
import com.ruoyi.wisdomarbitrate.domain.vo.ToDoCount;
|
||||||
import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils;
|
|
||||||
import com.ruoyi.wisdomarbitrate.domain.*;
|
import com.ruoyi.wisdomarbitrate.domain.*;
|
||||||
import com.ruoyi.wisdomarbitrate.domain.vo.SendRoomNoMessageVO;
|
import com.ruoyi.wisdomarbitrate.domain.vo.SendRoomNoMessageVO;
|
||||||
import com.ruoyi.wisdomarbitrate.mapper.*;
|
import com.ruoyi.wisdomarbitrate.mapper.*;
|
||||||
@@ -46,41 +46,33 @@ import com.ruoyi.wisdomarbitrate.utils.OCRUtils;
|
|||||||
import com.ruoyi.wisdomarbitrate.utils.SignAward;
|
import com.ruoyi.wisdomarbitrate.utils.SignAward;
|
||||||
import com.ruoyi.wisdomarbitrate.utils.UnZipFileUtils;
|
import com.ruoyi.wisdomarbitrate.utils.UnZipFileUtils;
|
||||||
import com.tencentyun.TLSSigAPIv2;
|
import com.tencentyun.TLSSigAPIv2;
|
||||||
import org.apache.http.HttpEntity;
|
|
||||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
|
||||||
import org.apache.http.client.methods.HttpPost;
|
|
||||||
import org.apache.http.entity.StringEntity;
|
|
||||||
import org.apache.http.impl.client.CloseableHttpClient;
|
|
||||||
import org.apache.http.impl.client.HttpClients;
|
|
||||||
import org.apache.http.util.EntityUtils;
|
|
||||||
import org.apache.pdfbox.pdmodel.PDDocument;
|
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||||
import org.apache.poi.xwpf.usermodel.Document;
|
|
||||||
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.StandardCopyOption;
|
import java.nio.file.StandardCopyOption;
|
||||||
import java.text.NumberFormat;
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.zip.ZipEntry;
|
|
||||||
import java.util.zip.ZipInputStream;
|
|
||||||
|
|
||||||
|
import static com.ruoyi.common.core.domain.AjaxResult.error;
|
||||||
import static com.ruoyi.common.core.domain.AjaxResult.success;
|
import static com.ruoyi.common.core.domain.AjaxResult.success;
|
||||||
import static com.ruoyi.common.utils.PageUtils.startPage;
|
import static com.ruoyi.common.utils.PageUtils.startPage;
|
||||||
import static com.ruoyi.common.utils.SecurityUtils.getLoginUser;
|
import static com.ruoyi.common.utils.SecurityUtils.getLoginUser;
|
||||||
@@ -253,6 +245,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ToDoCount selectToDoCount() {
|
public ToDoCount selectToDoCount() {
|
||||||
|
|
||||||
@@ -398,9 +391,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|||||||
if (file.isEmpty()) {
|
if (file.isEmpty()) {
|
||||||
return AjaxResult.error("请选择要上传的文件");
|
return AjaxResult.error("请选择要上传的文件");
|
||||||
}
|
}
|
||||||
// todo 服务器路径需要改
|
|
||||||
String targetPath = "/home/ruoyi/uploadPath/upload/unzipFile";
|
String targetPath = "/home/ruoyi/uploadPath/upload/unzipFile";
|
||||||
// String targetPath = "D:/";
|
|
||||||
File zipFile = null;
|
File zipFile = null;
|
||||||
InputStream ins = null;
|
InputStream ins = null;
|
||||||
try {
|
try {
|
||||||
@@ -416,10 +408,9 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|||||||
//得到解压缩的所有文件
|
//得到解压缩的所有文件
|
||||||
String zipName = file.getOriginalFilename();
|
String zipName = file.getOriginalFilename();
|
||||||
String subzipName = zipName.substring(0, zipName.indexOf(".zip"));
|
String subzipName = zipName.substring(0, zipName.indexOf(".zip"));
|
||||||
// String zipPath = "F:\\testZip\\uploadPath\\upload\\upload1\\unzipFile\\"+subzipName;
|
// todo
|
||||||
// todo 服务器路径需要改
|
|
||||||
String zipPath = "/home/ruoyi/uploadPath/upload/unzipFile/" + subzipName;
|
String zipPath = "/home/ruoyi/uploadPath/upload/unzipFile/" + subzipName;
|
||||||
// String zipPath = "D:/" + subzipName;
|
// String zipPath = "D:/home/ruoyi/uploadPath/upload/unzipFile/" + subzipName;
|
||||||
|
|
||||||
File dirUnzipPath = new File(zipPath);
|
File dirUnzipPath = new File(zipPath);
|
||||||
List<File> allFiles = new ArrayList<>();
|
List<File> allFiles = new ArrayList<>();
|
||||||
@@ -511,9 +502,9 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|||||||
String year = Integer.toString(now.getYear());
|
String year = Integer.toString(now.getYear());
|
||||||
String month = String.format("%02d", now.getMonthValue());
|
String month = String.format("%02d", now.getMonthValue());
|
||||||
String day = String.format("%02d", now.getDayOfMonth());
|
String day = String.format("%02d", now.getDayOfMonth());
|
||||||
// // todo 服务器路径需要改
|
// todo
|
||||||
String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
|
String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
|
||||||
// String saveFolderPath = "D:/" + year + "/" + month + "/" + day;
|
// String saveFolderPath = "D:/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
|
||||||
String fileName = UUID.randomUUID().toString().replace("-", "") + "_" + substrfile;
|
String fileName = UUID.randomUUID().toString().replace("-", "") + "_" + substrfile;
|
||||||
String resultFilePath = saveFolderPath + "/" + fileName;
|
String resultFilePath = saveFolderPath + "/" + fileName;
|
||||||
try {
|
try {
|
||||||
@@ -3003,17 +2994,17 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|||||||
return AjaxResult.error("请选择要上传的文件");
|
return AjaxResult.error("请选择要上传的文件");
|
||||||
}
|
}
|
||||||
UUID uuid = UUID.randomUUID();
|
UUID uuid = UUID.randomUUID();
|
||||||
// todo 服务器路径需要改
|
// todo
|
||||||
String targetPath = "/home/ruoyi/uploadPath/upload/unzipFile/"+uuid+ "/";
|
String targetPath = "/home/ruoyi/uploadPath/upload/unzipFile/" + uuid + "/";
|
||||||
// String targetPath = "D:/zip";
|
// String targetPath = "D:/home/ruoyi/uploadPath/upload/unzipFile/"+uuid+ "/";
|
||||||
File zipFile = null;
|
File zipFile = null;
|
||||||
InputStream ins = null;
|
InputStream ins = null;
|
||||||
try {
|
try {
|
||||||
ins = file.getInputStream();
|
ins = file.getInputStream();
|
||||||
//上传的压缩包保存的路径
|
//上传的压缩包保存的路径
|
||||||
// todo 服务器路径需要改
|
// todo
|
||||||
String savePath = "/home/ruoyi/uploadPath/upload/zipFile/";
|
String savePath = "/home/ruoyi/uploadPath/upload/zipFile/";
|
||||||
// String savePath = "D:/zip/";
|
// String savePath = "D:/home/ruoyi/uploadPath/upload/zipFile/";
|
||||||
String saveName = uuid + "_" + file.getOriginalFilename();
|
String saveName = uuid + "_" + file.getOriginalFilename();
|
||||||
zipFile = new File(savePath + saveName);
|
zipFile = new File(savePath + saveName);
|
||||||
inputChangeToFile(ins, zipFile);
|
inputChangeToFile(ins, zipFile);
|
||||||
@@ -3025,34 +3016,39 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|||||||
if (unzipSuccess) {
|
if (unzipSuccess) {
|
||||||
// 查询抓取规则
|
// 查询抓取规则
|
||||||
// todo 批次需要再上传压缩包时用户填写
|
// todo 批次需要再上传压缩包时用户填写
|
||||||
List<FatchRule> fatchRuleList = fatchRuleMapper.listByTemplateId("9");
|
List<FatchRule> fatchRuleList = fatchRuleMapper.listByTemplateId(17L);
|
||||||
|
if (CollectionUtil.isEmpty(fatchRuleList)) {
|
||||||
|
return error("未设置抓取规则");
|
||||||
|
}
|
||||||
File directory = new File(targetPath);
|
File directory = new File(targetPath);
|
||||||
Map<String,String> andConvertPDF = findAndConvertPDF(directory,fatchRuleList);
|
Map<String, String> andConvertPDF = findAndConvertPDF(directory, fatchRuleList);
|
||||||
if (andConvertPDF != null && andConvertPDF.size() > 0) {
|
if (andConvertPDF != null && andConvertPDF.size() > 0) {
|
||||||
Map<String,String> fatchMap = new HashMap<>();
|
Map<String, String> fatchMap = new HashMap<>();
|
||||||
if(CollectionUtil.isNotEmpty(fatchRuleList)){
|
if (CollectionUtil.isNotEmpty(fatchRuleList)) {
|
||||||
Map<String, List<FatchRule>> fatchRuleMap = fatchRuleList.stream().collect(Collectors.groupingBy(FatchRule::getFileName));
|
Map<String, List<FatchRule>> fatchRuleMap = fatchRuleList.stream().collect(Collectors.groupingBy(FatchRule::getFileName));
|
||||||
// 根据抓取规则循环抓取
|
// 根据抓取规则循环抓取
|
||||||
for (Map.Entry<String, List<FatchRule>> entry : fatchRuleMap.entrySet()) {
|
for (Map.Entry<String, List<FatchRule>> entry : fatchRuleMap.entrySet()) {
|
||||||
OCRAndBuildInfo(andConvertPDF,entry.getKey(),fatchMap,entry.getValue());
|
OCRAndBuildInfo(andConvertPDF, entry.getKey(), fatchMap, entry.getValue());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (fatchMap.size()>0){
|
if (fatchMap.size() <= 0) {
|
||||||
|
return error("从压缩包中未抓取到内容,请检查抓取字段配置");
|
||||||
|
}
|
||||||
|
if (fatchMap.size() > 0) {
|
||||||
|
|
||||||
// todo 从压缩包中识别各字段填充到数据库
|
// todo 从压缩包中识别各字段填充到数据库
|
||||||
//调用新增案件的接口
|
//调用新增案件的接口
|
||||||
CaseApplication caseApplication = new CaseApplication();
|
CaseApplication caseApplication = new CaseApplication();
|
||||||
//默认案件标的 todo 案件标的是什么
|
//默认案件标的 todo 案件标的是什么
|
||||||
caseApplication.setCaseSubjectAmount(new BigDecimal(1));
|
caseApplication.setCaseSubjectAmount(new BigDecimal(1));
|
||||||
// todo 这些以后要去掉,不在案件基本信息表维护,现在往基本信息表设置字段是因为修改以及查询详情的时候页面中字段是固定的,以后也要动态维护字段
|
// todo 这些以后要去掉,不在案件基本信息表维护,现在往基本信息表设置字段是因为修改以及查询详情的时候页面中字段是固定的,以后也要动态维护字段
|
||||||
// 仲裁请求
|
// 仲裁请求
|
||||||
caseApplication.setArbitratClaims(fatchMap.get("arbitrationClaims"));
|
caseApplication.setArbitratClaims(fatchMap.get("arbitrationClaims"));
|
||||||
// 事实和理由
|
// 事实和理由
|
||||||
caseApplication.setFacts(fatchMap.get("factsAndReason"));
|
caseApplication.setFacts(fatchMap.get("factsAndReason"));
|
||||||
// 合同编号
|
// 合同编号
|
||||||
String contractNumber = fatchMap.get("contractNumber");
|
String contractNumber = fatchMap.get("contractNumber");
|
||||||
if(StrUtil.isNotEmpty(contractNumber)) {
|
if (StrUtil.isNotEmpty(contractNumber)) {
|
||||||
// 提取字母和数字
|
// 提取字母和数字
|
||||||
String regx = "[^a-zA-Z0-9]";
|
String regx = "[^a-zA-Z0-9]";
|
||||||
String replaceAll = contractNumber.replaceAll(regx, "");
|
String replaceAll = contractNumber.replaceAll(regx, "");
|
||||||
@@ -3063,7 +3059,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|||||||
String lonStartDate = fatchMap.get("lonStartDate:");
|
String lonStartDate = fatchMap.get("lonStartDate:");
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat();
|
SimpleDateFormat sdf = new SimpleDateFormat();
|
||||||
sdf.applyPattern("yyyy年MM月dd日");
|
sdf.applyPattern("yyyy年MM月dd日");
|
||||||
if(StrUtil.isNotEmpty(lonStartDate)) {
|
if (StrUtil.isNotEmpty(lonStartDate)) {
|
||||||
try {
|
try {
|
||||||
caseApplication.setLoanStartDate(sdf.parse(lonStartDate));
|
caseApplication.setLoanStartDate(sdf.parse(lonStartDate));
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
@@ -3138,19 +3134,19 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|||||||
// caseApplication.setOutstandingMoney(mediationAgreementList.get(2));
|
// caseApplication.setOutstandingMoney(mediationAgreementList.get(2));
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// 合同甲方(贷款人)
|
// 合同甲方(贷款人)
|
||||||
caseApplication.setPartyA(fatchMap.get("partyA"));
|
caseApplication.setPartyA(fatchMap.get("partyA"));
|
||||||
List<CaseAffiliate> caseAffiliates = new ArrayList<>();
|
List<CaseAffiliate> caseAffiliates = new ArrayList<>();
|
||||||
CaseAffiliate caseAffiliate = new CaseAffiliate();
|
CaseAffiliate caseAffiliate = new CaseAffiliate();
|
||||||
caseAffiliate.setIdentityType(1);
|
caseAffiliate.setIdentityType(1);
|
||||||
// 申请人
|
// 申请人
|
||||||
caseAffiliate.setName(fatchMap.get("applicantName"));
|
caseAffiliate.setName(fatchMap.get("applicantName"));
|
||||||
// 统一社会信用代码
|
// 统一社会信用代码
|
||||||
caseAffiliate.setIdentityNum(fatchMap.get("creditCode"));
|
caseAffiliate.setIdentityNum(fatchMap.get("creditCode"));
|
||||||
// 法定代表人
|
// 法定代表人
|
||||||
caseAffiliate.setCompLegalPerson(fatchMap.get("legalRepresentative"));
|
caseAffiliate.setCompLegalPerson(fatchMap.get("legalRepresentative"));
|
||||||
// 申请人联系电话
|
// 申请人联系电话
|
||||||
caseAffiliate.setContactTelphone(fatchMap.get("applicantPhone"));
|
caseAffiliate.setContactTelphone(fatchMap.get("applicantPhone"));
|
||||||
// 申请人住所
|
// 申请人住所
|
||||||
caseAffiliate.setResidenAffili(fatchMap.get("applicantHome"));
|
caseAffiliate.setResidenAffili(fatchMap.get("applicantHome"));
|
||||||
// 申请人联系地址
|
// 申请人联系地址
|
||||||
@@ -3163,30 +3159,30 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|||||||
// caseAffiliate.setAppliAgentTitle(map.get("职务").get(1));
|
// caseAffiliate.setAppliAgentTitle(map.get("职务").get(1));
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// 委托代理人
|
// 委托代理人
|
||||||
caseAffiliate.setNameAgent(fatchMap.get("agentName"));
|
caseAffiliate.setNameAgent(fatchMap.get("agentName"));
|
||||||
// 委托代理人联系电话
|
// 委托代理人联系电话
|
||||||
caseAffiliate.setContactTelphoneAgent(fatchMap.get("agentPhone"));
|
caseAffiliate.setContactTelphoneAgent(fatchMap.get("agentPhone"));
|
||||||
|
|
||||||
// 代理人电子邮件
|
// 代理人电子邮件
|
||||||
caseAffiliate.setAgentEmail(fatchMap.get("agentEmail").replaceAll("\\s", ""));
|
caseAffiliate.setAgentEmail(StrUtil.isNotEmpty(fatchMap.get("agentEmail")) ? fatchMap.get("agentEmail").replaceAll("\\s", "") : null);
|
||||||
|
|
||||||
|
|
||||||
//设置默认代理人的身份证号码,暂时写死 要不然新增方法报错
|
//设置默认代理人的身份证号码,暂时写死 要不然新增方法报错
|
||||||
// caseAffiliate.setIdentityNumAgent("610423199603171716");
|
// caseAffiliate.setIdentityNumAgent("610423199603171716");
|
||||||
caseAffiliates.add(caseAffiliate);
|
caseAffiliates.add(caseAffiliate);
|
||||||
// 被申请人信息
|
// 被申请人信息
|
||||||
CaseAffiliate respondentAffiliate = new CaseAffiliate();
|
CaseAffiliate respondentAffiliate = new CaseAffiliate();
|
||||||
respondentAffiliate.setIdentityType(2);
|
respondentAffiliate.setIdentityType(2);
|
||||||
// 被申请人名称
|
// 被申请人名称
|
||||||
respondentAffiliate.setName(fatchMap.get("respondentName"));
|
respondentAffiliate.setName(fatchMap.get("respondentName"));
|
||||||
// 被申请人身份证
|
// 被申请人身份证
|
||||||
String identityNum = fatchMap.get("respondentCard");
|
String identityNum = fatchMap.get("respondentCard");
|
||||||
// 出生年月日,从身份证抓取
|
// 出生年月日,从身份证抓取
|
||||||
if(StrUtil.isNotEmpty(identityNum)) {
|
if (StrUtil.isNotEmpty(identityNum)) {
|
||||||
Map<String, String> identityNumMap = getBirAgeSex(identityNum);
|
Map<String, String> identityNumMap = getBirAgeSex(identityNum);
|
||||||
String birthday = identityNumMap.get("birthday");
|
String birthday = identityNumMap.get("birthday");
|
||||||
if(StrUtil.isNotEmpty(birthday)) {
|
if (StrUtil.isNotEmpty(birthday)) {
|
||||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
Date birthdayDate = null;
|
Date birthdayDate = null;
|
||||||
try {
|
try {
|
||||||
@@ -3198,11 +3194,11 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|||||||
respondentAffiliate.setResponBirth(birthdayDate);
|
respondentAffiliate.setResponBirth(birthdayDate);
|
||||||
}
|
}
|
||||||
//从身份证抓取性别
|
//从身份证抓取性别
|
||||||
fatchMap.put("resSex",identityNumMap.get("sexCode"));
|
fatchMap.put("resSex", identityNumMap.get("sexCode"));
|
||||||
respondentAffiliate.setResponSex(identityNumMap.get("sexCode"));
|
respondentAffiliate.setResponSex(identityNumMap.get("sexCode"));
|
||||||
}
|
}
|
||||||
respondentAffiliate.setIdentityNum(identityNum);
|
respondentAffiliate.setIdentityNum(identityNum);
|
||||||
// 被申请人电子邮件
|
// 被申请人电子邮件
|
||||||
// if(map.get("乙方确认有效的电子信箱地址为").size()>1) {
|
// if(map.get("乙方确认有效的电子信箱地址为").size()>1) {
|
||||||
// if(map.get("乙方确认有效的电子信箱地址为").get(0).contains("/")) {
|
// if(map.get("乙方确认有效的电子信箱地址为").get(0).contains("/")) {
|
||||||
// respondentAffiliate.setEmail(map.get("乙方确认有效的电子信箱地址为").get(1).replaceAll("\\s", ""));
|
// respondentAffiliate.setEmail(map.get("乙方确认有效的电子信箱地址为").get(1).replaceAll("\\s", ""));
|
||||||
@@ -3211,40 +3207,40 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// 被申请人电子邮件
|
// 被申请人电子邮件
|
||||||
respondentAffiliate.setEmail(fatchMap.get("respondentEmail").replaceAll("\\s", ""));
|
respondentAffiliate.setEmail(StrUtil.isNotEmpty(fatchMap.get("respondentEmail")) ? fatchMap.get("respondentEmail").replaceAll("\\s", "") : null);
|
||||||
// 被申请人联系电话
|
// 被申请人联系电话
|
||||||
respondentAffiliate.setContactTelphone(fatchMap.get("respondentPhone"));
|
respondentAffiliate.setContactTelphone(fatchMap.get("respondentPhone"));
|
||||||
// 被申请人住所
|
// 被申请人住所
|
||||||
respondentAffiliate.setResidenAffili(fatchMap.get("respondentHome"));
|
respondentAffiliate.setResidenAffili(fatchMap.get("respondentHome"));
|
||||||
|
|
||||||
caseAffiliates.add(respondentAffiliate);
|
caseAffiliates.add(respondentAffiliate);
|
||||||
caseApplication.setCaseAffiliates(caseAffiliates);
|
caseApplication.setCaseAffiliates(caseAffiliates);
|
||||||
// 新增案件基本信息表
|
// 新增案件基本信息表
|
||||||
this.insertcaseApplication(caseApplication,fatchMap);
|
this.insertcaseApplication(caseApplication, fatchMap);
|
||||||
if (null != caseApplication.getId()) {
|
if (null != caseApplication.getId()) {
|
||||||
List<CaseAttach> caseAttachs=new ArrayList<>();
|
List<CaseAttach> caseAttachs = new ArrayList<>();
|
||||||
for (Map.Entry<String, String> entry : andConvertPDF.entrySet()) {
|
for (Map.Entry<String, String> entry : andConvertPDF.entrySet()) {
|
||||||
if(entry.getValue().contains("证据材料")||entry.getValue().contains("申请书")||entry.getValue().contains("调解协议")||entry.getValue().contains("情况说明")){
|
if (entry.getValue().contains("证据材料") || entry.getValue().contains("申请书") || entry.getValue().contains("调解协议") || entry.getValue().contains("情况说明")) {
|
||||||
String pdfUrl = entry.getValue();
|
String pdfUrl = entry.getValue();
|
||||||
File file1 = new File(pdfUrl);
|
File file1 = new File(pdfUrl);
|
||||||
CaseAttach caseAttach = new CaseAttach();
|
CaseAttach caseAttach = new CaseAttach();
|
||||||
caseAttach.setCaseAppliId(caseApplication.getId());
|
caseAttach.setCaseAppliId(caseApplication.getId());
|
||||||
caseAttach.setAnnexPath(file1.getPath());
|
caseAttach.setAnnexPath(file1.getPath());
|
||||||
caseAttach.setAnnexName(file1.getName());
|
caseAttach.setAnnexName(file1.getName());
|
||||||
// 申请人提供的证据材料
|
// 申请人提供的证据材料
|
||||||
caseAttach.setAnnexType(2);
|
caseAttach.setAnnexType(2);
|
||||||
caseAttachs.add(caseAttach);
|
caseAttachs.add(caseAttach);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if(CollectionUtil.isNotEmpty(caseAttachs)) {
|
|
||||||
// 新增申请人证据材料
|
|
||||||
caseAttachMapper.batchSave(caseAttachs);
|
|
||||||
}
|
|
||||||
return AjaxResult.success("导入成功");
|
|
||||||
}
|
}
|
||||||
}else{
|
if (CollectionUtil.isNotEmpty(caseAttachs)) {
|
||||||
return AjaxResult.error("文件识别内容失败,请检查");
|
// 新增申请人证据材料
|
||||||
|
caseAttachMapper.batchSave(caseAttachs);
|
||||||
|
}
|
||||||
|
return AjaxResult.success("导入成功");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return AjaxResult.error("文件识别内容失败,请检查");
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// 没有找到符合条件的文件
|
// 没有找到符合条件的文件
|
||||||
@@ -3298,9 +3294,9 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|||||||
// return false;
|
// return false;
|
||||||
}
|
}
|
||||||
StringBuilder ocrText = new StringBuilder(); // 创建一个StringBuilder对象
|
StringBuilder ocrText = new StringBuilder(); // 创建一个StringBuilder对象
|
||||||
for (int i = 0; i < fileNumPage; i++) {
|
for (int i = 1; i <= fileNumPage; i++) {
|
||||||
//对接腾讯云接口.识别里面的数据
|
//对接腾讯云接口.识别里面的数据
|
||||||
String text = OCRUtils.pdfIdentifyText(base64, i + 1, fatchRules);
|
String text = OCRUtils.pdfIdentifyText(base64, i , fatchRules);
|
||||||
ocrText.append(text); // 拼接当前的字符串
|
ocrText.append(text); // 拼接当前的字符串
|
||||||
}
|
}
|
||||||
if(StrUtil.isNotEmpty(ocrText)){
|
if(StrUtil.isNotEmpty(ocrText)){
|
||||||
@@ -3377,10 +3373,13 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|||||||
// 如果文件名包含"仲裁申请书"且是PDF格式,直接返回路径
|
// 如果文件名包含"仲裁申请书"且是PDF格式,直接返回路径
|
||||||
path = directory.getAbsolutePath();
|
path = directory.getAbsolutePath();
|
||||||
} else {
|
} else {
|
||||||
// 如果不是PDF格式,进行转换成PDF并返回路径
|
String extension = getFileExtension(directory);
|
||||||
String pdfPath = convertToPDF(directory);
|
if( extension.contains("doc")|| extension.contains("docx")) {
|
||||||
if (pdfPath != null) {
|
// 如果不是PDF格式,进行转换成PDF并返回路径
|
||||||
path = pdfPath;
|
String pdfPath = convertToPDF(directory);
|
||||||
|
if (pdfPath != null) {
|
||||||
|
path = pdfPath;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 如果文件名包含"仲裁申请书"且是PDF格式,直接返回路径
|
// 如果文件名包含"仲裁申请书"且是PDF格式,直接返回路径
|
||||||
@@ -3432,7 +3431,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|||||||
pdfPathMap.put(file.getName(),file.getAbsolutePath());
|
pdfPathMap.put(file.getName(),file.getAbsolutePath());
|
||||||
} else {
|
} else {
|
||||||
// 如果不是PDF格式,进行转换成PDF并添加转换后的路径到列表中
|
// 如果不是PDF格式,进行转换成PDF并添加转换后的路径到列表中
|
||||||
String pdfPath = convertToPDF(file);
|
String pdfPath = convertToPDF(file);
|
||||||
if (pdfPath != null) {
|
if (pdfPath != null) {
|
||||||
// 如果是PDF格式,直接添加到列表中
|
// 如果是PDF格式,直接添加到列表中
|
||||||
pdfPathMap.put(file.getName(),pdfPath);
|
pdfPathMap.put(file.getName(),pdfPath);
|
||||||
@@ -3450,19 +3449,23 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|||||||
|
|
||||||
private static String convertToPDF(File file) {
|
private static String convertToPDF(File file) {
|
||||||
String wordFilePath = file.getAbsolutePath();
|
String wordFilePath = file.getAbsolutePath();
|
||||||
//String pdfSaveDirectory = "D:\\home\\unzip\\wordToPDF\\";
|
// todo
|
||||||
// todo 服务器路径需要改
|
|
||||||
String pdfSaveDirectory = "/home/ruoyi/uploadPath/upload/wordToPDF/";
|
String pdfSaveDirectory = "/home/ruoyi/uploadPath/upload/wordToPDF/";
|
||||||
// String pdfSaveDirectory = "D:/";
|
// String pdfSaveDirectory = "D:/home/ruoyi/uploadPath/upload/wordToPDF/";
|
||||||
File directory = new File(pdfSaveDirectory);
|
File directory = new File(pdfSaveDirectory);
|
||||||
if (!directory.exists()) {
|
if (!directory.exists()) {
|
||||||
directory.mkdirs();
|
directory.mkdirs();
|
||||||
}
|
}
|
||||||
String name = file.getName();
|
String name = file.getName();
|
||||||
String nameWithoutExtension = name.substring(0, name.lastIndexOf("."));
|
String nameWithoutExtension = name.substring(0, name.lastIndexOf("."));
|
||||||
|
|
||||||
String pdfFilePath = pdfSaveDirectory + nameWithoutExtension + ".pdf";
|
String pdfFilePath = pdfSaveDirectory + nameWithoutExtension + ".pdf";
|
||||||
File inputWord = new File(wordFilePath);
|
File inputWord = new File(wordFilePath);
|
||||||
|
if(!inputWord.exists()){
|
||||||
|
throw new ServiceException("文件不存在wordFilePath:"+wordFilePath);
|
||||||
|
}
|
||||||
File outputFile = new File(pdfFilePath);
|
File outputFile = new File(pdfFilePath);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
InputStream docxInputStream = new FileInputStream(inputWord);
|
InputStream docxInputStream = new FileInputStream(inputWord);
|
||||||
OutputStream outputStream = new FileOutputStream(outputFile);
|
OutputStream outputStream = new FileOutputStream(outputFile);
|
||||||
@@ -3472,7 +3475,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|||||||
outputStream.close();
|
outputStream.close();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
throw new ServiceException(e.getMessage()+"wordFilePath:"+wordFilePath+"pdfFilePath:"+pdfFilePath);
|
||||||
|
// e.printStackTrace();
|
||||||
}
|
}
|
||||||
return pdfFilePath;
|
return pdfFilePath;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-6
@@ -555,12 +555,8 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
|
|||||||
public AjaxResult saveFatchRules(TemplateManage templateManage) {
|
public AjaxResult saveFatchRules(TemplateManage templateManage) {
|
||||||
TemplateFatchRule templateFatchRule = new TemplateFatchRule();
|
TemplateFatchRule templateFatchRule = new TemplateFatchRule();
|
||||||
templateFatchRule.setTemplateId(templateManage.getId());
|
templateFatchRule.setTemplateId(templateManage.getId());
|
||||||
List<TemplateFatchRule> templateFatchRulelist = templateFatchRuleMapper.selectTemplateFatchRuleList(templateFatchRule);
|
templateFatchRuleMapper.deleteTemplateFatchRule(templateManage.getId());
|
||||||
if(templateFatchRulelist!=null&&templateFatchRulelist.size()>0){
|
|
||||||
List<Long> fatchRuleIds = templateFatchRulelist.stream().map(TemplateFatchRule::getFatchRuleId).collect(Collectors.toList());
|
|
||||||
fatchRuleMapper.deletebatchFatchRule(fatchRuleIds);
|
|
||||||
templateFatchRuleMapper.deleteTemplateFatchRule(templateManage.getId());
|
|
||||||
}
|
|
||||||
List<FatchRule> fatchRules = templateManage.getFatchRules();
|
List<FatchRule> fatchRules = templateManage.getFatchRules();
|
||||||
if(fatchRules!=null&&fatchRules.size()>0){
|
if(fatchRules!=null&&fatchRules.size()>0){
|
||||||
for (FatchRule fatchRule : fatchRules) {
|
for (FatchRule fatchRule : fatchRules) {
|
||||||
|
|||||||
@@ -221,15 +221,20 @@ public class OCRUtils {
|
|||||||
// 开始截取字符串 申请人:赵会
|
// 开始截取字符串 申请人:赵会
|
||||||
// String[] startContentSplit = ocrText.split(fatchRule.getStartContent());
|
// String[] startContentSplit = ocrText.split(fatchRule.getStartContent());
|
||||||
int startFirstIndex = ocrText.indexOf(fatchRule.getStartContent()) + fatchRule.getStartContent().length();
|
int startFirstIndex = ocrText.indexOf(fatchRule.getStartContent()) + fatchRule.getStartContent().length();
|
||||||
|
if(startFirstIndex<0){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (ocrText.length() >= startFirstIndex) {
|
if (ocrText.length() >= startFirstIndex) {
|
||||||
ocrText = ocrText.substring(startFirstIndex);
|
ocrText = ocrText.substring(startFirstIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StrUtil.isNotEmpty(fatchRule.getEndContent())) {
|
if (StrUtil.isNotEmpty(fatchRule.getEndContent())) {
|
||||||
int endFirstIndex = ocrText.indexOf(fatchRule.getEndContent()) + fatchRule.getEndContent().length();
|
if(ocrText.indexOf(fatchRule.getEndContent())>=0) {
|
||||||
if (ocrText.length() >= (endFirstIndex-fatchRule.getEndContent().length())) {
|
int endFirstIndex = ocrText.indexOf(fatchRule.getEndContent()) + fatchRule.getEndContent().length();
|
||||||
fatchMap.put(fatchRule.getColumn(), ocrText.substring(0, endFirstIndex-fatchRule.getEndContent().length()));
|
if (ocrText.length() >= (endFirstIndex - fatchRule.getEndContent().length())) {
|
||||||
ocrText = ocrText.substring(endFirstIndex-fatchRule.getEndContent().length());
|
fatchMap.put(fatchRule.getColumn(), ocrText.substring(0, endFirstIndex - fatchRule.getEndContent().length()));
|
||||||
|
ocrText = ocrText.substring(endFirstIndex - fatchRule.getEndContent().length());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,12 +129,15 @@
|
|||||||
<!--根据角色和状态过滤-->
|
<!--根据角色和状态过滤-->
|
||||||
<!--被申请人-->
|
<!--被申请人-->
|
||||||
<if test="idCard != null and idCard != ''">
|
<if test="idCard != null and idCard != ''">
|
||||||
or (t.identity_num=#{idCard} AND t.identity_type=2 and (t.case_status=4 or t.case_status=17))
|
or (t.identity_num=#{idCard} AND t.identity_type=2
|
||||||
|
<!-- and (t.case_status=4 or t.case_status=17) -->
|
||||||
|
)
|
||||||
</if>
|
</if>
|
||||||
<!--仲裁员-->
|
<!--仲裁员-->
|
||||||
<if test="userId != null and userId != ''">
|
<if test="userId != null and userId != ''">
|
||||||
or ( t.identity_type=1 and
|
<!-- or ( t.identity_type=1 and
|
||||||
t.case_status in (7,13,17,18)
|
t.case_status in (7,13,17,18) -->
|
||||||
|
or (t.identity_type=1
|
||||||
and
|
and
|
||||||
instr (t.arbitrator_id,#{userId})>0)
|
instr (t.arbitrator_id,#{userId})>0)
|
||||||
</if>
|
</if>
|
||||||
@@ -147,14 +150,17 @@
|
|||||||
<!-- </if>-->
|
<!-- </if>-->
|
||||||
<!--部门长-->
|
<!--部门长-->
|
||||||
<if test="deptHeadStatus != null and deptHeadStatus.size() > 0">
|
<if test="deptHeadStatus != null and deptHeadStatus.size() > 0">
|
||||||
or (t.identity_type=1 and t.case_status in
|
or (t.identity_type=1)
|
||||||
|
<!--and t.case_status in
|
||||||
<foreach item="caseStatus" collection="deptHeadStatus" open="(" separator="," close=")">
|
<foreach item="caseStatus" collection="deptHeadStatus" open="(" separator="," close=")">
|
||||||
#{caseStatus}
|
#{caseStatus}
|
||||||
</foreach>)
|
</foreach>)-->
|
||||||
</if>
|
</if>
|
||||||
<!--财务-->
|
<!--财务-->
|
||||||
<if test="financeStatus != null and financeStatus != ''">
|
<if test="financeStatus != null and financeStatus != ''">
|
||||||
or (t.identity_type=1 and t.case_status =#{financeStatus})
|
or (t.identity_type=1
|
||||||
|
<!-- and t.case_status =#{financeStatus}-->
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
</if>
|
</if>
|
||||||
@@ -165,7 +171,8 @@
|
|||||||
<foreach item="deptId" collection="agentDeptIds" open="(" separator="," close=")">#{deptId}
|
<foreach item="deptId" collection="agentDeptIds" open="(" separator="," close=")">#{deptId}
|
||||||
</foreach>
|
</foreach>
|
||||||
AND t.identity_type=1
|
AND t.identity_type=1
|
||||||
and t.case_status in (0,9))
|
<!-- and t.case_status in (0,9)-->
|
||||||
|
)
|
||||||
|
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
@@ -205,7 +212,8 @@
|
|||||||
JOIN case_affiliate ca ON ca.case_appli_id =c.id AND ca.identity_type = 1
|
JOIN case_affiliate ca ON ca.case_appli_id =c.id AND ca.identity_type = 1
|
||||||
|
|
||||||
<where>
|
<where>
|
||||||
(c.case_status <= 10 or c.case_status=31) AND ca.identity_type=1
|
<!--(c.case_status <= 10 or c.case_status=31) AND-->
|
||||||
|
ca.identity_type=1
|
||||||
|
|
||||||
<if test="applicationOrganId != null and applicationOrganId != ''">
|
<if test="applicationOrganId != null and applicationOrganId != ''">
|
||||||
AND ca.application_organ_id = #{applicationOrganId}
|
AND ca.application_organ_id = #{applicationOrganId}
|
||||||
@@ -295,7 +303,7 @@
|
|||||||
WHERE
|
WHERE
|
||||||
ca.identity_type=1
|
ca.identity_type=1
|
||||||
|
|
||||||
and c.case_status in (1,5,8,9,11,14,15,16,17,31)
|
<!-- and c.case_status in (1,5,8,9,11,14,15,16,17,31)-->
|
||||||
|
|
||||||
<!-- <if test="deptIds != null and deptIds.size() > 0">
|
<!-- <if test="deptIds != null and deptIds.size() > 0">
|
||||||
and ca.application_organ_id in
|
and ca.application_organ_id in
|
||||||
|
|||||||
Reference in New Issue
Block a user