Ver código fonte

Merge branch 'qtz' of SH-Arbitrate/Mediation-Backend into dev

qtz 2 anos atrás
pai
commit
4339a48155

+ 7
- 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/mscase/MsSignSealController.java Ver arquivo

@@ -75,7 +75,13 @@ public class MsSignSealController  extends BaseController {
75 75
         return AjaxResult.success(list);
76 76
     }
77 77
 
78
-
78
+    /**
79
+     * test
80
+     */
81
+    @PostMapping("/testSeal")
82
+    public AjaxResult testSeal(@Validated @RequestBody MsSignSealDTO dto) throws EsignDemoException {
83
+        return msSignSealService.testSeal(dto);
84
+    }
79 85
 
80 86
 
81 87
 

+ 14
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/dto/mscase/SealSignRecord.java Ver arquivo

@@ -29,6 +29,13 @@ public class SealSignRecord extends BaseEntity {
29 29
     /** 被申请人姓名 */
30 30
     private String pensonNameRes;
31 31
 
32
+    /** 调解员账户 */
33
+    private String pensonAccountMedi;
34
+    /** 调解员姓名 */
35
+    private String pensonNameMedi;
36
+
37
+
38
+
32 39
     /** 机构名称 */
33 40
     private String orgnizeName;
34 41
     /** 机构经办人 */
@@ -66,6 +73,13 @@ public class SealSignRecord extends BaseEntity {
66 73
     /** 被申请人签名位置y坐标 */
67 74
     private double positionYpsnRes;
68 75
 
76
+    /** 调解员签名位置页数 */
77
+    private String positionPagepsnMedi;
78
+    /** 调解员签名位置x坐标 */
79
+    private double positionXpsnMedi;
80
+    /** 调解员签名位置y坐标 */
81
+    private double positionYpsnMedi;
82
+
69 83
     /** 印章位置页数 */
70 84
     private String positionPageorg;
71 85
     /** 印章位置x坐标 */

+ 17
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/dept/MsSealSignRecord.java Ver arquivo

@@ -127,6 +127,23 @@ public class MsSealSignRecord {
127 127
     @Column(name = "position_ypsn_res")
128 128
     private double positionYpsnRes;
129 129
 
130
+    /** 调解员账户 */
131
+    @Column(name = "penson_account_medi")
132
+    private String pensonAccountMedi;
133
+    /** 调解员姓名 */
134
+    @Column(name = "penson_name_medi")
135
+    private String pensonNameMedi;
136
+
137
+    /** 调解员签名位置页数 */
138
+    @Column(name = "position_pagepsn_medi")
139
+    private String positionPagepsnMedi;
140
+    /** 调解员签名位置x坐标 */
141
+    @Column(name = "position_xpsn_medi")
142
+    private double positionXpsnMedi;
143
+    /** 调解员签名位置y坐标 */
144
+    @Column(name = "position_ypsn_medi")
145
+    private double positionYpsnMedi;
146
+
130 147
 
131 148
 
132 149
 }

+ 1
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/MsSignSealService.java Ver arquivo

@@ -23,4 +23,5 @@ public interface MsSignSealService {
23 23
 
24 24
     List<MsCaseLogRecordVO> selectCaseLogRecordList(MsSignSealDTO dto);
25 25
 
26
+    AjaxResult testSeal(MsSignSealDTO dto);
26 27
 }

+ 140
- 1
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsSignSealServiceImpl.java Ver arquivo

@@ -20,6 +20,7 @@ import com.ruoyi.common.utils.SmsUtils;
20 20
 import com.ruoyi.common.utils.StringUtils;
21 21
 import com.ruoyi.common.utils.file.SaaSAPIFileUtils;
22 22
 import com.ruoyi.system.domain.entity.flow.MsCaseFlow;
23
+import com.ruoyi.system.mapper.SysUserMapper;
23 24
 import com.ruoyi.system.mapper.flow.MsCaseFlowMapper;
24 25
 import com.ruoyi.wisdomarbitrate.domain.dto.dept.DeptIdentify;
25 26
 import com.ruoyi.wisdomarbitrate.domain.dto.dept.SealManage;
@@ -68,6 +69,9 @@ public class MsSignSealServiceImpl implements MsSignSealService {
68 69
     @Autowired
69 70
     MsCaseFlowMapper caseFlowMapper;
70 71
 
72
+    @Autowired
73
+    private SysUserMapper sysUserMapper;
74
+
71 75
     @Autowired
72 76
     private MsSealSignRecordMapper sealSignRecordMapper;
73 77
 
@@ -125,6 +129,16 @@ public class MsSignSealServiceImpl implements MsSignSealService {
125 129
                                 //发起签署
126 130
                                 sealSignRecord.setFilename(fileName);
127 131
 
132
+                                Long arbitratorId = caseApplication.getMediatorId();
133
+                                if (arbitratorId != null) {
134
+                                    SysUser sysUser = sysUserMapper.selectUserById(arbitratorId);
135
+                                    if (sysUser == null) {
136
+                                        return AjaxResult.error();
137
+                                    }
138
+                                    sealSignRecord.setPensonAccountMedi(sysUser.getPhonenumber());
139
+                                    sealSignRecord.setPensonNameMedi(sysUser.getNickName());
140
+                                }
141
+
128 142
                                 sealSignRecord.setPensonAccount(caseAffiliate.getContactTelphoneAgent());
129 143
                                 sealSignRecord.setPensonName(caseAffiliate.getNameAgent());
130 144
                                 sealSignRecord.setPensonAccountRes(caseAffiliate.getRespondentPhone());
@@ -161,7 +175,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
161 175
                                             double positionX = coordinateObj.getDoubleValue("positionX");
162 176
                                             double positionY = coordinateObj.getDoubleValue("positionY");
163 177
                                             sealSignRecord.setPositionXpsn(positionX + 90);
164
-                                            sealSignRecord.setPositionYpsn(positionY);
178
+                                            sealSignRecord.setPositionYpsn(positionY + 30);
165 179
                                         }
166 180
                                     }else if (keyword.equals("被申请人:")) {
167 181
                                         //签名
@@ -178,6 +192,21 @@ public class MsSignSealServiceImpl implements MsSignSealService {
178 192
                                             sealSignRecord.setPositionXpsnRes(positionX + 90);
179 193
                                             sealSignRecord.setPositionYpsnRes(positionY);
180 194
                                         }
195
+                                    }else if (keyword.equals("调解员:")) {
196
+                                        //签名
197
+                                        JSONArray positionsArray = jsonObject3.getJSONArray("positions");
198
+                                        // 遍历 positionsArray 中的每个元素
199
+                                        for (int j = 0; j < positionsArray.size(); j++) {
200
+                                            JSONObject positionObj = positionsArray.getJSONObject(j);
201
+                                            int pageNum = positionObj.getIntValue("pageNum");
202
+                                            sealSignRecord.setPositionPagepsnMedi(String.valueOf(pageNum));
203
+                                            JSONArray coordinatesArray = positionObj.getJSONArray("coordinates");
204
+                                            JSONObject coordinateObj = coordinatesArray.getJSONObject(0);
205
+                                            double positionX = coordinateObj.getDoubleValue("positionX");
206
+                                            double positionY = coordinateObj.getDoubleValue("positionY");
207
+                                            sealSignRecord.setPositionXpsnMedi(positionX + 90);
208
+                                            sealSignRecord.setPositionYpsnMedi(positionY);
209
+                                        }
181 210
                                     }else {
182 211
                                         //用印
183 212
                                         JSONArray positionsArray = jsonObject3.getJSONArray("positions");
@@ -288,6 +317,20 @@ public class MsSignSealServiceImpl implements MsSignSealService {
288 317
                                                 request1.setTemplateParamSet(new String[]{caseAffiliate.getRespondentName(), caseApplication.getCaseNum(),urlResponnew});
289 318
                                                 Boolean aBoolean1 = SmsUtils.sendSms(request1);
290 319
 
320
+                                                SealSignRecord sealSignRecordMedi = new SealSignRecord();
321
+                                                sealSignRecordMedi.setSignFlowid(signFlowId);
322
+                                                sealSignRecordMedi.setPensonAccount(sealSignRecord.getPensonAccountMedi());
323
+                                                EsignHttpResponse signUrlResponMedi = SignAward.signUrlMediation(sealSignRecordMedi);
324
+                                                JsonObject signUrlJsonObjectResponMedi = gson.fromJson(signUrlResponMedi.getBody(), JsonObject.class);
325
+                                                JsonObject signUrlDataResponMedi = signUrlJsonObjectResponMedi.getAsJsonObject("data");
326
+                                                String urlResponMedi = signUrlDataResponMedi.get("shortUrl").getAsString();
327
+                                                String urlResponnewMedi = urlResponMedi.substring(urlResponMedi.lastIndexOf("/")+1);
328
+
329
+                                                SmsUtils.SendSmsRequest requestMedi = new SmsUtils.SendSmsRequest();
330
+                                                requestMedi.setTemplateId("2047719");
331
+                                                requestMedi.setPhone(sealSignRecord.getPensonAccountMedi());
332
+                                                requestMedi.setTemplateParamSet(new String[]{sealSignRecord.getPensonNameMedi(), caseApplication.getCaseNum(),urlResponnewMedi});
333
+                                                Boolean aBooleanMedi = SmsUtils.sendSms(requestMedi);
291 334
 
292 335
                                             } else {
293 336
                                                 throw new ServiceException(jsonObject3.getString("message"));
@@ -646,7 +689,103 @@ public class MsSignSealServiceImpl implements MsSignSealService {
646 689
 
647 690
     }
648 691
 
692
+    @Override
693
+    @Transactional
694
+    public AjaxResult testSeal(MsSignSealDTO dto) {
695
+
696
+        Gson gson = new Gson();
697
+
698
+        List<MsSealSignRecord> sealSignRecords = sealSignRecordMapper.selectSealSignRecordbyStat();
699
+
700
+        try {
701
+            if (sealSignRecords != null && sealSignRecords.size() > 0) {
702
+                for (int i = 0; i < sealSignRecords.size(); i++) {
703
+                    MsSealSignRecord mssealSignRecord = sealSignRecords.get(i);
704
+                    SealSignRecord sealSignRecord = new SealSignRecord();
705
+                    BeanUtil.copyProperties(mssealSignRecord, sealSignRecord);
706
+
707
+                    String signFlowId = mssealSignRecord.getSignFlowId();
708
+                    if(StringUtils.isNotEmpty(signFlowId) && "819e60824fe241e9b862bd787403fa5e".equals(signFlowId)){
709
+                        sealSignRecord.setSignFlowid(mssealSignRecord.getSignFlowId());
710
+                        EsignHttpResponse signFlowDetail = SignAward.signFlowDetail(sealSignRecord);
711
+                        JsonObject signFlowDetailJsonObject = gson.fromJson(signFlowDetail.getBody(), JsonObject.class);
712
+                        JsonObject flowDetailData = signFlowDetailJsonObject.getAsJsonObject("data");
713
+                        JsonArray signersArray = flowDetailData.get("signers").getAsJsonArray();
714
+                        List<Integer> psnsignStatusList = new ArrayList<>();
715
+                        Integer psnsignStatus = null;
716
+                        Integer orgsignStatus = null;
717
+                        for (int j = 0; j < signersArray.size(); j++) {
718
+                            JsonObject signerObject = (JsonObject) signersArray.get(j);
719
+
720
+                            if (!(signerObject.get("psnSigner").toString()).equals("null")) {
721
+                                JsonObject psnSignerData = signerObject.getAsJsonObject("psnSigner");
722
+                                if (psnSignerData != null) {
723
+                                    psnsignStatus = signerObject.get("signStatus").getAsInt();
724
+                                    psnsignStatusList.add(psnsignStatus);
725
+                                }
726
+                            }
727
+                            if (!(signerObject.get("orgSigner").toString()).equals("null")) {
728
+                                JsonObject orgSignerData = signerObject.getAsJsonObject("orgSigner");
729
+                                if (orgSignerData != null) {
730
+                                    orgsignStatus = signerObject.get("signStatus").getAsInt();
731
+                                }
732
+                            }
733
+
734
+                        }
735
+
736
+                        List<Integer> psnsignStatusListnew = psnsignStatusList.stream().distinct().collect(Collectors.toList());
737
+
738
+                        if (( psnsignStatusListnew.size()==1 && (psnsignStatusListnew.get(0).intValue() == 2)) && (orgsignStatus.intValue() == 1)) {
739
+                            //更新立案申请状态为待用印
740
+                            MsCaseApplication caseApplicationselect = msCaseApplicationMapper.selectByPrimaryKey(sealSignRecord.getCaseAppliId());
741
+                            if ((mssealSignRecord.getSignFlowStatus() != null) && (mssealSignRecord.getSignFlowStatus().intValue() == 1)) {
742
+                                // 根据流程id查找下一个流程节点
743
+                                MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId().intValue());
744
+                                MsCaseApplication application = new MsCaseApplication();
745
+                                application.setId(caseApplicationselect.getId());
746
+                                application.setCaseFlowId(nextFlow.getId());
747
+                                application.setCaseStatusName(nextFlow.getCaseStatusName());
748
+                                caseApplicationMapper.updateByPrimaryKeySelective(application);
749
+
750
+                                //修改"签署用印记录表"的状态为待用印
751
+                                mssealSignRecord.setSignFlowStatus(2);
752
+                                sealSignRecordMapper.updateByPrimaryKeySelective(mssealSignRecord);
753
+                            }
754
+                        }
755
+                        if (( psnsignStatusListnew.size()==1 && (psnsignStatusListnew.get(0).intValue() == 2))  && (orgsignStatus.intValue() == 2)) {
756
+                            //更新立案申请状态为待送达
757
+                            MsCaseApplication caseApplicationselect = msCaseApplicationMapper.selectByPrimaryKey(sealSignRecord.getCaseAppliId());
758
+
759
+                            if ((mssealSignRecord.getSignFlowStatus() != null) && (mssealSignRecord.getSignFlowStatus().intValue() == 2)) {
760
+                                //修改"签署用印记录表"的状态为签署完成
761
+                                mssealSignRecord.setSignFlowStatus(3);
762
+                                sealSignRecordMapper.updateByPrimaryKeySelective(mssealSignRecord);
763
+
764
+                                // 根据流程id查找下一个流程节点
765
+                                MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId().intValue());
766
+                                MsCaseApplication application = new MsCaseApplication();
767
+                                application.setId(caseApplicationselect.getId());
768
+                                application.setCaseFlowId(nextFlow.getId());
769
+                                application.setCaseStatusName(nextFlow.getCaseStatusName());
770
+                                caseApplicationMapper.updateByPrimaryKeySelective(application);
771
+                            }
772
+                        }
773
+
774
+                    }
775
+
776
+
777
+                }
649 778
 
779
+            }
780
+        } catch (EsignDemoException e) {
781
+            e.printStackTrace();
782
+        }
783
+
784
+        return AjaxResult.success();
785
+
786
+
787
+
788
+    }
650 789
 
651 790
 
652 791
 }

+ 1
- 1
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/FixSelectFlowDetailUtils.java Ver arquivo

@@ -244,7 +244,7 @@ public class FixSelectFlowDetailUtils {
244 244
     /*
245 245
     定时查询签署流程详情
246 246
      */
247
-    @Scheduled(cron = "0/10 * * * * ?")
247
+//    @Scheduled(cron = "0/10 * * * * ?")
248 248
     @Transactional
249 249
     public void fixExecuteSelectFlowDetailUtils() {
250 250
         Gson gson = new Gson();

+ 36
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/SignAward.java Ver arquivo

@@ -304,6 +304,9 @@ public class SignAward {
304 304
         String psnAccountRes = sealSignRecord.getPensonAccountRes();
305 305
         String psnNameRes = sealSignRecord.getPensonNameRes();
306 306
 
307
+        String psnAccountMedi = sealSignRecord.getPensonAccountMedi();
308
+        String psnNameMedi = sealSignRecord.getPensonNameMedi();
309
+
307 310
         String orgName = sealSignRecord.getOrgnizeName();
308 311
         String orgNamePsnAccount = sealSignRecord.getOrgnizeNamePsnAccount();
309 312
         String orgNamepsnName = sealSignRecord.getOrgnizeNamepsnName();
@@ -316,6 +319,10 @@ public class SignAward {
316 319
         double positionXpsnRes = sealSignRecord.getPositionXpsnRes();
317 320
         double positionYpsnRes = sealSignRecord.getPositionYpsnRes();
318 321
 
322
+        String positionPagepsnMedi = sealSignRecord.getPositionPagepsnMedi();
323
+        double positionXpsnMedi = sealSignRecord.getPositionXpsnMedi();
324
+        double positionYpsnMedi = sealSignRecord.getPositionYpsnMedi();
325
+
319 326
         String positionPageorg = sealSignRecord.getPositionPageorg();
320 327
         double positionXorg = sealSignRecord.getPositionXorg();
321 328
         double positionYorg = sealSignRecord.getPositionYorg();
@@ -406,6 +413,34 @@ public class SignAward {
406 413
                 "            \"signerType\": 0\n" +
407 414
                 "        },\n" +
408 415
 
416
+
417
+                "        {\n" +
418
+                "            \"psnSignerInfo\": {\n" +
419
+                "                \"psnAccount\": \"" + psnAccountMedi + "\",\n" +
420
+                "                \"psnInfo\": {\n" +
421
+                "                            \"psnName\": \"" + psnNameMedi + "\"\n" +
422
+                "                        }\n" +
423
+                "            },\n" +
424
+                "            \"signFields\": [\n" +
425
+                "                {\n" +
426
+                "                    \"fileId\": \"" + fileId + "\",\n" +
427
+                "                    \"normalSignFieldConfig\": {\n" +
428
+                "                        \"autoSign\": false,\n" +
429
+                "                        \"freeMode\": false,\n" +
430
+                "                        \"movableSignField\": false,\n" +
431
+                "                        \"signFieldPosition\": {\n" +
432
+                "                            \"positionPage\": \"" + positionPagepsnMedi + "\",\n" +
433
+                "                            \"positionX\": " + positionXpsnMedi + ",\n" +
434
+                "                            \"positionY\": " + positionYpsnMedi + "\n" +
435
+                "                        },\n" +
436
+                "                        \"signFieldStyle\": 1\n" +
437
+                "                    },\n" +
438
+                "                    \"signFieldType\": 0\n" +
439
+                "                }\n" +
440
+                "            ],\n" +
441
+                "            \"signerType\": 0\n" +
442
+                "        },\n" +
443
+
409 444
                 "        {\n" +
410 445
                 "            \"orgSignerInfo\": {\n" +
411 446
                 "                \"orgName\": \"" + orgName + "\",\n" +
@@ -695,6 +730,7 @@ public class SignAward {
695 730
                 "    \"keywords\": [\n" +
696 731
                 "        \"申请人:\",\n" +
697 732
                 "        \"被申请人:\",\n" +
733
+                "        \"调解员:\",\n" +
698 734
                 "        \"(盖章)\"\n" +
699 735
                 "    ]\n" +
700 736
                 "}";