|
@@ -1,7 +1,6 @@
|
|
package cn.cslg.pas.service;
|
|
package cn.cslg.pas.service;
|
|
|
|
|
|
-import cn.cslg.pas.common.core.base.Constants;
|
|
|
|
-import cn.cslg.pas.common.model.params.PatentInstructionTextParams;
|
|
|
|
|
|
+import cn.cslg.pas.common.model.params.*;
|
|
import cn.cslg.pas.common.model.vo.ProjectImportPatentVO;
|
|
import cn.cslg.pas.common.model.vo.ProjectImportPatentVO;
|
|
import cn.cslg.pas.common.model.vo.TaskParams;
|
|
import cn.cslg.pas.common.model.vo.TaskParams;
|
|
import cn.cslg.pas.common.model.vo.UploadParamsVO;
|
|
import cn.cslg.pas.common.model.vo.UploadParamsVO;
|
|
@@ -9,31 +8,36 @@ import cn.cslg.pas.common.model.vo.UploadSettingVO;
|
|
import cn.cslg.pas.common.utils.ExcelUtils;
|
|
import cn.cslg.pas.common.utils.ExcelUtils;
|
|
import cn.cslg.pas.common.utils.FileUtils;
|
|
import cn.cslg.pas.common.utils.FileUtils;
|
|
import cn.cslg.pas.common.utils.UploadPatentBatchUtil;
|
|
import cn.cslg.pas.common.utils.UploadPatentBatchUtil;
|
|
-import cn.cslg.pas.domain.Patent;
|
|
|
|
-import cn.cslg.pas.domain.SystemDict;
|
|
|
|
|
|
+import cn.cslg.pas.domain.*;
|
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
import org.apache.poi.ss.usermodel.PictureData;
|
|
import org.apache.poi.ss.usermodel.PictureData;
|
|
|
|
+import org.springframework.context.annotation.Lazy;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import javax.annotation.Resource;
|
|
|
|
-import java.util.Arrays;
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
@Service
|
|
|
|
+@RequiredArgsConstructor(onConstructor_ = {@Lazy})
|
|
public class UploadPatentBatchService {
|
|
public class UploadPatentBatchService {
|
|
- @Resource
|
|
|
|
private final FileUtils fileUtils = new FileUtils();
|
|
private final FileUtils fileUtils = new FileUtils();
|
|
- @Resource
|
|
|
|
- private PatentImageService patentImageService;
|
|
|
|
- @Resource
|
|
|
|
- private PatentService patentService;
|
|
|
|
- @Resource
|
|
|
|
- private SystemDictService systemDictService;
|
|
|
|
- @Resource
|
|
|
|
- private PatentAgencyService patentAgencyService;
|
|
|
|
- @Resource
|
|
|
|
- private PatentInstructionTextService patentInstructionTextService;
|
|
|
|
-
|
|
|
|
|
|
+ private final PatentImageService patentImageService;
|
|
|
|
+ private final PatentService patentService;
|
|
|
|
+ private final PatentAgencyService patentAgencyService;
|
|
|
|
+ private final PatentInstructionTextService patentInstructionTextService;
|
|
|
|
+ private final PatentRightService patentRightService;
|
|
|
|
+ private final PatentAgentService patentAgentService;
|
|
|
|
+ private final PatentPledgeService patentPledgeService;
|
|
|
|
+ private final PatentLicensorService patentLicensorService;
|
|
|
|
+ private final PatentSimpleFamilyService patentSimpleFamilyService;
|
|
|
|
+ private final PatentInventorService patentInventorService;
|
|
|
|
+ private final ProjectPatentLinkService projectPatentLinkService;
|
|
|
|
+ private final ProjectFieldPatentLinkService projectFieldPatentLinkService;
|
|
|
|
+ private final ProjectFolderPatentLinkService projectFolderPatentLinkService;
|
|
|
|
+ private final PatentApplicantLinkService patentApplicantLinkService;
|
|
|
|
+ private final PatentLabelService patentLabelService;
|
|
|
|
+ private final PatentClassNumberLinkService patentClassNumberLinkService;
|
|
|
|
|
|
public void uploadPatentBatch(TaskParams params, ProjectImportPatentVO projectImportPatentVO) {
|
|
public void uploadPatentBatch(TaskParams params, ProjectImportPatentVO projectImportPatentVO) {
|
|
try {
|
|
try {
|
|
@@ -42,10 +46,8 @@ public class UploadPatentBatchService {
|
|
//查找需求数据源的对应配置
|
|
//查找需求数据源的对应配置
|
|
List<UploadSettingVO.Column> jsonData = UploadPatentBatchUtil.parsingConfigurationFiles(projectImportPatentVO, getSettingJson);
|
|
List<UploadSettingVO.Column> jsonData = UploadPatentBatchUtil.parsingConfigurationFiles(projectImportPatentVO, getSettingJson);
|
|
|
|
|
|
- List<SystemDict> systemDictList = systemDictService.getSystemDictListByType(Arrays.asList(Constants.PATENT_TYPE, Constants.PATENT_SIMPLE_STATUS));
|
|
|
|
Map<String, PictureData> pictureDataMap = ExcelUtils.getDataFromExcel(params.getPath());
|
|
Map<String, PictureData> pictureDataMap = ExcelUtils.getDataFromExcel(params.getPath());
|
|
|
|
|
|
-
|
|
|
|
//将数据进行装配并进行数据库操作
|
|
//将数据进行装配并进行数据库操作
|
|
for (int i = 0; i < params.getRowList().size(); i++) {
|
|
for (int i = 0; i < params.getRowList().size(); i++) {
|
|
//获取每一行的数据
|
|
//获取每一行的数据
|
|
@@ -53,6 +55,7 @@ public class UploadPatentBatchService {
|
|
//基础数据装配
|
|
//基础数据装配
|
|
UploadParamsVO uploadParamsVO = UploadPatentBatchUtil.processData(row, jsonData);
|
|
UploadParamsVO uploadParamsVO = UploadPatentBatchUtil.processData(row, jsonData);
|
|
|
|
|
|
|
|
+ //查询数据是否存在 如果存在 返回该条数据 如果不存在 新增一条数据
|
|
getOneOrInsertOne(uploadParamsVO);
|
|
getOneOrInsertOne(uploadParamsVO);
|
|
|
|
|
|
//专利信息需要特殊处理部分
|
|
//专利信息需要特殊处理部分
|
|
@@ -62,16 +65,8 @@ public class UploadPatentBatchService {
|
|
//专利信息(代理机构)数据装配
|
|
//专利信息(代理机构)数据装配
|
|
uploadParamsVO.getPatent().setAgencyId(patentAgencyService.getAgencyStringIdByName(uploadParamsVO.getPatent().getAgencyId()));
|
|
uploadParamsVO.getPatent().setAgencyId(patentAgencyService.getAgencyStringIdByName(uploadParamsVO.getPatent().getAgencyId()));
|
|
|
|
|
|
- //权利要求数据装配
|
|
|
|
-// for (int j = 0; j < uploadParamsVO.getPatentRightList().size(); j++) {
|
|
|
|
-// uploadParamsVO.getPatentRightList().get(j).setPatentId(uploadParamsVO.getPatent().getId());
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
- //说明书(文本)数据装配
|
|
|
|
- uploadParamsVO.getPatentInstructionText().setPatentId(uploadParamsVO.getPatent().getId());
|
|
|
|
-
|
|
|
|
//将装配对象中的数据保存到数据库
|
|
//将装配对象中的数据保存到数据库
|
|
- dataToDB(uploadParamsVO);
|
|
|
|
|
|
+ dataToDB(uploadParamsVO, projectImportPatentVO);
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
@@ -84,29 +79,55 @@ public class UploadPatentBatchService {
|
|
* @name 数据库交互
|
|
* @name 数据库交互
|
|
* @description 将装配完毕的VO类向数据库中不同的表进行添加或修改操作
|
|
* @description 将装配完毕的VO类向数据库中不同的表进行添加或修改操作
|
|
*/
|
|
*/
|
|
- private void dataToDB(UploadParamsVO uploadParamsVO) {
|
|
|
|
- //专利信息的数据库业务操作
|
|
|
|
|
|
+ private void dataToDB(UploadParamsVO uploadParamsVO, ProjectImportPatentVO projectImportPatentVO) {
|
|
|
|
+ // TODO: 2022/7/12 发明人地址 申请人地址 自定义字段 事务信息
|
|
|
|
+ //专利信息
|
|
//表:OS_PATENT
|
|
//表:OS_PATENT
|
|
uploadParamsVO.getPatent().updateById();
|
|
uploadParamsVO.getPatent().updateById();
|
|
-
|
|
|
|
- //权利要求的数据库业务操作
|
|
|
|
|
|
+ //权利要求
|
|
//表:OS_PATENT_RIGHT
|
|
//表:OS_PATENT_RIGHT
|
|
patentRightBusiness(uploadParamsVO);
|
|
patentRightBusiness(uploadParamsVO);
|
|
-
|
|
|
|
- //说明书(文本)的数据库业务操作
|
|
|
|
- //表:OS_PATENT_RIGHT
|
|
|
|
|
|
+ //说明书(文本)
|
|
|
|
+ //表:OS_PATENT_INSTRUCTION_TEXT
|
|
patentInstructionTextBusiness(uploadParamsVO);
|
|
patentInstructionTextBusiness(uploadParamsVO);
|
|
|
|
+ //代理人
|
|
|
|
+ //表:OS_PATENT_AGENT
|
|
|
|
+ patentAgentBusiness(uploadParamsVO);
|
|
|
|
+ //质押质权人
|
|
|
|
+ //表:OS_PATENT_PLEDGE
|
|
|
|
+ patentPledgeBusiness(uploadParamsVO);
|
|
|
|
+ //许可人
|
|
|
|
+ //表:OS_PATENT_LICENSOR
|
|
|
|
+ patentLicensorBusiness(uploadParamsVO);
|
|
|
|
+ //简单同族
|
|
|
|
+ //表:OS_PATENT_SIMPLEFAMILY
|
|
|
|
+ patentSimplyFamilyBusiness(uploadParamsVO);
|
|
|
|
+ //发明人
|
|
|
|
+ //表:OS_PATENT_INVENTOR
|
|
|
|
+ patentInventorBusiness(uploadParamsVO);
|
|
|
|
+ //申请人/权利人
|
|
|
|
+ //表:OS_APPLICATION_ATTR
|
|
|
|
+ //权利人
|
|
|
|
+ patentCurrentApplicationBusiness(uploadParamsVO);
|
|
|
|
+ //申请人
|
|
|
|
+ patentOriginalApplicationBusiness(uploadParamsVO);
|
|
|
|
+ //专题库关联专利信息
|
|
|
|
+ //表:OS_THEMATIC_PID
|
|
|
|
+ patentThematicPidBusiness(uploadParamsVO, projectImportPatentVO);
|
|
|
|
+ //标引内容关联专利信息
|
|
|
|
+ //表:OS_PATENT_FIELD_PATENT_LINK
|
|
|
|
+ patentProjectFieldPatentLinkBusiness(uploadParamsVO, projectImportPatentVO);
|
|
|
|
+ //文件夹管理
|
|
|
|
+ //表:OS_PORTFOLIO_LINK
|
|
|
|
+ patentProjectFolderPatentLinkBusiness(uploadParamsVO, projectImportPatentVO);
|
|
|
|
+ //标签
|
|
|
|
+ //表:OS_PATENT_LABEL
|
|
|
|
+ patentLabelBusiness(uploadParamsVO, projectImportPatentVO);
|
|
|
|
+ //分类号关联
|
|
|
|
+ //表:OS_PATENT_TYPENO
|
|
|
|
+ patentTypeNoBusiness(uploadParamsVO);
|
|
}
|
|
}
|
|
|
|
|
|
- private void patentRightBusiness(UploadParamsVO uploadParamsVO) {
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private void patentInstructionTextBusiness(UploadParamsVO uploadParamsVO) {
|
|
|
|
- patentInstructionTextService.updatePatentInstructionText(uploadParamsVO.getPatentInstructionText());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* @param uploadParamsVO 全局类
|
|
* @param uploadParamsVO 全局类
|
|
* @date 2022-7-11
|
|
* @date 2022-7-11
|
|
@@ -116,14 +137,130 @@ public class UploadPatentBatchService {
|
|
private void getOneOrInsertOne(UploadParamsVO uploadParamsVO) {
|
|
private void getOneOrInsertOne(UploadParamsVO uploadParamsVO) {
|
|
//用专利号查询该条数据是否存在
|
|
//用专利号查询该条数据是否存在
|
|
Patent patent = patentService.getByPatentNo(uploadParamsVO.getPatent().getPatentNo());
|
|
Patent patent = patentService.getByPatentNo(uploadParamsVO.getPatent().getPatentNo());
|
|
-
|
|
|
|
//如果不存在就新增一条
|
|
//如果不存在就新增一条
|
|
if (patent == null) {
|
|
if (patent == null) {
|
|
uploadParamsVO.getPatent().insert();
|
|
uploadParamsVO.getPatent().insert();
|
|
} else {
|
|
} else {
|
|
uploadParamsVO.getPatent().setId(patent.getId());
|
|
uploadParamsVO.getPatent().setId(patent.getId());
|
|
}
|
|
}
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void patentRightBusiness(UploadParamsVO uploadParamsVO) {
|
|
|
|
+ PatentRightParams patentRightParams = new PatentRightParams();
|
|
|
|
+ patentRightParams.setPatentId(uploadParamsVO.getPatent().getId());
|
|
|
|
+ patentRightParams.setPatentNo(uploadParamsVO.getPatent().getPatentNo());
|
|
|
|
+ patentRightParams.setContent(uploadParamsVO.getPatentRight().getContent());
|
|
|
|
+ patentRightParams.setContentOut(uploadParamsVO.getPatentRight().getContentOut());
|
|
|
|
+ patentRightParams.setSelfContent(uploadParamsVO.getSelfContent());
|
|
|
|
+
|
|
|
|
+ patentRightService.updatePatentRight(patentRightParams);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ private void patentInstructionTextBusiness(UploadParamsVO uploadParamsVO) {
|
|
|
|
+ PatentInstructionTextParams patentInstructionTextParams = new PatentInstructionTextParams();
|
|
|
|
+ patentInstructionTextParams.setPatentId(uploadParamsVO.getPatent().getId());
|
|
|
|
+ patentInstructionTextParams.setManual(uploadParamsVO.getPatentInstructionText().getManual());
|
|
|
|
+ patentInstructionTextParams.setManualOut(uploadParamsVO.getPatentInstructionText().getManualOut());
|
|
|
|
+
|
|
|
|
+ patentInstructionTextService.updatePatentInstructionText(patentInstructionTextParams);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ private void patentAgentBusiness(UploadParamsVO uploadParamsVO) {
|
|
|
|
+ PatentAgentParams patentAgentParams = new PatentAgentParams();
|
|
|
|
+ patentAgentParams.setPatentId(uploadParamsVO.getPatent().getId());
|
|
|
|
+ List<String> agentList = uploadParamsVO.getPatentAgentList().stream().map(PatentAgent::getName).collect(Collectors.toList());
|
|
|
|
+ patentAgentParams.setAgent(agentList);
|
|
|
|
+
|
|
|
|
+ patentAgentService.updatePatentAgent(patentAgentParams);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void patentPledgeBusiness(UploadParamsVO uploadParamsVO) {
|
|
|
|
+ PatentPledgeParams patentPledgeParams = new PatentPledgeParams();
|
|
|
|
+ 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);
|
|
|
|
+
|
|
|
|
+ patentPledgeService.updatePatentPledge(patentPledgeParams);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void patentLicensorBusiness(UploadParamsVO uploadParamsVO) {
|
|
|
|
+ PatentLicensorParams patentLicensorParams = new PatentLicensorParams();
|
|
|
|
+ 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);
|
|
|
|
+
|
|
|
|
+ patentLicensorService.updatePatentLicensor(patentLicensorParams);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void patentSimplyFamilyBusiness(UploadParamsVO uploadParamsVO) {
|
|
|
|
+ PatentSimpleFamilyParams patentSimpleFamilyParams = new PatentSimpleFamilyParams();
|
|
|
|
+ patentSimpleFamilyParams.setPatentId(uploadParamsVO.getPatent().getId());
|
|
|
|
+ patentSimpleFamilyParams.setPatentNo(uploadParamsVO.getPatent().getPatentNo());
|
|
|
|
+ patentSimpleFamilyParams.setSimpleFamily(uploadParamsVO.getSimpleFamily());
|
|
|
|
+ patentSimpleFamilyParams.setPatSnapFamily(uploadParamsVO.getPatSnapFamily());
|
|
|
|
+ patentSimpleFamilyParams.setInpadocFamily(uploadParamsVO.getInpadocFamily());
|
|
|
|
+
|
|
|
|
+ patentSimpleFamilyService.updatePatentSimpleFamily(patentSimpleFamilyParams);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void patentInventorBusiness(UploadParamsVO uploadParamsVO) {
|
|
|
|
+ PatentInventorParams patentInventorParams = new PatentInventorParams();
|
|
|
|
+ patentInventorParams.setPatentId(uploadParamsVO.getPatent().getId());
|
|
|
|
+ patentInventorParams.setFirstName(uploadParamsVO.getFirstName());
|
|
|
|
+ List<String> nameList = uploadParamsVO.getPatentInventorList().stream().map(PatentInventor::getName).collect(Collectors.toList());
|
|
|
|
+ patentInventorParams.setNameList(nameList);
|
|
|
|
+
|
|
|
|
+ patentInventorService.updatePatentInventor(patentInventorParams);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void patentCurrentApplicationBusiness(UploadParamsVO uploadParamsVO) {
|
|
|
|
+ patentApplicantLinkService.updatePatentApplicantLink(uploadParamsVO.getPatentApplicantCurrentName(), uploadParamsVO.getPatentApplicantStandardCurrentName(), 1, uploadParamsVO.getPatent().getId());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void patentOriginalApplicationBusiness(UploadParamsVO uploadParamsVO) {
|
|
|
|
+ patentApplicantLinkService.updatePatentApplicantLink(uploadParamsVO.getPatentApplicantOriginalName(), uploadParamsVO.getPatentApplicantStandardOriginalName(), 2, uploadParamsVO.getPatent().getId());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void patentThematicPidBusiness(UploadParamsVO uploadParamsVO, ProjectImportPatentVO projectImportPatentVO) {
|
|
|
|
+ projectPatentLinkService.updateProjectPatent(projectImportPatentVO.getProjectId(), uploadParamsVO.getPatent().getId());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void patentProjectFieldPatentLinkBusiness(UploadParamsVO uploadParamsVO, ProjectImportPatentVO projectImportPatentVO) {
|
|
|
|
+ projectFieldPatentLinkService.updateProjectFieldPatentLink(projectImportPatentVO, uploadParamsVO.getPatent().getId());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void patentProjectFolderPatentLinkBusiness(UploadParamsVO uploadParamsVO, ProjectImportPatentVO projectImportPatentVO) {
|
|
|
|
+ projectFolderPatentLinkService.updateProjectFolderLink(projectImportPatentVO, uploadParamsVO.getPatent().getId());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void patentLabelBusiness(UploadParamsVO uploadParamsVO, ProjectImportPatentVO projectImportPatentVO) {
|
|
|
|
+ PatentLabelParams patentLabelParams = new PatentLabelParams();
|
|
|
|
+ patentLabelParams.setPatentId(uploadParamsVO.getPatent().getId());
|
|
|
|
+ patentLabelParams.setProjectId(projectImportPatentVO.getProjectId());
|
|
|
|
+ List<String> labelList = uploadParamsVO.getPatentLabelList().stream().map(PatentLabel::getName).collect(Collectors.toList());
|
|
|
|
+ patentLabelParams.setLabel(labelList);
|
|
|
|
+
|
|
|
|
+ patentLabelService.updatePatentLabel(patentLabelParams);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void patentTypeNoBusiness(UploadParamsVO uploadParamsVO) {
|
|
|
|
+ PatentClassNumberParams patentClassNumberParams = new PatentClassNumberParams();
|
|
|
|
+ patentClassNumberParams.setPatentId(uploadParamsVO.getPatent().getId());
|
|
|
|
+ patentClassNumberParams.setCpcList(uploadParamsVO.getCpcList());
|
|
|
|
+ patentClassNumberParams.setIpcList(uploadParamsVO.getIpcList());
|
|
|
|
+ patentClassNumberParams.setLocList(uploadParamsVO.getLocList());
|
|
|
|
+ patentClassNumberParams.setIpcList(uploadParamsVO.getIpcList());
|
|
|
|
+ patentClassNumberParams.setMainIpc(uploadParamsVO.getMainIpc());
|
|
|
|
+ patentClassNumberParams.setMainUpc(uploadParamsVO.getMainUpc());
|
|
|
|
+
|
|
|
|
+ patentClassNumberLinkService.updatePatentClassNumberLink(patentClassNumberParams);
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|