Ver código fonte

2/5 excel导入

lwhhszx 1 ano atrás
pai
commit
c558c991ed

+ 17 - 17
src/main/java/cn/cslg/pas/common/config/ElasticSearchClientConfig.java

@@ -27,27 +27,27 @@ public class ElasticSearchClientConfig {
     @Configuration
     public class ElasticSearchConfig {
         //注入IOC容器
-//        @Bean
-//        public ElasticsearchClient elasticsearchClient() throws Exception {
-//            RestClientBuilder builder = RestClient.builder(new HttpHost("192.168.1.24", 9200, "https"));
-//            CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
-//            credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials("elastic", "xiaoshi221101"));
-//            SSLContext sslContext = SSLContextBuilder.create()
-//                    .loadTrustMaterial(new TrustSelfSignedStrategy())
-//                    .build();
-//            builder.setHttpClientConfigCallback(f -> f.setDefaultCredentialsProvider(credentialsProvider).setSSLContext(sslContext).setSSLHostnameVerifier(new NoopHostnameVerifier()));
-//            RestClient client =builder.build();
-//            ElasticsearchTransport transport = new RestClientTransport(client,new JacksonJsonpMapper());
-//            return new ElasticsearchClient(transport);
-//        }
-                @Bean
+        @Bean
         public ElasticsearchClient elasticsearchClient() throws Exception {
-            RestClientBuilder builder = RestClient.builder(new HttpHost("47.101.137.223", 9200, "http"));
+            RestClientBuilder builder = RestClient.builder(new HttpHost("192.168.1.24", 9200, "https"));
+            CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
+            credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials("elastic", "xiaoshi221101"));
+            SSLContext sslContext = SSLContextBuilder.create()
+                    .loadTrustMaterial(new TrustSelfSignedStrategy())
+                    .build();
+            builder.setHttpClientConfigCallback(f -> f.setDefaultCredentialsProvider(credentialsProvider).setSSLContext(sslContext).setSSLHostnameVerifier(new NoopHostnameVerifier()));
             RestClient client =builder.build();
             ElasticsearchTransport transport = new RestClientTransport(client,new JacksonJsonpMapper());
-
-                    return new ElasticsearchClient(transport);
+            return new ElasticsearchClient(transport);
         }
+//                @Bean
+//                public ElasticsearchClient elasticsearchClient() throws Exception {
+//                    RestClientBuilder builder = RestClient.builder(new HttpHost("47.101.137.223", 9200, "http"));
+//                    RestClient client = builder.build();
+//                    ElasticsearchTransport transport = new RestClientTransport(client, new JacksonJsonpMapper());
+//
+//                    return new ElasticsearchClient(transport);
+//                }
 
 
     }

+ 4 - 4
src/main/java/cn/cslg/pas/common/config/WebSocketConfig.java

@@ -6,8 +6,8 @@ import org.springframework.web.socket.server.standard.ServerEndpointExporter;
 
 @Configuration
 public class WebSocketConfig {
-    @Bean
-    public ServerEndpointExporter serverEndpointExporter() {
-        return new ServerEndpointExporter();
-    }
+//    @Bean
+//    public ServerEndpointExporter serverEndpointExporter() {
+//        return new ServerEndpointExporter();
+//    }
 }

+ 4 - 0
src/main/java/cn/cslg/pas/common/dto/UploadPatentWebDTO.java

@@ -1,5 +1,6 @@
 package cn.cslg.pas.common.dto;
 
+import cn.cslg.pas.common.dto.es.EsCustomFieldDTO;
 import cn.cslg.pas.common.vo.StarPatentVO;
 import cn.cslg.pas.common.vo.UploadParamsVO;
 import cn.cslg.pas.domain.es.Patent;
@@ -8,6 +9,8 @@ import lombok.Data;
 import lombok.Synchronized;
 import org.apache.poi.ss.usermodel.PictureData;
 
+import java.util.List;
+
 @Data
 
 public class UploadPatentWebDTO {
@@ -18,4 +21,5 @@ public class UploadPatentWebDTO {
     private PictureData pictureData;
     private Integer haveSaveCounter;
     private Integer index;
+    private List<EsCustomFieldDTO> esCustomFieldDTOList;
 }

+ 2 - 0
src/main/java/cn/cslg/pas/common/vo/ImportTaskAMVO.java

@@ -1,5 +1,6 @@
 package cn.cslg.pas.common.vo;
 
+import cn.cslg.pas.common.dto.es.EsCustomFieldDTO;
 import com.baomidou.mybatisplus.annotation.TableField;
 import lombok.Data;
 
@@ -93,4 +94,5 @@ public class ImportTaskAMVO {
 
     private Integer messageThreadCounter;
     private String patentNoStr;
+    private List<EsCustomFieldDTO> fieldDTOS;
 }

+ 11 - 9
src/main/java/cn/cslg/pas/controller/FTOController.java

@@ -28,6 +28,7 @@ import java.util.List;
 
 /**
  * FTOTort
+ *
  * @Author xiexiang
  * @Date 2023/12/8
  */
@@ -50,12 +51,13 @@ public class FTOController {
 
     @Operation(summary = "保存FTO对比结果")
     @PostMapping("/addFTOCompareRecord")
-    public Response addFTOCompareRecord(@RequestBody TortCompareRecordDTO tortCompareRecordDTO){
+    public Response addFTOCompareRecord(@RequestBody TortCompareRecordDTO tortCompareRecordDTO) {
         if (tortCompareRecordDTO != null) {
             List<Integer> ids = new ArrayList<>();
             try {
                 ids = ftoCompareRecordService.addFTOCompareRecord(tortCompareRecordDTO);
-            } catch (Exception e) {
+            }
+            catch (Exception e) {
                 if (e instanceof XiaoShiException) {
                     return Response.error(e.getMessage());
                 } else if (e instanceof UnLoginException) {
@@ -74,7 +76,7 @@ public class FTOController {
 
     @Operation(summary = "添加FTO协同任务")
     @PostMapping("/addFTOAssitTask")
-    public Response addFTOAssitTask(@RequestBody TortTaskDTO tortTaskDTO){
+    public Response addFTOAssitTask(@RequestBody TortTaskDTO tortTaskDTO) {
         Integer id = projectTaskService.addFTOAssitTask(tortTaskDTO);
         Records records = new Records();
         records.setData(id);
@@ -83,7 +85,7 @@ public class FTOController {
 
     @Operation(summary = "保存FTO协同任务对比结果")
     @PostMapping("/addFTOAssitTaskResult")
-    public Response addFTOAssitTaskResult(@RequestBody TortCompareRecordDTO tortCompareRecordDTO){
+    public Response addFTOAssitTaskResult(@RequestBody TortCompareRecordDTO tortCompareRecordDTO) {
         List<Integer> ids = ftoCompareRecordService.addFTOAssitTaskResult(tortCompareRecordDTO);
         Records records = new Records();
         records.setData(ids);
@@ -92,7 +94,7 @@ public class FTOController {
 
     @Operation(summary = "查询fto协同前后对比结果")
     @GetMapping("/getFTOAssitResult")
-    public Response getFTOAssitResult(String patentNo, Integer taskId){
+    public Response getFTOAssitResult(String patentNo, Integer taskId) {
         Integer type = 1;
         TortCompareRecordVO tortCompareRecordVO = ftoCompareRecordService.getFTOAssitResult(patentNo, taskId, type);
         return Response.success(tortCompareRecordVO);
@@ -100,7 +102,7 @@ public class FTOController {
 
     @Operation(summary = "保存最终对比结果")
     @PostMapping("/addFinalAssitResult")
-    public Response addFinalAssitResult(@RequestBody TortCompareRecordDTO tortCompareRecordDTO){
+    public Response addFinalAssitResult(@RequestBody TortCompareRecordDTO tortCompareRecordDTO) {
         List<Integer> ids = ftoCompareRecordService.addFinalAssitResult(tortCompareRecordDTO);
         Records records = new Records();
         records.setData(ids);
@@ -109,15 +111,15 @@ public class FTOController {
 
     @Operation(summary = "查询最终结果")
     @GetMapping("/getFTOFinalResult")
-    public Response getFTOFinalResult(String patentNo, Integer taskId){
+    public Response getFTOFinalResult(String patentNo, Integer taskId) {
         Integer type = 2;
-        TortCompareRecordVO tortCompareRecordVO = ftoCompareRecordService.getFTOAssitResult(patentNo,taskId, type);
+        TortCompareRecordVO tortCompareRecordVO = ftoCompareRecordService.getFTOAssitResult(patentNo, taskId, type);
         return Response.success(tortCompareRecordVO);
     }
 
     @Operation(summary = "查询报告专利最新对比结果")
     @GetMapping("/getLastRecord")
-    public Response getLastRecord(Integer projectId, String patentNo){
+    public Response getLastRecord(Integer projectId, String patentNo) {
         TortCompareRecordVO tortCompareRecordVO = ftoCompareRecordService.getLastRecord(projectId, patentNo);
         return Response.success(tortCompareRecordVO);
     }

+ 50 - 2
src/main/java/cn/cslg/pas/service/business/CustomFieldService.java

@@ -616,12 +616,10 @@ public class CustomFieldService extends ServiceImpl<CustomFieldMapper, CustomFie
         if (customField != null) {
             return customField.getId();
         }
-        PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
         CustomField customField1 = new CustomField();
         customField1.setName(name);
         customField1.setProjectId(projectId);
         customField1.setType(type);
-        customField1.setCreateId(personnelVO.getId());
         customField1.insert();
         return customField1.getId();
     }
@@ -820,4 +818,54 @@ public class CustomFieldService extends ServiceImpl<CustomFieldMapper, CustomFie
 //
 //    }
 
+
+    /**
+     * @param customerFieldList
+     */
+    public  List<EsCustomFieldDTO> getFieldDTOByStrings(List<UploadParamsVO.Field> customerFieldList, Integer projectId) {
+      List<EsCustomFieldDTO>  esCustomFieldDTOs =new ArrayList<>();
+        if (customerFieldList != null && customerFieldList.size() != 0) {
+
+            for (UploadParamsVO.Field field : customerFieldList) {
+                EsCustomFieldDTO esCustomFieldDTO =new EsCustomFieldDTO();
+                String key = field.getKey();
+                List<String> fieldList = field.getFieldList();
+                String[] keys = key.split(":");
+                if (keys.length < 2) {
+                    continue;
+                }
+                String type = keys[1].trim();
+                String fieldName = keys[0].trim();
+                Integer typeInt = Integer.parseInt(type);
+                Integer fieldId = this.GetIdByName(fieldName, projectId, typeInt);
+                esCustomFieldDTO.setFieldId(fieldId.toString());
+                List<String> values =new ArrayList<>();
+                switch (type) {
+                    case "0":
+                    case "1":
+                    case "2":
+                        esCustomFieldDTO.setFieldType(Integer.parseInt(type));
+                        values =fieldList;
+                        break;
+                    case "4":
+                    case "5":
+                        esCustomFieldDTO.setFieldType(Integer.parseInt(type));
+                        values = customOptionService.getIdsByNames(fieldList,fieldId);
+                        break;
+                    case "6":
+                        esCustomFieldDTO.setFieldType(Integer.parseInt(type));
+                       values =treeNodeService.getIdByNames(fieldList,fieldId);
+                        break;
+                }
+                esCustomFieldDTO.setFieldValue(values);
+
+                esCustomFieldDTO.setProjectId(projectId);
+                esCustomFieldDTOs.add(esCustomFieldDTO);
+            }
+
+        }
+     return esCustomFieldDTOs;
+    }
+
+
 }

+ 6 - 2
src/main/java/cn/cslg/pas/service/business/ImportTaskService.java

@@ -168,8 +168,12 @@ public class ImportTaskService extends ServiceImpl<ImportTaskMapper, ImportTask>
             String jsons = JSONObject.toJSON(importTaskDTO.getPatentNos()).toString();
             importTaskCondition.setPatentNos(jsons);
         }
-        String fieldJson = JsonUtils.objectToJson(importTaskCondition);
-        importTaskCondition.setCustomFields(fieldJson);
+
+        //保存标引信息
+        if (importTaskDTO.getFieldDTOS() != null && importTaskDTO.getFieldDTOS().size() > 0) {
+            String fieldJson = JsonUtils.objectToJson(importTaskDTO.getFieldDTOS());
+            importTaskCondition.setCustomFields(fieldJson);
+        }
         importTaskCondition.insert();
 
         //装载任务

+ 55 - 3
src/main/java/cn/cslg/pas/service/business/TreeNodeService.java

@@ -254,11 +254,11 @@ public class TreeNodeService extends ServiceImpl<TreeNodeMapper, TreeNode> imple
             if (parentPath != null) {
                 //父id若为顶层id,则父id没有路径
                 if (parentPath.equals("")) {
-                    treeNode.setPath(parentId+"");
+                    treeNode.setPath(parentId + "");
                     treeNode.setLevel(1);
                 } else {
                     //父id不是顶层id,父id有路径
-                    treeNode.setPath(parentPath + "/" + parentId );
+                    treeNode.setPath(parentPath + "/" + parentId);
                     treeNode.setLevel(parentNode.getLevel() + 1);
                 }
             } else {
@@ -484,7 +484,6 @@ public class TreeNodeService extends ServiceImpl<TreeNodeMapper, TreeNode> imple
         }
 
 
-
         List<Personnel> personnels = new ArrayList<>();
         List<String> guids = new ArrayList<>();
         List<SystemFile> systemFiles = new ArrayList<>();
@@ -771,4 +770,57 @@ public class TreeNodeService extends ServiceImpl<TreeNodeMapper, TreeNode> imple
         });
         return ids;
     }
+
+    //
+    public List<String> getIdByNames(List<String> values, Integer fieldId) {
+
+        List<String> valuesIds = new ArrayList<>();
+        for (String value : values) {
+            String[] valueQs = value.split("\\\\");
+            TreeNode parentTreeNode = null;
+            for (int i = 0; i < valueQs.length; i++) {
+                String valueQ = valueQs[i];
+                TreeNode treeNode = this.getTreeNodeByName(valueQ, i, fieldId, parentTreeNode);
+                if (i == valueQs.length - 1) {
+                    if (!valuesIds.contains(treeNode.getId())) {
+                        valuesIds.add(treeNode.getId().toString());
+                    }
+                }
+            }
+        }
+        return valuesIds;
+    }
+
+
+    public TreeNode getTreeNodeByName(String value, Integer level, Integer fieldId, TreeNode parentTreeNode) {
+        Integer parentId = 0;
+        if (parentTreeNode != null) {
+            parentId = parentTreeNode.getParentId();
+        }
+
+        //根据名称查询
+        LambdaQueryWrapper<TreeNode> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(TreeNode::getName, value)
+                .eq(TreeNode::getLevel, level)
+                .eq(TreeNode::getParentId, parentId)
+                .eq(TreeNode::getType, 4)
+                .eq(TreeNode::getTypeId, fieldId);
+        TreeNode treeNode = this.getOne(queryWrapper, false);
+        if (treeNode == null) {
+             treeNode =new TreeNode();
+            treeNode.setName(value);
+            treeNode.setType(4);
+            treeNode.setParentId(parentId);
+            treeNode.setLevel(level);
+            treeNode.setTypeId(fieldId);
+            if(parentTreeNode!=null) {
+                treeNode.setPath(parentTreeNode.getPath()+"/"+parentTreeNode.getId());
+            }
+            else {
+                treeNode.setPath("");
+            }
+            treeNode.insert();
+        }
+        return  treeNode;
+    }
 }

+ 2 - 1
src/main/java/cn/cslg/pas/service/importPatent/GetCataloguingFromWebThread.java

@@ -98,7 +98,7 @@ public class GetCataloguingFromWebThread extends Thread {
 
                 EsService esService = applicationContext.getBean(EsService.class);
 
-//                添加同族专利
+            // 添加同族专利
                 String familyPatentNoStr = patentStarApiService.getFamilyByPubNoApi(uploadPatentWebDTO.getPatent().getPublicNo());
                 List<String> familyPatentNos = new ArrayList<>();
                 if (!familyPatentNoStr.equals("no data")&&!familyPatentNoStr.trim().equals("")) {
@@ -124,6 +124,7 @@ public class GetCataloguingFromWebThread extends Thread {
                     List<String> quotedNos = this.reQuotedNos(nos);
                     esService.addEsQuotePatent(uploadPatentWebDTO.getPatent().getPublicNo(), quotedNos);
                 }
+
                 //加入es保存队列
                 importFromWebToEsService.loadPatentMessageDone(uploadPatentWebDTO);
             } catch (Exception e) {

+ 10 - 5
src/main/java/cn/cslg/pas/service/importPatent/GetPatentFromExcelThread.java

@@ -3,6 +3,7 @@ package cn.cslg.pas.service.importPatent;
 import cn.cslg.pas.common.core.base.FamilyType;
 import cn.cslg.pas.common.dto.UploadPatentWebDTO;
 import cn.cslg.pas.common.dto.business.EsPatentFamilyDTO;
+import cn.cslg.pas.common.dto.es.EsCustomFieldDTO;
 import cn.cslg.pas.common.model.cronModel.SystemFile;
 import cn.cslg.pas.common.utils.ReadExcelUtils;
 import cn.cslg.pas.common.vo.ImportTaskAMVO;
@@ -11,6 +12,7 @@ import cn.cslg.pas.common.vo.UploadParamsVO;
 import cn.cslg.pas.common.vo.UploadSettingVO;
 import cn.cslg.pas.domain.es.Patent;
 import cn.cslg.pas.domain.es.Text;
+import cn.cslg.pas.service.business.CustomFieldService;
 import cn.cslg.pas.service.business.es.EsService;
 import cn.cslg.pas.service.common.ExcuteDataToVOService;
 import cn.cslg.pas.service.common.ExcuteUploadSettingService;
@@ -53,7 +55,9 @@ public class GetPatentFromExcelThread extends Thread {
                 IOUtils.copy(inputStream, outputStream); // 将输入流复制到临时文件
             }
             Integer total = importTaskAMVO.getAllNum();
+
             Integer lastIndex = importTaskAMVO.getDoneNum();
+
             Integer sourceId = importTaskAMVO.getSourceId();
             //解析数据源类,通过数据来源id(如1:智慧芽)解析数据源配置文件,获得数据源配置文件对象jsonData
             ExcuteDataToVOService excuteDataToVOService = applicationContext.getBean(ExcuteDataToVOService.class);
@@ -68,19 +72,21 @@ public class GetPatentFromExcelThread extends Thread {
                     break;
                 }
                 PatentData patentData = ReadExcelUtils.readExcelOneRow(tempFile, sheet, i + 1);
-
                 //调用装载数据类(根据数据源配置文件对象和专利源数据生成专利数据)
                 UploadParamsVO uploadParamsVO = excuteDataToVOService.fileToPatentVO(patentData, jsonData);
                 this.loadPatent(uploadParamsVO);
-
                 UploadPatentWebDTO uploadPatentWebDTO = new UploadPatentWebDTO();
                 uploadPatentWebDTO.setHaveSaveCounter(0);
                 uploadPatentWebDTO.setTotalCounter(importTaskAMVO.getThreadCounter());
                 uploadPatentWebDTO.setPictureData(uploadParamsVO.getPictureData());
                 uploadPatentWebDTO.setPatent(uploadParamsVO.getPatent());
+                if(uploadParamsVO.getCustomerFieldList()!=null&&uploadParamsVO.getCustomerFieldList().size()!=0){
+                    CustomFieldService customFieldService =applicationContext.getBean(CustomFieldService.class);
+                    List<EsCustomFieldDTO> esCustomFieldDTOList =customFieldService.getFieldDTOByStrings(uploadParamsVO.getCustomerFieldList(),importTaskAMVO.getProjectId());
+                    uploadPatentWebDTO.setEsCustomFieldDTOList(esCustomFieldDTOList);
+                }
                 //专利丢入消费者队列,并唤醒消费者线程
-
-                savePatentToEsThread.awakeTask(uploadPatentWebDTO.getPatent());
+                savePatentToEsThread.awakeTask(uploadPatentWebDTO);
                 getPatentPictureFromExcelThread.awakeTask(uploadPatentWebDTO);
             }
             //专利取完通知消费者线程
@@ -98,7 +104,6 @@ public class GetPatentFromExcelThread extends Thread {
         this.savePatentToEsThread = savePatentToEsThread;
         this.applicationContext = taskThread.getApplicationContext();
         this.getPatentPictureFromExcelThread = getPatentPictureFromExcelThread;
-
     }
 
 

+ 3 - 7
src/main/java/cn/cslg/pas/service/importPatent/ImportFromWebToEsService.java

@@ -283,18 +283,14 @@ public class ImportFromWebToEsService implements PatentImportImp {
                     Patent orgPatent = uploadPatentWebDTO.getPatent();
                     Patent patent = dtos.get(0).getPatent();
                     BeanUtils.copyProperties(patent, orgPatent, FormatUtil.getNullPropertyNames(patent));
-                    Patent patent1 = new Patent();
-                    BeanUtils.copyProperties(orgPatent, patent1);
+                    uploadPatentWebDTO.setPatent(orgPatent);
                     uploadPatentWebDTOS.removeIf(i -> i.getIndex().equals(uploadPatentWebDTO.getIndex()));
-                    savePatentToEsThread.awakeTask(patent1);
+                    savePatentToEsThread.awakeTask(uploadPatentWebDTO);
                 } else {
                     uploadPatentWebDTOS.add(uploadPatentWebDTO);
                 }
             } else {
-                Patent patent = uploadPatentWebDTO.getPatent();
-                Patent patent1 = new Patent();
-                BeanUtils.copyProperties(patent, patent1);
-                savePatentToEsThread.awakeTask(patent1);
+                savePatentToEsThread.awakeTask(uploadPatentWebDTO);
             }
         }
     }

+ 38 - 11
src/main/java/cn/cslg/pas/service/importPatent/SavePatentToEsThread.java

@@ -1,6 +1,7 @@
 package cn.cslg.pas.service.importPatent;
 
 import cn.cslg.pas.common.dto.UploadPatentWebDTO;
+import cn.cslg.pas.common.dto.es.EsCustomFieldDTO;
 import cn.cslg.pas.common.utils.FormatUtil;
 import cn.cslg.pas.common.vo.ImportTaskAMVO;
 import cn.cslg.pas.common.vo.PatentWithIdVO;
@@ -10,6 +11,7 @@ import cn.cslg.pas.domain.es.Patent;
 import cn.cslg.pas.domain.es.PatentJoin;
 import cn.cslg.pas.service.business.CompareLiteratureService;
 import cn.cslg.pas.service.business.ImportTaskService;
+import cn.cslg.pas.service.business.es.EsCustomFieldService;
 import cn.cslg.pas.service.business.es.EsMergePersonService;
 import cn.cslg.pas.service.business.es.EsProductPatentService;
 import cn.cslg.pas.service.business.es.EsService;
@@ -30,25 +32,26 @@ import java.util.concurrent.locks.ReentrantLock;
 
 public class SavePatentToEsThread extends Thread {
     private ApplicationContext applicationContext;
-    private List<Patent> patents = new ArrayList<>();
+    private List<UploadPatentWebDTO> uploadPatentWebDTOS = new ArrayList<>();
     private Lock taskLock = new ReentrantLock();
-    private  Condition taskCondition = taskLock.newCondition();
+    private Condition taskCondition = taskLock.newCondition();
     private TaskThread taskThread;
     private ImportTaskAMVO importTaskAMVO;
     private Boolean ifProductAll = false;
 
     @Override
     public void run() {
-        while ((!ifProductAll || patents.size() > 0) && importTaskAMVO.getState().equals(1)) {
+        while ((!ifProductAll || uploadPatentWebDTOS.size() > 0) && importTaskAMVO.getState().equals(1)) {
             try {
                 //判断任务队列是否有任务,若没有则线程等待唤醒
-                if (patents.size() == 0) {
+                if (uploadPatentWebDTOS.size() == 0) {
                     taskLock.lock();
                     taskCondition.await();
                 }
             } catch (Exception e) {
             }
-            Patent patent = patents.remove(0);
+            UploadPatentWebDTO uploadPatentWebDTO = uploadPatentWebDTOS.remove(0);
+            Patent patent = uploadPatentWebDTO.getPatent();
             try {
                 //根据专利号查询专利
                 EsService esService = applicationContext.getBean(EsService.class);
@@ -122,6 +125,30 @@ public class SavePatentToEsThread extends Thread {
                     EsProductPatentService esProductPatentService = applicationContext.getBean(EsProductPatentService.class);
                     esProductPatentService.addProductPatent(patentId, importTaskAMVO.getProductId());
                 }
+
+                //保存和自定义字段关联
+                if (importTaskAMVO.getFieldDTOS() != null && importTaskAMVO.getFieldDTOS().size() > 0) {
+                    for (EsCustomFieldDTO esCustomFieldDTO : importTaskAMVO.getFieldDTOS()
+                    ) {
+                        esCustomFieldDTO.setPatentId(patentId);
+                        esCustomFieldDTO.setOptionType(2);
+                        EsCustomFieldService esCustomFieldService = applicationContext.getBean(EsCustomFieldService.class);
+                        esCustomFieldService.addCustomField(esCustomFieldDTO);
+                    }
+
+                }
+
+                if (uploadPatentWebDTO.getEsCustomFieldDTOList() != null && uploadPatentWebDTO.getEsCustomFieldDTOList().size() != 0) {
+                    for (EsCustomFieldDTO esCustomFieldDTO : uploadPatentWebDTO.getEsCustomFieldDTOList()
+                    ) {
+                        esCustomFieldDTO.setPatentId(patentId);
+                        esCustomFieldDTO.setOptionType(2);
+                        EsCustomFieldService esCustomFieldService = applicationContext.getBean(EsCustomFieldService.class);
+                        esCustomFieldService.addCustomField(esCustomFieldDTO);
+                    }
+
+                }
+
                 //导入完成,通知前台
                 taskThread.updateProcess(false, 1, "");
             } catch (Exception e) {
@@ -138,10 +165,10 @@ public class SavePatentToEsThread extends Thread {
         this.importTaskAMVO = taskThread.getImportTaskAMVO();
     }
 
-    public void awakeTask(Patent patent) {
-        Patent patent1 = new Patent();
-        BeanUtils.copyProperties(patent, patent1);
-        patents.add(patent1);
+    public void awakeTask(UploadPatentWebDTO uploadPatentWebDTO) {
+        UploadPatentWebDTO uploadPatentWebDTO1 = new UploadPatentWebDTO();
+        BeanUtils.copyProperties(uploadPatentWebDTO, uploadPatentWebDTO1);
+        uploadPatentWebDTOS.add(uploadPatentWebDTO1);
         if (taskLock.tryLock()) {
             taskCondition.signalAll();
             taskLock.unlock();
@@ -151,9 +178,9 @@ public class SavePatentToEsThread extends Thread {
     public void setIfProductAll(Boolean ifProductAll) {
 
         this.ifProductAll = ifProductAll;
-        System.out.println("专利导入全部结束"+ this.ifProductAll+importTaskAMVO.getId());
+        System.out.println("专利导入全部结束" + this.ifProductAll + importTaskAMVO.getId());
         if (taskLock.tryLock()) {
-            System.out.println("专利导入到es解锁"+importTaskAMVO.getId());
+            System.out.println("专利导入到es解锁" + importTaskAMVO.getId());
             taskCondition.signalAll();
             taskLock.unlock();
         }

+ 6 - 0
src/main/java/cn/cslg/pas/service/importPatent/SchedulingTaskService.java

@@ -1,6 +1,7 @@
 package cn.cslg.pas.service.importPatent;
 
 import cn.cslg.pas.common.core.base.Constants;
+import cn.cslg.pas.common.dto.es.EsCustomFieldDTO;
 import cn.cslg.pas.common.vo.ImportTaskAMVO;
 import cn.cslg.pas.common.vo.ProgressVO;
 import cn.cslg.pas.domain.business.ImportTask;
@@ -9,6 +10,7 @@ import cn.cslg.pas.domain.business.ReportProject;
 import cn.cslg.pas.service.business.ImportTaskConditionService;
 import cn.cslg.pas.service.business.ImportTaskService;
 import cn.cslg.pas.service.business.ReportProjectService;
+import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -106,6 +108,10 @@ public class SchedulingTaskService {
                 importTaskAMVO.setOrderByType(importTaskCondition.getOrderByType());
                 importTaskAMVO.setProjectType(importTaskCondition.getProjectType());
                 importTaskAMVO.setPatentNoStr(importTaskCondition.getPatentNos());
+                if(importTaskCondition.getCustomFields()!=null) {
+                    List<EsCustomFieldDTO> dtos = JSONArray.parseArray(importTaskCondition.getCustomFields());
+                    importTaskAMVO.setFieldDTOS(dtos);
+                }
                 LambdaQueryWrapper<ReportProject> rQueryWrapper = new LambdaQueryWrapper<>();
                 rQueryWrapper.eq(ReportProject::getProjectId, importTaskCondition.getProjectId());
                 ReportProject reportProject = reportProjectService.getOne(rQueryWrapper, false);

+ 3 - 5
src/test/java/cn/cslg/pas/service/CommonServiceTests.java

@@ -145,10 +145,8 @@ public class CommonServiceTests {
 //李仁杰<2232723707@qq.com>"
     @Test
     public void testEmail() throws Exception{
-
-        PatentImportImp patentImportImp = patentImportFactory.getClass("importFromWebToEsService");
-        PatentImportImp patentImportImp2 = patentImportFactory.getClass("importFromWebToEsService");
-          System.out.println(patentImportImp);
-        System.out.println(patentImportImp2);
+          String  a ="多功能应用\\烟熏模块";
+         String[] ab =a.split("\\\\");
+          System.out.println(ab);
     }
     }