Merge branch 'dev' of http://git.xayunmei.com/SH-Arbitrate/Arbitrate-Backend into qtz3
This commit is contained in:
@@ -182,4 +182,16 @@ imConfig:
|
|||||||
# 腾讯云账户 SecretId
|
# 腾讯云账户 SecretId
|
||||||
secretId: AKID3xfHgroY4MQHvLXUXMwIQL1UjmbBX1Tv
|
secretId: AKID3xfHgroY4MQHvLXUXMwIQL1UjmbBX1Tv
|
||||||
# 腾讯云密钥
|
# 腾讯云密钥
|
||||||
secretKey: INDrIXcT8YmomZBcsy0oNirnU0LTN4X7
|
secretKey: INDrIXcT8YmomZBcsy0oNirnU0LTN4X7
|
||||||
|
#jodconverter:
|
||||||
|
# local:
|
||||||
|
# host: 121.40.189.20
|
||||||
|
#暂时关闭预览,启动时会有点慢
|
||||||
|
# enabled: true
|
||||||
|
#设置libreoffice主目录 linux地址如:/usr/lib64/libreoffice
|
||||||
|
# office-home: /usr/lib64/libreoffice/
|
||||||
|
# office-home: D:\app\libreOffice\
|
||||||
|
#开启多个libreoffice进程,每个端口对应一个进程
|
||||||
|
# port-numbers: 8100
|
||||||
|
#libreoffice进程重启前的最大进程数
|
||||||
|
# max-tasks-per-process: 100
|
||||||
|
|||||||
@@ -11,12 +11,76 @@
|
|||||||
|
|
||||||
<artifactId>ruoyi-common</artifactId>
|
<artifactId>ruoyi-common</artifactId>
|
||||||
|
|
||||||
|
|
||||||
<description>
|
<description>
|
||||||
common通用工具
|
common通用工具
|
||||||
</description>
|
</description>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
|
<!--docx文件下载问题-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi-ooxml</artifactId>
|
||||||
|
<version>4.1.2</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- POI依赖,读取.doc型文档-->
|
||||||
|
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-scratchpad -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi-scratchpad</artifactId>
|
||||||
|
<version>4.1.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-io</groupId>
|
||||||
|
<artifactId>commons-io</artifactId>
|
||||||
|
<version>2.6</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jodconverter</groupId>
|
||||||
|
<artifactId>jodconverter-core</artifactId>
|
||||||
|
<version>4.2.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jodconverter</groupId>
|
||||||
|
<artifactId>jodconverter-local</artifactId>
|
||||||
|
<version>4.2.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jodconverter</groupId>
|
||||||
|
<artifactId>jodconverter-spring-boot-starter</artifactId>
|
||||||
|
<version>4.2.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.artofsolving</groupId>
|
||||||
|
<artifactId>jodconverter</artifactId>
|
||||||
|
<version>2.2.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.openoffice</groupId>
|
||||||
|
<artifactId>jurt</artifactId>
|
||||||
|
<version>3.0.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.openoffice</groupId>
|
||||||
|
<artifactId>ridl</artifactId>
|
||||||
|
<version>3.0.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.openoffice</groupId>
|
||||||
|
<artifactId>juh</artifactId>
|
||||||
|
<version>3.0.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.openoffice</groupId>
|
||||||
|
<artifactId>unoil</artifactId>
|
||||||
|
<version>3.0.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Spring框架基本的核心工具 -->
|
<!-- Spring框架基本的核心工具 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
|
|||||||
+45
-13
@@ -176,11 +176,21 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
|
|||||||
Map<String, String> columnValueMap = columnValueList.stream().collect(Collectors.toMap(ColumnValue::getColumn, ColumnValue::getValue));
|
Map<String, String> columnValueMap = columnValueList.stream().collect(Collectors.toMap(ColumnValue::getColumn, ColumnValue::getValue));
|
||||||
agentName=columnValueMap.get("agentName");
|
agentName=columnValueMap.get("agentName");
|
||||||
resName=columnValueMap.get("respondentName");
|
resName=columnValueMap.get("respondentName");
|
||||||
|
resName=columnValueMap.get("respondentName");
|
||||||
// 懒得if,暂时这样
|
// 懒得if,暂时这样
|
||||||
//
|
//
|
||||||
for (String bookmark : bookmarkList) {
|
for (String bookmark : bookmarkList) {
|
||||||
if(columnValueMap.containsKey(bookmark)){
|
if(columnValueMap.containsKey(bookmark)){
|
||||||
datas.put(bookmark,columnValueMap.get(bookmark));
|
if(bookmark.equals("resSex")){
|
||||||
|
String responSex = columnValueMap.get(bookmark);
|
||||||
|
if (responSex.equals("0")) {
|
||||||
|
datas.put(bookmark, "男");
|
||||||
|
} else {
|
||||||
|
datas.put(bookmark, "女");
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
datas.put(bookmark, columnValueMap.get(bookmark));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
@@ -220,6 +230,23 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
|
|||||||
if (objectiJuris!=null&&objectiJuris == 1) {
|
if (objectiJuris!=null&&objectiJuris == 1) {
|
||||||
datas.put("jurisdictionalObjection", jurisdictionalObjection);
|
datas.put("jurisdictionalObjection", jurisdictionalObjection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 出席庭审人员角色名称
|
||||||
|
String attendName="秘书、";
|
||||||
|
boolean isAbsenceFlag = caseApplicationById.getIsAbsence() != null && caseApplicationById.getIsAbsence().equals(0);
|
||||||
|
boolean appIsAbsenceFlag = caseApplicationById.getAppliIsAbsen() != null && caseApplicationById.getAppliIsAbsen().equals(0);
|
||||||
|
if(isAbsenceFlag||appIsAbsenceFlag){
|
||||||
|
if(isAbsenceFlag) {
|
||||||
|
attendName += "申请代理人" + agentName+"、";
|
||||||
|
}
|
||||||
|
if(appIsAbsenceFlag) {
|
||||||
|
attendName += "被申请人" + resName;
|
||||||
|
}
|
||||||
|
if(attendName.endsWith("、")){
|
||||||
|
agentName=attendName.replace("、","");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 仲裁员名称
|
// 仲裁员名称
|
||||||
datas.put("arbitratorName", caseApplicationById.getArbitratorName());
|
datas.put("arbitratorName", caseApplicationById.getArbitratorName());
|
||||||
// 审理方式
|
// 审理方式
|
||||||
@@ -228,14 +255,16 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
|
|||||||
if (hearDate != null) {
|
if (hearDate != null) {
|
||||||
// 审理日期
|
// 审理日期
|
||||||
String hearDateStr = sdf.format(hearDate);
|
String hearDateStr = sdf.format(hearDate);
|
||||||
|
datas.put("hearDate",hearDateStr);
|
||||||
// todo 线上仲裁/线下仲裁方式未选择
|
// todo 线上仲裁/线下仲裁方式未选择
|
||||||
//线上开庭时
|
//线上开庭时
|
||||||
if (arbitratMethod == 1) {
|
if (arbitratMethod == 1) {
|
||||||
String replace = onLine.replace(onLineDate, hearDateStr);
|
String replace = onLine.replace(onLineDate, Optional.ofNullable(hearDateStr).orElse(""));
|
||||||
datas.put("onLine", replace);
|
datas.put("onLine", replace);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//书面仲裁时
|
//书面仲裁时
|
||||||
String replace = written.replace(writtenDate, hearDateStr);
|
String replace = written.replace(writtenDate, Optional.ofNullable(hearDateStr).orElse(""));
|
||||||
datas.put("written", replace);
|
datas.put("written", replace);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -252,7 +281,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
|
|||||||
if (arbitratMethod == 1) {
|
if (arbitratMethod == 1) {
|
||||||
if (isAbsence != null && isAbsence == 1) {
|
if (isAbsence != null && isAbsence == 1) {
|
||||||
// 被申请人缺席
|
// 被申请人缺席
|
||||||
String absentReplace = absent.replace("{{agentName}}", agentName);
|
String absentReplace = absent.replace("{{agentName}}", Optional.ofNullable(agentName).orElse(""));
|
||||||
datas.put("absent",absentReplace);
|
datas.put("absent",absentReplace);
|
||||||
// 被申请人缺席
|
// 被申请人缺席
|
||||||
String resAbsentReplace=resAbsent;
|
String resAbsentReplace=resAbsent;
|
||||||
@@ -267,7 +296,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
|
|||||||
datas.put("resAbsent",resAbsentReplace);
|
datas.put("resAbsent",resAbsentReplace);
|
||||||
} else {
|
} else {
|
||||||
// 出席
|
// 出席
|
||||||
String attendReplace = attend.replace("{{agentName}}", agentName);
|
String attendReplace = attend.replace("{{agentName}}", Optional.ofNullable(agentName).orElse(""));
|
||||||
datas.put("attend",attend);
|
datas.put("attend",attend);
|
||||||
// 被申请人证据
|
// 被申请人证据
|
||||||
if(caseAttachMap!=null && CollectionUtil.isNotEmpty(caseAttachMap.get(6))){
|
if(caseAttachMap!=null && CollectionUtil.isNotEmpty(caseAttachMap.get(6))){
|
||||||
@@ -281,7 +310,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
|
|||||||
for (CaseAttach caseAttach : caseAttaches) {
|
for (CaseAttach caseAttach : caseAttaches) {
|
||||||
stringBuilder.append(caseAttach.getAnnexName()).append("\n");
|
stringBuilder.append(caseAttach.getAnnexName()).append("\n");
|
||||||
}
|
}
|
||||||
resFileRplace = resFile.replace("{{resFile}}", stringBuilder.toString()).replace("{{applicantOpinion}}", arbitrateRecordSelect.getApplicantOpinion());
|
resFileRplace = resFile.replace("{{resFile}}", stringBuilder.toString()).replace("{{applicantOpinion}}", Optional.ofNullable(arbitrateRecordSelect.getApplicantOpinion()).orElse(""));
|
||||||
}
|
}
|
||||||
datas.put("resFile",resFileRplace);
|
datas.put("resFile",resFileRplace);
|
||||||
}else {
|
}else {
|
||||||
@@ -296,7 +325,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
|
|||||||
for (CaseAttach caseAttach : caseAttaches) {
|
for (CaseAttach caseAttach : caseAttaches) {
|
||||||
stringBuilder.append(caseAttach.getAnnexName()).append("\n");
|
stringBuilder.append(caseAttach.getAnnexName()).append("\n");
|
||||||
}
|
}
|
||||||
resAttendOpinionReplace = resAttendOpinion.replace("{{applicantFile}}", stringBuilder.toString()).replace("{{respondentOpinion}}", arbitrateRecordSelect.getRespondentOpinion());
|
resAttendOpinionReplace = resAttendOpinion.replace("{{applicantFile}}", stringBuilder.toString()).replace("{{respondentOpinion}}", arbitrateRecordSelect.getRespondentOpinion()==null?"":arbitrateRecordSelect.getRespondentOpinion());
|
||||||
}
|
}
|
||||||
|
|
||||||
datas.put("resAttendOpinion",resAttendOpinionReplace);
|
datas.put("resAttendOpinion",resAttendOpinionReplace);
|
||||||
@@ -306,13 +335,16 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
|
|||||||
|
|
||||||
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());
|
||||||
String modalFilePath = "/data/arbitrate-document/template/新裁决书模板.docx";
|
// todo
|
||||||
// String modalFilePath = "D:/新裁决书模板.docx";
|
// String modalFilePath = "/data/arbitrate-document/template/新裁决书模板.docx";
|
||||||
// todo 服务器路径
|
String modalFilePath = templatePath;
|
||||||
String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
|
// todo
|
||||||
// String saveFolderPath = "D:/";
|
// String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
|
||||||
|
String saveFolderPath = "D:/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
|
||||||
String fileName = UUID.randomUUID().toString().replace("-", "") + ".docx";
|
String fileName = UUID.randomUUID().toString().replace("-", "") + ".docx";
|
||||||
String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
|
// todo
|
||||||
|
// String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
|
||||||
|
String saveName = "D:/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day + "/" + fileName;
|
||||||
String resultFilePath = saveFolderPath + "/" + fileName;
|
String resultFilePath = saveFolderPath + "/" + fileName;
|
||||||
// 创建日期目录
|
// 创建日期目录
|
||||||
File saveFolder = new File(saveFolderPath);
|
File saveFolder = new File(saveFolderPath);
|
||||||
|
|||||||
+123
-110
@@ -49,6 +49,13 @@ import com.tencentyun.TLSSigAPIv2;
|
|||||||
|
|
||||||
import org.apache.pdfbox.pdmodel.PDDocument;
|
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||||
|
|
||||||
|
|
||||||
|
import org.apache.poi.hwpf.extractor.WordExtractor;
|
||||||
|
import org.apache.poi.ooxml.POIXMLDocument;
|
||||||
|
import org.apache.poi.ooxml.extractor.POIXMLTextExtractor;
|
||||||
|
import org.apache.poi.openxml4j.opc.OPCPackage;
|
||||||
|
import org.apache.poi.xwpf.extractor.XWPFWordExtractor;
|
||||||
|
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;
|
||||||
@@ -1162,11 +1169,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|||||||
maxVersion = 1;
|
maxVersion = 1;
|
||||||
}
|
}
|
||||||
caseApplication.setVersion(maxVersion + 1);
|
caseApplication.setVersion(maxVersion + 1);
|
||||||
// 将修改提交状态改为未提交
|
|
||||||
// caseApplication.setUpdateSubmitStatus(UpdateSubmitStatus.UNCOMMITTED.getCode());
|
|
||||||
// 修改案件表的版本号
|
|
||||||
// caseApplicationMapper.updateVersionById(caseApplication.getId(),caseApplication.getVersion());
|
|
||||||
|
|
||||||
// 异步新增案件日志
|
// 异步新增案件日志
|
||||||
ThreadPoolUtil.execute(() -> {
|
ThreadPoolUtil.execute(() -> {
|
||||||
try {
|
try {
|
||||||
@@ -2882,6 +2884,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|||||||
* @param userId
|
* @param userId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String generateUserSign(String userId) {
|
public String generateUserSign(String userId) {
|
||||||
TLSSigAPIv2 tlsSigAPIv2 = new TLSSigAPIv2(sdkAppId, sdkSecretKey);
|
TLSSigAPIv2 tlsSigAPIv2 = new TLSSigAPIv2(sdkAppId, sdkSecretKey);
|
||||||
return tlsSigAPIv2.genUserSig(userId, 60 * 60 * 10);
|
return tlsSigAPIv2.genUserSig(userId, 60 * 60 * 10);
|
||||||
@@ -3023,7 +3026,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|||||||
if (unzipSuccess) {
|
if (unzipSuccess) {
|
||||||
// 查询抓取规则
|
// 查询抓取规则
|
||||||
// todo 批次需要再上传压缩包时用户填写
|
// todo 批次需要再上传压缩包时用户填写
|
||||||
List<FatchRule> fatchRuleList = fatchRuleMapper.listByTemplateId(17L);
|
List<FatchRule> fatchRuleList = fatchRuleMapper.listByTemplateId(templateId);
|
||||||
if (CollectionUtil.isEmpty(fatchRuleList)) {
|
if (CollectionUtil.isEmpty(fatchRuleList)) {
|
||||||
return error("未设置抓取规则");
|
return error("未设置抓取规则");
|
||||||
}
|
}
|
||||||
@@ -3041,14 +3044,13 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|||||||
if (fatchMap.size() <= 0) {
|
if (fatchMap.size() <= 0) {
|
||||||
return error("从压缩包中未抓取到内容,请检查抓取字段配置");
|
return error("从压缩包中未抓取到内容,请检查抓取字段配置");
|
||||||
}
|
}
|
||||||
if (fatchMap.size() > 0) {
|
|
||||||
|
|
||||||
// todo 从压缩包中识别各字段填充到数据库
|
// todo 从压缩包中识别各字段填充到数据库
|
||||||
//调用新增案件的接口
|
//调用新增案件的接口
|
||||||
CaseApplication caseApplication = new CaseApplication();
|
CaseApplication caseApplication = new CaseApplication();
|
||||||
caseApplication.setTemplateId(templateId);
|
caseApplication.setTemplateId(templateId);
|
||||||
//默认案件标的 todo 案件标的是什么
|
//默认案件标的 todo 案件标的是什么,默认写死
|
||||||
caseApplication.setCaseSubjectAmount(new BigDecimal(1));
|
caseApplication.setCaseSubjectAmount(new BigDecimal(10000));
|
||||||
// todo 这些以后要去掉,不在案件基本信息表维护,现在往基本信息表设置字段是因为修改以及查询详情的时候页面中字段是固定的,以后也要动态维护字段
|
// todo 这些以后要去掉,不在案件基本信息表维护,现在往基本信息表设置字段是因为修改以及查询详情的时候页面中字段是固定的,以后也要动态维护字段
|
||||||
// 仲裁请求
|
// 仲裁请求
|
||||||
caseApplication.setArbitratClaims(fatchMap.get("arbitrationClaims"));
|
caseApplication.setArbitratClaims(fatchMap.get("arbitrationClaims"));
|
||||||
@@ -3159,14 +3161,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|||||||
caseAffiliate.setResidenAffili(fatchMap.get("applicantHome"));
|
caseAffiliate.setResidenAffili(fatchMap.get("applicantHome"));
|
||||||
// 申请人联系地址
|
// 申请人联系地址
|
||||||
caseAffiliate.setContactAddress(fatchMap.get("applicantAddress"));
|
caseAffiliate.setContactAddress(fatchMap.get("applicantAddress"));
|
||||||
// if(map.get("职务").size()>0) {
|
|
||||||
// // 法定代表人职务
|
// // 法定代表人职务
|
||||||
// caseAffiliate.setCompLegalperPost(map.get("职务").get(0));
|
caseAffiliate.setCompLegalperPost(fatchMap.get("compLegalperPost"));
|
||||||
// if(map.get("职务").size()>1) {
|
|
||||||
// // 代理人职务
|
|
||||||
// caseAffiliate.setAppliAgentTitle(map.get("职务").get(1));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// 委托代理人
|
// 委托代理人
|
||||||
caseAffiliate.setNameAgent(fatchMap.get("agentName"));
|
caseAffiliate.setNameAgent(fatchMap.get("agentName"));
|
||||||
// 委托代理人联系电话
|
// 委托代理人联系电话
|
||||||
@@ -3228,7 +3224,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|||||||
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("情况说明")) {
|
|
||||||
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();
|
||||||
@@ -3238,7 +3233,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|||||||
// 申请人提供的证据材料
|
// 申请人提供的证据材料
|
||||||
caseAttach.setAnnexType(2);
|
caseAttach.setAnnexType(2);
|
||||||
caseAttachs.add(caseAttach);
|
caseAttachs.add(caseAttach);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (CollectionUtil.isNotEmpty(caseAttachs)) {
|
if (CollectionUtil.isNotEmpty(caseAttachs)) {
|
||||||
// 新增申请人证据材料
|
// 新增申请人证据材料
|
||||||
@@ -3246,9 +3241,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|||||||
}
|
}
|
||||||
return AjaxResult.success("导入成功");
|
return AjaxResult.success("导入成功");
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return AjaxResult.error("文件识别内容失败,请检查");
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// 没有找到符合条件的文件
|
// 没有找到符合条件的文件
|
||||||
@@ -3289,27 +3282,117 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String readerTxtFile(String filePath){
|
||||||
|
BufferedReader br=null;
|
||||||
|
StringBuilder result=new StringBuilder();
|
||||||
|
try {
|
||||||
|
br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(filePath)),"GBK"));
|
||||||
|
String line=null;
|
||||||
|
while ((line=br.readLine())!=null) {
|
||||||
|
result.append(line).append("\n");
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
if (null!=br){
|
||||||
|
try {
|
||||||
|
br.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result.toString();
|
||||||
|
}
|
||||||
|
public static String readWord(String filePath) throws Exception{
|
||||||
|
|
||||||
|
File file = new File(filePath);
|
||||||
|
if(file.length()==0) return ""; // 需要操作原因是可能会空文件问题,如果不做处理,在下面读取中会报错
|
||||||
|
StringBuffer sb = new StringBuffer();
|
||||||
|
String buffer = "";
|
||||||
|
try {
|
||||||
|
if (filePath.endsWith(".doc")) {
|
||||||
|
InputStream is = new FileInputStream(file);
|
||||||
|
WordExtractor ex = new WordExtractor(is);
|
||||||
|
buffer = ex.getText();
|
||||||
|
if(buffer.length() > 0){
|
||||||
|
//使用回车换行符分割字符串
|
||||||
|
String [] arry = buffer.split("r\\n");
|
||||||
|
for (String string : arry) {
|
||||||
|
sb.append(string.trim());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (filePath.endsWith(".docx")) {
|
||||||
|
FileInputStream fis = new FileInputStream(file);
|
||||||
|
XWPFDocument xdoc = new XWPFDocument(fis);
|
||||||
|
XWPFWordExtractor extractor = new XWPFWordExtractor(xdoc);
|
||||||
|
buffer = extractor.getText();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// OPCPackage opcPackage = POIXMLDocument.openPackage(filePath);
|
||||||
|
// XWPFWordExtractor extractor = new XWPFWordExtractor(opcPackage);
|
||||||
|
// buffer = extractor.getText();
|
||||||
|
if(buffer.length() > 0){
|
||||||
|
//使用换行符分割字符串
|
||||||
|
String [] arry = buffer.split("\r\n");
|
||||||
|
for (String string : arry) {
|
||||||
|
sb.append(string.trim());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.print("error---->"+filePath);
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private boolean OCRAndBuildInfo( Map<String, String> andConvertPDF,String mapKey, Map<String, String> map, List<FatchRule> fatchRules) {
|
private boolean OCRAndBuildInfo( Map<String, String> andConvertPDF,String mapKey, Map<String, String> map, List<FatchRule> fatchRules) {
|
||||||
String pdfUrl = andConvertPDF.get(mapKey);
|
String pdfUrl = andConvertPDF.get(mapKey);
|
||||||
|
|
||||||
if(StrUtil.isNotEmpty(pdfUrl)) {
|
if(StrUtil.isNotEmpty(pdfUrl)) {
|
||||||
//获取文件的页数
|
if(pdfUrl.endsWith("txt")){
|
||||||
int fileNumPage = getFileNumPage(pdfUrl);
|
String readerFile = readerTxtFile(pdfUrl);
|
||||||
//文件转成base64
|
if(StrUtil.isNotEmpty(readerFile)){
|
||||||
String base64 = OCRUtils.pdfConvertBase64(pdfUrl);
|
OCRUtils.fatchRuleGetContent(readerFile, fatchRules,map);
|
||||||
if (base64 == null) {
|
}
|
||||||
throw new ServiceException("文件转成base64,转码失败");
|
|
||||||
// return false;
|
}else if(pdfUrl.endsWith("doc")||pdfUrl.endsWith("docx")){
|
||||||
}
|
// doc,docx,text识别内容
|
||||||
StringBuilder ocrText = new StringBuilder(); // 创建一个StringBuilder对象
|
String readerFile = null;
|
||||||
for (int i = 1; i <= fileNumPage; i++) {
|
try {
|
||||||
//对接腾讯云接口.识别里面的数据
|
readerFile = readWord(pdfUrl);
|
||||||
String text = OCRUtils.pdfIdentifyText(base64, i , fatchRules);
|
} catch (Exception e) {
|
||||||
ocrText.append(text); // 拼接当前的字符串
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
if(StrUtil.isNotEmpty(ocrText)){
|
if(StrUtil.isNotEmpty(readerFile)){
|
||||||
OCRUtils.fatchRuleGetContent(ocrText.toString(), fatchRules,map);
|
OCRUtils.fatchRuleGetContent(readerFile, fatchRules,map);
|
||||||
|
}
|
||||||
|
|
||||||
|
}else if(pdfUrl.endsWith("pdf")){
|
||||||
|
//获取文件的页数
|
||||||
|
int fileNumPage = getFileNumPage(pdfUrl);
|
||||||
|
//文件转成base64
|
||||||
|
String base64 = OCRUtils.pdfConvertBase64(pdfUrl);
|
||||||
|
if (base64 == null) {
|
||||||
|
throw new ServiceException("文件转成base64,转码失败");
|
||||||
|
// return false;
|
||||||
|
}
|
||||||
|
StringBuilder ocrText = new StringBuilder(); // 创建一个StringBuilder对象
|
||||||
|
for (int i = 1; i <= fileNumPage; i++) {
|
||||||
|
//对接腾讯云接口.识别里面的数据
|
||||||
|
String text = OCRUtils.pdfIdentifyText(base64, i, fatchRules);
|
||||||
|
ocrText.append(text); // 拼接当前的字符串
|
||||||
|
if(StrUtil.isNotEmpty(ocrText)){
|
||||||
|
OCRUtils.fatchRuleGetContent(ocrText.toString(), fatchRules,map);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -3374,33 +3457,10 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|||||||
Map<String,String> pdfPathMap= new HashMap<>();
|
Map<String,String> pdfPathMap= new HashMap<>();
|
||||||
if (directory.isFile()) {
|
if (directory.isFile()) {
|
||||||
String path = "";
|
String path = "";
|
||||||
String fileName = "";
|
|
||||||
// 如果传入的参数是一个文件
|
// 如果传入的参数是一个文件
|
||||||
// if (directory.getName().contains("仲裁申请书")) {
|
|
||||||
if (isPDF(directory)) {
|
|
||||||
// 如果文件名包含"仲裁申请书"且是PDF格式,直接返回路径
|
|
||||||
path = directory.getAbsolutePath();
|
path = directory.getAbsolutePath();
|
||||||
} else {
|
pdfPathMap.put(directory.getName(), path);
|
||||||
String extension = getFileExtension(directory);
|
|
||||||
if( extension.contains("doc")|| extension.contains("docx")) {
|
|
||||||
// 如果不是PDF格式,进行转换成PDF并返回路径
|
|
||||||
String pdfPath = convertToPDF(directory);
|
|
||||||
if (pdfPath != null) {
|
|
||||||
path = pdfPath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 如果文件名包含"仲裁申请书"且是PDF格式,直接返回路径
|
|
||||||
// 如果是PDF格式,直接添加到列表中
|
|
||||||
// if(CollectionUtil.isNotEmpty(fatchRuleList)) {
|
|
||||||
// for (FatchRule fatchRule : fatchRuleList) {
|
|
||||||
// if(fatchRule.getFileName().contains(directory.getName())){
|
|
||||||
pdfPathMap.put(directory.getName(), path);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
} else if (directory.isDirectory()) {
|
} else if (directory.isDirectory()) {
|
||||||
searchAndConvertPDF(directory, pdfPathMap);
|
searchAndConvertPDF(directory, pdfPathMap);
|
||||||
} else {
|
} else {
|
||||||
@@ -3432,21 +3492,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|||||||
}
|
}
|
||||||
if (file.isFile()) {
|
if (file.isFile()) {
|
||||||
|
|
||||||
// 如果是文件且文件名包含"仲裁申请书"
|
pdfPathMap.put(file.getName(),file.getAbsolutePath());
|
||||||
// if (file.getName().contains("仲裁申请书")) {
|
|
||||||
if (isPDF(file)) {
|
|
||||||
// 如果是PDF格式,直接添加到列表中
|
|
||||||
pdfPathMap.put(file.getName(),file.getAbsolutePath());
|
|
||||||
} else {
|
|
||||||
// 如果不是PDF格式,进行转换成PDF并添加转换后的路径到列表中
|
|
||||||
String pdfPath = convertToPDF(file);
|
|
||||||
if (pdfPath != null) {
|
|
||||||
// 如果是PDF格式,直接添加到列表中
|
|
||||||
pdfPathMap.put(file.getName(),pdfPath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// }
|
|
||||||
} else if (file.isDirectory()) {
|
} else if (file.isDirectory()) {
|
||||||
// 如果是目录,递归查找
|
// 如果是目录,递归查找
|
||||||
searchAndConvertPDF(file, pdfPathMap);
|
searchAndConvertPDF(file, pdfPathMap);
|
||||||
@@ -3455,39 +3501,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String convertToPDF(File file) {
|
|
||||||
String wordFilePath = file.getAbsolutePath();
|
|
||||||
// todo
|
|
||||||
String pdfSaveDirectory = "/home/ruoyi/uploadPath/upload/wordToPDF/";
|
|
||||||
// String pdfSaveDirectory = "D:/home/ruoyi/uploadPath/upload/wordToPDF/";
|
|
||||||
File directory = new File(pdfSaveDirectory);
|
|
||||||
if (!directory.exists()) {
|
|
||||||
directory.mkdirs();
|
|
||||||
}
|
|
||||||
String name = file.getName();
|
|
||||||
String nameWithoutExtension = name.substring(0, name.lastIndexOf("."));
|
|
||||||
|
|
||||||
String pdfFilePath = pdfSaveDirectory + nameWithoutExtension + ".pdf";
|
|
||||||
File inputWord = new File(wordFilePath);
|
|
||||||
if(!inputWord.exists()){
|
|
||||||
throw new ServiceException("文件不存在wordFilePath:"+wordFilePath);
|
|
||||||
}
|
|
||||||
File outputFile = new File(pdfFilePath);
|
|
||||||
|
|
||||||
try {
|
|
||||||
InputStream docxInputStream = new FileInputStream(inputWord);
|
|
||||||
OutputStream outputStream = new FileOutputStream(outputFile);
|
|
||||||
IConverter converter = LocalConverter.builder().build();
|
|
||||||
converter.convert(docxInputStream).as(DocumentType.DOCX).to(outputStream).as(DocumentType.PDF).execute();
|
|
||||||
docxInputStream.close();
|
|
||||||
outputStream.close();
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new ServiceException(e.getMessage()+"wordFilePath:"+wordFilePath+"pdfFilePath:"+pdfFilePath);
|
|
||||||
// e.printStackTrace();
|
|
||||||
}
|
|
||||||
return pdfFilePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int getFileNumPage(String pdfUrl) {
|
private static int getFileNumPage(String pdfUrl) {
|
||||||
File pdfFile = new File(pdfUrl);
|
File pdfFile = new File(pdfUrl);
|
||||||
|
|||||||
@@ -1432,7 +1432,7 @@
|
|||||||
c.disputes,
|
c.disputes,
|
||||||
c.loan_type,
|
c.loan_type,
|
||||||
c.loan_term,
|
c.loan_term,
|
||||||
c.mediation_agreement
|
c.mediation_agreement,c.template_id templateId
|
||||||
from case_application c
|
from case_application c
|
||||||
LEFT JOIN case_affiliate ca ON ca.case_appli_id = c.id and ca.identity_type=1
|
LEFT JOIN case_affiliate ca ON ca.case_appli_id = c.id and ca.identity_type=1
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
<select id="selectFatchRuleList" parameterType="FatchRule" resultMap="BaseResultMap">
|
<select id="selectFatchRuleList" parameterType="FatchRule" resultMap="BaseResultMap">
|
||||||
SELECT f.id ,f.file_name ,f.start_content ,f.end_content ,
|
SELECT f.id ,f.file_name ,f.start_content ,f.end_content ,
|
||||||
f.`column` ,f.is_default ,f.columnName
|
f.`column` ,f.is_default ,f.`column_name`
|
||||||
FROM template_fatch_rule tf
|
FROM template_fatch_rule tf
|
||||||
left join template_manage t on tf.template_id = t.id
|
left join template_manage t on tf.template_id = t.id
|
||||||
LEFT JOIN fatch_rule f on tf.fatch_rule_id = f.id
|
LEFT JOIN fatch_rule f on tf.fatch_rule_id = f.id
|
||||||
@@ -65,7 +65,7 @@
|
|||||||
|
|
||||||
<select id="selectFatchRuleListIsDefault" parameterType="FatchRule" resultMap="BaseResultMap">
|
<select id="selectFatchRuleListIsDefault" parameterType="FatchRule" resultMap="BaseResultMap">
|
||||||
SELECT f.id ,f.file_name ,f.start_content ,f.end_content ,
|
SELECT f.id ,f.file_name ,f.start_content ,f.end_content ,
|
||||||
f.`column` ,f.is_default ,f.columnName
|
f.`column` ,f.is_default ,f.`column_name`
|
||||||
FROM fatch_rule f
|
FROM fatch_rule f
|
||||||
<where>
|
<where>
|
||||||
<if test="isDefault != null">
|
<if test="isDefault != null">
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
<if test="startContent != null and startContent != ''">start_content,</if>
|
<if test="startContent != null and startContent != ''">start_content,</if>
|
||||||
<if test="endContent != null and endContent != ''">end_content,</if>
|
<if test="endContent != null and endContent != ''">end_content,</if>
|
||||||
<if test="column != null and column != ''">`column`,</if>
|
<if test="column != null and column != ''">`column`,</if>
|
||||||
<if test="columnName != null and columnName != ''">columnName,</if>
|
<if test="columnName != null and columnName != ''">`column_name`,</if>
|
||||||
<if test="isDefault != null">is_default</if>
|
<if test="isDefault != null">is_default</if>
|
||||||
)values(
|
)values(
|
||||||
<if test="fileName != null and fileName != ''">#{fileName},</if>
|
<if test="fileName != null and fileName != ''">#{fileName},</if>
|
||||||
|
|||||||
Reference in New Issue
Block a user