xiexiang 1 년 전
부모
커밋
45cbdf88f0

+ 52 - 0
src/main/java/cn/cslg/pas/common/dto/ExportTaskDTO.java

@@ -0,0 +1,52 @@
+package cn.cslg.pas.common.dto;
+
+import cn.cslg.pas.common.dto.es.EsCustomFieldDTO;
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 导出任务DTO类
+ *
+ * @author xx
+ */
+
+@Accessors(chain = true)
+@Data
+public class ExportTaskDTO {
+    private Integer projectId;
+
+    /**
+     * 1 Excel导入
+     * 2 专利号导入
+     * 3 专利号文件导入
+     * 4 检索导入
+     * 5 pdf文档导入
+     * 6 Excel导出
+     */
+    private Integer type;
+
+    /**
+     * 文件guid
+     */
+    private String fileGuid;
+
+    /**
+     * 导出总条数
+     */
+    private Integer allNum;
+
+    /**
+     /**
+     * 失败条数
+     */
+    private Integer defaultNum;
+
+    /**
+     * 完成时间
+     */
+    private Date finishTime;
+}

+ 6 - 0
src/main/java/cn/cslg/pas/common/utils/GenerateObjectUtil.java

@@ -21,6 +21,12 @@ public class GenerateObjectUtil {
         method.invoke(obj, value);
         method.invoke(obj, value);
     }
     }
 
 
+    /**
+     *
+     * @param obj
+     * @param propertyName
+     * @return
+     */
     public static Object getPropertyValue(Object obj, String propertyName){
     public static Object getPropertyValue(Object obj, String propertyName){
         try {
         try {
             String getMethodName = "get" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1);
             String getMethodName = "get" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1);

+ 51 - 0
src/main/java/cn/cslg/pas/common/utils/ParseByteToFileUtils.java

@@ -0,0 +1,51 @@
+package cn.cslg.pas.common.utils;
+
+import cn.cslg.pas.service.common.FileManagerService;
+import cn.hutool.core.util.IdUtil;
+import org.apache.commons.io.input.XmlStreamReaderException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.io.ByteArrayResource;
+import org.springframework.mock.web.MockMultipartFile;
+import org.springframework.stereotype.Component;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Method;
+import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/1/11
+ */
+@Component
+public class ParseByteToFileUtils {
+    @Autowired
+    private FileManagerService fileManagerService;
+
+    public static MultipartFile convertBytesToMultipartFile(byte[] fileData, String fileName) throws IOException {
+        InputStream inputStream = new ByteArrayInputStream(fileData);
+        MultipartFile multipartFile = new MockMultipartFile("file", fileName, "application/octet-stream", inputStream);
+        return multipartFile;
+    }
+
+    public String uploadFile(byte[] fileData) throws IOException {
+        List<MultipartFile> multipartFiles = new ArrayList<>();
+        //保存生成地址
+        String fileName = IdUtil.simpleUUID() + ".xls";
+        //文件原始名中的中文字符可能会乱码,对文件名进行URL编码
+        String encodedFileName = URLEncoder.encode(fileName, StandardCharsets.UTF_8.toString());
+        MultipartFile multipartFile = this.convertBytesToMultipartFile(fileData, encodedFileName);
+        multipartFiles.add(multipartFile);
+        List<String> fileGuids = fileManagerService.uploadFileGetGuid(multipartFiles);
+        String fileGuid = null;
+        if (!fileGuids.isEmpty()) {
+            fileGuid = fileGuids.get(0);
+        }
+        return fileGuid;
+    }
+}

+ 3 - 1
src/main/java/cn/cslg/pas/common/utils/ResponseEnum.java

@@ -14,7 +14,9 @@ public enum ResponseEnum {
     PATENT_IMPORT_TASK_SUCCESS(903, "导入任务完成"),
     PATENT_IMPORT_TASK_SUCCESS(903, "导入任务完成"),
     PATENT_IMPORT_PATENT_PART_SUCCESS(900, "专利信息部分上传成功"),
     PATENT_IMPORT_PATENT_PART_SUCCESS(900, "专利信息部分上传成功"),
     COMPARE_LITERATURE_BATCH(600,"批量上传对比文献"),
     COMPARE_LITERATURE_BATCH(600,"批量上传对比文献"),
-    COMPARE_LITERATURE_BATCH_DONE(601,"批量上传对比文献完成");
+    COMPARE_LITERATURE_BATCH_DONE(601,"批量上传对比文献完成"),
+    PATENT_EXPORT_TASK(602,"导出专利信息"),
+    PATENT_EXPORT_TASK_DONE(603,"导出专利信息完成") ;
 
 
     private Integer code;
     private Integer code;
     private String message;
     private String message;

+ 15 - 0
src/main/java/cn/cslg/pas/common/vo/ConfigVOS/PatentConfigVO.java

@@ -0,0 +1,15 @@
+package cn.cslg.pas.common.vo.ConfigVOS;
+
+import lombok.Data;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/1/11
+ */
+@Data
+public class PatentConfigVO {
+    private String type;
+    private String value;
+    private String exportClass;
+}
+

+ 21 - 18
src/main/java/cn/cslg/pas/controller/PatentController.java

@@ -34,6 +34,7 @@ import org.springframework.core.io.InputStreamResource;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.MediaType;
 import org.springframework.http.MediaType;
 import org.springframework.http.ResponseEntity;
 import org.springframework.http.ResponseEntity;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayInputStream;
@@ -230,24 +231,26 @@ public class PatentController {
                 .body(new InputStreamResource(new ByteArrayInputStream(fileData)));
                 .body(new InputStreamResource(new ByteArrayInputStream(fileData)));
     }
     }
 
 
-    @PostMapping("/export")
+//    @PostMapping("/exportPatentExcel")
+//    @Operation(summary = "导出专利")
+//    public ResponseEntity<InputStreamResource> export(@RequestBody EsCustomFieldBatchVO EsVO) throws IOException {
+//        byte[] fileData = patentExportService.exportPatent(EsVO);
+//        //保存生成excel的地址
+//        String fileName = IdUtil.simpleUUID() + ".xls";
+//        //文件原始名中的中文字符可能会乱码,对文件名进行URL编码
+//        String encodedFileName = URLEncoder.encode(fileName, StandardCharsets.UTF_8.toString());
+//        return ResponseEntity.ok().contentLength(fileData.length)
+//                .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + encodedFileName + "\"")
+//                .contentType(MediaType.parseMediaType("application/octet-stream"))
+//                .body(new InputStreamResource(new ByteArrayInputStream(fileData)));
+//    }
+
+    @PostMapping("/exportPatentExcel")
     @Operation(summary = "导出专利")
     @Operation(summary = "导出专利")
-    public ResponseEntity<InputStreamResource> export(@RequestBody EsCustomFieldBatchVO EsVO) throws IOException {
-//        Integer taskId = 1;
-//        TaskParams taskParams = new TaskParams();
-//        taskParams.setTaskId(taskId);
-//        taskParams.setTaskType(2);
-//        taskParams.setProjectId(EsVO.getProjectId());
-//        taskParams.setSelected(JsonUtils.objectToJson(EsVO.getSelected()));
-//        taskParams.setCreateId("328");
-        byte[] fileData = patentExportService.exportPatent(EsVO);
-        //保存生成excel的地址
-        String fileName = IdUtil.simpleUUID() + ".xls";
-        //文件原始名中的中文字符可能会乱码,对文件名进行URL编码
-        String encodedFileName = URLEncoder.encode(fileName, StandardCharsets.UTF_8.toString());
-        return ResponseEntity.ok().contentLength(fileData.length)
-                .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + encodedFileName + "\"")
-                .contentType(MediaType.parseMediaType("application/octet-stream"))
-                .body(new InputStreamResource(new ByteArrayInputStream(fileData)));
+    public Response export(@RequestBody EsCustomFieldBatchVO EsVO) throws IOException {
+        patentExportService.exportPatent(EsVO);
+        Records records = new Records();
+        records.setData("导出成功");
+        return Response.success(records);
     }
     }
 }
 }

+ 16 - 0
src/main/java/cn/cslg/pas/factorys/PatentExportFactory/GetCommonValue.java

@@ -0,0 +1,16 @@
+package cn.cslg.pas.factorys.PatentExportFactory;
+
+import org.springframework.stereotype.Component;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/1/11
+ */
+@Component
+public class GetCommonValue implements GetValueImp{
+    @Override
+    public String getValue(Object value) {
+        String reValue = value.toString();
+        return reValue;
+    }
+}

+ 25 - 0
src/main/java/cn/cslg/pas/factorys/PatentExportFactory/GetDateValue.java

@@ -0,0 +1,25 @@
+package cn.cslg.pas.factorys.PatentExportFactory;
+
+import org.springframework.stereotype.Component;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/1/11
+ */
+@Component
+public class GetDateValue implements GetValueImp{
+    @Override
+    public String getValue(Object value) {
+        Date inputDate = (Date)value;
+        String reValue;
+        // 创建SimpleDateFormat对象,指定输出日期的格式
+        SimpleDateFormat outputDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        // 将Date对象格式化为字符串
+        reValue = outputDateFormat.format(inputDate);
+        return reValue;
+    }
+}

+ 21 - 0
src/main/java/cn/cslg/pas/factorys/PatentExportFactory/GetNameValue.java

@@ -0,0 +1,21 @@
+package cn.cslg.pas.factorys.PatentExportFactory;
+
+import org.springframework.stereotype.Component;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/1/11
+ */
+@Component
+public class GetNameValue implements GetValueImp{
+    @Override
+    public String getValue(Object value) {
+        if (value != null) {
+            String reValue = value.toString();
+            String result = reValue.substring(1, reValue.length() - 1);
+            return result;
+        } else {
+            return null;
+        }
+    }
+}

+ 8 - 0
src/main/java/cn/cslg/pas/factorys/PatentExportFactory/GetValueImp.java

@@ -0,0 +1,8 @@
+package cn.cslg.pas.factorys.PatentExportFactory;
+
+
+import cn.cslg.pas.common.model.cronModel.SqlObject;
+
+public interface GetValueImp {
+    public String getValue(Object value);
+}

+ 25 - 0
src/main/java/cn/cslg/pas/factorys/PatentExportFactory/PatentExportFactory.java

@@ -0,0 +1,25 @@
+package cn.cslg.pas.factorys.PatentExportFactory;
+
+import cn.cslg.pas.factorys.getSqlFactorys.GetSqlObject;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/1/11
+ */
+@Component
+public class PatentExportFactory {
+    @Autowired
+    private Map<String, GetValueImp> getValueImpMap;
+
+
+    public GetValueImp getClass(String sqlType) {
+        GetValueImp bean1 = getValueImpMap.get(sqlType);
+        return bean1;
+    }
+}

+ 46 - 0
src/main/java/cn/cslg/pas/service/business/ImportTaskService.java

@@ -1,5 +1,6 @@
 package cn.cslg.pas.service.business;
 package cn.cslg.pas.service.business;
 
 
+import cn.cslg.pas.common.dto.ExportTaskDTO;
 import cn.cslg.pas.common.dto.ImportTaskDTO;
 import cn.cslg.pas.common.dto.ImportTaskDTO;
 import cn.cslg.pas.common.dto.PatentStarListDTO;
 import cn.cslg.pas.common.dto.PatentStarListDTO;
 import cn.cslg.pas.common.model.cronModel.Personnel;
 import cn.cslg.pas.common.model.cronModel.Personnel;
@@ -378,4 +379,49 @@ public class ImportTaskService extends ServiceImpl<ImportTaskMapper, ImportTask>
         }
         }
 
 
     }
     }
+
+    public Integer addExportExcel(ExportTaskDTO exportTaskDTO){
+        if (exportTaskDTO == null) {
+            throw new XiaoShiException("入参不能为空");
+        }
+//        PersonnelVO personnelVO = new PersonnelVO();
+//        try {
+//            personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+//        } catch (Exception e) {
+//            throw new UnLoginException("未登录");
+//        }
+        ImportTaskCondition importTaskCondition = new ImportTaskCondition();
+        importTaskCondition.setFileGuid(exportTaskDTO.getFileGuid());
+        if (exportTaskDTO.getProjectId() != null) {
+            importTaskCondition.setProjectId(exportTaskDTO.getProjectId());
+        }
+        importTaskCondition.setIfUpdate(false);
+        importTaskCondition.setType(exportTaskDTO.getType());
+//        importTaskCondition.setCreateId(personnelVO.getId());
+        importTaskCondition.setCreateId("328");
+        importTaskCondition.insert();
+        Integer importTaskConditionId = importTaskCondition.getId();
+        if (importTaskConditionId != null) {
+            ImportTask importTask = new ImportTask();
+            importTask.setImportTaskConditionId(importTaskConditionId);
+            importTask.setType(exportTaskDTO.getType());
+            importTask.setAllNum(exportTaskDTO.getAllNum());
+            importTask.setDefaultNum(exportTaskDTO.getDefaultNum());
+            importTask.setFinishTime(exportTaskDTO.getFinishTime());
+            importTask.setCreateId("328");
+            String name = "";
+            if (exportTaskDTO.getType().equals(6)) {
+                name = "【专利】";
+            } else if (exportTaskDTO.getType().equals(7)){
+                name = "【PDF首页】";
+            }
+//            String importTaskName = "导出" + name + "-" + personnelVO.getName();
+            String importTaskName = "导出" + name + "-" + "朱豪";
+            importTask.setName(importTaskName);
+            importTask.insert();
+            return importTask.getId();
+        } else {
+            throw new XiaoShiException("导出任务记录失败");
+        }
+    }
 }
 }

+ 62 - 21
src/main/java/cn/cslg/pas/service/business/PatentExportService.java

@@ -1,18 +1,19 @@
 package cn.cslg.pas.service.business;
 package cn.cslg.pas.service.business;
 
 
-import cn.cslg.pas.common.core.base.Constants;
+import cn.cslg.pas.common.dto.ExportTaskDTO;
 import cn.cslg.pas.common.dto.PatentColumnDTO;
 import cn.cslg.pas.common.dto.PatentColumnDTO;
-import cn.cslg.pas.common.dto.PatentDTO;
 import cn.cslg.pas.common.dto.PatentExport.PatentExportVO;
 import cn.cslg.pas.common.dto.PatentExport.PatentExportVO;
-import cn.cslg.pas.common.dto.PatentExport.TaskParams;
-import cn.cslg.pas.common.model.request.QueryRequest;
 import cn.cslg.pas.common.utils.*;
 import cn.cslg.pas.common.utils.*;
-import cn.cslg.pas.common.vo.TaskWebSocketDTO;
+import cn.cslg.pas.common.vo.ConfigVOS.PatentConfigVO;
+import cn.cslg.pas.common.vo.WebSocketMessageVO;
 import cn.cslg.pas.common.vo.business.PatentNoVO;
 import cn.cslg.pas.common.vo.business.PatentNoVO;
 import cn.cslg.pas.common.vo.es.EsCustomFieldBatchVO;
 import cn.cslg.pas.common.vo.es.EsCustomFieldBatchVO;
 import cn.cslg.pas.exception.XiaoShiException;
 import cn.cslg.pas.exception.XiaoShiException;
+import cn.cslg.pas.factorys.PatentExportFactory.GetValueImp;
+import cn.cslg.pas.factorys.PatentExportFactory.PatentExportFactory;
 import cn.cslg.pas.service.business.es.EsPatentService;
 import cn.cslg.pas.service.business.es.EsPatentService;
-import cn.cslg.pas.service.business.es.EsService;
+import cn.cslg.pas.service.common.MessageService;
+import com.alibaba.fastjson.JSON;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.poi.hssf.usermodel.*;
 import org.apache.poi.hssf.usermodel.*;
 import org.apache.poi.hssf.util.HSSFColor;
 import org.apache.poi.hssf.util.HSSFColor;
@@ -20,6 +21,7 @@ import org.apache.poi.ss.usermodel.FillPatternType;
 import org.apache.poi.ss.usermodel.HorizontalAlignment;
 import org.apache.poi.ss.usermodel.HorizontalAlignment;
 import org.apache.poi.ss.usermodel.VerticalAlignment;
 import org.apache.poi.ss.usermodel.VerticalAlignment;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 import java.io.ByteArrayOutputStream;
 import java.io.ByteArrayOutputStream;
@@ -29,6 +31,7 @@ import java.util.*;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
 
 
 /**
 /**
+ * Excel导出专利
  * @Author xiexiang
  * @Author xiexiang
  * @Date 2024/1/3
  * @Date 2024/1/3
  */
  */
@@ -37,26 +40,32 @@ import java.util.stream.Collectors;
 public class PatentExportService {
 public class PatentExportService {
 
 
     @Autowired
     @Autowired
-    private FileUtils fileUtils;
+    private PDFExportFirstPageService pdfExportFirstPageService;
 
 
     @Autowired
     @Autowired
-    private EsService esService;
+    private EsPatentService patentService;
 
 
     @Autowired
     @Autowired
-    private PDFExportFirstPageService pdfExportFirstPageService;
+    private MessageService messageService;
 
 
     @Autowired
     @Autowired
-    private EsPatentService patentService;
+    private PatentExportFactory patentExportFactory;
 
 
+    @Autowired
+    private ParseByteToFileUtils parseByteToFileUtils;
 
 
+    @Autowired
+    private ImportTaskService importTaskService;
 
 
     /**
     /**
      * 导出专利
      * 导出专利
+     *
      * @param EsVO
      * @param EsVO
      * @return
      * @return
      * @throws IOException
      * @throws IOException
      */
      */
-    public byte[] exportPatent(EsCustomFieldBatchVO EsVO) throws IOException {
+    @Async
+    public void exportPatent(EsCustomFieldBatchVO EsVO) throws IOException {
         try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
         try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
             String esSelected = JsonUtils.objectToJson(EsVO.getSelected());
             String esSelected = JsonUtils.objectToJson(EsVO.getSelected());
             //selected字符串转PatentExportVO集合
             //selected字符串转PatentExportVO集合
@@ -101,25 +110,33 @@ public class PatentExportService {
             //根据projectId查询专利信息
             //根据projectId查询专利信息
             List<String> patentNos = pdfExportFirstPageService.getPatentNo(EsVO);
             List<String> patentNos = pdfExportFirstPageService.getPatentNo(EsVO);
             if (patentNos.isEmpty()) {
             if (patentNos.isEmpty()) {
-                return null;
+                throw new XiaoShiException("未获取到专利信息");
             }
             }
+            Integer total = patentNos.size();
+            Integer defaultNum = 0;
             for (int i = 0; i < patentNos.size(); i++) {
             for (int i = 0; i < patentNos.size(); i++) {
                 Map<String, Object> map = new LinkedHashMap<>();
                 Map<String, Object> map = new LinkedHashMap<>();
                 PatentNoVO patentNoVO = new PatentNoVO();
                 PatentNoVO patentNoVO = new PatentNoVO();
                 patentNoVO.setPatentNo(patentNos.get(i));
                 patentNoVO.setPatentNo(patentNos.get(i));
-
                 PatentColumnDTO patent = patentService.selectPatentDetail(patentNoVO);
                 PatentColumnDTO patent = patentService.selectPatentDetail(patentNoVO);
-
                 if (patent == null) {
                 if (patent == null) {
+                    defaultNum++;
                     continue;
                     continue;
                 }
                 }
-
                 for (int j = 0; j < columns.size(); j++) {
                 for (int j = 0; j < columns.size(); j++) {
                     String column = columns.get(j);
                     String column = columns.get(j);
                     PatentExportVO patentExportVO = selected.stream().filter(item -> item.getValue().equals(column)).findFirst().orElse(new PatentExportVO());
                     PatentExportVO patentExportVO = selected.stream().filter(item -> item.getValue().equals(column)).findFirst().orElse(new PatentExportVO());
                     // 使用反射获取属性值
                     // 使用反射获取属性值
                     Object value = GenerateObjectUtil.getPropertyValue(patent, patentExportVO.getValue());
                     Object value = GenerateObjectUtil.getPropertyValue(patent, patentExportVO.getValue());
-                    map.put(patentExportVO.getName(), value);
+                    if (value != null) {
+                        String json = CommonService.readJsonFile("patent.json");
+                        List<PatentConfigVO> patentConfigVOS = JSON.parseArray(json, PatentConfigVO.class);
+                        PatentConfigVO patentConfigVO = patentConfigVOS.stream().filter(item -> item.getValue().equals(column)).findFirst().orElse(null);
+                        String exportClass = patentConfigVO.getExportClass();
+                        GetValueImp getValueImp = patentExportFactory.getClass(exportClass);
+                        String reValue = getValueImp.getValue(value);
+                        map.put(patentExportVO.getName(), reValue);
+                    }
                 }
                 }
                 //新建一普通行
                 //新建一普通行
                 HSSFRow row = sheet.createRow(i + 1);
                 HSSFRow row = sheet.createRow(i + 1);
@@ -137,17 +154,41 @@ public class PatentExportService {
                         }
                         }
                     }
                     }
                 }
                 }
+                WebSocketMessageVO webSocketMessageVO =new WebSocketMessageVO();
+                webSocketMessageVO.setProjectId(EsVO.getProjectId());
+                webSocketMessageVO.setCreateId("328");
+                webSocketMessageVO.setCode(602);
+                webSocketMessageVO.setAllNum(total);
+                webSocketMessageVO.setCurrentNum(i+1);
+                webSocketMessageVO.setState(1);
+                messageService.sendPatentExportMessage(webSocketMessageVO);
             }
             }
             hssfWorkbook.write(out);
             hssfWorkbook.write(out);
-            return out.toByteArray();
-
+            WebSocketMessageVO webSocketMessageVO =new WebSocketMessageVO();
+            webSocketMessageVO.setProjectId(EsVO.getProjectId());
+            webSocketMessageVO.setCreateId("328");
+            webSocketMessageVO.setAllNum(total);
+            webSocketMessageVO.setCurrentNum(total);
+            webSocketMessageVO.setState(2);
+            messageService.sendPatentExportMessage(webSocketMessageVO);
+            String fileGuid = "";
+            if (out.toByteArray() != null && out.toByteArray().length != 0) {
+                fileGuid = parseByteToFileUtils.uploadFile(out.toByteArray());
+            }
+            ExportTaskDTO exportTaskDTO = new ExportTaskDTO();
+            exportTaskDTO.setProjectId(EsVO.getProjectId());
+            exportTaskDTO.setType(6);
+            exportTaskDTO.setFileGuid(fileGuid);
+            exportTaskDTO.setAllNum(total);
+            exportTaskDTO.setDefaultNum(defaultNum);
+            Integer taskId = importTaskService.addExportExcel(exportTaskDTO);
+            if (taskId == null) {
+                throw new XiaoShiException("导出记录失败");
+            }
         } catch (FileNotFoundException e) {
         } catch (FileNotFoundException e) {
             throw new FileNotFoundException();
             throw new FileNotFoundException();
         }
         }
     }
     }
 
 
 
 
-
-
-
 }
 }

+ 19 - 0
src/main/java/cn/cslg/pas/service/common/MessageService.java

@@ -89,4 +89,23 @@ public class MessageService {
             WebSocketServer.sendInfo(Response.websocket(taskWebSocketDTO, ResponseEnum.COMPARE_LITERATURE_BATCH), webSocketMessageVO.getCreateId());
             WebSocketServer.sendInfo(Response.websocket(taskWebSocketDTO, ResponseEnum.COMPARE_LITERATURE_BATCH), webSocketMessageVO.getCreateId());
 
 
     }
     }
+      //发送导出专利任务消息
+    public void sendPatentExportMessage(WebSocketMessageVO webSocketMessageVO) {
+        //通过WebSocket 在每一次循环结束后 向前端发送完成进度
+        //当任务状态为完成时,flag为true
+        long percentage = (long) Math.floor((webSocketMessageVO.getCurrentNum() + 0D) / webSocketMessageVO.getAllNum() * 100D);
+        boolean flag = webSocketMessageVO.getState().equals(2);
+
+        TaskWebSocketDTO taskWebSocketDTO = new TaskWebSocketDTO();
+        taskWebSocketDTO.setComplete(flag);
+        taskWebSocketDTO.setIndex(webSocketMessageVO.getCurrentNum());
+        taskWebSocketDTO.setPercentage(percentage);
+        if(flag) {
+            WebSocketServer.sendInfo(Response.websocket(taskWebSocketDTO, ResponseEnum.PATENT_EXPORT_TASK_DONE), webSocketMessageVO.getCreateId());
+        return;
+        }
+        WebSocketServer.sendInfo(Response.websocket(taskWebSocketDTO, ResponseEnum.PATENT_EXPORT_TASK), webSocketMessageVO.getCreateId());
+
+    }
+
 }
 }

+ 16 - 8
src/main/resources/jsons/patent.json

@@ -11,7 +11,8 @@
     "ifShow": "true",
     "ifShow": "true",
     "ifAsCondition": "true",
     "ifAsCondition": "true",
     "ifStats": "false",
     "ifStats": "false",
-    "groupBy": "number"
+    "groupBy": "number",
+    "exportClass": "getCommonValue"
   },
   },
   {
   {
     "name": "申请号",
     "name": "申请号",
@@ -25,7 +26,8 @@
     "ifShow": "true",
     "ifShow": "true",
     "ifAsCondition": "true",
     "ifAsCondition": "true",
     "ifStats": "false",
     "ifStats": "false",
-    "groupBy": "number"
+    "groupBy": "number",
+    "exportClass": "getCommonValue"
   },
   },
   {
   {
     "name": "公开号",
     "name": "公开号",
@@ -39,7 +41,8 @@
     "ifShow": "true",
     "ifShow": "true",
     "ifAsCondition": "true",
     "ifAsCondition": "true",
     "ifStats": "false",
     "ifStats": "false",
-    "groupBy": "number"
+    "groupBy": "number",
+    "exportClass": "getCommonValue"
   },
   },
   {
   {
     "name": "授权号",
     "name": "授权号",
@@ -53,7 +56,8 @@
     "ifShow": "true",
     "ifShow": "true",
     "ifAsCondition": "true",
     "ifAsCondition": "true",
     "ifStats": "false",
     "ifStats": "false",
-    "groupBy": "number"
+    "groupBy": "number",
+    "exportClass": "getCommonValue"
   },
   },
   {
   {
     "name": "公开日",
     "name": "公开日",
@@ -67,7 +71,8 @@
     "ifShow": "true",
     "ifShow": "true",
     "ifAsCondition": "true",
     "ifAsCondition": "true",
     "ifStats": "true",
     "ifStats": "true",
-    "groupBy": "dateType"
+    "groupBy": "dateType",
+    "exportClass": "getDateValue"
   },
   },
   {
   {
     "name": "申请日",
     "name": "申请日",
@@ -81,7 +86,8 @@
     "ifShow": "true",
     "ifShow": "true",
     "ifAsCondition": "true",
     "ifAsCondition": "true",
     "ifStats": "true",
     "ifStats": "true",
-    "groupBy": "dateType"
+    "groupBy": "dateType",
+    "exportClass": "getDateValue"
   },
   },
   {
   {
     "name": "授权日",
     "name": "授权日",
@@ -95,7 +101,8 @@
     "ifShow": "true",
     "ifShow": "true",
     "ifAsCondition": "true",
     "ifAsCondition": "true",
     "ifStats": "true",
     "ifStats": "true",
-    "groupBy": "dateType"
+    "groupBy": "dateType",
+    "exportClass": "getDateValue"
   },
   },
   {
   {
     "name": "项目id",
     "name": "项目id",
@@ -164,7 +171,8 @@
     "ifAsCondition": "true",
     "ifAsCondition": "true",
     "ifStats": "true",
     "ifStats": "true",
     "defaultShowStats": "true",
     "defaultShowStats": "true",
-    "groupBy": "company"
+    "groupBy": "company",
+    "exportClass": "getNameValue"
   },
   },
   {
   {
     "name": "标准申请人",
     "name": "标准申请人",