瀏覽代碼

10.12开发

hejinbo 2 年之前
父節點
當前提交
0ee4c53252

+ 10
- 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/bean/SealSignRecord.java 查看文件

@@ -158,6 +158,16 @@ public class SealSignRecord extends BaseEntity {
158 158
     private double positionXorg;
159 159
     /** 印章位置y坐标 */
160 160
     private double positionYorg;
161
+    /** 案件申请id */
162
+    private Long caseAppliId;
163
+
164
+    public Long getCaseAppliId() {
165
+        return caseAppliId;
166
+    }
167
+
168
+    public void setCaseAppliId(Long caseAppliId) {
169
+        this.caseAppliId = caseAppliId;
170
+    }
161 171
 
162 172
     public Long getId() {
163 173
         return id;

+ 0
- 1
ruoyi-common/src/main/java/com/ruoyi/common/utils/file/SaaSAPIFileUtils.java 查看文件

@@ -67,7 +67,6 @@ public class SaaSAPIFileUtils {
67 67
     /**
68 68
      * 下载已签署文件及附属材料
69 69
      */
70
-
71 70
     public static EsignHttpResponse fileDownloadUrl(String signFlowId) throws EsignDemoException {
72 71
         String apiaddr = "/v3/sign-flow/"+ signFlowId +"/file-download-url";
73 72
         //请求参数body体,json格式。get或者delete请求时jsonString传空json:"{}"或者null

+ 10
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/SealSignRecordMapper.java 查看文件

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

+ 91
- 4
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java 查看文件

@@ -4,14 +4,22 @@ 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
+import com.alibaba.fastjson.JSONArray;
7 8
 import com.alibaba.fastjson.JSONObject;
9
+import com.google.gson.Gson;
10
+import com.google.gson.JsonArray;
11
+import com.google.gson.JsonObject;
8 12
 import com.ruoyi.common.annotation.DataScope;
9 13
 import com.ruoyi.common.constant.CaseApplicationConstants;
10 14
 import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
11 15
 import com.ruoyi.common.core.domain.entity.SysDept;
16
+import com.ruoyi.common.core.domain.entity.SysUser;
12 17
 import com.ruoyi.common.exception.EsignDemoException;
13 18
 import com.ruoyi.common.exception.ServiceException;
19
+import com.ruoyi.common.utils.SignAward;
20
+import com.ruoyi.common.utils.bean.SealSignRecord;
14 21
 import com.ruoyi.common.utils.file.SaaSAPIFileUtils;
22
+import com.ruoyi.system.mapper.SysUserMapper;
15 23
 import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils;
16 24
 import com.ruoyi.common.utils.DateUtils;
17 25
 import com.ruoyi.common.utils.SmsUtils;
@@ -55,6 +63,10 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
55 63
     private SysDeptMapper sysDeptMapper;
56 64
     @Autowired
57 65
     private ICaseApplicationService caseApplicationService;
66
+    @Autowired
67
+    private SysUserMapper sysUserMapper;
68
+    @Autowired
69
+    private SealSignRecordMapper sealSignRecordMapper;
58 70
 
59 71
     // 手机号正则
60 72
     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}$");
@@ -707,7 +719,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
707 719
                     for (CaseAttach caseAttach : caseAttachList) {
708 720
                         if (caseAttach.getAnnexType() == 3) {
709 721
                             String annexPath = caseAttach.getAnnexPath();
710
-                            String path = "/home/ruoyi/" + annexPath;
722
+                            //String path = "/home/ruoyi/" + annexPath;
723
+                            String path ="D:\\home\\仲裁裁决书模板.docx";
711 724
                             //获取文件上传地址
712 725
                             EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path);
713 726
                             String body = response.getBody();
@@ -723,13 +736,87 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
723 736
                                     Thread.sleep(5000);
724 737
                                     EsignHttpResponse response2 = SaaSAPIFileUtils.getFileStatus(fileId);
725 738
                                     JSONObject jsonObject2 = JSONObject.parseObject(response2.getBody());
726
-                                    int fileStatus = jsonObject2.getJSONObject("data").getIntValue("fileStatus");
739
+                                    JSONObject data = jsonObject2.getJSONObject("data");
740
+                                    int fileStatus =data.getIntValue("fileStatus");
727 741
                                     if (fileStatus == 2 || fileStatus == 5){
728
-                                        //上传成功,发起签署流程
729
-                                        //保存案件id,文件id,文件名称.流程id到签署用印记录表里
742
+                                        String fileName = data.getString("fileName");
743
+                                        //上传成功,获取文件签名印章位置
744
+                                        SealSignRecord sealSignRecord = new SealSignRecord();
745
+                                        sealSignRecord.setFileid(fileId);
746
+                                        EsignHttpResponse positions = SignAward.getPositions(sealSignRecord);
747
+                                        Gson gson = new Gson();
748
+                                        JsonObject positionsJsonObject = gson.fromJson(positions.getBody(), JsonObject.class);
749
+                                        JsonObject positionsData = positionsJsonObject.getAsJsonObject("data");
750
+                                        String keywordPositions = positionsData.get("keywordPositions").getAsString();
751
+                                        //发起签署
752
+                                        sealSignRecord.setFilename(fileName);
753
+                                        String arbitratorId = caseApplication2.getArbitratorId();
754
+                                        if (arbitratorId!=null){
755
+                                            SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(arbitratorId));
756
+                                            if (sysUser == null){
757
+                                                return rows;
758
+                                            }
759
+                                            sealSignRecord.setPensonAccount(sysUser.getPhonenumber());
760
+                                            sealSignRecord.setPensonName(sysUser.getNickName());
761
+                                        }
762
+                                        sealSignRecord.setOrgnizeName("西安云美电子科技有限公司");
763
+                                        sealSignRecord.setOrgnizeNamePsnAccount("秦桃则");
764
+                                        sealSignRecord.setOrgnizeName("西安云美电子科技有限公司");
765
+                                        sealSignRecord.setOrgnizeNamePsnAccount("17691338406");
766
+                                        sealSignRecord.setOrgnizeNamepsnName("韩超勃");
767
+                                        //解析文件签名印章位置
768
+                                        JSONArray jsonArray = JSONArray.parseArray(keywordPositions);
769
+                                        for (int i = 0; i < jsonArray.size(); i++) {
770
+                                            JSONObject jsonObject3 = jsonArray.getJSONObject(i);
771
+                                            String keyword = jsonObject3.getString("keyword");
772
+                                            if (keyword.equals("仲裁员")){
773
+                                                //签名
774
+                                                JSONArray positionsArray = jsonObject3.getJSONArray("positions");
775
+                                                // 遍历 positionsArray 中的每个元素
776
+                                                for (int j = 0; j < positionsArray.size(); j++){
777
+                                                    JSONObject positionObj = positionsArray.getJSONObject(j);
778
+                                                    int pageNum = positionObj.getIntValue("pageNum");
779
+                                                    sealSignRecord.setPositionPagepsn(String.valueOf(pageNum));
780
+                                                    JSONArray coordinatesArray = positionObj.getJSONArray("coordinates");
781
+                                                    JSONObject coordinateObj = coordinatesArray.getJSONObject(0);
782
+                                                    double positionX = coordinateObj.getDoubleValue("positionX");
783
+                                                    double positionY = coordinateObj.getDoubleValue("positionY");
784
+                                                    sealSignRecord.setPositionXpsn(positionX);
785
+                                                    sealSignRecord.setPositionYpsn(positionY);
786
+                                                }
787
+                                            }else {
788
+                                                //用印
789
+                                                JSONArray positionsArray = jsonObject3.getJSONArray("positions");
790
+                                                // 遍历 positionsArray 中的每个元素
791
+                                                for (int j = 0; j < positionsArray.size(); j++) {
792
+                                                    JSONObject positionObj = positionsArray.getJSONObject(j);
793
+                                                    int pageNum = positionObj.getIntValue("pageNum");
794
+                                                    sealSignRecord.setPositionPageorg(String.valueOf(pageNum));
795
+                                                    JSONArray coordinatesArray = positionObj.getJSONArray("coordinates");
796
+                                                    JSONObject coordinateObj = coordinatesArray.getJSONObject(0);
797
+                                                    double positionX = coordinateObj.getDoubleValue("positionX");
798
+                                                    double positionY = coordinateObj.getDoubleValue("positionY");
799
+                                                    sealSignRecord.setPositionXorg(positionX);
800
+                                                    sealSignRecord.setPositionYorg(positionY);
801
+                                                }
802
+                                            }
803
+                                        }
804
+                                        EsignHttpResponse response3 = SignAward.createByFile(sealSignRecord);
805
+                                        JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody());
806
+                                        if (jsonObject1.getIntValue("code")==0){
807
+                                            //获取签署流程ID
808
+                                            JSONObject data1 = jsonObject3.getJSONObject("data");
809
+                                            String signFlowId = data1.getString("signFlowId");
810
+                                            //保存案件id,文件id,文件名称.流程id到签署用印记录表里
811
+                                            sealSignRecord.setCaseAppliId(caseApplication.getId());
812
+                                            sealSignRecord.setSignFlowid(signFlowId);
813
+                                            sealSignRecord.setSignFlowStatus(1);//待签名
814
+                                            sealSignRecordMapper.insertSealSignRecord(sealSignRecord);
815
+                                        }
730 816
                                     }
731 817
                                 }
732 818
                             }
819
+                            break;
733 820
                         }
734 821
                     }
735 822
                 }

+ 15
- 0
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/SealSignRecordMapper.xml 查看文件

@@ -0,0 +1,15 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper
3
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5
+<mapper namespace="com.ruoyi.wisdomarbitrate.mapper.SealSignRecordMapper">
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>
15
+</mapper>