Quellcode durchsuchen

公章管理测试

hejinbo vor 2 Jahren
Ursprung
Commit
4088cf7357

+ 2
- 3
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/DeptIdentifyController.java Datei anzeigen

@@ -61,9 +61,8 @@ public class DeptIdentifyController extends BaseController {
61 61
      * @return
62 62
      */
63 63
     @PostMapping("/sealUpload")
64
-    public AjaxResult sealUpload(@Validated @RequestBody DeptIdentify deptIdentify
65
-            , @RequestParam("file") MultipartFile file) {
66
-        return deptIdentifyService.sealUpload(deptIdentify, file);
64
+    public AjaxResult sealUpload(Long id, String sealName , @RequestParam("file") MultipartFile file) {
65
+        return deptIdentifyService.sealUpload(id,sealName, file);
67 66
     }
68 67
 
69 68
     /**

+ 0
- 71
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/MyTest.java Datei anzeigen

@@ -1,71 +0,0 @@
1
-package com.ruoyi.web.controller.wisdomarbitrate;
2
-
3
-import com.google.gson.Gson;
4
-import com.google.gson.JsonArray;
5
-import com.google.gson.JsonObject;
6
-import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
7
-import com.ruoyi.common.exception.EsignDemoException;
8
-import com.ruoyi.wisdomarbitrate.domain.DeptIdentify;
9
-import com.ruoyi.wisdomarbitrate.mapper.CaseApplicationMapper;
10
-import com.ruoyi.wisdomarbitrate.mapper.CaseAttachMapper;
11
-import com.ruoyi.wisdomarbitrate.mapper.DeptIdentifyMapper;
12
-import com.ruoyi.wisdomarbitrate.mapper.SealSignRecordMapper;
13
-import com.ruoyi.wisdomarbitrate.utils.SignAward;
14
-import org.springframework.beans.factory.annotation.Autowired;
15
-import org.springframework.web.bind.annotation.GetMapping;
16
-import org.springframework.web.bind.annotation.RequestMapping;
17
-import org.springframework.web.bind.annotation.RestController;
18
-
19
-import java.util.List;
20
-
21
-@RestController
22
-@RequestMapping
23
-public class MyTest {
24
-    @Autowired
25
-    private CaseApplicationMapper caseApplicationMapper;
26
-    @Autowired
27
-    private SealSignRecordMapper sealSignRecordMapper;
28
-    @Autowired
29
-    private CaseAttachMapper caseAttachMapper;
30
-    @Autowired
31
-    private DeptIdentifyMapper deptIdentifyMapper;
32
-    @GetMapping("/test")
33
-    public void myTest() throws EsignDemoException {
34
-        Gson gson = new Gson();
35
-        DeptIdentify deptIdentify = new DeptIdentify();
36
-        deptIdentify.setIdentifyStatus(0);
37
-        List<DeptIdentify> deptIdentifysnew = deptIdentifyMapper.selectDeptIdentifylist(deptIdentify);
38
-        if (deptIdentifysnew != null && deptIdentifysnew.size() > 0) {
39
-            for (int i = 0; i < deptIdentifysnew.size(); i++) {
40
-                EsignHttpResponse identifyInfo = SignAward.getDeptIdentifyInfo(deptIdentifysnew.get(i));
41
-                JsonObject identifyInfoJsonObject = gson.fromJson(identifyInfo.getBody(), JsonObject.class);
42
-                JsonObject identifyInfoData = identifyInfoJsonObject.getAsJsonObject("data");
43
-                int realnameStatus = identifyInfoData.get("realnameStatus").getAsInt();
44
-                if (realnameStatus == 1) {
45
-                    String orgId = identifyInfoData.get("orgId").getAsString();
46
-                    System.out.println("这是orgId"+orgId+"=======================");
47
-                    EsignHttpResponse identifyInfo1 = SignAward.deptIdentifySealList(orgId);
48
-                    //将orgId保存到数据库里
49
-                    DeptIdentify deptIdentifynew = deptIdentifysnew.get(i);
50
-                    deptIdentifynew.setOrgId(orgId);
51
-                    JsonObject identifyInfoJsonObject1 = gson.fromJson(identifyInfo1.getBody(), JsonObject.class);
52
-                    JsonObject identifyInfoData1 = identifyInfoJsonObject1.getAsJsonObject("data");
53
-                    JsonArray sealArray = identifyInfoData1.get("seals").getAsJsonArray();
54
-                    String sealNames = "";
55
-                    if (sealArray.size() > 0) {
56
-                        for (int j = 0; j < sealArray.size(); j++) {
57
-                            JsonObject sealObject = (JsonObject) sealArray.get(j);
58
-                            String sealName = sealObject.get("sealName").toString();
59
-                            String sealNamenew = sealName.substring(1, sealName.length() - 1);
60
-                            sealNames += sealNamenew + ",";
61
-                        }
62
-                    }
63
-                    String sealName = sealNames.substring(0, sealNames.length() - 1);
64
-                    deptIdentifynew.setIdentifyStatus(1);
65
-                    deptIdentifynew.setSealName(sealName);
66
-                    int row = deptIdentifyMapper.updateDeptIdentify(deptIdentifynew);
67
-                }
68
-            }
69
-        }
70
-    }
71
-}

+ 1
- 1
ruoyi-admin/src/main/resources/application-druid.yml Datei anzeigen

@@ -6,7 +6,7 @@ spring:
6 6
         druid:
7 7
             # 主库数据源
8 8
             master:
9
-                url: jdbc:mysql://121.40.189.20:3306/smart_arbitration?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=Asia/Shanghai&useSSL=false
9
+                url: jdbc:mysql://121.40.189.20:3306/test_smart_arbitration?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=Asia/Shanghai&useSSL=false
10 10
                 username: root
11 11
                 password: YMzc157#
12 12
             # 从库数据源

+ 1
- 1
ruoyi-admin/src/main/resources/application.yml Datei anzeigen

@@ -18,7 +18,7 @@ ruoyi:
18 18
 # 开发环境配置
19 19
 server:
20 20
   # 服务器的HTTP端口,默认为8080
21
-  port: 9001
21
+  port: 8001
22 22
   servlet:
23 23
     # 应用的访问路径
24 24
     context-path: /

+ 2
- 3
ruoyi-common/src/main/java/com/ruoyi/common/utils/SealUtil.java Datei anzeigen

@@ -96,9 +96,7 @@ public class SealUtil {
96 96
         //生成签名鉴权方式的的header
97 97
         Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId,eSignAppSecret,jsonParm,requestType.name(),apiaddr,true);
98 98
         //发起接口请求
99
-        EsignHttpResponse response = EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true);
100
-        System.out.println(response);
101
-        return response;
99
+        return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true);
102 100
     }
103 101
 
104 102
     /**
@@ -114,6 +112,7 @@ public class SealUtil {
114 112
         return EsignHttpHelper.doUploadHttp(uploadUrl,requestType,esignFileBean.getFileBytes(),esignFileBean.getFileContentMD5(), EsignHeaderConstant.CONTENTTYPE_STREAM.VALUE(),true);
115 113
     }
116 114
     public static void main(String[] args) throws Exception {
115
+        queryAuthProcess("OF-2b1e52987408005c");
117 116
        // createOrgByImage();
118 117
       //  getOrgEmpower();
119 118
        // queryAuthProcess("OF-2b00885895080028");

+ 1
- 1
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IDeptIdentifyService.java Datei anzeigen

@@ -18,7 +18,7 @@ public interface IDeptIdentifyService {
18 18
 
19 19
     AjaxResult enableDept(DeptIdentify deptIdentify);
20 20
 
21
-    AjaxResult sealUpload(DeptIdentify deptIdentify, MultipartFile file);
21
+    AjaxResult sealUpload(Long id, String sealName , MultipartFile file);
22 22
 
23 23
 
24 24
     AjaxResult receiveNotify(String body);

+ 28
- 13
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DeptIdentifyServiceImpl.java Datei anzeigen

@@ -71,14 +71,16 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
71 71
             EsignHttpResponse identifyUrl = SignAward.deptIdentifyUrl(deptIdentifyselect);
72 72
             JsonObject signUrlJsonObject = gson.fromJson(identifyUrl.getBody(), JsonObject.class);
73 73
             int code = signUrlJsonObject.get("code").getAsInt();
74
-            JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data");
75
-            String url = signUrlData.get("authUrl").getAsString();
76
-            //获取本次认证授权流程ID
77
-            String authFlowId = signUrlData.get("authFlowId").getAsString();
78
-            deptIdentify.setAuthFlowId(authFlowId);
79
-            deptIdentifynew.setIdentifyUrl(url);
80
-            deptIdentify.setIdentifyDate(new Date());
81
-            int row = deptIdentifyMapper.updateDeptIdentify(deptIdentify);
74
+            if (code == 0){
75
+                JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data");
76
+                String url = signUrlData.get("authUrl").getAsString();
77
+                //获取本次认证授权流程ID
78
+                String authFlowId = signUrlData.get("authFlowId").getAsString();
79
+                deptIdentify.setAuthFlowId(authFlowId);
80
+                deptIdentifynew.setIdentifyUrl(url);
81
+                deptIdentify.setIdentifyDate(new Date());
82
+                int row = deptIdentifyMapper.updateDeptIdentify(deptIdentify);
83
+            }
82 84
         }
83 85
         return deptIdentifynew;
84 86
     }
@@ -113,7 +115,7 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
113 115
     }
114 116
 
115 117
     @Override
116
-    public AjaxResult sealUpload(DeptIdentify deptIdentify, MultipartFile file) {
118
+    public AjaxResult sealUpload(Long id, String sealName , MultipartFile file) {
117 119
         try {
118 120
             if (file.isEmpty()) {
119 121
                 return AjaxResult.error("请选择要上传的文件");
@@ -121,6 +123,8 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
121 123
             String filePath = RuoYiConfig.getUploadPath();
122 124
             // 上传
123 125
             String fileName = FileUploadUtils.upload(filePath, file);
126
+            DeptIdentify deptIdentify = new DeptIdentify();
127
+            deptIdentify.setId(id);
124 128
             List<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentifyBydeptid(deptIdentify);
125 129
             if (deptIdentifies != null && deptIdentifies.size() > 0) {
126 130
                 for (DeptIdentify identify : deptIdentifies) {
@@ -133,21 +137,32 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
133 137
                         String prefix = "/profile";
134 138
                         int startIndex = fileName.indexOf(prefix);
135 139
                         startIndex += prefix.length();
136
-                        String annexPath = "/uploadPath" + fileName.substring(startIndex);
140
+                        //String annexPath = "home/ruoyi/uploadPath" + fileName.substring(startIndex);
137 141
                         //创建机构图片印章
142
+                        String annexPath = "D:\\develop\\2.jpg";
143
+                        identify.setSealName(sealName);
138 144
                         EsignHttpResponse response = SignAward.createOrgByImage(identify, annexPath);
139 145
                         JSONObject jsonObject = JSONObject.parseObject(response.getBody());
140 146
                         int code = jsonObject.getIntValue("code");
141 147
                         if (code == 0) {  //业务码,0表示成功,非0表示异常。
142 148
                             String sealId = jsonObject.getJSONObject("data").getString("sealId");
143
-                            identify.setSealId(sealId);
144
-                            identify.setIsUse(0);  //设置印章使用状态为未启用
145 149
                             //保存到表里
146
-                            int i = deptIdentifyMapper.updateDeptIdentify(identify);
150
+                            DeptIdentify deptIdentify1 = new DeptIdentify();
151
+                            deptIdentify1.setDeptId(identify.getDeptId());
152
+                            deptIdentify1.setUserId(identify.getUserId());
153
+                            deptIdentify1.setIdentifyStatus(identify.getIdentifyStatus());
154
+                            deptIdentify1.setIdentifyDate(identify.getIdentifyDate());
155
+                            deptIdentify1.setIsUse(identify.getIsUse());
156
+                            deptIdentify1.setSealName(sealName);
157
+                            deptIdentify1.setOrgId(identify.getOrgId());
158
+                            deptIdentify1.setAuthFlowId(identify.getAuthFlowId());
159
+                            deptIdentify1.setSealId(sealId);
160
+                            int i = deptIdentifyMapper.insertDeptIdentify(deptIdentify1);
147 161
                             if (i > 0) {
148 162
                                 return AjaxResult.success("上传成功");
149 163
                             }
150 164
                         }
165
+                        return AjaxResult.error("公章上传失败,请检查印章名称是否重复");
151 166
                     }
152 167
                     return AjaxResult.error("企业用户未授予资源管理权限");
153 168
                 }

+ 33
- 29
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/FixSelectFlowDetailUtils.java Datei anzeigen

@@ -181,32 +181,36 @@ public class FixSelectFlowDetailUtils {
181 181
         if (deptIdentifysnew != null && deptIdentifysnew.size() > 0) {
182 182
             for (int i = 0; i < deptIdentifysnew.size(); i++) {
183 183
                 EsignHttpResponse identifyInfo = SignAward.getDeptIdentifyInfo(deptIdentifysnew.get(i));
184
+
184 185
                 JsonObject identifyInfoJsonObject = gson.fromJson(identifyInfo.getBody(), JsonObject.class);
185
-                JsonObject identifyInfoData = identifyInfoJsonObject.getAsJsonObject("data");
186
-                int realnameStatus = identifyInfoData.get("realnameStatus").getAsInt();
187
-                if (realnameStatus == 1) {
188
-                    String orgId = identifyInfoData.get("orgId").getAsString();
189
-                    System.out.println("这是orgId"+orgId+"=======================");
190
-                    EsignHttpResponse identifyInfo1 = SignAward.deptIdentifySealList(orgId);
191
-                    //将orgId保存到数据库里
192
-                    DeptIdentify deptIdentifynew = deptIdentifysnew.get(i);
193
-                    deptIdentifynew.setOrgId(orgId);
194
-                    JsonObject identifyInfoJsonObject1 = gson.fromJson(identifyInfo1.getBody(), JsonObject.class);
195
-                    JsonObject identifyInfoData1 = identifyInfoJsonObject1.getAsJsonObject("data");
196
-                    JsonArray sealArray = identifyInfoData1.get("seals").getAsJsonArray();
197
-                    String sealNames = "";
198
-                    if (sealArray.size() > 0) {
199
-                        for (int j = 0; j < sealArray.size(); j++) {
200
-                            JsonObject sealObject = (JsonObject) sealArray.get(j);
201
-                            String sealName = sealObject.get("sealName").toString();
202
-                            String sealNamenew = sealName.substring(1, sealName.length() - 1);
203
-                            sealNames += sealNamenew + ",";
186
+                int code = identifyInfoJsonObject.get("code").getAsInt();
187
+                if (code == 0) {
188
+                    JsonObject identifyInfoData = identifyInfoJsonObject.getAsJsonObject("data");
189
+                    int realnameStatus = identifyInfoData.get("realnameStatus").getAsInt();
190
+                    if (realnameStatus == 1) {
191
+                        String orgId = identifyInfoData.get("orgId").getAsString();
192
+                        System.out.println("这是orgId" + orgId + "=======================");
193
+                        EsignHttpResponse identifyInfo1 = SignAward.deptIdentifySealList(orgId);
194
+                        //将orgId保存到数据库里
195
+                        DeptIdentify deptIdentifynew = deptIdentifysnew.get(i);
196
+                        deptIdentifynew.setOrgId(orgId);
197
+                        JsonObject identifyInfoJsonObject1 = gson.fromJson(identifyInfo1.getBody(), JsonObject.class);
198
+                        JsonObject identifyInfoData1 = identifyInfoJsonObject1.getAsJsonObject("data");
199
+                        JsonArray sealArray = identifyInfoData1.get("seals").getAsJsonArray();
200
+                        String sealNames = "";
201
+                        if (sealArray.size() > 0) {
202
+                            for (int j = 0; j < sealArray.size(); j++) {
203
+                                JsonObject sealObject = (JsonObject) sealArray.get(j);
204
+                                String sealName = sealObject.get("sealName").toString();
205
+                                String sealNamenew = sealName.substring(1, sealName.length() - 1);
206
+                                sealNames += sealNamenew + ",";
207
+                            }
204 208
                         }
209
+                        String sealName = sealNames.substring(0, sealNames.length() - 1);
210
+                        deptIdentifynew.setIdentifyStatus(1);
211
+                        deptIdentifynew.setSealName(sealName);
212
+                        int row = deptIdentifyMapper.updateDeptIdentify(deptIdentifynew);
205 213
                     }
206
-                    String sealName = sealNames.substring(0, sealNames.length() - 1);
207
-                    deptIdentifynew.setIdentifyStatus(1);
208
-                    deptIdentifynew.setSealName(sealName);
209
-                    int row = deptIdentifyMapper.updateDeptIdentify(deptIdentifynew);
210 214
                 }
211 215
             }
212 216
         }
@@ -217,9 +221,9 @@ public class FixSelectFlowDetailUtils {
217 221
      *
218 222
      * @throws EsignDemoException
219 223
      */
220
-   // @Scheduled(cron = "0/30 * * * * ?")
224
+    // @Scheduled(cron = "0/30 * * * * ?")
221 225
     @Transactional
222
-    public void searchForInstitutionalSeal()  {
226
+    public void searchForInstitutionalSeal() {
223 227
         try {
224 228
             DeptIdentify deptIdentify = new DeptIdentify();
225 229
             deptIdentify.setIsUse(0);
@@ -228,16 +232,16 @@ public class FixSelectFlowDetailUtils {
228 232
                 for (DeptIdentify identify : deptIdentifies) {
229 233
                     //查询企业内部印章
230 234
                     Integer annexId = identify.getAnnexId();
231
-                    if (annexId == null){
235
+                    if (annexId == null) {
232 236
                         //说明之前没有下载过
233 237
                         EsignHttpResponse response = SignAward.orgOwnSealList(identify);
234 238
                         JSONObject jsonObject = JSONObject.parseObject(response.getBody());
235 239
                         JSONObject data = jsonObject.getJSONObject("data");
236 240
                         JSONArray seals = data.getJSONArray("seals");
237
-                        for (int i = 0; i < seals.size(); i++){
241
+                        for (int i = 0; i < seals.size(); i++) {
238 242
                             JSONObject seal = seals.getJSONObject(i);
239 243
                             int statusDescription = seal.getIntValue("statusDescription");
240
-                            if (statusDescription==1){//印章状态 1已启用,2待审核,3审核不通过,4 挂起
244
+                            if (statusDescription == 1) {//印章状态 1已启用,2待审核,3审核不通过,4 挂起
241 245
                                 //已启用证明审核通过,下载到数据库
242 246
                                 String sealImageDownloadUrl = seal.getString("sealImageDownloadUrl");
243 247
                                 LocalDate now = LocalDate.now();
@@ -265,7 +269,7 @@ public class FixSelectFlowDetailUtils {
265 269
                                     caseAttach.setAnnexPath(savePath);
266 270
                                     caseAttach.setAnnexName(saveName);
267 271
                                     int i1 = caseAttachMapper.save(caseAttach);
268
-                                    if (i1>0){
272
+                                    if (i1 > 0) {
269 273
                                         //将附件id保存到公章管理表里
270 274
                                         Integer annexId1 = caseAttach.getAnnexId();
271 275
                                         identify.setAnnexId(annexId1);

+ 52
- 56
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/SignAward.java Datei anzeigen

@@ -119,7 +119,10 @@ public class SignAward {
119 119
 
120 120
 //        System.out.println(signFlowDetailJsonObject);
121 121
 
122
-
122
+        DeptIdentify deptIdentify = new DeptIdentify();
123
+        deptIdentify.setOrgId("db279dd50d844e6fa64770d9a6edc7dd");
124
+        EsignHttpResponse orgByImage = createOrgByImage(deptIdentify, "D:\\develop\\2.jpg");
125
+        System.out.println("这是结果===============" + orgByImage);
123 126
     }
124 127
 
125 128
 
@@ -435,48 +438,38 @@ public class SignAward {
435 438
      * @return
436 439
      */
437 440
     public static EsignHttpResponse createOrgByImage(DeptIdentify deptIdentify, String filePath) throws EsignDemoException {
438
-        //获取认证授权流程ID
439
-        String authFlowId = deptIdentify.getAuthFlowId();
440
-        //查询认证授权流程详情
441
-        EsignHttpResponse response = SealUtil.queryAuthProcess(authFlowId);
442
-        String body = response.getBody();
443
-        if (body != null) {
444
-            JSONObject jsonObject = JSONObject.parseObject(body);
445
-            //查询授权流程状态
446
-            int authorizedStatus = jsonObject.getJSONObject("data").getIntValue("authorizedStatus");
447
-            if (authorizedStatus == 1) {//0 -流程过期失效  1 - 已授权  2 - 授权中  3 - 审批未通过
448
-                String apiaddr = "/v3/seals/org-seals/create-by-image";
449
-                String orgId = deptIdentify.getOrgId();
450
-                //上传印章图片
451
-                //步骤一:获取印章图片上传地址fileUploadUrl
452
-                EsignHttpResponse response1 = SealUtil.getFileUploadUrl(filePath);
453
-                JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody());
454
-                String fileUploadUrl = jsonObject1.getJSONObject("data").getString("fileUploadUrl");
455
-                //步骤二:将印章图片文件流上传到fileUploadUrl
456
-                EsignHttpResponse response2 = SealUtil.fileStreamUpload(fileUploadUrl, filePath);
457
-                JSONObject jsonObject2 = JSONObject.parseObject(response2.getBody());
458
-                int errCode = jsonObject2.getIntValue("errCode");
459
-                if (errCode == 0){  //业务码,0表示成功,非0表示异常。
460
-                    //获取步骤一里面的fileKey
461
-                    String sealImageFileKey = jsonObject1.getJSONObject("data").getString("fileKey");
462
-                    String sealName = deptIdentify.getSealName();
463
-                    //请求参数body体,json格式。get或者delete请求时jsonString传空json:"{}"或者null
464
-                    String jsonParm = "{\n" +
465
-                            "  \"orgId\": \"" + orgId + "\",\n" +
466
-                            "  \"sealImageFileKey\": \"" + sealImageFileKey + "\",\n" +
467
-                            "  \"sealName\": \"   " + sealName + "  \",\n" +
468
-                            "  \"sealWidth\": 50,\n" +
469
-                            "  \"sealHeight\": 50,\n" +
470
-                            "}";
471
-                    //请求方法
472
-                    EsignRequestType requestType = EsignRequestType.POST;
473
-                    //生成签名鉴权方式的的header
474
-                    Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, false);
475
-                    //发起接口请求
476
-                    return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, false);
477
-                }
478
-            }
441
+        String apiaddr = "/v3/seals/org-seals/create-by-image";
442
+        String orgId = deptIdentify.getOrgId();
443
+        //上传印章图片
444
+        //步骤一:获取印章图片上传地址fileUploadUrl
445
+        EsignHttpResponse response1 = SealUtil.getFileUploadUrl(filePath);
446
+        JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody());
447
+        String fileUploadUrl = jsonObject1.getJSONObject("data").getString("fileUploadUrl");
448
+        //步骤二:将印章图片文件流上传到fileUploadUrl
449
+        EsignHttpResponse response2 = SealUtil.fileStreamUpload(fileUploadUrl, filePath);
450
+        JSONObject jsonObject2 = JSONObject.parseObject(response2.getBody());
451
+        int errCode = jsonObject2.getIntValue("errCode");
452
+        if (errCode == 0) {  //业务码,0表示成功,非0表示异常。
453
+            //获取步骤一里面的fileKey
454
+            String sealImageFileKey = jsonObject1.getJSONObject("data").getString("fileKey");
455
+            String sealName = deptIdentify.getSealName();
456
+            //请求参数body体,json格式。get或者delete请求时jsonString传空json:"{}"或者null
457
+            String jsonParm = "{\n" +
458
+                    "  \"orgId\": \"" + orgId + "\",\n" +
459
+                    "  \"sealImageFileKey\": \"" + sealImageFileKey + "\",\n" +
460
+                    "  \"sealName\": \"" + sealName + "\",\n" +
461
+                    "  \"sealWidth\": 50,\n" +
462
+                    "  \"sealHeight\": 50,\n" +
463
+                    "  \"sealBizType\": \"COMMON\"\n" +
464
+                    "}";
465
+            //请求方法
466
+            EsignRequestType requestType = EsignRequestType.POST;
467
+            //生成签名鉴权方式的的header
468
+            Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, true);
469
+            //发起接口请求
470
+            return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true);
479 471
         }
472
+
480 473
         return null;
481 474
     }
482 475
 
@@ -485,35 +478,38 @@ public class SignAward {
485 478
      */
486 479
 
487 480
     public static EsignHttpResponse orgOwnSealList(DeptIdentify deptIdentify) throws EsignDemoException {
488
-        String orgId=deptIdentify.getOrgId();
489
-        int pageNum=1;
490
-        int pageSize=20;
481
+        String orgId = deptIdentify.getOrgId();
482
+        int pageNum = 1;
483
+        int pageSize = 20;
491 484
 
492
-        String apiaddr="/v3/seals/org-own-seal-list?orgId="+orgId+"&pageNum="+pageNum+"&pageSize="+pageSize;
485
+        String apiaddr = "/v3/seals/org-own-seal-list?orgId=" + orgId + "&pageNum=" + pageNum + "&pageSize=" + pageSize;
493 486
 
494 487
         //请求参数body体,json格式。get或者delete请求时jsonString传空json:"{}"或者null
495
-        String jsonParm=null;
488
+        String jsonParm = null;
496 489
         //请求方法
497
-        EsignRequestType requestType= EsignRequestType.GET;
490
+        EsignRequestType requestType = EsignRequestType.GET;
498 491
         //生成签名鉴权方式的的header
499
-        Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId,eSignAppSecret,jsonParm,requestType.name(),apiaddr,false);
492
+        Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, false);
500 493
         //发起接口请求
501
-        return EsignHttpHelper.doCommHttp(eSignHost, apiaddr,requestType , jsonParm, header,false);
494
+        return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, false);
502 495
     }
496
+
503 497
     /**
504 498
      * 查询指定印章详情(机构)
505 499
      */
506 500
 
507
-    public static EsignHttpResponse getOrgSeal(String orgId,String sealId) throws EsignDemoException {
508
-        String apiaddr="/v3/seals/org-seal-info?orgId="+orgId+"&sealId="+sealId;
501
+    public static EsignHttpResponse getOrgSeal(String orgId, String sealId) throws EsignDemoException {
502
+        String apiaddr = "/v3/seals/org-seal-info?orgId=" + orgId + "&sealId=" + sealId;
509 503
 
510 504
         //请求参数body体,json格式。get或者delete请求时jsonString传空json:"{}"或者null
511
-        String jsonParm=null;
505
+        String jsonParm = null;
512 506
         //请求方法
513
-        EsignRequestType requestType= EsignRequestType.GET;
507
+        EsignRequestType requestType = EsignRequestType.GET;
514 508
         //生成签名鉴权方式的的header
515
-        Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId,eSignAppSecret,jsonParm,requestType.name(),apiaddr,false);
509
+        Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, false);
516 510
         //发起接口请求
517
-        return EsignHttpHelper.doCommHttp(eSignHost, apiaddr,requestType , jsonParm, header,false);
511
+        return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, false);
518 512
     }
513
+
514
+
519 515
 }

+ 20
- 8
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/DeptIdentifyMapper.xml Datei anzeigen

@@ -32,7 +32,7 @@
32 32
     </select>
33 33
 
34 34
     <select id="selectDeptIdentifyBydeptid" parameterType="DeptIdentify" resultMap="DeptIdentifyResult">
35
-        SELECT d.id ,d.dept_id ,d.user_id ,d.org_id ,d.auth_flow_id
35
+        SELECT d.*
36 36
         from dept_identify d
37 37
         <where>
38 38
             <if test="deptId != null">
@@ -41,6 +41,9 @@
41 41
             <if test="userId != null">
42 42
                 AND d.user_id = #{userId}
43 43
             </if>
44
+            <if test="id != null">
45
+                AND d.id = #{id}
46
+            </if>
44 47
         </where>
45 48
     </select>
46 49
 
@@ -48,11 +51,23 @@
48 51
         insert into dept_identify(
49 52
         <if test="deptId != null">dept_id,</if>
50 53
         <if test="userId != null">user_id,</if>
51
-        <if test="identifyStatus != null">identify_status</if>
54
+        <if test="identifyStatus != null">identify_status,</if>
55
+        <if test="identifyDate != null">identify_date,</if>
56
+        <if test="isUse != null">is_use,</if>
57
+        <if test="sealName != null and sealName != ''">seal_name,</if>
58
+        <if test="orgId != null and orgId != ''">org_id,</if>
59
+        <if test="authFlowId != null and authFlowId != ''">auth_flow_id,</if>
60
+        <if test="sealId != null and sealId != ''">seal_id</if>
52 61
         )values(
53 62
         <if test="deptId != null">#{deptId},</if>
54 63
         <if test="userId != null">#{userId},</if>
55
-        <if test="identifyStatus != null">#{identifyStatus}</if>
64
+        <if test="identifyStatus != null">#{identifyStatus},</if>
65
+        <if test="identifyDate != null">#{identifyDate},</if>
66
+        <if test="isUse != null">#{isUse},</if>
67
+        <if test="sealName != null and sealName != ''">#{sealName},</if>
68
+        <if test="orgId != null and orgId != ''">#{orgId},</if>
69
+        <if test="authFlowId != null and authFlowId != '' ">#{authFlowId},</if>
70
+        <if test="sealId != null and sealId != ''">#{sealId}</if>
56 71
         )
57 72
     </insert>
58 73
 
@@ -104,14 +119,13 @@
104 119
             <if test="orgId != null  and orgId != ''">org_id = #{orgId},</if>
105 120
             <if test="sealId != null  and sealId != ''">seal_id = #{sealId},</if>
106 121
             <if test="sealStatus != null ">seal_status = #{sealStatus},</if>
122
+            <if test="authFlowId != null  and authFlowId != '' ">auth_flow_id = #{authFlowId},</if>
107 123
         </set>
108 124
         <where>
109 125
             <if test="id != null">
110 126
                 AND id = #{id}
111 127
             </if>
112
-            <if test="sealId != null">
113
-                AND seal_id = #{sealId}
114
-            </if>
128
+
115 129
         </where>
116 130
     </update>
117 131
 
@@ -119,6 +133,4 @@
119 133
 
120 134
 
121 135
 
122
-
123
-
124 136
 </mapper>