|
@@ -71,7 +71,6 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
|
|
|
//1.根据专利总数量count遍历检索专利
|
|
|
int pageNum = 0; //页码
|
|
|
- //int exceptionNum = 0; //中途出错未生产完成的专利数量
|
|
|
for (int i = 1; i <= count; i += size) {
|
|
|
pageNum++;
|
|
|
PatentStarListDto patentStarListDto = new PatentStarListDto()
|
|
@@ -108,32 +107,21 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
}
|
|
|
//装载权要
|
|
|
if (cells.contains("2")) {
|
|
|
- //setPatentClaim(starPatent, uploadParamsVO);
|
|
|
pantentQueueService.rightToPQueue(pQueueData);
|
|
|
}
|
|
|
//装载说明书文本
|
|
|
if (cells.contains("3")) {
|
|
|
- //setPatentInstructionText(starPatent, uploadParamsVO);
|
|
|
pantentQueueService.instructionTextToPQueue(pQueueData);
|
|
|
}
|
|
|
//装载说明书pdf
|
|
|
if (cells.contains("4")) {
|
|
|
- //setPatentInstructionPDF(starPatent, uploadParamsVO);
|
|
|
pantentQueueService.instructionPDFToPQueue(pQueueData);
|
|
|
}
|
|
|
//装载摘要附图
|
|
|
if (cells.contains("6")) {
|
|
|
- //setPatentPicture(starPatent, uploadParamsVO);
|
|
|
pantentQueueService.imageToPQueue(pQueueData);
|
|
|
}
|
|
|
|
|
|
- //将该专利存入5个消费者队列
|
|
|
- //ProjectImportPatentVO projectImportPatentVO = new ProjectImportPatentVO();
|
|
|
- //projectImportPatentVO.setProjectId(task.getProjectId());
|
|
|
- //task.setExceptionNum(exceptionNum);
|
|
|
- //专利丢入5个消费者队列,并唤醒5个消费者线程
|
|
|
- //pantentQueueService.patentToQueue(task, uploadParamsVO, projectImportPatentVO);
|
|
|
-
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
//exceptionNum++;
|
|
@@ -174,7 +162,7 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
if (starPatent.getPublicDate() != null && !starPatent.getPublicDate().equals(""))
|
|
|
patent.setPublicDate(Integer.parseInt(starPatent.getPublicDate()));
|
|
|
//装载申请人
|
|
|
- if (starPatent.getAbstractStr() != null && !starPatent.getAbstractStr().equals("")) {
|
|
|
+ if (starPatent.getApplicantStr() != null && !starPatent.getApplicantStr().equals("")) {
|
|
|
uploadParamsVO.setPatentApplicantOriginalName(Arrays.asList(starPatent.getApplicantStr().split(";")));
|
|
|
}
|
|
|
//装载权利人
|
|
@@ -184,13 +172,30 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
//装载IPC分类号
|
|
|
if (starPatent.getIpcListStr() != null && !starPatent.getIpcListStr().equals("")) {
|
|
|
String[] ipcArr = starPatent.getIpcListStr().split(";");
|
|
|
- //装载IPC分类号
|
|
|
+ //装载主分类号
|
|
|
uploadParamsVO.setMainIpc(ipcArr[0]);
|
|
|
uploadParamsVO.setIpcList(Arrays.asList(ipcArr));
|
|
|
}
|
|
|
+ //装载法律状态
|
|
|
+ Integer status = starPatent.getLG();
|
|
|
+ if (status != null) {
|
|
|
+ //有效(有权)
|
|
|
+ if (status == 1) {
|
|
|
+ patent.setSimpleStatus(3);
|
|
|
+ //失效(无权)
|
|
|
+ } else if (status == 2) {
|
|
|
+ patent.setSimpleStatus(2);
|
|
|
+ //审中(审中)
|
|
|
+ } else if (status == 3) {
|
|
|
+ patent.setSimpleStatus(1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ uploadParamsVO.setPatentSimpleStatus(starPatent.getSimpleStatus());
|
|
|
+ uploadParamsVO.setSimpleStatus(starPatent.getSimpleStatus());
|
|
|
+
|
|
|
|
|
|
//以下 ↓装载的是调用"获得中国专利著录"接口返回的专利相关数据
|
|
|
- String appNo = null;
|
|
|
+ String appNo;
|
|
|
if (starPatent.getApplicationNo().contains(".")) {
|
|
|
appNo = starPatent.getApplicationNo().substring(0, starPatent.getApplicationNo().lastIndexOf("."));
|
|
|
} else {
|
|
@@ -205,22 +210,26 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
ChinaPatentZhuLu chinaPatentZhuLu = chinaPatentZhuLus.get(0);
|
|
|
|
|
|
//装载申请人地址
|
|
|
- ArrayList<String> patentApplicantOriginalAddresss = new ArrayList<>();
|
|
|
- if (chinaPatentZhuLu.getDZ().contains(" ")) {
|
|
|
- patentApplicantOriginalAddresss.add(chinaPatentZhuLu.getDZ().substring(chinaPatentZhuLu.getDZ().indexOf(" ") + 1));
|
|
|
- } else {
|
|
|
- patentApplicantOriginalAddresss.add(chinaPatentZhuLu.getDZ());
|
|
|
+ if (chinaPatentZhuLu.getDZ() != null && !chinaPatentZhuLu.getDZ().equals("")) {
|
|
|
+ ArrayList<String> patentApplicantOriginalAddresss = new ArrayList<>();
|
|
|
+ if (chinaPatentZhuLu.getDZ().contains(" ")) {
|
|
|
+ patentApplicantOriginalAddresss.add(chinaPatentZhuLu.getDZ().substring(chinaPatentZhuLu.getDZ().indexOf(" ") + 1));
|
|
|
+ } else {
|
|
|
+ patentApplicantOriginalAddresss.add(chinaPatentZhuLu.getDZ());
|
|
|
+ }
|
|
|
+ uploadParamsVO.setPatentApplicantOriginalAddress(patentApplicantOriginalAddresss);
|
|
|
}
|
|
|
- uploadParamsVO.setPatentApplicantOriginalAddress(patentApplicantOriginalAddresss);
|
|
|
//装载代理人
|
|
|
- List<String> patentAgents = Arrays.asList(chinaPatentZhuLu.getAT().split(";"));
|
|
|
- ArrayList<PatentAgent> patentAgentList = new ArrayList<>();
|
|
|
- for (String n : patentAgents) {
|
|
|
- PatentAgent patentAgent = new PatentAgent();
|
|
|
- patentAgent.setName(n);
|
|
|
- patentAgentList.add(patentAgent);
|
|
|
+ if (chinaPatentZhuLu.getAT() != null && !chinaPatentZhuLu.getAT().equals("")) {
|
|
|
+ List<String> patentAgents = Arrays.asList(chinaPatentZhuLu.getAT().split(";"));
|
|
|
+ ArrayList<PatentAgent> patentAgentList = new ArrayList<>();
|
|
|
+ for (String n : patentAgents) {
|
|
|
+ PatentAgent patentAgent = new PatentAgent();
|
|
|
+ patentAgent.setName(n);
|
|
|
+ patentAgentList.add(patentAgent);
|
|
|
+ }
|
|
|
+ uploadParamsVO.setPatentAgentList(patentAgentList);
|
|
|
}
|
|
|
- uploadParamsVO.setPatentAgentList(patentAgentList);
|
|
|
//装载代理机构地址
|
|
|
if (chinaPatentZhuLu.getAGN() != null && !chinaPatentZhuLu.getAGN().equals("")) {
|
|
|
String agencyAddress;
|
|
@@ -232,35 +241,43 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
patent.setAgencyId(agencyAddress);
|
|
|
}
|
|
|
//装载发明人
|
|
|
- List<String> patentInventorNames = Arrays.asList(chinaPatentZhuLu.getIV().split(";"));
|
|
|
- ArrayList<PatentInventor> patentInventors = new ArrayList<>();
|
|
|
- for (String patentInventorName : patentInventorNames) {
|
|
|
- PatentInventor patentInventor = new PatentInventor();
|
|
|
- patentInventor.setName(patentInventorName);
|
|
|
- patentInventors.add(patentInventor);
|
|
|
+ if (chinaPatentZhuLu.getIV() != null && !chinaPatentZhuLu.getIV().equals("")) {
|
|
|
+ List<String> patentInventorNames = Arrays.asList(chinaPatentZhuLu.getIV().split(";"));
|
|
|
+ ArrayList<PatentInventor> patentInventors = new ArrayList<>();
|
|
|
+ for (String patentInventorName : patentInventorNames) {
|
|
|
+ PatentInventor patentInventor = new PatentInventor();
|
|
|
+ patentInventor.setName(patentInventorName);
|
|
|
+ patentInventors.add(patentInventor);
|
|
|
+ }
|
|
|
+ uploadParamsVO.setPatentInventorList(patentInventors);
|
|
|
}
|
|
|
- uploadParamsVO.setPatentInventorList(patentInventors);
|
|
|
//装载优先权号、优先权国家、优先权日
|
|
|
- String priorityInfo = chinaPatentZhuLu.getPR();
|
|
|
- patent.setPriorityNo(priorityInfo);
|
|
|
+ patent.setPriorityNo(chinaPatentZhuLu.getPR());
|
|
|
|
|
|
//以下 ↓装载的是调用"获得同族专利"接口返回的专利相关数据
|
|
|
- String familyPatentNoStr = patentStarApiService.getFamilyByPubNoApi(starPatent.getPatentNo());
|
|
|
- FamilyPatentNo familyPatentNo = JSON.parseObject(familyPatentNoStr, FamilyPatentNo.class);
|
|
|
- //装载同族号
|
|
|
- if (familyPatentNo.getFamilyinfo() != null && !familyPatentNo.getFamilyinfo().equals("")) {
|
|
|
- List<String> simpleFamily = Arrays.asList(familyPatentNo.getFamilyinfo().split(";"));
|
|
|
- uploadParamsVO.setSimpleFamily(simpleFamily);
|
|
|
+ if (starPatent.getPatentNo() != null && !starPatent.getPatentNo().equals("")) {
|
|
|
+ String familyPatentNoStr = patentStarApiService.getFamilyByPubNoApi(starPatent.getPatentNo());
|
|
|
+ if (!familyPatentNoStr.equals("no data")) {
|
|
|
+ FamilyPatentNo familyPatentNo = JSON.parseObject(familyPatentNoStr, FamilyPatentNo.class);
|
|
|
+ //装载同族号
|
|
|
+ if (familyPatentNo.getFamilyinfo() != null && !familyPatentNo.getFamilyinfo().equals("")) {
|
|
|
+ List<String> simpleFamily = Arrays.asList(familyPatentNo.getFamilyinfo().split(";"));
|
|
|
+ uploadParamsVO.setSimpleFamily(simpleFamily);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//以下 ↓装载的是调用"获得中国专利法律状态"接口返回的专利相关数据
|
|
|
String cnLegalApiStr = patentStarApiService.getCnLegalApi(appNo);
|
|
|
List<ChinaLeagalStatus> chinaLeagalStatuses = JSON.parseArray(cnLegalApiStr, ChinaLeagalStatus.class);
|
|
|
ChinaLeagalStatus chinaLeagalStatus = chinaLeagalStatuses.get(0);
|
|
|
- //装载法律状态
|
|
|
- uploadParamsVO.setPatentSimpleStatus(chinaLeagalStatus.getLegalStatus());
|
|
|
- uploadParamsVO.setSimpleStatus(chinaLeagalStatus.getLegalStatus());
|
|
|
-
|
|
|
+ //装载事务表的status(公开|授权|驳回|权力转移。。。)
|
|
|
+ PatentAffair patentAffair = new PatentAffair();
|
|
|
+ patentAffair.setStatus(chinaLeagalStatus.getLegalStatus());
|
|
|
+ if (chinaLeagalStatus.getLegalDate() != null && !chinaLeagalStatus.getLegalDate().equals("")) {
|
|
|
+ patentAffair.setDateTime(Integer.parseInt(chinaLeagalStatus.getLegalDate()));
|
|
|
+ }
|
|
|
+ uploadParamsVO.setPatentAffair(patentAffair);
|
|
|
|
|
|
//最后将 patent装载到 uploadParamsVO
|
|
|
uploadParamsVO.setPatent(patent);
|
|
@@ -274,7 +291,7 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
* @param uploadParamsVO 专利实体类对象
|
|
|
*/
|
|
|
public void setPatentClaim(StarPatentVO starPatent, UploadParamsVO uploadParamsVO) throws IOException {
|
|
|
- String appNo = null;
|
|
|
+ String appNo;
|
|
|
if (starPatent.getApplicationNo().contains(".")) {
|
|
|
appNo = starPatent.getApplicationNo().substring(0, starPatent.getApplicationNo().lastIndexOf("."));
|
|
|
} else {
|
|
@@ -311,7 +328,7 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
* @param uploadParamsVO 专利实体类对象
|
|
|
*/
|
|
|
public void setPatentInstructionText(StarPatentVO starPatent, UploadParamsVO uploadParamsVO) throws IOException {
|
|
|
- String appNo = null;
|
|
|
+ String appNo;
|
|
|
if (starPatent.getApplicationNo().contains(".")) {
|
|
|
appNo = starPatent.getApplicationNo().substring(0, starPatent.getApplicationNo().lastIndexOf("."));
|
|
|
} else {
|
|
@@ -360,42 +377,42 @@ public class ExcutePatentDataStar implements IExcutePatentData {
|
|
|
* @param uploadParamsVO 专利实体类对象
|
|
|
*/
|
|
|
public void setPatentInstructionPDF(StarPatentVO starPatent, UploadParamsVO uploadParamsVO) {
|
|
|
- String patentNo = starPatent.getPatentNo();
|
|
|
- //根据专利号调用"获得世界专利pdf"接口,获得pdf的url地址
|
|
|
- String pdfUrl = patentStarApiService.getEnPdfApi(patentNo);
|
|
|
-
|
|
|
try {
|
|
|
- URL url = new URL(pdfUrl); //想要读取的url地址
|
|
|
- InputStream in = url.openStream();
|
|
|
-
|
|
|
- File file = File.createTempFile("new_url", ".pdf"); //创建文件
|
|
|
- OutputStream os = new FileOutputStream(file); //创建文件输出流
|
|
|
- int bytesRead;
|
|
|
- byte[] buffer = new byte[8192];
|
|
|
- int len = 8192;
|
|
|
- while ((bytesRead = in.read(buffer, 0, len)) != -1) {
|
|
|
- os.write(buffer, 0, bytesRead);
|
|
|
- }
|
|
|
- //关闭释放流
|
|
|
- os.close();
|
|
|
- in.close();
|
|
|
+ //根据专利号调用"获得世界专利pdf"接口,获得pdf的url地址
|
|
|
+ if (starPatent.getPatentNo() != null && !starPatent.getPatentNo().equals("")) {
|
|
|
+ String pdfUrl = patentStarApiService.getEnPdfApi(starPatent.getPatentNo());
|
|
|
+ URL url = new URL(pdfUrl); //想要读取的url地址
|
|
|
+ InputStream in = url.openStream();
|
|
|
+
|
|
|
+ File file = File.createTempFile("new_url", ".pdf"); //创建文件
|
|
|
+ OutputStream os = new FileOutputStream(file); //创建文件输出流
|
|
|
+ int bytesRead;
|
|
|
+ byte[] buffer = new byte[8192];
|
|
|
+ int len = 8192;
|
|
|
+ while ((bytesRead = in.read(buffer, 0, len)) != -1) {
|
|
|
+ os.write(buffer, 0, bytesRead);
|
|
|
+ }
|
|
|
+ //关闭释放流
|
|
|
+ os.close();
|
|
|
+ in.close();
|
|
|
+
|
|
|
+ DiskFileItemFactory diskFileItemFactory = new DiskFileItemFactory(16, null);
|
|
|
+ FileItem item = diskFileItemFactory.createItem(file.getName(), "text/plain", true, file.getName());
|
|
|
+ buffer = new byte[8192];
|
|
|
+ FileInputStream fis = new FileInputStream(file);
|
|
|
+ OutputStream fos = item.getOutputStream();
|
|
|
+ len = 8192;
|
|
|
+ while ((bytesRead = fis.read(buffer, 0, len)) != -1) {
|
|
|
+ fos.write(buffer, 0, bytesRead);
|
|
|
+ }
|
|
|
+ //关闭释放流
|
|
|
+ fos.close();
|
|
|
+ fis.close();
|
|
|
+ MultipartFile multipartFile = new CommonsMultipartFile(item);
|
|
|
+ UploadFileDTO fileDTO = fileUtils.uploadFile(multipartFile);
|
|
|
+ uploadParamsVO.setFileDTO(fileDTO);
|
|
|
|
|
|
- DiskFileItemFactory diskFileItemFactory = new DiskFileItemFactory(16, null);
|
|
|
- FileItem item = diskFileItemFactory.createItem(file.getName(), "text/plain", true, file.getName());
|
|
|
- buffer = new byte[8192];
|
|
|
- FileInputStream fis = new FileInputStream(file);
|
|
|
- OutputStream fos = item.getOutputStream();
|
|
|
- len = 8192;
|
|
|
- while ((bytesRead = fis.read(buffer, 0, len)) != -1) {
|
|
|
- fos.write(buffer, 0, bytesRead);
|
|
|
}
|
|
|
- //关闭释放流
|
|
|
- fos.close();
|
|
|
- fis.close();
|
|
|
- MultipartFile multipartFile = new CommonsMultipartFile(item);
|
|
|
- UploadFileDTO fileDTO = fileUtils.uploadFile(multipartFile);
|
|
|
- uploadParamsVO.setFileDTO(fileDTO);
|
|
|
-
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|