소스 검색

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

hejinbo 2 년 전
부모
커밋
52e0baa614

+ 10
- 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/bean/SealSignRecord.java 파일 보기

@@ -178,6 +178,16 @@ public class SealSignRecord extends BaseEntity {
178 178
     private double positionXorg;
179 179
     /** 印章位置y坐标 */
180 180
     private double positionYorg;
181
+    /** 案件申请id */
182
+    private Long caseAppliId;
183
+
184
+    public Long getCaseAppliId() {
185
+        return caseAppliId;
186
+    }
187
+
188
+    public void setCaseAppliId(Long caseAppliId) {
189
+        this.caseAppliId = caseAppliId;
190
+    }
181 191
 
182 192
     public Long getId() {
183 193
         return id;

+ 31
- 14
ruoyi-common/src/main/java/com/ruoyi/common/utils/file/SaaSAPIFileUtils.java 파일 보기

@@ -64,20 +64,37 @@ public class SaaSAPIFileUtils {
64 64
         return EsignHttpHelper.doCommHttp(eSignHost, apiaddr,requestType , jsonParm, header,true);
65 65
     }
66 66
 
67
-//  public static void main(String[] args) throws EsignDemoException {
68
- //      String filePath = "D:\\home\\ruoyi\\uploadPath\\upload\\2023\\10\\7\\b442880179844a848f1f8b08c29e3d0c.docx";
69
-//        EsignHttpResponse uploadUrl = getUploadUrl(filePath);
70
-//        String body = uploadUrl.getBody();
71
-//        JSONObject jsonObject = new JSONObject(body);
72
-//        JSONObject dataObj = jsonObject.getJSONObject("data");
73
-//        String fileUploadUrl = dataObj.get("fileUploadUrl").toString();
74
-//        System.out.println("这是fileUploadUrl:"+fileUploadUrl);
75
-//        String fileId = dataObj.get("fileId").toString();
76
-//        System.out.println("这是fileId:"+fileId);
77
-//        EsignHttpResponse esignHttpResponse = uploadFile(fileUploadUrl, filePath);
78
-//        System.out.println("这是上传文件流的结果:"+esignHttpResponse.getBody());
67
+    /**
68
+     * 下载已签署文件及附属材料
69
+     */
70
+    public static EsignHttpResponse fileDownloadUrl(String signFlowId) throws EsignDemoException {
71
+        String apiaddr = "/v3/sign-flow/"+ signFlowId +"/file-download-url";
72
+        //请求参数body体,json格式。get或者delete请求时jsonString传空json:"{}"或者null
73
+        String jsonParm=null;
74
+        //请求方法
75
+        EsignRequestType requestType= EsignRequestType.GET;
76
+        //生成签名鉴权方式的的header
77
+        Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId,eSignAppSecret,jsonParm,requestType.name(),apiaddr,true);
78
+        //发起接口请求
79
+        return EsignHttpHelper.doCommHttp(eSignHost, apiaddr,requestType , jsonParm, header,true);
80
+    }
81
+
82
+  public static void main(String[] args) throws EsignDemoException {
83
+      String filePath = "D:\\home\\ruoyi\\uploadPath\\upload\\2023\\10\\7\\23893bfd3f2249ffa5c82850c11c482e.docx";
84
+        EsignHttpResponse uploadUrl = getUploadUrl(filePath);
85
+        String body = uploadUrl.getBody();
86
+        JSONObject jsonObject = new JSONObject(body);
87
+        JSONObject dataObj = jsonObject.getJSONObject("data");
88
+        String fileUploadUrl = dataObj.get("fileUploadUrl").toString();
89
+        System.out.println("这是fileUploadUrl:"+fileUploadUrl);
90
+        String fileId = dataObj.get("fileId").toString();
91
+        System.out.println("这是fileId:"+fileId);
92
+      //String fileUploadUrl = "https://esignoss.esign.cn/1111564182/ccf6db5a-92da-4523-89ba-385a30423596/23893bfd3f2249ffa5c82850c11c482e.docx?Expires=1697021257&OSSAccessKeyId=STS.NTmgvSC8n5Zg1y7EciQftF23N&Signature=CxVZmpwFksWmLYkxPjVz9K4mVyA%3D&callback-var=eyJ4OmZpbGVfa2V5IjoiJDAyODhjOTg3LWNlNzgtNDM1OC04NWYwLTdlNmUyM2NjOTJmNiQzNDk1NzQ3MjE5In0%3D%0A&callback=eyJjYWxsYmFja1VybCI6Imh0dHA6Ly9zbWx0YXBpLnRzaWduLmNuL2FueWRvb3IvZmlsZS1zeXN0ZW0vY2FsbGJhY2svYWxpb3NzIiwiY2FsbGJhY2tCb2R5IjogIntcIm1pbWVUeXBlXCI6JHttaW1lVHlwZX0sXCJzaXplXCI6ICR7c2l6ZX0sXCJidWNrZXRcIjogJHtidWNrZXR9LFwib2JqZWN0XCI6ICR7b2JqZWN0fSxcImV0YWdcIjogJHtldGFnfSxcImZpbGVfa2V5XCI6JHt4OmZpbGVfa2V5fX0iLCJjYWxsYmFja0JvZHlUeXBlIjogImFwcGxpY2F0aW9uL2pzb24ifQ%3D%3D%0A&security-token=CAIS%2BAF1q6Ft5B2yfSjIr5fYLMznrudPgpiMM1%2BGoWM8XelYqfeYrDz2IHtKdXRvBu8Xs%2F4wnmxX7f4YlqB6T55OSAmcNZEofT7katr4MeT7oMWQweEurv%2FMQBqyaXPS2MvVfJ%2BOLrf0ceusbFbpjzJ6xaCAGxypQ12iN%2B%2Fm6%2FNgdc9FHHPPD1x8CcxROxFppeIDKHLVLozNCBPxhXfKB0ca0WgVy0EHsPnvm5DNs0uH1AKjkbRM9r6ceMb0M5NeW75kSMqw0eBMca7M7TVd8RAi9t0t1%2FIVpGiY4YDAWQYLv0rda7DOltFiMkpla7MmXqlft%2BhzcgeQY0pc%2FRqAAaxcPCSY0Du8wgErfR1llD8t2zeFG%2B1mktU4Rsl7AgxsSFxrwILBUk2x7imVsFVA0kkS8rNBMDKGIsIZTCl5M7S2L%2BD8364htwcZgIZYHK2fCN6gCuy%2Bfk9C%2FfQaTc00IWBMw8OubuJ%2Fq2mdMh32yoi7dLuJyhwt1z%2F%2BWf5vIFHdIAA%3D";
93
+        EsignHttpResponse esignHttpResponse = uploadFile(fileUploadUrl, filePath);
94
+        System.out.println("这是上传文件流的结果:"+esignHttpResponse.getBody());
79 95
 //       EsignHttpResponse fileStatus = getFileStatus(fileId);
80 96
 //        System.out.println("这是获取文件上传状态的结果:"+fileStatus.getBody());
81
-//        getFileStatus("a0c2ad21065f48ff8b872412c39d5d3a");
82
-//    }
97
+//        getFileStatus("a808f1f39a744357a2f018e4ab34c55d");
98
+//     fileDownloadUrl("");
99
+    }
83 100
 }

+ 6
- 2
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/SealSignRecordMapper.java 파일 보기

@@ -1,6 +1,10 @@
1 1
 package com.ruoyi.wisdomarbitrate.mapper;
2 2
 
3
-public interface SealSignRecordMapper {
4
-
3
+import com.ruoyi.common.utils.bean.SealSignRecord;
4
+import com.ruoyi.wisdomarbitrate.domain.CaseLogRecord;
5
+import org.apache.ibatis.annotations.Mapper;
5 6
 
7
+@Mapper
8
+public interface SealSignRecordMapper {
9
+    int insertSealSignRecord(SealSignRecord SealSignRecord);
6 10
 }

+ 0
- 14
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java 파일 보기

@@ -118,20 +118,6 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
118 118
                 datas.put("rulingFollows", arbitrateRecord1.getRulingFollows());
119 119
             }
120 120
             datas.put("legalProvisions", "仲裁法");
121
-            if (arbitratorName == null) {
122
-                datas.put("arbitratorName1", null);
123
-                datas.put("arbitratorName2", null);
124
-            } else if (arbitratorName.contains(",")) {
125
-                String[] nameArray = arbitratorName.split(",");
126
-                String firstName = nameArray[0];
127
-                String secondName = nameArray[1];
128
-                datas.put("arbitratorName1", firstName);
129
-                datas.put("arbitratorName2", secondName);
130
-            } else {
131
-                String secondName = "";
132
-                datas.put("arbitratorName1", arbitratorName);
133
-                datas.put("arbitratorName2", secondName);
134
-            }
135 121
             LocalDate now = LocalDate.now();
136 122
             String year = Integer.toString(now.getYear());
137 123
             String month = String.format("%02d", now.getMonthValue());

+ 132
- 1
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java 파일 보기

@@ -4,6 +4,9 @@ package com.ruoyi.wisdomarbitrate.service.impl;
4 4
 import cn.hutool.core.collection.CollectionUtil;
5 5
 import cn.hutool.core.util.StrUtil;
6 6
 
7
+
8
+import com.alibaba.fastjson.JSONArray;
9
+import com.alibaba.fastjson.JSONObject;
7 10
 import com.google.gson.Gson;
8 11
 import com.google.gson.JsonArray;
9 12
 import com.google.gson.JsonObject;
@@ -11,10 +14,16 @@ import com.ruoyi.common.annotation.DataScope;
11 14
 import com.ruoyi.common.constant.CaseApplicationConstants;
12 15
 import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
13 16
 import com.ruoyi.common.core.domain.entity.SysDept;
17
+
18
+import com.ruoyi.common.core.domain.entity.SysUser;
19
+
14 20
 import com.ruoyi.common.exception.EsignDemoException;
15 21
 import com.ruoyi.common.exception.ServiceException;
16 22
 import com.ruoyi.common.utils.SignAward;
17 23
 import com.ruoyi.common.utils.bean.SealSignRecord;
24
+
25
+import com.ruoyi.common.utils.file.SaaSAPIFileUtils;
26
+import com.ruoyi.system.mapper.SysUserMapper;
18 27
 import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils;
19 28
 import com.ruoyi.common.utils.DateUtils;
20 29
 import com.ruoyi.common.utils.SmsUtils;
@@ -28,6 +37,8 @@ import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
28 37
 import org.springframework.beans.factory.annotation.Autowired;
29 38
 import org.springframework.stereotype.Service;
30 39
 import org.springframework.transaction.annotation.Transactional;
40
+
41
+import java.io.File;
31 42
 import java.math.BigDecimal;
32 43
 import java.text.SimpleDateFormat;
33 44
 import java.util.*;
@@ -54,6 +65,13 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
54 65
     private CaseAttachMapper caseAttachMapper;
55 66
     @Autowired
56 67
     private SysDeptMapper sysDeptMapper;
68
+    @Autowired
69
+    private ICaseApplicationService caseApplicationService;
70
+    @Autowired
71
+    private SysUserMapper sysUserMapper;
72
+    @Autowired
73
+    private SealSignRecordMapper sealSignRecordMapper;
74
+
57 75
     // 手机号正则
58 76
     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}$");
59 77
 
@@ -697,10 +715,123 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
697 715
         arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord);
698 716
         Integer agreeOrNotCheck = caseApplication.getAgreeOrNotCheck();
699 717
         if(agreeOrNotCheck.intValue()==1){//同意审核
718
+            try {
719
+                //获取当前案件的裁决书
720
+                CaseApplication caseApplication2 = caseApplicationService.selectCaseApplication(caseApplication);
721
+                List<CaseAttach> caseAttachList = caseApplication2.getCaseAttachList();
722
+                if (caseAttachList != null && caseAttachList.size() > 0) {
723
+                    for (CaseAttach caseAttach : caseAttachList) {
724
+                        if (caseAttach.getAnnexType() == 3) {
725
+                            String annexPath = caseAttach.getAnnexPath();
726
+                            //String path = "/home/ruoyi/" + annexPath;
727
+                            String path ="D:\\home\\仲裁裁决书模板.docx";
728
+                            //获取文件上传地址
729
+                            EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path);
730
+                            String body = response.getBody();
731
+                            if (body != null){
732
+                                JSONObject jsonObject = JSONObject.parseObject(body);
733
+                                String fileId = jsonObject.getJSONObject("data").getString("fileId");
734
+                                String fileUploadUrl = jsonObject.getJSONObject("data").getString("fileUploadUrl");
735
+                                //上传文件流
736
+                                EsignHttpResponse response1 = SaaSAPIFileUtils.uploadFile(fileUploadUrl, path);
737
+                                JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody());
738
+                                if (jsonObject1.getIntValue("errCode")==0){
739
+                                    //查看文件上传状态
740
+                                    Thread.sleep(5000);
741
+                                    EsignHttpResponse response2 = SaaSAPIFileUtils.getFileStatus(fileId);
742
+                                    JSONObject jsonObject2 = JSONObject.parseObject(response2.getBody());
743
+                                    JSONObject data = jsonObject2.getJSONObject("data");
744
+                                    int fileStatus =data.getIntValue("fileStatus");
745
+                                    if (fileStatus == 2 || fileStatus == 5){
746
+                                        String fileName = data.getString("fileName");
747
+                                        //上传成功,获取文件签名印章位置
748
+                                        SealSignRecord sealSignRecord = new SealSignRecord();
749
+                                        sealSignRecord.setFileid(fileId);
750
+                                        EsignHttpResponse positions = SignAward.getPositions(sealSignRecord);
751
+                                        Gson gson = new Gson();
752
+                                        JsonObject positionsJsonObject = gson.fromJson(positions.getBody(), JsonObject.class);
753
+                                        JsonObject positionsData = positionsJsonObject.getAsJsonObject("data");
754
+                                        String keywordPositions = positionsData.get("keywordPositions").getAsString();
755
+                                        //发起签署
756
+                                        sealSignRecord.setFilename(fileName);
757
+                                        String arbitratorId = caseApplication2.getArbitratorId();
758
+                                        if (arbitratorId!=null){
759
+                                            SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(arbitratorId));
760
+                                            if (sysUser == null){
761
+                                                return rows;
762
+                                            }
763
+                                            sealSignRecord.setPensonAccount(sysUser.getPhonenumber());
764
+                                            sealSignRecord.setPensonName(sysUser.getNickName());
765
+                                        }
766
+                                        sealSignRecord.setOrgnizeName("西安云美电子科技有限公司");
767
+                                        sealSignRecord.setOrgnizeNamePsnAccount("秦桃则");
768
+                                        sealSignRecord.setOrgnizeName("西安云美电子科技有限公司");
769
+                                        sealSignRecord.setOrgnizeNamePsnAccount("17691338406");
770
+                                        sealSignRecord.setOrgnizeNamepsnName("韩超勃");
771
+                                        //解析文件签名印章位置
772
+                                        JSONArray jsonArray = JSONArray.parseArray(keywordPositions);
773
+                                        for (int i = 0; i < jsonArray.size(); i++) {
774
+                                            JSONObject jsonObject3 = jsonArray.getJSONObject(i);
775
+                                            String keyword = jsonObject3.getString("keyword");
776
+                                            if (keyword.equals("仲裁员")){
777
+                                                //签名
778
+                                                JSONArray positionsArray = jsonObject3.getJSONArray("positions");
779
+                                                // 遍历 positionsArray 中的每个元素
780
+                                                for (int j = 0; j < positionsArray.size(); j++){
781
+                                                    JSONObject positionObj = positionsArray.getJSONObject(j);
782
+                                                    int pageNum = positionObj.getIntValue("pageNum");
783
+                                                    sealSignRecord.setPositionPagepsn(String.valueOf(pageNum));
784
+                                                    JSONArray coordinatesArray = positionObj.getJSONArray("coordinates");
785
+                                                    JSONObject coordinateObj = coordinatesArray.getJSONObject(0);
786
+                                                    double positionX = coordinateObj.getDoubleValue("positionX");
787
+                                                    double positionY = coordinateObj.getDoubleValue("positionY");
788
+                                                    sealSignRecord.setPositionXpsn(positionX);
789
+                                                    sealSignRecord.setPositionYpsn(positionY);
790
+                                                }
791
+                                            }else {
792
+                                                //用印
793
+                                                JSONArray positionsArray = jsonObject3.getJSONArray("positions");
794
+                                                // 遍历 positionsArray 中的每个元素
795
+                                                for (int j = 0; j < positionsArray.size(); j++) {
796
+                                                    JSONObject positionObj = positionsArray.getJSONObject(j);
797
+                                                    int pageNum = positionObj.getIntValue("pageNum");
798
+                                                    sealSignRecord.setPositionPageorg(String.valueOf(pageNum));
799
+                                                    JSONArray coordinatesArray = positionObj.getJSONArray("coordinates");
800
+                                                    JSONObject coordinateObj = coordinatesArray.getJSONObject(0);
801
+                                                    double positionX = coordinateObj.getDoubleValue("positionX");
802
+                                                    double positionY = coordinateObj.getDoubleValue("positionY");
803
+                                                    sealSignRecord.setPositionXorg(positionX);
804
+                                                    sealSignRecord.setPositionYorg(positionY);
805
+                                                }
806
+                                            }
807
+                                        }
808
+                                        EsignHttpResponse response3 = SignAward.createByFile(sealSignRecord);
809
+                                        JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody());
810
+                                        if (jsonObject1.getIntValue("code")==0){
811
+                                            //获取签署流程ID
812
+                                            JSONObject data1 = jsonObject3.getJSONObject("data");
813
+                                            String signFlowId = data1.getString("signFlowId");
814
+                                            //保存案件id,文件id,文件名称.流程id到签署用印记录表里
815
+                                            sealSignRecord.setCaseAppliId(caseApplication.getId());
816
+                                            sealSignRecord.setSignFlowid(signFlowId);
817
+                                            sealSignRecord.setSignFlowStatus(1);//待签名
818
+                                            sealSignRecordMapper.insertSealSignRecord(sealSignRecord);
819
+                                        }
820
+                                    }
821
+                                }
822
+                            }
823
+                            break;
824
+                        }
825
+                    }
826
+                }
827
+            } catch (EsignDemoException e) {
828
+                e.printStackTrace();
829
+            } catch (InterruptedException e) {
830
+                e.printStackTrace();
831
+            }
700 832
             caseApplication.setCaseStatus(CaseApplicationConstants.SIGN_ARBITRATION);
701 833
             // 新增日志
702 834
             CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.SIGN_ARBITRATION,"");
703
-
704 835
             rows = caseApplicationMapper.submitCaseApplication(caseApplication);
705 836
         }else if(agreeOrNotCheck.intValue()==2){//拒绝审核
706 837
             caseApplication.setCaseStatus(CaseApplicationConstants.VERPRIF_ARBITRATION);

+ 9
- 10
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/SealSignRecordMapper.xml 파일 보기

@@ -3,15 +3,14 @@
3 3
         PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4 4
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 5
 <mapper namespace="com.ruoyi.wisdomarbitrate.mapper.SealSignRecordMapper">
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
6
+    <insert id="insertSealSignRecord"  useGeneratedKeys="true" keyProperty="id">
7
+        INSERT INTO seal_sign_record (file_id, file_name, sign_flow_id , penson_account
8
+        ,penson_name,orgnize_name,org_name_psn_acc,org_name_psn_name,position_page_psn
9
+        ,position_xpsn,position_ypsn,position_pageorg,position_xorg,position_yorg,case_appli_id
10
+        ,sign_flow_status)
11
+        VALUES (#{fileid}, #{filename}, #{signFlowid},#{pensonAccount},#{pensonName},#{orgnizeName}
12
+        ,#{orgnizeNamePsnAccount},#{orgnizeNamepsnName},#{positionPagepsn},#{positionXpsn},#{positionYpsn}
13
+        ,#{positionPageorg},#{positionXorg},#{positionYorg},#{caseAppliId},#{signFlowStatus})
14
+    </insert>
16 15
 
17 16
 </mapper>