Преглед изворни кода

批量送达裁决书功能

qitz пре 2 година
родитељ
комит
95cacd287b

+ 28
- 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java Прегледај датотеку

@@ -42,7 +42,7 @@ public class AdjudicationController extends BaseController {
42 42
     /**
43 43
      * 根据批号查询批量签名链接
44 44
      */
45
-    @PostMapping("/selectBatchSignUrl")
45
+    @PostMapping("/getSignUrlBatch")
46 46
     public AjaxResult getSignUrlBatch(@RequestBody StringIdsReq idsReq) {
47 47
         if(StrUtil.isEmpty(idsReq.getBatchNumber().toString())|| StrUtil.isEmpty(idsReq.getPsnAccount())){
48 48
             return error("参数校验失败");
@@ -170,6 +170,19 @@ public class AdjudicationController extends BaseController {
170 170
         return adjudicationService.caseFile(batchCaseApplication.getIds());
171 171
     }
172 172
 
173
+    /**
174
+     * 批量归档(暂时只改案件状态)
175
+     * @param batchCaseApplication
176
+     * @return
177
+     */
178
+    @PostMapping("/caseFileBatch")
179
+    public AjaxResult caseFileBatch(@RequestBody CaseApplication caseApplication){
180
+        if(StrUtil.isEmpty(caseApplication.getBatchNumber().toString())){
181
+            return error("参数校验失败");
182
+        }
183
+        return adjudicationService.caseFileBatch(caseApplication.getBatchNumber());
184
+    }
185
+
173 186
     /**
174 187
      * 送达(不包含发送电子邮件)
175 188
      * @param bookSendVO
@@ -180,6 +193,20 @@ public class AdjudicationController extends BaseController {
180 193
     public AjaxResult service(@RequestBody BookSendVO bookSendVO){
181 194
         return adjudicationService.service(bookSendVO.getId(),bookSendVO.getAppEmail(),bookSendVO.getResEmail(),bookSendVO.getApptrackingNum(),bookSendVO.getRestrackingNum());
182 195
     }
196
+
197
+    /**
198
+     * 批量送达仲裁书
199
+     * @param caseApplication
200
+     * @return
201
+     */
202
+    @PostMapping("/serviceBatch")
203
+    public AjaxResult serviceBatch( CaseApplication caseApplication){
204
+        if(StrUtil.isEmpty(caseApplication.getBatchNumber().toString())){
205
+            return error("参数校验失败");
206
+        }
207
+        return adjudicationService.serviceBatch(caseApplication.getBatchNumber());
208
+    }
209
+
183 210
     /**
184 211
      * 用印(暂时只改案件状态)
185 212
      * @param caseApplication

+ 4
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IAdjudicationService.java Прегледај датотеку

@@ -61,4 +61,8 @@ public interface IAdjudicationService {
61 61
     SealSignRecord getSignUrlBatch(StringIdsReq idsReq);
62 62
 
63 63
     SealSignRecord getSealUrlBatch(StringIdsReq idsReq);
64
+
65
+    AjaxResult caseFileBatch(Integer batchNumber);
66
+
67
+    AjaxResult serviceBatch(Integer batchNumber);
64 68
 }

+ 191
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java Прегледај датотеку

@@ -744,6 +744,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
744 744
     }
745 745
 
746 746
     @Override
747
+    @Transactional
747 748
     public AjaxResult signature(CaseApplication caseApplication) {
748 749
         //更改案件状态(暂时)
749 750
         caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATED_SEAL);
@@ -755,6 +756,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
755 756
     }
756 757
 
757 758
     @Override
759
+    @Transactional
758 760
     public AjaxResult caseFile(List<Long> ids) {
759 761
         try {
760 762
             for (Long id : ids) {
@@ -1529,6 +1531,195 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
1529 1531
         return signRecord;
1530 1532
     }
1531 1533
 
1534
+    @Override
1535
+    @Transactional
1536
+    public AjaxResult caseFileBatch(Integer batchNumber) {
1537
+        CaseApplication caseApplicationsel = new CaseApplication();
1538
+        caseApplicationsel.setBatchNumber(batchNumber);
1539
+        caseApplicationsel.setCaseStatus(CaseApplicationConstants.CASE_FILING);
1540
+        List<CaseApplication> caseApplications1 = caseApplicationMapper.listCaseApplicationByBatchNumber(caseApplicationsel);
1541
+        if (caseApplications1 != null && caseApplications1.size() > 0) {
1542
+            List<Long> ids = caseApplications1.stream().map(CaseApplication::getId).collect(Collectors.toList());
1543
+            try {
1544
+                for (Long id : ids) {
1545
+                    CaseApplication caseApplication = new CaseApplication();
1546
+                    caseApplication.setId(id);
1547
+                    //更改案件状态(暂时)
1548
+                    caseApplication.setCaseStatus(CaseApplicationConstants.CASE_ARCHIVED);
1549
+                    caseApplicationMapper.submitCaseApplication(caseApplication);
1550
+                    // 新增日志
1551
+                    CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_ARCHIVED, "");
1552
+                }
1553
+            } catch (Exception e) {
1554
+                return AjaxResult.error(e.getMessage());
1555
+            }
1556
+
1557
+        }else{
1558
+            throw new ServiceException("这个批号没有批量归档的案件");
1559
+        }
1560
+
1561
+        return AjaxResult.success("归档成功");
1562
+    }
1563
+
1564
+    @Override
1565
+    @Transactional
1566
+    public AjaxResult serviceBatch(Integer batchNumber) {
1567
+        CaseApplication caseApplicationsel = new CaseApplication();
1568
+        caseApplicationsel.setBatchNumber(batchNumber);
1569
+        caseApplicationsel.setCaseStatus(CaseApplicationConstants.ARBITRATION_DELIVERY);
1570
+        List<CaseApplication> caseApplications1 = caseApplicationMapper.listCaseApplicationByBatchNumber(caseApplicationsel);
1571
+        if (caseApplications1 != null && caseApplications1.size() > 0) {
1572
+            List<Long> ids = caseApplications1.stream().map(CaseApplication::getId).collect(Collectors.toList());
1573
+            for (Long id : ids) {
1574
+                CaseApplication caseApplication = new CaseApplication();
1575
+                caseApplication.setId(id);
1576
+                CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication);
1577
+                if (caseApplication1 == null) {
1578
+                    return AjaxResult.error("未查询到相关案件");
1579
+                }
1580
+                List<CaseAttach> caseAttachList = caseAttachMapper.queryCaseAttachList(caseApplication1);
1581
+                if (caseAttachList != null && caseAttachList.size() > 0) {
1582
+                    for (CaseAttach caseAttach : caseAttachList) {
1583
+                        if (caseAttach.getAnnexType() == 3) {
1584
+                            String annexName = caseAttach.getAnnexName();
1585
+                            String prefix = "/profile/upload/";
1586
+                            int startIndex = prefix.length();
1587
+                            String path = caseAttach.getAnnexPath() + annexName.substring(startIndex);
1588
+                            File file = new File(path);
1589
+                            // todo 部署放开
1590
+                            if (!file.exists()) {
1591
+                                return AjaxResult.error("未生成裁决书");
1592
+                            }
1593
+
1594
+                        }
1595
+                    }
1596
+                }
1597
+                //修改案件状态
1598
+                caseApplication1.setCaseStatus(CaseApplicationConstants.CASE_FILING);
1599
+                caseApplicationMapper.submitCaseApplication(caseApplication1);
1600
+
1601
+                String appEmail = "";
1602
+                String resEmail = "";
1603
+                CaseAffiliate caseAffiliate = new CaseAffiliate();
1604
+                caseAffiliate.setCaseAppliId(id);
1605
+                List<CaseAffiliate> caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
1606
+                if (caseAffiliates != null && caseAffiliates.size() > 0) {
1607
+                    for (CaseAffiliate affiliate : caseAffiliates) {
1608
+                        if (affiliate.getIdentityType() == 1) {  //申请人
1609
+                            appEmail = affiliate.getSendEmail();
1610
+                        } else {
1611
+                            resEmail = affiliate.getSendEmail();
1612
+                        }
1613
+                    }
1614
+                }
1615
+
1616
+                //申请人发送邮件
1617
+                boolean appEmailFlag = sendCaseEmail(caseApplication1, appEmail, caseAttachList);
1618
+                SendMailRecord sendMailRecord = new SendMailRecord();
1619
+                sendMailRecord.setCaseId(id);
1620
+                sendMailRecord.setMailAddress(appEmail);
1621
+                sendMailRecord.setMailContent("您好,审核后的裁决书在附件中请查阅");
1622
+//        sendMailRecord.setMailContent("您好,您的{"+caseApplication1.getCaseNum()+"}案件,审核后的裁决书在附件中请查阅");
1623
+                sendMailRecord.setMailName("签署后的裁决书");
1624
+                sendMailRecord.setSendTime(new Date());
1625
+                sendMailRecord.setCreateBy(getUsername());
1626
+                if (appEmailFlag) {
1627
+                    sendMailRecord.setSendStatus(1);
1628
+                } else {
1629
+                    sendMailRecord.setSendStatus(0);
1630
+                }
1631
+                sendMailRecordMapper.saveSendMailRecord(sendMailRecord);
1632
+                // 被申请人发送邮件
1633
+                boolean resEmailFlag = sendCaseEmail(caseApplication1, resEmail, caseAttachList);
1634
+
1635
+                SendMailRecord sendMailRecord1 = new SendMailRecord();
1636
+                sendMailRecord1.setCaseId(id);
1637
+                sendMailRecord1.setMailAddress(resEmail);
1638
+//        sendMailRecord.setMailContent("您好,您的{"+caseApplication1.getCaseNum()+"}案件,审核后的裁决书在附件中请查阅");
1639
+                sendMailRecord1.setMailContent("您好,审核后的裁决书在附件中请查阅");
1640
+                sendMailRecord1.setMailName("签署后的裁决书");
1641
+                sendMailRecord1.setSendTime(new Date());
1642
+                sendMailRecord1.setCreateBy(getUsername());
1643
+                if (resEmailFlag) {
1644
+                    sendMailRecord1.setSendStatus(1);
1645
+                }else {
1646
+                    sendMailRecord1.setSendStatus(0);
1647
+                }
1648
+                sendMailRecordMapper.saveSendMailRecord(sendMailRecord1);
1649
+                if(!appEmailFlag&&!resEmailFlag){
1650
+                    throw new ServiceException("裁决书发送失败");
1651
+                }
1652
+                if(!appEmailFlag){
1653
+                    throw new ServiceException("申请人裁决书发送失败");
1654
+                }
1655
+                if(!resEmailFlag){
1656
+                    throw new ServiceException("被申请人裁决书发送失败");
1657
+                }
1658
+                // 发送短信
1659
+                if (appEmailFlag||resEmailFlag) {
1660
+
1661
+                    if (CollectionUtil.isNotEmpty(caseAffiliates)) {
1662
+                        SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
1663
+                        request.setTemplateId("1990362");
1664
+                        for (CaseAffiliate affiliate : caseAffiliates) {
1665
+                            String telphone=null;
1666
+                            if(appEmailFlag&&affiliate.getIdentityType()==1){
1667
+                                telphone = affiliate.getContactTelphone();
1668
+                            }else if(resEmailFlag&&affiliate.getIdentityType()==2){
1669
+                                telphone = affiliate.getContactTelphone();
1670
+                            }
1671
+                            if(StrUtil.isEmpty(telphone)){
1672
+                                continue;
1673
+                            }
1674
+
1675
+                            request.setPhone(telphone);
1676
+//                    if(affiliate.getIdentityType() == 1) {
1677
+//                        request.setTemplateParamSet(new String[]{caseAffiliate.getName(), caseApplication1.getCaseNum(), appEmail});
1678
+//                    }else {
1679
+//                        request.setTemplateParamSet(new String[]{caseAffiliate.getName(), caseApplication1.getCaseNum(), resEmail});
1680
+//                    }
1681
+                            request.setTemplateParamSet(new String[]{affiliate.getName(), caseApplication1.getCaseNum()});
1682
+                            Boolean aBoolean = SmsUtils.sendSms(request);
1683
+
1684
+                            // 保存短信发送记录
1685
+                            SmsSendRecord smsSendRecord = new SmsSendRecord();
1686
+                            smsSendRecord.setCaseId(caseAffiliate.getCaseAppliId());
1687
+
1688
+                            smsSendRecord.setCaseNum(caseApplication1.getCaseNum());
1689
+                            smsSendRecord.setPhone(request.getPhone());
1690
+                            smsSendRecord.setSendTime(new Date());
1691
+//                        // 尊敬的{1}用户,您的{2}仲裁案件,裁决书已送达,请知晓,如非本人操作,请忽略本短信。
1692
+//                        if(affiliate.getIdentityType() == 1) {
1693
+//                            smsSendRecord.setSendContent("尊敬的" + caseAffiliate.getName() + "用户,您的" + caseApplication1.getCaseNum() + "仲裁案件,裁决书已送达至" +appEmail+"邮箱,请知晓,如非本人操作,请忽略本短信。");
1694
+//                        }else {
1695
+//                            smsSendRecord.setSendContent("尊敬的" + caseAffiliate.getName() + "用户,您的" + caseApplication1.getCaseNum() + "仲裁案件,裁决书已送达至" +resEmail+"邮箱,请知晓,如非本人操作,请忽略本短信。");
1696
+//                        }
1697
+                            smsSendRecord.setSendContent("尊敬的" + affiliate.getName() + "用户,您的" + caseApplication1.getCaseNum() + "仲裁案件,裁决书已送达,请知晓,如非本人操作,请忽略本短信。");
1698
+
1699
+
1700
+                            smsSendRecord.setCreateBy(getUsername());
1701
+                            if (aBoolean) {
1702
+                                smsSendRecord.setSendStatus(1);
1703
+                            } else {
1704
+                                smsSendRecord.setSendStatus(0);
1705
+                            }
1706
+                            smsRecordMapper.saveSmsSendRecord(smsSendRecord);
1707
+                        }
1708
+
1709
+                    }
1710
+                    // 新增日志
1711
+                    CaseLogUtils.insertCaseLog(caseApplication1.getId(), CaseApplicationConstants.CASE_FILING, "");
1712
+
1713
+                }
1714
+
1715
+            }
1716
+
1717
+        }else{
1718
+            throw new ServiceException("这个批号没有批量送达裁决书的案件");
1719
+        }
1720
+        return AjaxResult.success("仲裁文书送达成功");
1721
+    }
1722
+
1532 1723
     /**
1533 1724
      * 根据仲裁员手机号分页查询等待签署,签署中的裁决书
1534 1725
      *