|
@@ -1,19 +1,18 @@
|
|
package cn.cslg.pas.service;
|
|
package cn.cslg.pas.service;
|
|
|
|
|
|
-import cn.cslg.pas.domain.*;
|
|
|
|
-import cn.cslg.pas.common.utils.StringUtils;
|
|
|
|
-import cn.cslg.pas.mapper.PatentSimpleFamilyMapper;
|
|
|
|
import cn.cslg.pas.common.model.params.PatentSimpleFamilyParams;
|
|
import cn.cslg.pas.common.model.params.PatentSimpleFamilyParams;
|
|
import cn.cslg.pas.common.utils.PatentUtils;
|
|
import cn.cslg.pas.common.utils.PatentUtils;
|
|
|
|
+import cn.cslg.pas.common.utils.StringUtils;
|
|
|
|
+import cn.cslg.pas.domain.Patent;
|
|
|
|
+import cn.cslg.pas.domain.PatentSimpleFamily;
|
|
|
|
+import cn.cslg.pas.domain.PatentSimpleFamilyLink;
|
|
|
|
+import cn.cslg.pas.mapper.PatentSimpleFamilyMapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
import org.springframework.context.annotation.Lazy;
|
|
import org.springframework.context.annotation.Lazy;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.lang.reflect.Array;
|
|
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.Arrays;
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -33,16 +32,16 @@ public class PatentSimpleFamilyService extends ServiceImpl<PatentSimpleFamilyMap
|
|
private final PatentApplicantService patentApplicantService;
|
|
private final PatentApplicantService patentApplicantService;
|
|
private final PatentSimpleFamilyLinkService patentSimpleFamilyLinkService;
|
|
private final PatentSimpleFamilyLinkService patentSimpleFamilyLinkService;
|
|
|
|
|
|
- public PatentSimpleFamily getPatentSimpleFamilyByIdsAndType(List<Integer> ids, Integer type) {
|
|
|
|
|
|
+ public PatentSimpleFamily getPatentSimpleFamilyByIdsAndType(List<Integer> ids, Integer type) {
|
|
if (ids == null || ids.size() == 0) {
|
|
if (ids == null || ids.size() == 0) {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
LambdaQueryWrapper<PatentSimpleFamily> queryWrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<PatentSimpleFamily> queryWrapper = new LambdaQueryWrapper<>();
|
|
queryWrapper.in(PatentSimpleFamily::getId, ids);
|
|
queryWrapper.in(PatentSimpleFamily::getId, ids);
|
|
queryWrapper.eq(PatentSimpleFamily::getType, type);
|
|
queryWrapper.eq(PatentSimpleFamily::getType, type);
|
|
- List<PatentSimpleFamily> patentSimpleFamilies =this.list(queryWrapper);
|
|
|
|
- if(patentSimpleFamilies.size()==0){
|
|
|
|
- return null;
|
|
|
|
|
|
+ List<PatentSimpleFamily> patentSimpleFamilies = this.list(queryWrapper);
|
|
|
|
+ if (patentSimpleFamilies.size() == 0) {
|
|
|
|
+ return null;
|
|
}
|
|
}
|
|
return patentSimpleFamilies.get(0);
|
|
return patentSimpleFamilies.get(0);
|
|
}
|
|
}
|
|
@@ -56,7 +55,7 @@ public class PatentSimpleFamilyService extends ServiceImpl<PatentSimpleFamilyMap
|
|
return this.list(queryWrapper);
|
|
return this.list(queryWrapper);
|
|
}
|
|
}
|
|
|
|
|
|
- public void importPatentSimpleFamily(Patent patent, List<PatentSimpleFamily> importPatentSimpleFamilyList, List<PatentSimpleFamilyLink> importPatentSimpleFamilyLinkList) {
|
|
|
|
|
|
+ public void importPatentSimpleFamily(Patent patent, List<PatentSimpleFamily> importPatentSimpleFamilyList, List<PatentSimpleFamilyLink> importPatentSimpleFamilyLinkList) {
|
|
List<PatentSimpleFamilyLink> importPatentSimpleFamilyLink = importPatentSimpleFamilyLinkList.stream().filter(item -> item.getFamilyId().equals(patent.getSimpleFamily())).collect(Collectors.toList());
|
|
List<PatentSimpleFamilyLink> importPatentSimpleFamilyLink = importPatentSimpleFamilyLinkList.stream().filter(item -> item.getFamilyId().equals(patent.getSimpleFamily())).collect(Collectors.toList());
|
|
List<PatentSimpleFamilyLink> importPatentInpadocFamilyLink = importPatentSimpleFamilyLinkList.stream().filter(item -> item.getFamilyId().equals(patent.getInpadocFamily())).collect(Collectors.toList());
|
|
List<PatentSimpleFamilyLink> importPatentInpadocFamilyLink = importPatentSimpleFamilyLinkList.stream().filter(item -> item.getFamilyId().equals(patent.getInpadocFamily())).collect(Collectors.toList());
|
|
List<PatentSimpleFamilyLink> importPatentPatSnapFamilyLink = importPatentSimpleFamilyLinkList.stream().filter(item -> item.getFamilyId().equals(patent.getPatSnapFamily())).collect(Collectors.toList());
|
|
List<PatentSimpleFamilyLink> importPatentPatSnapFamilyLink = importPatentSimpleFamilyLinkList.stream().filter(item -> item.getFamilyId().equals(patent.getPatSnapFamily())).collect(Collectors.toList());
|
|
@@ -91,11 +90,11 @@ public class PatentSimpleFamilyService extends ServiceImpl<PatentSimpleFamilyMap
|
|
public void updateData(List<String> familyNo, String patentNo, Integer patentId, Integer type) {
|
|
public void updateData(List<String> familyNo, String patentNo, Integer patentId, Integer type) {
|
|
//两个表 1.同族表 2.同组关联专利表
|
|
//两个表 1.同族表 2.同组关联专利表
|
|
//用专利号 获取同族关联专利表的信息
|
|
//用专利号 获取同族关联专利表的信息
|
|
- if(!familyNo.contains(patentNo)){
|
|
|
|
- familyNo.add(patentNo);
|
|
|
|
- }
|
|
|
|
|
|
+ if (!familyNo.contains(patentNo)) {
|
|
|
|
+ familyNo.add(patentNo);
|
|
|
|
+ }
|
|
List<PatentSimpleFamilyLink> patentSimpleFamilyLinkList = patentSimpleFamilyLinkService.getPatentSimpleFamilyLinkByPatentNo(familyNo);
|
|
List<PatentSimpleFamilyLink> patentSimpleFamilyLinkList = patentSimpleFamilyLinkService.getPatentSimpleFamilyLinkByPatentNo(familyNo);
|
|
- PatentSimpleFamily family =new PatentSimpleFamily();
|
|
|
|
|
|
+ PatentSimpleFamily family = new PatentSimpleFamily();
|
|
|
|
|
|
if (patentSimpleFamilyLinkList == null || patentSimpleFamilyLinkList.size() == 0) {
|
|
if (patentSimpleFamilyLinkList == null || patentSimpleFamilyLinkList.size() == 0) {
|
|
//如果 同组关联专利表 内没有数据 就新建一条 同族表 的数据
|
|
//如果 同组关联专利表 内没有数据 就新建一条 同族表 的数据
|
|
@@ -105,19 +104,18 @@ public class PatentSimpleFamilyService extends ServiceImpl<PatentSimpleFamilyMap
|
|
PatentSimpleFamily patentSimpleFamily = this.getPatentSimpleFamilyByIdsAndType(patentSimpleFamilyLinkList.stream().map(PatentSimpleFamilyLink::getFamilyId).collect(Collectors.toList()), type);
|
|
PatentSimpleFamily patentSimpleFamily = this.getPatentSimpleFamilyByIdsAndType(patentSimpleFamilyLinkList.stream().map(PatentSimpleFamilyLink::getFamilyId).collect(Collectors.toList()), type);
|
|
if (patentSimpleFamily == null) {
|
|
if (patentSimpleFamily == null) {
|
|
family = this.add(type);
|
|
family = this.add(type);
|
|
|
|
+ } else {
|
|
|
|
+ family = patentSimpleFamily;
|
|
}
|
|
}
|
|
- else {
|
|
|
|
- family = patentSimpleFamily;
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
// List<PatentSimpleFamilyLink> temps = patentSimpleFamilyLinkService.getPatentSimpleFamilyLinkByPatentNoAndFamilyId(familyNo, family.getId());
|
|
// List<PatentSimpleFamilyLink> temps = patentSimpleFamilyLinkService.getPatentSimpleFamilyLinkByPatentNoAndFamilyId(familyNo, family.getId());
|
|
|
|
|
|
List<Patent> patent1s = patentService.getPublicDateAndPatentNoByPatentNo(familyNo);
|
|
List<Patent> patent1s = patentService.getPublicDateAndPatentNoByPatentNo(familyNo);
|
|
- // 遍历
|
|
|
|
- if(patentSimpleFamilyLinkList!=null&&patentSimpleFamilyLinkList.size()!=0) {
|
|
|
|
- Patent patent2 =new Patent();
|
|
|
|
|
|
+ // 遍历
|
|
|
|
+ if (patentSimpleFamilyLinkList != null && patentSimpleFamilyLinkList.size() != 0) {
|
|
|
|
+ Patent patent2 = new Patent();
|
|
for (String patent : familyNo) {
|
|
for (String patent : familyNo) {
|
|
- PatentSimpleFamilyLink temp = patentSimpleFamilyLinkList.stream().filter(item -> item. getPatentNo().equals(patent)).findFirst().orElse(null);
|
|
|
|
|
|
+ PatentSimpleFamilyLink temp = patentSimpleFamilyLinkList.stream().filter(item -> item.getPatentNo().equals(patent)).findFirst().orElse(null);
|
|
if (temp == null) {
|
|
if (temp == null) {
|
|
PatentSimpleFamilyLink patentSimpleFamilyLink = new PatentSimpleFamilyLink();
|
|
PatentSimpleFamilyLink patentSimpleFamilyLink = new PatentSimpleFamilyLink();
|
|
patentSimpleFamilyLink.setFamilyId(family.getId());
|
|
patentSimpleFamilyLink.setFamilyId(family.getId());
|
|
@@ -129,8 +127,8 @@ public class PatentSimpleFamilyService extends ServiceImpl<PatentSimpleFamilyMap
|
|
}
|
|
}
|
|
|
|
|
|
//更新同族专利的同族号
|
|
//更新同族专利的同族号
|
|
- Patent patent1 = patent1s.stream().filter(item -> item.getPatentNo().equals(patent)).findFirst().orElse(null);
|
|
|
|
- if (patent1 != null&&patent1.getType()!=null) {
|
|
|
|
|
|
+ Patent patent1 = patent1s.stream().filter(item -> item.getPatentNo().equals(patent)).findFirst().orElse(null);
|
|
|
|
+ if (patent1 != null && patent1.getType() != null) {
|
|
switch (type) {
|
|
switch (type) {
|
|
case 1:
|
|
case 1:
|
|
patent1.setSimpleFamily(family.getId());
|
|
patent1.setSimpleFamily(family.getId());
|
|
@@ -154,27 +152,23 @@ public class PatentSimpleFamilyService extends ServiceImpl<PatentSimpleFamilyMap
|
|
String country2 = PatentUtils.getPatentCountry(patent2.getPatentNo());
|
|
String country2 = PatentUtils.getPatentCountry(patent2.getPatentNo());
|
|
if ("CN".equals(country1) && !"CN".equals(country2)) {
|
|
if ("CN".equals(country1) && !"CN".equals(country2)) {
|
|
family.setPatentNo(patent1.getPatentNo());
|
|
family.setPatentNo(patent1.getPatentNo());
|
|
- patent2 =patent1;
|
|
|
|
- }
|
|
|
|
- else if (!"CN".equals(country1) && "CN".equals(country2)) {
|
|
|
|
|
|
+ patent2 = patent1;
|
|
|
|
+ } else if (!"CN".equals(country1) && "CN".equals(country2)) {
|
|
family.setPatentNo(patent2.getPatentNo());
|
|
family.setPatentNo(patent2.getPatentNo());
|
|
- }
|
|
|
|
- else if (("CN".equals(country1) && "CN".equals(country2))||(!"CN".equals(country1) && !"CN".equals(country2))) {
|
|
|
|
|
|
+ } else if (("CN".equals(country1) && "CN".equals(country2)) || (!"CN".equals(country1) && !"CN".equals(country2))) {
|
|
Integer publicData1 = patent1.getPublicDate();
|
|
Integer publicData1 = patent1.getPublicDate();
|
|
Integer publicData2 = patent2.getPublicDate();
|
|
Integer publicData2 = patent2.getPublicDate();
|
|
if (publicData1 == null && publicData2 != null) {
|
|
if (publicData1 == null && publicData2 != null) {
|
|
family.setPatentNo(patent2.getPatentNo());
|
|
family.setPatentNo(patent2.getPatentNo());
|
|
- }
|
|
|
|
- else if (publicData1 != null && publicData2 == null) {
|
|
|
|
|
|
+ } else if (publicData1 != null && publicData2 == null) {
|
|
family.setPatentNo(patent1.getPatentNo());
|
|
family.setPatentNo(patent1.getPatentNo());
|
|
- patent2 =patent1;
|
|
|
|
- }
|
|
|
|
- else if (publicData1 != null && publicData2 != null) {
|
|
|
|
|
|
+ patent2 = patent1;
|
|
|
|
+ } else if (publicData1 != null && publicData2 != null) {
|
|
if (publicData1 > publicData2) {
|
|
if (publicData1 > publicData2) {
|
|
family.setPatentNo(patent2.getPatentNo());
|
|
family.setPatentNo(patent2.getPatentNo());
|
|
} else {
|
|
} else {
|
|
family.setPatentNo(patent1.getPatentNo());
|
|
family.setPatentNo(patent1.getPatentNo());
|
|
- patent2 =patent1;
|
|
|
|
|
|
+ patent2 = patent1;
|
|
System.out.println(patent2);
|
|
System.out.println(patent2);
|
|
}
|
|
}
|
|
}
|
|
}
|