|
@@ -57,6 +57,8 @@ import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Propagation;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import java.io.*;
|
|
@@ -117,6 +119,7 @@ public class CaseFileService extends ServiceImpl<CaseFileMapper, CaseFile> {
|
|
|
* @return
|
|
|
*/
|
|
|
// @Scheduled(cron = "0 0 1 * * ?")
|
|
|
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Throwable.class)
|
|
|
public void getCaseInfoByHanding() throws Exception {
|
|
|
//重试机制
|
|
|
int retry = 0;
|
|
@@ -269,11 +272,12 @@ public class CaseFileService extends ServiceImpl<CaseFileMapper, CaseFile> {
|
|
|
|
|
|
/**
|
|
|
* 根据新申请类型,状态为递交中条件去查询当前时间的案件
|
|
|
- * 每日定时02:00启动方法
|
|
|
+ * 每日定时03:00启动方法
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
-// @Scheduled(cron = "0 0 3 * * ?")
|
|
|
+ @Scheduled(cron = "0 30 14 * * ?")
|
|
|
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Throwable.class)
|
|
|
public void getCaseInfoByFinish() throws Exception {
|
|
|
int retry = 0;
|
|
|
int retrySum = 3;
|
|
@@ -446,6 +450,7 @@ public class CaseFileService extends ServiceImpl<CaseFileMapper, CaseFile> {
|
|
|
* @return
|
|
|
* @throws IOException
|
|
|
*/
|
|
|
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Throwable.class)
|
|
|
public List<String> getCaseInfo(String cookie, String uuid, String number) throws Exception {
|
|
|
byte[] bytes = getReportInfoFromWDService.exportFileFromWD(cookie, uuid, number);
|
|
|
//创建临时文件tempFile,并将文件读取到tempFile
|
|
@@ -612,7 +617,7 @@ public class CaseFileService extends ServiceImpl<CaseFileMapper, CaseFile> {
|
|
|
JSONObject jsonObject1 = JSONObject.parseObject(caseInfo);
|
|
|
List<GetCaseInfoByWDVO> caseInfoRows = JSONArray.parseArray(jsonObject1.getString("TableRows"), GetCaseInfoByWDVO.class);
|
|
|
if (!CollectionUtils.isEmpty(caseInfoRows)) {
|
|
|
- GetCaseInfoByWDVO caseInfoByWDVO = caseInfoRows.stream().filter(i -> i.getCtrl_proc().equals("新申请")).findFirst().orElse(new GetCaseInfoByWDVO());
|
|
|
+ GetCaseInfoByWDVO caseInfoByWDVO = caseInfoRows.stream().filter(i -> i.getCtrl_proc().equals("新申请")).findFirst().orElse(null);
|
|
|
if (ObjectUtils.isNotEmpty(caseInfoByWDVO)) {
|
|
|
String procId = caseInfoByWDVO.getProc_id();
|
|
|
GetPatentActionByWDDTO vo = new GetPatentActionByWDDTO();
|
|
@@ -648,7 +653,7 @@ public class CaseFileService extends ServiceImpl<CaseFileMapper, CaseFile> {
|
|
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
|
|
List<TableRowsVO> rowsVOS = JSON.parseArray(jsonObject.getString("TableRows"), TableRowsVO.class);
|
|
|
if (!CollectionUtils.isEmpty(rowsVOS)) {
|
|
|
- TableRowsVO rowsVO = rowsVOS.stream().filter(i -> i.getFile_desc().equals("新申请第一次内审")).findFirst().orElse(new TableRowsVO());
|
|
|
+ TableRowsVO rowsVO = rowsVOS.stream().filter(i -> i.getFile_desc().equals("新申请第一次内审")).findFirst().orElse(null);
|
|
|
if (ObjectUtils.isNotEmpty(rowsVO)) {
|
|
|
GetBaseInfoByWDDTO getBaseInfoByWDDTO = new GetBaseInfoByWDDTO();
|
|
|
getBaseInfoByWDDTO.setFile_no(rowsVO.getFile_no());
|
|
@@ -658,7 +663,7 @@ public class CaseFileService extends ServiceImpl<CaseFileMapper, CaseFile> {
|
|
|
this.uploadCaseFile(cookieStr, baseInfoByWDVO.getFile_guid(), baseInfoByWDVO.getFile_size(),
|
|
|
rowsVO.getFile_name(), caseNo, 1);
|
|
|
}
|
|
|
- TableRowsVO rowsVO1 = rowsVOS.stream().filter(i -> i.getFile_desc().equals("新申请第一次返稿")).findFirst().orElse(new TableRowsVO());
|
|
|
+ TableRowsVO rowsVO1 = rowsVOS.stream().filter(i -> i.getFile_desc().equals("新申请第一次返稿")).findFirst().orElse(null);
|
|
|
if (ObjectUtils.isNotEmpty(rowsVO1)) {
|
|
|
GetBaseInfoByWDDTO getBaseInfoByWDDTO = new GetBaseInfoByWDDTO();
|
|
|
getBaseInfoByWDDTO.setFile_no(rowsVO1.getFile_no());
|
|
@@ -668,7 +673,7 @@ public class CaseFileService extends ServiceImpl<CaseFileMapper, CaseFile> {
|
|
|
this.uploadCaseFile(cookieStr, baseInfoByWDVO.getFile_guid(), baseInfoByWDVO.getFile_size(),
|
|
|
rowsVO1.getFile_name(), caseNo, 2);
|
|
|
}
|
|
|
- TableRowsVO rowsVO2 = rowsVOS.stream().filter(i -> i.getFile_desc().equals("新申请文档")).findFirst().orElse(new TableRowsVO());
|
|
|
+ TableRowsVO rowsVO2 = rowsVOS.stream().filter(i -> i.getFile_desc().equals("新申请文档")).findFirst().orElse(null);
|
|
|
if (ObjectUtils.isNotEmpty(rowsVO2)) {
|
|
|
GetBaseInfoByWDDTO getBaseInfoByWDDTO = new GetBaseInfoByWDDTO();
|
|
|
getBaseInfoByWDDTO.setFile_no(rowsVO2.getFile_no());
|
|
@@ -692,6 +697,7 @@ public class CaseFileService extends ServiceImpl<CaseFileMapper, CaseFile> {
|
|
|
* @param type
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Throwable.class)
|
|
|
public void uploadCaseFile(String cookie, String guid, String number, String fileName, String caseNo, Integer type) throws Exception {
|
|
|
CaseFile caseFile = caseFileMapper.selectOne(new LambdaQueryWrapper<CaseFile>()
|
|
|
.eq(CaseFile::getCaseNo, caseNo));
|
|
@@ -702,12 +708,12 @@ public class CaseFileService extends ServiceImpl<CaseFileMapper, CaseFile> {
|
|
|
if (ObjectUtils.isEmpty(assoCaseFile1)) {
|
|
|
byte[] bytes = getReportInfoFromWDService.exportFileFromWD(cookie, guid, number);//创建临时文件tempFile,并将文件读取到tempFile
|
|
|
File tempFile = null;
|
|
|
- if (fileName.endsWith(".docx")) {
|
|
|
- tempFile = File.createTempFile("temp_", ".docx");
|
|
|
- } else if (fileName.endsWith(".doc")) {
|
|
|
+ if (fileName.endsWith(".doc")) {
|
|
|
tempFile = File.createTempFile("temp_", ".doc");
|
|
|
} else if (fileName.endsWith(".zip")) {
|
|
|
tempFile = File.createTempFile("temp_", ".zip");
|
|
|
+ } else {
|
|
|
+ tempFile = File.createTempFile("temp_", ".docx");
|
|
|
}
|
|
|
List<String> ids = new ArrayList<>();
|
|
|
try (
|
|
@@ -715,7 +721,7 @@ public class CaseFileService extends ServiceImpl<CaseFileMapper, CaseFile> {
|
|
|
FileOutputStream outputStream = new FileOutputStream(tempFile)
|
|
|
) {
|
|
|
IOUtils.copy(inputStream, outputStream); // 将输入流复制到临时文件
|
|
|
- if (fileName.endsWith(".docx") || fileName.equals(".doc")) {
|
|
|
+ if (fileName.endsWith(".docx") || fileName.endsWith(".doc")) {
|
|
|
ids = fileManagerService.uploadFileGetGuid2(Collections.singletonList(tempFile));
|
|
|
} else if (fileName.endsWith(".zip")) {
|
|
|
String tempDirectoryName = IdUtil.simpleUUID();
|
|
@@ -781,45 +787,51 @@ public class CaseFileService extends ServiceImpl<CaseFileMapper, CaseFile> {
|
|
|
* @param caseNo
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Throwable.class)
|
|
|
public void addDiscrepancy(String caseNo) throws Exception {
|
|
|
CaseFile caseFile = caseFileMapper.selectOne(new LambdaQueryWrapper<CaseFile>()
|
|
|
.eq(CaseFile::getCaseNo, caseNo));
|
|
|
if (ObjectUtils.isNotEmpty(caseFile)) {
|
|
|
List<AssoCaseFile> assoCaseFiles = assoCaseFileMapper.selectList(new LambdaQueryWrapper<AssoCaseFile>()
|
|
|
.eq(AssoCaseFile::getCaseId, caseFile.getId()));
|
|
|
- AssoCaseFile assoCaseFile1 = assoCaseFiles.stream().filter(i -> i.getFileType() == 1).findFirst().orElse(new AssoCaseFile());
|
|
|
- AssoCaseFile assoCaseFile2 = assoCaseFiles.stream().filter(i -> i.getFileType() == 2).findFirst().orElse(new AssoCaseFile());
|
|
|
- AssoCaseFile assoCaseFile3 = assoCaseFiles.stream().filter(i -> i.getFileType() == 3).findFirst().orElse(new AssoCaseFile());
|
|
|
- if (ObjectUtils.isNotEmpty(assoCaseFile1) && ObjectUtils.isNotEmpty(assoCaseFile2)) {
|
|
|
- Discrepancy discrepancy1 = discrepancyMapper.selectOne(new LambdaQueryWrapper<Discrepancy>()
|
|
|
- .eq(Discrepancy::getCaseFileId1, assoCaseFile1.getId())
|
|
|
- .eq(Discrepancy::getCaseFileId2, assoCaseFile2.getId()));
|
|
|
- if (ObjectUtils.isEmpty(discrepancy1)) {
|
|
|
- Discrepancy discrepancy = new Discrepancy();
|
|
|
- discrepancy.setCaseId(caseFile.getId());
|
|
|
- discrepancy.setCaseFileId1(assoCaseFile1.getId());
|
|
|
- discrepancy.setCaseFileId2(assoCaseFile2.getId());
|
|
|
- discrepancy.setDiscrepancyType(1);
|
|
|
- discrepancy.insert();
|
|
|
+ if (assoCaseFiles.size() != 3) {
|
|
|
+ caseFileMapper.deleteById(caseFile.getId());
|
|
|
+ } else {
|
|
|
+ AssoCaseFile assoCaseFile1 = assoCaseFiles.stream().filter(i -> i.getFileType() == 1).findFirst().orElse(null);
|
|
|
+ AssoCaseFile assoCaseFile2 = assoCaseFiles.stream().filter(i -> i.getFileType() == 2).findFirst().orElse(null);
|
|
|
+ AssoCaseFile assoCaseFile3 = assoCaseFiles.stream().filter(i -> i.getFileType() == 3).findFirst().orElse(null);
|
|
|
+ if (ObjectUtils.isNotEmpty(assoCaseFile1) && ObjectUtils.isNotEmpty(assoCaseFile2)) {
|
|
|
+ Discrepancy discrepancy1 = discrepancyMapper.selectOne(new LambdaQueryWrapper<Discrepancy>()
|
|
|
+ .eq(Discrepancy::getCaseFileId1, assoCaseFile1.getId())
|
|
|
+ .eq(Discrepancy::getCaseFileId2, assoCaseFile2.getId()));
|
|
|
+ if (ObjectUtils.isEmpty(discrepancy1)) {
|
|
|
+ Discrepancy discrepancy = new Discrepancy();
|
|
|
+ discrepancy.setCaseId(caseFile.getId());
|
|
|
+ discrepancy.setCaseFileId1(assoCaseFile1.getId());
|
|
|
+ discrepancy.setCaseFileId2(assoCaseFile2.getId());
|
|
|
+ discrepancy.setDiscrepancyType(1);
|
|
|
+ discrepancy.insert();
|
|
|
|
|
|
- this.getFile(assoCaseFile1.getFileGuid(), assoCaseFile2.getFileGuid(), discrepancy.getId(), assoCaseFile1.getFileName(), assoCaseFile2.getFileName());
|
|
|
+ this.getFile(assoCaseFile1.getFileGuid(), assoCaseFile2.getFileGuid(), discrepancy.getId(), assoCaseFile1.getFileName(), assoCaseFile2.getFileName());
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- if (ObjectUtils.isNotEmpty(assoCaseFile2) && ObjectUtils.isNotEmpty(assoCaseFile3)) {
|
|
|
- Discrepancy discrepancy2 = discrepancyMapper.selectOne(new LambdaQueryWrapper<Discrepancy>()
|
|
|
- .eq(Discrepancy::getCaseFileId1, assoCaseFile2.getId())
|
|
|
- .eq(Discrepancy::getCaseFileId2, assoCaseFile3.getId()));
|
|
|
- if (ObjectUtils.isEmpty(discrepancy2)) {
|
|
|
- Discrepancy discrepancy = new Discrepancy();
|
|
|
- discrepancy.setCaseId(caseFile.getId());
|
|
|
- discrepancy.setCaseFileId1(assoCaseFile2.getId());
|
|
|
- discrepancy.setCaseFileId2(assoCaseFile3.getId());
|
|
|
- discrepancy.setDiscrepancyType(2);
|
|
|
- discrepancy.insert();
|
|
|
+ if (ObjectUtils.isNotEmpty(assoCaseFile2) && ObjectUtils.isNotEmpty(assoCaseFile3)) {
|
|
|
+ Discrepancy discrepancy2 = discrepancyMapper.selectOne(new LambdaQueryWrapper<Discrepancy>()
|
|
|
+ .eq(Discrepancy::getCaseFileId1, assoCaseFile2.getId())
|
|
|
+ .eq(Discrepancy::getCaseFileId2, assoCaseFile3.getId()));
|
|
|
+ if (ObjectUtils.isEmpty(discrepancy2)) {
|
|
|
+ Discrepancy discrepancy = new Discrepancy();
|
|
|
+ discrepancy.setCaseId(caseFile.getId());
|
|
|
+ discrepancy.setCaseFileId1(assoCaseFile2.getId());
|
|
|
+ discrepancy.setCaseFileId2(assoCaseFile3.getId());
|
|
|
+ discrepancy.setDiscrepancyType(2);
|
|
|
+ discrepancy.insert();
|
|
|
|
|
|
- this.getFile(assoCaseFile2.getFileGuid(), assoCaseFile3.getFileGuid(), discrepancy.getId(), assoCaseFile2.getFileName(), assoCaseFile3.getFileName());
|
|
|
+ this.getFile(assoCaseFile2.getFileGuid(), assoCaseFile3.getFileGuid(), discrepancy.getId(), assoCaseFile2.getFileName(), assoCaseFile3.getFileName());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -836,10 +848,10 @@ public class CaseFileService extends ServiceImpl<CaseFileMapper, CaseFile> {
|
|
|
public void getFile(String guid1, String guid2, Integer discrepancyId, String fileName1, String fileName2) throws IOException {
|
|
|
byte[] bytes = fileManagerService.downloadSystemFileFromFMS(guid1);
|
|
|
File tempFile = null;
|
|
|
- if (fileName1.endsWith(".docx")) {
|
|
|
- tempFile = File.createTempFile("temp1_", ".docx");
|
|
|
- } else if (fileName1.endsWith(".doc")) {
|
|
|
+ if (fileName1.endsWith(".doc")) {
|
|
|
tempFile = File.createTempFile("temp1_", ".doc");
|
|
|
+ } else {
|
|
|
+ tempFile = File.createTempFile("temp1_", ".docx");
|
|
|
}
|
|
|
try (
|
|
|
InputStream inputStream = new ByteArrayInputStream(bytes);
|
|
@@ -849,10 +861,10 @@ public class CaseFileService extends ServiceImpl<CaseFileMapper, CaseFile> {
|
|
|
}
|
|
|
byte[] bytes1 = fileManagerService.downloadSystemFileFromFMS(guid2);
|
|
|
File tempFile1 = null;
|
|
|
- if (fileName2.endsWith(".docx")) {
|
|
|
- tempFile1 = File.createTempFile("temp2_", ".docx");
|
|
|
- } else if (fileName2.endsWith(".doc")) {
|
|
|
+ if (fileName2.endsWith(".doc")) {
|
|
|
tempFile1 = File.createTempFile("temp2_", ".doc");
|
|
|
+ } else {
|
|
|
+ tempFile1 = File.createTempFile("temp2_", ".docx");
|
|
|
}
|
|
|
try (
|
|
|
InputStream inputStream = new ByteArrayInputStream(bytes1);
|
|
@@ -974,6 +986,7 @@ public class CaseFileService extends ServiceImpl<CaseFileMapper, CaseFile> {
|
|
|
* @param type
|
|
|
* @param discrepancyId
|
|
|
*/
|
|
|
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Throwable.class)
|
|
|
public void compareText(String text, String text1, Integer type, Integer discrepancyId) {
|
|
|
double similarity = cosineSimilarityService.calculateCosineSimilarity(text, text1);
|
|
|
int total = text.length();
|