From 6c2e59c52365f40467cc6315d4a91042342685e3 Mon Sep 17 00:00:00 2001
From: sinake <sinake1@qq.com>
Date: 星期四, 21 五月 2026 15:33:10 +0800
Subject: [PATCH] 转运附件数据不对

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceEthicalreviewopinionsController.java |   73 +++++++++++++++++++++++++++++++-----
 1 files changed, 62 insertions(+), 11 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceEthicalreviewopinionsController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceEthicalreviewopinionsController.java
index a5abf64..41c248d 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceEthicalreviewopinionsController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceEthicalreviewopinionsController.java
@@ -36,6 +36,8 @@
 import org.springframework.web.bind.annotation.*;
 
 import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.URL;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -188,17 +190,17 @@
      */
     @ApiOperation("閬椾綋鍣ㄥ畼鑾峰彇浼︾悊瀹℃煡琛�")
     @GetMapping(value = "/download")
-    public Result downloadInfo(String initiateId) throws IOException {
-        if(ObjectUtils.isEmpty(initiateId)){
+    public Result downloadInfo(String nitiateId) throws IOException {
+        if(ObjectUtils.isEmpty(nitiateId)){
             return Result.error("nitiateId浼︾悊瀹℃煡id涓嶈兘涓虹┖");
         }
         EthicalReviewVO reviewVO =new EthicalReviewVO();
-        reviewVO.setNitiateId(initiateId);
+        reviewVO.setNitiateId(nitiateId);
         List<EthicalReviewVO> list = serviceEthicalreviewopinionsService.selectVOList(reviewVO);
         if(list.size()==0){
             return Result.error("浼︾悊瀹℃煡id鏃犵浉鍏虫暟鎹�");
         }
-        EthicalreviewopinionsStateTotalVO  stateTotalVO=serviceEthicalreviewopinionsService.stateTotalAll(initiateId);
+        EthicalreviewopinionsStateTotalVO  stateTotalVO=serviceEthicalreviewopinionsService.stateTotalAll(nitiateId);
         String filePath = getClass().getResource("/template/").getPath();
         if(filePath.substring(0,1).equals("/"))
             filePath=filePath.substring(1);
@@ -221,6 +223,57 @@
             String committeeOpinion="";
             for (EthicalReviewVO row:list) {
                 String State="",sgin="",id=row.getId()+"",expName=row.getExpertname();
+                if(ObjectUtils.isNotEmpty(row.getSigin())){
+//                    byte[] imageBytes = Files.readAllBytes(Paths.get(row.getSigin()));
+//                    sgin=Base64.getEncoder().encodeToString(imageBytes);
+                    HttpURLConnection connection = null;
+                    InputStream inputStream = null;
+                    ByteArrayOutputStream outputStream = null;
+                    try {
+                        URL url = new URL(row.getSigin());
+                        connection = (HttpURLConnection) url.openConnection();
+                        connection.setRequestMethod("GET");
+                        connection.setConnectTimeout(5000);
+                        connection.setReadTimeout(5000);
+
+                        if (connection.getResponseCode() != HttpURLConnection.HTTP_OK) {
+                            sgin="";
+                        }
+
+                        inputStream = connection.getInputStream();
+                        outputStream = new ByteArrayOutputStream();
+
+                        byte[] buffer = new byte[1024];
+                        int bytesRead;
+                        while ((bytesRead = inputStream.read(buffer)) != -1) {
+                            outputStream.write(buffer, 0, bytesRead);
+                        }
+
+                        byte[] imageBytes = outputStream.toByteArray();
+                        sgin= Base64.getEncoder().encodeToString(imageBytes);
+                    }catch (Exception e){
+                        sgin="";
+                    }finally {
+                        if (inputStream != null) {
+                            try {
+                                inputStream.close();
+                            } catch (IOException e) {
+
+                            }
+                        }
+                        if (outputStream != null) {
+                            try {
+                                outputStream.close();
+                            } catch (IOException e) {
+
+                            }
+                        }
+                        if (connection != null) {
+                            connection.disconnect();
+                        }
+                    }
+
+                }
                 if(expName.length()==2) expName=expName.substring(0,1)+"  "+expName.substring(1);
                 if(row.getReceiveStatus().equals("1"))State="宸插悓鎰�";
                 else if(row.getReceiveStatus().equals("2")) State="涓嶅悓鎰�";
@@ -234,7 +287,7 @@
                         "            <w:tc><w:tcPr></w:tcPr>\n" +
                         "                <w:p wsp:rsidR=\"00425E28\" wsp:rsidRPr=\"00CB3FB5\" wsp:rsidRDefault=\"00AC7CCA\" wsp:rsidP=\"00CB3FB5\">\n" +
                         "                    <w:r wsp:rsidRPr=\"00737357\">\n" +
-                        "                        <w:t>銆愬鍛樺鎵广��"+expName+"  "+State+" </w:t></w:r>\n" +
+                        "                        <w:spacing w:line=\"480\" w:line-rule=\"auto\"/><w:t>銆愬鍛樺鎵广��"+expName+"  "+State+" </w:t></w:r>\n" +
                         "                   </w:p>\n" +
                         "            </w:tc>\n" +
                         "            <w:tc><w:tcPr></w:tcPr>\n" +
@@ -243,17 +296,15 @@
                         "                        <w:t>绛惧悕锛�</w:t></w:r>\n" +
                         "                    <w:r wsp:rsidR=\"00421BE1\">\n" ;
                         if(sgin.length()>10) {
-                            committeeOpinion +=  "                        <w:pict>\n" +
-                                    "                        <w:binData w:name=\"wordml://03000001.png\" xml:space=\"preserve\"> " + sgin + "</w:binData>\n" +
-                                    "                            <v:shape style=\"width:50pt;height:20pt\"><v:imagedata src=\"wordml://03000001.png\" o:title=\"my绛惧瓧\"/></v:shape>\n" +
-                                    "                        </w:pict>\n" ;
+                            committeeOpinion +="<w:pict><w:binData w:name=\"wordml://03000001.png\" xml:space=\"preserve\">\n" + sgin + "\n" +
+                                    "</w:binData><v:shape  style=\"width:50pt;height:20pt\"><v:imagedata src=\"wordml://03000001.png\" o:title=\"\"/></v:shape></w:pict>\n" ;
                         }
                 committeeOpinion += "                    </w:r>\n" +
                         "                </w:p>\n" +
                         "            </w:tc>\n" +
                         "            <w:tc><w:tcPr></w:tcPr>\n" +
                         "                <w:p wsp:rsidR=\"00425E28\" wsp:rsidRPr=\"00CB3FB5\" wsp:rsidRDefault=\"00AC7CCA\" wsp:rsidP=\"00CB3FB5\">\n" +
-                        "                    <w:r wsp:rsidRPr=\"00737357\"><w:t>"+DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",row.getConclusiontime())+"</w:t></w:r></w:p>\n" +
+                        "                    <w:spacing w:line=\"480\" w:line-rule=\"auto\"/><w:r wsp:rsidRPr=\"00737357\"><w:t>"+DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",row.getConclusiontime())+"</w:t></w:r></w:p>\n" +
                         "            </w:tc>\n" +
                         "        </w:tr>";
                }
@@ -264,7 +315,7 @@
             e.printStackTrace();
         }
         String newTime = String.valueOf(Calendar.getInstance().getTimeInMillis());
-        String name = "閬椾綋鍣ㄥ畼鑾峰彇浼︾悊瀹℃煡琛╛"+initiateId+"_" +  newTime;
+        String name = "閬椾綋鍣ㄥ畼鑾峰彇浼︾悊瀹℃煡琛╛"+nitiateId+"_" +  newTime;
 
         String filePathData =RuoYiConfig.getProfile() + "/download/wordtemplate";
         //鍒涘缓鏂囦欢澶�

--
Gitblit v1.9.3