|
|
@@ -1,13 +1,18 @@
|
|
1
|
1
|
package com.ruoyi.wisdomarbitrate.service.impl;
|
|
2
|
2
|
|
|
3
|
3
|
|
|
|
4
|
+import cn.hutool.core.collection.CollectionUtil;
|
|
|
5
|
+import com.ruoyi.common.annotation.DataScope;
|
|
4
|
6
|
import com.ruoyi.common.constant.CaseApplicationConstants;
|
|
|
7
|
+import com.ruoyi.common.core.domain.entity.SysDept;
|
|
5
|
8
|
import com.ruoyi.common.exception.ServiceException;
|
|
6
|
9
|
import com.ruoyi.common.utils.DateUtils;
|
|
7
|
10
|
import com.ruoyi.common.utils.SmsUtils;
|
|
8
|
11
|
import com.ruoyi.common.utils.StringUtils;
|
|
9
|
12
|
import com.ruoyi.common.utils.bean.BeanUtils;
|
|
|
13
|
+import com.ruoyi.system.mapper.SysDeptMapper;
|
|
10
|
14
|
import com.ruoyi.wisdomarbitrate.domain.*;
|
|
|
15
|
+import com.ruoyi.wisdomarbitrate.domain.vo.SendRoomNoMessageVO;
|
|
11
|
16
|
import com.ruoyi.wisdomarbitrate.mapper.*;
|
|
12
|
17
|
import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
|
|
13
|
18
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -18,6 +23,8 @@ import java.text.SimpleDateFormat;
|
|
18
|
23
|
import java.util.*;
|
|
19
|
24
|
import java.util.stream.Collectors;
|
|
20
|
25
|
|
|
|
26
|
+import static com.ruoyi.common.utils.SecurityUtils.getUsername;
|
|
|
27
|
+
|
|
21
|
28
|
|
|
22
|
29
|
@Service
|
|
23
|
30
|
public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
|
@@ -34,6 +41,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
34
|
41
|
|
|
35
|
42
|
@Autowired
|
|
36
|
43
|
private CaseAttachMapper caseAttachMapper;
|
|
|
44
|
+ @Autowired
|
|
|
45
|
+ private SysDeptMapper sysDeptMapper;
|
|
37
|
46
|
|
|
38
|
47
|
|
|
39
|
48
|
|
|
|
@@ -52,7 +61,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
52
|
61
|
//根据仲裁费用计费规则计算应缴费用
|
|
53
|
62
|
//暂时设置计费比率为0.01
|
|
54
|
63
|
BigDecimal feeRate = new BigDecimal(0.01);
|
|
55
|
|
- BigDecimal feePayable = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
|
64
|
+ BigDecimal feePayable = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
56
|
65
|
caseApplication.setFeePayable(feePayable);
|
|
57
|
66
|
// 获取自动编码
|
|
58
|
67
|
String caseNum = generateCaseNum();
|
|
|
@@ -60,16 +69,43 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
60
|
69
|
|
|
61
|
70
|
int rows = caseApplicationMapper.insertCaseApplication(caseApplication);
|
|
62
|
71
|
List<CaseAffiliate> caseAffiliates = caseApplication.getCaseAffiliates();
|
|
63
|
|
- if(caseAffiliates!=null&&caseAffiliates.size()>0){
|
|
64
|
|
- for (CaseAffiliate caseAffiliate : caseAffiliates){
|
|
|
72
|
+
|
|
|
73
|
+ if (caseAffiliates != null && caseAffiliates.size() > 0) {
|
|
|
74
|
+ // 查询所有的组织机构,组装成map
|
|
|
75
|
+ List<SysDept> deptList = sysDeptMapper.selectDeptList(new SysDept());
|
|
|
76
|
+ if (CollectionUtil.isEmpty(deptList)) {
|
|
|
77
|
+ deptList = new ArrayList<>();
|
|
|
78
|
+ }
|
|
|
79
|
+ Map<String, Long> deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptName, SysDept::getDeptId));
|
|
|
80
|
+
|
|
|
81
|
+ for (CaseAffiliate caseAffiliate : caseAffiliates) {
|
|
65
|
82
|
caseAffiliate.setCaseAppliId(caseApplication.getId());
|
|
|
83
|
+ // 将组织机构id设为申请人名称
|
|
|
84
|
+ if (deptMap.containsKey(caseApplication.getName())) {
|
|
|
85
|
+ caseAffiliate.setName(String.valueOf(deptMap.get(caseApplication.getName())));
|
|
|
86
|
+ } else {
|
|
|
87
|
+ // 如果不存在则新增
|
|
|
88
|
+ SysDept dept = new SysDept();
|
|
|
89
|
+ dept.setParentId(0L);
|
|
|
90
|
+ dept.setDeptName(caseApplication.getName());
|
|
|
91
|
+ dept.setAncestors("0");
|
|
|
92
|
+ dept.setOrderNum(1);
|
|
|
93
|
+ dept.setStatus("0");
|
|
|
94
|
+ dept.setDelFlag("0");
|
|
|
95
|
+ dept.setCreateBy(getUsername());
|
|
|
96
|
+ dept.setUpdateBy(getUsername());
|
|
|
97
|
+ sysDeptMapper.insertDept(dept);
|
|
|
98
|
+ caseAffiliate.setName(String.valueOf(dept.getDeptId()));
|
|
|
99
|
+
|
|
|
100
|
+ }
|
|
66
|
101
|
}
|
|
|
102
|
+
|
|
67
|
103
|
caseAffiliateMapper.batchCaseAffiliate(caseAffiliates);
|
|
68
|
104
|
}
|
|
69
|
105
|
|
|
70
|
106
|
List<CaseAttach> caseAttachList = caseApplication.getCaseAttachList();
|
|
71
|
|
- if(caseAttachList!=null&&caseAttachList.size()>0){
|
|
72
|
|
- for (CaseAttach caseAttach : caseAttachList){
|
|
|
107
|
+ if (caseAttachList != null && caseAttachList.size() > 0) {
|
|
|
108
|
+ for (CaseAttach caseAttach : caseAttachList) {
|
|
73
|
109
|
caseAttach.setCaseAppliId(caseApplication.getId());
|
|
74
|
110
|
caseAttachMapper.updateCaseAttach(caseAttach);
|
|
75
|
111
|
}
|
|
|
@@ -213,6 +249,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
213
|
249
|
int successNum = 0;
|
|
214
|
250
|
int failureNum = 0;
|
|
215
|
251
|
if(caseApplicationList!=null&&caseApplicationList.size()>0){
|
|
|
252
|
+ // 1,查询所有的组织机构,组装成map
|
|
|
253
|
+ List<SysDept> deptList = sysDeptMapper.selectDeptList(new SysDept());
|
|
216
|
254
|
List<CaseApplication> caseApplicationListinsert = new ArrayList<>();
|
|
217
|
255
|
for (int i = 0; i < caseApplicationList.size(); i++){
|
|
218
|
256
|
CaseApplication caseApplication = caseApplicationList.get(i);
|
|
|
@@ -224,7 +262,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
224
|
262
|
|
|
225
|
263
|
//赋值CaseApplication的案件关联人信息
|
|
226
|
264
|
List<CaseAffiliate> caseAffiliatesnew = new ArrayList<>();
|
|
227
|
|
- assignmentCaseAffiliates(caseApplication,caseAffiliatesnew);
|
|
|
265
|
+ // 组装案件关联人信息
|
|
|
266
|
+ assignmentCaseAffiliates(caseApplication,caseAffiliatesnew,deptList);
|
|
228
|
267
|
|
|
229
|
268
|
// int caseApplicationCount = selectCaseApplicationCount(caseApplication);
|
|
230
|
269
|
// if(caseApplicationCount>0){
|
|
|
@@ -415,6 +454,32 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
415
|
454
|
return caseApplicationselect;
|
|
416
|
455
|
}
|
|
417
|
456
|
|
|
|
457
|
+ /**
|
|
|
458
|
+ * 给被申请人发送房间号短信
|
|
|
459
|
+ * @param messageVO
|
|
|
460
|
+ * @return
|
|
|
461
|
+ */
|
|
|
462
|
+ @Override
|
|
|
463
|
+ public String sendRoomNoMessage(SendRoomNoMessageVO messageVO) {
|
|
|
464
|
+ Arbitrator arbitrator = arbitratorMapper.selectArbitratorById(messageVO.getId(), 2);
|
|
|
465
|
+ if(null==arbitrator){
|
|
|
466
|
+ return "被申请人不存在";
|
|
|
467
|
+ }
|
|
|
468
|
+ CaseApplication caseApplication = new CaseApplication();
|
|
|
469
|
+ caseApplication.setId(messageVO.getId());
|
|
|
470
|
+ CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication);
|
|
|
471
|
+
|
|
|
472
|
+ //发送短信通知
|
|
|
473
|
+ SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
|
|
|
474
|
+ request.setTemplateId("1948332");
|
|
|
475
|
+ // 1948332 普通短信 开庭审理房间号通知 尊敬的{1}用户,您的{2}仲裁案件,开庭审理房间号为{3},请知晓,如非本人操作,请忽略本短信。
|
|
|
476
|
+ request.setPhone(arbitrator.getTelephone());
|
|
|
477
|
+ request.setTemplateParamSet(new String[]{arbitrator.getArbitratorName(), caseApplicationselect.getCaseNum(), messageVO.getRoomNo()});
|
|
|
478
|
+
|
|
|
479
|
+
|
|
|
480
|
+ return "短信发送成功";
|
|
|
481
|
+ }
|
|
|
482
|
+
|
|
418
|
483
|
@Override
|
|
419
|
484
|
@Transactional
|
|
420
|
485
|
public int pendTralSure(CaseApplication caseApplication) {
|
|
|
@@ -509,12 +574,15 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
509
|
574
|
|
|
510
|
575
|
|
|
511
|
576
|
|
|
512
|
|
- private void assignmentCaseAffiliates(CaseApplication caseApplication, List<CaseAffiliate> caseAffiliatesnew) {
|
|
|
577
|
+ private void assignmentCaseAffiliates(CaseApplication caseApplication, List<CaseAffiliate> caseAffiliatesnew,List<SysDept> deptList) {
|
|
|
578
|
+ // 申请人信息
|
|
513
|
579
|
CaseAffiliate caseAffiliate = new CaseAffiliate();
|
|
514
|
580
|
|
|
515
|
581
|
// BeanUtils.copyBeanProp(caseApplication,caseAffiliate);
|
|
516
|
582
|
BeanUtils.copyBeanProp(caseAffiliate,caseApplication);
|
|
517
|
583
|
caseAffiliate.setIdentityType(1);
|
|
|
584
|
+ // 申请人(机构),需要判断部门中是否存在,不存在则新增,当身份类型为1的时候,查询时需要根据名称查询组织机构
|
|
|
585
|
+ setApplicantOrganization(caseAffiliate,caseApplication,deptList);
|
|
518
|
586
|
caseAffiliatesnew.add(caseAffiliate);
|
|
519
|
587
|
|
|
520
|
588
|
// 组装被申请人信息
|
|
|
@@ -522,6 +590,40 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
522
|
590
|
caseApplication.setCaseAffiliates(caseAffiliatesnew);
|
|
523
|
591
|
}
|
|
524
|
592
|
|
|
|
593
|
+ /**
|
|
|
594
|
+ * 设置申请人的组织机构
|
|
|
595
|
+ * @param caseAffiliate
|
|
|
596
|
+ * @param caseApplication
|
|
|
597
|
+ */
|
|
|
598
|
+ @DataScope(deptAlias = "d")
|
|
|
599
|
+ private void setApplicantOrganization(CaseAffiliate caseAffiliate, CaseApplication caseApplication, List<SysDept> deptList ) {
|
|
|
600
|
+
|
|
|
601
|
+ if(CollectionUtil.isNotEmpty(deptList)){
|
|
|
602
|
+ Map<String, Long> deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptName, SysDept::getDeptId));
|
|
|
603
|
+ // 将组织机构id设为申请人名称
|
|
|
604
|
+ if(deptMap.containsKey(caseApplication.getName())){
|
|
|
605
|
+ caseAffiliate.setName(String.valueOf(deptMap.get(caseApplication.getName())));
|
|
|
606
|
+ }else {
|
|
|
607
|
+ // 如果不存在则新增
|
|
|
608
|
+ SysDept dept = new SysDept();
|
|
|
609
|
+ dept.setParentId(0L);
|
|
|
610
|
+ dept.setDeptName(caseApplication.getName());
|
|
|
611
|
+ dept.setAncestors("0");
|
|
|
612
|
+ dept.setOrderNum(1);
|
|
|
613
|
+ dept.setStatus("0");
|
|
|
614
|
+ dept.setDelFlag("0");
|
|
|
615
|
+ dept.setCreateBy(getUsername());
|
|
|
616
|
+ dept.setUpdateBy(getUsername());
|
|
|
617
|
+ sysDeptMapper.insertDept(dept);
|
|
|
618
|
+ caseAffiliate.setName(String.valueOf(dept.getDeptId()));
|
|
|
619
|
+
|
|
|
620
|
+ }
|
|
|
621
|
+ }
|
|
|
622
|
+
|
|
|
623
|
+
|
|
|
624
|
+
|
|
|
625
|
+ }
|
|
|
626
|
+
|
|
525
|
627
|
/**
|
|
526
|
628
|
* 组装被申请人信息
|
|
527
|
629
|
* @param caseApplication
|