Bläddra i källkod

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

qtz 2 år sedan
förälder
incheckning
fb76ba3a21

+ 326
- 197
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java Visa fil

@@ -1271,7 +1271,6 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
1271 1271
 
1272 1272
             if(mediaResult!=null){
1273 1273
                 if(mediaResult.intValue()==1){
1274
-                    Integer isReconci = req.getIsReconci();
1275 1274
                     //达成调解
1276 1275
                     if (application.getTemplateId() == null) {
1277 1276
                         return AjaxResult.error("未找到模板");
@@ -1281,7 +1280,6 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
1281 1280
                     req.setTemplateType(TemplateTypeEnum.MEDIATE_BOOK.getCode());
1282 1281
                     AjaxResult result = generateApplication(req);
1283 1282
                     if (result != null && result.isSuccess()) {
1284
-                        // todo 生成完调解书需要记录日志
1285 1283
                         List<MsCaseAttach> caseAttachList = msCaseAttachMapper.queryAnnexPathByCaseId(req.getId());
1286 1284
                         if (caseAttachList != null && caseAttachList.size() > 0) {
1287 1285
                             for (MsCaseAttach caseAttach : caseAttachList) {
@@ -1431,207 +1429,117 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
1431 1429
                                                     }
1432 1430
                                                 }
1433 1431
 
1434
-                                                if(isReconci.intValue()==1){
1435
-                                                    EsignHttpResponse response3 = SignAward.createByFileReconci(sealSignRecord);
1436
-
1437
-                                                    JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody());
1438
-                                                    if (jsonObject3 != null) {
1439
-                                                        if (jsonObject3.getIntValue("code") == 0) {
1440
-                                                            //获取签署流程ID
1441
-                                                            JSONObject data1 = jsonObject3.getJSONObject("data");
1442
-                                                            String signFlowId = data1.getString("signFlowId");
1443
-                                                            //保存案件id,文件id,文件名称.流程id到签署用印记录表里
1444
-                                                            sealSignRecord.setCaseAppliId(application.getId());
1445
-                                                            sealSignRecord.setSignFlowid(signFlowId);
1446
-                                                            sealSignRecord.setSignFlowStatus(1);//待签名
1447
-                                                            MsSealSignRecord msSealSignRecord = new MsSealSignRecord();
1448
-                                                            BeanUtil.copyProperties(sealSignRecord, msSealSignRecord);
1449
-                                                            msSealSignRecord.setFileId(sealSignRecord.getFileid());
1450
-                                                            msSealSignRecord.setFileName(sealSignRecord.getFilename());
1451
-                                                            msSealSignRecord.setSignFlowId(sealSignRecord.getSignFlowid());
1452
-                                                            sealSignRecordMapper.insert(msSealSignRecord);
1453
-
1454
-                                                            SealSignRecord sealSignRecordapply = new SealSignRecord();
1455
-                                                            sealSignRecordapply.setSignFlowid(signFlowId);
1456
-
1457
-                                                            String nameAgent = caseAffiliate.getNameAgent();
1458
-                                                            if(StringUtils.isNotBlank(nameAgent)){
1459
-                                                                sealSignRecordapply.setPensonAccount(caseAffiliate.getContactTelphoneAgent());
1460
-                                                            }else {
1461
-                                                                sealSignRecordapply.setPensonAccount(caseAffiliate.getApplicationPhone());
1432
+                                                String orgnizeName = sealSignRecord.getOrgnizeName(); //机构名称
1433
+                                                String orgnizeNamepsnName = sealSignRecord.getOrgnizeNamepsnName(); //机构经办人姓名
1434
+                                                String orgnizeNamePsnAccount = sealSignRecord.getOrgnizeNamePsnAccount(); //机构经办人联系方式
1435
+                                                //查询机构信息
1436
+                                                DeptIdentify deptIdentify1 = new DeptIdentify();
1437
+                                                deptIdentify1.setIdentifyName(orgnizeName);
1438
+                                                deptIdentify1.setOperName(orgnizeNamepsnName);
1439
+                                                deptIdentify1.setOperPhone(orgnizeNamePsnAccount);
1440
+                                                List<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentify(deptIdentify1);
1441
+                                                if (deptIdentifies != null && deptIdentifies.size() > 0) {
1442
+                                                    Long iddeptIdent = deptIdentifies.get(0).getId();
1443
+                                                    SealManage sealManage = new SealManage();
1444
+                                                    sealManage.setIdentifyId(iddeptIdent);
1445
+                                                    List<String> sealIdList = new ArrayList<>();
1446
+                                                    List<SealManage> selectSealList = sealManageMapper.selectSealList(sealManage);
1447
+                                                    if (selectSealList != null && selectSealList.size() > 0) {
1448
+                                                        for (SealManage manage : selectSealList) {
1449
+                                                            Integer sealStatus = manage.getSealStatus();
1450
+                                                            Integer isUse = manage.getIsUse();
1451
+                                                            if (sealStatus == 1 && isUse ==1) {
1452
+                                                                sealIdList.add(manage.getSealId());
1462 1453
                                                             }
1463
-
1464
-                                                            EsignHttpResponse signUrl = SignAward.signUrlMediation(sealSignRecordapply);
1465
-                                                            JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class);
1466
-                                                            JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data");
1467
-                                                            String urlapply = signUrlData.get("shortUrl").getAsString();
1468
-                                                            String urlapplynew = urlapply.substring(urlapply.lastIndexOf("/")+1);
1469
-
1470
-                                                            //发送签名链接短信,尊敬的{1}用户,您的{2}调解案件,签名链接{3},请点击链接签名,如非本人操作,请忽略本短信
1471
-                                                            SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
1472
-                                                            request.setTemplateId("2047719");
1473
-                                                            if(StringUtils.isNotBlank(nameAgent)){
1474
-                                                                request.setPhone(caseAffiliate.getContactTelphoneAgent());
1475
-                                                                request.setTemplateParamSet(new String[]{caseAffiliate.getNameAgent(), application.getCaseNum(),urlapplynew});
1476
-                                                            }else {
1477
-                                                                request.setPhone(caseAffiliate.getApplicationPhone());
1478
-                                                                request.setTemplateParamSet(new String[]{caseAffiliate.getApplicationName(), application.getCaseNum(),urlapplynew});
1479
-                                                            }
1480
-                                                            Boolean aBoolean = SmsUtils.sendSms(request);
1481
-
1482
-                                                            SealSignRecord sealSignRecordRespon = new SealSignRecord();
1483
-                                                            sealSignRecordRespon.setSignFlowid(signFlowId);
1484
-                                                            sealSignRecordRespon.setPensonAccount(caseAffiliate.getRespondentPhone());
1485
-                                                            EsignHttpResponse signUrlRespon = SignAward.signUrlMediation(sealSignRecordRespon);
1486
-                                                            JsonObject signUrlJsonObjectRespon = gson.fromJson(signUrlRespon.getBody(), JsonObject.class);
1487
-                                                            JsonObject signUrlDataRespon = signUrlJsonObjectRespon.getAsJsonObject("data");
1488
-                                                            String urlRespon = signUrlDataRespon.get("shortUrl").getAsString();
1489
-                                                            String urlResponnew = urlRespon.substring(urlRespon.lastIndexOf("/")+1);
1490
-
1491
-                                                            SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest();
1492
-                                                            request1.setTemplateId("2047719");
1493
-                                                            request1.setPhone(caseAffiliate.getRespondentPhone());
1494
-                                                            request1.setTemplateParamSet(new String[]{caseAffiliate.getRespondentName(), application.getCaseNum(),urlResponnew});
1495
-                                                            Boolean aBoolean1 = SmsUtils.sendSms(request1);
1496
-
1497
-                                                        } else {
1498
-                                                            throw new ServiceException(jsonObject3.getString("message"));
1499 1454
                                                         }
1500
-                                                    } else {
1501
-                                                        return AjaxResult.error();
1502
-                                                    }
1503
-
1504
-                                                }else {
1505
-                                            /*DeptIdentify deptIdentify1 = new DeptIdentify();
1506
-                                        deptIdentify1.setSealStatus(1); // 印章状态为启用
1507
-                                        //根据机构名称查询部门id
1508
-                                        SysDept sysDept = new SysDept();
1509
-                                        sysDept.setDeptName(sealSignRecord.getOrgnizeName());
1510
-                                        List<SysDept> sysDepts = deptMapper.selectDeptList(sysDept);
1511
-                                        if (sysDepts != null && sysDepts.size() > 0) {
1512
-                                            Long deptId = sysDepts.get(0).getDeptId();
1513
-                                            deptIdentify1.setDeptId(deptId);
1514
-                                        }
1515
-                                        List<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentifylistother(deptIdentify1);
1516
-                                        List<String> sealIds = new ArrayList<>();
1517
-                                        if (deptIdentifies != null && deptIdentifies.size() > 0) {
1518
-                                            for (DeptIdentify identify : deptIdentifies) {
1519
-                                                String sealId = identify.getSealId();
1520
-                                                sealIds.add(sealId);
1521
-                                            }
1522
-                                        }*/
1523
-                                                    String orgnizeName = sealSignRecord.getOrgnizeName(); //机构名称
1524
-                                                    String orgnizeNamepsnName = sealSignRecord.getOrgnizeNamepsnName(); //机构经办人姓名
1525
-                                                    String orgnizeNamePsnAccount = sealSignRecord.getOrgnizeNamePsnAccount(); //机构经办人联系方式
1526
-                                                    //查询机构信息
1527
-                                                    DeptIdentify deptIdentify1 = new DeptIdentify();
1528
-                                                    deptIdentify1.setIdentifyName(orgnizeName);
1529
-                                                    deptIdentify1.setOperName(orgnizeNamepsnName);
1530
-                                                    deptIdentify1.setOperPhone(orgnizeNamePsnAccount);
1531
-                                                    List<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentify(deptIdentify1);
1532
-                                                    if (deptIdentifies != null && deptIdentifies.size() > 0) {
1533
-                                                        Long iddeptIdent = deptIdentifies.get(0).getId();
1534
-                                                        SealManage sealManage = new SealManage();
1535
-                                                        sealManage.setIdentifyId(iddeptIdent);
1536
-                                                        List<String> sealIdList = new ArrayList<>();
1537
-                                                        List<SealManage> selectSealList = sealManageMapper.selectSealList(sealManage);
1538
-                                                        if (selectSealList != null && selectSealList.size() > 0) {
1539
-                                                            for (SealManage manage : selectSealList) {
1540
-                                                                Integer sealStatus = manage.getSealStatus();
1541
-                                                                Integer isUse = manage.getIsUse();
1542
-                                                                if (sealStatus == 1 && isUse ==1) {
1543
-                                                                    sealIdList.add(manage.getSealId());
1455
+                                                        EsignHttpResponse response3 = SignAward.createByFileMediation(sealSignRecord, sealIdList);
1456
+
1457
+                                                        JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody());
1458
+                                                        if (jsonObject3 != null) {
1459
+                                                            if (jsonObject3.getIntValue("code") == 0) {
1460
+                                                                //获取签署流程ID
1461
+                                                                JSONObject data1 = jsonObject3.getJSONObject("data");
1462
+                                                                String signFlowId = data1.getString("signFlowId");
1463
+                                                                //保存案件id,文件id,文件名称.流程id到签署用印记录表里
1464
+                                                                sealSignRecord.setCaseAppliId(application.getId());
1465
+                                                                sealSignRecord.setSignFlowid(signFlowId);
1466
+                                                                sealSignRecord.setSignFlowStatus(1);//待签名
1467
+                                                                MsSealSignRecord msSealSignRecord = new MsSealSignRecord();
1468
+                                                                BeanUtil.copyProperties(sealSignRecord, msSealSignRecord);
1469
+                                                                msSealSignRecord.setFileId(sealSignRecord.getFileid());
1470
+                                                                msSealSignRecord.setFileName(sealSignRecord.getFilename());
1471
+                                                                msSealSignRecord.setSignFlowId(sealSignRecord.getSignFlowid());
1472
+                                                                msSealSignRecord.setOrgnNamePsnAcc(sealSignRecord.getOrgnizeNamePsnAccount());
1473
+                                                                msSealSignRecord.setOrgnNamePsnName(sealSignRecord.getOrgnizeNamepsnName());
1474
+                                                                sealSignRecordMapper.insert(msSealSignRecord);
1475
+
1476
+                                                                SealSignRecord sealSignRecordapply = new SealSignRecord();
1477
+                                                                sealSignRecordapply.setSignFlowid(signFlowId);
1478
+                                                                String nameAgent = caseAffiliate.getNameAgent();
1479
+                                                                if(StringUtils.isNotBlank(nameAgent)){
1480
+                                                                    sealSignRecordapply.setPensonAccount(caseAffiliate.getContactTelphoneAgent());
1481
+                                                                }else {
1482
+                                                                    sealSignRecordapply.setPensonAccount(caseAffiliate.getApplicationPhone());
1544 1483
                                                                 }
1545
-                                                            }
1546
-                                                            EsignHttpResponse response3 = SignAward.createByFileMediation(sealSignRecord, sealIdList);
1547
-
1548
-                                                            JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody());
1549
-                                                            if (jsonObject3 != null) {
1550
-                                                                if (jsonObject3.getIntValue("code") == 0) {
1551
-                                                                    //获取签署流程ID
1552
-                                                                    JSONObject data1 = jsonObject3.getJSONObject("data");
1553
-                                                                    String signFlowId = data1.getString("signFlowId");
1554
-                                                                    //保存案件id,文件id,文件名称.流程id到签署用印记录表里
1555
-                                                                    sealSignRecord.setCaseAppliId(application.getId());
1556
-                                                                    sealSignRecord.setSignFlowid(signFlowId);
1557
-                                                                    sealSignRecord.setSignFlowStatus(1);//待签名
1558
-                                                                    MsSealSignRecord msSealSignRecord = new MsSealSignRecord();
1559
-                                                                    BeanUtil.copyProperties(sealSignRecord, msSealSignRecord);
1560
-                                                                    msSealSignRecord.setFileId(sealSignRecord.getFileid());
1561
-                                                                    msSealSignRecord.setFileName(sealSignRecord.getFilename());
1562
-                                                                    msSealSignRecord.setSignFlowId(sealSignRecord.getSignFlowid());
1563
-                                                                    msSealSignRecord.setOrgnNamePsnAcc(sealSignRecord.getOrgnizeNamePsnAccount());
1564
-                                                                    msSealSignRecord.setOrgnNamePsnName(sealSignRecord.getOrgnizeNamepsnName());
1565
-                                                                    sealSignRecordMapper.insert(msSealSignRecord);
1566
-
1567
-                                                                    SealSignRecord sealSignRecordapply = new SealSignRecord();
1568
-                                                                    sealSignRecordapply.setSignFlowid(signFlowId);
1569
-                                                                    String nameAgent = caseAffiliate.getNameAgent();
1570
-                                                                    if(StringUtils.isNotBlank(nameAgent)){
1571
-                                                                        sealSignRecordapply.setPensonAccount(caseAffiliate.getContactTelphoneAgent());
1572
-                                                                    }else {
1573
-                                                                        sealSignRecordapply.setPensonAccount(caseAffiliate.getApplicationPhone());
1574
-                                                                    }
1575
-
1576
-                                                                    EsignHttpResponse signUrl = SignAward.signUrlMediation(sealSignRecordapply);
1577
-                                                                    JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class);
1578
-                                                                    JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data");
1579
-                                                                    String urlapply = signUrlData.get("shortUrl").getAsString();
1580
-                                                                    String urlapplynew = urlapply.substring(urlapply.lastIndexOf("/")+1);
1581
-
1582
-                                                                    //发送签名链接短信,尊敬的{1}用户,您的{2}调解案件,签名链接{3},请点击链接签名,如非本人操作,请忽略本短信
1583
-                                                                    SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
1584
-                                                                    request.setTemplateId("2047719");
1585
-
1586
-                                                                    if(StringUtils.isNotBlank(nameAgent)){
1587
-                                                                        request.setPhone(caseAffiliate.getContactTelphoneAgent());
1588
-                                                                        request.setTemplateParamSet(new String[]{caseAffiliate.getNameAgent(), application.getCaseNum(),urlapplynew});
1589
-                                                                    }else {
1590
-                                                                        request.setPhone(caseAffiliate.getApplicationPhone());
1591
-                                                                        request.setTemplateParamSet(new String[]{caseAffiliate.getApplicationName(), application.getCaseNum(),urlapplynew});
1592
-                                                                    }
1593
-                                                                    Boolean aBoolean = SmsUtils.sendSms(request);
1594
-
1595
-                                                                    SealSignRecord sealSignRecordRespon = new SealSignRecord();
1596
-                                                                    sealSignRecordRespon.setSignFlowid(signFlowId);
1597
-                                                                    sealSignRecordRespon.setPensonAccount(caseAffiliate.getRespondentPhone());
1598
-                                                                    EsignHttpResponse signUrlRespon = SignAward.signUrlMediation(sealSignRecordRespon);
1599
-                                                                    JsonObject signUrlJsonObjectRespon = gson.fromJson(signUrlRespon.getBody(), JsonObject.class);
1600
-                                                                    JsonObject signUrlDataRespon = signUrlJsonObjectRespon.getAsJsonObject("data");
1601
-                                                                    String urlRespon = signUrlDataRespon.get("shortUrl").getAsString();
1602
-                                                                    String urlResponnew = urlRespon.substring(urlRespon.lastIndexOf("/")+1);
1603
-
1604
-                                                                    SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest();
1605
-                                                                    request1.setTemplateId("2047719");
1606
-                                                                    request1.setPhone(caseAffiliate.getRespondentPhone());
1607
-                                                                    request1.setTemplateParamSet(new String[]{caseAffiliate.getRespondentName(), application.getCaseNum(),urlResponnew});
1608
-                                                                    Boolean aBoolean1 = SmsUtils.sendSms(request1);
1609
-
1610
-                                                                    SealSignRecord sealSignRecordMedi = new SealSignRecord();
1611
-                                                                    sealSignRecordMedi.setSignFlowid(signFlowId);
1612
-                                                                    sealSignRecordMedi.setPensonAccount(sealSignRecord.getPensonAccountMedi());
1613
-                                                                    EsignHttpResponse signUrlResponMedi = SignAward.signUrlMediation(sealSignRecordMedi);
1614
-                                                                    JsonObject signUrlJsonObjectResponMedi = gson.fromJson(signUrlResponMedi.getBody(), JsonObject.class);
1615
-                                                                    JsonObject signUrlDataResponMedi = signUrlJsonObjectResponMedi.getAsJsonObject("data");
1616
-                                                                    String urlResponMedi = signUrlDataResponMedi.get("shortUrl").getAsString();
1617
-                                                                    String urlResponnewMedi = urlResponMedi.substring(urlResponMedi.lastIndexOf("/")+1);
1618
-
1619
-                                                                    SmsUtils.SendSmsRequest requestMedi = new SmsUtils.SendSmsRequest();
1620
-                                                                    requestMedi.setTemplateId("2047719");
1621
-                                                                    requestMedi.setPhone(sealSignRecord.getPensonAccountMedi());
1622
-                                                                    requestMedi.setTemplateParamSet(new String[]{sealSignRecord.getPensonNameMedi(), application.getCaseNum(),urlResponnewMedi});
1623
-                                                                    Boolean aBooleanMedi = SmsUtils.sendSms(requestMedi);
1624
-
1625
-                                                                } else {
1626
-                                                                    throw new ServiceException(jsonObject3.getString("message"));
1484
+
1485
+                                                                EsignHttpResponse signUrl = SignAward.signUrlMediation(sealSignRecordapply);
1486
+                                                                JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class);
1487
+                                                                JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data");
1488
+                                                                String urlapply = signUrlData.get("shortUrl").getAsString();
1489
+                                                                String urlapplynew = urlapply.substring(urlapply.lastIndexOf("/")+1);
1490
+
1491
+                                                                //发送签名链接短信,尊敬的{1}用户,您的{2}调解案件,签名链接{3},请点击链接签名,如非本人操作,请忽略本短信
1492
+                                                                SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
1493
+                                                                request.setTemplateId("2047719");
1494
+
1495
+                                                                if(StringUtils.isNotBlank(nameAgent)){
1496
+                                                                    request.setPhone(caseAffiliate.getContactTelphoneAgent());
1497
+                                                                    request.setTemplateParamSet(new String[]{caseAffiliate.getNameAgent(), application.getCaseNum(),urlapplynew});
1498
+                                                                }else {
1499
+                                                                    request.setPhone(caseAffiliate.getApplicationPhone());
1500
+                                                                    request.setTemplateParamSet(new String[]{caseAffiliate.getApplicationName(), application.getCaseNum(),urlapplynew});
1627 1501
                                                                 }
1502
+                                                                Boolean aBoolean = SmsUtils.sendSms(request);
1503
+
1504
+                                                                SealSignRecord sealSignRecordRespon = new SealSignRecord();
1505
+                                                                sealSignRecordRespon.setSignFlowid(signFlowId);
1506
+                                                                sealSignRecordRespon.setPensonAccount(caseAffiliate.getRespondentPhone());
1507
+                                                                EsignHttpResponse signUrlRespon = SignAward.signUrlMediation(sealSignRecordRespon);
1508
+                                                                JsonObject signUrlJsonObjectRespon = gson.fromJson(signUrlRespon.getBody(), JsonObject.class);
1509
+                                                                JsonObject signUrlDataRespon = signUrlJsonObjectRespon.getAsJsonObject("data");
1510
+                                                                String urlRespon = signUrlDataRespon.get("shortUrl").getAsString();
1511
+                                                                String urlResponnew = urlRespon.substring(urlRespon.lastIndexOf("/")+1);
1512
+
1513
+                                                                SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest();
1514
+                                                                request1.setTemplateId("2047719");
1515
+                                                                request1.setPhone(caseAffiliate.getRespondentPhone());
1516
+                                                                request1.setTemplateParamSet(new String[]{caseAffiliate.getRespondentName(), application.getCaseNum(),urlResponnew});
1517
+                                                                Boolean aBoolean1 = SmsUtils.sendSms(request1);
1518
+
1519
+                                                                SealSignRecord sealSignRecordMedi = new SealSignRecord();
1520
+                                                                sealSignRecordMedi.setSignFlowid(signFlowId);
1521
+                                                                sealSignRecordMedi.setPensonAccount(sealSignRecord.getPensonAccountMedi());
1522
+                                                                EsignHttpResponse signUrlResponMedi = SignAward.signUrlMediation(sealSignRecordMedi);
1523
+                                                                JsonObject signUrlJsonObjectResponMedi = gson.fromJson(signUrlResponMedi.getBody(), JsonObject.class);
1524
+                                                                JsonObject signUrlDataResponMedi = signUrlJsonObjectResponMedi.getAsJsonObject("data");
1525
+                                                                String urlResponMedi = signUrlDataResponMedi.get("shortUrl").getAsString();
1526
+                                                                String urlResponnewMedi = urlResponMedi.substring(urlResponMedi.lastIndexOf("/")+1);
1527
+
1528
+                                                                SmsUtils.SendSmsRequest requestMedi = new SmsUtils.SendSmsRequest();
1529
+                                                                requestMedi.setTemplateId("2047719");
1530
+                                                                requestMedi.setPhone(sealSignRecord.getPensonAccountMedi());
1531
+                                                                requestMedi.setTemplateParamSet(new String[]{sealSignRecord.getPensonNameMedi(), application.getCaseNum(),urlResponnewMedi});
1532
+                                                                Boolean aBooleanMedi = SmsUtils.sendSms(requestMedi);
1533
+
1628 1534
                                                             } else {
1629
-                                                                return AjaxResult.error();
1535
+                                                                throw new ServiceException(jsonObject3.getString("message"));
1630 1536
                                                             }
1537
+                                                        } else {
1538
+                                                            return AjaxResult.error();
1631 1539
                                                         }
1632
-                                                    } else {
1633
-                                                        return AjaxResult.error();
1634 1540
                                                     }
1541
+                                                } else {
1542
+                                                    return AjaxResult.error();
1635 1543
                                                 }
1636 1544
 
1637 1545
                                                 // 修改案件状态为待签名
@@ -1641,10 +1549,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
1641 1549
                                                 if(caseFlow != null){
1642 1550
                                                     application.setCaseFlowId(caseFlow.getId());
1643 1551
                                                     application.setCaseStatusName(caseFlow.getCaseStatusName());
1644
-                                                    msCaseApplicationMapper.updateByPrimaryKey(application);
1645 1552
                                                 }
1646 1553
 
1647
-                                                application.setIsReconci(isReconci);
1648 1554
                                                 application.setMediaResult(mediaResult);
1649 1555
                                                 msCaseApplicationMapper.updateByPrimaryKeySelective(application);
1650 1556
                                             }else{
@@ -1727,7 +1633,230 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
1727 1633
                             .header("signstr", signStr)
1728 1634
                             .body(paramsbody)
1729 1635
                             .execute();
1636
+                }else if(mediaResult.intValue()==5){
1637
+                    //达成和解
1638
+                    if (application.getTemplateId() == null) {
1639
+                        return AjaxResult.error("未找到模板");
1640
+                    }
1641
+                    String templateId = String.valueOf(application.getTemplateId());
1642
+                    req.setTemplateId(templateId);
1643
+                    req.setTemplateType(TemplateTypeEnum.MEDIATION_AGREEMENT.getCode());
1644
+                    AjaxResult result = generateApplication(req);
1645
+                    if (result != null && result.isSuccess()) {
1646
+                        List<MsCaseAttach> caseAttachList = msCaseAttachMapper.queryAnnexPathByCaseId(req.getId());
1647
+                        if (caseAttachList != null && caseAttachList.size() > 0) {
1648
+                            for (MsCaseAttach caseAttach : caseAttachList) {
1649
+                                if (caseAttach.getAnnexType() == AnnexTypeEnum.MEDIATE_BOOK.getCode()) {
1650
+                                    String prefix = "/profile";
1651
+                                    int startIndex = prefix.length();
1652
+                                    String annexPath = caseAttach.getAnnexPath();
1653
+                                    String path = "/home/ruoyi/uploadPath/" + annexPath.substring(startIndex+1);
1654
+                                    //获取文件上传地址
1655
+                                    EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path);
1656
+                                    String body = response.getBody();
1657
+                                    if (body != null) {
1658
+                                        JSONObject jsonObject = JSONObject.parseObject(body);
1659
+                                        String fileId = jsonObject.getJSONObject("data").getString("fileId");
1660
+                                        String fileUploadUrl = jsonObject.getJSONObject("data").getString("fileUploadUrl");
1661
+                                        //上传文件流
1662
+                                        EsignHttpResponse response1 = SaaSAPIFileUtils.uploadFile(fileUploadUrl, path);
1663
+                                        JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody());
1664
+                                        if (jsonObject1.getIntValue("errCode") == 0) {
1665
+                                            //查看文件上传状态
1666
+                                            Thread.sleep(1000);
1667
+                                            EsignHttpResponse response2 = SaaSAPIFileUtils.getFileStatus(fileId);
1668
+                                            JSONObject jsonObject2 = JSONObject.parseObject(response2.getBody());
1669
+                                            JSONObject data = jsonObject2.getJSONObject("data");
1670
+                                            int fileStatus = data.getIntValue("fileStatus");
1671
+                                            if (fileStatus == 2 || fileStatus == 5) {
1672
+                                                String fileName = data.getString("fileName");
1673
+                                                //上传成功,获取文件签名印章位置
1674
+                                                SealSignRecord sealSignRecord = new SealSignRecord();
1675
+                                                sealSignRecord.setFileid(fileId);
1676
+                                                EsignHttpResponse positions = SignAward.getPositionsMediation(sealSignRecord);
1677
+                                                Gson gson = new Gson();
1678
+                                                JsonObject positionsJsonObject = gson.fromJson(positions.getBody(), JsonObject.class);
1679
+                                                JsonObject positionsData = positionsJsonObject.getAsJsonObject("data");
1680
+                                                String keywordPositions = positionsData.get("keywordPositions").toString();
1681
+                                                //发起签署
1682
+                                                sealSignRecord.setFilename(fileName);
1683
+
1684
+                                                Long arbitratorId = application.getMediatorId();
1685
+                                                if (arbitratorId!=null) {
1686
+                                                    SysUser sysUser = sysUserMapper.selectUserById(arbitratorId);
1687
+                                                    if (sysUser == null) {
1688
+                                                        return AjaxResult.error();
1689
+                                                    }
1690
+                                                    sealSignRecord.setPensonAccountMedi(sysUser.getPhonenumber());
1691
+                                                    sealSignRecord.setPensonNameMedi(sysUser.getNickName());
1692
+                                                }
1693
+
1694
+                                                Integer organizeFlag = caseAffiliate.getOrganizeFlag();
1695
+                                                if(organizeFlag!=null){
1696
+                                                    if(organizeFlag.intValue()==1){
1697
+                                                        sealSignRecord.setPensonAccount(caseAffiliate.getContactTelphoneAgent());
1698
+                                                        sealSignRecord.setPensonName(caseAffiliate.getNameAgent());
1699
+                                                    }else {
1700
+                                                        String nameAgent = caseAffiliate.getNameAgent();
1701
+                                                        if(StringUtils.isNotBlank(nameAgent)){
1702
+                                                            sealSignRecord.setPensonAccount(caseAffiliate.getContactTelphoneAgent());
1703
+                                                            sealSignRecord.setPensonName(caseAffiliate.getNameAgent());
1704
+                                                        }else {
1705
+                                                            sealSignRecord.setPensonAccount(caseAffiliate.getApplicationPhone());
1706
+                                                            sealSignRecord.setPensonName(caseAffiliate.getApplicationName());
1707
+                                                        }
1708
+                                                    }
1709
+                                                }
1710
+
1711
+                                                sealSignRecord.setPensonAccountRes(caseAffiliate.getRespondentPhone());
1712
+                                                sealSignRecord.setPensonNameRes(caseAffiliate.getRespondentName());
1713
+
1714
+//                                                DeptIdentify deptIdentify = new DeptIdentify();
1715
+//                                                deptIdentify.setIsUse(1);
1716
+//                                                DeptIdentify deptIdentifyselect = new DeptIdentify();
1717
+//                                                List<DeptIdentify> deptIdentifysnew = deptIdentifyMapper.selectDeptIdentify(deptIdentify);
1718
+//                                                if (deptIdentifysnew != null && deptIdentifysnew.size() > 0) {
1719
+//                                                    deptIdentifyselect = deptIdentifysnew.get(0);
1720
+//                                                    sealSignRecord.setOrgnizeName(deptIdentifyselect.getIdentifyName());
1721
+//                                                    sealSignRecord.setOrgnizeNamePsnAccount(deptIdentifyselect.getOperPhone());
1722
+//                                                    sealSignRecord.setOrgnizeNamepsnName(deptIdentifyselect.getOperName());
1723
+//                                                } else {
1724
+//                                                    return AjaxResult.error("没有用印时的机构名称及经办人信息");
1725
+//                                                }
1726
+
1727
+                                                //解析文件签名印章位置
1728
+                                                JSONArray jsonArray = JSONArray.parseArray(keywordPositions);
1729
+                                                for (int i = 0; i < jsonArray.size(); i++) {
1730
+                                                    JSONObject jsonObject3 = jsonArray.getJSONObject(i);
1731
+                                                    String keyword = jsonObject3.getString("keyword");
1732
+                                                    if (keyword.equals("甲方(签字):")) {
1733
+                                                        //签名
1734
+                                                        JSONArray positionsArray = jsonObject3.getJSONArray("positions");
1735
+                                                        // 遍历 positionsArray 中的每个元素
1736
+                                                        for (int j = 0; j < positionsArray.size(); j++) {
1737
+                                                            JSONObject positionObj = positionsArray.getJSONObject(j);
1738
+                                                            int pageNum = positionObj.getIntValue("pageNum");
1739
+                                                            sealSignRecord.setPositionPagepsn(String.valueOf(pageNum));
1740
+                                                            JSONArray coordinatesArray = positionObj.getJSONArray("coordinates");
1741
+                                                            JSONObject coordinateObj = coordinatesArray.getJSONObject(0);
1742
+                                                            double positionX = coordinateObj.getDoubleValue("positionX");
1743
+                                                            double positionY = coordinateObj.getDoubleValue("positionY");
1744
+                                                            sealSignRecord.setPositionXpsn(positionX + 120);
1745
+                                                            sealSignRecord.setPositionYpsn(positionY);
1746
+                                                        }
1747
+                                                    }else if (keyword.equals("乙方(签字):")) {
1748
+                                                        //签名
1749
+                                                        JSONArray positionsArray = jsonObject3.getJSONArray("positions");
1750
+                                                        // 遍历 positionsArray 中的每个元素
1751
+                                                        for (int j = 0; j < positionsArray.size(); j++) {
1752
+                                                            JSONObject positionObj = positionsArray.getJSONObject(j);
1753
+                                                            int pageNum = positionObj.getIntValue("pageNum");
1754
+                                                            sealSignRecord.setPositionPagepsnRes(String.valueOf(pageNum));
1755
+                                                            JSONArray coordinatesArray = positionObj.getJSONArray("coordinates");
1756
+                                                            JSONObject coordinateObj = coordinatesArray.getJSONObject(0);
1757
+                                                            double positionX = coordinateObj.getDoubleValue("positionX");
1758
+                                                            double positionY = coordinateObj.getDoubleValue("positionY");
1759
+                                                            sealSignRecord.setPositionXpsnRes(positionX + 120);
1760
+                                                            sealSignRecord.setPositionYpsnRes(positionY + 10);
1761
+                                                        }
1762
+                                                    }
1763
+                                                }
1764
+
1765
+                                                EsignHttpResponse response3 = SignAward.createByFileReconci(sealSignRecord);
1766
+
1767
+                                                JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody());
1768
+                                                if (jsonObject3 != null) {
1769
+                                                    if (jsonObject3.getIntValue("code") == 0) {
1770
+                                                        //获取签署流程ID
1771
+                                                        JSONObject data1 = jsonObject3.getJSONObject("data");
1772
+                                                        String signFlowId = data1.getString("signFlowId");
1773
+                                                        //保存案件id,文件id,文件名称.流程id到签署用印记录表里
1774
+                                                        sealSignRecord.setCaseAppliId(application.getId());
1775
+                                                        sealSignRecord.setSignFlowid(signFlowId);
1776
+                                                        sealSignRecord.setSignFlowStatus(1);//待签名
1777
+                                                        MsSealSignRecord msSealSignRecord = new MsSealSignRecord();
1778
+                                                        BeanUtil.copyProperties(sealSignRecord, msSealSignRecord);
1779
+                                                        msSealSignRecord.setFileId(sealSignRecord.getFileid());
1780
+                                                        msSealSignRecord.setFileName(sealSignRecord.getFilename());
1781
+                                                        msSealSignRecord.setSignFlowId(sealSignRecord.getSignFlowid());
1782
+                                                        sealSignRecordMapper.insert(msSealSignRecord);
1783
+
1784
+                                                        SealSignRecord sealSignRecordapply = new SealSignRecord();
1785
+                                                        sealSignRecordapply.setSignFlowid(signFlowId);
1786
+
1787
+                                                        String nameAgent = caseAffiliate.getNameAgent();
1788
+                                                        if(StringUtils.isNotBlank(nameAgent)){
1789
+                                                            sealSignRecordapply.setPensonAccount(caseAffiliate.getContactTelphoneAgent());
1790
+                                                        }else {
1791
+                                                            sealSignRecordapply.setPensonAccount(caseAffiliate.getApplicationPhone());
1792
+                                                        }
1793
+
1794
+                                                        EsignHttpResponse signUrl = SignAward.signUrlMediation(sealSignRecordapply);
1795
+                                                        JsonObject signUrlJsonObject = gson.fromJson(signUrl.getBody(), JsonObject.class);
1796
+                                                        JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data");
1797
+                                                        String urlapply = signUrlData.get("shortUrl").getAsString();
1798
+                                                        String urlapplynew = urlapply.substring(urlapply.lastIndexOf("/")+1);
1799
+
1800
+                                                        //发送签名链接短信,尊敬的{1}用户,您的{2}调解案件,签名链接{3},请点击链接签名,如非本人操作,请忽略本短信
1801
+                                                        SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
1802
+                                                        request.setTemplateId("2047719");
1803
+                                                        if(StringUtils.isNotBlank(nameAgent)){
1804
+                                                            request.setPhone(caseAffiliate.getContactTelphoneAgent());
1805
+                                                            request.setTemplateParamSet(new String[]{caseAffiliate.getNameAgent(), application.getCaseNum(),urlapplynew});
1806
+                                                        }else {
1807
+                                                            request.setPhone(caseAffiliate.getApplicationPhone());
1808
+                                                            request.setTemplateParamSet(new String[]{caseAffiliate.getApplicationName(), application.getCaseNum(),urlapplynew});
1809
+                                                        }
1810
+                                                        Boolean aBoolean = SmsUtils.sendSms(request);
1811
+
1812
+                                                        SealSignRecord sealSignRecordRespon = new SealSignRecord();
1813
+                                                        sealSignRecordRespon.setSignFlowid(signFlowId);
1814
+                                                        sealSignRecordRespon.setPensonAccount(caseAffiliate.getRespondentPhone());
1815
+                                                        EsignHttpResponse signUrlRespon = SignAward.signUrlMediation(sealSignRecordRespon);
1816
+                                                        JsonObject signUrlJsonObjectRespon = gson.fromJson(signUrlRespon.getBody(), JsonObject.class);
1817
+                                                        JsonObject signUrlDataRespon = signUrlJsonObjectRespon.getAsJsonObject("data");
1818
+                                                        String urlRespon = signUrlDataRespon.get("shortUrl").getAsString();
1819
+                                                        String urlResponnew = urlRespon.substring(urlRespon.lastIndexOf("/")+1);
1820
+
1821
+                                                        SmsUtils.SendSmsRequest request1 = new SmsUtils.SendSmsRequest();
1822
+                                                        request1.setTemplateId("2047719");
1823
+                                                        request1.setPhone(caseAffiliate.getRespondentPhone());
1824
+                                                        request1.setTemplateParamSet(new String[]{caseAffiliate.getRespondentName(), application.getCaseNum(),urlResponnew});
1825
+                                                        Boolean aBoolean1 = SmsUtils.sendSms(request1);
1826
+
1827
+                                                    } else {
1828
+                                                        throw new ServiceException(jsonObject3.getString("message"));
1829
+                                                    }
1830
+                                                } else {
1831
+                                                    return AjaxResult.error();
1832
+                                                }
1833
+
1834
+                                                // 修改案件状态为待签名
1835
+                                                Example flowExample = new Example(MsCaseFlow.class);
1836
+                                                flowExample.createCriteria().andEqualTo("caseStatusName", "待签名");
1837
+                                                MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample);
1838
+                                                if(caseFlow != null){
1839
+                                                    application.setCaseFlowId(caseFlow.getId());
1840
+                                                    application.setCaseStatusName(caseFlow.getCaseStatusName());
1841
+                                                }
1842
+
1843
+                                                application.setMediaResult(mediaResult);
1844
+                                                msCaseApplicationMapper.updateByPrimaryKeySelective(application);
1845
+                                                return AjaxResult.success();
1846
+                                            }else{
1847
+                                                return AjaxResult.error();
1848
+                                            }
1849
+                                        }else{
1850
+                                            return AjaxResult.error();
1851
+                                        }
1852
+                                    }
1853
+                                    break;
1854
+                                }
1855
+                            }
1856
+                        }
1857
+                    }
1730 1858
                 }
1859
+
1731 1860
             }
1732 1861
         } else {
1733 1862
             // 线下调解