|
@@ -0,0 +1,424 @@
|
|
|
|
+package cn.cslg.pas.service;
|
|
|
|
+
|
|
|
|
+import cn.cslg.pas.common.core.base.Constants;
|
|
|
|
+import cn.cslg.pas.common.model.dto.TaskWebSocketDTO;
|
|
|
|
+import cn.cslg.pas.common.model.params.*;
|
|
|
|
+import cn.cslg.pas.common.model.vo.ProjectImportPatentVO;
|
|
|
|
+import cn.cslg.pas.common.model.vo.TaskParams;
|
|
|
|
+import cn.cslg.pas.common.model.vo.UploadParamsVO;
|
|
|
|
+import cn.cslg.pas.common.model.vo.UploadSettingVO;
|
|
|
|
+import cn.cslg.pas.common.utils.*;
|
|
|
|
+import cn.cslg.pas.domain.*;
|
|
|
|
+import cn.cslg.pas.mapper.ImportErrorLogMapper;
|
|
|
|
+import cn.hutool.extra.spring.SpringUtil;
|
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
|
+import org.apache.poi.ss.usermodel.PictureData;
|
|
|
|
+import org.springframework.context.annotation.Lazy;
|
|
|
|
+import org.springframework.scheduling.annotation.Async;
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|
|
|
+
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
|
+import java.util.*;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
+
|
|
|
|
+@Service
|
|
|
|
+@RequiredArgsConstructor(onConstructor_ = {@Lazy})
|
|
|
|
+public class UploadPatentBatchService {
|
|
|
|
+ private final FileUtils fileUtils;
|
|
|
|
+ private final SystemDictService systemDictService;
|
|
|
|
+ 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 PatentApplicantService patentApplicantService;
|
|
|
|
+ private final PatentLabelService patentLabelService;
|
|
|
|
+ private final PatentClassNumberLinkService patentClassNumberLinkService;
|
|
|
|
+ private final PatentAffairService patentAffairService;
|
|
|
|
+ private final ImportErrorLogMapper importErrorLogMapper;
|
|
|
|
+ private static int FLAG = 0;
|
|
|
|
+
|
|
|
|
+ @Async("singleThreadAsyncTaskExecutor")
|
|
|
|
+ public void uploadPatentBatch(TaskParams params, ProjectImportPatentVO projectImportPatentVO) {
|
|
|
|
+ Integer total = params.getRowList().size();
|
|
|
|
+ try {
|
|
|
|
+ //先解析Json文件 获得配置文件的Json串
|
|
|
|
+ String getSettingJson = fileUtils.analysisJsonFile();
|
|
|
|
+ //查找需求数据源的对应配置
|
|
|
|
+ List<UploadSettingVO.Column> jsonData = UploadPatentBatchUtil.parsingConfigurationFiles(projectImportPatentVO, getSettingJson);
|
|
|
|
+
|
|
|
|
+ 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);
|
|
|
|
+
|
|
|
|
+ //查询数据是否存在 如果存在 返回该条数据 如果不存在 新增一条数据
|
|
|
|
+ getOneOrInsertOne(uploadParamsVO);
|
|
|
|
+
|
|
|
|
+ //专利信息需要特殊处理部分
|
|
|
|
+ //专利信息(摘要附图)数据装配
|
|
|
|
+ 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));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //专利信息(代理机构)数据装配
|
|
|
|
+ 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())
|
|
|
|
+ .setProjectId(projectImportPatentVO.getProjectId())
|
|
|
|
+ .setComplete(false)
|
|
|
|
+ .setIndex(i)
|
|
|
|
+ .setTaskType(Constants.TASK_IMPORT_PATENT)
|
|
|
|
+ .setPercentage(total == 0 ? 0 : Math.round((total.equals(i) ? (i * 1D) : (i + 1D)) / total * 100D))
|
|
|
|
+ .setFileName("")
|
|
|
|
+ .setOldName(params.getOldName())
|
|
|
|
+ .setUrl("")
|
|
|
|
+ .setTotal(total), ResponseEnum.PATENT_IMPORT_TASK_SUCCESS), params.getUserId());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ SpringUtil.getBean(ProjectService.class).setImportPatentTaskStatus(2, params.getTaskId());
|
|
|
|
+ WebSocketServer.sendInfo(Response.websocket(new TaskWebSocketDTO()
|
|
|
|
+ .setTaskId(params.getTaskId())
|
|
|
|
+ .setProjectId(projectImportPatentVO.getProjectId())
|
|
|
|
+ .setComplete(true)
|
|
|
|
+ .setIndex(total)
|
|
|
|
+ .setTaskType(Constants.TASK_IMPORT_PATENT)
|
|
|
|
+ .setPercentage(100L)
|
|
|
|
+ .setFileName("")
|
|
|
|
+ .setOldName(params.getOldName())
|
|
|
|
+ .setUrl("")
|
|
|
|
+ .setTotal(total), ResponseEnum.PATENT_IMPORT_TASK_SUCCESS), params.getUserId());
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ SpringUtil.getBean(ProjectService.class).setImportPatentTaskStatus(3, params.getTaskId());
|
|
|
|
+ if (FLAG > 0) {
|
|
|
|
+ int successCount = total - FLAG;
|
|
|
|
+ WebSocketServer.sendInfo(Response.error("部分数据上传成功" + "\n" + "成功条数:" + successCount + "失败条数:" + FLAG), params.getUserId());
|
|
|
|
+ }
|
|
|
|
+ FLAG = 0;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * @param uploadParamsVO 全局类
|
|
|
|
+ * @date 2022-7-11
|
|
|
|
+ * @name 数据库交互
|
|
|
|
+ * @description 将装配完毕的VO类向数据库中不同的表进行添加或修改操作
|
|
|
|
+ */
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
+ public void dataToDB(TaskParams params, UploadParamsVO uploadParamsVO, ProjectImportPatentVO projectImportPatentVO) {
|
|
|
|
+ try {
|
|
|
|
+ //专利信息 OS_PATENT
|
|
|
|
+ if (uploadParamsVO.getPatent() != null) {
|
|
|
|
+ List<SystemDict> systemDictList = systemDictService.getSystemDictListByType(Collections.singletonList(Constants.PATENT_SIMPLE_STATUS));
|
|
|
|
+ Integer simpleStatus = Integer.parseInt(systemDictList.stream()
|
|
|
|
+ .filter(systemDict -> systemDict.getType().equals(Constants.PATENT_SIMPLE_STATUS) && systemDict.getLabel().equals(uploadParamsVO.getPatentSimpleStatus()))
|
|
|
|
+ .findFirst()
|
|
|
|
+ .orElse(new SystemDict()).getValue());
|
|
|
|
+ uploadParamsVO.getPatent().setSimpleStatus(simpleStatus);
|
|
|
|
+ uploadParamsVO.getPatent().updateById();
|
|
|
|
+ }
|
|
|
|
+ //权利要求 OS_PATENT_RIGHT
|
|
|
|
+ patentRightBusiness(uploadParamsVO);
|
|
|
|
+ //说明书(文本) OS_PATENT_INSTRUCTION_TEXT
|
|
|
|
+ if (uploadParamsVO.getPatentInstructionText() != null) {
|
|
|
|
+ patentInstructionTextBusiness(uploadParamsVO);
|
|
|
|
+ }
|
|
|
|
+ //代理人 OS_PATENT_AGENT
|
|
|
|
+ if (uploadParamsVO.getPatentAgentList() != null) {
|
|
|
|
+ patentAgentBusiness(uploadParamsVO);
|
|
|
|
+ }
|
|
|
|
+ //质押质权人 OS_PATENT_PLEDGE
|
|
|
|
+ if (uploadParamsVO.getPatentPledgeList() != null) {
|
|
|
|
+ patentPledgeBusiness(uploadParamsVO);
|
|
|
|
+ }
|
|
|
|
+ //许可人 OS_PATENT_LICENSOR
|
|
|
|
+ if (uploadParamsVO.getPatentLicensorList() != null) {
|
|
|
|
+ patentLicensorBusiness(uploadParamsVO);
|
|
|
|
+ }
|
|
|
|
+ //简单同族 OS_PATENT_SIMPLEFAMILY
|
|
|
|
+ patentSimplyFamilyBusiness(uploadParamsVO);
|
|
|
|
+ //发明人 OS_PATENT_INVENTOR
|
|
|
|
+ patentInventorBusiness(uploadParamsVO);
|
|
|
|
+ //申请人(原始)/权利人(当前) OS_PATENT_APPLICATION || OS_APPLICATION_ATTR
|
|
|
|
+ if (uploadParamsVO.getPatentApplicantStandardCurrentName() != null && uploadParamsVO.getPatentApplicantOriginalName() != null && uploadParamsVO.getPatentApplicantStandardOriginalName() != null) {
|
|
|
|
+ patentApplicationBusiness(uploadParamsVO);
|
|
|
|
+ }
|
|
|
|
+ //申请人地址 OS_PATENT_APPLICATION
|
|
|
|
+ patentApplicationAddressBusiness(uploadParamsVO);
|
|
|
|
+ //专题库关联专利信息 OS_THEMATIC_PID
|
|
|
|
+ if (uploadParamsVO.getPatent() != null) {
|
|
|
|
+ patentThematicPidBusiness(uploadParamsVO, projectImportPatentVO);
|
|
|
|
+ }
|
|
|
|
+ //标引内容关联专利信息 OS_PATENT_FIELD_PATENT_LINK
|
|
|
|
+ if (uploadParamsVO.getPatent() != null) {
|
|
|
|
+ patentProjectFieldPatentLinkBusiness(uploadParamsVO, projectImportPatentVO);
|
|
|
|
+ }
|
|
|
|
+ //文件夹管理 OS_PORTFOLIO_LINK
|
|
|
|
+ if (uploadParamsVO.getPatent() != null) {
|
|
|
|
+ patentProjectFolderPatentLinkBusiness(uploadParamsVO, projectImportPatentVO);
|
|
|
|
+ }
|
|
|
|
+ //标签 OS_PATENT_LABEL
|
|
|
|
+ if (uploadParamsVO.getPatentLabelList() != null) {
|
|
|
|
+ patentLabelBusiness(uploadParamsVO, projectImportPatentVO);
|
|
|
|
+ }
|
|
|
|
+ //分类号关联 OS_PATENT_TYPENO
|
|
|
|
+ patentTypeNoBusiness(uploadParamsVO);
|
|
|
|
+ //事务信息 OS_PATENT_AFFAIR
|
|
|
|
+ patentAffairBusiness(uploadParamsVO);
|
|
|
|
+ //自定义字段
|
|
|
|
+ if (uploadParamsVO.getKey() != null && uploadParamsVO.getFieldList() != null) {
|
|
|
|
+ patentFieldBusiness(params, uploadParamsVO, projectImportPatentVO);
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ if (uploadParamsVO.getPatent() != null) {
|
|
|
|
+ ImportErrorLog importErrorLog = new ImportErrorLog();
|
|
|
|
+ importErrorLog.setPatentId(uploadParamsVO.getPatent().getId())
|
|
|
|
+ .setPatentNo(uploadParamsVO.getPatent().getPatentNo())
|
|
|
|
+ .setCreateTime(new SimpleDateFormat("yyyy-MM-dd 24HI:mm:ss").format(new Date()))
|
|
|
|
+ .setCreateUserId(Integer.parseInt(params.getUserId()))
|
|
|
|
+ .setMistakeMessage(e.getMessage())
|
|
|
|
+ .setProjectId(params.getProjectId());
|
|
|
|
+ importErrorLogMapper.insert(importErrorLog);
|
|
|
|
+ FLAG += 1;
|
|
|
|
+ }
|
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * @param uploadParamsVO 全局类
|
|
|
|
+ * @date 2022-7-11
|
|
|
|
+ * @name 工具方法
|
|
|
|
+ * @description 查询数据是否存在 如果存在 返回该条数据 如果不存在 新增一条数据
|
|
|
|
+ */
|
|
|
|
+ private void getOneOrInsertOne(UploadParamsVO uploadParamsVO) {
|
|
|
|
+ if (uploadParamsVO.getPatent() != null) {
|
|
|
|
+ //用专利号查询该条数据是否存在
|
|
|
|
+ Patent patent = patentService.getByPatentNo(uploadParamsVO.getPatent().getPatentNo());
|
|
|
|
+ //如果不存在就新增一条
|
|
|
|
+ if (patent == null) {
|
|
|
|
+ uploadParamsVO.getPatent().insert();
|
|
|
|
+ } else {
|
|
|
|
+ uploadParamsVO.getPatent().setId(patent.getId());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void patentRightBusiness(UploadParamsVO uploadParamsVO) {
|
|
|
|
+ PatentRightParams patentRightParams = new PatentRightParams();
|
|
|
|
+ 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());
|
|
|
|
+ }
|
|
|
|
+ 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();
|
|
|
|
+ if (uploadParamsVO.getSimpleFamily() != null) {
|
|
|
|
+ patentSimpleFamilyParams.setSimpleFamily(uploadParamsVO.getSimpleFamily());
|
|
|
|
+ }
|
|
|
|
+ if (uploadParamsVO.getPatSnapFamily() != null) {
|
|
|
|
+ patentSimpleFamilyParams.setPatSnapFamily(uploadParamsVO.getPatSnapFamily());
|
|
|
|
+ }
|
|
|
|
+ if (uploadParamsVO.getInpadocFamily() != null) {
|
|
|
|
+ patentSimpleFamilyParams.setInpadocFamily(uploadParamsVO.getInpadocFamily());
|
|
|
|
+ }
|
|
|
|
+ patentSimpleFamilyParams.setPatentId(uploadParamsVO.getPatent().getId());
|
|
|
|
+ patentSimpleFamilyParams.setPatentNo(uploadParamsVO.getPatent().getPatentNo());
|
|
|
|
+
|
|
|
|
+ patentSimpleFamilyService.updatePatentSimpleFamily(patentSimpleFamilyParams);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void patentInventorBusiness(UploadParamsVO uploadParamsVO) {
|
|
|
|
+ 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);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void patentApplicationBusiness(UploadParamsVO uploadParamsVO) {
|
|
|
|
+ //权利人
|
|
|
|
+ patentApplicantLinkService.updatePatentApplicantLink(uploadParamsVO.getPatentApplicantCurrentName(), uploadParamsVO.getPatentApplicantStandardCurrentName(), 1, uploadParamsVO.getPatent().getId());
|
|
|
|
+ //申请人
|
|
|
|
+ patentApplicantLinkService.updatePatentApplicantLink(uploadParamsVO.getPatentApplicantOriginalName(), uploadParamsVO.getPatentApplicantStandardOriginalName(), 2, uploadParamsVO.getPatent().getId());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void patentApplicationAddressBusiness(UploadParamsVO uploadParamsVO) {
|
|
|
|
+ PatentApplicantAddressParams patentApplicantAddressParams = new PatentApplicantAddressParams();
|
|
|
|
+ patentApplicantAddressParams.setPatentId(uploadParamsVO.getPatent().getId());
|
|
|
|
+ patentApplicantAddressParams.setCurrentAddress(uploadParamsVO.getPatentApplicantCurrentAddress());
|
|
|
|
+ patentApplicantAddressParams.setOriginalAddress(uploadParamsVO.getPatentApplicantOriginalAddress());
|
|
|
|
+ patentApplicantAddressParams.setCurrentCountry(uploadParamsVO.getPatentApplicantCurrentCountry());
|
|
|
|
+ patentApplicantAddressParams.setOriginalCountry(uploadParamsVO.getPatentApplicantOriginalCountry());
|
|
|
|
+ patentApplicantAddressParams.setFirstCurrentAddress(uploadParamsVO.getFirstAddress());
|
|
|
|
+ patentApplicantService.updatePatentApplicantAddress(patentApplicantAddressParams);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ 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();
|
|
|
|
+ if (uploadParamsVO.getMainIpc() != null) {
|
|
|
|
+ patentClassNumberParams.setMainIpc(uploadParamsVO.getMainIpc());
|
|
|
|
+ }
|
|
|
|
+ if (uploadParamsVO.getMainUpc() != null) {
|
|
|
|
+ patentClassNumberParams.setMainUpc(uploadParamsVO.getMainUpc());
|
|
|
|
+ }
|
|
|
|
+ if (uploadParamsVO.getCpcList() != null) {
|
|
|
|
+ patentClassNumberParams.setCpcList(uploadParamsVO.getCpcList());
|
|
|
|
+ }
|
|
|
|
+ if (uploadParamsVO.getLocList() != null) {
|
|
|
|
+ patentClassNumberParams.setLocList(uploadParamsVO.getLocList());
|
|
|
|
+ }
|
|
|
|
+ if (uploadParamsVO.getUpcList() != null) {
|
|
|
|
+ patentClassNumberParams.setUpcList(uploadParamsVO.getUpcList());
|
|
|
|
+ }
|
|
|
|
+ if (uploadParamsVO.getIpcList() != null) {
|
|
|
|
+ patentClassNumberParams.setIpcList(uploadParamsVO.getIpcList());
|
|
|
|
+ }
|
|
|
|
+ patentClassNumberParams.setPatentId(uploadParamsVO.getPatent().getId());
|
|
|
|
+
|
|
|
|
+ patentClassNumberLinkService.updatePatentClassNumberLink(patentClassNumberParams);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void patentAffairBusiness(UploadParamsVO uploadParamsVO) {
|
|
|
|
+ PatentAffairParams patentAffairParams = new PatentAffairParams();
|
|
|
|
+ if (uploadParamsVO.getPatentAffair() != null) {
|
|
|
|
+ patentAffairParams.setContent(uploadParamsVO.getPatentAffair().getContent());
|
|
|
|
+ patentAffairParams.setStatusList(uploadParamsVO.getPatentAffair().getStatus());
|
|
|
|
+ patentAffairParams.setDateTime(uploadParamsVO.getPatentAffair().getDateTime());
|
|
|
|
+ }
|
|
|
|
+ if (uploadParamsVO.getSimpleStatus() != null) {
|
|
|
|
+ List<SystemDict> systemDictList = systemDictService.getSystemDictListByType(Collections.singletonList(Constants.PATENT_SIMPLE_STATUS));
|
|
|
|
+ Integer simpleStatus = Integer.parseInt(systemDictList.stream()
|
|
|
|
+ .filter(systemDict -> systemDict.getType().equals(Constants.PATENT_SIMPLE_STATUS) && systemDict.getLabel().equals(uploadParamsVO.getSimpleStatus()))
|
|
|
|
+ .findFirst()
|
|
|
|
+ .orElse(new SystemDict()).getValue());
|
|
|
|
+ patentAffairParams.setSimpleStatus(simpleStatus);
|
|
|
|
+ }
|
|
|
|
+ patentAffairParams.setPatentId(uploadParamsVO.getPatent().getId());
|
|
|
|
+
|
|
|
|
+ patentAffairService.updatePatientAffair(patentAffairParams);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void patentFieldBusiness(TaskParams params, UploadParamsVO uploadParamsVO, ProjectImportPatentVO projectImportPatentVO) {
|
|
|
|
+ PatentCustomFieldParams patentCustomFieldParams = new PatentCustomFieldParams();
|
|
|
|
+ patentCustomFieldParams.setPatentId(uploadParamsVO.getPatent().getId());
|
|
|
|
+ patentCustomFieldParams.setProjectId(projectImportPatentVO.getProjectId());
|
|
|
|
+ patentCustomFieldParams.setUserId(Integer.parseInt(params.getUserId()));
|
|
|
|
+ patentCustomFieldParams.put(uploadParamsVO.getKey(), uploadParamsVO.getFieldList());
|
|
|
|
+
|
|
|
|
+ patentService.updatePatentCustomField(patentCustomFieldParams);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|