Просмотр исходного кода

Merge branch 'hjb' of SH-Arbitrate/Arbitrate-Backend into dev

hejinbo 2 лет назад
Родитель
Сommit
ad7a8125db
17 измененных файлов: 859 добавлений и 147 удалений
  1. 49
    2
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/DeptIdentifyController.java
  2. 124
    0
      ruoyi-common/src/main/java/com/ruoyi/common/utils/SealUtil.java
  3. 1
    1
      ruoyi-common/src/main/java/com/ruoyi/common/utils/file/SaaSAPIFileUtils.java
  4. 1
    0
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseAttach.java
  5. 58
    1
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/DeptIdentify.java
  6. 27
    0
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/SealListVO.java
  7. 2
    0
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/CaseAttachMapper.java
  8. 1
    0
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/DeptIdentifyMapper.java
  9. 13
    0
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IDeptIdentifyService.java
  10. 3
    3
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java
  11. 33
    4
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java
  12. 39
    5
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseArbitrateServiceImpl.java
  13. 188
    10
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DeptIdentifyServiceImpl.java
  14. 119
    45
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/FixSelectFlowDetailUtils.java
  15. 163
    68
      ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/SignAward.java
  16. 12
    2
      ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAttachMapper.xml
  17. 26
    6
      ruoyi-system/src/main/resources/mapper/wisdomarbitrate/DeptIdentifyMapper.xml

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

1
 package com.ruoyi.web.controller.wisdomarbitrate;
1
 package com.ruoyi.web.controller.wisdomarbitrate;
2
 
2
 
3
+import com.alibaba.fastjson.JSONObject;
3
 import com.ruoyi.common.annotation.Log;
4
 import com.ruoyi.common.annotation.Log;
4
 import com.ruoyi.common.core.controller.BaseController;
5
 import com.ruoyi.common.core.controller.BaseController;
5
 import com.ruoyi.common.core.domain.AjaxResult;
6
 import com.ruoyi.common.core.domain.AjaxResult;
9
 import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
10
 import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
10
 import com.ruoyi.wisdomarbitrate.domain.DeptIdentify;
11
 import com.ruoyi.wisdomarbitrate.domain.DeptIdentify;
11
 import com.ruoyi.wisdomarbitrate.domain.SealSignRecord;
12
 import com.ruoyi.wisdomarbitrate.domain.SealSignRecord;
13
+import com.ruoyi.wisdomarbitrate.domain.SmsSendRecord;
14
+import com.ruoyi.wisdomarbitrate.domain.vo.SealListVO;
12
 import com.ruoyi.wisdomarbitrate.service.IDeptIdentifyService;
15
 import com.ruoyi.wisdomarbitrate.service.IDeptIdentifyService;
13
 import org.springframework.beans.factory.annotation.Autowired;
16
 import org.springframework.beans.factory.annotation.Autowired;
14
 import org.springframework.validation.annotation.Validated;
17
 import org.springframework.validation.annotation.Validated;
15
 import org.springframework.web.bind.annotation.*;
18
 import org.springframework.web.bind.annotation.*;
19
+import org.springframework.web.multipart.MultipartFile;
16
 
20
 
17
 import java.util.List;
21
 import java.util.List;
18
 
22
 
19
 @RestController
23
 @RestController
20
 @RequestMapping("/deptIdentify")
24
 @RequestMapping("/deptIdentify")
21
-public class DeptIdentifyController  extends BaseController {
25
+public class DeptIdentifyController extends BaseController {
22
     @Autowired
26
     @Autowired
23
     private IDeptIdentifyService deptIdentifyService;
27
     private IDeptIdentifyService deptIdentifyService;
24
 
28
 
49
         return deptIdentifyService.enableDept(deptIdentify);
53
         return deptIdentifyService.enableDept(deptIdentify);
50
     }
54
     }
51
 
55
 
56
+    /**
57
+     * 上传自定义公章
58
+     *
59
+     * @param deptIdentify
60
+     * @param file
61
+     * @return
62
+     */
63
+    @PostMapping("/sealUpload")
64
+    public AjaxResult sealUpload(@Validated @RequestBody DeptIdentify deptIdentify
65
+            , @RequestParam("file") MultipartFile file) {
66
+        return deptIdentifyService.sealUpload(deptIdentify, file);
67
+    }
52
 
68
 
69
+    /**
70
+     * 接收E签宝回调通知
71
+     * @param body
72
+     * @return
73
+     */
74
+    @GetMapping("/notify")
75
+    public AjaxResult receiveNotify(String body) {
76
+        return deptIdentifyService.receiveNotify(body);
77
+    }
53
 
78
 
79
+    /**
80
+     * 签章图片列表查询
81
+     * @param deptIdentify
82
+     * @return
83
+     */
84
+    @GetMapping("/sealList")
85
+    public TableDataInfo getSealList(DeptIdentify deptIdentify){
86
+        startPage();
87
+        List<SealListVO> list = deptIdentifyService.getSealList(deptIdentify);
88
+        return getDataTable(list);
89
+    }
54
 
90
 
55
-
91
+    /**
92
+     * 印章启用或者禁用
93
+     * @param deptIdentify
94
+     * @return
95
+     */
96
+    @PostMapping("/updateSealLockStatus")
97
+    public AjaxResult updateSealLockStatus(@Validated @RequestBody DeptIdentify deptIdentify){
98
+        if(deptIdentify.getSealId()==null ||deptIdentify.getSealStatus()==null){
99
+            return error("参数校验失败");
100
+        }
101
+        return deptIdentifyService.updateSealLockStatus(deptIdentify);
102
+    }
56
 }
103
 }

+ 124
- 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/SealUtil.java Просмотреть файл

1
+package com.ruoyi.common.utils;
2
+
3
+import com.ruoyi.common.config.EsignDemoConfig;
4
+import com.ruoyi.common.constant.EsignHeaderConstant;
5
+import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
6
+import com.ruoyi.common.enums.EsignRequestType;
7
+import com.ruoyi.common.exception.EsignDemoException;
8
+import com.ruoyi.common.utils.bean.EsignFileBean;
9
+
10
+import java.util.Map;
11
+
12
+public class SealUtil {
13
+    private static String eSignHost = EsignDemoConfig.EsignHost;
14
+    private static String eSignAppId = EsignDemoConfig.EsignAppId;
15
+    private static String eSignAppSecret = EsignDemoConfig.EsignAppSecret;
16
+
17
+    /**
18
+     * 获取机构认证&授权页面链接
19
+     *
20
+     * @return
21
+     */
22
+    public static EsignHttpResponse getOrgEmpower() throws EsignDemoException {
23
+        String apiaddr = "/v3/org-auth-url";
24
+        String nickName = "何进波";
25
+        String phonenumber = "15191509780";
26
+        String deptName = "西安云美公司";
27
+        String jsonParm = "{\n" +
28
+                "    \"orgAuthConfig\": {\n" +
29
+                "        \"orgName\": \"" + deptName + " \",\n" +
30
+                "        \"transactorInfo\": {\n" +
31
+                "            \"psnAccount\": \"" + phonenumber +  "\",\n" +
32
+                "            \"psnInfo\": {\n" +
33
+                "                \"psnName\": \"" + nickName +  "\",\n" +
34
+               "                 \"psnMobile\": \"" + phonenumber +  "\"\n" +
35
+                "            }\n" +
36
+                "        }\n" +
37
+                "    },\n" +
38
+                "    \"authorizeConfig\": {\n" +
39
+                "        \"authorizedScopes\": [\n" +
40
+                "            \"get_org_identity_info\",\n" +
41
+                "            \"get_psn_identity_info\",\n" +
42
+                "            \"org_initiate_sign\",\n" +
43
+                "            \"psn_initiate_sign\",\n" +
44
+                "            \"manage_org_resource\",\n" +
45
+                "            \"manage_psn_resource\",\n" +
46
+                "            \"use_org_order\"\n" +
47
+                "        ]\n" +
48
+                "    }\n" +
49
+                "}";
50
+        //请求方法
51
+        EsignRequestType requestType = EsignRequestType.POST;
52
+        //生成请求签名鉴权方式的Header
53
+        Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, true);
54
+        //发起接口请求
55
+        return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true);
56
+
57
+    }
58
+    /**
59
+     * 查询认证授权流程详情
60
+     *
61
+     * @return
62
+     */
63
+    public static EsignHttpResponse queryAuthProcess(String authFlowId ) throws EsignDemoException {
64
+        String apiaddr = "/v3/auth-flow/" + authFlowId;
65
+        //请求参数body体,json格式。get或者delete请求时jsonString传空json:"{}"或者null
66
+        String jsonParm=null;
67
+        //请求方法
68
+        EsignRequestType requestType= EsignRequestType.GET;
69
+        //生成签名鉴权方式的的header
70
+        Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId,eSignAppSecret,jsonParm,requestType.name(),apiaddr,true);
71
+        //发起接口请求
72
+        return EsignHttpHelper.doCommHttp(eSignHost, apiaddr,requestType , jsonParm, header,true);
73
+    }
74
+
75
+
76
+
77
+
78
+    /**
79
+     *   步骤一:获取印章图片上传地址fileUploadUrl
80
+     *
81
+     * @return
82
+     */
83
+    public static EsignHttpResponse getFileUploadUrl(String filePath) throws EsignDemoException {
84
+        //自定义的文件封装类,传入文件地址可以获取文件的名称大小,文件流等数据
85
+        EsignFileBean esignFileBean = new EsignFileBean(filePath);
86
+        String apiaddr="/v3/files/file-key";
87
+        //请求参数body体,json格式。get或者delete请求时jsonString传空json:"{}"或者null
88
+        String jsonParm="{\n" +
89
+                "    \"contentMd5\": \""+esignFileBean.getFileContentMD5()+"\",\n" +
90
+                "    \"fileName\":\""+esignFileBean.getFileName()+"\"," +
91
+                "    \"fileSize\": "+esignFileBean.getFileSize()+",\n" +
92
+                "    \"contentType\": \""+ EsignHeaderConstant.CONTENTTYPE_STREAM.VALUE()+"\"\n" +
93
+                "}";
94
+        //请求方法
95
+        EsignRequestType requestType= EsignRequestType.POST;
96
+        //生成签名鉴权方式的的header
97
+        Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId,eSignAppSecret,jsonParm,requestType.name(),apiaddr,true);
98
+        //发起接口请求
99
+        EsignHttpResponse response = EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true);
100
+        System.out.println(response);
101
+        return response;
102
+    }
103
+
104
+    /**
105
+     *   步骤二:将印章图片文件流上传到fileUploadUrl
106
+     *
107
+     * @return
108
+     */
109
+    public static EsignHttpResponse fileStreamUpload(String uploadUrl,String filePath) throws EsignDemoException {
110
+        //根据文件地址获取文件contentMd5
111
+        EsignFileBean esignFileBean = new EsignFileBean(filePath);
112
+        //请求方法
113
+        EsignRequestType requestType= EsignRequestType.PUT;
114
+        return EsignHttpHelper.doUploadHttp(uploadUrl,requestType,esignFileBean.getFileBytes(),esignFileBean.getFileContentMD5(), EsignHeaderConstant.CONTENTTYPE_STREAM.VALUE(),true);
115
+    }
116
+    public static void main(String[] args) throws Exception {
117
+       // createOrgByImage();
118
+      //  getOrgEmpower();
119
+       // queryAuthProcess("OF-2b00885895080028");
120
+       // getFileUploadUrl();
121
+//        String uplodUrl = "https://esignoss.esign.cn/7438987614/8e278262-5960-4004-bff3-297c11e2652e/Snipaste_2023-10-27_09-59-23.jpg?Expires=1699439095&OSSAccessKeyId=STS.NTZ8NBHcTVQXgsxVRH4iyC5AY&Signature=3yu3ZQifphZsnOgN0CI0SJdqFhY%3D&callback-var=eyJ4OmZpbGVfa2V5IjoiJDliM2Y3ZjkyLTdkOWUtNGZkZi04NWU4LWE4ZDU4MzEwZjIzOCQ0MTQwNTE2ODk5In0%3D%0A&callback=eyJjYWxsYmFja1VybCI6Imh0dHA6Ly9zbWx0YXBpLnRzaWduLmNuL2FueWRvb3IvZmlsZS1zeXN0ZW0vY2FsbGJhY2svYWxpb3NzIiwiY2FsbGJhY2tCb2R5IjogIntcIm1pbWVUeXBlXCI6JHttaW1lVHlwZX0sXCJzaXplXCI6ICR7c2l6ZX0sXCJidWNrZXRcIjogJHtidWNrZXR9LFwib2JqZWN0XCI6ICR7b2JqZWN0fSxcImV0YWdcIjogJHtldGFnfSxcImZpbGVfa2V5XCI6JHt4OmZpbGVfa2V5fX0iLCJjYWxsYmFja0JvZHlUeXBlIjogImFwcGxpY2F0aW9uL2pzb24ifQ%3D%3D%0A&security-token=CAIS%2BAF1q6Ft5B2yfSjIr5fvc%2FT2pbx14ZOzZVXJslIdOOZVrPDquzz2IHtKdXRvBu8Xs%2F4wnmxX7f4YlqB6T55OSAmcNZEoWWWTbdH4MeT7oMWQweEurv%2FMQBqyaXPS2MvVfJ%2BOLrf0ceusbFbpjzJ6xaCAGxypQ12iN%2B%2Fm6%2FNgdc9FHHPPD1x8CcxROxFppeIDKHLVLozNCBPxhXfKB0ca0WgVy0EHsPnvm5DNs0uH1AKjkbRM9r6ceMb0M5NeW75kSMqw0eBMca7M7TVd8RAi9t0t1%2FIVpGiY4YDAWQYLv0rda7DOltFiMkpla7MmXqlft%2BhzcgeQY0pc%2FRqAAXGx8FDtPQxW3RSasFgOFBJaxbYjH3WFFrbV25v8a%2BS9OWPAYqOCvmkxbM7N4hOge2iaBAG4SRLMb6ypPJ15YEpoZI8KkdeDvQJryZEWchmc0Lhz0yDRqrN%2BzYhgu4VpBJu1WJg%2FyXrvAZ0gWhBN%2BILrblSR9QHVWVVYZTAKN4ejIAA%3D";
122
+//       fileStreamUpload(uplodUrl,"D:\\develop\\Snipaste_2023-10-27_09-59-23.jpg");
123
+    }
124
+}

+ 1
- 1
ruoyi-common/src/main/java/com/ruoyi/common/utils/file/SaaSAPIFileUtils.java Просмотреть файл

82
         //生成签名鉴权方式的的header
82
         //生成签名鉴权方式的的header
83
         Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId,eSignAppSecret,jsonParm,requestType.name(),apiaddr,true);
83
         Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId,eSignAppSecret,jsonParm,requestType.name(),apiaddr,true);
84
         //发起接口请求
84
         //发起接口请求
85
-        return EsignHttpHelper.doCommHttp(eSignHost, apiaddr,requestType , jsonParm, header,true);
85
+        return EsignHttpHelper.doCommHttp(eSignHost, apiaddr,requestType , jsonParm, header,false);
86
     }
86
     }
87
 
87
 
88
 
88
 

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

43
      */
43
      */
44
     private String userName;
44
     private String userName;
45
 
45
 
46
+
46
 }
47
 }

+ 58
- 1
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/DeptIdentify.java Просмотреть файл

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 {
33
     /** 印章名称 */
32
     /** 印章名称 */
34
     private String sealName;
33
     private String sealName;
35
 
34
 
35
+    /** 机构账号ID */
36
+    private String orgId;
37
+
38
+    /** 认证授权流程ID */
39
+    private String authFlowId;
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
+     * 印章状态  0禁用,1启用
58
+     */
59
+    private Integer sealStatus;
60
+
61
+    public Integer getAnnexId() {
62
+        return annexId;
63
+    }
64
+
65
+    public void setAnnexId(Integer annexId) {
66
+        this.annexId = annexId;
67
+    }
68
+
69
+    public String getAuthFlowId() {
70
+        return authFlowId;
71
+    }
72
+
73
+    public void setAuthFlowId(String authFlowId) {
74
+        this.authFlowId = authFlowId;
75
+    }
76
+
77
+    public String getOrgId() {
78
+        return orgId;
79
+    }
80
+
81
+    public void setOrgId(String orgId) {
82
+        this.orgId = orgId;
83
+    }
84
+
36
     public String getSealName() {
85
     public String getSealName() {
37
         return sealName;
86
         return sealName;
38
     }
87
     }
123
     public void setIsUse(Integer isUse) {
172
     public void setIsUse(Integer isUse) {
124
         this.isUse = isUse;
173
         this.isUse = isUse;
125
     }
174
     }
175
+
176
+    public Integer getSealStatus() {
177
+        return sealStatus;
178
+    }
179
+
180
+    public void setSealStatus(Integer sealStatus) {
181
+        this.sealStatus = sealStatus;
182
+    }
126
 }
183
 }

+ 27
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/SealListVO.java Просмотреть файл

1
+package com.ruoyi.wisdomarbitrate.domain.vo;
2
+
3
+import lombok.Data;
4
+
5
+@Data
6
+public class SealListVO {
7
+    /** 印章id */
8
+    private String sealId;
9
+    /** 印章名称 */
10
+    private String sealName;
11
+    /**
12
+     * 印章状态  0禁用,1启用
13
+     */
14
+    private Integer sealStatus;
15
+    /**
16
+     * 附件id
17
+     */
18
+    private Integer annexId;
19
+    /**
20
+     * 附件路径
21
+     */
22
+    private String annexPath;
23
+    /**
24
+     * 附件类型,立案申请书(1)、申请人证据材料(2)、仲裁文书(3)、案件视频(4)、身份证件(5)、被申请人证据材料 (6)、庭审笔录(7)、缴费凭证(8)'
25
+     */
26
+    private Integer annexType;
27
+}

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

23
     int deleteByFileIds(@Param("ids") List<Integer> fileIds);
23
     int deleteByFileIds(@Param("ids") List<Integer> fileIds);
24
 
24
 
25
     List<CaseAttach> getCaseAttachByCaseIdAndType(CaseAttach caseAttach);
25
     List<CaseAttach> getCaseAttachByCaseIdAndType(CaseAttach caseAttach);
26
+
27
+    CaseAttach queryAnnexById(Integer annexId);
26
 }
28
 }

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

19
     int updateDeptIdentify(DeptIdentify deptIdentify);
19
     int updateDeptIdentify(DeptIdentify deptIdentify);
20
 
20
 
21
     List<DeptIdentify> selectDeptIdentifylistother(DeptIdentify deptIdentify);
21
     List<DeptIdentify> selectDeptIdentifylistother(DeptIdentify deptIdentify);
22
+
22
 }
23
 }

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

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 com.ruoyi.wisdomarbitrate.domain.vo.SealListVO;
7
+import org.springframework.web.multipart.MultipartFile;
6
 
8
 
7
 import java.util.List;
9
 import java.util.List;
8
 
10
 
15
     DeptIdentify selectDeptIndefiUrl(DeptIdentify deptIdentify) throws EsignDemoException;
17
     DeptIdentify selectDeptIndefiUrl(DeptIdentify deptIdentify) throws EsignDemoException;
16
 
18
 
17
     AjaxResult enableDept(DeptIdentify deptIdentify);
19
     AjaxResult enableDept(DeptIdentify deptIdentify);
20
+
21
+    AjaxResult sealUpload(DeptIdentify deptIdentify, MultipartFile file);
22
+
23
+
24
+    AjaxResult receiveNotify(String body);
25
+
26
+    List<SealListVO> getSealList(DeptIdentify deptIdentify);
27
+
28
+    AjaxResult updateSealLockStatus(DeptIdentify deptIdentify);
29
+
30
+
18
 }
31
 }

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

296
             String month = String.format("%02d", now.getMonthValue());
296
             String month = String.format("%02d", now.getMonthValue());
297
             String day = String.format("%02d", now.getDayOfMonth());
297
             String day = String.format("%02d", now.getDayOfMonth());
298
             String modalFilePath = "/data/arbitrate-document/template/新裁决书模板.docx";
298
             String modalFilePath = "/data/arbitrate-document/template/新裁决书模板.docx";
299
-            //String modalFilePath = "D:/develop/新裁决书模板.docx";
299
+           // String modalFilePath = "D:/develop/新裁决书模板.docx";
300
             String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
300
             String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
301
-            //String saveFolderPath = "D:/data/" + year + "/" + month + "/" + day;
301
+           // String saveFolderPath = "D:/data/" + year + "/" + month + "/" + day;
302
             String fileName = UUID.randomUUID().toString().replace("-", "") + ".docx";
302
             String fileName = UUID.randomUUID().toString().replace("-", "") + ".docx";
303
             String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
303
             String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
304
             String resultFilePath = saveFolderPath + "/" + fileName;
304
             String resultFilePath = saveFolderPath + "/" + fileName;
729
             //财产保全
729
             //财产保全
730
             Integer properPreser = caseApplication1.getProperPreser();
730
             Integer properPreser = caseApplication1.getProperPreser();
731
             String preservation = "本案受理后,申请人向仲裁委提交了财产保全申请,仲裁委根据《中华人民共和国仲裁法》" +
731
             String preservation = "本案受理后,申请人向仲裁委提交了财产保全申请,仲裁委根据《中华人民共和国仲裁法》" +
732
-                    "第二十八条之规定,将该申请提交至XXX市XXX区法院。";
732
+                    "第二十八条之规定,将该申请提交至法院。";
733
             if (properPreser == null) {
733
             if (properPreser == null) {
734
                 datas.put("preservation", null);
734
                 datas.put("preservation", null);
735
             } else if (properPreser == 1) {
735
             } else if (properPreser == 1) {

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

113
     private DeptIdentifyMapper deptIdentifyMapper;
113
     private DeptIdentifyMapper deptIdentifyMapper;
114
     @Autowired
114
     @Autowired
115
     private ReservedConferenceMapper reservedConferenceMapper;
115
     private ReservedConferenceMapper reservedConferenceMapper;
116
+    @Autowired
117
+    private SysDeptMapper deptMapper;
116
     // 手机号正则
118
     // 手机号正则
117
     private static final Pattern TELEPHONE_REGX = Pattern.compile("^1(3\\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\\d|9[0-35-9])\\d{8}$");
119
     private static final Pattern TELEPHONE_REGX = Pattern.compile("^1(3\\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\\d|9[0-35-9])\\d{8}$");
118
 
120
 
1753
                                                 }
1755
                                                 }
1754
                                             }
1756
                                             }
1755
                                         }
1757
                                         }
1756
-                                        EsignHttpResponse response3 = SignAward.createByFile(sealSignRecord);
1758
+                                        DeptIdentify deptIdentify1 = new DeptIdentify();
1759
+                                        deptIdentify1.setSealStatus(1); // 印章状态为启用
1760
+                                        //根据机构名称查询部门id
1761
+                                        SysDept sysDept = new SysDept();
1762
+                                        sysDept.setDeptName(sealSignRecord.getOrgnizeName());
1763
+                                        List<SysDept> sysDepts = deptMapper.selectDeptList(sysDept);
1764
+                                        if (sysDepts != null && sysDepts.size() > 0) {
1765
+                                            Long deptId = sysDepts.get(0).getDeptId();
1766
+                                            deptIdentify1.setDeptId(deptId);
1767
+                                        }
1768
+                                        List<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentifylistother(deptIdentify1);
1769
+                                        List<String> sealIds = new ArrayList<>();
1770
+                                        if (deptIdentifies != null && deptIdentifies.size() > 0) {
1771
+                                            for (DeptIdentify identify : deptIdentifies) {
1772
+                                                String sealId = identify.getSealId();
1773
+                                                sealIds.add(sealId);
1774
+                                            }
1775
+                                        }
1776
+                                        EsignHttpResponse response3 = SignAward.createByFile(sealSignRecord,sealIds);
1757
                                         JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody());
1777
                                         JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody());
1758
                                         if (jsonObject3.getIntValue("code") == 0) {
1778
                                         if (jsonObject3.getIntValue("code") == 0) {
1759
                                             //获取签署流程ID
1779
                                             //获取签署流程ID
1903
 
1923
 
1904
         for (CaseAffiliate caseAffiliate : caseAffiliates) {
1924
         for (CaseAffiliate caseAffiliate : caseAffiliates) {
1905
             request.setPhone(caseAffiliate.getContactTelphone());
1925
             request.setPhone(caseAffiliate.getContactTelphone());
1926
+            request.setTemplateParamSet(new String[]{caseAffiliate.getName(), caseApplicationselect.getCaseNum(), messageVO.getRoomNo() + caseAffiliate.getUserId()});
1927
+            // 1952136 普通短信 尊敬的{1}用户,您的{2}仲裁案件,开庭审理房间号为{3},请在浏览器打开https://miniapp-3gpama6l759911ef-1321289474.tcloudbaseapp.com/jump-mp.html 请知晓,如非本人操作,请忽略本短信。
1906
             String userId = (null==caseAffiliate.getUserId()?"" : caseAffiliate.getUserId());
1928
             String userId = (null==caseAffiliate.getUserId()?"" : caseAffiliate.getUserId());
1907
             if(messageVO.getScheduleStartTime()==null) {
1929
             if(messageVO.getScheduleStartTime()==null) {
1908
                 // 1983692	开庭审理创建会议通知  尊敬的{1}用户,您的{2}仲裁案件,开庭审理房间号为{3},请点击https://txroom.xayunmei.com/#/home, 请知晓,如非本人操作,请忽略本短信。
1930
                 // 1983692	开庭审理创建会议通知  尊敬的{1}用户,您的{2}仲裁案件,开庭审理房间号为{3},请点击https://txroom.xayunmei.com/#/home, 请知晓,如非本人操作,请忽略本短信。
1918
             smsSendRecord.setCaseNum(caseApplicationselect.getCaseNum());
1940
             smsSendRecord.setCaseNum(caseApplicationselect.getCaseNum());
1919
             smsSendRecord.setPhone(request.getPhone());
1941
             smsSendRecord.setPhone(request.getPhone());
1920
             smsSendRecord.setSendTime(new Date());
1942
             smsSendRecord.setSendTime(new Date());
1921
-            String content="";
1943
+            String content = "";
1922
             if(messageVO.getScheduleStartTime()==null) {
1944
             if(messageVO.getScheduleStartTime()==null) {
1923
                  content = "尊敬的" + caseAffiliate.getName() + "用户,您的" + caseApplicationselect.getCaseNum() + "仲裁案件,开庭审理房间号为" + messageVO.getRoomNo() + userId + ",请点击https://txroom.xayunmei.com/#/home, 请知晓,如非本人操作,请忽略本短信。";
1945
                  content = "尊敬的" + caseAffiliate.getName() + "用户,您的" + caseApplicationselect.getCaseNum() + "仲裁案件,开庭审理房间号为" + messageVO.getRoomNo() + userId + ",请点击https://txroom.xayunmei.com/#/home, 请知晓,如非本人操作,请忽略本短信。";
1924
             }else {
1946
             }else {
1943
         }
1965
         }
1944
         return returnResult;
1966
         return returnResult;
1945
     }
1967
     }
1968
+
1946
     @Override
1969
     @Override
1947
     public SealSignRecord selectSignUrl(CaseApplication caseApplication) throws EsignDemoException {
1970
     public SealSignRecord selectSignUrl(CaseApplication caseApplication) throws EsignDemoException {
1948
         SealSignRecord sealSignRecord = new SealSignRecord();
1971
         SealSignRecord sealSignRecord = new SealSignRecord();
2486
 
2509
 
2487
     /**
2510
     /**
2488
      * 获取userSign,默认过期时间10小时
2511
      * 获取userSign,默认过期时间10小时
2512
+     *
2489
      * @param userId
2513
      * @param userId
2490
      * @return
2514
      * @return
2491
      */
2515
      */
2492
-    public String generateUserSign(String userId){
2516
+    public String generateUserSign(String userId) {
2493
         TLSSigAPIv2 tlsSigAPIv2 = new TLSSigAPIv2(sdkAppId, secretKey);
2517
         TLSSigAPIv2 tlsSigAPIv2 = new TLSSigAPIv2(sdkAppId, secretKey);
2494
         return tlsSigAPIv2.genUserSig(userId, 60 * 60 * 10);
2518
         return tlsSigAPIv2.genUserSig(userId, 60 * 60 * 10);
2495
     }
2519
     }
2497
 
2521
 
2498
     /**
2522
     /**
2499
      * 预约会议
2523
      * 预约会议
2524
+     *
2500
      * @param reservedConferenceVO
2525
      * @param reservedConferenceVO
2501
      * @return
2526
      * @return
2502
      * @throws Exception
2527
      * @throws Exception
2514
         Date endTime = reservedConferenceVO.getScheduleEndTime();
2539
         Date endTime = reservedConferenceVO.getScheduleEndTime();
2515
         Random rand = new Random();
2540
         Random rand = new Random();
2516
         int random = rand.nextInt(214748365);
2541
         int random = rand.nextInt(214748365);
2517
-        String url="https://roomkit.trtc.tencent-cloud.com/room_api/v1/roomctl/create?usersig=" + userSign + "&identifier=" + administrator + "&sdkappid=" + sdkAppId + "&random=" +random + "&contenttype=json";
2542
+        String url = "https://roomkit.trtc.tencent-cloud.com/room_api/v1/roomctl/create?usersig=" + userSign + "&identifier=" + administrator + "&sdkappid=" + sdkAppId + "&random=" + random + "&contenttype=json";
2518
         HttpPost post = new HttpPost(url);
2543
         HttpPost post = new HttpPost(url);
2519
         String result = "";
2544
         String result = "";
2520
         //添加参数
2545
         //添加参数
2522
         JSONObject roomParams = new JSONObject();
2547
         JSONObject roomParams = new JSONObject();
2523
         bodyParams.put("ownerId", reservedConferenceVO.getOwnerId());
2548
         bodyParams.put("ownerId", reservedConferenceVO.getOwnerId());
2524
         bodyParams.put("roomId", reservedConferenceVO.getRoomId());
2549
         bodyParams.put("roomId", reservedConferenceVO.getRoomId());
2550
+        bodyParams.put("scheduleStartTime", startTime);
2551
+        bodyParams.put("scheduleEndTime", endTime);
2552
+
2525
         bodyParams.put("scheduleStartTime",startTime.getTime()/1000 );
2553
         bodyParams.put("scheduleStartTime",startTime.getTime()/1000 );
2526
         bodyParams.put("scheduleEndTime",endTime.getTime()/1000);
2554
         bodyParams.put("scheduleEndTime",endTime.getTime()/1000);
2527
         roomParams.put("roomType", 1);
2555
         roomParams.put("roomType", 1);
2565
 
2593
 
2566
     /**
2594
     /**
2567
      * 销毁房间回调
2595
      * 销毁房间回调
2596
+     *
2568
      * @param body
2597
      * @param body
2569
      * @param request
2598
      * @param request
2570
      */
2599
      */

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

1
 package com.ruoyi.wisdomarbitrate.service.impl;
1
 package com.ruoyi.wisdomarbitrate.service.impl;
2
 
2
 
3
 import cn.hutool.core.collection.CollectionUtil;
3
 import cn.hutool.core.collection.CollectionUtil;
4
+import com.deepoove.poi.data.PictureRenderData;
4
 import com.ruoyi.common.constant.CaseApplicationConstants;
5
 import com.ruoyi.common.constant.CaseApplicationConstants;
5
 import com.ruoyi.common.core.domain.AjaxResult;
6
 import com.ruoyi.common.core.domain.AjaxResult;
6
 import com.ruoyi.common.core.redis.RedisCache;
7
 import com.ruoyi.common.core.redis.RedisCache;
8
 import com.ruoyi.wisdomarbitrate.domain.*;
9
 import com.ruoyi.wisdomarbitrate.domain.*;
9
 import com.ruoyi.wisdomarbitrate.mapper.*;
10
 import com.ruoyi.wisdomarbitrate.mapper.*;
10
 import com.ruoyi.wisdomarbitrate.service.IAdjudicationService;
11
 import com.ruoyi.wisdomarbitrate.service.IAdjudicationService;
12
+import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
11
 import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils;
13
 import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils;
12
 import com.ruoyi.common.utils.SmsUtils;
14
 import com.ruoyi.common.utils.SmsUtils;
13
 import com.ruoyi.wisdomarbitrate.service.ICaseArbitrateService;
15
 import com.ruoyi.wisdomarbitrate.service.ICaseArbitrateService;
28
 import java.time.ZoneId;
30
 import java.time.ZoneId;
29
 import java.util.*;
31
 import java.util.*;
30
 import java.util.function.Function;
32
 import java.util.function.Function;
33
+import java.util.regex.Pattern;
31
 import java.util.stream.Collectors;
34
 import java.util.stream.Collectors;
32
 
35
 
33
 import static com.ruoyi.common.utils.SecurityUtils.getUsername;
36
 import static com.ruoyi.common.utils.SecurityUtils.getUsername;
50
     private IAdjudicationService adjudicationService;
53
     private IAdjudicationService adjudicationService;
51
     @Autowired
54
     @Autowired
52
     private RedisCache redisCache;
55
     private RedisCache redisCache;
56
+    @Autowired
57
+    private ICaseApplicationService caseApplicationService;
53
 
58
 
54
     @Override
59
     @Override
55
     @Transactional
60
     @Transactional
346
                     } else if (identityType == 2) {  //被申请人
351
                     } else if (identityType == 2) {  //被申请人
347
                         datas.put("resName", affiliate.getName());
352
                         datas.put("resName", affiliate.getName());
348
                         datas.put("resAddress", affiliate.getResidenAffili());
353
                         datas.put("resAddress", affiliate.getResidenAffili());
349
-                        datas.put("resSex", affiliate.getResponSex());
354
+                        String responSex = affiliate.getResponSex();
355
+                        if (responSex.equals("0")) {
356
+                            datas.put("resSex", "男");
357
+                        } else {
358
+                            datas.put("resSex", "女");
359
+                        }
350
                         Date responBirth = affiliate.getResponBirth();
360
                         Date responBirth = affiliate.getResponBirth();
351
                         if (responBirth != null) {
361
                         if (responBirth != null) {
352
                             SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
362
                             SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
495
             }
505
             }
496
             datas.put("claims", caseApplication1.getArbitratClaims());
506
             datas.put("claims", caseApplication1.getArbitratClaims());
497
             datas.put("request", caseApplication1.getRequestRule());
507
             datas.put("request", caseApplication1.getRequestRule());
498
-            //申请人证据材料
499
-            datas.put("appEvidenceMaterial", null);
500
-            //被申请人证据材料
501
-            datas.put("resEvidenceMaterial", null);
508
+            CaseApplication caseApplication2 = caseApplicationService.selectCaseApplication(caseApplication);
509
+            List<CaseAttach> caseAttachList1 = caseApplication2.getCaseAttachList();
510
+            if (caseAttachList1 != null && caseAttachList1.size() > 0) {
511
+                for (CaseAttach caseAttach : caseAttachList1) {
512
+                    if (caseAttach.getAnnexType() == 6) {   //被申请人证据材料
513
+                        String annexName = caseAttach.getAnnexName();
514
+                        boolean isImageFile = Pattern.matches(".*\\.(jpg|png|gif|bmp)$", annexName);
515
+                        if (isImageFile) {
516
+                            String annexPath = "/home/ruoyi" + caseAttach.getAnnexPath();
517
+                            System.out.println("路径是===========" + annexPath);
518
+                            PictureRenderData pictureRenderData = WordUtil
519
+                                    .rebuildImageContent(100, 100, null, annexPath);
520
+                            datas.put("resEvidenceMaterial", pictureRenderData);
521
+                        }
522
+                    } else if (caseAttach.getAnnexType() == 2) {   //申请人证据材料
523
+                        String annexName = caseAttach.getAnnexName();
524
+                        boolean isImageFile = Pattern.matches(".*\\.(jpg|png|gif|bmp)$", annexName);
525
+                        if (isImageFile) {
526
+                            String annexPath = "/home/ruoyi" + caseAttach.getAnnexPath();
527
+                            System.out.println("路径是===========" + annexPath);
528
+                            PictureRenderData pictureRenderData = WordUtil
529
+                                    .rebuildImageContent(100, 100, null, annexPath);
530
+                            //申请人证据材料
531
+                            datas.put("appEvidenceMaterial", pictureRenderData);
532
+                        }
533
+                    }
534
+                }
535
+            }
502
             datas.put("applicaCrossOpin", caseApplication1.getApplicaCrossOpin());
536
             datas.put("applicaCrossOpin", caseApplication1.getApplicaCrossOpin());
503
             if (arbitrateRecord1 != null) {
537
             if (arbitrateRecord1 != null) {
504
                 datas.put("factDetermi", arbitrateRecord1.getFactDetermi());
538
                 datas.put("factDetermi", arbitrateRecord1.getFactDetermi());

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

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;
7
+import com.ruoyi.common.constant.FileTransformation;
5
 import com.ruoyi.common.core.domain.AjaxResult;
8
 import com.ruoyi.common.core.domain.AjaxResult;
6
 import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
9
 import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
7
 import com.ruoyi.common.exception.EsignDemoException;
10
 import com.ruoyi.common.exception.EsignDemoException;
11
+import com.ruoyi.common.utils.SealUtil;
12
+import com.ruoyi.common.utils.file.FileUploadUtils;
13
+import com.ruoyi.wisdomarbitrate.domain.CaseAttach;
8
 import com.ruoyi.wisdomarbitrate.domain.DeptIdentify;
14
 import com.ruoyi.wisdomarbitrate.domain.DeptIdentify;
15
+import com.ruoyi.wisdomarbitrate.domain.vo.SealListVO;
16
+import com.ruoyi.wisdomarbitrate.mapper.CaseAttachMapper;
9
 import com.ruoyi.wisdomarbitrate.mapper.DeptIdentifyMapper;
17
 import com.ruoyi.wisdomarbitrate.mapper.DeptIdentifyMapper;
10
 import com.ruoyi.wisdomarbitrate.service.IDeptIdentifyService;
18
 import com.ruoyi.wisdomarbitrate.service.IDeptIdentifyService;
11
 import com.ruoyi.wisdomarbitrate.utils.SignAward;
19
 import com.ruoyi.wisdomarbitrate.utils.SignAward;
12
 import org.springframework.beans.factory.annotation.Autowired;
20
 import org.springframework.beans.factory.annotation.Autowired;
13
 import org.springframework.stereotype.Service;
21
 import org.springframework.stereotype.Service;
14
 import org.springframework.transaction.annotation.Transactional;
22
 import org.springframework.transaction.annotation.Transactional;
23
+import org.springframework.web.multipart.MultipartFile;
15
 
24
 
25
+import java.io.File;
26
+import java.io.IOException;
27
+import java.time.LocalDate;
28
+import java.util.ArrayList;
16
 import java.util.Date;
29
 import java.util.Date;
17
 import java.util.List;
30
 import java.util.List;
31
+import java.util.UUID;
18
 
32
 
19
 @Service
33
 @Service
20
 public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
34
 public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
21
 
35
 
22
     @Autowired
36
     @Autowired
23
     private DeptIdentifyMapper deptIdentifyMapper;
37
     private DeptIdentifyMapper deptIdentifyMapper;
38
+    @Autowired
39
+    private CaseAttachMapper caseAttachMapper;
24
 
40
 
25
 
41
 
26
     @Override
42
     @Override
27
     @Transactional
43
     @Transactional
28
     public List<DeptIdentify> selectDeptIdentify(DeptIdentify deptIdentify) {
44
     public List<DeptIdentify> selectDeptIdentify(DeptIdentify deptIdentify) {
29
         List<DeptIdentify> deptIdentifys = deptIdentifyMapper.selectDeptIdentify(deptIdentify);
45
         List<DeptIdentify> deptIdentifys = deptIdentifyMapper.selectDeptIdentify(deptIdentify);
30
-        if(deptIdentifys!=null&&deptIdentifys.size()>0){
46
+        if (deptIdentifys != null && deptIdentifys.size() > 0) {
31
             for (int i = 0; i < deptIdentifys.size(); i++) {
47
             for (int i = 0; i < deptIdentifys.size(); i++) {
32
                 DeptIdentify deptIdentifyselect = deptIdentifys.get(i);
48
                 DeptIdentify deptIdentifyselect = deptIdentifys.get(i);
33
                 List<DeptIdentify> deptIdentifylist = deptIdentifyMapper.selectDeptIdentifyBydeptid(deptIdentifyselect);
49
                 List<DeptIdentify> deptIdentifylist = deptIdentifyMapper.selectDeptIdentifyBydeptid(deptIdentifyselect);
34
-                if(deptIdentifylist!=null&&deptIdentifylist.size()>0){
50
+                if (deptIdentifylist != null && deptIdentifylist.size() > 0) {
35
                     continue;
51
                     continue;
36
-                }else {
52
+                } else {
37
                     deptIdentifyselect.setIdentifyStatus(0);
53
                     deptIdentifyselect.setIdentifyStatus(0);
38
                     deptIdentifyMapper.insertDeptIdentify(deptIdentifyselect);
54
                     deptIdentifyMapper.insertDeptIdentify(deptIdentifyselect);
39
                 }
55
                 }
49
     public DeptIdentify selectDeptIndefiUrl(DeptIdentify deptIdentify) throws EsignDemoException {
65
     public DeptIdentify selectDeptIndefiUrl(DeptIdentify deptIdentify) throws EsignDemoException {
50
         List<DeptIdentify> deptIdentifysnew = deptIdentifyMapper.selectDeptIdentifylist(deptIdentify);
66
         List<DeptIdentify> deptIdentifysnew = deptIdentifyMapper.selectDeptIdentifylist(deptIdentify);
51
         DeptIdentify deptIdentifynew = new DeptIdentify();
67
         DeptIdentify deptIdentifynew = new DeptIdentify();
52
-        if(deptIdentifysnew!=null&&deptIdentifysnew.size()>0){
68
+        if (deptIdentifysnew != null && deptIdentifysnew.size() > 0) {
53
             Gson gson = new Gson();
69
             Gson gson = new Gson();
54
             DeptIdentify deptIdentifyselect = deptIdentifysnew.get(0);
70
             DeptIdentify deptIdentifyselect = deptIdentifysnew.get(0);
55
             EsignHttpResponse identifyUrl = SignAward.deptIdentifyUrl(deptIdentifyselect);
71
             EsignHttpResponse identifyUrl = SignAward.deptIdentifyUrl(deptIdentifyselect);
56
             JsonObject signUrlJsonObject = gson.fromJson(identifyUrl.getBody(), JsonObject.class);
72
             JsonObject signUrlJsonObject = gson.fromJson(identifyUrl.getBody(), JsonObject.class);
73
+            int code = signUrlJsonObject.get("code").getAsInt();
57
             JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data");
74
             JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data");
58
             String url = signUrlData.get("authUrl").getAsString();
75
             String url = signUrlData.get("authUrl").getAsString();
76
+            //获取本次认证授权流程ID
77
+            String authFlowId = signUrlData.get("authFlowId").getAsString();
78
+            deptIdentify.setAuthFlowId(authFlowId);
59
             deptIdentifynew.setIdentifyUrl(url);
79
             deptIdentifynew.setIdentifyUrl(url);
80
+            deptIdentify.setIdentifyDate(new Date());
81
+            int row = deptIdentifyMapper.updateDeptIdentify(deptIdentify);
60
         }
82
         }
61
-
62
-        deptIdentify.setIdentifyDate(new Date());
63
-        int row = deptIdentifyMapper.updateDeptIdentify(deptIdentify);
64
         return deptIdentifynew;
83
         return deptIdentifynew;
65
     }
84
     }
66
 
85
 
70
         List<DeptIdentify> deptIdentifysnew = deptIdentifyMapper.selectDeptIdentifylist(deptIdentify);
89
         List<DeptIdentify> deptIdentifysnew = deptIdentifyMapper.selectDeptIdentifylist(deptIdentify);
71
         DeptIdentify deptIdentifyselect = deptIdentifysnew.get(0);
90
         DeptIdentify deptIdentifyselect = deptIdentifysnew.get(0);
72
         Integer identifyStatus = deptIdentifyselect.getIdentifyStatus();
91
         Integer identifyStatus = deptIdentifyselect.getIdentifyStatus();
73
-        if(identifyStatus.intValue()==0){
92
+        if (identifyStatus.intValue() == 0) {
74
             return AjaxResult.error("这个认证数据未进行认证,不能启用");
93
             return AjaxResult.error("这个认证数据未进行认证,不能启用");
75
-        }else if(identifyStatus.intValue()==1){
94
+        } else if (identifyStatus.intValue() == 1) {
76
             deptIdentifyselect.setIsUse(1);
95
             deptIdentifyselect.setIsUse(1);
77
             deptIdentifyMapper.updateDeptIdentify(deptIdentifyselect);
96
             deptIdentifyMapper.updateDeptIdentify(deptIdentifyselect);
78
 
97
 
80
             deptIdentifySel.setId(deptIdentify.getId());
99
             deptIdentifySel.setId(deptIdentify.getId());
81
             deptIdentifySel.setIdentifyStatus(1);
100
             deptIdentifySel.setIdentifyStatus(1);
82
             List<DeptIdentify> deptIdentifysother = deptIdentifyMapper.selectDeptIdentifylistother(deptIdentifySel);
101
             List<DeptIdentify> deptIdentifysother = deptIdentifyMapper.selectDeptIdentifylistother(deptIdentifySel);
83
-            if(deptIdentifysother!=null&&deptIdentifysother.size()>0){
102
+            if (deptIdentifysother != null && deptIdentifysother.size() > 0) {
84
                 for (int i = 0; i < deptIdentifysother.size(); i++) {
103
                 for (int i = 0; i < deptIdentifysother.size(); i++) {
85
                     DeptIdentify deptIdentifyother = deptIdentifysother.get(i);
104
                     DeptIdentify deptIdentifyother = deptIdentifysother.get(i);
86
                     deptIdentifyother.setIsUse(0);
105
                     deptIdentifyother.setIsUse(0);
93
 
112
 
94
     }
113
     }
95
 
114
 
115
+    @Override
116
+    public AjaxResult sealUpload(DeptIdentify deptIdentify, MultipartFile file) {
117
+        try {
118
+            if (file.isEmpty()) {
119
+                return AjaxResult.error("请选择要上传的文件");
120
+            }
121
+            String filePath = RuoYiConfig.getUploadPath();
122
+            // 上传
123
+            String fileName = FileUploadUtils.upload(filePath, file);
124
+            List<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentifyBydeptid(deptIdentify);
125
+            if (deptIdentifies != null && deptIdentifies.size() > 0) {
126
+                for (DeptIdentify identify : deptIdentifies) {
127
+                    //先判断企业用户是否授予资源管理权限
128
+                    String authFlowId = identify.getAuthFlowId();
129
+                    EsignHttpResponse response1 = SealUtil.queryAuthProcess(authFlowId);
130
+                    JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody());
131
+                    int authorizedStatus = jsonObject1.getJSONObject("data").getIntValue("authorizedStatus");
132
+                    if (authorizedStatus == 1) {//授权流程状态 0流程过期失效  1已授权 2授权中  3审批未通过
133
+                        String prefix = "/profile";
134
+                        int startIndex = fileName.indexOf(prefix);
135
+                        startIndex += prefix.length();
136
+                        String annexPath = "/uploadPath" + fileName.substring(startIndex);
137
+                        //创建机构图片印章
138
+                        EsignHttpResponse response = SignAward.createOrgByImage(identify, annexPath);
139
+                        JSONObject jsonObject = JSONObject.parseObject(response.getBody());
140
+                        int code = jsonObject.getIntValue("code");
141
+                        if (code == 0) {  //业务码,0表示成功,非0表示异常。
142
+                            String sealId = jsonObject.getJSONObject("data").getString("sealId");
143
+                            identify.setSealId(sealId);
144
+                            identify.setIsUse(0);  //设置印章使用状态为未启用
145
+                            //保存到表里
146
+                            int i = deptIdentifyMapper.updateDeptIdentify(identify);
147
+                            if (i > 0) {
148
+                                return AjaxResult.success("上传成功");
149
+                            }
150
+                        }
151
+                    }
152
+                    return AjaxResult.error("企业用户未授予资源管理权限");
153
+                }
154
+            }
155
+        } catch (IOException e) {
156
+            e.printStackTrace();
157
+        } catch (EsignDemoException e) {
158
+            e.printStackTrace();
159
+        }
160
+        return AjaxResult.error();
161
+    }
162
+
163
+    @Override
164
+    public AjaxResult receiveNotify(String body) {
165
+      /* 请求Body数据格式如下:
166
+        {
167
+                "action":"SEAL_AUDIT",
168
+                "auditStatus":1,
169
+                "psnId":"c7e00294**41e7",
170
+                "rejectReason":"",
171
+                "sealBizType":"COMMON",
172
+                "sealId":"af80ba0f-xx-xx-xx-a2da292d7f7f",
173
+                "sealName":"赵四的图片印章",
174
+                "statusDescription":"通过"
175
+        }*/
176
+        //解析body数据
177
+        try {
178
+            JSONObject jsonObject = JSONObject.parseObject(body);
179
+            String action = jsonObject.getString("action");
180
+            if (action.equals("SEAL_AUDIT")) {  //SEAL_AUDIT表示图片印章审核结果通知
181
+                String auditStatus = jsonObject.getString("auditStatus");
182
+                if (auditStatus.equals("1")) {   //图片印章审核结果   1通过 ,0驳回
183
+                    //审核通过,拿到印章id和机构账号ID
184
+                    String orgId = jsonObject.getString("orgId");
185
+                    String sealId = jsonObject.getString("sealId");
186
+                    //查询指定印章详情(机构)
187
+                    EsignHttpResponse response = SignAward.getOrgSeal(orgId, sealId);
188
+                    JSONObject jsonObject1 = JSONObject.parseObject(response.getBody());
189
+                    if (jsonObject1.getIntValue("code") == 0) {  //业务码,0表示成功,非0表示异常。
190
+                        int sealStatus = jsonObject1.getJSONObject("data").getIntValue("sealStatus");
191
+                        if (sealStatus == 1) {         //印章状态 1已启用,2待审核,3审核不通过,4 挂起
192
+                            String sealImageDownloadUrl = jsonObject1.getString("sealImageDownloadUrl");
193
+                            LocalDate now = LocalDate.now();
194
+                            String year = Integer.toString(now.getYear());
195
+                            String month = String.format("%02d", now.getMonthValue());
196
+                            String day = String.format("%02d", now.getDayOfMonth());
197
+                            String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
198
+                            String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf";
199
+                            String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
200
+                            String savePath = "/home/ruoyi/uploadPath/upload/";
201
+                            // 创建日期目录
202
+                            File saveFolder = new File(saveFolderPath);
203
+                            if (!saveFolder.exists()) {
204
+                                saveFolder.mkdirs();
205
+                            }
206
+                            String resultFilePath = saveFolderPath + "/" + fileName;
207
+                            File resultFilePathFile = new File(resultFilePath);
208
+                            if (!resultFilePathFile.exists()) {
209
+                                resultFilePathFile.createNewFile();
210
+                            }
211
+                            boolean downLoadFile = FileTransformation.downLoadFileByUrl(sealImageDownloadUrl, resultFilePath);
212
+                            if (downLoadFile) {
213
+                                CaseAttach caseAttach = new CaseAttach();
214
+                                caseAttach.setAnnexType(10);  //10代表印章图片
215
+                                caseAttach.setAnnexPath(savePath);
216
+                                caseAttach.setAnnexName(saveName);
217
+                                int i1 = caseAttachMapper.save(caseAttach);
218
+                                if (i1 > 0) {
219
+                                    //将附件id保存到公章管理表里
220
+                                    Integer annexId1 = caseAttach.getAnnexId();
221
+                                    DeptIdentify identify = new DeptIdentify();
222
+                                    identify.setSealId(sealId);
223
+                                    List<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentify(identify);
224
+                                    if (deptIdentifies != null && deptIdentifies.size() > 0) {
225
+                                        DeptIdentify identify1 = deptIdentifies.get(0);
226
+                                        identify1.setAnnexId(annexId1);
227
+                                        identify1.setSealStatus(1);  //启用
228
+                                        deptIdentifyMapper.updateDeptIdentify(identify1);
229
+                                    }
230
+                                }
231
+                            }
232
+                        }
233
+                    }
234
+                }
235
+            }
236
+        } catch (EsignDemoException e) {
237
+            e.printStackTrace();
238
+        } catch (IOException e) {
239
+            e.printStackTrace();
240
+        }
241
+        return new AjaxResult(200, "success");
242
+    }
243
+
244
+    @Override
245
+    public List<SealListVO> getSealList(DeptIdentify deptIdentify) {
246
+        List<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentifylistother(deptIdentify);
247
+        List<SealListVO> sealListVOS = new ArrayList<>();
248
+        if (deptIdentifies != null && deptIdentifies.size() > 0) {
249
+            for (DeptIdentify identify : deptIdentifies) {
250
+                SealListVO sealListVO = new SealListVO();
251
+                sealListVO.setSealId(identify.getSealId());
252
+                sealListVO.setSealName(identify.getSealName());
253
+                sealListVO.setSealStatus(identify.getSealStatus());
254
+                Integer annexId = identify.getAnnexId();
255
+                //根据附件id查询路径
256
+                CaseAttach caseAttach = caseAttachMapper.queryAnnexById(annexId);
257
+                String annexName = caseAttach.getAnnexName();
258
+                String prefix = "/profile";
259
+                int startIndex = annexName.indexOf(prefix);
260
+                startIndex += prefix.length();
261
+                String annexPath = "/uploadPath" + annexName.substring(startIndex);
262
+                sealListVO.setAnnexPath(annexPath);
263
+                sealListVO.setAnnexType(caseAttach.getAnnexType());
264
+                sealListVOS.add(sealListVO);
265
+            }
266
+        }
267
+        return sealListVOS;
268
+    }
96
 
269
 
270
+    @Override
271
+    public AjaxResult updateSealLockStatus(DeptIdentify deptIdentify) {
272
+        deptIdentifyMapper.updateDeptIdentify(deptIdentify);
273
+        return AjaxResult.success();
274
+    }
97
 }
275
 }

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

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;
7
 import com.ruoyi.common.constant.FileTransformation;
9
 import com.ruoyi.common.constant.FileTransformation;
8
 import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
10
 import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
9
 import com.ruoyi.common.exception.EsignDemoException;
11
 import com.ruoyi.common.exception.EsignDemoException;
12
+import com.ruoyi.common.utils.SealUtil;
10
 import com.ruoyi.common.utils.file.SaaSAPIFileUtils;
13
 import com.ruoyi.common.utils.file.SaaSAPIFileUtils;
11
 import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
14
 import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
12
 import com.ruoyi.wisdomarbitrate.domain.CaseAttach;
15
 import com.ruoyi.wisdomarbitrate.domain.CaseAttach;
41
 
44
 
42
     @Scheduled(cron = "0/10 * * * * ?")
45
     @Scheduled(cron = "0/10 * * * * ?")
43
     @Transactional
46
     @Transactional
44
-    public void fixExecuteSelectFlowDetailUtils(){
47
+    public void fixExecuteSelectFlowDetailUtils() {
45
         Gson gson = new Gson();
48
         Gson gson = new Gson();
46
 
49
 
47
         SealSignRecord sealSignRecordselect = new SealSignRecord();
50
         SealSignRecord sealSignRecordselect = new SealSignRecord();
49
         List<SealSignRecord> sealSignRecords = sealSignRecordMapper.selectSealSignRecordbyStat(sealSignRecordselect);
52
         List<SealSignRecord> sealSignRecords = sealSignRecordMapper.selectSealSignRecordbyStat(sealSignRecordselect);
50
 
53
 
51
         try {
54
         try {
52
-            if(sealSignRecords!=null&&sealSignRecords.size()>0){
55
+            if (sealSignRecords != null && sealSignRecords.size() > 0) {
53
                 for (int i = 0; i < sealSignRecords.size(); i++) {
56
                 for (int i = 0; i < sealSignRecords.size(); i++) {
54
                     SealSignRecord sealSignRecord = sealSignRecords.get(i);
57
                     SealSignRecord sealSignRecord = sealSignRecords.get(i);
55
                     EsignHttpResponse signFlowDetail = SignAward.signFlowDetail(sealSignRecord);
58
                     EsignHttpResponse signFlowDetail = SignAward.signFlowDetail(sealSignRecord);
56
-                    JsonObject signFlowDetailJsonObject = gson.fromJson(signFlowDetail.getBody(),JsonObject.class);
59
+                    JsonObject signFlowDetailJsonObject = gson.fromJson(signFlowDetail.getBody(), JsonObject.class);
57
                     JsonObject flowDetailData = signFlowDetailJsonObject.getAsJsonObject("data");
60
                     JsonObject flowDetailData = signFlowDetailJsonObject.getAsJsonObject("data");
58
                     JsonArray signersArray = flowDetailData.get("signers").getAsJsonArray();
61
                     JsonArray signersArray = flowDetailData.get("signers").getAsJsonArray();
59
                     Integer psnsignStatus = null;
62
                     Integer psnsignStatus = null;
60
                     Integer orgsignStatus = null;
63
                     Integer orgsignStatus = null;
61
                     for (int j = 0; j < signersArray.size(); j++) {
64
                     for (int j = 0; j < signersArray.size(); j++) {
62
-                        JsonObject signerObject = (JsonObject)signersArray.get(j);
65
+                        JsonObject signerObject = (JsonObject) signersArray.get(j);
63
 
66
 
64
-                        if(!(signerObject.get("psnSigner").toString()).equals("null")){
67
+                        if (!(signerObject.get("psnSigner").toString()).equals("null")) {
65
                             JsonObject psnSignerData = signerObject.getAsJsonObject("psnSigner");
68
                             JsonObject psnSignerData = signerObject.getAsJsonObject("psnSigner");
66
-                            if(psnSignerData!=null){
69
+                            if (psnSignerData != null) {
67
                                 psnsignStatus = signerObject.get("signStatus").getAsInt();
70
                                 psnsignStatus = signerObject.get("signStatus").getAsInt();
68
                             }
71
                             }
69
                         }
72
                         }
70
-                        if(!(signerObject.get("orgSigner").toString()).equals("null")){
73
+                        if (!(signerObject.get("orgSigner").toString()).equals("null")) {
71
                             JsonObject orgSignerData = signerObject.getAsJsonObject("orgSigner");
74
                             JsonObject orgSignerData = signerObject.getAsJsonObject("orgSigner");
72
-                            if(orgSignerData!=null){
75
+                            if (orgSignerData != null) {
73
                                 orgsignStatus = signerObject.get("signStatus").getAsInt();
76
                                 orgsignStatus = signerObject.get("signStatus").getAsInt();
74
                             }
77
                             }
75
                         }
78
                         }
76
 
79
 
77
                     }
80
                     }
78
-                    if((psnsignStatus.intValue()==2)&&(orgsignStatus.intValue()==1)){
81
+                    if ((psnsignStatus.intValue() == 2) && (orgsignStatus.intValue() == 1)) {
79
                         //更新立案申请状态为待用印
82
                         //更新立案申请状态为待用印
80
                         CaseApplication caseApplication = new CaseApplication();
83
                         CaseApplication caseApplication = new CaseApplication();
81
                         caseApplication.setId(sealSignRecord.getCaseAppliId());
84
                         caseApplication.setId(sealSignRecord.getCaseAppliId());
82
 
85
 
83
                         CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication);
86
                         CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication);
84
-                        if(caseApplicationselect!=null){
85
-                            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)) {
86
                                 caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATED_SEAL);
89
                                 caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATED_SEAL);
87
                                 caseApplicationMapper.submitCaseApplication(caseApplication);
90
                                 caseApplicationMapper.submitCaseApplication(caseApplication);
88
 
91
 
93
                         }
96
                         }
94
 
97
 
95
                     }
98
                     }
96
-                    if((psnsignStatus.intValue()==2)&&(orgsignStatus.intValue()==2)){
99
+                    if ((psnsignStatus.intValue() == 2) && (orgsignStatus.intValue() == 2)) {
97
                         //更新立案申请状态为待送达
100
                         //更新立案申请状态为待送达
98
                         CaseApplication caseApplication = new CaseApplication();
101
                         CaseApplication caseApplication = new CaseApplication();
99
                         caseApplication.setId(sealSignRecord.getCaseAppliId());
102
                         caseApplication.setId(sealSignRecord.getCaseAppliId());
100
 
103
 
101
                         CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication);
104
                         CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication);
102
-                        if(caseApplicationselect!=null){
103
-                            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)) {
104
                                 caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATION_DELIVERY);
107
                                 caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATION_DELIVERY);
105
                                 //下载审核完成的裁决书,
108
                                 //下载审核完成的裁决书,
106
                                 String signFlowId = sealSignRecord.getSignFlowid();
109
                                 String signFlowId = sealSignRecord.getSignFlowid();
107
                                 EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId);
110
                                 EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId);
108
-                                JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(),JsonObject.class);
111
+                                JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class);
109
                                 JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data");
112
                                 JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data");
110
                                 JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray();
113
                                 JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray();
111
-                                if(filesArray!=null&&filesArray.size()>0){
112
-                                    JsonObject fileObject = (JsonObject)filesArray.get(0);
114
+                                if (filesArray != null && filesArray.size() > 0) {
115
+                                    JsonObject fileObject = (JsonObject) filesArray.get(0);
113
                                     String fileDownloadUrl = fileObject.get("downloadUrl").toString();
116
                                     String fileDownloadUrl = fileObject.get("downloadUrl").toString();
114
                                     //修改"签署用印记录表"的状态为签署完成
117
                                     //修改"签署用印记录表"的状态为签署完成
115
                                     sealSignRecord.setSignFlowStatus(3);
118
                                     sealSignRecord.setSignFlowStatus(3);
116
-                                    sealSignRecord.setFileDownloadUrl(fileDownloadUrl.substring(1,fileDownloadUrl.length()-1));
119
+                                    sealSignRecord.setFileDownloadUrl(fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1));
117
                                     sealSignRecordMapper.updataSealSignRecord(sealSignRecord);
120
                                     sealSignRecordMapper.updataSealSignRecord(sealSignRecord);
118
 
121
 
119
-                                    String filearbitraUrl  = fileDownloadUrl.substring(1,fileDownloadUrl.length()-1);
122
+                                    String filearbitraUrl = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1);
120
                                     caseApplication.setFilearbitraUrl(filearbitraUrl);
123
                                     caseApplication.setFilearbitraUrl(filearbitraUrl);
121
                                     caseApplicationMapper.submitCaseApplication(caseApplication);
124
                                     caseApplicationMapper.submitCaseApplication(caseApplication);
122
 
125
 
135
                                         saveFolder.mkdirs();
138
                                         saveFolder.mkdirs();
136
                                     }
139
                                     }
137
                                     String resultFilePath = saveFolderPath + "/" + fileName;
140
                                     String resultFilePath = saveFolderPath + "/" + fileName;
138
-                                    File resultFilePathFile  = new File(resultFilePath);
141
+                                    File resultFilePathFile = new File(resultFilePath);
139
                                     if (!resultFilePathFile.exists()) {
142
                                     if (!resultFilePathFile.exists()) {
140
                                         resultFilePathFile.createNewFile();
143
                                         resultFilePathFile.createNewFile();
141
                                     }
144
                                     }
142
 
145
 
143
-                                   String fileDownloadUrlnew  = fileDownloadUrl.substring(1,fileDownloadUrl.length()-1);
144
-                                   boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath);
145
-                                   if(downLoadFile) {
146
-                                       Long caseAppliId = sealSignRecord.getCaseAppliId();
147
-                                       CaseAttach caseAttach = new CaseAttach();
148
-                                       caseAttach.setCaseAppliId(caseAppliId);
149
-                                       caseAttach.setAnnexType(3);
150
-                                       caseAttach.setAnnexPath(savePath);
151
-                                       caseAttach.setAnnexName(saveName);
152
-                                       caseAttachMapper.updateCaseAttachBycaseid(caseAttach);
153
-                                   }
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
+                                    }
154
 
157
 
155
                                 }
158
                                 }
156
                             }
159
                             }
162
             }
165
             }
163
         } catch (EsignDemoException e) {
166
         } catch (EsignDemoException e) {
164
             e.printStackTrace();
167
             e.printStackTrace();
165
-        }catch (IOException e) {
168
+        } catch (IOException e) {
166
             e.printStackTrace();
169
             e.printStackTrace();
167
         }
170
         }
168
 
171
 
169
     }
172
     }
170
 
173
 
171
-
172
     @Scheduled(cron = "0/30 * * * * ?")
174
     @Scheduled(cron = "0/30 * * * * ?")
173
     @Transactional
175
     @Transactional
174
     public void fixExecuteSelectDeptIndentifyUtils() throws EsignDemoException {
176
     public void fixExecuteSelectDeptIndentifyUtils() throws EsignDemoException {
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
-                String orgId = identifyInfoData.get("orgId").getAsString();
186
-                if(realnameStatus==1){
187
+                if (realnameStatus == 1) {
188
+                    String orgId = identifyInfoData.get("orgId").getAsString();
187
                     EsignHttpResponse identifyInfo1 = SignAward.deptIdentifySealList(orgId);
189
                     EsignHttpResponse identifyInfo1 = SignAward.deptIdentifySealList(orgId);
190
+                    //将orgId保存到数据库里
191
+                    DeptIdentify deptIdentifynew = deptIdentifysnew.get(i);
192
+                    deptIdentifynew.setOrgId(orgId);
188
                     JsonObject identifyInfoJsonObject1 = gson.fromJson(identifyInfo1.getBody(), JsonObject.class);
193
                     JsonObject identifyInfoJsonObject1 = gson.fromJson(identifyInfo1.getBody(), JsonObject.class);
189
                     JsonObject identifyInfoData1 = identifyInfoJsonObject1.getAsJsonObject("data");
194
                     JsonObject identifyInfoData1 = identifyInfoJsonObject1.getAsJsonObject("data");
190
                     JsonArray sealArray = identifyInfoData1.get("seals").getAsJsonArray();
195
                     JsonArray sealArray = identifyInfoData1.get("seals").getAsJsonArray();
191
                     String sealNames = "";
196
                     String sealNames = "";
192
-                    if(sealArray.size()>0){
197
+                    if (sealArray.size() > 0) {
193
                         for (int j = 0; j < sealArray.size(); j++) {
198
                         for (int j = 0; j < sealArray.size(); j++) {
194
-                            JsonObject sealObject = (JsonObject)sealArray.get(j);
199
+                            JsonObject sealObject = (JsonObject) sealArray.get(j);
195
                             String sealName = sealObject.get("sealName").toString();
200
                             String sealName = sealObject.get("sealName").toString();
196
-                            String sealNamenew = sealName.substring(1,sealName.length()-1);
197
-                            sealNames += sealNamenew +",";
201
+                            String sealNamenew = sealName.substring(1, sealName.length() - 1);
202
+                            sealNames += sealNamenew + ",";
198
                         }
203
                         }
199
                     }
204
                     }
200
-                    String sealName = sealNames.substring(0,sealNames.length()-1);
201
-                    DeptIdentify deptIdentifynew = deptIdentifysnew.get(i);
205
+                    String sealName = sealNames.substring(0, sealNames.length() - 1);
202
                     deptIdentifynew.setIdentifyStatus(1);
206
                     deptIdentifynew.setIdentifyStatus(1);
203
                     deptIdentifynew.setSealName(sealName);
207
                     deptIdentifynew.setSealName(sealName);
204
                     int row = deptIdentifyMapper.updateDeptIdentify(deptIdentifynew);
208
                     int row = deptIdentifyMapper.updateDeptIdentify(deptIdentifynew);
205
                 }
209
                 }
206
-
207
             }
210
             }
208
-
209
         }
211
         }
210
-
211
     }
212
     }
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
+                                    int i1 = caseAttachMapper.save(caseAttach);
267
+                                    if (i1>0){
268
+                                        //将附件id保存到公章管理表里
269
+                                        Integer annexId1 = caseAttach.getAnnexId();
270
+                                        identify.setAnnexId(annexId1);
271
+                                        deptIdentifyMapper.updateDeptIdentify(identify);
272
+                                    }
273
+                                }
274
+                            }
275
+                        }
276
+                    }
277
+                }
278
+            }
279
+        } catch (EsignDemoException e) {
280
+            e.printStackTrace();
281
+        } catch (IOException e) {
282
+            e.printStackTrace();
283
+        }
284
+    }
213
 }
285
 }
286
+
287
+

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

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
 
15
 import java.io.File;
17
 import java.io.File;
16
 import java.util.Date;
18
 import java.util.Date;
19
+import java.util.List;
17
 import java.util.Map;
20
 import java.util.Map;
18
 
21
 
19
 public class SignAward {
22
 public class SignAward {
20
 
23
 
21
-    private static String eSignHost= EsignApplicaConfig.EsignHost;
22
-    private static String eSignAppId= EsignApplicaConfig.EsignAppId;
23
-    private static String eSignAppSecret= EsignApplicaConfig.EsignAppSecret;
24
-
24
+    private static String eSignHost = EsignApplicaConfig.EsignHost;
25
+    private static String eSignAppId = EsignApplicaConfig.EsignAppId;
26
+    private static String eSignAppSecret = EsignApplicaConfig.EsignAppSecret;
25
 
27
 
26
 
28
 
27
     public static void main(String[] args) throws EsignDemoException {
29
     public static void main(String[] args) throws EsignDemoException {
89
 //        System.out.println("机构印章名称:" +sealNames.substring(0,sealNames.length()-1));
91
 //        System.out.println("机构印章名称:" +sealNames.substring(0,sealNames.length()-1));
90
 
92
 
91
 
93
 
92
-
93
-
94
         //查询签署流程详情
94
         //查询签署流程详情
95
 //        EsignHttpResponse signFlowDetail = signFlowDetail(sealSignRecord);
95
 //        EsignHttpResponse signFlowDetail = signFlowDetail(sealSignRecord);
96
 //        JsonObject signFlowDetailJsonObject = gson.fromJson(signFlowDetail.getBody(),JsonObject.class);
96
 //        JsonObject signFlowDetailJsonObject = gson.fromJson(signFlowDetail.getBody(),JsonObject.class);
120
 //        System.out.println(signFlowDetailJsonObject);
120
 //        System.out.println(signFlowDetailJsonObject);
121
 
121
 
122
 
122
 
123
-
124
-
125
     }
123
     }
126
 
124
 
127
 
125
 
128
-
129
     /**
126
     /**
130
      * 查询签署流程详情
127
      * 查询签署流程详情
128
+     *
131
      * @return
129
      * @return
132
      */
130
      */
133
     public static EsignHttpResponse signFlowDetail(SealSignRecord sealSignRecord) throws EsignDemoException {
131
     public static EsignHttpResponse signFlowDetail(SealSignRecord sealSignRecord) throws EsignDemoException {
134
         String signFlowId = sealSignRecord.getSignFlowid();
132
         String signFlowId = sealSignRecord.getSignFlowid();
135
-        String apiaddr= "/v3/sign-flow/"+ signFlowId + "/detail";
133
+        String apiaddr = "/v3/sign-flow/" + signFlowId + "/detail";
136
         String jsonParm = null;
134
         String jsonParm = null;
137
         //请求方法
135
         //请求方法
138
         EsignRequestType requestType = EsignRequestType.GET;
136
         EsignRequestType requestType = EsignRequestType.GET;
139
         //生成签名鉴权方式的的header
137
         //生成签名鉴权方式的的header
140
-        Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId,eSignAppSecret,jsonParm,requestType.name(),apiaddr,true);
138
+        Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, false);
141
         //发起接口请求
139
         //发起接口请求
142
-        return EsignHttpHelper.doCommHttp(eSignHost, apiaddr,requestType , jsonParm, header,true);
140
+        return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, false);
143
     }
141
     }
144
 
142
 
145
 
143
 
146
     /**
144
     /**
147
      * 发起签署
145
      * 发起签署
146
+     *
148
      * @return
147
      * @return
149
      * @throws EsignDemoException
148
      * @throws EsignDemoException
150
      */
149
      */
151
-    public static EsignHttpResponse createByFile(SealSignRecord sealSignRecord) throws EsignDemoException {
150
+    public static EsignHttpResponse createByFile(SealSignRecord sealSignRecord, List<String> sealIds) throws EsignDemoException {
152
         String apiaddr = "/v3/sign-flow/create-by-file";
151
         String apiaddr = "/v3/sign-flow/create-by-file";
153
 
152
 
154
         String fileId = sealSignRecord.getFileid();
153
         String fileId = sealSignRecord.getFileid();
169
         double positionXorg = sealSignRecord.getPositionXorg();
168
         double positionXorg = sealSignRecord.getPositionXorg();
170
         double positionYorg = sealSignRecord.getPositionYorg();
169
         double positionYorg = sealSignRecord.getPositionYorg();
171
 
170
 
172
-        String availableSealId = "209af82b-5f87-4e0a-b0d8-cc4923b6e652";
173
 
171
 
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
+                "                               \"" + sealIds + "\"\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" +
270
         //请求方法
268
         //请求方法
271
         EsignRequestType requestType = EsignRequestType.POST;
269
         EsignRequestType requestType = EsignRequestType.POST;
272
         //生成请求签名鉴权方式的Header
270
         //生成请求签名鉴权方式的Header
273
-        Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, true);
271
+        Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, false);
274
         //发起接口请求
272
         //发起接口请求
275
-        return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true);
273
+        return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, false);
276
     }
274
     }
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
         //请求方法
298
         EsignRequestType requestType = EsignRequestType.POST;
297
         EsignRequestType requestType = EsignRequestType.POST;
299
         //生成请求签名鉴权方式的Header
298
         //生成请求签名鉴权方式的Header
300
-        Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, true);
299
+        Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, false);
301
         //发起接口请求
300
         //发起接口请求
302
-        return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true);
301
+        return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, false);
303
     }
302
     }
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
                 "}";
327
         //请求方法
327
         //请求方法
328
         EsignRequestType requestType = EsignRequestType.POST;
328
         EsignRequestType requestType = EsignRequestType.POST;
329
         //生成请求签名鉴权方式的Header
329
         //生成请求签名鉴权方式的Header
330
-        Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, true);
330
+        Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, false);
331
         //发起接口请求
331
         //发起接口请求
332
-        return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true);
332
+        return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, false);
333
     }
333
     }
334
 
334
 
335
     /**
335
     /**
336
-     * 获取机构认证链接
336
+     * 获取机构认证&授权页面链接
337
+     *
337
      * @return
338
      * @return
338
-     * @throws EsignDemoException
339
      */
339
      */
340
     public static EsignHttpResponse deptIdentifyUrl(DeptIdentify deptIdentify) throws EsignDemoException {
340
     public static EsignHttpResponse deptIdentifyUrl(DeptIdentify deptIdentify) throws EsignDemoException {
341
         String apiaddr = "/v3/org-auth-url";
341
         String apiaddr = "/v3/org-auth-url";
343
         String phonenumber = deptIdentify.getPhonenumber();
343
         String phonenumber = deptIdentify.getPhonenumber();
344
         String deptName = deptIdentify.getDeptName();
344
         String deptName = deptIdentify.getDeptName();
345
         String jsonParm = "{\n" +
345
         String jsonParm = "{\n" +
346
-                "            \"orgAuthConfig\": {\n" +
347
-                "                \"orgName\": \"" + deptName +  "\",\n" +
348
-                "                \"transactorInfo\": {\n" +
349
-                "                   \"psnAccount\": \"" + phonenumber +  "\",\n" +
350
-                "                   \"psnInfo\": {\n" +
351
-                "                              \"psnName\": \"" + nickName +  "\",\n" +
352
-                "                              \"psnMobile\": \"" + phonenumber +  "\"\n" +
353
-                "                         }\n" +
354
-
355
-                "                   }\n" +
346
+                "    \"orgAuthConfig\": {\n" +
347
+                "        \"orgName\": \"" + deptName + " \",\n" +
348
+                "        \"transactorInfo\": {\n" +
349
+                "            \"psnAccount\": \"" + phonenumber + "\",\n" +
350
+                "            \"psnInfo\": {\n" +
351
+                "                \"psnName\": \"" + nickName + "\",\n" +
352
+                "                 \"psnMobile\": \"" + phonenumber + "\"\n" +
356
                 "            }\n" +
353
                 "            }\n" +
354
+                "        }\n" +
355
+                "    },\n" +
356
+                "    \"authorizeConfig\": {\n" +
357
+                "        \"authorizedScopes\": [\n" +
358
+                "            \"get_org_identity_info\",\n" +
359
+                "            \"get_psn_identity_info\",\n" +
360
+                "            \"org_initiate_sign\",\n" +
361
+                "            \"psn_initiate_sign\",\n" +
362
+                "            \"manage_org_resource\",\n" +
363
+                "            \"manage_psn_resource\",\n" +
364
+                "            \"use_org_order\"\n" +
365
+                "        ]\n" +
366
+                "    }\n" +
357
                 "}";
367
                 "}";
358
         //请求方法
368
         //请求方法
359
         EsignRequestType requestType = EsignRequestType.POST;
369
         EsignRequestType requestType = EsignRequestType.POST;
360
         //生成请求签名鉴权方式的Header
370
         //生成请求签名鉴权方式的Header
361
-        Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, true);
371
+        Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, false);
362
         //发起接口请求
372
         //发起接口请求
363
-        return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true);
373
+        return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, false);
364
     }
374
     }
365
 
375
 
366
     /**
376
     /**
367
      * 查询企业认证状态
377
      * 查询企业认证状态
368
      */
378
      */
369
     public static EsignHttpResponse getDeptIdentifyInfo(DeptIdentify deptIdentify) throws EsignDemoException {
379
     public static EsignHttpResponse getDeptIdentifyInfo(DeptIdentify deptIdentify) throws EsignDemoException {
370
-        String apiaddr="/v3/organizations/identity-info?orgName="+deptIdentify.getDeptName();
380
+        String apiaddr = "/v3/organizations/identity-info?orgName=" + deptIdentify.getDeptName();
371
 
381
 
372
-        String jsonParm="{}";
382
+        String jsonParm = "{}";
373
         //请求方法
383
         //请求方法
374
-        EsignRequestType requestType= EsignRequestType.GET;
384
+        EsignRequestType requestType = EsignRequestType.GET;
375
         //生成签名鉴权方式的的header
385
         //生成签名鉴权方式的的header
376
-        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, false);
377
         //发起接口请求
387
         //发起接口请求
378
-        return EsignHttpHelper.doCommHttp(eSignHost, apiaddr,requestType , jsonParm, header,true);
388
+        return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, false);
379
     }
389
     }
390
+
380
     /**
391
     /**
381
      * 查询企业认证印章信息
392
      * 查询企业认证印章信息
382
      */
393
      */
383
     public static EsignHttpResponse deptIdentifySealList(String orgId) throws EsignDemoException {
394
     public static EsignHttpResponse deptIdentifySealList(String orgId) throws EsignDemoException {
384
-        int pageNum=1;
385
-        int pageSize=10;
386
-        String apiaddr="/v3/seals/org-own-seal-list?orgId="+orgId+"&pageNum="+pageNum+"&pageSize="+pageSize;
387
-        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;
388
         //请求方法
399
         //请求方法
389
-        EsignRequestType requestType= EsignRequestType.GET;
400
+        EsignRequestType requestType = EsignRequestType.GET;
390
         //生成签名鉴权方式的的header
401
         //生成签名鉴权方式的的header
391
-        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, false);
392
         //发起接口请求
403
         //发起接口请求
393
-        return EsignHttpHelper.doCommHttp(eSignHost, apiaddr,requestType , jsonParm, header,true);
404
+        return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, false);
394
     }
405
     }
395
 
406
 
396
 
407
 
397
-
398
     /**
408
     /**
399
      * 获取文件签名印章位置
409
      * 获取文件签名印章位置
410
+     *
400
      * @return
411
      * @return
401
      * @throws EsignDemoException
412
      * @throws EsignDemoException
402
      */
413
      */
412
         //请求方法
423
         //请求方法
413
         EsignRequestType requestType = EsignRequestType.POST;
424
         EsignRequestType requestType = EsignRequestType.POST;
414
         //生成请求签名鉴权方式的Header
425
         //生成请求签名鉴权方式的Header
415
-        Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, true);
426
+        Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, false);
416
         //发起接口请求
427
         //发起接口请求
417
-        return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true);
428
+        return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, false);
418
     }
429
     }
419
 
430
 
431
+    /**
432
+     * 创建机构图片印章
433
+     *
434
+     * @return
435
+     */
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, false);
474
+                    //发起接口请求
475
+                    return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, false);
476
+                }
477
+            }
478
+        }
479
+        return null;
480
+    }
481
+
482
+    /**
483
+     * 查询企业内部印章
484
+     */
420
 
485
 
486
+    public static EsignHttpResponse orgOwnSealList(DeptIdentify deptIdentify) throws EsignDemoException {
487
+        String orgId=deptIdentify.getOrgId();
488
+        int pageNum=1;
489
+        int pageSize=20;
421
 
490
 
491
+        String apiaddr="/v3/seals/org-own-seal-list?orgId="+orgId+"&pageNum="+pageNum+"&pageSize="+pageSize;
422
 
492
 
493
+        //请求参数body体,json格式。get或者delete请求时jsonString传空json:"{}"或者null
494
+        String jsonParm=null;
495
+        //请求方法
496
+        EsignRequestType requestType= EsignRequestType.GET;
497
+        //生成签名鉴权方式的的header
498
+        Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId,eSignAppSecret,jsonParm,requestType.name(),apiaddr,false);
499
+        //发起接口请求
500
+        return EsignHttpHelper.doCommHttp(eSignHost, apiaddr,requestType , jsonParm, header,false);
501
+    }
502
+    /**
503
+     * 查询指定印章详情(机构)
504
+     */
505
+
506
+    public static EsignHttpResponse getOrgSeal(String orgId,String sealId) throws EsignDemoException {
507
+        String apiaddr="/v3/seals/org-seal-info?orgId="+orgId+"&sealId="+sealId;
508
+
509
+        //请求参数body体,json格式。get或者delete请求时jsonString传空json:"{}"或者null
510
+        String jsonParm=null;
511
+        //请求方法
512
+        EsignRequestType requestType= EsignRequestType.GET;
513
+        //生成签名鉴权方式的的header
514
+        Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId,eSignAppSecret,jsonParm,requestType.name(),apiaddr,false);
515
+        //发起接口请求
516
+        return EsignHttpHelper.doCommHttp(eSignHost, apiaddr,requestType , jsonParm, header,false);
517
+    }
423
 }
518
 }

+ 12
- 2
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAttachMapper.xml Просмотреть файл

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
62
             </if>
63
             </if>
63
         </where>
64
         </where>
64
     </select>
65
     </select>
66
+    <select id="queryAnnexById" resultType="com.ruoyi.wisdomarbitrate.domain.CaseAttach">
67
+        select annex_id,annex_name,annex_path,annex_type,note,use_id,use_account
68
+        from case_attach
69
+        <where>
70
+            <if test="annexId != null ">
71
+                AND annex_id = #{annexId}
72
+            </if>
73
+        </where>
74
+    </select>
65
 
75
 
66
     <update id="updateCaseAttach" parameterType="CaseAttach">
76
     <update id="updateCaseAttach" parameterType="CaseAttach">
67
         update case_attach
77
         update case_attach

+ 26
- 6
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/DeptIdentifyMapper.xml Просмотреть файл

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"     />
20
+        <result property="sealStatus"     column="seal_status"     />
17
 
21
 
18
     </resultMap>
22
     </resultMap>
19
 
23
 
28
     </select>
32
     </select>
29
 
33
 
30
     <select id="selectDeptIdentifyBydeptid" parameterType="DeptIdentify" resultMap="DeptIdentifyResult">
34
     <select id="selectDeptIdentifyBydeptid" parameterType="DeptIdentify" resultMap="DeptIdentifyResult">
31
-        SELECT d.id ,d.dept_id ,d.user_id
35
+        SELECT d.id ,d.dept_id ,d.user_id ,d.org_id ,d.auth_flow_id
32
         from dept_identify d
36
         from dept_identify d
33
         <where>
37
         <where>
34
             <if test="deptId != null">
38
             <if test="deptId != null">
53
     </insert>
57
     </insert>
54
 
58
 
55
     <select id="selectDeptIdentifylist" parameterType="DeptIdentify" resultMap="DeptIdentifyResult">
59
     <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
60
+        SELECT  d.id ,d.dept_id ,d.user_id, d.identify_status ,d.identify_date ,d.is_use , d.seal_name,
61
+               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
62
         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
63
         left join sys_user u on u.user_id  = d.user_id
60
         <where>
64
         <where>
71
     </select>
75
     </select>
72
 
76
 
73
     <select id="selectDeptIdentifylistother" parameterType="DeptIdentify" resultMap="DeptIdentifyResult">
77
     <select id="selectDeptIdentifylistother" parameterType="DeptIdentify" resultMap="DeptIdentifyResult">
74
-        SELECT d.id ,d.dept_id ,d.user_id,d.identify_status ,d.is_use
78
+        SELECT d.id ,d.dept_id ,d.user_id,d.identify_status ,d.is_use ,d.sealName ,d.sealId ,d.annexId
75
         from dept_identify d
79
         from dept_identify d
76
         <where>
80
         <where>
77
             <if test="identifyStatus != null">
81
             <if test="identifyStatus != null">
78
                 AND d.identify_status = #{identifyStatus}
82
                 AND d.identify_status = #{identifyStatus}
79
             </if>
83
             </if>
80
             <if test="id != null">
84
             <if test="id != null">
81
-                AND d.id != #{id}
85
+                AND d.id = #{id}
86
+            </if>
87
+            <if test="sealStatus != null">
88
+                AND d.seal_status = #{sealStatus}
89
+            </if>
90
+            <if test="deptId != null">
91
+                AND d.dept_id = #{deptId}
82
             </if>
92
             </if>
83
         </where>
93
         </where>
84
     </select>
94
     </select>
85
 
95
 
96
+
86
     <update id="updateDeptIdentify" parameterType="DeptIdentify">
97
     <update id="updateDeptIdentify" parameterType="DeptIdentify">
87
         update dept_identify
98
         update dept_identify
88
         <set>
99
         <set>
90
             <if test="isUse != null">is_use = #{isUse},</if>
101
             <if test="isUse != null">is_use = #{isUse},</if>
91
             <if test="identifyStatus != null ">identify_status = #{identifyStatus},</if>
102
             <if test="identifyStatus != null ">identify_status = #{identifyStatus},</if>
92
             <if test="sealName != null  and sealName != ''">seal_name = #{sealName},</if>
103
             <if test="sealName != null  and sealName != ''">seal_name = #{sealName},</if>
104
+            <if test="sealId != null  and sealId != ''">seal_id = #{sealId},</if>
105
+            <if test="sealStatus != null ">seal_status = #{sealStatus},</if>
93
         </set>
106
         </set>
94
-        where id = #{id}
107
+        <where>
108
+            <if test="id != null">
109
+                AND d.id = #{id}
110
+            </if>
111
+            <if test="sealId != null">
112
+                AND seal_id = #{sealId}
113
+            </if>
114
+        </where>
95
     </update>
115
     </update>
96
 
116
 
97
 
117