|
@@ -6,9 +6,11 @@ import cn.cslg.report.common.model.vo.PersonnelVO;
|
|
|
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.asso.AssoRecordsFeature;
|
|
|
import cn.cslg.report.mapper.FeatureMapper;
|
|
|
import cn.cslg.report.service.OutInterfaceService;
|
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
@@ -39,11 +41,13 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
|
|
|
private final ReportService reportService;
|
|
|
private final LoginUtils loginUtils;
|
|
|
private final FeatureMapper featureMapper;
|
|
|
+ private final AssoRecordsFeatureService assoRecordsFeatureService;
|
|
|
+ private final CompareRecordsService compareRecordsService;
|
|
|
|
|
|
/**
|
|
|
- *@function 对权要进行合并操作
|
|
|
* @param patentRights(专利权利要求)
|
|
|
- * @return List<PatentRight>
|
|
|
+ * @return List<PatentRight>
|
|
|
+ * @function 对权要进行合并操作
|
|
|
*/
|
|
|
|
|
|
private List<PatentRight> FormatPatentRights(List<PatentRight> patentRights) {
|
|
@@ -69,13 +73,13 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- *@function 从PAS系统上获得权要并拆分
|
|
|
- * @param patentNo 专利号
|
|
|
+ * @param patentNo 专利号
|
|
|
* @param splitType 拆分类型
|
|
|
- * @param splitBy 拆分依据
|
|
|
- * @param reportId 报告id
|
|
|
+ * @param splitBy 拆分依据
|
|
|
+ * @param reportId 报告id
|
|
|
* @return 是否拆分成功
|
|
|
* @throws IOException
|
|
|
+ * @function 从PAS系统上获得权要并拆分
|
|
|
*/
|
|
|
public String splitPatentRight(String patentNo, Integer splitType, Integer splitBy, Integer reportId) throws IOException {
|
|
|
PersonnelVO personnelVO = cacheUtils.getLoginUser(StpUtil.getLoginIdAsInt());
|
|
@@ -83,16 +87,16 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
|
|
|
LambdaQueryWrapper<Report> queryWrapper = new LambdaQueryWrapper();
|
|
|
queryWrapper.eq(Report::getId, reportId);
|
|
|
//未查到报告报错
|
|
|
- if( reportService.list(queryWrapper).size()==0){
|
|
|
- return Response.error("未查询到报告");
|
|
|
- }
|
|
|
+ if (reportService.list(queryWrapper).size() == 0) {
|
|
|
+ return Response.error("未查询到报告");
|
|
|
+ }
|
|
|
Report report = reportService.list(queryWrapper).get(0);
|
|
|
Integer flag = 0;
|
|
|
- if(splitBy==null){
|
|
|
- splitBy=0;
|
|
|
+ if (splitBy == null) {
|
|
|
+ splitBy = 0;
|
|
|
}
|
|
|
- if(splitType==null){
|
|
|
- splitType=0;
|
|
|
+ if (splitType == null) {
|
|
|
+ splitType = 0;
|
|
|
}
|
|
|
//如果报告未拆分过权要,或者拆分类型不同则更新报告
|
|
|
if (report.getSplitBy() == null || report.getSplitType() == null || report.getSplitBy() != splitBy || report.getSplitType() != splitType) {
|
|
@@ -113,10 +117,10 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
|
|
|
List<Integer> partRightIds = new ArrayList<>();
|
|
|
List<String> flags = new ArrayList<>();
|
|
|
// 当splitType=0仅拆解主权要
|
|
|
- if (splitType .equals(0) ) {
|
|
|
- partRightIds = patentRights.stream().filter(item -> item.getType() .equals(1) ).map(PatentRight::getId).collect(Collectors.toList());
|
|
|
+ if (splitType.equals(0)) {
|
|
|
+ partRightIds = patentRights.stream().filter(item -> item.getType().equals(1)).map(PatentRight::getId).collect(Collectors.toList());
|
|
|
}// 当splitType=1拆解全部权要
|
|
|
- else if (splitType .equals(1) ) {
|
|
|
+ else if (splitType.equals(1)) {
|
|
|
partRightIds = patentRights.stream().map(PatentRight::getId).collect(Collectors.toList());
|
|
|
}
|
|
|
//当splitBy=0时仅仅根据“,”拆解
|
|
@@ -135,8 +139,8 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
|
|
|
flags.add(",");
|
|
|
flags.add(",");
|
|
|
}
|
|
|
- Integer a=splitBy;
|
|
|
- Integer b =splitType;
|
|
|
+ Integer a = splitBy;
|
|
|
+ Integer b = splitType;
|
|
|
Features featureTO = new Features();
|
|
|
featureTO.setReportId(reportId);
|
|
|
featureTO.setSignPatentNo(patentNo);
|
|
@@ -150,54 +154,54 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
|
|
|
wrapper.eq(Features::getReportId, reportId)
|
|
|
.eq(Features::getSignPatentNo, patentNo)
|
|
|
.eq(Features::getPartnerId, personnelVO.getId());
|
|
|
- wrapper.and(QueryWrapper -> QueryWrapper.ne(Features::getSplitBy,a).or().ne(Features::getSplitType,b));
|
|
|
+ wrapper.and(QueryWrapper -> QueryWrapper.ne(Features::getSplitBy, a).or().ne(Features::getSplitType, b));
|
|
|
this.remove(wrapper);
|
|
|
//将拆解的权要和特征装载到对象PatentRightVo
|
|
|
for (int i = 0; i < patentRights.size(); i++) {
|
|
|
//特征序号
|
|
|
- Integer order =1;
|
|
|
+ Integer order = 1;
|
|
|
List<Features> featuresList = new ArrayList<>();
|
|
|
- String[] tems= patentRights.get(i).getContent().split("\\.");
|
|
|
- String name ="权要"+tems[0].replace(" ","");
|
|
|
+ String[] tems = patentRights.get(i).getContent().split("\\.");
|
|
|
+ String name = "权要" + tems[0].replace(" ", "");
|
|
|
int rightId = patentRights.get(i).getId();
|
|
|
//对需要拆解的权要进行拆解
|
|
|
|
|
|
- if (featureFromDb != null && featureFromDb.size() != 0) {
|
|
|
- featuresList = featureFromDb.stream().filter(item -> item.getRightId() .equals(rightId) &&item.getSplitBy().equals(a) &&item.getPartnerId().equals(personnelVO.getId())&&item.getSplitType().equals(b)).collect(Collectors.toList());
|
|
|
+ if (featureFromDb != null && featureFromDb.size() != 0) {
|
|
|
+ featuresList = featureFromDb.stream().filter(item -> item.getRightId().equals(rightId) && item.getSplitBy().equals(a) && item.getPartnerId().equals(personnelVO.getId()) && item.getSplitType().equals(b)).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ //如果数据库里无拆解记录则手动插入一条
|
|
|
+ if (featuresList == null || featuresList.size() == 0 || flag == 1) {
|
|
|
+ featuresList = new ArrayList<>();
|
|
|
+ List<String> contentOuts = Arrays.asList(patentRights.get(i).getContentOut());
|
|
|
+ List<String> contents = Arrays.asList(patentRights.get(i).getContent());
|
|
|
+ //如果是需要拆解的权要
|
|
|
+ if (partRightIds.contains(patentRights.get(i).getId())) {
|
|
|
+ //获得权要的译文并且拆解
|
|
|
+ contentOuts = this.splitStringByFlags(patentRights.get(i).getContentOut(), flags);
|
|
|
+ //获得权要的原文并且拆解
|
|
|
+ contents = this.splitStringByFlags(patentRights.get(i).getContent(), flags);
|
|
|
}
|
|
|
- //如果数据库里无拆解记录则手动插入一条
|
|
|
- if (featuresList == null || featuresList.size() == 0 || flag == 1) {
|
|
|
- featuresList = new ArrayList<>();
|
|
|
- List<String> contentOuts = Arrays.asList(patentRights.get(i).getContentOut());
|
|
|
- List<String> contents =Arrays.asList(patentRights.get(i).getContent());
|
|
|
- //如果是需要拆解的权要
|
|
|
- if (partRightIds.contains(patentRights.get(i).getId())) {
|
|
|
- //获得权要的译文并且拆解
|
|
|
- contentOuts = this.splitStringByFlags(patentRights.get(i).getContentOut(), flags);
|
|
|
- //获得权要的原文并且拆解
|
|
|
- contents = this.splitStringByFlags(patentRights.get(i).getContent(), flags);
|
|
|
- }
|
|
|
- //遍历拆解出来的内容并装载到features最后存入列表
|
|
|
- for (int t = 0; t < contents.size(); t++) {
|
|
|
- Features features = new Features();
|
|
|
- features.setRightId(patentRights.get(i).getId());
|
|
|
- features.setIsFinal(0);
|
|
|
- features.setSignPatentNo(patentNo);
|
|
|
- features.setReportId(reportId);
|
|
|
- String countOut = contentOuts.size() - 1 >= t ? contentOuts.get(t) : "";
|
|
|
- features.setContentOut(countOut);
|
|
|
- features.setContent(contents.get(t));
|
|
|
- features.setSplitBy(splitBy);
|
|
|
- features.setPartnerId(personnelVO.getId());
|
|
|
- features.setRightName(name);
|
|
|
- features.setFeaturesOrder(order);
|
|
|
- features.setRightType(patentRights.get(i).getType());
|
|
|
- features.setSplitType(splitType);
|
|
|
- featuresList.add(features);
|
|
|
- order+=1;
|
|
|
- }
|
|
|
- this.saveBatch(featuresList);
|
|
|
+ //遍历拆解出来的内容并装载到features最后存入列表
|
|
|
+ for (int t = 0; t < contents.size(); t++) {
|
|
|
+ Features features = new Features();
|
|
|
+ features.setRightId(patentRights.get(i).getId());
|
|
|
+ features.setIsFinal(0);
|
|
|
+ features.setSignPatentNo(patentNo);
|
|
|
+ features.setReportId(reportId);
|
|
|
+ String countOut = contentOuts.size() - 1 >= t ? contentOuts.get(t) : "";
|
|
|
+ features.setContentOut(countOut);
|
|
|
+ features.setContent(contents.get(t));
|
|
|
+ features.setSplitBy(splitBy);
|
|
|
+ features.setPartnerId(personnelVO.getId());
|
|
|
+ features.setRightName(name);
|
|
|
+ features.setFeaturesOrder(order);
|
|
|
+ features.setRightType(patentRights.get(i).getType());
|
|
|
+ features.setSplitType(splitType);
|
|
|
+ featuresList.add(features);
|
|
|
+ order += 1;
|
|
|
}
|
|
|
+ this.saveBatch(featuresList);
|
|
|
+ }
|
|
|
//装载到对象PatentRightVo
|
|
|
PatentRightVo patentRightVo = new PatentRightVo();
|
|
|
patentRightVo.setPatentId(patentRights.get(i).getPatentId());
|
|
@@ -219,27 +223,27 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @function 根据报告id 和专利号查询专利特征表
|
|
|
* @param patentNos 专利号
|
|
|
* @param reportId 报告id
|
|
|
* @return map
|
|
|
* @throws IOException
|
|
|
+ * @function 根据报告id 和专利号查询专利特征表
|
|
|
*/
|
|
|
|
|
|
public String getFeatures(String patentNos, Integer reportId) throws IOException {
|
|
|
|
|
|
LambdaQueryWrapper<Report> queryWrapper = new LambdaQueryWrapper();
|
|
|
queryWrapper.eq(Report::getId, reportId);
|
|
|
- if(reportService.list(queryWrapper).size()==0){
|
|
|
+ if (reportService.list(queryWrapper).size() == 0) {
|
|
|
return "";
|
|
|
}
|
|
|
Report report = reportService.list(queryWrapper).get(0);
|
|
|
//权要(带拆分的特征)列表
|
|
|
List<PatentRightVo> patentRightVos = new ArrayList<>();
|
|
|
- String patentNo =report.getSignPatentNo();
|
|
|
+ String patentNo = report.getSignPatentNo();
|
|
|
//从pas获得权要信息
|
|
|
- if(patentNos!=null){
|
|
|
- patentNo=patentNos;
|
|
|
+ if (patentNos != null) {
|
|
|
+ patentNo = patentNos;
|
|
|
}
|
|
|
String resBody = outInterfaceService.getPatentRightFromPAS(patentNo);
|
|
|
JSONObject jsonObject = JSONObject.parseObject(resBody);
|
|
@@ -247,7 +251,7 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
|
|
|
List<PatentRight> patentRightsOrgin = JSON.parseArray(jsonObject.getString("data"), PatentRight.class);
|
|
|
//处理权要
|
|
|
List<PatentRight> patentRights = FormatPatentRights(patentRightsOrgin);
|
|
|
- Features featureTO = new Features();
|
|
|
+ Features featureTO = new Features();
|
|
|
featureTO.setReportId(reportId);
|
|
|
featureTO.setSignPatentNo(patentNo);
|
|
|
featureTO.setPartnerId(report.getPersonId());
|
|
@@ -258,10 +262,10 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
|
|
|
|
|
|
List<Features> featuresList = new ArrayList<>();
|
|
|
//对需要拆解的权要进行拆解
|
|
|
- if (featureFromDb != null && featureFromDb.size() != 0) {
|
|
|
- int rightId = patentRights.get(i).getId();
|
|
|
- featuresList = featureFromDb.stream().filter(item -> item.getRightId().equals(rightId) &&item.getPartnerId().equals(report.getPersonId())).collect(Collectors.toList());
|
|
|
- }
|
|
|
+ if (featureFromDb != null && featureFromDb.size() != 0) {
|
|
|
+ int rightId = patentRights.get(i).getId();
|
|
|
+ featuresList = featureFromDb.stream().filter(item -> item.getRightId().equals(rightId) && item.getPartnerId().equals(report.getPersonId())).collect(Collectors.toList());
|
|
|
+ }
|
|
|
//装载到对象PatentRightVo
|
|
|
PatentRightVo patentRightVo = new PatentRightVo();
|
|
|
String name = "权要" + (i + 1);
|
|
@@ -282,6 +286,7 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
|
|
|
map.put("splitType", report.getSplitType());
|
|
|
return Response.success(map);
|
|
|
}
|
|
|
+
|
|
|
//根据符号拆分字符串
|
|
|
public List<String> splitStringByFlags(String sentence, List<String> flags) {
|
|
|
List<String> sectences = new ArrayList<>();
|
|
@@ -351,17 +356,17 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
|
|
|
//根据登录人Id,报告Id,标的专利号删除原有特征
|
|
|
this.remove(wrapper);
|
|
|
for (int i = 0; i < patentRightVos.size(); i++) {
|
|
|
- int order=1;
|
|
|
+ int order = 1;
|
|
|
PatentRightVo patentRightVo = patentRightVos.get(i);
|
|
|
if (patentRightVo.getFeatures() != null && patentRightVo.getFeatures().size() != 0) {
|
|
|
- List<Features> tem =patentRightVo.getFeatures();
|
|
|
+ List<Features> tem = patentRightVo.getFeatures();
|
|
|
for (int t = 0; t < tem.size(); t++) {
|
|
|
tem.get(t).setFeaturesOrder(order);
|
|
|
tem.get(t).setPartnerId(personnelVO.getId());
|
|
|
tem.get(t).setSplitBy(feature.getSplitBy());
|
|
|
tem.get(t).setSplitType(feature.getSplitType());
|
|
|
tem.get(t).setId(null);
|
|
|
- order+=1;
|
|
|
+ order += 1;
|
|
|
features.add(tem.get(t));
|
|
|
}
|
|
|
}
|
|
@@ -371,46 +376,83 @@ public class FeatureService extends ServiceImpl<FeatureMapper, Features> {
|
|
|
return Response.success();
|
|
|
}
|
|
|
|
|
|
- public String querySimFeaturePatent(PatentVO patentVO) throws IOException {
|
|
|
+ public List<Map<String,Object>> querySimFeaturePatent(PatentVO patentVO) throws IOException {
|
|
|
//获得当前用户信息
|
|
|
- PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
|
|
|
+ PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
|
|
|
//根据报告Id,拆分人Id,标的专利号获得特征。
|
|
|
LambdaQueryWrapper<Features> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
queryWrapper.eq(Features::getReportId, patentVO.getReportId())
|
|
|
- .eq(Features::getPartnerId, personnelVO.getId());
|
|
|
+ .eq(Features::getPartnerId, personnelVO.getId());
|
|
|
List<Features> features = this.list(queryWrapper);
|
|
|
- LambdaQueryWrapper<Report> lambdaQueryWrapper =new LambdaQueryWrapper<>();
|
|
|
- lambdaQueryWrapper.eq(Report::getId,patentVO.getReportId());
|
|
|
- List<Report> reports =reportService.list(lambdaQueryWrapper);
|
|
|
- List<String> signPatentNos =reports.stream().map(Report::getSignPatentNo).collect(Collectors.toList());
|
|
|
+ LambdaQueryWrapper<Report> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ lambdaQueryWrapper.eq(Report::getId, patentVO.getReportId());
|
|
|
+ Report report = reportService.list(lambdaQueryWrapper).get(0);
|
|
|
+ String signPatentNo = report.getSignPatentNo();
|
|
|
//获得特征内容
|
|
|
List<String> contents = features.stream().map(Features::getContent).collect(Collectors.toList());
|
|
|
- List<String> patentNos = featureMapper.getSignPatentNo(contents);
|
|
|
- patentNos.removeAll(signPatentNos);
|
|
|
- if(patentNos.size()==0)
|
|
|
- {return Response.success();}
|
|
|
- patentVO.setPatentNos(patentNos);
|
|
|
- String res= outInterfaceService.getPatentFromPAS(patentVO,1);
|
|
|
+ List<Features> featuresList = featureMapper.getSignPatentNo(contents,signPatentNo);
|
|
|
+ if (featuresList.size() == 0) {
|
|
|
+ return new ArrayList<Map<String,Object>>();
|
|
|
+ }
|
|
|
+ //根据特征Id 查询 对比记录特征关联信息
|
|
|
+ List<Integer> featureIds =featuresList.stream().map(Features::getId).collect(Collectors.toList());
|
|
|
+ List<AssoRecordsFeature> assoRecordsFeatures =new ArrayList<>();
|
|
|
+ List<CompareRecords> compareRecords =new ArrayList<>();
|
|
|
+ if(featureIds!=null&featureIds.size()>0) {
|
|
|
+ LambdaQueryWrapper<AssoRecordsFeature> queryWrapper1 = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper1.in(AssoRecordsFeature::getFeatureId, featureIds);
|
|
|
+ assoRecordsFeatures = assoRecordsFeatureService.list(queryWrapper1);
|
|
|
+ // 根据关联信息获得对比记录ID
|
|
|
+ List<Integer> recordsId =assoRecordsFeatures.stream().map(AssoRecordsFeature::getRecordsId).collect(Collectors.toList());
|
|
|
+ //根据对比记录ID获得对比记录信息
|
|
|
+ LambdaQueryWrapper<CompareRecords> queryWrapper2 =new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper2.in(CompareRecords::getId,recordsId);
|
|
|
+ compareRecords =compareRecordsService.list(queryWrapper2);
|
|
|
+ }
|
|
|
+ //装载信息
|
|
|
+List<Map<String,Object>> mapList =new ArrayList<Map<String,Object>>();
|
|
|
+ //装载特征对应划出的话
|
|
|
+ while (featuresList.size()>0) {
|
|
|
+ Map<String,Object> map =new HashMap<>();
|
|
|
+ List<Map<String,Object>> temMapList =new ArrayList<>();
|
|
|
+ Features features1 =featuresList.get(0);
|
|
|
+ featuresList.remove(features1);
|
|
|
+ map.put("signPatentNo",features1.getSignPatentNo());
|
|
|
+ for (Features tem : featuresList) {
|
|
|
+ if(tem.getSignPatentNo().equals(features1.getSignPatentNo())){
|
|
|
+ Map<String, Object> temMap = new HashMap<>();
|
|
|
+ List<Integer> recordIds = assoRecordsFeatures.stream().filter(item -> item.getFeatureId().equals(tem.getId())).map(AssoRecordsFeature::getRecordsId).collect(Collectors.toList());
|
|
|
+ List<CompareRecords> PartRecords = compareRecords.stream().filter(item -> recordIds.contains(item)).collect(Collectors.toList());
|
|
|
+ temMap.put("feature", tem);
|
|
|
+ temMap.put("CompareRecords", PartRecords);
|
|
|
+ temMapList.add(temMap);
|
|
|
+ features.remove(tem);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ map.put("features",temMapList);
|
|
|
+ mapList.add(map);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
- return res;
|
|
|
+ return mapList;
|
|
|
}
|
|
|
- public Features select(int id){
|
|
|
+
|
|
|
+ public Features select(int id) {
|
|
|
LambdaQueryWrapper<Features> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper.eq(Features::getId,id);
|
|
|
- if(this.list(queryWrapper).size()==0){
|
|
|
+ queryWrapper.eq(Features::getId, id);
|
|
|
+ if (this.list(queryWrapper).size() == 0) {
|
|
|
return null;
|
|
|
}
|
|
|
return this.list(queryWrapper).get(0);
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public Integer delByReportId(int reportId){
|
|
|
+ public Integer delByReportId(int reportId) {
|
|
|
LambdaQueryWrapper<Features> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- queryWrapper.eq(Features::getReportId,reportId);
|
|
|
+ queryWrapper.eq(Features::getReportId, reportId);
|
|
|
this.remove(queryWrapper);
|
|
|
- List<Features> features =this.list(queryWrapper);
|
|
|
+ List<Features> features = this.list(queryWrapper);
|
|
|
return 1;
|
|
|
}
|
|
|
|