|
@@ -22,6 +22,7 @@ import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.context.ApplicationContext;
|
|
import org.springframework.context.ApplicationContext;
|
|
import org.springframework.context.annotation.Scope;
|
|
import org.springframework.context.annotation.Scope;
|
|
|
|
+import org.springframework.scheduling.annotation.Async;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.io.ByteArrayInputStream;
|
|
import java.io.ByteArrayInputStream;
|
|
@@ -55,7 +56,7 @@ public class ImportFromWebToEsService implements PatentImportImp {
|
|
private List<UploadPatentWebDTO> uploadPatentWebDTOS = new ArrayList<>();
|
|
private List<UploadPatentWebDTO> uploadPatentWebDTOS = new ArrayList<>();
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public void startPatentThread() {
|
|
|
|
|
|
+ public Boolean startPatentThread() {
|
|
//装载专利信息的计数器
|
|
//装载专利信息的计数器
|
|
Integer addPatentCounter = 0;
|
|
Integer addPatentCounter = 0;
|
|
//十进制转二进制
|
|
//十进制转二进制
|
|
@@ -83,13 +84,12 @@ public class ImportFromWebToEsService implements PatentImportImp {
|
|
getCataloguingFromWebThread = new GetCataloguingFromWebThread(taskThread, this);
|
|
getCataloguingFromWebThread = new GetCataloguingFromWebThread(taskThread, this);
|
|
getCataloguingFromWebThread.start();
|
|
getCataloguingFromWebThread.start();
|
|
}
|
|
}
|
|
- excuteLessThan10000(importTaskAMVO, addPatentCounter);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ return excuteLessThan10000(importTaskAMVO, addPatentCounter);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- private void excuteLessThan10000(ImportTaskAMVO importTaskAMVO, Integer addPatentCounter) {
|
|
|
|
|
|
+ private Boolean excuteLessThan10000(ImportTaskAMVO importTaskAMVO, Integer addPatentCounter) {
|
|
|
|
+ Boolean ifHaveGet = false;
|
|
try {
|
|
try {
|
|
String orderBy = importTaskAMVO.getOrderBy(); //排序字段
|
|
String orderBy = importTaskAMVO.getOrderBy(); //排序字段
|
|
String orderByType = importTaskAMVO.getOrderByType(); //排序类型
|
|
String orderByType = importTaskAMVO.getOrderByType(); //排序类型
|
|
@@ -202,10 +202,10 @@ public class ImportFromWebToEsService implements PatentImportImp {
|
|
Integer startPage = calculate.getStartPage();
|
|
Integer startPage = calculate.getStartPage();
|
|
Integer endPage = calculate.getEndPage();
|
|
Integer endPage = calculate.getEndPage();
|
|
|
|
|
|
- for (int i = startPage; i <endPage; i++) {
|
|
|
|
|
|
+ for (int i = startPage; i < endPage; i++) {
|
|
PatentStarListDTO patentStarListDTOTemp = new PatentStarListDTO();
|
|
PatentStarListDTO patentStarListDTOTemp = new PatentStarListDTO();
|
|
BeanUtils.copyProperties(patentStarListDto, patentStarListDTOTemp);
|
|
BeanUtils.copyProperties(patentStarListDto, patentStarListDTOTemp);
|
|
- patentStarListDTOTemp.setPageNum(i+1);
|
|
|
|
|
|
+ patentStarListDTOTemp.setPageNum(i + 1);
|
|
patentStarListDTOTemp.setRowCount(50);
|
|
patentStarListDTOTemp.setRowCount(50);
|
|
//调用一般接口返回一批专利著录相关数据
|
|
//调用一般接口返回一批专利著录相关数据
|
|
|
|
|
|
@@ -221,9 +221,9 @@ public class ImportFromWebToEsService implements PatentImportImp {
|
|
Integer pageEndNum = starPatents.size();
|
|
Integer pageEndNum = starPatents.size();
|
|
//遍历这一页的专利
|
|
//遍历这一页的专利
|
|
for (int j = pageStartNum; j < pageEndNum; j++) {
|
|
for (int j = pageStartNum; j < pageEndNum; j++) {
|
|
- StarPatentVO starPatentVO =starPatents.get(j);
|
|
|
|
|
|
+ StarPatentVO starPatentVO = starPatents.get(j);
|
|
|
|
|
|
- if(nos!=null) {
|
|
|
|
|
|
+ if (nos != null) {
|
|
nos.removeIf(item -> item.equals(starPatentVO.getApplicationNo())
|
|
nos.removeIf(item -> item.equals(starPatentVO.getApplicationNo())
|
|
|| item.equals(starPatentVO.getPublicNo())
|
|
|| item.equals(starPatentVO.getPublicNo())
|
|
|| item.equals(starPatentVO.getPublicAccreditNo())
|
|
|| item.equals(starPatentVO.getPublicAccreditNo())
|
|
@@ -238,7 +238,7 @@ public class ImportFromWebToEsService implements PatentImportImp {
|
|
uploadPatentWebDTO.setIndex(index);
|
|
uploadPatentWebDTO.setIndex(index);
|
|
uploadPatentWebDTO.setTotalCounter(addPatentCounter);
|
|
uploadPatentWebDTO.setTotalCounter(addPatentCounter);
|
|
uploadPatentWebDTO.setHaveSaveCounter(0);
|
|
uploadPatentWebDTO.setHaveSaveCounter(0);
|
|
-
|
|
|
|
|
|
+ ifHaveGet = true;
|
|
if (ifCataloguing == '1') {
|
|
if (ifCataloguing == '1') {
|
|
getCataloguingFromWebThread.awakeTask(uploadPatentWebDTO);
|
|
getCataloguingFromWebThread.awakeTask(uploadPatentWebDTO);
|
|
}
|
|
}
|
|
@@ -258,19 +258,19 @@ public class ImportFromWebToEsService implements PatentImportImp {
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
- List<PatentImportErrorLog> patentImportErrorLogs =new ArrayList<>();
|
|
|
|
- if(nos!=null&&nos.size()>0){
|
|
|
|
- nos.forEach(item->{
|
|
|
|
- PatentImportErrorLog patentImportErrorLog =new PatentImportErrorLog();
|
|
|
|
|
|
+ List<PatentImportErrorLog> patentImportErrorLogs = new ArrayList<>();
|
|
|
|
+ if (nos != null && nos.size() > 0) {
|
|
|
|
+ nos.forEach(item -> {
|
|
|
|
+ PatentImportErrorLog patentImportErrorLog = new PatentImportErrorLog();
|
|
patentImportErrorLog.setPatentNo(item);
|
|
patentImportErrorLog.setPatentNo(item);
|
|
patentImportErrorLog.setErrorType(-1);
|
|
patentImportErrorLog.setErrorType(-1);
|
|
patentImportErrorLog.setTaskId(importTaskAMVO.getId());
|
|
patentImportErrorLog.setTaskId(importTaskAMVO.getId());
|
|
patentImportErrorLogs.add(patentImportErrorLog);
|
|
patentImportErrorLogs.add(patentImportErrorLog);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- if(patentImportErrorLogs.size()>0){
|
|
|
|
|
|
+ if (patentImportErrorLogs.size() > 0) {
|
|
PatentImportErrorLogService patentImportErrorLogService = applicationContext.getBean(PatentImportErrorLogService.class);
|
|
PatentImportErrorLogService patentImportErrorLogService = applicationContext.getBean(PatentImportErrorLogService.class);
|
|
- patentImportErrorLogService.saveBatch(patentImportErrorLogs);
|
|
|
|
|
|
+ patentImportErrorLogService.saveBatch(patentImportErrorLogs);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -287,10 +287,12 @@ public class ImportFromWebToEsService implements PatentImportImp {
|
|
if (ifPdf == '1') {
|
|
if (ifPdf == '1') {
|
|
getPatentPDFFromWebThread.setIfProductAll(true);
|
|
getPatentPDFFromWebThread.setIfProductAll(true);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ return ifHaveGet;
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
//生产消费到一半时,发生错误异常,将任务状态置为完成
|
|
//生产消费到一半时,发生错误异常,将任务状态置为完成
|
|
-
|
|
|
|
|
|
+ return ifHaveGet;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|