|
|
@@ -105,7 +105,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
105
|
105
|
LoginUser loginUser = getLoginUser();
|
|
106
|
106
|
SysUser user = loginUser.getUser();
|
|
107
|
107
|
Long userId = user.getUserId();
|
|
108
|
|
-
|
|
109
|
108
|
// 查询登录人身份证号
|
|
110
|
109
|
SysUser sysUser = sysUserMapper.selectUserById(userId);
|
|
111
|
110
|
List<SysRole> roles = sysUser.getRoles();
|
|
|
@@ -552,7 +551,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
552
|
551
|
@Override
|
|
553
|
552
|
@Transactional
|
|
554
|
553
|
public int insertcaseApplication(CaseApplication caseApplication) {
|
|
555
|
|
- // 新增立案信息
|
|
|
554
|
+
|
|
556
|
555
|
caseApplication.setCaseStatus(CaseApplicationConstants.CASE_APPLICATION);
|
|
557
|
556
|
//根据仲裁费用计费规则计算应缴费用
|
|
558
|
557
|
//暂时设置计费比率为0.01
|
|
|
@@ -563,10 +562,11 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
563
|
562
|
String caseNum = generateCaseNum();
|
|
564
|
563
|
caseApplication.setCaseNum(caseNum);
|
|
565
|
564
|
caseApplication.setCreateBy(getUsername());
|
|
566
|
|
-
|
|
|
565
|
+ // 新增立案信息
|
|
567
|
566
|
int rows = caseApplicationMapper.insertCaseApplication(caseApplication);
|
|
568
|
567
|
List<CaseAffiliate> caseAffiliates = caseApplication.getCaseAffiliates();
|
|
569
|
568
|
Map<String, Long> deptMap =new HashMap<>();
|
|
|
569
|
+ // 判断申请机构
|
|
570
|
570
|
if (caseAffiliates != null && caseAffiliates.size() > 0) {
|
|
571
|
571
|
// 查询所有的组织机构,组装成map
|
|
572
|
572
|
List<SysDept> deptList = sysDeptMapper.selectDeptList(new SysDept());
|
|
|
@@ -574,7 +574,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
574
|
574
|
deptList = new ArrayList<>();
|
|
575
|
575
|
}
|
|
576
|
576
|
deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptName, SysDept::getDeptId,(oldV,newV)->newV));
|
|
577
|
|
-
|
|
|
577
|
+ // 查询申请人角色id
|
|
|
578
|
+ Long roleId = roleMapper.selectRoleIdByName("申请人");
|
|
578
|
579
|
for (CaseAffiliate caseAffiliate : caseAffiliates) {
|
|
579
|
580
|
caseAffiliate.setCaseAppliId(caseApplication.getId());
|
|
580
|
581
|
if(caseAffiliate.getIdentityType()==1&&StrUtil.isNotEmpty(caseAffiliate.getName())) {
|
|
|
@@ -600,13 +601,13 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
600
|
601
|
|
|
601
|
602
|
}
|
|
602
|
603
|
// 组装申请代理人信息
|
|
603
|
|
- String agentInfoFlag = buildAgentInfo(caseAffiliate);
|
|
|
604
|
+ String agentInfoFlag = buildAgentInfo(caseAffiliate,roleId);
|
|
604
|
605
|
if(StrUtil.isNotEmpty(agentInfoFlag)){
|
|
605
|
606
|
throw new ServiceException(agentInfoFlag);
|
|
606
|
607
|
}
|
|
607
|
608
|
}
|
|
608
|
609
|
}
|
|
609
|
|
-
|
|
|
610
|
+ // 新增案件关联人
|
|
610
|
611
|
caseAffiliateMapper.batchCaseAffiliate(caseAffiliates);
|
|
611
|
612
|
}
|
|
612
|
613
|
|
|
|
@@ -614,6 +615,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
614
|
615
|
if (caseAttachList != null && caseAttachList.size() > 0) {
|
|
615
|
616
|
for (CaseAttach caseAttach : caseAttachList) {
|
|
616
|
617
|
caseAttach.setCaseAppliId(caseApplication.getId());
|
|
|
618
|
+ // 修改案件附件
|
|
617
|
619
|
caseAttachMapper.updateCaseAttach(caseAttach);
|
|
618
|
620
|
}
|
|
619
|
621
|
}
|
|
|
@@ -666,6 +668,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
666
|
668
|
deptList = new ArrayList<>();
|
|
667
|
669
|
}
|
|
668
|
670
|
Map<String, Long> deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptName, SysDept::getDeptId,(oldV,newV)->newV));
|
|
|
671
|
+ // 查询申请人角色id
|
|
|
672
|
+ Long roleId = roleMapper.selectRoleIdByName("申请人");
|
|
669
|
673
|
for (CaseAffiliate caseAffiliate : caseAffiliates){
|
|
670
|
674
|
caseAffiliate.setCaseAppliId(caseApplication.getId());
|
|
671
|
675
|
if(caseAffiliate.getIdentityType()==1&&StrUtil.isNotEmpty(caseAffiliate.getName())) {
|
|
|
@@ -691,7 +695,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
691
|
695
|
caseAffiliate.setApplicationOrganId(String.valueOf(dept.getDeptId()));
|
|
692
|
696
|
|
|
693
|
697
|
}
|
|
694
|
|
- String agentInfoFlag = buildAgentInfo(caseAffiliate);
|
|
|
698
|
+ String agentInfoFlag = buildAgentInfo(caseAffiliate,roleId);
|
|
695
|
699
|
if(StrUtil.isNotEmpty(agentInfoFlag)){
|
|
696
|
700
|
throw new ServiceException(agentInfoFlag);
|
|
697
|
701
|
}
|
|
|
@@ -718,10 +722,9 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
718
|
722
|
* 组装申请代理人信息
|
|
719
|
723
|
* @param caseAffiliate
|
|
720
|
724
|
*/
|
|
721
|
|
- private String buildAgentInfo(CaseAffiliate caseAffiliate) {
|
|
|
725
|
+ private String buildAgentInfo(CaseAffiliate caseAffiliate,Long roleId) {
|
|
722
|
726
|
if (caseAffiliate.getIdentityType()==1&&StrUtil.isNotEmpty(caseAffiliate.getNameAgent())) {
|
|
723
|
|
- // 查询申请人角色id
|
|
724
|
|
- Long roleId = roleMapper.selectRoleIdByName("申请人");
|
|
|
727
|
+
|
|
725
|
728
|
// 组装申请机构代理人信息,用户表新增并且和部门关联
|
|
726
|
729
|
// 根据代理人身份证去用户表查询,有修改,么有新增
|
|
727
|
730
|
SysUser agentUser = sysUserMapper.selectUserByIdCard(caseAffiliate.getIdentityNumAgent());
|
|
|
@@ -764,28 +767,40 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
764
|
767
|
caseAffiliate.setContactTelphoneAgent(agentUser.getPhonenumber());
|
|
765
|
768
|
caseAffiliate.setNameAgent(agentUser.getNickName());
|
|
766
|
769
|
caseAffiliate.setApplicantAgentUserId(String.valueOf(agentUser.getUserId()));
|
|
|
770
|
+ List<Long> longList=new ArrayList<>();
|
|
767
|
771
|
// 新增角色为申请人
|
|
768
|
772
|
if(CollectionUtil.isNotEmpty(agentUser.getRoles())) {
|
|
769
|
|
- List<Long> longList = agentUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList());
|
|
|
773
|
+ longList = agentUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList());
|
|
770
|
774
|
if(!longList.contains(roleId)) {
|
|
771
|
|
- ArrayList<SysUserRole> sysUserRoles = new ArrayList<>();
|
|
772
|
|
- SysUserRole sysUserRole = new SysUserRole();
|
|
773
|
|
- sysUserRole.setUserId(agentUser.getUserId());
|
|
774
|
|
- sysUserRole.setRoleId(roleId);
|
|
775
|
|
- sysUserRoles.add(sysUserRole);
|
|
776
|
|
- if (CollectionUtil.isNotEmpty(sysUserRoles)) {
|
|
777
|
|
- userRoleMapper.batchUserRole(sysUserRoles);
|
|
778
|
|
- }
|
|
|
775
|
+ insertAgentUserRole(agentUser,roleId);
|
|
779
|
776
|
}
|
|
|
777
|
+ }else {
|
|
|
778
|
+
|
|
|
779
|
+ insertAgentUserRole(agentUser,roleId);
|
|
780
|
780
|
}
|
|
781
|
781
|
|
|
782
|
782
|
}
|
|
783
|
783
|
|
|
784
|
|
-
|
|
785
|
784
|
}
|
|
786
|
785
|
return null;
|
|
787
|
786
|
}
|
|
788
|
787
|
|
|
|
788
|
+ /**
|
|
|
789
|
+ * 新增角色为申请人
|
|
|
790
|
+ * @param agentUser
|
|
|
791
|
+ * @param roleId
|
|
|
792
|
+ */
|
|
|
793
|
+ private void insertAgentUserRole(SysUser agentUser, Long roleId) {
|
|
|
794
|
+ ArrayList<SysUserRole> sysUserRoles = new ArrayList<>();
|
|
|
795
|
+ SysUserRole sysUserRole = new SysUserRole();
|
|
|
796
|
+ sysUserRole.setUserId(agentUser.getUserId());
|
|
|
797
|
+ sysUserRole.setRoleId(roleId);
|
|
|
798
|
+ sysUserRoles.add(sysUserRole);
|
|
|
799
|
+ if (CollectionUtil.isNotEmpty(sysUserRoles)) {
|
|
|
800
|
+ userRoleMapper.batchUserRole(sysUserRoles);
|
|
|
801
|
+ }
|
|
|
802
|
+ }
|
|
|
803
|
+
|
|
789
|
804
|
@Override
|
|
790
|
805
|
@Transactional
|
|
791
|
806
|
public int submitCaseApplication( List<Long> ids) {
|
|
|
@@ -882,7 +897,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
882
|
897
|
StringBuilder failureMsg = new StringBuilder();
|
|
883
|
898
|
StringBuilder successMsg = new StringBuilder();
|
|
884
|
899
|
int successNum = 0;
|
|
885
|
|
- int failureNum = 0;
|
|
886
|
900
|
if(caseApplicationList!=null&&caseApplicationList.size()>0){
|
|
887
|
901
|
// 1,查询所有的组织机构,组装成map
|
|
888
|
902
|
List<SysDept> deptList = sysDeptMapper.selectDeptList(new SysDept());
|
|
|
@@ -890,6 +904,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
890
|
904
|
if(CollectionUtil.isNotEmpty(deptList)) {
|
|
891
|
905
|
deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptName, SysDept::getDeptId,(oldV,newV)->newV));
|
|
892
|
906
|
}
|
|
|
907
|
+ // 查询申请人角色id
|
|
|
908
|
+ Long roleId = roleMapper.selectRoleIdByName("申请人");
|
|
893
|
909
|
List<CaseApplication> caseApplicationListinsert = new ArrayList<>();
|
|
894
|
910
|
for (int i = 0; i < caseApplicationList.size(); i++){
|
|
895
|
911
|
CaseApplication caseApplication = caseApplicationList.get(i);
|
|
|
@@ -907,7 +923,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
907
|
923
|
//赋值CaseApplication的案件关联人信息
|
|
908
|
924
|
List<CaseAffiliate> caseAffiliatesnew = new ArrayList<>();
|
|
909
|
925
|
// 组装案件关联人信息
|
|
910
|
|
- assignmentCaseAffiliates(caseApplication, caseAffiliatesnew, deptMap);
|
|
|
926
|
+ assignmentCaseAffiliates(caseApplication, caseAffiliatesnew, deptMap,roleId);
|
|
911
|
927
|
|
|
912
|
928
|
// int caseApplicationCount = selectCaseApplicationCount(caseApplication);
|
|
913
|
929
|
// if(caseApplicationCount>0){
|
|
|
@@ -928,7 +944,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
928
|
944
|
failureMsg.append("<br/>").append("第").append(i+2).append("行:").append(caseApplication.getErrorMsg().toString());
|
|
929
|
945
|
}
|
|
930
|
946
|
}
|
|
931
|
|
- if(caseApplicationListinsert!=null&&caseApplicationListinsert.size()>0){
|
|
|
947
|
+ if(caseApplicationListinsert.size()>0){
|
|
932
|
948
|
// List<CaseApplication> caseApplicationListinsertDiffer = caseApplicationListinsert.stream().collect(
|
|
933
|
949
|
// collectingAndThen(
|
|
934
|
950
|
// toCollection(() -> new TreeSet<>(Comparator.comparing(CaseApplication::getCaseNum))),
|
|
|
@@ -946,7 +962,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
946
|
962
|
List<CaseAffiliate> caseAffiliatesnew = new ArrayList<>();
|
|
947
|
963
|
CaseApplication caseApplicationNew = new CaseApplication();
|
|
948
|
964
|
copyCaseApplication(caseApplicationinsertDiffer,caseApplicationNew);
|
|
949
|
|
- if(caseApplicationListinsert!=null&&caseApplicationListinsert.size()>0){
|
|
|
965
|
+ if(caseApplicationListinsert.size()>0){
|
|
950
|
966
|
for (int j = 0; j < caseApplicationListinsert.size(); j++){
|
|
951
|
967
|
CaseApplication caseApplicationinsert = caseApplicationListinsert.get(j);
|
|
952
|
968
|
|
|
|
@@ -976,7 +992,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
976
|
992
|
}
|
|
977
|
993
|
|
|
978
|
994
|
successNum++;
|
|
979
|
|
- successMsg.append("<br/>" + successNum + "、立案编号 " + caseApplicationItera.getCaseNum() + " 导入成功");
|
|
|
995
|
+ successMsg.append("<br/>").append(successNum).append("、立案编号 ").append(caseApplicationItera.getCaseNum()).append(" 导入成功");
|
|
980
|
996
|
}
|
|
981
|
997
|
|
|
982
|
998
|
// }
|
|
|
@@ -988,7 +1004,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
988
|
1004
|
}else {
|
|
989
|
1005
|
throw new ServiceException("导入立案申请数据不能为空!");
|
|
990
|
1006
|
}
|
|
991
|
|
- return successMsg.append(failureMsg.toString()).toString();
|
|
|
1007
|
+ return successMsg.append(failureMsg).toString();
|
|
992
|
1008
|
|
|
993
|
1009
|
}
|
|
994
|
1010
|
|
|
|
@@ -1857,7 +1873,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
1857
|
1873
|
|
|
1858
|
1874
|
|
|
1859
|
1875
|
|
|
1860
|
|
- private void assignmentCaseAffiliates(CaseApplication caseApplication, List<CaseAffiliate> caseAffiliatesnew, Map<String, Long> deptMap) {
|
|
|
1876
|
+ private void assignmentCaseAffiliates(CaseApplication caseApplication, List<CaseAffiliate> caseAffiliatesnew,
|
|
|
1877
|
+ Map<String, Long> deptMap,Long roleId) {
|
|
1861
|
1878
|
// 申请人信息
|
|
1862
|
1879
|
CaseAffiliate caseAffiliate = new CaseAffiliate();
|
|
1863
|
1880
|
|
|
|
@@ -1869,7 +1886,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
|
|
1869
|
1886
|
if(StrUtil.isNotEmpty(caseApplication.getName())){
|
|
1870
|
1887
|
setApplicantOrganization(caseAffiliate, caseApplication, deptMap);
|
|
1871
|
1888
|
}
|
|
1872
|
|
- String s = buildAgentInfo(caseAffiliate);
|
|
|
1889
|
+ String s = buildAgentInfo(caseAffiliate,roleId);
|
|
1873
|
1890
|
if(StrUtil.isNotEmpty(s)){
|
|
1874
|
1891
|
StringBuilder errorMsg = caseApplication.getErrorMsg();
|
|
1875
|
1892
|
if(StrUtil.isEmpty(errorMsg)){
|