|
@@ -4,12 +4,15 @@ import cn.cslg.pas.common.dto.PatentStarListDTO;
|
|
|
import cn.cslg.pas.common.dto.UploadPatentWebDTO;
|
|
|
import cn.cslg.pas.common.model.cronModel.Calculate;
|
|
|
import cn.cslg.pas.common.model.cronModel.SystemFile;
|
|
|
-import cn.cslg.pas.common.utils.*;
|
|
|
+import cn.cslg.pas.common.utils.DateUtils;
|
|
|
+import cn.cslg.pas.common.utils.FormatUtil;
|
|
|
+import cn.cslg.pas.common.utils.ReadExcelUtils;
|
|
|
import cn.cslg.pas.common.vo.ImportTaskAMVO;
|
|
|
import cn.cslg.pas.common.vo.StarPatentVO;
|
|
|
-import cn.cslg.pas.common.vo.UploadParamsVO;
|
|
|
+import cn.cslg.pas.domain.business.PatentImportErrorLog;
|
|
|
import cn.cslg.pas.domain.es.Patent;
|
|
|
import cn.cslg.pas.factorys.PatentImportFactory.PatentImportImp;
|
|
|
+import cn.cslg.pas.service.business.PatentImportErrorLogService;
|
|
|
import cn.cslg.pas.service.common.FileManagerService;
|
|
|
import cn.cslg.pas.service.common.PatentStarApiService;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
@@ -93,8 +96,8 @@ public class ImportFromWebToEsService implements PatentImportImp {
|
|
|
String dbType = importTaskAMVO.getDbType(); //检索数据库类型
|
|
|
Integer taskStartNum = importTaskAMVO.getDoneNum();
|
|
|
List<String> addPatentNos = new ArrayList<>();
|
|
|
- String patentNoStr =importTaskAMVO.getPatentNoStr();
|
|
|
- if(patentNoStr!=null){
|
|
|
+ String patentNoStr = importTaskAMVO.getPatentNoStr();
|
|
|
+ if (patentNoStr != null) {
|
|
|
addPatentNos = JSONArray.parseArray(patentNoStr);
|
|
|
}
|
|
|
int patentNum = 10000;
|
|
@@ -185,8 +188,16 @@ public class ImportFromWebToEsService implements PatentImportImp {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- Integer trueStartNum = taskStartNum > lastOverNum ? taskStartNum : lastOverNum;
|
|
|
- Integer startNum = trueStartNum - lastOverNum;
|
|
|
+ Integer startNum = 0;
|
|
|
+ if (taskStartNum > lastOverNum) {
|
|
|
+ startNum = taskStartNum - lastOverNum;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> nos = patentStarListDto.getNos();
|
|
|
+ if (nos != null) {
|
|
|
+ nos = nos.subList(startNum, nos.size());
|
|
|
+ }
|
|
|
+
|
|
|
Calculate calculate = DateUtils.calculateFromStartAndEndNumber(startNum, total, 50);
|
|
|
Integer startPage = calculate.getStartPage();
|
|
|
Integer endPage = calculate.getEndPage();
|
|
@@ -205,17 +216,19 @@ public class ImportFromWebToEsService implements PatentImportImp {
|
|
|
}
|
|
|
List<StarPatentVO> starPatents = (List<StarPatentVO>) resultMap.get("records");
|
|
|
|
|
|
- if ((i * 50 + starPatents.size()) < startNum) {
|
|
|
- continue;
|
|
|
- }
|
|
|
+
|
|
|
Integer pageStartNum = (i * 50) >= startNum ? 0 : startNum - (i * 50);
|
|
|
Integer pageEndNum = starPatents.size();
|
|
|
//遍历这一页的专利
|
|
|
for (int j = pageStartNum; j < pageEndNum; j++) {
|
|
|
+ StarPatentVO starPatentVO =starPatents.get(j);
|
|
|
+ nos.removeIf(item->item.equals(starPatentVO.getApplicationNo())
|
|
|
+ ||item.equals(starPatentVO.getPublicNo())
|
|
|
+ ||item.equals(starPatentVO.getPublicAccreditNo()));
|
|
|
UploadPatentWebDTO uploadPatentWebDTO = new UploadPatentWebDTO();
|
|
|
Patent patent = new Patent();
|
|
|
//装载start
|
|
|
- uploadPatentWebDTO.setStarPatentVO(starPatents.get(j));
|
|
|
+ uploadPatentWebDTO.setStarPatentVO(starPatentVO);
|
|
|
uploadPatentWebDTO.setPatent(patent);
|
|
|
uploadPatentWebDTO.setCounter(0);
|
|
|
uploadPatentWebDTO.setIndex(index);
|
|
@@ -241,8 +254,20 @@ public class ImportFromWebToEsService implements PatentImportImp {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
-
|
|
|
- taskStartNum = overNum;
|
|
|
+ List<PatentImportErrorLog> patentImportErrorLogs =new ArrayList<>();
|
|
|
+ if(nos!=null&&nos.size()>0){
|
|
|
+ nos.forEach(item->{
|
|
|
+ PatentImportErrorLog patentImportErrorLog =new PatentImportErrorLog();
|
|
|
+ patentImportErrorLog.setPatentNo(item);
|
|
|
+ patentImportErrorLog.setErrorType(-1);
|
|
|
+ patentImportErrorLog.setTaskId(importTaskAMVO.getId());
|
|
|
+ patentImportErrorLogs.add(patentImportErrorLog);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if(patentImportErrorLogs.size()>0){
|
|
|
+ PatentImportErrorLogService patentImportErrorLogService = applicationContext.getBean(PatentImportErrorLogService.class);
|
|
|
+ patentImportErrorLogService.saveBatch(patentImportErrorLogs);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (ifCataloguing == '1') {
|