|
@@ -20,6 +20,7 @@ import cn.cslg.pas.domain.business.ReportProject;
|
|
|
import cn.cslg.pas.domain.business.novelty.NoveltyCompareLiterature;
|
|
|
import cn.cslg.pas.domain.es.Patent;
|
|
|
import cn.cslg.pas.domain.report.AssoComLiteratureFile;
|
|
|
+import cn.cslg.pas.exception.ExceptionEnum;
|
|
|
import cn.cslg.pas.exception.UnLoginException;
|
|
|
import cn.cslg.pas.exception.XiaoShiException;
|
|
|
import cn.cslg.pas.mapper.CompareLiteratureMapper;
|
|
@@ -323,6 +324,9 @@ public class CompareLiteratureService extends ServiceImpl<CompareLiteratureMappe
|
|
|
|
|
|
}
|
|
|
}
|
|
|
+ else {
|
|
|
+ compareLiteratureVO.setPublicNo(compareLiterature.getLiteratureNo());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -377,11 +381,13 @@ public class CompareLiteratureService extends ServiceImpl<CompareLiteratureMappe
|
|
|
|
|
|
public void updateCompareLiteratureBatch(UpdateBatchLiteratureDTO updateBatchLiteratureDTO) {
|
|
|
PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
|
|
|
-
|
|
|
+ Integer projectId =updateBatchLiteratureDTO.getProjectId();
|
|
|
if (updateBatchLiteratureDTO == null) {
|
|
|
return;
|
|
|
}
|
|
|
List<UpdateBatchLiteraturesDTO> dtos = updateBatchLiteratureDTO.getUpdateBatchLiteratureDTOs();
|
|
|
+ List<Integer> orders =dtos.stream().map(UpdateBatchLiteraturesDTO::getSysOrder).collect(Collectors.toList());
|
|
|
+ this.checkOrders(orders,projectId);
|
|
|
int i = 1;
|
|
|
for (UpdateBatchLiteraturesDTO item : dtos) {
|
|
|
if (item.getType().equals(1)) {
|
|
@@ -499,24 +505,25 @@ public class CompareLiteratureService extends ServiceImpl<CompareLiteratureMappe
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
}
|
|
|
- if (patentWithIdVO == null) {
|
|
|
- return null;
|
|
|
+ CompareLiterature compareLiterature = new CompareLiterature();
|
|
|
+ compareLiterature.setCreateId(personnelVO.getId());
|
|
|
+ //报告id
|
|
|
+ compareLiterature.setProjectId(projectId);
|
|
|
+ if (patentWithIdVO != null) {
|
|
|
+ literatureNo = patent.getPatentNo();
|
|
|
}
|
|
|
- literatureNo = patent.getPatentNo();
|
|
|
+
|
|
|
//判断该专利是否已经作为文献
|
|
|
Integer lastId = this.getHaveAddIdByNos(projectId, literatureNo);
|
|
|
if (lastId != null && id == null) {
|
|
|
id = lastId;
|
|
|
}
|
|
|
|
|
|
- CompareLiterature compareLiterature = new CompareLiterature();
|
|
|
- compareLiterature.setCreateId(personnelVO.getId());
|
|
|
- //报告id
|
|
|
- compareLiterature.setProjectId(projectId);
|
|
|
+
|
|
|
//文档guid
|
|
|
- compareLiterature.setLiteratureNo(patent.getPatentNo());
|
|
|
+ compareLiterature.setLiteratureNo(literatureNo);
|
|
|
//文档名称
|
|
|
- String name = literatureNo;
|
|
|
+ String name = null;
|
|
|
if (patent != null) {
|
|
|
if (patent.getTitle() != null && patent.getTitle().size() != 0) {
|
|
|
name = patent.getTitle().get(0).getTextContent();
|
|
@@ -557,7 +564,9 @@ public class CompareLiteratureService extends ServiceImpl<CompareLiteratureMappe
|
|
|
|
|
|
}
|
|
|
try {
|
|
|
- importSinglePatentService.saveAssoPatentProjectToEs(projectId, patentWithIdVO.getId());
|
|
|
+ if (patentWithIdVO != null) {
|
|
|
+ importSinglePatentService.saveAssoPatentProjectToEs(projectId, patentWithIdVO.getId());
|
|
|
+ }
|
|
|
} catch (Exception e) {
|
|
|
throw new XiaoShiException("添加和es关联错误");
|
|
|
}
|
|
@@ -776,4 +785,20 @@ public class CompareLiteratureService extends ServiceImpl<CompareLiteratureMappe
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param orders
|
|
|
+ */
|
|
|
+ public void checkOrders(List<Integer> orders,Integer projectId){
|
|
|
+ if(orders!=null&&orders.size()!=0){
|
|
|
+ LambdaQueryWrapper<CompareLiterature> queryWrapper =new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.in(CompareLiterature::getSysOrder,orders)
|
|
|
+ .eq(CompareLiterature::getProjectId,projectId);
|
|
|
+ List<CompareLiterature> compareLiteratures =this.list(queryWrapper);
|
|
|
+ if(compareLiteratures!=null&&compareLiteratures.size()>0){
|
|
|
+ throw new XiaoShiException(ExceptionEnum.BUSINESS_ERROR,"已导入,禁止连续提交");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|