Browse Source

20250922-生成专利申请文档

lrj 1 month ago
parent
commit
6a3cd06c01

+ 1 - 1
src/main/java/cn/cslg/pas/common/core/base/Constants.java

@@ -49,7 +49,7 @@ public class Constants {
     public static final Integer PATENT_CLASS_NUMBER_CPC = 2;
     public static final Integer PATENT_CLASS_NUMBER_UPC = 3;
     public static final Integer PATENT_CLASS_NUMBER_LOC = 4;
-    public static final Integer MAX_IMPORT_TASK_COUNT=2;
+    public static final Integer MAX_IMPORT_TASK_COUNT=5;
     public static final  Integer IMPORT_PATENT_TO=1;
     public static final String   IMPORT_TASK_CONFIG="importTaskConfig";
     /**

+ 1 - 0
src/main/java/cn/cslg/pas/common/model/dify/GenerateInstructAnswerVO.java

@@ -15,4 +15,5 @@ public class GenerateInstructAnswerVO {
     private List<ImplementationMessage> implementations;
     private List<String> answers;
     private List<String> claimList;
+    private List<ClaimExplainVO> claimExplainVOs;
 }

+ 53 - 0
src/main/java/cn/cslg/pas/common/utils/commonUtils/PictureUtils.java

@@ -0,0 +1,53 @@
+package cn.cslg.pas.common.utils.commonUtils;
+
+import org.apache.poi.hemf.usermodel.HemfPicture;
+import org.apache.poi.util.Units;
+
+import javax.imageio.ImageIO;
+import java.awt.*;
+import java.awt.geom.Dimension2D;
+import java.awt.geom.Rectangle2D;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.FileInputStream;
+
+public class PictureUtils {
+    public static File convertEmfToPng(File inputEmf, File outputPng) throws Exception {
+        try (FileInputStream fis = new FileInputStream(inputEmf)) {
+            // 1. 使用POI的HemfPicture解析EMF文件
+            HemfPicture emf = new HemfPicture(fis);
+
+            // 2. 获取EMF图片的原始尺寸(单位为点)
+            Dimension2D dim = emf.getSize();
+            int width = Units.pointsToPixel(dim.getWidth()); // 将点转换为像素
+            int height = Units.pointsToPixel(dim.getHeight());
+
+            // 3. (可选) 调整输出图片大小,例如限制最大边长
+            double max = Math.max(width, height);
+            if (max > 1500) {
+                width *= 1500 / max;
+                height *= 1500 / max;
+            }
+
+            // 4. 创建BufferedImage,并设置渲染提示以提高质量
+            BufferedImage bufImg = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
+            Graphics2D g = bufImg.createGraphics();
+            // 设置一系列渲染提示,使转换后的图片更平滑清晰
+            g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+            g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
+            g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
+            g.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
+
+            // 5. 将EMF图片绘制到BufferedImage上
+            emf.draw(g, new Rectangle2D.Double(0, 0, width, height));
+            g.dispose();
+
+            // 6. 保存为PNG
+            ImageIO.write(bufImg, "PNG", outputPng);
+
+            inputEmf.delete();
+            return outputPng;
+        }
+    }
+
+}

+ 132 - 0
src/main/java/cn/cslg/pas/service/common/WordService.java

@@ -0,0 +1,132 @@
+package cn.cslg.pas.service.common;
+
+import cn.cslg.pas.common.utils.commonUtils.PictureUtils;
+import org.apache.poi.hwpf.HWPFDocument;
+import org.apache.poi.hwpf.extractor.WordExtractor;
+import org.apache.poi.hwpf.model.PicturesTable;
+import org.apache.poi.hwpf.usermodel.Picture;
+import org.apache.poi.xwpf.usermodel.XWPFComment;
+import org.apache.poi.xwpf.usermodel.XWPFDocument;
+import org.apache.poi.xwpf.usermodel.XWPFPictureData;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.UUID;
+
+@Service
+public class WordService {
+    private static final List<String> images = Arrays.asList("png", "jpeg", "gif", "jpg", "webp", "svg");
+
+    public String getDocxComments(MultipartFile multipartFile) {
+        StringBuilder stringBuilder = new StringBuilder();
+        try (InputStream fis = multipartFile.getInputStream();
+             XWPFDocument document = new XWPFDocument(fis)) {
+
+            // 获取文档中的所有批注
+            XWPFComment[] comments = document.getComments();
+            if (comments != null && comments.length > 0) {
+                for (XWPFComment comment : comments) {
+                    // 提取批注信息
+                    String author = comment.getAuthor();
+                    String text = comment.getText(); // 获取批注文本内容
+                    String id = comment.getId(); // 获取批注ID
+                    stringBuilder.append(text);
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return stringBuilder.toString();
+    }
+
+    public String getDocComments(MultipartFile multipartFile) {
+        StringBuilder stringBuilder = new StringBuilder();
+        try (InputStream fis = multipartFile.getInputStream();
+             WordExtractor extractor = new WordExtractor(fis)) {
+
+            // 尝试提取批注文本
+            String[] comments = extractor.getCommentsText();
+            if (comments != null) {
+                for (String comment : comments) {
+                    stringBuilder.append(comment);
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return stringBuilder.toString();
+    }
+
+    public List<File> getDocxPictures(InputStream fis) {
+        List<File> files = new ArrayList<>();
+        try (
+                XWPFDocument document = new XWPFDocument(fis)) {
+// 获取所有图片数据
+            List<XWPFPictureData> pictures = document.getAllPictures();
+            int imageIndex = 1;
+            for (XWPFPictureData picture : pictures) {
+                String suggestFileExtension = picture.suggestFileExtension();
+                if (!images.contains(suggestFileExtension)) {
+                    suggestFileExtension = "png";
+
+                }
+// 获取图片数据和文件名
+                byte[] bytes = picture.getData();
+                String fileName = UUID.randomUUID() + "_" + imageIndex + "." + suggestFileExtension;
+                File file = new File(fileName);
+// 保存图片到本地
+                try (FileOutputStream fos = new FileOutputStream(file)) {
+                    fos.write(bytes);
+
+                }
+                files.add(file);
+                imageIndex++;
+            }
+            document.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return files;
+    }
+
+    public List<File> getDocPictures(InputStream fis) throws IOException {
+        String picStr = "";
+        List<File> files = new ArrayList<>();
+        HWPFDocument doc = null;
+        try {
+            doc = new HWPFDocument(fis);
+// 获取所有图片数据
+            int length = doc.characterLength();
+            PicturesTable pTable = doc.getPicturesTable();
+            for (Picture picture : pTable.getAllPictures()) {
+                String suggestFileExtension = picture.suggestFileExtension();
+                String fileName = "image." + suggestFileExtension;
+                File file = new File(UUID.randomUUID() + fileName);
+
+                OutputStream out = new FileOutputStream(file);
+                picture.writeImageContent(out);
+
+                if (!images.contains(suggestFileExtension)) {
+                    File newFile = new File(UUID.randomUUID() + ".png");
+                    if (suggestFileExtension.equals("emf")) {
+                        file = PictureUtils.convertEmfToPng(file, newFile);
+                    }
+                }
+                files.add(file);
+
+
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            doc.close();
+        }
+        return files;
+    }
+
+}

+ 28 - 0
src/main/java/cn/cslg/pas/service/dify/AssoConfessionSessionFileService.java

@@ -2,12 +2,16 @@ package cn.cslg.pas.service.dify;
 
 import cn.cslg.pas.domain.dify.AssoConfessionSessionFile;
 import cn.cslg.pas.mapper.dify.AssoConfessionSessionFileMapper;
+import cn.cslg.pas.service.common.FileManagerService;
 import cn.cslg.pas.service.quartzService.QuartzVO;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.RequiredArgsConstructor;
+import org.checkerframework.checker.units.qual.A;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.io.File;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -15,6 +19,8 @@ import java.util.stream.Collectors;
 @Service
 @RequiredArgsConstructor
 public class AssoConfessionSessionFileService extends ServiceImpl<AssoConfessionSessionFileMapper, AssoConfessionSessionFile> {
+    @Autowired
+    private FileManagerService fileManagerService;
 
     public List<String> getFileGuid(Integer confessionSessionId, Integer type) {
         LambdaQueryWrapper<AssoConfessionSessionFile> queryWrapper = new LambdaQueryWrapper<>();
@@ -46,4 +52,26 @@ public class AssoConfessionSessionFileService extends ServiceImpl<AssoConfession
         }
         return assoConfessionSessionFile;
     }
+
+
+    public List<AssoConfessionSessionFile> addDiscoveryPictures(List<File> files, Integer confessionSessionId) throws Exception {
+        Integer type = 2;
+        List<AssoConfessionSessionFile> assoConfessionSessionFiles = new ArrayList<>();
+        if (files == null || files.size() == 0) {
+            return assoConfessionSessionFiles;
+        }
+        List<String> guids = fileManagerService.uploadFileGetGuid2(files);
+        if (guids == null || guids.size() == 0) {
+            return assoConfessionSessionFiles;
+        }
+        guids.forEach(item -> {
+            AssoConfessionSessionFile assoConfessionSessionFile = new AssoConfessionSessionFile();
+            assoConfessionSessionFile.setConfessionSessionId(confessionSessionId);
+            assoConfessionSessionFile.setType(type);
+            assoConfessionSessionFile.setGuid(item);
+            assoConfessionSessionFiles.add(assoConfessionSessionFile);
+        });
+        this.saveBatch(assoConfessionSessionFiles);
+        return assoConfessionSessionFiles;
+    }
 }

+ 27 - 0
src/main/java/cn/cslg/pas/service/dify/GenerateDiscoveryResultService.java

@@ -6,13 +6,20 @@ import cn.cslg.pas.common.model.dify.generateDiscoveryResult.DiscoryResultVO;
 import cn.cslg.pas.common.utils.LoginUtils;
 import cn.cslg.pas.domain.dify.ConfessionSession;
 import cn.cslg.pas.service.common.DifyService;
+import cn.cslg.pas.service.common.FileManagerService;
+import cn.cslg.pas.service.common.WordService;
 import com.alibaba.fastjson2.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 @Service
@@ -27,6 +34,10 @@ public class GenerateDiscoveryResultService {
     private LoginUtils loginUtils;
     @Value("${DIFY.discoveryResultKey}")
     private String discoveryResultKey;
+    @Autowired
+    private FileManagerService fileManagerService;
+    @Autowired
+    private WordService wordService;
     public DiscoryResultVO generateResult(ChatMessageDTO chatMessageDTO) throws Exception {
         DiscoryResultVO discoryResultVO = null;
         Integer confessionSessionId = chatMessageDTO.getConfessionSessionId();
@@ -71,7 +82,23 @@ public class GenerateDiscoveryResultService {
         LambdaUpdateWrapper<ConfessionSession> updateWrapper = new LambdaUpdateWrapper<>();
         updateWrapper.set(ConfessionSession::getResultContent, answer).eq(ConfessionSession::getId, confessionSessionId);
         confessionSessionService.update(updateWrapper);
+
+
         return discoryResultVO;
 
     }
+    private  void addDiscoveryPictures(String fileId) throws Exception{
+       File file= fileManagerService.getOrgTempFileByGuid(fileId);
+        //保存交底书附图
+        List<File> fileList =new ArrayList<>();
+        try {
+            InputStream inputStream =new FileInputStream(file);
+        }
+        catch (Exception e){
+            e.printStackTrace();
+        }finally {
+            fileList.forEach(item->item.delete());
+            file.delete();
+        }
+    }
 }

+ 56 - 61
src/main/java/cn/cslg/pas/service/dify/GenerateInstructionService.java

@@ -162,7 +162,7 @@ public class GenerateInstructionService {
             mainClaimStr = StringUtils.join(reMainPatentClaims, "\n");
         }
         String mainClaim = mainClaimStr;
-        String claimStrs= StringUtils.join(reMainPatentClaims,"\n");
+        String claimStrs = StringUtils.join(reMainPatentClaims, "\n");
         return Flux.create(emitter -> {
             new Thread(() -> {
                 try {
@@ -170,15 +170,30 @@ public class GenerateInstructionService {
                     //;流程开始
                     String startMess = getFluxMessage("", ALL_START, "");
                     emitter.next(startMess);
-
+                    String conversionId = "";
+                    String title = "";
                     //生成标题和技术领域
-                    GenerateInstructAnswerVO generateInstructAnswerVO = this.genrateTechcialAndTitle(userId, emitter, mainClaim, background, filePath,claimStrs);
-                    String conversionId = generateInstructAnswerVO.getConversionId();
-                    String title = generateInstructAnswerVO.getTitle();
+                    GenerateInstructAnswerVO generateInstructAnswerVO = this.genrateTechcialAndTitle(userId, emitter, mainClaim, background, filePath, claimStrs);
+                    conversionId = generateInstructAnswerVO.getConversionId();
+                    title = generateInstructAnswerVO.getTitle();
                     String technical = generateInstructAnswerVO.getTechnical();
                     map.put("title", title);
                     map.put("conversionId", conversionId);
                     map.put("technical", technical);
+                    //生成具体实施方式
+                    GenerateInstructAnswerVO generateInstructAnswerVO2 = this.generateImplementation(userId, emitter, background, conversionId, rePatentClaims);
+                    map.put("implementation", generateInstructAnswerVO2.getImplementations());
+
+                    List<ClaimExplainVO> claimExplainVOS = generateInstructAnswerVO2.getClaimExplainVOs();
+                    conversionId = generateInstructAnswerVO2.getConversionId();
+                    //生成发明内容
+                    String startMessage = getFluxMessage(FIELD_CONTENT, START, "");
+                    emitter.next(startMessage);
+
+                    GenerateInstructAnswerVO generateInstructAnswerVO3 = this.generateContent(userId, emitter, rePatentClaims, claimExplainVOS, conversionId, title);
+                    List<String> formClaimList = generateInstructAnswerVO3.getClaimList();
+                    map.put("content", generateInstructAnswerVO3.getAnswers());
+
                     //生成背景技术
                     GenerateInstructAnswerVO generateInstructAnswerVO4 = this.generateBackGround(emitter, background);
                     map.put("background", generateInstructAnswerVO4.getAnswers());
@@ -189,17 +204,6 @@ public class GenerateInstructionService {
                     confessionSession.setConversationId(conversionId);
                     confessionSession.updateById();
 
-                    //生成发明内容
-                    String startMessage = getFluxMessage(FIELD_CONTENT, START, "");
-                    emitter.next(startMessage);
-                    ClaimExplainVO claimExplainVO = this.getFirstImplementation(userId, rePatentClaims.get(0), background, conversionId);
-                    GenerateInstructAnswerVO generateInstructAnswerVO3 = this.generateContent(userId, emitter, rePatentClaims, claimExplainVO, conversionId, title);
-                    List<String> formClaimList = generateInstructAnswerVO3.getClaimList();
-                    map.put("content", generateInstructAnswerVO3.getAnswers());
-                    //生成具体实施方式
-                    GenerateInstructAnswerVO generateInstructAnswerVO2 = this.generateImplementation(userId, emitter, claimExplainVO, background, conversionId, rePatentClaims, formClaimList);
-                    map.put("implementation", generateInstructAnswerVO2.getImplementations());
-
                     //生成文档
                     String fileGuid = this.generateFile(map, templateFilePath, name);
                     AssoConfessionSessionFile assoConfessionSessionFile = new AssoConfessionSessionFile();
@@ -251,7 +255,7 @@ public class GenerateInstructionService {
      * @return
      * @throws Exception
      */
-    public GenerateInstructAnswerVO genrateTechcialAndTitle(Integer userId, FluxSink fluxSink, String mainClaim, String background, String filePath,String claimStrs) throws Exception {
+    public GenerateInstructAnswerVO genrateTechcialAndTitle(Integer userId, FluxSink fluxSink, String mainClaim, String background, String filePath, String claimStrs) throws Exception {
         GenerateInstructAnswerVO generateInstructAnswerVO = null;
         GenerateTechnicalVO generateTechnicalVO = null;
         String startMessage = getFluxMessage(FIELD_TITLE, START, "");
@@ -334,59 +338,52 @@ public class GenerateInstructionService {
      * 生成权要的具体实施方式
      *
      * @param fluxSink
-     * @param firstClaimExplainVO
      * @param background
      * @param conversationId
      * @param rePatentClaims
      * @return
      * @throws Exception
      */
-    public GenerateInstructAnswerVO generateImplementation(Integer userId, FluxSink fluxSink, ClaimExplainVO firstClaimExplainVO, String background, String conversationId, List<RePatentClaim> rePatentClaims, List<String> formClaims) throws Exception {
+    public GenerateInstructAnswerVO generateImplementation(Integer userId, FluxSink fluxSink, String background, String conversationId, List<RePatentClaim> rePatentClaims) throws Exception {
         String startMessage = getFluxMessage(FIELD_IMPLEMENTATION, START, "");
         fluxSink.next(startMessage);
         GenerateInstructAnswerVO mainVO = new GenerateInstructAnswerVO();
         List<ImplementationMessage> implementationMessages = new ArrayList<>();
 
-
+        List<ClaimExplainVO> claimExplainVOS = new ArrayList<>();
         for (int i = 0; i < rePatentClaims.size(); i++) {
             RePatentClaim rePatentClaim = rePatentClaims.get(i);
-            String formClaim = "";
-            if (formClaims.size() >= i + 1) {
-                formClaim = formClaims.get(i);
-            }
-            ClaimExplainVO claimExplainVO = null;
-            if (i == 0) {
-                claimExplainVO = firstClaimExplainVO;
-            } else {
-                try {
 
-                    String claimContent = rePatentClaim.getContent();
-                    GetInstructAnswerDTO getInstructAnswerDTO = new GetInstructAnswerDTO();
-                    getInstructAnswerDTO.setClaim(claimContent);
-                    getInstructAnswerDTO.setBackground(background);
-                    getInstructAnswerDTO.setIndex(i);
-                    getInstructAnswerDTO.setType("g&implementation");
-                    getInstructAnswerDTO.setConversationId(conversationId);
-                    getInstructAnswerDTO.setUserId(userId);
-                    GenerateInstructAnswerVO generateInstructAnswerVO = this.getAnswerVO(getInstructAnswerDTO);
-                    String answer = generateInstructAnswerVO.getAnswer();
-                    if (generateInstructAnswerVO.getConversionId() != null) {
-                        mainVO.setConversionId(generateInstructAnswerVO.getConversionId());
-                    }
+            ClaimExplainVO claimExplainVO = null;
 
-                    claimExplainVO = JSONObject.parseObject(answer, ClaimExplainVO.class);
+            try {
+
+                String claimContent = rePatentClaim.getContent();
+                GetInstructAnswerDTO getInstructAnswerDTO = new GetInstructAnswerDTO();
+                getInstructAnswerDTO.setClaim(claimContent);
+                getInstructAnswerDTO.setBackground(background);
+                getInstructAnswerDTO.setIndex(i);
+                getInstructAnswerDTO.setType("g&implementation");
+                getInstructAnswerDTO.setConversationId(conversationId);
+                getInstructAnswerDTO.setUserId(userId);
+                GenerateInstructAnswerVO generateInstructAnswerVO = this.getAnswerVO(getInstructAnswerDTO);
+                String answer = generateInstructAnswerVO.getAnswer();
+                if (generateInstructAnswerVO.getConversionId() != null) {
+                    mainVO.setConversionId(generateInstructAnswerVO.getConversionId());
+                }
 
+                claimExplainVO = JSONObject.parseObject(answer, ClaimExplainVO.class);
 
-                } catch (Exception e) {
-                    e.printStackTrace();
-                }
 
+            } catch (Exception e) {
+                e.printStackTrace();
             }
 
+
             String message = "";
             String reStr = null;
             if (claimExplainVO != null) {
-                ImplementationMessage implementationMessage = this.formatImplementation(claimExplainVO, rePatentClaim, formClaim);
+                ImplementationMessage implementationMessage = this.formatImplementation(claimExplainVO, rePatentClaim);
                 implementationMessages.add(implementationMessage);
                 if (implementationMessage != null) {
                     reStr = implementationMessage.getClaimStr() + "\n" + implementationMessage.getExplain() + "\n" + implementationMessage.getEffect();
@@ -395,15 +392,17 @@ public class GenerateInstructionService {
                     reStr = "\n" + reStr;
                 }
                 message = getFluxMessage(FIELD_IMPLEMENTATION, MESSAGE, reStr);
+
             } else {
                 message = getFluxMessage(FIELD_IMPLEMENTATION, MESSAGE, "生成权要" + (i + 1) + "的具体实施方式异常");
 
             }
+            claimExplainVOS.add(claimExplainVO);
             fluxSink.next(message);
 
 
         }
-
+        mainVO.setClaimExplainVOs(claimExplainVOS);
         mainVO.setImplementations(implementationMessages);
         String endMessage = getFluxMessage(FIELD_IMPLEMENTATION, END, "");
         fluxSink.next(endMessage);
@@ -416,9 +415,9 @@ public class GenerateInstructionService {
      * @param claimExplainVO
      * @return
      */
-    private ImplementationMessage formatImplementation(ClaimExplainVO claimExplainVO, RePatentClaim rePatentClaim, String formClaim) {
+    private ImplementationMessage formatImplementation(ClaimExplainVO claimExplainVO, RePatentClaim rePatentClaim) {
         ImplementationMessage implementationMessage = new ImplementationMessage();
-        String explainVOClaim = formClaim;
+        String explainVOClaim = claimExplainVO.getClaim();
         String effect = claimExplainVO.getEffects();
         String explain = claimExplainVO.getExplain();
         if (explainVOClaim != null && !explainVOClaim.trim().equals("")) {
@@ -531,10 +530,11 @@ public class GenerateInstructionService {
      * @param rePatentClaims
      * @return
      */
-    public GenerateInstructAnswerVO generateContent(Integer userId, FluxSink fluxSink, List<RePatentClaim> rePatentClaims, ClaimExplainVO claimExplainVO, String conversationId, String title) throws Exception {
+    public GenerateInstructAnswerVO generateContent(Integer userId, FluxSink fluxSink, List<RePatentClaim> rePatentClaims, List<ClaimExplainVO> claimExplainVOs, String conversationId, String title) throws Exception {
         GenerateInstructAnswerVO generateInstructAnswerVO = new GenerateInstructAnswerVO();
         List<String> formClaims = new ArrayList<>();
         List<String> contentStrs = new ArrayList<>();
+        ClaimExplainVO firstClaimExplainVO = claimExplainVOs.get(0);
         List<String> claimStrsList = rePatentClaims.stream().map(RePatentClaim::getContent).collect(Collectors.toList());
         GetInstructAnswerDTO getInstructAnswerDTO = new GetInstructAnswerDTO();
         getInstructAnswerDTO.setConversationId(conversationId);
@@ -542,7 +542,7 @@ public class GenerateInstructionService {
         GenerateInstructAnswerVO generateInstructAnswerVO2 = new GenerateInstructAnswerVO();
 
         //发送说明书内容第一段信息
-        getInstructAnswerDTO.setEffects(claimExplainVO.getEffects());
+        getInstructAnswerDTO.setEffects(firstClaimExplainVO.getEffects());
         getInstructAnswerDTO.setType("g&re_effect");
         getInstructAnswerDTO.setUserId(userId);
         generateInstructAnswerVO2 = this.getAnswerVO(getInstructAnswerDTO);
@@ -555,13 +555,8 @@ public class GenerateInstructionService {
         fluxSink.next(message);
         Integer mainClaimFlag = 0;
         for (int i = 0; i < claimStrsList.size(); i++) {
-            getInstructAnswerDTO.setType("g&content");
-            String claimStr = claimStrsList.get(i);
-            getInstructAnswerDTO.setClaim(claimStr);
-            generateInstructAnswerVO2 = this.getAnswerVO(getInstructAnswerDTO);
-            String answer1 = generateInstructAnswerVO2.getAnswer();
-            GenerateContentVO generateTechnicalVO1 = JSONObject.parseObject(answer1, GenerateContentVO.class);
-            String claim = generateTechnicalVO1.getClaim();
+            ClaimExplainVO claimExplainVO = claimExplainVOs.get(i);
+            String claim = claimExplainVO.getClaim();
             formClaims.add(claim);
             RePatentClaim rePatentClaim = rePatentClaims.get(i);
             String temContent = "";
@@ -577,8 +572,8 @@ public class GenerateInstructionService {
         }
 
 
-        if (claimExplainVO != null) {
-            String temContent = "有益效果是:" + claimExplainVO.getEffects();
+        if (firstClaimExplainVO != null) {
+            String temContent = "有益效果是:" + firstClaimExplainVO.getEffects();
             contentStrs.add(temContent);
             message = getFluxMessage(FIELD_CONTENT, MESSAGE, "\n" + temContent);
             fluxSink.next(message);

+ 0 - 1
src/main/java/cn/cslg/pas/service/importPatent/TaskThread.java

@@ -146,7 +146,6 @@ catch (Exception e){
             task.setDoneNum(this.patentProcess.getPatentDoneNum());
         }
 
-
         importTaskAMVO.setDoneNum(this.patentProcess.getPatentDoneNum());
         task.updateById();
         MessageService messageService = applicationContext.getBean(MessageService.class);

+ 1 - 1
src/main/resources/application-dev.yml

@@ -92,7 +92,7 @@ DIFY:
   checkApiKey: aa
   cliamKey: app-jF3akhYKgljPLdpeIpTNbs6f
 #  gInstructionKey: app-7ImBmlr7kvBTSvBj1mTvgKyp
-  gInstructionKey: app-HuhT7taopBI3fnxdB6Hgq7ov
+  gInstructionKey: app-7ImBmlr7kvBTSvBj1mTvgKyp
   discoveryResultKey: app-G5gnZ4s7GlMEIft79fk7hUR7
   aiPatentResultKey: app-KLneZ6O7qXL2DjKm169ltxJI
   url: http://192.168.2.24/v1/