hejinbo 2 lat temu
rodzic
commit
94d3f1cb1e

+ 12
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/DeptIdentifyController.java Wyświetl plik

13
 import org.springframework.beans.factory.annotation.Autowired;
13
 import org.springframework.beans.factory.annotation.Autowired;
14
 import org.springframework.validation.annotation.Validated;
14
 import org.springframework.validation.annotation.Validated;
15
 import org.springframework.web.bind.annotation.*;
15
 import org.springframework.web.bind.annotation.*;
16
+import org.springframework.web.multipart.MultipartFile;
16
 
17
 
17
 import java.util.List;
18
 import java.util.List;
18
 
19
 
49
         return deptIdentifyService.enableDept(deptIdentify);
50
         return deptIdentifyService.enableDept(deptIdentify);
50
     }
51
     }
51
 
52
 
53
+    /**
54
+     * 上传自定义公章
55
+     * @param deptIdentify
56
+     * @param file
57
+     * @return
58
+     */
59
+    @PostMapping("sealUpload")
60
+    public AjaxResult  sealUpload(@Validated @RequestBody DeptIdentify deptIdentify
61
+            ,@RequestParam("file") MultipartFile file){
62
+        return deptIdentifyService.sealUpload(deptIdentify,file);
63
+    }
52
 
64
 
53
 
65
 
54
 
66
 

+ 1
- 2
ruoyi-common/src/main/java/com/ruoyi/common/utils/SealUtil.java Wyświetl plik

80
      *
80
      *
81
      * @return
81
      * @return
82
      */
82
      */
83
-    public static EsignHttpResponse getFileUploadUrl() throws EsignDemoException {
83
+    public static EsignHttpResponse getFileUploadUrl(String filePath) throws EsignDemoException {
84
         //自定义的文件封装类,传入文件地址可以获取文件的名称大小,文件流等数据
84
         //自定义的文件封装类,传入文件地址可以获取文件的名称大小,文件流等数据
85
-        String filePath = "D:\\develop\\Snipaste_2023-10-27_09-59-23.jpg";
86
         EsignFileBean esignFileBean = new EsignFileBean(filePath);
85
         EsignFileBean esignFileBean = new EsignFileBean(filePath);
87
         String apiaddr="/v3/files/file-key";
86
         String apiaddr="/v3/files/file-key";
88
         //请求参数body体,json格式。get或者delete请求时jsonString传空json:"{}"或者null
87
         //请求参数body体,json格式。get或者delete请求时jsonString传空json:"{}"或者null

+ 4
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseAttach.java Wyświetl plik

42
      * 用户账户
42
      * 用户账户
43
      */
43
      */
44
     private String userName;
44
     private String userName;
45
+    /**
46
+     * 印章状态(0未启用,1已启用)
47
+     */
48
+    private Integer sealStatus;
45
 
49
 
46
 }
50
 }

+ 24
- 1
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/DeptIdentify.java Wyświetl plik

2
 
2
 
3
 import com.fasterxml.jackson.annotation.JsonFormat;
3
 import com.fasterxml.jackson.annotation.JsonFormat;
4
 import com.ruoyi.common.core.domain.BaseEntity;
4
 import com.ruoyi.common.core.domain.BaseEntity;
5
-
6
 import java.util.Date;
5
 import java.util.Date;
7
 
6
 
8
 public class DeptIdentify   extends BaseEntity {
7
 public class DeptIdentify   extends BaseEntity {
39
     /** 认证授权流程ID */
38
     /** 认证授权流程ID */
40
     private String authFlowId;
39
     private String authFlowId;
41
 
40
 
41
+    public String getSealId() {
42
+        return sealId;
43
+    }
44
+
45
+    public void setSealId(String sealId) {
46
+        this.sealId = sealId;
47
+    }
48
+
49
+    /** 印章id */
50
+    private String sealId;
51
+
52
+    /**
53
+     * 附件id
54
+     */
55
+    private Integer annexId;
56
+
57
+    public Integer getAnnexId() {
58
+        return annexId;
59
+    }
60
+
61
+    public void setAnnexId(Integer annexId) {
62
+        this.annexId = annexId;
63
+    }
64
+
42
     public String getAuthFlowId() {
65
     public String getAuthFlowId() {
43
         return authFlowId;
66
         return authFlowId;
44
     }
67
     }

+ 5
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IDeptIdentifyService.java Wyświetl plik

3
 import com.ruoyi.common.core.domain.AjaxResult;
3
 import com.ruoyi.common.core.domain.AjaxResult;
4
 import com.ruoyi.common.exception.EsignDemoException;
4
 import com.ruoyi.common.exception.EsignDemoException;
5
 import com.ruoyi.wisdomarbitrate.domain.DeptIdentify;
5
 import com.ruoyi.wisdomarbitrate.domain.DeptIdentify;
6
+import org.springframework.web.multipart.MultipartFile;
6
 
7
 
7
 import java.util.List;
8
 import java.util.List;
8
 
9
 
15
     DeptIdentify selectDeptIndefiUrl(DeptIdentify deptIdentify) throws EsignDemoException;
16
     DeptIdentify selectDeptIndefiUrl(DeptIdentify deptIdentify) throws EsignDemoException;
16
 
17
 
17
     AjaxResult enableDept(DeptIdentify deptIdentify);
18
     AjaxResult enableDept(DeptIdentify deptIdentify);
19
+
20
+    AjaxResult sealUpload(DeptIdentify deptIdentify, MultipartFile file);
21
+
22
+
18
 }
23
 }

+ 68
- 10
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DeptIdentifyServiceImpl.java Wyświetl plik

1
 package com.ruoyi.wisdomarbitrate.service.impl;
1
 package com.ruoyi.wisdomarbitrate.service.impl;
2
 
2
 
3
+import com.alibaba.fastjson.JSONObject;
3
 import com.google.gson.Gson;
4
 import com.google.gson.Gson;
4
 import com.google.gson.JsonObject;
5
 import com.google.gson.JsonObject;
6
+import com.ruoyi.common.config.RuoYiConfig;
5
 import com.ruoyi.common.core.domain.AjaxResult;
7
 import com.ruoyi.common.core.domain.AjaxResult;
6
 import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
8
 import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
7
 import com.ruoyi.common.exception.EsignDemoException;
9
 import com.ruoyi.common.exception.EsignDemoException;
10
+import com.ruoyi.common.utils.SealUtil;
11
+import com.ruoyi.common.utils.file.FileUploadUtils;
12
+import com.ruoyi.wisdomarbitrate.domain.CaseAttach;
8
 import com.ruoyi.wisdomarbitrate.domain.DeptIdentify;
13
 import com.ruoyi.wisdomarbitrate.domain.DeptIdentify;
14
+import com.ruoyi.wisdomarbitrate.mapper.CaseAttachMapper;
9
 import com.ruoyi.wisdomarbitrate.mapper.DeptIdentifyMapper;
15
 import com.ruoyi.wisdomarbitrate.mapper.DeptIdentifyMapper;
10
 import com.ruoyi.wisdomarbitrate.service.IDeptIdentifyService;
16
 import com.ruoyi.wisdomarbitrate.service.IDeptIdentifyService;
11
 import com.ruoyi.wisdomarbitrate.utils.SignAward;
17
 import com.ruoyi.wisdomarbitrate.utils.SignAward;
12
 import org.springframework.beans.factory.annotation.Autowired;
18
 import org.springframework.beans.factory.annotation.Autowired;
13
 import org.springframework.stereotype.Service;
19
 import org.springframework.stereotype.Service;
14
 import org.springframework.transaction.annotation.Transactional;
20
 import org.springframework.transaction.annotation.Transactional;
21
+import org.springframework.web.multipart.MultipartFile;
15
 
22
 
23
+import java.io.IOException;
16
 import java.util.Date;
24
 import java.util.Date;
17
 import java.util.List;
25
 import java.util.List;
18
 
26
 
21
 
29
 
22
     @Autowired
30
     @Autowired
23
     private DeptIdentifyMapper deptIdentifyMapper;
31
     private DeptIdentifyMapper deptIdentifyMapper;
32
+    @Autowired
33
+    private CaseAttachMapper caseAttachMapper;
24
 
34
 
25
 
35
 
26
     @Override
36
     @Override
27
     @Transactional
37
     @Transactional
28
     public List<DeptIdentify> selectDeptIdentify(DeptIdentify deptIdentify) {
38
     public List<DeptIdentify> selectDeptIdentify(DeptIdentify deptIdentify) {
29
         List<DeptIdentify> deptIdentifys = deptIdentifyMapper.selectDeptIdentify(deptIdentify);
39
         List<DeptIdentify> deptIdentifys = deptIdentifyMapper.selectDeptIdentify(deptIdentify);
30
-        if(deptIdentifys!=null&&deptIdentifys.size()>0){
40
+        if (deptIdentifys != null && deptIdentifys.size() > 0) {
31
             for (int i = 0; i < deptIdentifys.size(); i++) {
41
             for (int i = 0; i < deptIdentifys.size(); i++) {
32
                 DeptIdentify deptIdentifyselect = deptIdentifys.get(i);
42
                 DeptIdentify deptIdentifyselect = deptIdentifys.get(i);
33
                 List<DeptIdentify> deptIdentifylist = deptIdentifyMapper.selectDeptIdentifyBydeptid(deptIdentifyselect);
43
                 List<DeptIdentify> deptIdentifylist = deptIdentifyMapper.selectDeptIdentifyBydeptid(deptIdentifyselect);
34
-                if(deptIdentifylist!=null&&deptIdentifylist.size()>0){
44
+                if (deptIdentifylist != null && deptIdentifylist.size() > 0) {
35
                     continue;
45
                     continue;
36
-                }else {
46
+                } else {
37
                     deptIdentifyselect.setIdentifyStatus(0);
47
                     deptIdentifyselect.setIdentifyStatus(0);
38
                     deptIdentifyMapper.insertDeptIdentify(deptIdentifyselect);
48
                     deptIdentifyMapper.insertDeptIdentify(deptIdentifyselect);
39
                 }
49
                 }
49
     public DeptIdentify selectDeptIndefiUrl(DeptIdentify deptIdentify) throws EsignDemoException {
59
     public DeptIdentify selectDeptIndefiUrl(DeptIdentify deptIdentify) throws EsignDemoException {
50
         List<DeptIdentify> deptIdentifysnew = deptIdentifyMapper.selectDeptIdentifylist(deptIdentify);
60
         List<DeptIdentify> deptIdentifysnew = deptIdentifyMapper.selectDeptIdentifylist(deptIdentify);
51
         DeptIdentify deptIdentifynew = new DeptIdentify();
61
         DeptIdentify deptIdentifynew = new DeptIdentify();
52
-        if(deptIdentifysnew!=null&&deptIdentifysnew.size()>0){
62
+        if (deptIdentifysnew != null && deptIdentifysnew.size() > 0) {
53
             Gson gson = new Gson();
63
             Gson gson = new Gson();
54
             DeptIdentify deptIdentifyselect = deptIdentifysnew.get(0);
64
             DeptIdentify deptIdentifyselect = deptIdentifysnew.get(0);
55
             EsignHttpResponse identifyUrl = SignAward.deptIdentifyUrl(deptIdentifyselect);
65
             EsignHttpResponse identifyUrl = SignAward.deptIdentifyUrl(deptIdentifyselect);
56
             JsonObject signUrlJsonObject = gson.fromJson(identifyUrl.getBody(), JsonObject.class);
66
             JsonObject signUrlJsonObject = gson.fromJson(identifyUrl.getBody(), JsonObject.class);
67
+            int code = signUrlJsonObject.get("code").getAsInt();
57
             JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data");
68
             JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data");
58
             String url = signUrlData.get("authUrl").getAsString();
69
             String url = signUrlData.get("authUrl").getAsString();
59
             //获取本次认证授权流程ID
70
             //获取本次认证授权流程ID
60
             String authFlowId = signUrlData.get("authFlowId").getAsString();
71
             String authFlowId = signUrlData.get("authFlowId").getAsString();
61
             deptIdentify.setAuthFlowId(authFlowId);
72
             deptIdentify.setAuthFlowId(authFlowId);
62
             deptIdentifynew.setIdentifyUrl(url);
73
             deptIdentifynew.setIdentifyUrl(url);
74
+            deptIdentify.setIdentifyDate(new Date());
75
+            int row = deptIdentifyMapper.updateDeptIdentify(deptIdentify);
63
         }
76
         }
64
-
65
-        deptIdentify.setIdentifyDate(new Date());
66
-        int row = deptIdentifyMapper.updateDeptIdentify(deptIdentify);
67
         return deptIdentifynew;
77
         return deptIdentifynew;
68
     }
78
     }
69
 
79
 
73
         List<DeptIdentify> deptIdentifysnew = deptIdentifyMapper.selectDeptIdentifylist(deptIdentify);
83
         List<DeptIdentify> deptIdentifysnew = deptIdentifyMapper.selectDeptIdentifylist(deptIdentify);
74
         DeptIdentify deptIdentifyselect = deptIdentifysnew.get(0);
84
         DeptIdentify deptIdentifyselect = deptIdentifysnew.get(0);
75
         Integer identifyStatus = deptIdentifyselect.getIdentifyStatus();
85
         Integer identifyStatus = deptIdentifyselect.getIdentifyStatus();
76
-        if(identifyStatus.intValue()==0){
86
+        if (identifyStatus.intValue() == 0) {
77
             return AjaxResult.error("这个认证数据未进行认证,不能启用");
87
             return AjaxResult.error("这个认证数据未进行认证,不能启用");
78
-        }else if(identifyStatus.intValue()==1){
88
+        } else if (identifyStatus.intValue() == 1) {
79
             deptIdentifyselect.setIsUse(1);
89
             deptIdentifyselect.setIsUse(1);
80
             deptIdentifyMapper.updateDeptIdentify(deptIdentifyselect);
90
             deptIdentifyMapper.updateDeptIdentify(deptIdentifyselect);
81
 
91
 
83
             deptIdentifySel.setId(deptIdentify.getId());
93
             deptIdentifySel.setId(deptIdentify.getId());
84
             deptIdentifySel.setIdentifyStatus(1);
94
             deptIdentifySel.setIdentifyStatus(1);
85
             List<DeptIdentify> deptIdentifysother = deptIdentifyMapper.selectDeptIdentifylistother(deptIdentifySel);
95
             List<DeptIdentify> deptIdentifysother = deptIdentifyMapper.selectDeptIdentifylistother(deptIdentifySel);
86
-            if(deptIdentifysother!=null&&deptIdentifysother.size()>0){
96
+            if (deptIdentifysother != null && deptIdentifysother.size() > 0) {
87
                 for (int i = 0; i < deptIdentifysother.size(); i++) {
97
                 for (int i = 0; i < deptIdentifysother.size(); i++) {
88
                     DeptIdentify deptIdentifyother = deptIdentifysother.get(i);
98
                     DeptIdentify deptIdentifyother = deptIdentifysother.get(i);
89
                     deptIdentifyother.setIsUse(0);
99
                     deptIdentifyother.setIsUse(0);
96
 
106
 
97
     }
107
     }
98
 
108
 
109
+    @Override
110
+    public AjaxResult sealUpload(DeptIdentify deptIdentify, MultipartFile file) {
111
+        try {
112
+            if (file.isEmpty()) {
113
+                return AjaxResult.error("请选择要上传的文件");
114
+            }
115
+            String filePath = RuoYiConfig.getUploadPath();
116
+            // 上传
117
+            String fileName = FileUploadUtils.upload(filePath, file);
118
+            List<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentifyBydeptid(deptIdentify);
119
+            if (deptIdentifies != null && deptIdentifies.size() > 0) {
120
+                for (DeptIdentify identify : deptIdentifies) {
121
+                    //先判断企业用户是否授予资源管理权限
122
+                    String authFlowId = identify.getAuthFlowId();
123
+                    EsignHttpResponse response1 = SealUtil.queryAuthProcess(authFlowId);
124
+                    JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody());
125
+                    int authorizedStatus = jsonObject1.getJSONObject("data").getIntValue("authorizedStatus");
126
+                    if (authorizedStatus == 1){//授权流程状态 0流程过期失效  1已授权 2授权中  3审批未通过
127
+                        String prefix = "/profile";
128
+                        int startIndex = fileName.indexOf(prefix);
129
+                        startIndex += prefix.length();
130
+                        String annexPath = "/uploadPath" + fileName.substring(startIndex);
131
+                        //创建机构图片印章
132
+                        EsignHttpResponse response = SignAward.createOrgByImage(identify, annexPath);
133
+                        JSONObject jsonObject = JSONObject.parseObject(response.getBody());
134
+                        int code = jsonObject.getIntValue("code");
135
+                        if (code == 0) {  //业务码,0表示成功,非0表示异常。
136
+                            String sealId = jsonObject.getJSONObject("data").getString("sealId");
137
+                            identify.setSealId(sealId);
138
+                            identify.setIsUse(0);  //设置印章使用状态为未启用
139
+                            //保存到表里
140
+                            int i = deptIdentifyMapper.updateDeptIdentify(identify);
141
+                            if (i>0){
142
+                                return AjaxResult.success("上传成功");
143
+                            }
144
+                        }
145
+                    }
146
+                    return AjaxResult.error("企业用户未授予资源管理权限");
147
+                }
148
+            }
149
+        } catch (IOException e) {
150
+            e.printStackTrace();
151
+        } catch (EsignDemoException e) {
152
+            e.printStackTrace();
153
+        }
154
+            return AjaxResult.error();
155
+    }
156
+
99
 
157
 
100
 }
158
 }

+ 116
- 39
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/FixSelectFlowDetailUtils.java Wyświetl plik

1
 package com.ruoyi.wisdomarbitrate.utils;
1
 package com.ruoyi.wisdomarbitrate.utils;
2
 
2
 
3
+import com.alibaba.fastjson.JSONArray;
4
+import com.alibaba.fastjson.JSONObject;
3
 import com.google.gson.Gson;
5
 import com.google.gson.Gson;
4
 import com.google.gson.JsonArray;
6
 import com.google.gson.JsonArray;
5
 import com.google.gson.JsonObject;
7
 import com.google.gson.JsonObject;
42
 
44
 
43
     @Scheduled(cron = "0/10 * * * * ?")
45
     @Scheduled(cron = "0/10 * * * * ?")
44
     @Transactional
46
     @Transactional
45
-    public void fixExecuteSelectFlowDetailUtils(){
47
+    public void fixExecuteSelectFlowDetailUtils() {
46
         Gson gson = new Gson();
48
         Gson gson = new Gson();
47
 
49
 
48
         SealSignRecord sealSignRecordselect = new SealSignRecord();
50
         SealSignRecord sealSignRecordselect = new SealSignRecord();
50
         List<SealSignRecord> sealSignRecords = sealSignRecordMapper.selectSealSignRecordbyStat(sealSignRecordselect);
52
         List<SealSignRecord> sealSignRecords = sealSignRecordMapper.selectSealSignRecordbyStat(sealSignRecordselect);
51
 
53
 
52
         try {
54
         try {
53
-            if(sealSignRecords!=null&&sealSignRecords.size()>0){
55
+            if (sealSignRecords != null && sealSignRecords.size() > 0) {
54
                 for (int i = 0; i < sealSignRecords.size(); i++) {
56
                 for (int i = 0; i < sealSignRecords.size(); i++) {
55
                     SealSignRecord sealSignRecord = sealSignRecords.get(i);
57
                     SealSignRecord sealSignRecord = sealSignRecords.get(i);
56
                     EsignHttpResponse signFlowDetail = SignAward.signFlowDetail(sealSignRecord);
58
                     EsignHttpResponse signFlowDetail = SignAward.signFlowDetail(sealSignRecord);
57
-                    JsonObject signFlowDetailJsonObject = gson.fromJson(signFlowDetail.getBody(),JsonObject.class);
59
+                    JsonObject signFlowDetailJsonObject = gson.fromJson(signFlowDetail.getBody(), JsonObject.class);
58
                     JsonObject flowDetailData = signFlowDetailJsonObject.getAsJsonObject("data");
60
                     JsonObject flowDetailData = signFlowDetailJsonObject.getAsJsonObject("data");
59
                     JsonArray signersArray = flowDetailData.get("signers").getAsJsonArray();
61
                     JsonArray signersArray = flowDetailData.get("signers").getAsJsonArray();
60
                     Integer psnsignStatus = null;
62
                     Integer psnsignStatus = null;
61
                     Integer orgsignStatus = null;
63
                     Integer orgsignStatus = null;
62
                     for (int j = 0; j < signersArray.size(); j++) {
64
                     for (int j = 0; j < signersArray.size(); j++) {
63
-                        JsonObject signerObject = (JsonObject)signersArray.get(j);
65
+                        JsonObject signerObject = (JsonObject) signersArray.get(j);
64
 
66
 
65
-                        if(!(signerObject.get("psnSigner").toString()).equals("null")){
67
+                        if (!(signerObject.get("psnSigner").toString()).equals("null")) {
66
                             JsonObject psnSignerData = signerObject.getAsJsonObject("psnSigner");
68
                             JsonObject psnSignerData = signerObject.getAsJsonObject("psnSigner");
67
-                            if(psnSignerData!=null){
69
+                            if (psnSignerData != null) {
68
                                 psnsignStatus = signerObject.get("signStatus").getAsInt();
70
                                 psnsignStatus = signerObject.get("signStatus").getAsInt();
69
                             }
71
                             }
70
                         }
72
                         }
71
-                        if(!(signerObject.get("orgSigner").toString()).equals("null")){
73
+                        if (!(signerObject.get("orgSigner").toString()).equals("null")) {
72
                             JsonObject orgSignerData = signerObject.getAsJsonObject("orgSigner");
74
                             JsonObject orgSignerData = signerObject.getAsJsonObject("orgSigner");
73
-                            if(orgSignerData!=null){
75
+                            if (orgSignerData != null) {
74
                                 orgsignStatus = signerObject.get("signStatus").getAsInt();
76
                                 orgsignStatus = signerObject.get("signStatus").getAsInt();
75
                             }
77
                             }
76
                         }
78
                         }
77
 
79
 
78
                     }
80
                     }
79
-                    if((psnsignStatus.intValue()==2)&&(orgsignStatus.intValue()==1)){
81
+                    if ((psnsignStatus.intValue() == 2) && (orgsignStatus.intValue() == 1)) {
80
                         //更新立案申请状态为待用印
82
                         //更新立案申请状态为待用印
81
                         CaseApplication caseApplication = new CaseApplication();
83
                         CaseApplication caseApplication = new CaseApplication();
82
                         caseApplication.setId(sealSignRecord.getCaseAppliId());
84
                         caseApplication.setId(sealSignRecord.getCaseAppliId());
83
 
85
 
84
                         CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication);
86
                         CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication);
85
-                        if(caseApplicationselect!=null){
86
-                            if((caseApplicationselect.getCaseStatus()!=null)&&(caseApplicationselect.getCaseStatus().intValue()==CaseApplicationConstants.SIGN_ARBITRATION)){
87
+                        if (caseApplicationselect != null) {
88
+                            if ((caseApplicationselect.getCaseStatus() != null) && (caseApplicationselect.getCaseStatus().intValue() == CaseApplicationConstants.SIGN_ARBITRATION)) {
87
                                 caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATED_SEAL);
89
                                 caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATED_SEAL);
88
                                 caseApplicationMapper.submitCaseApplication(caseApplication);
90
                                 caseApplicationMapper.submitCaseApplication(caseApplication);
89
 
91
 
94
                         }
96
                         }
95
 
97
 
96
                     }
98
                     }
97
-                    if((psnsignStatus.intValue()==2)&&(orgsignStatus.intValue()==2)){
99
+                    if ((psnsignStatus.intValue() == 2) && (orgsignStatus.intValue() == 2)) {
98
                         //更新立案申请状态为待送达
100
                         //更新立案申请状态为待送达
99
                         CaseApplication caseApplication = new CaseApplication();
101
                         CaseApplication caseApplication = new CaseApplication();
100
                         caseApplication.setId(sealSignRecord.getCaseAppliId());
102
                         caseApplication.setId(sealSignRecord.getCaseAppliId());
101
 
103
 
102
                         CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication);
104
                         CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication);
103
-                        if(caseApplicationselect!=null){
104
-                            if((caseApplicationselect.getCaseStatus()!=null)&&(caseApplicationselect.getCaseStatus().intValue()==CaseApplicationConstants.ARBITRATED_SEAL)){
105
+                        if (caseApplicationselect != null) {
106
+                            if ((caseApplicationselect.getCaseStatus() != null) && (caseApplicationselect.getCaseStatus().intValue() == CaseApplicationConstants.ARBITRATED_SEAL)) {
105
                                 caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATION_DELIVERY);
107
                                 caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATION_DELIVERY);
106
                                 //下载审核完成的裁决书,
108
                                 //下载审核完成的裁决书,
107
                                 String signFlowId = sealSignRecord.getSignFlowid();
109
                                 String signFlowId = sealSignRecord.getSignFlowid();
108
                                 EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId);
110
                                 EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId);
109
-                                JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(),JsonObject.class);
111
+                                JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class);
110
                                 JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data");
112
                                 JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data");
111
                                 JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray();
113
                                 JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray();
112
-                                if(filesArray!=null&&filesArray.size()>0){
113
-                                    JsonObject fileObject = (JsonObject)filesArray.get(0);
114
+                                if (filesArray != null && filesArray.size() > 0) {
115
+                                    JsonObject fileObject = (JsonObject) filesArray.get(0);
114
                                     String fileDownloadUrl = fileObject.get("downloadUrl").toString();
116
                                     String fileDownloadUrl = fileObject.get("downloadUrl").toString();
115
                                     //修改"签署用印记录表"的状态为签署完成
117
                                     //修改"签署用印记录表"的状态为签署完成
116
                                     sealSignRecord.setSignFlowStatus(3);
118
                                     sealSignRecord.setSignFlowStatus(3);
117
-                                    sealSignRecord.setFileDownloadUrl(fileDownloadUrl.substring(1,fileDownloadUrl.length()-1));
119
+                                    sealSignRecord.setFileDownloadUrl(fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1));
118
                                     sealSignRecordMapper.updataSealSignRecord(sealSignRecord);
120
                                     sealSignRecordMapper.updataSealSignRecord(sealSignRecord);
119
 
121
 
120
-                                    String filearbitraUrl  = fileDownloadUrl.substring(1,fileDownloadUrl.length()-1);
122
+                                    String filearbitraUrl = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1);
121
                                     caseApplication.setFilearbitraUrl(filearbitraUrl);
123
                                     caseApplication.setFilearbitraUrl(filearbitraUrl);
122
                                     caseApplicationMapper.submitCaseApplication(caseApplication);
124
                                     caseApplicationMapper.submitCaseApplication(caseApplication);
123
 
125
 
136
                                         saveFolder.mkdirs();
138
                                         saveFolder.mkdirs();
137
                                     }
139
                                     }
138
                                     String resultFilePath = saveFolderPath + "/" + fileName;
140
                                     String resultFilePath = saveFolderPath + "/" + fileName;
139
-                                    File resultFilePathFile  = new File(resultFilePath);
141
+                                    File resultFilePathFile = new File(resultFilePath);
140
                                     if (!resultFilePathFile.exists()) {
142
                                     if (!resultFilePathFile.exists()) {
141
                                         resultFilePathFile.createNewFile();
143
                                         resultFilePathFile.createNewFile();
142
                                     }
144
                                     }
143
 
145
 
144
-                                   String fileDownloadUrlnew  = fileDownloadUrl.substring(1,fileDownloadUrl.length()-1);
145
-                                   boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath);
146
-                                   if(downLoadFile) {
147
-                                       Long caseAppliId = sealSignRecord.getCaseAppliId();
148
-                                       CaseAttach caseAttach = new CaseAttach();
149
-                                       caseAttach.setCaseAppliId(caseAppliId);
150
-                                       caseAttach.setAnnexType(3);
151
-                                       caseAttach.setAnnexPath(savePath);
152
-                                       caseAttach.setAnnexName(saveName);
153
-                                       caseAttachMapper.updateCaseAttachBycaseid(caseAttach);
154
-                                   }
146
+                                    String fileDownloadUrlnew = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1);
147
+                                    boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath);
148
+                                    if (downLoadFile) {
149
+                                        Long caseAppliId = sealSignRecord.getCaseAppliId();
150
+                                        CaseAttach caseAttach = new CaseAttach();
151
+                                        caseAttach.setCaseAppliId(caseAppliId);
152
+                                        caseAttach.setAnnexType(3);
153
+                                        caseAttach.setAnnexPath(savePath);
154
+                                        caseAttach.setAnnexName(saveName);
155
+                                        caseAttachMapper.updateCaseAttachBycaseid(caseAttach);
156
+                                    }
155
 
157
 
156
                                 }
158
                                 }
157
                             }
159
                             }
163
             }
165
             }
164
         } catch (EsignDemoException e) {
166
         } catch (EsignDemoException e) {
165
             e.printStackTrace();
167
             e.printStackTrace();
166
-        }catch (IOException e) {
168
+        } catch (IOException e) {
167
             e.printStackTrace();
169
             e.printStackTrace();
168
         }
170
         }
169
 
171
 
176
         DeptIdentify deptIdentify = new DeptIdentify();
178
         DeptIdentify deptIdentify = new DeptIdentify();
177
         deptIdentify.setIdentifyStatus(0);
179
         deptIdentify.setIdentifyStatus(0);
178
         List<DeptIdentify> deptIdentifysnew = deptIdentifyMapper.selectDeptIdentifylist(deptIdentify);
180
         List<DeptIdentify> deptIdentifysnew = deptIdentifyMapper.selectDeptIdentifylist(deptIdentify);
179
-        if(deptIdentifysnew!=null&&deptIdentifysnew.size()>0){
181
+        if (deptIdentifysnew != null && deptIdentifysnew.size() > 0) {
180
             for (int i = 0; i < deptIdentifysnew.size(); i++) {
182
             for (int i = 0; i < deptIdentifysnew.size(); i++) {
181
                 EsignHttpResponse identifyInfo = SignAward.getDeptIdentifyInfo(deptIdentifysnew.get(i));
183
                 EsignHttpResponse identifyInfo = SignAward.getDeptIdentifyInfo(deptIdentifysnew.get(i));
182
                 JsonObject identifyInfoJsonObject = gson.fromJson(identifyInfo.getBody(), JsonObject.class);
184
                 JsonObject identifyInfoJsonObject = gson.fromJson(identifyInfo.getBody(), JsonObject.class);
183
                 JsonObject identifyInfoData = identifyInfoJsonObject.getAsJsonObject("data");
185
                 JsonObject identifyInfoData = identifyInfoJsonObject.getAsJsonObject("data");
184
                 int realnameStatus = identifyInfoData.get("realnameStatus").getAsInt();
186
                 int realnameStatus = identifyInfoData.get("realnameStatus").getAsInt();
185
-                if(realnameStatus==1){
187
+                if (realnameStatus == 1) {
186
                     String orgId = identifyInfoData.get("orgId").getAsString();
188
                     String orgId = identifyInfoData.get("orgId").getAsString();
187
                     EsignHttpResponse identifyInfo1 = SignAward.deptIdentifySealList(orgId);
189
                     EsignHttpResponse identifyInfo1 = SignAward.deptIdentifySealList(orgId);
188
                     //将orgId保存到数据库里
190
                     //将orgId保存到数据库里
192
                     JsonObject identifyInfoData1 = identifyInfoJsonObject1.getAsJsonObject("data");
194
                     JsonObject identifyInfoData1 = identifyInfoJsonObject1.getAsJsonObject("data");
193
                     JsonArray sealArray = identifyInfoData1.get("seals").getAsJsonArray();
195
                     JsonArray sealArray = identifyInfoData1.get("seals").getAsJsonArray();
194
                     String sealNames = "";
196
                     String sealNames = "";
195
-                    if(sealArray.size()>0){
197
+                    if (sealArray.size() > 0) {
196
                         for (int j = 0; j < sealArray.size(); j++) {
198
                         for (int j = 0; j < sealArray.size(); j++) {
197
-                            JsonObject sealObject = (JsonObject)sealArray.get(j);
199
+                            JsonObject sealObject = (JsonObject) sealArray.get(j);
198
                             String sealName = sealObject.get("sealName").toString();
200
                             String sealName = sealObject.get("sealName").toString();
199
-                            String sealNamenew = sealName.substring(1,sealName.length()-1);
200
-                            sealNames += sealNamenew +",";
201
+                            String sealNamenew = sealName.substring(1, sealName.length() - 1);
202
+                            sealNames += sealNamenew + ",";
201
                         }
203
                         }
202
                     }
204
                     }
203
-                    String sealName = sealNames.substring(0,sealNames.length()-1);
205
+                    String sealName = sealNames.substring(0, sealNames.length() - 1);
204
                     deptIdentifynew.setIdentifyStatus(1);
206
                     deptIdentifynew.setIdentifyStatus(1);
205
                     deptIdentifynew.setSealName(sealName);
207
                     deptIdentifynew.setSealName(sealName);
206
                     int row = deptIdentifyMapper.updateDeptIdentify(deptIdentifynew);
208
                     int row = deptIdentifyMapper.updateDeptIdentify(deptIdentifynew);
208
             }
210
             }
209
         }
211
         }
210
     }
212
     }
213
+
214
+    /**
215
+     * 定时查询企业内部印章审核状态
216
+     *
217
+     * @throws EsignDemoException
218
+     */
219
+    @Scheduled(cron = "0/30 * * * * ?")
220
+    @Transactional
221
+    public void searchForInstitutionalSeal()  {
222
+        try {
223
+            DeptIdentify deptIdentify = new DeptIdentify();
224
+            deptIdentify.setIsUse(0);
225
+            List<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentifylist(deptIdentify);
226
+            if (deptIdentifies != null && deptIdentifies.size() > 0) {
227
+                for (DeptIdentify identify : deptIdentifies) {
228
+                    //查询企业内部印章
229
+                    Integer annexId = identify.getAnnexId();
230
+                    if (annexId == null){
231
+                        //说明之前没有下载过
232
+                        EsignHttpResponse response = SignAward.orgOwnSealList(identify);
233
+                        JSONObject jsonObject = JSONObject.parseObject(response.getBody());
234
+                        JSONObject data = jsonObject.getJSONObject("data");
235
+                        JSONArray seals = data.getJSONArray("seals");
236
+                        for (int i = 0; i < seals.size(); i++){
237
+                            JSONObject seal = seals.getJSONObject(i);
238
+                            int statusDescription = seal.getIntValue("statusDescription");
239
+                            if (statusDescription==1){//印章状态 1已启用,2待审核,3审核不通过,4 挂起
240
+                                //已启用证明审核通过,下载到数据库
241
+                                String sealImageDownloadUrl = seal.getString("sealImageDownloadUrl");
242
+                                LocalDate now = LocalDate.now();
243
+                                String year = Integer.toString(now.getYear());
244
+                                String month = String.format("%02d", now.getMonthValue());
245
+                                String day = String.format("%02d", now.getDayOfMonth());
246
+                                String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
247
+                                String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf";
248
+                                String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
249
+                                String savePath = "/home/ruoyi/uploadPath/upload/";
250
+                                // 创建日期目录
251
+                                File saveFolder = new File(saveFolderPath);
252
+                                if (!saveFolder.exists()) {
253
+                                    saveFolder.mkdirs();
254
+                                }
255
+                                String resultFilePath = saveFolderPath + "/" + fileName;
256
+                                File resultFilePathFile = new File(resultFilePath);
257
+                                if (!resultFilePathFile.exists()) {
258
+                                    resultFilePathFile.createNewFile();
259
+                                }
260
+                                boolean downLoadFile = FileTransformation.downLoadFileByUrl(sealImageDownloadUrl, resultFilePath);
261
+                                if (downLoadFile) {
262
+                                    CaseAttach caseAttach = new CaseAttach();
263
+                                    caseAttach.setAnnexType(10);  //10代表印章图片
264
+                                    caseAttach.setAnnexPath(savePath);
265
+                                    caseAttach.setAnnexName(saveName);
266
+                                    caseAttach.setSealStatus(1);  //1代表印章启用
267
+                                    int i1 = caseAttachMapper.save(caseAttach);
268
+                                    if (i1>0){
269
+                                        //将附件id保存到公章管理表里
270
+                                        Integer annexId1 = caseAttach.getAnnexId();
271
+                                        identify.setAnnexId(annexId1);
272
+                                        deptIdentifyMapper.updateDeptIdentify(identify);
273
+                                    }
274
+                                }
275
+                            }
276
+                        }
277
+                    }
278
+                }
279
+            }
280
+        } catch (EsignDemoException e) {
281
+            e.printStackTrace();
282
+        } catch (IOException e) {
283
+            e.printStackTrace();
284
+        }
285
+    }
211
 }
286
 }
287
+
288
+

+ 109
- 65
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/SignAward.java Wyświetl plik

1
 package com.ruoyi.wisdomarbitrate.utils;
1
 package com.ruoyi.wisdomarbitrate.utils;
2
 
2
 
3
+import com.alibaba.fastjson.JSONObject;
3
 import com.google.gson.Gson;
4
 import com.google.gson.Gson;
4
 import com.google.gson.JsonArray;
5
 import com.google.gson.JsonArray;
5
 import com.google.gson.JsonObject;
6
 import com.google.gson.JsonObject;
9
 import com.ruoyi.common.utils.DateUtils;
10
 import com.ruoyi.common.utils.DateUtils;
10
 import com.ruoyi.common.utils.EsignApplicaConfig;
11
 import com.ruoyi.common.utils.EsignApplicaConfig;
11
 import com.ruoyi.common.utils.EsignHttpHelper;
12
 import com.ruoyi.common.utils.EsignHttpHelper;
13
+import com.ruoyi.common.utils.SealUtil;
12
 import com.ruoyi.wisdomarbitrate.domain.DeptIdentify;
14
 import com.ruoyi.wisdomarbitrate.domain.DeptIdentify;
13
 import com.ruoyi.wisdomarbitrate.domain.SealSignRecord;
15
 import com.ruoyi.wisdomarbitrate.domain.SealSignRecord;
14
 
16
 
18
 
20
 
19
 public class SignAward {
21
 public class SignAward {
20
 
22
 
21
-    private static String eSignHost= EsignApplicaConfig.EsignHost;
22
-    private static String eSignAppId= EsignApplicaConfig.EsignAppId;
23
-    private static String eSignAppSecret= EsignApplicaConfig.EsignAppSecret;
24
-
23
+    private static String eSignHost = EsignApplicaConfig.EsignHost;
24
+    private static String eSignAppId = EsignApplicaConfig.EsignAppId;
25
+    private static String eSignAppSecret = EsignApplicaConfig.EsignAppSecret;
25
 
26
 
26
 
27
 
27
     public static void main(String[] args) throws EsignDemoException {
28
     public static void main(String[] args) throws EsignDemoException {
89
 //        System.out.println("机构印章名称:" +sealNames.substring(0,sealNames.length()-1));
90
 //        System.out.println("机构印章名称:" +sealNames.substring(0,sealNames.length()-1));
90
 
91
 
91
 
92
 
92
-
93
-
94
         //查询签署流程详情
93
         //查询签署流程详情
95
 //        EsignHttpResponse signFlowDetail = signFlowDetail(sealSignRecord);
94
 //        EsignHttpResponse signFlowDetail = signFlowDetail(sealSignRecord);
96
 //        JsonObject signFlowDetailJsonObject = gson.fromJson(signFlowDetail.getBody(),JsonObject.class);
95
 //        JsonObject signFlowDetailJsonObject = gson.fromJson(signFlowDetail.getBody(),JsonObject.class);
120
 //        System.out.println(signFlowDetailJsonObject);
119
 //        System.out.println(signFlowDetailJsonObject);
121
 
120
 
122
 
121
 
123
-
124
-
125
     }
122
     }
126
 
123
 
127
 
124
 
128
-
129
     /**
125
     /**
130
      * 查询签署流程详情
126
      * 查询签署流程详情
127
+     *
131
      * @return
128
      * @return
132
      */
129
      */
133
     public static EsignHttpResponse signFlowDetail(SealSignRecord sealSignRecord) throws EsignDemoException {
130
     public static EsignHttpResponse signFlowDetail(SealSignRecord sealSignRecord) throws EsignDemoException {
134
         String signFlowId = sealSignRecord.getSignFlowid();
131
         String signFlowId = sealSignRecord.getSignFlowid();
135
-        String apiaddr= "/v3/sign-flow/"+ signFlowId + "/detail";
132
+        String apiaddr = "/v3/sign-flow/" + signFlowId + "/detail";
136
         String jsonParm = null;
133
         String jsonParm = null;
137
         //请求方法
134
         //请求方法
138
         EsignRequestType requestType = EsignRequestType.GET;
135
         EsignRequestType requestType = EsignRequestType.GET;
139
         //生成签名鉴权方式的的header
136
         //生成签名鉴权方式的的header
140
-        Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId,eSignAppSecret,jsonParm,requestType.name(),apiaddr,true);
137
+        Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, true);
141
         //发起接口请求
138
         //发起接口请求
142
-        return EsignHttpHelper.doCommHttp(eSignHost, apiaddr,requestType , jsonParm, header,true);
139
+        return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true);
143
     }
140
     }
144
 
141
 
145
 
142
 
146
     /**
143
     /**
147
      * 发起签署
144
      * 发起签署
145
+     *
148
      * @return
146
      * @return
149
      * @throws EsignDemoException
147
      * @throws EsignDemoException
150
      */
148
      */
174
         String jsonParm = "{\n" +
172
         String jsonParm = "{\n" +
175
                 "    \"docs\": [\n" +
173
                 "    \"docs\": [\n" +
176
                 "        {\n" +
174
                 "        {\n" +
177
-                "            \"fileId\": \"" + fileId +  "\",\n" +
178
-                "            \"fileName\": \"" + fileName +  "\"\n" +
175
+                "            \"fileId\": \"" + fileId + "\",\n" +
176
+                "            \"fileName\": \"" + fileName + "\"\n" +
179
                 "        }\n" +
177
                 "        }\n" +
180
                 "    ],\n" +
178
                 "    ],\n" +
181
                 "    \"signFlowConfig\": {\n" +
179
                 "    \"signFlowConfig\": {\n" +
203
                 "    \"signers\": [\n" +
201
                 "    \"signers\": [\n" +
204
                 "          {\n" +
202
                 "          {\n" +
205
                 "            \"psnSignerInfo\": {\n" +
203
                 "            \"psnSignerInfo\": {\n" +
206
-                "                \"psnAccount\": \"" + psnAccount +  "\",\n" +
204
+                "                \"psnAccount\": \"" + psnAccount + "\",\n" +
207
                 "                \"psnInfo\": {\n" +
205
                 "                \"psnInfo\": {\n" +
208
-                "                            \"psnName\": \"" + psnName +  "\"\n" +
206
+                "                            \"psnName\": \"" + psnName + "\"\n" +
209
                 "                        }\n" +
207
                 "                        }\n" +
210
                 "            },\n" +
208
                 "            },\n" +
211
                 "            \"signFields\": [\n" +
209
                 "            \"signFields\": [\n" +
212
                 "                {\n" +
210
                 "                {\n" +
213
-                "                    \"fileId\": \"" + fileId +  "\",\n" +
211
+                "                    \"fileId\": \"" + fileId + "\",\n" +
214
                 "                    \"normalSignFieldConfig\": {\n" +
212
                 "                    \"normalSignFieldConfig\": {\n" +
215
                 "                        \"autoSign\": false,\n" +
213
                 "                        \"autoSign\": false,\n" +
216
                 "                        \"freeMode\": false,\n" +
214
                 "                        \"freeMode\": false,\n" +
217
                 "                        \"movableSignField\": false,\n" +
215
                 "                        \"movableSignField\": false,\n" +
218
                 "                        \"signFieldPosition\": {\n" +
216
                 "                        \"signFieldPosition\": {\n" +
219
-                "                            \"positionPage\": \"" + positionPagepsn +  "\",\n" +
220
-                "                            \"positionX\": " + positionXpsn +  ",\n" +
221
-                "                            \"positionY\": " + positionYpsn +  "\n" +
217
+                "                            \"positionPage\": \"" + positionPagepsn + "\",\n" +
218
+                "                            \"positionX\": " + positionXpsn + ",\n" +
219
+                "                            \"positionY\": " + positionYpsn + "\n" +
222
                 "                        },\n" +
220
                 "                        },\n" +
223
                 "                        \"signFieldStyle\": 1\n" +
221
                 "                        \"signFieldStyle\": 1\n" +
224
                 "                    },\n" +
222
                 "                    },\n" +
230
 
228
 
231
                 "        {\n" +
229
                 "        {\n" +
232
                 "            \"orgSignerInfo\": {\n" +
230
                 "            \"orgSignerInfo\": {\n" +
233
-                "                \"orgName\": \"" + orgName +  "\",\n" +
231
+                "                \"orgName\": \"" + orgName + "\",\n" +
234
                 "                \"transactorInfo\": {\n" +
232
                 "                \"transactorInfo\": {\n" +
235
-                "                \"psnAccount\": \"" + orgNamePsnAccount +  "\",\n" +
233
+                "                \"psnAccount\": \"" + orgNamePsnAccount + "\",\n" +
236
                 "                \"psnInfo\": {\n" +
234
                 "                \"psnInfo\": {\n" +
237
-                "                            \"psnName\": \"" + orgNamepsnName +  "\"\n" +
235
+                "                            \"psnName\": \"" + orgNamepsnName + "\"\n" +
238
                 "                        }\n" +
236
                 "                        }\n" +
239
                 "                }\n" +
237
                 "                }\n" +
240
                 "            },\n" +
238
                 "            },\n" +
241
 
239
 
242
                 "            \"signFields\": [\n" +
240
                 "            \"signFields\": [\n" +
243
                 "                {\n" +
241
                 "                {\n" +
244
-                "                    \"fileId\": \"" + fileId +  "\",\n" +
242
+                "                    \"fileId\": \"" + fileId + "\",\n" +
245
                 "                    \"normalSignFieldConfig\": {\n" +
243
                 "                    \"normalSignFieldConfig\": {\n" +
246
                 "                        \"autoSign\": false,\n" +
244
                 "                        \"autoSign\": false,\n" +
247
                 "                        \"freeMode\": false,\n" +
245
                 "                        \"freeMode\": false,\n" +
248
 
246
 
249
                 "                        \"availableSealIds\": [\n" +
247
                 "                        \"availableSealIds\": [\n" +
250
-                "                               \"" + availableSealId +  "\"\n" +
248
+                "                               \"" + availableSealId + "\"\n" +
251
                 "                           ],\n" +
249
                 "                           ],\n" +
252
 
250
 
253
 
251
 
254
                 "                        \"signFieldPosition\": {\n" +
252
                 "                        \"signFieldPosition\": {\n" +
255
-                "                            \"positionPage\": \"" + positionPageorg +  "\",\n" +
256
-                "                            \"positionX\": " + positionXorg +  ",\n" +
257
-                "                            \"positionY\": " + positionYorg +  "\n" +
253
+                "                            \"positionPage\": \"" + positionPageorg + "\",\n" +
254
+                "                            \"positionX\": " + positionXorg + ",\n" +
255
+                "                            \"positionY\": " + positionYorg + "\n" +
258
                 "                        },\n" +
256
                 "                        },\n" +
259
                 "                        \"signFieldStyle\": 1\n" +
257
                 "                        \"signFieldStyle\": 1\n" +
260
                 "                    },\n" +
258
                 "                    },\n" +
277
 
275
 
278
     /**
276
     /**
279
      * 获取合同文件签名链接
277
      * 获取合同文件签名链接
278
+     *
280
      * @return
279
      * @return
281
      * @throws EsignDemoException
280
      * @throws EsignDemoException
282
      */
281
      */
291
                 "    \"clientType\": \"PC\",\n" +
290
                 "    \"clientType\": \"PC\",\n" +
292
 
291
 
293
                 "    \"operator\": {\n" +
292
                 "    \"operator\": {\n" +
294
-                "        \"psnAccount\": \"" + psnAccount +  "\"\n" +
293
+                "        \"psnAccount\": \"" + psnAccount + "\"\n" +
295
                 "    }\n" +
294
                 "    }\n" +
296
                 "}";
295
                 "}";
297
         //请求方法
296
         //请求方法
304
 
303
 
305
     /**
304
     /**
306
      * 获取合同文件用印链接
305
      * 获取合同文件用印链接
306
+     *
307
      * @return
307
      * @return
308
      * @throws EsignDemoException
308
      * @throws EsignDemoException
309
      */
309
      */
317
         String jsonParm = "{\n" +
317
         String jsonParm = "{\n" +
318
                 "    \"operator\": {\n" +
318
                 "    \"operator\": {\n" +
319
 
319
 
320
-                "        \"psnAccount\": \"" + psnAccount +  "\"\n" +
320
+                "        \"psnAccount\": \"" + psnAccount + "\"\n" +
321
                 "    },\n" +
321
                 "    },\n" +
322
                 "    \"organization\": {\n" +
322
                 "    \"organization\": {\n" +
323
-                "        \"orgName\": \"" + orgName +  "\"\n" +
323
+                "        \"orgName\": \"" + orgName + "\"\n" +
324
 
324
 
325
                 "    }\n" +
325
                 "    }\n" +
326
                 "}";
326
                 "}";
346
                 "    \"orgAuthConfig\": {\n" +
346
                 "    \"orgAuthConfig\": {\n" +
347
                 "        \"orgName\": \"" + deptName + " \",\n" +
347
                 "        \"orgName\": \"" + deptName + " \",\n" +
348
                 "        \"transactorInfo\": {\n" +
348
                 "        \"transactorInfo\": {\n" +
349
-                "            \"psnAccount\": \"" + phonenumber +  "\",\n" +
349
+                "            \"psnAccount\": \"" + phonenumber + "\",\n" +
350
                 "            \"psnInfo\": {\n" +
350
                 "            \"psnInfo\": {\n" +
351
-                "                \"psnName\": \"" + nickName +  "\",\n" +
352
-                "                 \"psnMobile\": \"" + phonenumber +  "\"\n" +
351
+                "                \"psnName\": \"" + nickName + "\",\n" +
352
+                "                 \"psnMobile\": \"" + phonenumber + "\"\n" +
353
                 "            }\n" +
353
                 "            }\n" +
354
                 "        }\n" +
354
                 "        }\n" +
355
                 "    },\n" +
355
                 "    },\n" +
377
      * 查询企业认证状态
377
      * 查询企业认证状态
378
      */
378
      */
379
     public static EsignHttpResponse getDeptIdentifyInfo(DeptIdentify deptIdentify) throws EsignDemoException {
379
     public static EsignHttpResponse getDeptIdentifyInfo(DeptIdentify deptIdentify) throws EsignDemoException {
380
-        String apiaddr="/v3/organizations/identity-info?orgName="+deptIdentify.getDeptName();
380
+        String apiaddr = "/v3/organizations/identity-info?orgName=" + deptIdentify.getDeptName();
381
 
381
 
382
-        String jsonParm="{}";
382
+        String jsonParm = "{}";
383
         //请求方法
383
         //请求方法
384
-        EsignRequestType requestType= EsignRequestType.GET;
384
+        EsignRequestType requestType = EsignRequestType.GET;
385
         //生成签名鉴权方式的的header
385
         //生成签名鉴权方式的的header
386
-        Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId,eSignAppSecret,jsonParm,requestType.name(),apiaddr,true);
386
+        Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, true);
387
         //发起接口请求
387
         //发起接口请求
388
-        return EsignHttpHelper.doCommHttp(eSignHost, apiaddr,requestType , jsonParm, header,true);
388
+        return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true);
389
     }
389
     }
390
+
390
     /**
391
     /**
391
      * 查询企业认证印章信息
392
      * 查询企业认证印章信息
392
      */
393
      */
393
     public static EsignHttpResponse deptIdentifySealList(String orgId) throws EsignDemoException {
394
     public static EsignHttpResponse deptIdentifySealList(String orgId) throws EsignDemoException {
394
-        int pageNum=1;
395
-        int pageSize=10;
396
-        String apiaddr="/v3/seals/org-own-seal-list?orgId="+orgId+"&pageNum="+pageNum+"&pageSize="+pageSize;
397
-        String jsonParm=null;
395
+        int pageNum = 1;
396
+        int pageSize = 10;
397
+        String apiaddr = "/v3/seals/org-own-seal-list?orgId=" + orgId + "&pageNum=" + pageNum + "&pageSize=" + pageSize;
398
+        String jsonParm = null;
398
         //请求方法
399
         //请求方法
399
-        EsignRequestType requestType= EsignRequestType.GET;
400
+        EsignRequestType requestType = EsignRequestType.GET;
400
         //生成签名鉴权方式的的header
401
         //生成签名鉴权方式的的header
401
-        Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId,eSignAppSecret,jsonParm,requestType.name(),apiaddr,true);
402
+        Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, true);
402
         //发起接口请求
403
         //发起接口请求
403
-        return EsignHttpHelper.doCommHttp(eSignHost, apiaddr,requestType , jsonParm, header,true);
404
+        return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true);
404
     }
405
     }
405
 
406
 
406
 
407
 
407
-
408
     /**
408
     /**
409
      * 获取文件签名印章位置
409
      * 获取文件签名印章位置
410
+     *
410
      * @return
411
      * @return
411
      * @throws EsignDemoException
412
      * @throws EsignDemoException
412
      */
413
      */
432
      *
433
      *
433
      * @return
434
      * @return
434
      */
435
      */
435
-    public static EsignHttpResponse createOrgByImage(DeptIdentify deptIdentify) throws EsignDemoException {
436
-        String apiaddr = "/v3/seals/org-seals/create-by-image";
437
-        String orgId = deptIdentify.getOrgId();
438
-        String sealImageFileKey = "";
436
+    public static EsignHttpResponse createOrgByImage(DeptIdentify deptIdentify, String filePath) throws EsignDemoException {
437
+        //获取认证授权流程ID
438
+        String authFlowId = deptIdentify.getAuthFlowId();
439
+        //查询认证授权流程详情
440
+        EsignHttpResponse response = SealUtil.queryAuthProcess(authFlowId);
441
+        String body = response.getBody();
442
+        if (body != null) {
443
+            JSONObject jsonObject = JSONObject.parseObject(body);
444
+            //查询授权流程状态
445
+            int authorizedStatus = jsonObject.getJSONObject("data").getIntValue("authorizedStatus");
446
+            if (authorizedStatus == 1) {//0 -流程过期失效  1 - 已授权  2 - 授权中  3 - 审批未通过
447
+                String apiaddr = "/v3/seals/org-seals/create-by-image";
448
+                String orgId = deptIdentify.getOrgId();
449
+                //上传印章图片
450
+                //步骤一:获取印章图片上传地址fileUploadUrl
451
+                EsignHttpResponse response1 = SealUtil.getFileUploadUrl(filePath);
452
+                JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody());
453
+                String fileUploadUrl = jsonObject1.getJSONObject("data").getString("fileUploadUrl");
454
+                //步骤二:将印章图片文件流上传到fileUploadUrl
455
+                EsignHttpResponse response2 = SealUtil.fileStreamUpload(fileUploadUrl, filePath);
456
+                JSONObject jsonObject2 = JSONObject.parseObject(response2.getBody());
457
+                int errCode = jsonObject2.getIntValue("errCode");
458
+                if (errCode == 0){  //业务码,0表示成功,非0表示异常。
459
+                    //获取步骤一里面的fileKey
460
+                    String sealImageFileKey = jsonObject1.getJSONObject("data").getString("fileKey");
461
+                    String sealName = deptIdentify.getSealName();
462
+                    //请求参数body体,json格式。get或者delete请求时jsonString传空json:"{}"或者null
463
+                    String jsonParm = "{\n" +
464
+                            "  \"orgId\": \"" + orgId + "\",\n" +
465
+                            "  \"sealImageFileKey\": \"" + sealImageFileKey + "\",\n" +
466
+                            "  \"sealName\": \"   " + sealName + "  \",\n" +
467
+                            "  \"sealWidth\": 50,\n" +
468
+                            "  \"sealHeight\": 50,\n" +
469
+                            "}";
470
+                    //请求方法
471
+                    EsignRequestType requestType = EsignRequestType.POST;
472
+                    //生成签名鉴权方式的的header
473
+                    Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, true);
474
+                    //发起接口请求
475
+                    return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true);
476
+                }
477
+            }
478
+        }
479
+        return null;
480
+    }
481
+
482
+    /**
483
+     * 查询企业内部印章
484
+     */
485
+
486
+    public static EsignHttpResponse orgOwnSealList(DeptIdentify deptIdentify) throws EsignDemoException {
487
+        String orgId=deptIdentify.getOrgId();
488
+        int pageNum=1;
489
+        int pageSize=20;
490
+
491
+        String apiaddr="/v3/seals/org-own-seal-list?orgId="+orgId+"&pageNum="+pageNum+"&pageSize="+pageSize;
492
+
439
         //请求参数body体,json格式。get或者delete请求时jsonString传空json:"{}"或者null
493
         //请求参数body体,json格式。get或者delete请求时jsonString传空json:"{}"或者null
440
-        String jsonParm = "{\n" +
441
-                "  \"orgId\": \"" + orgId + "\",\n" +
442
-                "  \"sealImageFileKey\": \"" + sealImageFileKey + "\",\n" +
443
-                "  \"sealName\": \"企业公章1\",\n" +
444
-                "  \"sealWidth\": 50,\n" +
445
-                "  \"sealHeight\": 50,\n" +
446
-                "}";
494
+        String jsonParm=null;
447
         //请求方法
495
         //请求方法
448
-        EsignRequestType requestType = EsignRequestType.POST;
496
+        EsignRequestType requestType= EsignRequestType.GET;
449
         //生成签名鉴权方式的的header
497
         //生成签名鉴权方式的的header
450
-        Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, true);
498
+        Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId,eSignAppSecret,jsonParm,requestType.name(),apiaddr,true);
451
         //发起接口请求
499
         //发起接口请求
452
-        EsignHttpResponse response = EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true);
453
-        System.out.println(response);
454
-        return response;
500
+        return EsignHttpHelper.doCommHttp(eSignHost, apiaddr,requestType , jsonParm, header,true);
455
     }
501
     }
456
-
457
-
458
 }
502
 }

+ 3
- 2
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAttachMapper.xml Wyświetl plik

12
         <result property="note"     column="note"    />
12
         <result property="note"     column="note"    />
13
         <result property="userId"     column="use_id"    />
13
         <result property="userId"     column="use_id"    />
14
         <result property="userName"     column="use_account"    />
14
         <result property="userName"     column="use_account"    />
15
+        <result property="sealStatus"     column="seal_status"    />
15
     </resultMap>
16
     </resultMap>
16
     <insert id="save" useGeneratedKeys="true" keyProperty="annexId">
17
     <insert id="save" useGeneratedKeys="true" keyProperty="annexId">
17
-        INSERT INTO case_attach (case_appli_id, annex_name, annex_path , annex_type,note,use_id,use_account)
18
-        VALUES (#{caseAppliId}, #{annexName}, #{annexPath},#{annexType},#{note},#{userId},#{userName})
18
+        INSERT INTO case_attach (case_appli_id, annex_name, annex_path , annex_type,note,use_id,use_account,seal_status)
19
+        VALUES (#{caseAppliId}, #{annexName}, #{annexPath},#{annexType},#{note},#{userId},#{userName},#{sealStatus})
19
     </insert>
20
     </insert>
20
     <delete id="deleteByFileIds">
21
     <delete id="deleteByFileIds">
21
         delete from case_attach
22
         delete from case_attach

+ 7
- 3
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/DeptIdentifyMapper.xml Wyświetl plik

14
         <result property="phonenumber"       column="phonenumber"       />
14
         <result property="phonenumber"       column="phonenumber"       />
15
         <result property="deptName"     column="dept_name"     />
15
         <result property="deptName"     column="dept_name"     />
16
         <result property="sealName"     column="seal_name"     />
16
         <result property="sealName"     column="seal_name"     />
17
+        <result property="orgId"     column="org_id"     />
18
+        <result property="authFlowId"     column="auth_flow_id"     />
19
+        <result property="sealId"     column="seal_id"     />
17
 
20
 
18
     </resultMap>
21
     </resultMap>
19
 
22
 
28
     </select>
31
     </select>
29
 
32
 
30
     <select id="selectDeptIdentifyBydeptid" parameterType="DeptIdentify" resultMap="DeptIdentifyResult">
33
     <select id="selectDeptIdentifyBydeptid" parameterType="DeptIdentify" resultMap="DeptIdentifyResult">
31
-        SELECT d.id ,d.dept_id ,d.user_id
34
+        SELECT d.id ,d.dept_id ,d.user_id ,d.org_id ,d.auth_flow_id
32
         from dept_identify d
35
         from dept_identify d
33
         <where>
36
         <where>
34
             <if test="deptId != null">
37
             <if test="deptId != null">
53
     </insert>
56
     </insert>
54
 
57
 
55
     <select id="selectDeptIdentifylist" parameterType="DeptIdentify" resultMap="DeptIdentifyResult">
58
     <select id="selectDeptIdentifylist" parameterType="DeptIdentify" resultMap="DeptIdentifyResult">
56
-        SELECT  d.id ,d.dept_id ,d.user_id, d.identify_status ,d.identify_date ,d.is_use , d.seal_name,  sd.dept_name ,
57
-            u.nick_name ,u.phonenumber
59
+        SELECT  d.id ,d.dept_id ,d.user_id, d.identify_status ,d.identify_date ,d.is_use , d.seal_name,
60
+               d.org_id , d.seal_id ,sd.dept_name , u.nick_name ,u.phonenumber
58
         from dept_identify d left join sys_dept sd on d.dept_id  = sd.dept_id
61
         from dept_identify d left join sys_dept sd on d.dept_id  = sd.dept_id
59
         left join sys_user u on u.user_id  = d.user_id
62
         left join sys_user u on u.user_id  = d.user_id
60
         <where>
63
         <where>
90
             <if test="isUse != null">is_use = #{isUse},</if>
93
             <if test="isUse != null">is_use = #{isUse},</if>
91
             <if test="identifyStatus != null ">identify_status = #{identifyStatus},</if>
94
             <if test="identifyStatus != null ">identify_status = #{identifyStatus},</if>
92
             <if test="sealName != null  and sealName != ''">seal_name = #{sealName},</if>
95
             <if test="sealName != null  and sealName != ''">seal_name = #{sealName},</if>
96
+            <if test="sealId != null  and sealId != ''">seal_id = #{sealId},</if>
93
         </set>
97
         </set>
94
         where id = #{id}
98
         where id = #{id}
95
     </update>
99
     </update>