Pārlūkot izejas kodu

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

hejinbo 2 gadus atpakaļ
vecāks
revīzija
c21e092c89

+ 2
- 2
ruoyi-admin/src/main/resources/application-druid.yml Parādīt failu

@@ -6,9 +6,9 @@ spring:
6 6
         druid:
7 7
             # 主库数据源
8 8
             master:
9
-                url: jdbc:mysql://121.40.189.20:3306/arbitrate?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=Asia/Shanghai&useSSL=false
9
+                url: jdbc:mysql://121.40.189.20:3306/smart_arbitration?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=Asia/Shanghai&useSSL=false
10 10
                 username: root
11
-                password: root123456
11
+                password: YMzc157#
12 12
             # 从库数据源
13 13
             slave:
14 14
                 # 从数据源开关/默认关闭

+ 3
- 1
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/SealSignRecordMapper.java Parādīt failu

@@ -1,5 +1,7 @@
1 1
 package com.ruoyi.wisdomarbitrate.mapper;
2 2
 
3
+
4
+
3 5
 import com.ruoyi.wisdomarbitrate.domain.SealSignRecord;
4 6
 
5 7
 import java.util.List;
@@ -10,7 +12,7 @@ public interface SealSignRecordMapper {
10 12
     List<SealSignRecord> selectSealSignRecordbyStat(SealSignRecord sealSignRecord);
11 13
 
12 14
     int updataSealSignRecord(SealSignRecord sealSignRecord);
13
-    
14 15
 
15 16
 
17
+    void insertSealSignRecord(SealSignRecord sealSignRecord);
16 18
 }

+ 17
- 14
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java Parādīt failu

@@ -188,9 +188,12 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
188 188
                     if (caseAttach.getAnnexType() == 3) {
189 189
                         String annexPath = caseAttach.getAnnexPath();
190 190
                         //File file = new File("/home/ruoyi/" + annexPath);
191
-                        String path = "/home/ruoyi/" + annexPath;
192
-                        File file = new File(path);
193
-                        System.out.println("文件是:" + file);
191
+                        String path = "/home/ruoyi" + annexPath;
192
+                        System.out.println("原文件路径是:" + path);
193
+                        String newpath = path.replace("/", "\\");
194
+                        System.out.println("新文件路径是:" + newpath);
195
+                        File file = new File(newpath);
196
+                        System.out.println("新文件是:" + file);
194 197
                         fileList.add(file);
195 198
                     }
196 199
                 }
@@ -385,21 +388,21 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
385 388
         return AjaxResult.success(archivesDetailVO);
386 389
     }
387 390
 
388
-    /*public static void main(String[] args) {
391
+    public static void main(String[] args) {
389 392
         try {
390
-            List<File> fileList = new ArrayList<>();
391
-            fileList.add(new File("D:\\home\\ruoyi\\uploadPath\\upload\\2023\\10\\7\\b442880179844a848f1f8b08c29e3d0c.docx"));
392
-            File file = fileList.get(0);
393
+//            List<File> fileList = new ArrayList<>();
394
+//            fileList.add(new File("D:\\home\\ruoyi\\uploadPath\\upload\\2023\\10\\7\\b442880179844a848f1f8b08c29e3d0c.docx"));
395
+ //           File file = fileList.get(0);//System.out.println("这是文件"+file);
393 396
             //电子邮件送达
394
-            EmailOutUtil emailOutUtil = new EmailOutUtil();
395
-            JavaMailSender javaMailSender = emailOutUtil.rebuildMailSender();
396
-            if (javaMailSender != null) {
397
-                emailOutUtil.sendMessageCarryFile("1154956315@qq.com", "案件裁决书", "您的裁决书已送达,详情请查阅附件", file
398
-                        , "hjbjava@163.com", javaMailSender);
399
-            }
397
+//            EmailOutUtil emailOutUtil = new EmailOutUtil();
398
+//            JavaMailSender javaMailSender = emailOutUtil.rebuildMailSender();
399
+//            if (javaMailSender != null) {
400
+//                emailOutUtil.sendMessageCarryFile("1154956315@qq.com", "案件裁决书", "您的裁决书已送达,详情请查阅附件", file
401
+//                        , "hjbjava@163.com", javaMailSender);
402
+//            }
400 403
         } catch (MailSendException e) {
401 404
             e.printStackTrace();
402 405
         }
403
-    }*/
406
+    }
404 407
 
405 408
 }

+ 125
- 3
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java Parādīt failu

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

+ 11
- 6
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/SealSignRecordMapper.xml Parādīt failu

@@ -4,6 +4,17 @@
4 4
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 5
 <mapper namespace="com.ruoyi.wisdomarbitrate.mapper.SealSignRecordMapper">
6 6
 
7
+    <insert id="insertSealSignRecord"  useGeneratedKeys="true" keyProperty="id">
8
+        INSERT INTO seal_sign_record (file_id, file_name, sign_flow_id , penson_account
9
+        ,penson_name,orgnize_name,orgn_name_psn_acc,orgn_name_psn_name,position_pagepsn
10
+        ,position_xpsn,position_ypsn,position_pageorg,position_xorg,position_yorg,case_appli_id
11
+        ,sign_flow_status)
12
+        VALUES (#{fileid}, #{filename}, #{signFlowid},#{pensonAccount},#{pensonName},#{orgnizeName}
13
+        ,#{orgnizeNamePsnAccount},#{orgnizeNamepsnName},#{positionPagepsn},#{positionXpsn},#{positionYpsn}
14
+        ,#{positionPageorg},#{positionXorg},#{positionYorg},#{caseAppliId},#{signFlowStatus})
15
+    </insert>
16
+
17
+
7 18
     <resultMap type="SealSignRecord" id="SealSignRecordResult">
8 19
         <id     property="id"       column="id"      />
9 20
         <result property="caseAppliId"       column="case_appli_id"      />
@@ -46,10 +57,4 @@
46 57
     </update>
47 58
 
48 59
 
49
-
50
-
51
-
52
-
53
-
54
-
55 60
 </mapper>