|
|
@@ -2,6 +2,7 @@ package com.ruoyi.wisdomarbitrate.service.impl;
|
|
2
|
2
|
|
|
3
|
3
|
|
|
4
|
4
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
5
|
+import cn.hutool.core.util.StrUtil;
|
|
5
|
6
|
import com.ruoyi.common.annotation.DataScope;
|
|
6
|
7
|
import com.ruoyi.common.constant.CaseApplicationConstants;
|
|
7
|
8
|
import com.ruoyi.common.core.domain.entity.SysDept;
|
|
|
@@ -69,34 +70,38 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
69
|
70
|
|
|
70
|
71
|
int rows = caseApplicationMapper.insertCaseApplication(caseApplication);
|
|
71
|
72
|
List<CaseAffiliate> caseAffiliates = caseApplication.getCaseAffiliates();
|
|
72
|
|
-
|
|
|
73
|
+ Map<String, Long> deptMap =new HashMap<>();
|
|
73
|
74
|
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<>();
|
|
|
75
|
+ if(StrUtil.isNotEmpty(caseApplication.getName())) {
|
|
|
76
|
+ // 查询所有的组织机构,组装成map
|
|
|
77
|
+ List<SysDept> deptList = sysDeptMapper.selectDeptList(new SysDept());
|
|
|
78
|
+ if (CollectionUtil.isEmpty(deptList)) {
|
|
|
79
|
+ deptList = new ArrayList<>();
|
|
|
80
|
+ }
|
|
|
81
|
+ deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptName, SysDept::getDeptId));
|
|
78
|
82
|
}
|
|
79
|
|
- Map<String, Long> deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptName, SysDept::getDeptId));
|
|
80
|
|
-
|
|
81
|
83
|
for (CaseAffiliate caseAffiliate : caseAffiliates) {
|
|
82
|
84
|
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
|
|
-
|
|
|
85
|
+ if(caseAffiliate.getIdentityType()==1&&StrUtil.isNotEmpty(caseApplication.getName())) {
|
|
|
86
|
+ // 将组织机构id设为申请人名称
|
|
|
87
|
+ if (deptMap.containsKey(caseApplication.getName())) {
|
|
|
88
|
+ caseAffiliate.setName(String.valueOf(deptMap.get(caseApplication.getName())));
|
|
|
89
|
+ } else {
|
|
|
90
|
+ // 如果不存在则新增
|
|
|
91
|
+ SysDept dept = new SysDept();
|
|
|
92
|
+ dept.setParentId(0L);
|
|
|
93
|
+ dept.setDeptName(caseApplication.getName());
|
|
|
94
|
+ dept.setAncestors("0");
|
|
|
95
|
+ dept.setOrderNum(1);
|
|
|
96
|
+ dept.setStatus("0");
|
|
|
97
|
+ dept.setDelFlag("0");
|
|
|
98
|
+ dept.setCreateBy(getUsername());
|
|
|
99
|
+ dept.setUpdateBy(getUsername());
|
|
|
100
|
+ sysDeptMapper.insertDept(dept);
|
|
|
101
|
+ deptMap.put(dept.getDeptName(), dept.getDeptId());
|
|
|
102
|
+ caseAffiliate.setName(String.valueOf(dept.getDeptId()));
|
|
|
103
|
+
|
|
|
104
|
+ }
|
|
100
|
105
|
}
|
|
101
|
106
|
}
|
|
102
|
107
|
|
|
|
@@ -582,7 +587,9 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
582
|
587
|
BeanUtils.copyBeanProp(caseAffiliate,caseApplication);
|
|
583
|
588
|
caseAffiliate.setIdentityType(1);
|
|
584
|
589
|
// 申请人(机构),需要判断部门中是否存在,不存在则新增,当身份类型为1的时候,查询时需要根据名称查询组织机构
|
|
585
|
|
- setApplicantOrganization(caseAffiliate,caseApplication,deptList);
|
|
|
590
|
+ if(StrUtil.isNotEmpty(caseApplication.getName())){
|
|
|
591
|
+ setApplicantOrganization(caseAffiliate, caseApplication, deptList);
|
|
|
592
|
+ }
|
|
586
|
593
|
caseAffiliatesnew.add(caseAffiliate);
|
|
587
|
594
|
|
|
588
|
595
|
// 组装被申请人信息
|
|
|
@@ -615,6 +622,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
615
|
622
|
dept.setCreateBy(getUsername());
|
|
616
|
623
|
dept.setUpdateBy(getUsername());
|
|
617
|
624
|
sysDeptMapper.insertDept(dept);
|
|
|
625
|
+ deptMap.put(dept.getDeptName(),dept.getDeptId());
|
|
618
|
626
|
caseAffiliate.setName(String.valueOf(dept.getDeptId()));
|
|
619
|
627
|
|
|
620
|
628
|
}
|