|
@@ -3,14 +3,14 @@ package cn.cslg.report.service.business;
|
|
|
import cn.cslg.report.common.model.vo.PatentRightVo;
|
|
|
import cn.cslg.report.common.model.vo.PatentVO;
|
|
|
import cn.cslg.report.common.model.vo.PersonnelVO;
|
|
|
+import cn.cslg.report.common.model.vo.SplitVO;
|
|
|
import cn.cslg.report.common.utils.CacheUtils;
|
|
|
import cn.cslg.report.common.utils.Response;
|
|
|
import cn.cslg.report.common.utils.SecurityUtils.LoginUtils;
|
|
|
-import cn.cslg.report.entity.CompareRecords;
|
|
|
-import cn.cslg.report.entity.Features;
|
|
|
-import cn.cslg.report.entity.PatentRight;
|
|
|
-import cn.cslg.report.entity.Report;
|
|
|
+import cn.cslg.report.entity.*;
|
|
|
import cn.cslg.report.entity.asso.AssoRecordsFeature;
|
|
|
+import cn.cslg.report.entity.asso.AssoTaskPatentSplit;
|
|
|
+import cn.cslg.report.entity.asso.AssoTaskPersonel;
|
|
|
import cn.cslg.report.mapper.FeatureMapper;
|
|
|
import cn.cslg.report.service.OutInterfaceService;
|
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
@@ -43,6 +43,10 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
|
|
|
private final FeatureMapper featureMapper;
|
|
|
private final AssoRecordsFeatureService assoRecordsFeatureService;
|
|
|
private final CompareRecordsService compareRecordsService;
|
|
|
+ private final AssoTaskPersonelService assoTaskPersonelService;
|
|
|
+ private final AssoTaskPatentSplitService assoTaskPatentSplitService;
|
|
|
+ private final TaskService taskService;
|
|
|
+ private final CompareMessageService compareMessageService;
|
|
|
|
|
|
/**
|
|
|
* @param patentRights(专利权利要求)
|
|
@@ -50,7 +54,7 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
|
|
|
* @function 对权要进行合并操作
|
|
|
*/
|
|
|
|
|
|
- private List<PatentRight> FormatPatentRights(List<PatentRight> patentRights) {
|
|
|
+ public List<PatentRight> FormatPatentRights(List<PatentRight> patentRights) {
|
|
|
List<PatentRight> retList = new ArrayList<>();
|
|
|
for (int i = 0; i < patentRights.size(); i++) {
|
|
|
String str = patentRights.get(i).getContent();
|
|
@@ -81,16 +85,13 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
|
|
|
* @throws IOException
|
|
|
* @function 从PAS系统上获得权要并拆分
|
|
|
*/
|
|
|
- public String splitPatentRight(String patentNo, Integer splitType, Integer splitBy, Integer reportId) throws IOException {
|
|
|
- PersonnelVO personnelVO = cacheUtils.getLoginUser(StpUtil.getLoginIdAsInt());
|
|
|
- //根据报告ID查询报告
|
|
|
- LambdaQueryWrapper<Report> queryWrapper = new LambdaQueryWrapper();
|
|
|
- queryWrapper.eq(Report::getId, reportId);
|
|
|
- //未查到报告报错
|
|
|
- if (reportService.list(queryWrapper).size() == 0) {
|
|
|
- return Response.error("未查询到报告");
|
|
|
- }
|
|
|
- Report report = reportService.list(queryWrapper).get(0);
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public String splitPatentRight(SplitVO splitVO) throws IOException {
|
|
|
+ String patentNo =splitVO.getPatentNo();
|
|
|
+ Integer reportId =splitVO.getReportId();
|
|
|
+ Integer splitType =splitVO.getSplitType();
|
|
|
+ Integer splitBy =splitVO.getSplitBy();
|
|
|
+ Integer taskId =splitVO.getTaskId();
|
|
|
Integer flag = 0;
|
|
|
if (splitBy == null) {
|
|
|
splitBy = 0;
|
|
@@ -98,12 +99,61 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
|
|
|
if (splitType == null) {
|
|
|
splitType = 0;
|
|
|
}
|
|
|
- //如果报告未拆分过权要,或者拆分类型不同则更新报告
|
|
|
- if (report.getSplitBy() == null || report.getSplitType() == null || report.getSplitBy() != splitBy || report.getSplitType() != splitType) {
|
|
|
- report.setSplitBy(splitBy);
|
|
|
- report.setSplitType(splitType);
|
|
|
- report.updateById();
|
|
|
- flag = 1;
|
|
|
+ PersonnelVO personnelVO = cacheUtils.getLoginUser(StpUtil.getLoginIdAsInt());
|
|
|
+ //如果是FTO报告则 将拆分信息存入
|
|
|
+ if(taskId!=null){
|
|
|
+ //根据taskId获得报告ID
|
|
|
+ Task task = taskService.getById(taskId);
|
|
|
+ reportId =task.getId();
|
|
|
+ //根据taskId 和专利号找到关联Id
|
|
|
+ LambdaQueryWrapper<AssoTaskPersonel> queryWrapper1 =new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper1.eq(AssoTaskPersonel::getTaskId,taskId)
|
|
|
+ .eq(AssoTaskPersonel::getPatentNo,patentNo);
|
|
|
+ List<AssoTaskPersonel> assoTaskPersonels= assoTaskPersonelService.list(queryWrapper1);
|
|
|
+ if(assoTaskPersonels!=null&&assoTaskPersonels.size()!=0){
|
|
|
+ //关联ID
|
|
|
+ Integer assoId =assoTaskPersonels.get(0).getId();
|
|
|
+ //根据关联ID 查询任务专利关联信息
|
|
|
+ LambdaQueryWrapper<AssoTaskPatentSplit> queryWrapper =new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.eq(AssoTaskPatentSplit::getTaskPatentId,assoId);
|
|
|
+ List<AssoTaskPatentSplit> assoTaskPatentSplits = assoTaskPatentSplitService.list(queryWrapper);
|
|
|
+ AssoTaskPatentSplit assoTaskPatentSplit =new AssoTaskPatentSplit();
|
|
|
+ //如果没查到关联信息代表第一次拆分,新建一条
|
|
|
+ if(assoTaskPatentSplits==null||assoTaskPatentSplits.size()==0){
|
|
|
+ assoTaskPatentSplit.setTaskPatentId(assoId);
|
|
|
+ assoTaskPatentSplit.setSplitBy(splitBy);
|
|
|
+ assoTaskPatentSplit.setSplitType(splitType);
|
|
|
+ assoTaskPatentSplit.insert();
|
|
|
+ flag =1;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ assoTaskPatentSplit = assoTaskPatentSplits.get(0);
|
|
|
+ if(assoTaskPatentSplit.getSplitBy() != splitBy || assoTaskPatentSplit.getSplitType() != splitType)
|
|
|
+ {
|
|
|
+ assoTaskPatentSplit.setSplitBy(splitBy);
|
|
|
+ assoTaskPatentSplit.setSplitType(splitType);
|
|
|
+ assoTaskPatentSplit.updateById();
|
|
|
+ flag=1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ //根据报告ID查询报告
|
|
|
+ LambdaQueryWrapper<Report> queryWrapper = new LambdaQueryWrapper();
|
|
|
+ queryWrapper.eq(Report::getId, reportId);
|
|
|
+ //未查到报告报错
|
|
|
+ if (reportService.list(queryWrapper).size() == 0) {
|
|
|
+ return Response.error("未查询到报告");
|
|
|
+ }
|
|
|
+ Report report = reportService.list(queryWrapper).get(0);
|
|
|
+ //如果报告未拆分过权要,或者拆分类型不同则更新报告
|
|
|
+ if (report.getSplitBy() == null || report.getSplitType() == null || report.getSplitBy() != splitBy || report.getSplitType() != splitType) {
|
|
|
+ report.setSplitBy(splitBy);
|
|
|
+ report.setSplitType(splitType);
|
|
|
+ report.updateById();
|
|
|
+ flag = 1;
|
|
|
+ }
|
|
|
}
|
|
|
//权要(带拆分的特征)列表
|
|
|
List<PatentRightVo> patentRightVos = new ArrayList<>();
|
|
@@ -147,14 +197,21 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
|
|
|
featureTO.setPartnerId(personnelVO.getId());
|
|
|
featureTO.setSplitType(splitType);
|
|
|
featureTO.setSplitBy(splitBy);
|
|
|
+ featureTO.setTaskId(taskId);
|
|
|
//查询数据库里是否有拆分记录
|
|
|
List<Features> featureFromDb = this.queryFeatures(featureTO);
|
|
|
//删除所有不符合登录人拆分条件的拆分特征
|
|
|
LambdaQueryWrapper<Features> wrapper = new LambdaQueryWrapper<>();
|
|
|
wrapper.eq(Features::getReportId, reportId)
|
|
|
- .eq(Features::getSignPatentNo, patentNo)
|
|
|
- .eq(Features::getPartnerId, personnelVO.getId());
|
|
|
+ .eq(Features::getSignPatentNo, patentNo);
|
|
|
wrapper.and(QueryWrapper -> QueryWrapper.ne(Features::getSplitBy, a).or().ne(Features::getSplitType, b));
|
|
|
+ if(taskId!=null){
|
|
|
+ List<Features> features =this.list(wrapper);
|
|
|
+ List<Integer> Ids =features.stream().map(Features::getId).collect(Collectors.toList());
|
|
|
+ LambdaQueryWrapper<CompareMessage> queryWrapper =new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.in(CompareMessage::getFeatureId,Ids);
|
|
|
+ compareMessageService.remove(queryWrapper);
|
|
|
+ }
|
|
|
this.remove(wrapper);
|
|
|
//将拆解的权要和特征装载到对象PatentRightVo
|
|
|
for (int i = 0; i < patentRights.size(); i++) {
|
|
@@ -196,6 +253,9 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
|
|
|
features.setFeaturesOrder(order);
|
|
|
features.setRightType(patentRights.get(i).getType());
|
|
|
features.setSplitType(splitType);
|
|
|
+ if(taskId!=null){
|
|
|
+ features.setTaskId(taskId);
|
|
|
+ }
|
|
|
featuresList.add(features);
|
|
|
order += 1;
|
|
|
}
|
|
@@ -216,8 +276,8 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
|
|
|
}
|
|
|
Map<String, Object> map = new HashMap<String, Object>();
|
|
|
map.put("patentRightVos", patentRightVos);
|
|
|
- map.put("splitBy", report.getSplitBy());
|
|
|
- map.put("splitType", report.getSplitType());
|
|
|
+ map.put("splitBy", splitBy);
|
|
|
+ map.put("splitType",splitType);
|
|
|
return Response.success(map);
|
|
|
}
|
|
|
|
|
@@ -337,6 +397,9 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
|
|
|
lambdaQueryWrapper.in(Features::getPartnerId, features.getPartnerIds());
|
|
|
|
|
|
}
|
|
|
+ if (features.getTaskId() != null) {
|
|
|
+ lambdaQueryWrapper.eq(Features::getTaskId, features.getTaskId());
|
|
|
+ }
|
|
|
featureList = this.list(lambdaQueryWrapper);
|
|
|
return featureList;
|
|
|
}
|
|
@@ -354,8 +417,7 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
|
|
|
LambdaQueryWrapper<Features> wrapper = new LambdaQueryWrapper<>();
|
|
|
if (patentRightVos.get(0).getReportId() != null && patentRightVos.get(0).getSignPatentNo() != null) {
|
|
|
wrapper.eq(Features::getReportId, patentRightVos.get(0).getReportId())
|
|
|
- .eq(Features::getSignPatentNo, patentRightVos.get(0).getSignPatentNo())
|
|
|
- .eq(Features::getPartnerId, personnelVO.getId());
|
|
|
+ .eq(Features::getSignPatentNo, patentRightVos.get(0).getSignPatentNo());
|
|
|
Features feature = this.list(wrapper).get(0);
|
|
|
//根据登录人Id,报告Id,标的专利号删除原有特征
|
|
|
this.remove(wrapper);
|
|
@@ -380,6 +442,7 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
|
|
|
return Response.success();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
public List<Map<String,Object>> querySimFeaturePatent(PatentVO patentVO) throws IOException {
|
|
|
//获得当前用户信息
|
|
|
PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
|
|
@@ -471,17 +534,4 @@ List<Map<String,Object>> mapList =new ArrayList<Map<String,Object>>();
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
- public Map<String,Object> getSplitMessage(Integer reportId,String patentNo) {
|
|
|
- LambdaQueryWrapper<Features> queryWrapper =new LambdaQueryWrapper<>();
|
|
|
- queryWrapper.eq(Features::getReportId,reportId)
|
|
|
- .eq(Features::getSignPatentNo,patentNo);
|
|
|
- List<Features> features =this.list(queryWrapper);
|
|
|
- Map<String,Object> map =new HashMap<>();
|
|
|
- if(features!=null&& features.size()!=0){
|
|
|
- map.put("splitBy",features.get(0).getSplitBy());
|
|
|
- map.put("splitType",features.get(0).getSplitType());
|
|
|
- }
|
|
|
- return map;
|
|
|
- }
|
|
|
}
|