|
@@ -58,39 +58,43 @@ public class UploadPatentBatchService {
|
|
|
|
|
|
@Async("singleThreadAsyncTaskExecutor")
|
|
|
public void uploadPatentBatch(TaskParams params, ProjectImportPatentVO projectImportPatentVO) {
|
|
|
+ //获得专利总数量
|
|
|
Integer total = params.getRowList().size();
|
|
|
try {
|
|
|
- //先解析Json文件 获得配置文件的Json串
|
|
|
+ //拿到存放在服务器的专利数据来源配置文件uploadSetting.json并按行读取文件字符流,返回整个文件字符串
|
|
|
String getSettingJson = fileUtils.analysisJsonFile();
|
|
|
- //查找需求数据源的对应配置
|
|
|
+ //查找并装载本次导入的专利需要的数据源(如智慧芽)的对应配置(如前台传来的数据来源id是1,即“智慧芽”,那么jsonData装载的就是智慧芽的数据源配置)
|
|
|
List<UploadSettingVO.Column> jsonData = UploadPatentBatchUtil.parsingConfigurationFiles(projectImportPatentVO, getSettingJson);
|
|
|
|
|
|
+ //装载所有专利的摘要附图(key:专利行数 value:专利行数对应的专利的摘要附图图片数据)
|
|
|
Map<String, PictureData> pictureDataMap = ExcelUtils.getDataFromExcel(params.getPath());
|
|
|
- //将数据进行装配并进行数据库操作
|
|
|
+ //遍历所有专利(专利总数量),将数据进行装配并进行数据库操作
|
|
|
for (int i = 0; i < params.getRowList().size(); i++) {
|
|
|
//获取每一行的数据
|
|
|
Map<Object, Object> row = params.getRowList().get(i);
|
|
|
- //基础数据装配
|
|
|
+ //专利基础数据装配(此步与数据源配置文件对象相关)
|
|
|
UploadParamsVO uploadParamsVO = UploadPatentBatchUtil.processData(row, jsonData);
|
|
|
- //查询数据是否存在 如果存在 返回该条数据 如果不存在 新增一条数据
|
|
|
+ //专利基础数据入库(专利表"os_patent"):专利基础数据根据UploadParamsVO中patent对象装载的专利号patentNo查询专利表“os_patent”,如果存在就将表中专利的Id装载到patent的id属性上,如果不存在就先将该专利数据入表后再装载Id
|
|
|
getOneOrInsertOne(uploadParamsVO);
|
|
|
- //专利信息需要特殊处理部分
|
|
|
- //专利信息(摘要附图)数据装配
|
|
|
+
|
|
|
+ //摘要附图数据装配及入库(摘要附图表"os_patent_img")
|
|
|
PictureData pictureData = pictureDataMap.get(String.valueOf(i + 1));
|
|
|
if (uploadParamsVO.getPatent() != null) {
|
|
|
if (uploadParamsVO.getPatent().getId() != null && pictureData != null) {
|
|
|
uploadParamsVO.getPatent().setAbstractPath(patentImageService.updatePatentImage(uploadParamsVO.getPatent().getId(), pictureData));
|
|
|
}
|
|
|
}
|
|
|
- //专利信息(代理机构)数据装配
|
|
|
+ //代理机构数据装配及入库(代理机构表"os_patent_agency")
|
|
|
if (uploadParamsVO.getPatent() != null) {
|
|
|
if (uploadParamsVO.getPatent().getAgencyId() != null) {
|
|
|
uploadParamsVO.getPatent().setAgencyId(patentAgencyService.getAgencyStringIdByName(uploadParamsVO.getPatent().getAgencyId()));
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
//将装配对象中的数据保存到数据库
|
|
|
dataToDB(params, uploadParamsVO, projectImportPatentVO);
|
|
|
+
|
|
|
//通过WebSocket 在每一次循环结束后 向前端发送完成进度
|
|
|
WebSocketServer.sendInfo(Response.websocket(new TaskWebSocketDTO()
|
|
|
.setTaskId(params.getTaskId())
|
|
@@ -201,7 +205,7 @@ public class UploadPatentBatchService {
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void dataToDB(TaskParams params, UploadParamsVO uploadParamsVO, ProjectImportPatentVO projectImportPatentVO) {
|
|
|
try {
|
|
|
- //专利信息 OS_PATENT
|
|
|
+ //保存法律状态(表"os_patent")
|
|
|
if (uploadParamsVO.getPatent() != null) {
|
|
|
List<SystemDict> systemDictList = systemDictService.getSystemDictListByType(Collections.singletonList(Constants.PATENT_SIMPLE_STATUS));
|
|
|
Integer simpleStatus = Integer.parseInt(systemDictList.stream()
|
|
@@ -211,57 +215,73 @@ public class UploadPatentBatchService {
|
|
|
uploadParamsVO.getPatent().setSimpleStatus(simpleStatus);
|
|
|
uploadParamsVO.getPatent().updateById();
|
|
|
}
|
|
|
- //权利要求 OS_PATENT_RIGHT
|
|
|
+
|
|
|
+ //保存权利要求(表"os_patent_right")
|
|
|
patentRightBusiness(uploadParamsVO);
|
|
|
|
|
|
- //说明书(文本) OS_PATENT_INSTRUCTION_TEXT
|
|
|
+ //保存说明书(表"os_patent_instruction_text")
|
|
|
if (uploadParamsVO.getPatentInstructionText() != null) {
|
|
|
patentInstructionTextBusiness(uploadParamsVO);
|
|
|
}
|
|
|
- //代理人 OS_PATENT_AGENT
|
|
|
+
|
|
|
+ //保存代理人(表"os_patent_agent"、表"os_patent_agent_link")
|
|
|
if (uploadParamsVO.getPatentAgentList() != null) {
|
|
|
patentAgentBusiness(uploadParamsVO);
|
|
|
}
|
|
|
- //质押质权人 OS_PATENT_PLEDGE
|
|
|
+
|
|
|
+ //保存简单同族(表"")
|
|
|
+ patentSimplyFamilyBusiness(uploadParamsVO);
|
|
|
+
|
|
|
+ //保存质押质权人(表"os_patent_pledge")
|
|
|
if (uploadParamsVO.getPatentPledgeList() != null) {
|
|
|
patentPledgeBusiness(uploadParamsVO);
|
|
|
}
|
|
|
- //许可人 OS_PATENT_LICENSOR
|
|
|
+
|
|
|
+ //保存许可人(表"os_patent_licensor")
|
|
|
if (uploadParamsVO.getPatentLicensorList() != null) {
|
|
|
patentLicensorBusiness(uploadParamsVO);
|
|
|
}
|
|
|
- //简单同族 OS_PATENT_SIMPLEFAMILY
|
|
|
- patentSimplyFamilyBusiness(uploadParamsVO);
|
|
|
- //发明人 OS_PATENT_INVENTOR
|
|
|
+
|
|
|
+ //保存发明人(表"os_patent_inventor"、表"os_patent_inventor_relation")
|
|
|
patentInventorBusiness(uploadParamsVO);
|
|
|
- //申请人(原始)/权利人(当前) OS_PATENT_APPLICATION || OS_APPLICATION_ATTR
|
|
|
+
|
|
|
+ //保存申请人(原始)/权利人(当前)(表"os_patent_applicant"、表"os_applicant_attr")
|
|
|
patentApplicationBusiness(uploadParamsVO);
|
|
|
- //申请人地址 OS_PATENT_APPLICATION
|
|
|
+
|
|
|
+ //保存申请人地址(表"")
|
|
|
patentApplicationAddressBusiness(uploadParamsVO);
|
|
|
- //专题库关联专利信息 OS_THEMATIC_PID
|
|
|
+
|
|
|
+ //保存专题库关联专利信息(表"os_thematic_pid")
|
|
|
if (uploadParamsVO.getPatent() != null) {
|
|
|
patentThematicPidBusiness(uploadParamsVO, projectImportPatentVO);
|
|
|
}
|
|
|
- //标引内容关联专利信息 OS_PATENT_FIELD_PATENT_LINK
|
|
|
+
|
|
|
+ //保存标引内容关联专利信息(表"os_patent_field_patent_link"、"os_patent_field_text")
|
|
|
if (uploadParamsVO.getPatent() != null) {
|
|
|
patentProjectFieldPatentLinkBusiness(uploadParamsVO, projectImportPatentVO);
|
|
|
}
|
|
|
- //文件夹管理 OS_PORTFOLIO_LINK
|
|
|
+
|
|
|
+ //保存文件夹关联专利信息(表"os_portfolio_link")
|
|
|
if (uploadParamsVO.getPatent() != null) {
|
|
|
patentProjectFolderPatentLinkBusiness(uploadParamsVO, projectImportPatentVO);
|
|
|
}
|
|
|
- //标签 OS_PATENT_LABEL
|
|
|
+
|
|
|
+ //保存标签(表"os_patent_label")
|
|
|
if (uploadParamsVO.getPatentLabelList() != null) {
|
|
|
patentLabelBusiness(uploadParamsVO, projectImportPatentVO);
|
|
|
}
|
|
|
- //分类号关联 OS_PATENT_TYPENO
|
|
|
+
|
|
|
+ //保存分类号关联(表"os_patent_typeno")
|
|
|
patentTypeNoBusiness(uploadParamsVO);
|
|
|
- //事务信息 OS_PATENT_AFFAIR
|
|
|
+
|
|
|
+ //保存事务信息(表"os_patent_affair")
|
|
|
patentAffairBusiness(uploadParamsVO);
|
|
|
- //自定义字段
|
|
|
+
|
|
|
+ //保存自定义字段
|
|
|
if (uploadParamsVO.getCustomerFieldList() != null) {
|
|
|
patentFieldBusiness(params, uploadParamsVO, projectImportPatentVO);
|
|
|
}
|
|
|
+
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
if (uploadParamsVO.getPatent() != null) {
|
|
@@ -366,106 +386,146 @@ public class UploadPatentBatchService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //权利要求
|
|
|
private void patentRightBusiness(UploadParamsVO uploadParamsVO) {
|
|
|
+ //创建PatentRightParams对象保存权要基本信息
|
|
|
PatentRightParams patentRightParams = new PatentRightParams();
|
|
|
+ //装载专利id
|
|
|
patentRightParams.setPatentId(uploadParamsVO.getPatent().getId());
|
|
|
+ //装载专利号
|
|
|
patentRightParams.setPatentNo(uploadParamsVO.getPatent().getPatentNo());
|
|
|
if (uploadParamsVO.getPatentRight() != null) {
|
|
|
+ //装载权利要求原文
|
|
|
patentRightParams.setContent(uploadParamsVO.getPatentRight().getContent());
|
|
|
+ //装载权利要求译文
|
|
|
patentRightParams.setContentOut(uploadParamsVO.getPatentRight().getContentOut());
|
|
|
}
|
|
|
if (uploadParamsVO.getSelfContent() != null) {
|
|
|
+ //装载独立权要
|
|
|
patentRightParams.setSelfContent(uploadParamsVO.getSelfContent());
|
|
|
}
|
|
|
+ //开始保存权要入库(1.格式化权要 2.理出主次权要父子关系 3.权要入表"os_patent_right")
|
|
|
patentRightService.updatePatentRight(patentRightParams);
|
|
|
+ //暂未使用
|
|
|
patentRightService.importAuthority(patentRightParams);
|
|
|
}
|
|
|
|
|
|
+ //说明书文本
|
|
|
private void patentInstructionTextBusiness(UploadParamsVO uploadParamsVO) {
|
|
|
+ //创建PatentInstructionTextParams对象装载说明书相关数据
|
|
|
PatentInstructionTextParams patentInstructionTextParams = new PatentInstructionTextParams();
|
|
|
+ //装载专利id
|
|
|
patentInstructionTextParams.setPatentId(uploadParamsVO.getPatent().getId());
|
|
|
+ //装载说明书
|
|
|
patentInstructionTextParams.setManual(uploadParamsVO.getPatentInstructionText().getManual());
|
|
|
+ //装载说明书(译)
|
|
|
patentInstructionTextParams.setManualOut(uploadParamsVO.getPatentInstructionText().getManualOut());
|
|
|
|
|
|
+ //开始保存说明书入表“os_patent_instruction_text”
|
|
|
patentInstructionTextService.updatePatentInstructionText(patentInstructionTextParams);
|
|
|
}
|
|
|
|
|
|
//代理人
|
|
|
private void patentAgentBusiness(UploadParamsVO uploadParamsVO) {
|
|
|
+ //创建PatentAgentParams对象装载代理人相关数据
|
|
|
PatentAgentParams patentAgentParams = new PatentAgentParams();
|
|
|
+ //装载专利id
|
|
|
patentAgentParams.setPatentId(uploadParamsVO.getPatent().getId());
|
|
|
List<String> agentList = uploadParamsVO.getPatentAgentList().stream().map(PatentAgent::getName).collect(Collectors.toList());
|
|
|
+ //装载代理人集合
|
|
|
patentAgentParams.setAgent(agentList);
|
|
|
+ //开始保存代理人信息入表“os_patent_agent”
|
|
|
patentAgentService.updatePatentAgent(patentAgentParams);
|
|
|
}
|
|
|
|
|
|
- //质押质权人 OS_PATENT_PLEDGE
|
|
|
+ //质押质权人
|
|
|
private void patentPledgeBusiness(UploadParamsVO uploadParamsVO) {
|
|
|
+ //创建PatentPledgeParams对象装载质押质权人相关数据
|
|
|
PatentPledgeParams patentPledgeParams = new PatentPledgeParams();
|
|
|
+ //装载专利id
|
|
|
patentPledgeParams.setPatentId(uploadParamsVO.getPatent().getId());
|
|
|
List<String> pledgeeList = uploadParamsVO.getPatentPledgeList().stream().map(PatentPledge::getPledgee).collect(Collectors.toList());
|
|
|
List<String> pledgorList = uploadParamsVO.getPatentPledgeList().stream().map(PatentPledge::getPledgor).collect(Collectors.toList());
|
|
|
+ //装载质权人集合
|
|
|
patentPledgeParams.setPledgee(pledgeeList);
|
|
|
+ //装载质押人集合
|
|
|
patentPledgeParams.setPledgor(pledgorList);
|
|
|
-
|
|
|
+ //开始保存质押质权人信息入表“os_patent_pledge”
|
|
|
patentPledgeService.updatePatentPledge(patentPledgeParams);
|
|
|
}
|
|
|
|
|
|
|
|
|
- //许可人 OS_PATENT_LICENSOR
|
|
|
+ //许可人
|
|
|
private void patentLicensorBusiness(UploadParamsVO uploadParamsVO) {
|
|
|
+ //创建PatentLicensorParams对象装载许可人相关数据
|
|
|
PatentLicensorParams patentLicensorParams = new PatentLicensorParams();
|
|
|
+ //装载专利id
|
|
|
patentLicensorParams.setPatentId(uploadParamsVO.getPatent().getId());
|
|
|
List<String> licensorList = uploadParamsVO.getPatentLicensorList().stream().map(PatentLicensor::getLicensor).collect(Collectors.toList());
|
|
|
List<String> licenseeList = uploadParamsVO.getPatentLicensorList().stream().map(PatentLicensor::getLicensee).collect(Collectors.toList());
|
|
|
List<String> typeList = uploadParamsVO.getPatentLicensorList().stream().map(PatentLicensor::getType).collect(Collectors.toList());
|
|
|
+ //装载许可人
|
|
|
patentLicensorParams.setLicensor(licensorList);
|
|
|
+ //装载被许可人
|
|
|
patentLicensorParams.setLicensee(licenseeList);
|
|
|
+ //装载许可类型
|
|
|
patentLicensorParams.setType(typeList);
|
|
|
-
|
|
|
+ //开始保存许可人相关信息入专利信息许可人表“os_patent_licensor”
|
|
|
patentLicensorService.updatePatentLicensor(patentLicensorParams);
|
|
|
}
|
|
|
|
|
|
|
|
|
//简单同族
|
|
|
private void patentSimplyFamilyBusiness(UploadParamsVO uploadParamsVO) {
|
|
|
+ //创建PatentSimpleFamilyParams对象装载简单同族相关数据
|
|
|
PatentSimpleFamilyParams patentSimpleFamilyParams = new PatentSimpleFamilyParams();
|
|
|
if (uploadParamsVO.getSimpleFamily() != null) {
|
|
|
+ //装载简单同族
|
|
|
patentSimpleFamilyParams.setSimpleFamily(uploadParamsVO.getSimpleFamily());
|
|
|
}
|
|
|
if (uploadParamsVO.getPatSnapFamily() != null) {
|
|
|
+ //装载
|
|
|
patentSimpleFamilyParams.setPatSnapFamily(uploadParamsVO.getPatSnapFamily());
|
|
|
}
|
|
|
if (uploadParamsVO.getInpadocFamily() != null) {
|
|
|
+ //装载
|
|
|
patentSimpleFamilyParams.setInpadocFamily(uploadParamsVO.getInpadocFamily());
|
|
|
}
|
|
|
+ //装载专利id
|
|
|
patentSimpleFamilyParams.setPatentId(uploadParamsVO.getPatent().getId());
|
|
|
+ //装载专利号
|
|
|
patentSimpleFamilyParams.setPatentNo(uploadParamsVO.getPatent().getPatentNo());
|
|
|
-
|
|
|
+ //开始
|
|
|
patentSimpleFamilyService.updatePatentSimpleFamily(patentSimpleFamilyParams);
|
|
|
}
|
|
|
|
|
|
- //发明人 OS_PATENT_INVENTOR
|
|
|
+ //发明人
|
|
|
private void patentInventorBusiness(UploadParamsVO uploadParamsVO) {
|
|
|
+ //创建PatentInventorParams对象装载发明人相关数据
|
|
|
PatentInventorParams patentInventorParams = new PatentInventorParams();
|
|
|
if (uploadParamsVO.getPatentInventorList() != null) {
|
|
|
List<String> addressList = uploadParamsVO.getPatentInventorList().stream().map(PatentInventor::getAddress).filter(Objects::nonNull).collect(Collectors.toList());
|
|
|
+ //装载发明人地址集合
|
|
|
patentInventorParams.setAddressList(addressList);
|
|
|
List<String> nameList = uploadParamsVO.getPatentInventorList().stream().map(PatentInventor::getName).collect(Collectors.toList());
|
|
|
+ //装载发明人名称集合
|
|
|
patentInventorParams.setNameList(nameList);
|
|
|
}
|
|
|
if (uploadParamsVO.getFirstName() != null) {
|
|
|
+ //装载第一发明人名称
|
|
|
patentInventorParams.setFirstName(uploadParamsVO.getFirstName());
|
|
|
}
|
|
|
if (uploadParamsVO.getFirstAddress() != null) {
|
|
|
+ //装载第一发明人地址
|
|
|
patentInventorParams.setFirstAddress(uploadParamsVO.getFirstAddress());
|
|
|
}
|
|
|
+ //装载专利号
|
|
|
patentInventorParams.setPatentId(uploadParamsVO.getPatent().getId());
|
|
|
-
|
|
|
+ //开始装载发明人表实体类相关信息、专利与发明人关联表实体类集合相关信息,然后各自数据分别插入这两张表
|
|
|
patentInventorService.updatePatentInventor(patentInventorParams);
|
|
|
}
|
|
|
|
|
|
- //申请人(原始)/权利人(当前) OS_PATENT_APPLICATION || OS_APPLICATION_ATTR
|
|
|
+ //申请人(原始)/权利人(当前)
|
|
|
private void patentApplicationBusiness(UploadParamsVO uploadParamsVO) {
|
|
|
// 根据本条数据的名字查询所有的申请人信息
|
|
|
List<String> name = new ArrayList<>();
|