hejinbo 2 лет назад
Родитель
Сommit
a4e8347835

+ 1
- 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/DeptIdentifyController.java Просмотреть файл

@@ -30,7 +30,7 @@ public class DeptIdentifyController extends BaseController {
30 30
     }
31 31
 
32 32
     /**
33
-     * 查询部门认证数据
33
+     * 查询机构信息
34 34
      */
35 35
     @GetMapping("/list")
36 36
     public TableDataInfo list(DeptIdentify deptIdentify) {

+ 8
- 2
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DeptIdentifyServiceImpl.java Просмотреть файл

@@ -135,13 +135,13 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
135 135
                         //创建机构图片印章
136 136
                         // String annexPath = "D:\\develop\\2.jpg";
137 137
                         String sealName = "自定义" + UUID.randomUUID() + "";  //自定义印章印章名称不能重复,所以用UUID确保唯一性
138
-                        EsignHttpResponse response = SignAward.createOrgByImage(identify,sealName,annexPath);
138
+                        EsignHttpResponse response = SignAward.createOrgByImage(identify, sealName, annexPath);
139 139
                         JSONObject jsonObject = JSONObject.parseObject(response.getBody());
140 140
                         int code = jsonObject.getIntValue("code");
141 141
                         if (code == 0) {  //业务码,0表示成功,非0表示异常。
142 142
                             String sealId = jsonObject.getJSONObject("data").getString("sealId");
143 143
                             //保存到表里
144
-                            SealManage sealManage  = new SealManage();
144
+                            SealManage sealManage = new SealManage();
145 145
                             sealManage.setIdentifyId(identify.getId());
146 146
                             sealManage.setSealName(sealName);
147 147
                             sealManage.setSealId(sealId);
@@ -297,6 +297,12 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
297 297
         if (identifyType == null) {
298 298
             deptIdentify.setIdentifyType(1); // 设置机构默认为仲裁机构
299 299
         }
300
+        //先查询看数据库里有没有相同的机构经办人
301
+        List<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentify(deptIdentify);
302
+        if (deptIdentifies != null && deptIdentifies.size() > 0) {
303
+            //说明之前新增过
304
+            return AjaxResult.error("信息重复");
305
+        }
300 306
         deptIdentify.setIdentifyStatus(0); //设置认证状态默认为未认证
301 307
         deptIdentify.setIsUse(0); //设置认证状态默认为未认证
302 308
         int i = deptIdentifyMapper.insertDeptIdentify(deptIdentify);//设置机构默认为未启用

+ 30
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/ImageToBase64Converter.java Просмотреть файл

@@ -0,0 +1,30 @@
1
+package com.ruoyi.wisdomarbitrate.utils;
2
+
3
+import java.io.BufferedInputStream;
4
+import java.io.FileOutputStream;
5
+import java.io.IOException;
6
+import java.io.InputStream;
7
+import java.net.URL;
8
+import java.nio.file.Files;
9
+import java.nio.file.Path;
10
+import java.nio.file.Paths;
11
+import java.util.Base64;
12
+
13
+public class ImageToBase64Converter {
14
+    public static String imageToBase64(String imagePath) throws Exception {
15
+        Path path = Paths.get(imagePath);
16
+        byte[] imageBytes = Files.readAllBytes(path);
17
+        String base64Image = Base64.getEncoder().encodeToString(imageBytes);
18
+        return base64Image;
19
+    }
20
+
21
+    public static void main(String[] args) {
22
+        String imagePath = "D:\\develop\\2.jpg";
23
+        try {
24
+            String base64Image = imageToBase64(imagePath);
25
+            System.out.println(base64Image);
26
+        } catch (Exception e) {
27
+            e.printStackTrace();
28
+        }
29
+    }
30
+}

+ 0
- 37
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/MyTest.java Просмотреть файл

@@ -1,37 +0,0 @@
1
-package com.ruoyi.wisdomarbitrate.utils;
2
-
3
-import java.io.BufferedInputStream;
4
-import java.io.FileOutputStream;
5
-import java.io.IOException;
6
-import java.io.InputStream;
7
-import java.net.URL;
8
-
9
-public class MyTest {
10
-    public static void download(String fileUrl, String saveFilePath) throws IOException {
11
-        URL url = new URL(fileUrl);
12
-        InputStream inputStream = url.openStream();
13
-        BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream);
14
-        FileOutputStream fileOutputStream = new FileOutputStream(saveFilePath);
15
-
16
-        byte[] buffer = new byte[1024];
17
-        int bytesRead = 0;
18
-        while ((bytesRead = bufferedInputStream.read(buffer, 0, buffer.length)) != -1) {
19
-            fileOutputStream.write(buffer, 0, bytesRead);
20
-        }
21
-
22
-        fileOutputStream.close();
23
-        bufferedInputStream.close();
24
-        inputStream.close();
25
-    }
26
-
27
-    public static void main(String[] args) {
28
-        String fileUrl = "https://esignoss.esign.cn/1111563786/0e16cc53-fe2e-403b-b901-587778a8ea92/3ed8f1b0bd2640e895fcfbaffdec0a1e.pdf?Expires=1698742492&OSSAccessKeyId=LTAI4G23YViiKnxTC28ygQzF&Signature=K%2Bb5k7DqNmaxeu%2Fct5qis4qor7s%3D";
29
-        String saveFilePath = "D:\\home\\example.pdf";
30
-        try {
31
-            download(fileUrl, saveFilePath);
32
-            System.out.println("File downloaded successfully.");
33
-        } catch (IOException e) {
34
-            e.printStackTrace();
35
-        }
36
-    }
37
-}