xiaochan vor 3 Monaten
Ursprung
Commit
323723a89f

+ 0 - 6
pom.xml

@@ -216,12 +216,6 @@
             <version>0.2.2</version>
         </dependency>
 
-        <!-- https://mvnrepository.com/artifact/com.dameng/DmJdbcDriver18 -->
-        <dependency>
-            <groupId>com.dameng</groupId>
-            <artifactId>DmJdbcDriver18</artifactId>
-            <version>8.1.3.140</version>
-        </dependency>
 
         <dependency>
             <groupId>org.springframework.boot</groupId>

+ 72 - 0
src/main/java/thyyxxk/webserver/service/archive/ArchiveServer.java

@@ -2,6 +2,7 @@ package thyyxxk.webserver.service.archive;
 
 import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.format.FastDateFormat;
+import cn.hutool.core.io.FileUtil;
 import cn.hutool.crypto.asymmetric.KeyType;
 import cn.hutool.crypto.asymmetric.RSA;
 import com.alibaba.fastjson.JSONObject;
@@ -9,6 +10,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.dtflys.forest.Forest;
 import com.dtflys.forest.http.ForestRequest;
 import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.web.multipart.MultipartFile;
@@ -22,9 +24,14 @@ import thyyxxk.webserver.service.externalhttp.WebSocketService;
 import thyyxxk.webserver.service.redislike.RedisLikeService;
 import thyyxxk.webserver.utils.*;
 
+import javax.annotation.PostConstruct;
 import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
+@Slf4j
 @Service
 public class ArchiveServer {
     private static ArchiveConfig archiveData;
@@ -221,5 +228,70 @@ public class ArchiveServer {
         }
     }
 
+    public UploadResult uploadFileByStr(String data, String path, boolean isTest, String userCode) {
+        JSONObject execute;
+
+        Map<String, Object> body = new HashMap<>();
+        body.put("data", data);
+        body.put("path", path);
+        body.put("isTest", isTest);
+
+        try {
+            execute = sendApi("/uploadByStr", userCode)
+                    .addHeader("content-type", "application/json")
+                    .addBody(body)
+                    .execute(JSONObject.class);
+        } catch (Exception e) {
+            throw new BizException(ExceptionEnum.LOGICAL_ERROR, "上传文件错误:" + e.getMessage());
+        }
+        Integer code = execute.getInteger("code");
+
+        if (ExceptionEnum.SUCCESS.getCode() != code) {
+            throw new BizException(ExceptionEnum.LOGICAL_ERROR, "上传文件错误:" + execute.getString("message"));
+        }
+        return execute.getObject("data", UploadResult.class);
+    }
+
+
+    public UploadResult uploadFileByStr(String data, String path, boolean isTest) {
+        return uploadFileByStr(data, path, isTest, null);
+    }
+
+    public UploadResult uploadFileByStr(String data, String path) {
+        return uploadFileByStr(data, path, !isProd, null);
+    }
+
+    public UploadResult uploadFileByBytes(byte[] data, String path, boolean isTest, String userCode) {
+        JSONObject execute;
+
+        Map<String, Object> body = new HashMap<>();
+        body.put("data", data);
+        body.put("path", path);
+        body.put("isTest", isTest);
+
+        try {
+            execute = sendApi("/uploadByByte", userCode)
+                    .addHeader("content-type", "application/json")
+                    .addBody(body)
+                    .execute(JSONObject.class);
+        } catch (Exception e) {
+            throw new BizException(ExceptionEnum.LOGICAL_ERROR, "上传文件错误:" + e.getMessage());
+        }
+        Integer code = execute.getInteger("code");
+
+        if (ExceptionEnum.SUCCESS.getCode() != code) {
+            throw new BizException(ExceptionEnum.LOGICAL_ERROR, "上传文件错误:" + execute.getString("message"));
+        }
+        return execute.getObject("data", UploadResult.class);
+    }
+
+    public UploadResult uploadFileByBytes(byte[] data, String path, boolean isTest) {
+        return uploadFileByBytes(data, path, isTest, null);
+    }
+
+    public UploadResult uploadFileByBytes(byte[] data, String path) {
+        return uploadFileByBytes(data, path, !isProd, null);
+    }
+
 }
 

+ 1 - 2
src/main/java/thyyxxk/webserver/service/ca/CaServer.java

@@ -604,7 +604,6 @@ public class CaServer implements Assertion {
      * @return
      */
     public JSONObject hBoardSignReturnUrl(String document, JSONObject data) {
-        // TODO 完成一定手写板签名的时候,需要保存一下PDF
         log.info("回调:{},数据:{}", document, data);
         EmrPatientData emrData = emrPatientDao.selectById(document);
         String redisKey = getRedisKey(document);
@@ -682,7 +681,7 @@ public class CaServer implements Assertion {
 
         // 写入CA数据
         FileUtil.writeString(upload.getCaData(), archivePath + caPath, StandardCharsets.UTF_8);
-        FileUtil.writeString(new String(file), archivePath + pdfPath, StandardCharsets.UTF_8);
+        FileUtil.writeBytes(file, archivePath + pdfPath);
         return "/archive" + pdfPath;
     }
 

+ 10 - 11
src/main/java/thyyxxk/webserver/service/ca/CaWSDL.java

@@ -15,17 +15,6 @@ public class CaWSDL {
     // 创建 Pattern 对象
     private final Pattern pattern = Pattern.compile(regex);
 
-    private final String WSDL = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"http://webservice.security.openapi.sp.custle.com\">\n" +
-            "   <soapenv:Header/>\n" +
-            "   <soapenv:Body>\n" +
-            "      <web:${name}>\n" +
-            "         <web:in0>\n" +
-            "    <![CDATA[${data}]]>\n" +
-            "         </web:in0>\n" +
-            "      </web:${name}>\n" +
-            "   </soapenv:Body>\n" +
-            "</soapenv:Envelope>";
-
     private final String url;
 
     public CaWSDL(String url) {
@@ -33,6 +22,16 @@ public class CaWSDL {
     }
 
     public JSONObject invoke(String method, String request) {
+        String WSDL = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"http://webservice.security.openapi.sp.custle.com\">\n" +
+                      "   <soapenv:Header/>\n" +
+                      "   <soapenv:Body>\n" +
+                      "      <web:${name}>\n" +
+                      "         <web:in0>\n" +
+                      "    <![CDATA[${data}]]>\n" +
+                      "         </web:in0>\n" +
+                      "      </web:${name}>\n" +
+                      "   </soapenv:Body>\n" +
+                      "</soapenv:Envelope>";
         String body = WSDL.replace("${name}", method).replace("${data}", request);
         String execute = Forest.post(url).addBody(body).bodyType(ForestDataType.XML).execute(String.class);
         String data = findData(execute);

+ 1 - 6
src/main/resources/application-cytest.yml

@@ -15,7 +15,7 @@ spring:
     cache: false
   datasource:
     dynamic:
-      primary: his
+      primary: dev
       strict: false
       datasource:
         his:
@@ -38,11 +38,6 @@ spring:
           username: "sa"
           password: "*ThyyHis2018#"
           driver-class-name: "com.microsoft.sqlserver.jdbc.SQLServerDriver"
-        dameng:
-          url: "jdbc:dm://172.16.30.206:5240"
-          username: "SYSDBA"
-          password: "HUN_SYSDBA2023"
-          driver-class-name: "dm.jdbc.driver.DmDriver"
     druid:
       #type: com.alibaba.druid.pool.DruidDataSource
       #初始化时建立物理连接的个数。初始化发生在显示调用init方法,或者第一次getConnection时