|
|
@@ -3,6 +3,8 @@ package com.ruoyi.wisdomarbitrate.utils;
|
|
3
|
3
|
import com.alibaba.fastjson.JSON;
|
|
4
|
4
|
import com.alibaba.fastjson.JSONObject;
|
|
5
|
5
|
import com.google.gson.Gson;
|
|
|
6
|
+import com.google.gson.JsonArray;
|
|
|
7
|
+import com.google.gson.JsonObject;
|
|
6
|
8
|
import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
|
|
7
|
9
|
import com.ruoyi.common.enums.EsignRequestType;
|
|
8
|
10
|
import com.ruoyi.common.exception.EsignDemoException;
|
|
|
@@ -13,6 +15,7 @@ import com.ruoyi.wisdomarbitrate.domain.vo.base.StringIdsReq;
|
|
13
|
15
|
import com.ruoyi.wisdomarbitrate.domain.dto.dept.DeptIdentify;
|
|
14
|
16
|
import com.ruoyi.wisdomarbitrate.domain.dto.mscase.SealSignRecord;
|
|
15
|
17
|
|
|
|
18
|
+import java.util.ArrayList;
|
|
16
|
19
|
import java.util.List;
|
|
17
|
20
|
import java.util.Map;
|
|
18
|
21
|
|
|
|
@@ -28,23 +31,28 @@ public class SignAward {
|
|
28
|
31
|
|
|
29
|
32
|
|
|
30
|
33
|
|
|
|
34
|
+
|
|
31
|
35
|
/* 发起签署*/
|
|
32
|
|
-// EsignHttpResponse createByFile = createByFile(sealSignRecord);
|
|
|
36
|
+// EsignHttpResponse createByFile = createByFileMediation(sealSignRecord,sealIdList);
|
|
33
|
37
|
// JsonObject createByFileJsonObject = gson.fromJson(createByFile.getBody(), JsonObject.class);
|
|
34
|
38
|
// JsonObject createByFileData = createByFileJsonObject.getAsJsonObject("data");
|
|
35
|
39
|
// String signFlowId = createByFileData.get("signFlowId").getAsString();
|
|
36
|
|
-// System.err.println("流程id:"+signFlowId);
|
|
|
40
|
+// System.out.println("流程id:"+signFlowId);
|
|
|
41
|
+
|
|
|
42
|
+
|
|
|
43
|
+
|
|
37
|
44
|
|
|
38
|
45
|
/* 获取文件签名印章位置*/
|
|
39
|
|
-// EsignHttpResponse positions = getPositions(sealSignRecord);
|
|
|
46
|
+// EsignHttpResponse positions = getPositionsMediation(sealSignRecord);
|
|
40
|
47
|
// JsonObject positionsJsonObject = gson.fromJson(positions.getBody(), JsonObject.class);
|
|
41
|
48
|
// JsonObject positionsData = positionsJsonObject.getAsJsonObject("data");
|
|
42
|
49
|
// JsonArray keywordPositions = positionsData.get("keywordPositions").getAsJsonArray();
|
|
43
|
50
|
// System.out.println("获取文件签名印章位置:" +keywordPositions.toString());
|
|
44
|
51
|
|
|
45
|
52
|
// String signFlowId = "c9955453716344f9971d308abdc13464";
|
|
|
53
|
+
|
|
46
|
54
|
//获取合同文件签名链接
|
|
47
|
|
-// EsignHttpResponse signUrl = signUrl(sealSignRecord);
|
|
|
55
|
+// EsignHttpResponse signUrl = signUrlMediation(sealSignRecord);
|
|
48
|
56
|
// JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class);
|
|
49
|
57
|
// JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data");
|
|
50
|
58
|
// String shortUrl = signUrlData.get("shortUrl").getAsString();
|
|
|
@@ -274,6 +282,173 @@ public class SignAward {
|
|
274
|
282
|
return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, false);
|
|
275
|
283
|
}
|
|
276
|
284
|
|
|
|
285
|
+ /**
|
|
|
286
|
+ * 发起签署
|
|
|
287
|
+ *
|
|
|
288
|
+ * @return
|
|
|
289
|
+ * @throws EsignDemoException
|
|
|
290
|
+ */
|
|
|
291
|
+ public static EsignHttpResponse createByFileMediation(SealSignRecord sealSignRecord ,List<String> sealIdList) throws EsignDemoException {
|
|
|
292
|
+ String apiaddr = "/v3/sign-flow/create-by-file";
|
|
|
293
|
+
|
|
|
294
|
+ String fileId = sealSignRecord.getFileid();
|
|
|
295
|
+ String fileName = sealSignRecord.getFilename();
|
|
|
296
|
+
|
|
|
297
|
+ String psnAccount = sealSignRecord.getPensonAccount();
|
|
|
298
|
+ String psnName = sealSignRecord.getPensonName();
|
|
|
299
|
+
|
|
|
300
|
+ String psnAccountRes = sealSignRecord.getPensonAccountRes();
|
|
|
301
|
+ String psnNameRes = sealSignRecord.getPensonNameRes();
|
|
|
302
|
+
|
|
|
303
|
+ String orgName = sealSignRecord.getOrgnizeName();
|
|
|
304
|
+ String orgNamePsnAccount = sealSignRecord.getOrgnizeNamePsnAccount();
|
|
|
305
|
+ String orgNamepsnName = sealSignRecord.getOrgnizeNamepsnName();
|
|
|
306
|
+
|
|
|
307
|
+ String positionPagepsn = sealSignRecord.getPositionPagepsn();
|
|
|
308
|
+ double positionXpsn = sealSignRecord.getPositionXpsn();
|
|
|
309
|
+ double positionYpsn = sealSignRecord.getPositionYpsn();
|
|
|
310
|
+
|
|
|
311
|
+ String positionPagepsnRes = sealSignRecord.getPositionPagepsnRes();
|
|
|
312
|
+ double positionXpsnRes = sealSignRecord.getPositionXpsnRes();
|
|
|
313
|
+ double positionYpsnRes = sealSignRecord.getPositionYpsnRes();
|
|
|
314
|
+
|
|
|
315
|
+ String positionPageorg = sealSignRecord.getPositionPageorg();
|
|
|
316
|
+ double positionXorg = sealSignRecord.getPositionXorg();
|
|
|
317
|
+ double positionYorg = sealSignRecord.getPositionYorg();
|
|
|
318
|
+ String availableSealId = "209af82b-5f87-4e0a-b0d8-cc4923b6e652";
|
|
|
319
|
+
|
|
|
320
|
+
|
|
|
321
|
+ String jsonParm = "{\n" +
|
|
|
322
|
+ " \"docs\": [\n" +
|
|
|
323
|
+ " {\n" +
|
|
|
324
|
+ " \"fileId\": \"" + fileId + "\",\n" +
|
|
|
325
|
+ " \"fileName\": \"" + fileName + "\"\n" +
|
|
|
326
|
+ " }\n" +
|
|
|
327
|
+ " ],\n" +
|
|
|
328
|
+ " \"signFlowConfig\": {\n" +
|
|
|
329
|
+ " \"signFlowTitle\": \"测试合同\",\n" +
|
|
|
330
|
+ " \"autoStart\": true,\n" +
|
|
|
331
|
+ " \"authConfig\": {\n" +
|
|
|
332
|
+ " \"willingnessAuthModes\": [\n" +
|
|
|
333
|
+ " \"CODE_SMS\"\n" +
|
|
|
334
|
+ " ],\n" +
|
|
|
335
|
+ " \"psnAvailableAuthModes\": [\n" +
|
|
|
336
|
+ " \"PSN_MOBILE3\"\n" +
|
|
|
337
|
+ " ],\n" +
|
|
|
338
|
+ " \"orgAvailableAuthModes\": [\n" +
|
|
|
339
|
+ " \"ORG_LEGALREP\"\n" +
|
|
|
340
|
+ " ]\n" +
|
|
|
341
|
+ " },\n" +
|
|
|
342
|
+
|
|
|
343
|
+ " \"signConfig\": {\n" +
|
|
|
344
|
+ " \"availableSignClientTypes\": \"1\"\n" +
|
|
|
345
|
+ " },\n" +
|
|
|
346
|
+
|
|
|
347
|
+ " \"autoFinish\": true\n" +
|
|
|
348
|
+ " },\n" +
|
|
|
349
|
+
|
|
|
350
|
+ " \"signers\": [\n" +
|
|
|
351
|
+ " {\n" +
|
|
|
352
|
+ " \"psnSignerInfo\": {\n" +
|
|
|
353
|
+ " \"psnAccount\": \"" + psnAccount + "\",\n" +
|
|
|
354
|
+ " \"psnInfo\": {\n" +
|
|
|
355
|
+ " \"psnName\": \"" + psnName + "\"\n" +
|
|
|
356
|
+ " }\n" +
|
|
|
357
|
+ " },\n" +
|
|
|
358
|
+ " \"signFields\": [\n" +
|
|
|
359
|
+ " {\n" +
|
|
|
360
|
+ " \"fileId\": \"" + fileId + "\",\n" +
|
|
|
361
|
+ " \"normalSignFieldConfig\": {\n" +
|
|
|
362
|
+ " \"autoSign\": false,\n" +
|
|
|
363
|
+ " \"freeMode\": false,\n" +
|
|
|
364
|
+ " \"movableSignField\": false,\n" +
|
|
|
365
|
+ " \"signFieldPosition\": {\n" +
|
|
|
366
|
+ " \"positionPage\": \"" + positionPagepsn + "\",\n" +
|
|
|
367
|
+ " \"positionX\": " + positionXpsn + ",\n" +
|
|
|
368
|
+ " \"positionY\": " + positionYpsn + "\n" +
|
|
|
369
|
+ " },\n" +
|
|
|
370
|
+ " \"signFieldStyle\": 1\n" +
|
|
|
371
|
+ " },\n" +
|
|
|
372
|
+ " \"signFieldType\": 0\n" +
|
|
|
373
|
+ " }\n" +
|
|
|
374
|
+ " ],\n" +
|
|
|
375
|
+ " \"signerType\": 0\n" +
|
|
|
376
|
+ " },\n" +
|
|
|
377
|
+
|
|
|
378
|
+ " {\n" +
|
|
|
379
|
+ " \"psnSignerInfo\": {\n" +
|
|
|
380
|
+ " \"psnAccount\": \"" + psnAccountRes + "\",\n" +
|
|
|
381
|
+ " \"psnInfo\": {\n" +
|
|
|
382
|
+ " \"psnName\": \"" + psnNameRes + "\"\n" +
|
|
|
383
|
+ " }\n" +
|
|
|
384
|
+ " },\n" +
|
|
|
385
|
+ " \"signFields\": [\n" +
|
|
|
386
|
+ " {\n" +
|
|
|
387
|
+ " \"fileId\": \"" + fileId + "\",\n" +
|
|
|
388
|
+ " \"normalSignFieldConfig\": {\n" +
|
|
|
389
|
+ " \"autoSign\": false,\n" +
|
|
|
390
|
+ " \"freeMode\": false,\n" +
|
|
|
391
|
+ " \"movableSignField\": false,\n" +
|
|
|
392
|
+ " \"signFieldPosition\": {\n" +
|
|
|
393
|
+ " \"positionPage\": \"" + positionPagepsnRes + "\",\n" +
|
|
|
394
|
+ " \"positionX\": " + positionXpsnRes + ",\n" +
|
|
|
395
|
+ " \"positionY\": " + positionYpsnRes + "\n" +
|
|
|
396
|
+ " },\n" +
|
|
|
397
|
+ " \"signFieldStyle\": 1\n" +
|
|
|
398
|
+ " },\n" +
|
|
|
399
|
+ " \"signFieldType\": 0\n" +
|
|
|
400
|
+ " }\n" +
|
|
|
401
|
+ " ],\n" +
|
|
|
402
|
+ " \"signerType\": 0\n" +
|
|
|
403
|
+ " },\n" +
|
|
|
404
|
+
|
|
|
405
|
+ " {\n" +
|
|
|
406
|
+ " \"orgSignerInfo\": {\n" +
|
|
|
407
|
+ " \"orgName\": \"" + orgName + "\",\n" +
|
|
|
408
|
+ " \"transactorInfo\": {\n" +
|
|
|
409
|
+ " \"psnAccount\": \"" + orgNamePsnAccount + "\",\n" +
|
|
|
410
|
+ " \"psnInfo\": {\n" +
|
|
|
411
|
+ " \"psnName\": \"" + orgNamepsnName + "\"\n" +
|
|
|
412
|
+ " }\n" +
|
|
|
413
|
+ " }\n" +
|
|
|
414
|
+ " },\n" +
|
|
|
415
|
+
|
|
|
416
|
+ " \"signFields\": [\n" +
|
|
|
417
|
+ " {\n" +
|
|
|
418
|
+ " \"fileId\": \"" + fileId + "\",\n" +
|
|
|
419
|
+ " \"normalSignFieldConfig\": {\n" +
|
|
|
420
|
+ " \"autoSign\": false,\n" +
|
|
|
421
|
+ " \"freeMode\": false,\n" +
|
|
|
422
|
+
|
|
|
423
|
+ /* " \"availableSealIds\": [\n" +
|
|
|
424
|
+ " \"" + availableSealId + "\"\n" +
|
|
|
425
|
+ " ],\n" +*/
|
|
|
426
|
+ // " \"availableSealIds\": " + new Gson().toJson(sealIdList) + ",\n" +
|
|
|
427
|
+
|
|
|
428
|
+ " \"signFieldPosition\": {\n" +
|
|
|
429
|
+ " \"positionPage\": \"" + positionPageorg + "\",\n" +
|
|
|
430
|
+ " \"positionX\": " + positionXorg + ",\n" +
|
|
|
431
|
+ " \"positionY\": " + positionYorg + "\n" +
|
|
|
432
|
+ " },\n" +
|
|
|
433
|
+ " \"signFieldStyle\": 1\n" +
|
|
|
434
|
+ " },\n" +
|
|
|
435
|
+ " \"signFieldType\": 0\n" +
|
|
|
436
|
+ " }\n" +
|
|
|
437
|
+ " ],\n" +
|
|
|
438
|
+ " \"signerType\": 1\n" +
|
|
|
439
|
+ " }\n" +
|
|
|
440
|
+
|
|
|
441
|
+ " ]\n" +
|
|
|
442
|
+ "}";
|
|
|
443
|
+
|
|
|
444
|
+ //请求方法
|
|
|
445
|
+ EsignRequestType requestType = EsignRequestType.POST;
|
|
|
446
|
+ //生成请求签名鉴权方式的Header
|
|
|
447
|
+ Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, false);
|
|
|
448
|
+ //发起接口请求
|
|
|
449
|
+ return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, false);
|
|
|
450
|
+ }
|
|
|
451
|
+
|
|
277
|
452
|
/**
|
|
278
|
453
|
* 获取合同文件签名链接
|
|
279
|
454
|
*
|
|
|
@@ -301,6 +476,35 @@ public class SignAward {
|
|
301
|
476
|
//发起接口请求
|
|
302
|
477
|
return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, false);
|
|
303
|
478
|
}
|
|
|
479
|
+
|
|
|
480
|
+ /**
|
|
|
481
|
+ * 获取合同文件移动端签名链接
|
|
|
482
|
+ *
|
|
|
483
|
+ * @return
|
|
|
484
|
+ * @throws EsignDemoException
|
|
|
485
|
+ */
|
|
|
486
|
+ public static EsignHttpResponse signUrlMediation(SealSignRecord sealSignRecord) throws EsignDemoException {
|
|
|
487
|
+
|
|
|
488
|
+ String signFlowId = sealSignRecord.getSignFlowid();
|
|
|
489
|
+ String psnAccount = sealSignRecord.getPensonAccount();
|
|
|
490
|
+
|
|
|
491
|
+ String apiaddr = "/v3/sign-flow/" + signFlowId + "/sign-url";
|
|
|
492
|
+ String jsonParm = "{\n" +
|
|
|
493
|
+
|
|
|
494
|
+ " \"clientType\": \"H5\",\n" +
|
|
|
495
|
+
|
|
|
496
|
+ " \"operator\": {\n" +
|
|
|
497
|
+ " \"psnAccount\": \"" + psnAccount + "\"\n" +
|
|
|
498
|
+ " }\n" +
|
|
|
499
|
+ "}";
|
|
|
500
|
+ //请求方法
|
|
|
501
|
+ EsignRequestType requestType = EsignRequestType.POST;
|
|
|
502
|
+ //生成请求签名鉴权方式的Header
|
|
|
503
|
+ Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, false);
|
|
|
504
|
+ //发起接口请求
|
|
|
505
|
+ return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, false);
|
|
|
506
|
+ }
|
|
|
507
|
+
|
|
304
|
508
|
/**
|
|
305
|
509
|
* 获取批量签页面链接
|
|
306
|
510
|
*
|
|
|
@@ -474,6 +678,30 @@ public class SignAward {
|
|
474
|
678
|
return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, false);
|
|
475
|
679
|
}
|
|
476
|
680
|
|
|
|
681
|
+ /**
|
|
|
682
|
+ * 获取文件签名印章位置
|
|
|
683
|
+ *
|
|
|
684
|
+ * @return
|
|
|
685
|
+ * @throws EsignDemoException
|
|
|
686
|
+ */
|
|
|
687
|
+ public static EsignHttpResponse getPositionsMediation(SealSignRecord sealSignRecord) throws EsignDemoException {
|
|
|
688
|
+ String fileId = sealSignRecord.getFileid();
|
|
|
689
|
+ String apiaddr = "/v3/files/" + fileId + "/keyword-positions";
|
|
|
690
|
+ String jsonParm = "{\n" +
|
|
|
691
|
+ " \"keywords\": [\n" +
|
|
|
692
|
+ " \"申请人:\",\n" +
|
|
|
693
|
+ " \"被申请人:\",\n" +
|
|
|
694
|
+ " \"(盖章)\"\n" +
|
|
|
695
|
+ " ]\n" +
|
|
|
696
|
+ "}";
|
|
|
697
|
+ //请求方法
|
|
|
698
|
+ EsignRequestType requestType = EsignRequestType.POST;
|
|
|
699
|
+ //生成请求签名鉴权方式的Header
|
|
|
700
|
+ Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, false);
|
|
|
701
|
+ //发起接口请求
|
|
|
702
|
+ return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, false);
|
|
|
703
|
+ }
|
|
|
704
|
+
|
|
477
|
705
|
/**
|
|
478
|
706
|
* 创建机构图片印章
|
|
479
|
707
|
*
|