|
@@ -119,7 +119,7 @@ public class GetPatentStarPartService {
|
|
|
ArrayList<PatentInstruction> patentInstructions = new ArrayList<>();
|
|
|
PatentDTO patentDTO = new PatentDTO();
|
|
|
|
|
|
- String pdfUrl = "", pdfUrlOA = "", pdfUrlOC = "";
|
|
|
+ String pdfUrl = "", pdfUrl1 = "", pdfUrl2 = "";
|
|
|
if (patentNo.contains("CN")) {
|
|
|
//根据申请号调用"获得中国专利pdf"接口,获得1个或2个pdf的url地址
|
|
|
String pdfUrlStr = patentStarApiService.getCnPdfApi(appNo);
|
|
@@ -128,45 +128,60 @@ public class GetPatentStarPartService {
|
|
|
}
|
|
|
if (pdfUrlStr.contains("|http")) { //若包含公开和授权两个pdf
|
|
|
String[] pdfUrlArr = pdfUrlStr.split("\\|http");
|
|
|
- pdfUrlOA = pdfUrlArr[0].substring(pdfUrlArr[0].indexOf("http"), pdfUrlArr[0].indexOf("0A_CN_0.pdf") + 11);
|
|
|
- pdfUrlArr[1] = "|http" + pdfUrlArr[1];
|
|
|
- pdfUrlOC = pdfUrlArr[1].substring(pdfUrlArr[1].indexOf("http"), pdfUrlArr[1].indexOf("0C_CN_0.pdf") + 11);
|
|
|
- } else if (pdfUrlStr.contains("0A_CN_0.pdf")) { //若只有一个且是OA
|
|
|
- pdfUrlOA = pdfUrlStr.substring(pdfUrlStr.indexOf("http"), pdfUrlStr.indexOf("0A_CN_0.pdf") + 11);
|
|
|
- } else if (pdfUrlStr.contains("0C_CN_0.pdf")) { //若只有一个且是OC
|
|
|
- pdfUrlOC = pdfUrlStr.substring(pdfUrlStr.indexOf("http"), pdfUrlStr.indexOf("0C_CN_0.pdf") + 11);
|
|
|
- }
|
|
|
-
|
|
|
- //公开pdf文档
|
|
|
- if (!pdfUrlOA.equals("")) {
|
|
|
- PatentInstruction patentInstruction = new PatentInstruction();
|
|
|
- patentInstruction.setUrl(pdfUrlOA);
|
|
|
- patentInstruction.setType(1);
|
|
|
- patentInstructions.add(patentInstruction);
|
|
|
- }
|
|
|
- //授权pdf文档
|
|
|
- if (!pdfUrlOC.equals("")) {
|
|
|
+ pdfUrl1 = pdfUrlArr[0].substring(pdfUrlArr[0].indexOf("http"), pdfUrlArr[0].indexOf("?"));
|
|
|
+ pdfUrlArr[1] = "http" + pdfUrlArr[1];
|
|
|
+ pdfUrl2 = pdfUrlArr[1].substring(pdfUrlArr[1].indexOf("http"), pdfUrlArr[1].indexOf("?"));
|
|
|
+ if (pdfUrl1.contains("0A_CN_0.pdf")) {
|
|
|
+ PatentInstruction patentInstruction = new PatentInstruction();
|
|
|
+ patentInstruction.setUrl(pdfUrl1);
|
|
|
+ patentInstruction.setType(1);
|
|
|
+ patentInstructions.add(patentInstruction);
|
|
|
+ PatentInstruction patentInstruction2 = new PatentInstruction();
|
|
|
+ patentInstruction2.setUrl(pdfUrl2);
|
|
|
+ patentInstruction2.setType(2);
|
|
|
+ patentInstructions.add(patentInstruction2);
|
|
|
+ } else {
|
|
|
+ PatentInstruction patentInstruction = new PatentInstruction();
|
|
|
+ patentInstruction.setUrl(pdfUrl2);
|
|
|
+ patentInstruction.setType(1);
|
|
|
+ patentInstructions.add(patentInstruction);
|
|
|
+ PatentInstruction patentInstruction2 = new PatentInstruction();
|
|
|
+ patentInstruction2.setUrl(pdfUrl1);
|
|
|
+ patentInstruction2.setType(2);
|
|
|
+ patentInstructions.add(patentInstruction2);
|
|
|
+ }
|
|
|
+ } else { //若只有一个
|
|
|
+ pdfUrl1 = pdfUrlStr.substring(pdfUrlStr.indexOf("http"), pdfUrlStr.indexOf("?"));
|
|
|
PatentInstruction patentInstruction = new PatentInstruction();
|
|
|
- patentInstruction.setUrl(pdfUrlOC);
|
|
|
- patentInstruction.setType(2);
|
|
|
+ patentInstruction.setUrl(pdfUrl1);
|
|
|
+ if (pdfUrl1.contains("0A_CN_0.pdf")) {
|
|
|
+ patentInstruction.setType(1);
|
|
|
+ } else {
|
|
|
+ patentInstruction.setType(2);
|
|
|
+ }
|
|
|
patentInstructions.add(patentInstruction);
|
|
|
+
|
|
|
}
|
|
|
- patentDTO.setPdf(patentInstructions);
|
|
|
- return patentDTO;
|
|
|
+
|
|
|
} else {
|
|
|
//根据专利号调用"获得世界专利pdf"接口,获得pdf的url地址
|
|
|
pdfUrl = patentStarApiService.getEnPdfApi(patentNo);
|
|
|
if (pdfUrl.equals("")) {
|
|
|
return new PatentDTO();
|
|
|
}
|
|
|
+ if (pdfUrl.contains("?Expire")) {
|
|
|
+ //pdfUrl = pdfUrl.substring(pdfUrl.indexOf("http"), pdfUrl.indexOf("?Expire"));
|
|
|
+ return patentDTO;
|
|
|
+ }
|
|
|
PatentInstruction patentInstruction = new PatentInstruction();
|
|
|
patentInstruction.setUrl(pdfUrl);
|
|
|
patentInstruction.setType(1);
|
|
|
patentInstructions.add(patentInstruction);
|
|
|
- patentDTO.setPdf(patentInstructions);
|
|
|
- return patentDTO;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+ patentDTO.setPdf(patentInstructions);
|
|
|
+ return patentDTO;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -209,90 +224,97 @@ public class GetPatentStarPartService {
|
|
|
.setCurrent(current)
|
|
|
.setSize(size);
|
|
|
|
|
|
- //以下 ↓装载的是调用"获得同族专利"接口返回的专利相关数据
|
|
|
- String familyPatentNoStr = patentStarApiService.getFamilyByPubNoApi(patentNo);
|
|
|
- //若没有同族号,则返回空集合(表示该公开号暂无同族)
|
|
|
- if (familyPatentNoStr.equals("no data")) {
|
|
|
- pageVO.setRecords(new ArrayList<>())
|
|
|
- .setTotal(0);
|
|
|
- patentDTO.setFamilyPatentResult(pageVO);
|
|
|
- return patentDTO;
|
|
|
- }
|
|
|
+ try {
|
|
|
+ //以下 ↓装载的是调用"获得同族专利"接口返回的专利相关数据
|
|
|
+ String familyPatentNoStr = patentStarApiService.getFamilyByPubNoApi(patentNo);
|
|
|
+ //若没有同族号,则返回空集合(表示该公开号暂无同族)
|
|
|
+ if (familyPatentNoStr.equals("no data")) {
|
|
|
+ pageVO.setRecords(new ArrayList<>())
|
|
|
+ .setTotal(0);
|
|
|
+ patentDTO.setFamilyPatentResult(pageVO);
|
|
|
+ return patentDTO;
|
|
|
+ }
|
|
|
|
|
|
- FamilyPatentNo familyPatentNo = JSON.parseObject(familyPatentNoStr, FamilyPatentNo.class);
|
|
|
- //familyPNStr:以分号;拼接的多个同族公开号字符串
|
|
|
- String familyPNStr = familyPatentNo.getFamilyinfo();
|
|
|
- List<String> familyPatentNos = Arrays.asList(familyPNStr.split(";"));
|
|
|
-
|
|
|
- //集合转成字符串
|
|
|
- String conditions = "PN=(" + StringUtils.join(familyPatentNos, " OR ") + ")";
|
|
|
-
|
|
|
- //调用一般接口返回这些同族号专利的著录相关数据(标题、申请人、权利人、摘要附图)
|
|
|
- PatentStarListDto patentStarListDto = new PatentStarListDto()
|
|
|
- .setCurrentQuery(conditions)
|
|
|
- .setOrderBy("ID")
|
|
|
- .setOrderByType("DESC")
|
|
|
- .setPageNum(current)
|
|
|
- .setRowCount(size)
|
|
|
- .setDBType("CN");
|
|
|
- Map<String, Object> resultMap = patentStarApiService.patentStarSearchApi(patentStarListDto);
|
|
|
- if (resultMap == null || (Integer) resultMap.get("total") == 0) {
|
|
|
- patentStarListDto.setDBType("WD");
|
|
|
- resultMap = patentStarApiService.patentStarSearchApi(patentStarListDto);
|
|
|
+ FamilyPatentNo familyPatentNo = JSON.parseObject(familyPatentNoStr, FamilyPatentNo.class);
|
|
|
+ //familyPNStr:以分号;拼接的多个同族公开号字符串
|
|
|
+ String familyPNStr = familyPatentNo.getFamilyinfo();
|
|
|
+ List<String> familyPatentNos = Arrays.asList(familyPNStr.split(";"));
|
|
|
+
|
|
|
+ //集合转成字符串
|
|
|
+ String conditions = "PN=(" + StringUtils.join(familyPatentNos, " OR ") + ")";
|
|
|
+
|
|
|
+ //调用一般接口返回这些同族号专利的著录相关数据(标题、申请人、权利人、摘要附图)
|
|
|
+ PatentStarListDto patentStarListDto = new PatentStarListDto()
|
|
|
+ .setCurrentQuery(conditions)
|
|
|
+ .setOrderBy("ID")
|
|
|
+ .setOrderByType("DESC")
|
|
|
+ .setPageNum(current)
|
|
|
+ .setRowCount(size)
|
|
|
+ .setDBType("CN");
|
|
|
+ Map<String, Object> resultMap = patentStarApiService.patentStarSearchApi(patentStarListDto);
|
|
|
if (resultMap == null || (Integer) resultMap.get("total") == 0) {
|
|
|
- ThrowException.throwXiaoShiException("发生未知错误,一般接口未检索出专利");
|
|
|
+ patentStarListDto.setDBType("WD");
|
|
|
+ resultMap = patentStarApiService.patentStarSearchApi(patentStarListDto);
|
|
|
+ if (resultMap == null || (Integer) resultMap.get("total") == 0) {
|
|
|
+ ThrowException.throwXiaoShiException("发生未知错误,一般接口未检索出专利");
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- List<StarPatentVO> patents = (List<StarPatentVO>) resultMap.get("records");
|
|
|
- int total = patents.size();
|
|
|
+ List<StarPatentVO> patents = (List<StarPatentVO>) resultMap.get("records");
|
|
|
+ int total = patents.size();
|
|
|
|
|
|
- //防止下标越界的判断(即判断所需当前页是否有数据)
|
|
|
- if ((current - 1) * size >= total) {
|
|
|
- pageVO.setRecords(new ArrayList<>())
|
|
|
- .setTotal(familyPatentNos.size());
|
|
|
- patentDTO.setFamilyPatentResult(pageVO);
|
|
|
- return patentDTO;
|
|
|
- }
|
|
|
+ //防止下标越界的判断(即判断所需当前页是否有数据)
|
|
|
+ if ((current - 1) * size >= total) {
|
|
|
+ pageVO.setRecords(new ArrayList<>())
|
|
|
+ .setTotal(familyPatentNos.size());
|
|
|
+ patentDTO.setFamilyPatentResult(pageVO);
|
|
|
+ return patentDTO;
|
|
|
+ }
|
|
|
|
|
|
- //根据分页信息,取分页区间内的同族号
|
|
|
- //familyPatentNos = pageBySubList(familyPatentNos, current, size);
|
|
|
-
|
|
|
- List<PatentSimpleFamilyLink> records = new ArrayList<>();
|
|
|
- for (StarPatentVO starPatent : patents) {
|
|
|
- PatentSimpleFamilyLink patentSimpleFamilyLink = new PatentSimpleFamilyLink();
|
|
|
- patentSimpleFamilyLink.setAbstractPath(starPatent.getAbstractPath()); //装载摘要附图
|
|
|
- patentSimpleFamilyLink.setPatentNo(starPatent.getPatentNo()); //装载公开号
|
|
|
- patentSimpleFamilyLink.setName(starPatent.getName()); //装载标题
|
|
|
- //装载申请人和权利人
|
|
|
- ArrayList<PatentApplicant> patentApplicants = new ArrayList<>();
|
|
|
- //装载申请人
|
|
|
- if (starPatent.getApplicantStr() != null && !starPatent.getApplicantStr().equals("")) {
|
|
|
- List<String> patentApplicantOriginalNames = Arrays.asList(starPatent.getApplicantStr().split(";"));
|
|
|
- for (String patentApplicantOriginalName : patentApplicantOriginalNames) {
|
|
|
- PatentApplicant patentApplicant = new PatentApplicant();
|
|
|
- patentApplicant.setName(patentApplicantOriginalName);
|
|
|
- patentApplicant.setDataType(1);
|
|
|
- patentApplicants.add(patentApplicant); //装载申请人
|
|
|
+ //根据分页信息,取分页区间内的同族号
|
|
|
+ //familyPatentNos = pageBySubList(familyPatentNos, current, size);
|
|
|
+
|
|
|
+ List<PatentSimpleFamilyLink> records = new ArrayList<>();
|
|
|
+ for (StarPatentVO starPatent : patents) {
|
|
|
+ PatentSimpleFamilyLink patentSimpleFamilyLink = new PatentSimpleFamilyLink();
|
|
|
+ patentSimpleFamilyLink.setAbstractPath(starPatent.getAbstractPath()); //装载摘要附图
|
|
|
+ patentSimpleFamilyLink.setPatentNo(starPatent.getPatentNo()); //装载公开号
|
|
|
+ patentSimpleFamilyLink.setName(starPatent.getName()); //装载标题
|
|
|
+ //装载申请人和权利人
|
|
|
+ ArrayList<PatentApplicant> patentApplicants = new ArrayList<>();
|
|
|
+ //装载申请人
|
|
|
+ if (starPatent.getApplicantStr() != null && !starPatent.getApplicantStr().equals("")) {
|
|
|
+ List<String> patentApplicantOriginalNames = Arrays.asList(starPatent.getApplicantStr().split(";"));
|
|
|
+ for (String patentApplicantOriginalName : patentApplicantOriginalNames) {
|
|
|
+ PatentApplicant patentApplicant = new PatentApplicant();
|
|
|
+ patentApplicant.setName(patentApplicantOriginalName);
|
|
|
+ patentApplicant.setDataType(1);
|
|
|
+ patentApplicants.add(patentApplicant); //装载申请人
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- //装载权利人
|
|
|
- if (starPatent.getCurrentApplicantStr() != null && !starPatent.getCurrentApplicantStr().equals("")) {
|
|
|
- List<String> patentApplicantCurrentNames = (Arrays.asList(starPatent.getCurrentApplicantStr().split(";")));
|
|
|
- for (String patentApplicantCurrentName : patentApplicantCurrentNames) {
|
|
|
- PatentApplicant patentApplicant = new PatentApplicant();
|
|
|
- patentApplicant.setName(patentApplicantCurrentName);
|
|
|
- patentApplicant.setDataType(2);
|
|
|
- patentApplicants.add(patentApplicant); //装载权利人
|
|
|
+ //装载权利人
|
|
|
+ if (starPatent.getCurrentApplicantStr() != null && !starPatent.getCurrentApplicantStr().equals("")) {
|
|
|
+ List<String> patentApplicantCurrentNames = (Arrays.asList(starPatent.getCurrentApplicantStr().split(";")));
|
|
|
+ for (String patentApplicantCurrentName : patentApplicantCurrentNames) {
|
|
|
+ PatentApplicant patentApplicant = new PatentApplicant();
|
|
|
+ patentApplicant.setName(patentApplicantCurrentName);
|
|
|
+ patentApplicant.setDataType(2);
|
|
|
+ patentApplicants.add(patentApplicant); //装载权利人
|
|
|
+ }
|
|
|
}
|
|
|
+ patentSimpleFamilyLink.setApplicant(patentApplicants);
|
|
|
+ records.add(patentSimpleFamilyLink);
|
|
|
}
|
|
|
- patentSimpleFamilyLink.setApplicant(patentApplicants);
|
|
|
- records.add(patentSimpleFamilyLink);
|
|
|
- }
|
|
|
|
|
|
- pageVO.setRecords(records)
|
|
|
- .setTotal(total);
|
|
|
- patentDTO.setFamilyPatentResult(pageVO);
|
|
|
+ pageVO.setRecords(records)
|
|
|
+ .setTotal(total);
|
|
|
+ patentDTO.setFamilyPatentResult(pageVO);
|
|
|
+ } catch (Exception e) {
|
|
|
+ pageVO.setRecords(new ArrayList<>())
|
|
|
+ .setTotal(0);
|
|
|
+ patentDTO.setFamilyPatentResult(pageVO);
|
|
|
+ return patentDTO;
|
|
|
+ }
|
|
|
|
|
|
return patentDTO;
|
|
|
}
|