|
@@ -431,6 +431,7 @@ public class CompareLiteratureService extends ServiceImpl<CompareLiteratureMappe
|
|
/**
|
|
/**
|
|
* 添加或更新专利文献
|
|
* 添加或更新专利文献
|
|
*/
|
|
*/
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
public Integer saveOrUpdatePatent(UpdateBatchLiteraturesDTO updateBatchLiteratureDTO) {
|
|
public Integer saveOrUpdatePatent(UpdateBatchLiteraturesDTO updateBatchLiteratureDTO) {
|
|
PersonnelVO personnelVO = new PersonnelVO();
|
|
PersonnelVO personnelVO = new PersonnelVO();
|
|
Integer projectId = updateBatchLiteratureDTO.getProjectId();
|
|
Integer projectId = updateBatchLiteratureDTO.getProjectId();
|
|
@@ -459,6 +460,9 @@ public class CompareLiteratureService extends ServiceImpl<CompareLiteratureMappe
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+ if(patentWithIdVO==null){
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
literatureNo = patent.getPatentNo();
|
|
literatureNo = patent.getPatentNo();
|
|
//判断该专利是否已经作为文献
|
|
//判断该专利是否已经作为文献
|
|
Integer lastId = this.getHaveAddIdByNos(projectId, literatureNo);
|
|
Integer lastId = this.getHaveAddIdByNos(projectId, literatureNo);
|
|
@@ -502,13 +506,13 @@ public class CompareLiteratureService extends ServiceImpl<CompareLiteratureMappe
|
|
compareLiterature.updateById();
|
|
compareLiterature.updateById();
|
|
|
|
|
|
} else {
|
|
} else {
|
|
- try {
|
|
|
|
- importSinglePatentService.saveAssoPatentProjectToEs(projectId, patentWithIdVO.getId());
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- throw new XiaoShiException("添加和es关联错误");
|
|
|
|
- }
|
|
|
|
compareLiterature.insert();
|
|
compareLiterature.insert();
|
|
}
|
|
}
|
|
|
|
+ try {
|
|
|
|
+ importSinglePatentService.saveAssoPatentProjectToEs(projectId, patentWithIdVO.getId());
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ throw new XiaoShiException("添加和es关联错误");
|
|
|
|
+ }
|
|
|
|
|
|
return compareLiterature.getId();
|
|
return compareLiterature.getId();
|
|
|
|
|
|
@@ -656,4 +660,37 @@ public class CompareLiteratureService extends ServiceImpl<CompareLiteratureMappe
|
|
}
|
|
}
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ public void addAssoToEs(){
|
|
|
|
+ List<String> patentNos =new ArrayList<>();
|
|
|
|
+ LambdaQueryWrapper<CompareLiterature> compareLiteratureLambdaQueryWrapper =new LambdaQueryWrapper<>();
|
|
|
|
+ compareLiteratureLambdaQueryWrapper.eq(CompareLiterature::getType,0);
|
|
|
|
+ List<CompareLiterature> compareLiteratures =this.list(compareLiteratureLambdaQueryWrapper);
|
|
|
|
+ int i=0;
|
|
|
|
+ for (CompareLiterature item: compareLiteratures){
|
|
|
|
+ i++;
|
|
|
|
+ System.out.println(i);
|
|
|
|
+ String patentNo =item.getLiteratureNo().trim();
|
|
|
|
+ Integer projectId =item.getProjectId();
|
|
|
|
+ try {
|
|
|
|
+ PatentWithIdVO patentWithIdVO = esService.getIdByPatentNo(patentNo);
|
|
|
|
+ if(patentWithIdVO==null){
|
|
|
|
+ // 不存在该专利则从数据库获取著录信息并保存
|
|
|
|
+ patentWithIdVO = importSinglePatentService.addSinglePatent(patentNo);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ importSinglePatentService.saveAssoPatentProjectToEs(projectId, patentWithIdVO.getId());
|
|
|
|
+ }
|
|
|
|
+catch (Exception e){
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ patentNos.add(patentNo);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+System.out.println(patentNos);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|