|
|
@@ -701,17 +701,17 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
701
|
701
|
if(CollectionUtil.isNotEmpty(applicant)){
|
|
702
|
702
|
for (int i = 0; i < applicant.size(); i++) {
|
|
703
|
703
|
// 申请人
|
|
704
|
|
- appOperatorCount= setCaseAfflicate(caseApplication, applicant.get(i).getApplicant(),i,appOperatorCount);
|
|
|
704
|
+ appOperatorCount= setCaseAfflicate(caseApplication, applicant.get(i).getApplicant(),i,appOperatorCount,false);
|
|
705
|
705
|
// 申请人代理人
|
|
706
|
|
- appOperatorCount=setCaseAfflicate(caseApplication, applicant.get(i).getApplicantAgent(),i,appOperatorCount);
|
|
|
706
|
+ appOperatorCount=setCaseAfflicate(caseApplication, applicant.get(i).getApplicantAgent(),i,appOperatorCount,false);
|
|
707
|
707
|
}
|
|
708
|
708
|
}
|
|
709
|
709
|
if(CollectionUtil.isNotEmpty(res)){
|
|
710
|
710
|
for (int i = 0; i < res.size(); i++) {
|
|
711
|
711
|
// 申请人
|
|
712
|
|
- resOperatorCount= setCaseAfflicate(caseApplication, res.get(i).getRes(),i,resOperatorCount);
|
|
|
712
|
+ resOperatorCount= setCaseAfflicate(caseApplication, res.get(i).getRes(),i,resOperatorCount,false);
|
|
713
|
713
|
// 申请人代理人
|
|
714
|
|
- resOperatorCount= setCaseAfflicate(caseApplication, res.get(i).getResAgent(),i,resOperatorCount);
|
|
|
714
|
+ resOperatorCount= setCaseAfflicate(caseApplication, res.get(i).getResAgent(),i,resOperatorCount,false);
|
|
715
|
715
|
}
|
|
716
|
716
|
}
|
|
717
|
717
|
if (appOperatorCount < 1 && resOperatorCount < 1) {
|
|
|
@@ -769,9 +769,12 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
769
|
769
|
* 设置案件相关信息
|
|
770
|
770
|
* @param caseApplication
|
|
771
|
771
|
* @param affiliate
|
|
|
772
|
+ * @param groupOrder 组别
|
|
|
773
|
+ * @param operatorCount 操作人数量
|
|
|
774
|
+ * @param updateFlag 是否修改案件
|
|
772
|
775
|
*/
|
|
773
|
776
|
@Transactional
|
|
774
|
|
- public int setCaseAfflicate(MsCaseApplicationVO caseApplication, MsCaseAffiliate affiliate,int groupOrder,int operatorCount) {
|
|
|
777
|
+ public int setCaseAfflicate(MsCaseApplicationVO caseApplication, MsCaseAffiliate affiliate,int groupOrder,int operatorCount,boolean updateFlag) {
|
|
775
|
778
|
if(affiliate==null){
|
|
776
|
779
|
return operatorCount;
|
|
777
|
780
|
}
|
|
|
@@ -793,8 +796,6 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
793
|
796
|
}
|
|
794
|
797
|
affiliate.setCaseAppliId(caseApplication.getId());
|
|
795
|
798
|
List<Long> roleIdList = new ArrayList<>();
|
|
796
|
|
- // Long roleId = null;
|
|
797
|
|
-
|
|
798
|
799
|
switch (affiliate.getRoleType()) {
|
|
799
|
800
|
case 1:
|
|
800
|
801
|
roleIdList.add((Long) applicantObj);
|
|
|
@@ -827,19 +828,28 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
827
|
828
|
}
|
|
828
|
829
|
break;
|
|
829
|
830
|
default:
|
|
830
|
|
-
|
|
831
|
831
|
break;
|
|
832
|
832
|
}
|
|
833
|
833
|
// 如果是申请人,则和用户表关联
|
|
834
|
834
|
if (affiliate.getOrganizeFlag() == 0) {
|
|
835
|
|
- caseApplicationService.insertAfficateUser(affiliate, roleIdList);
|
|
|
835
|
+ caseApplicationService.insertAfficateUser(affiliate, roleIdList, updateFlag);
|
|
836
|
836
|
} else {
|
|
837
|
837
|
// 申请机构
|
|
838
|
838
|
if (affiliate.getRoleType() == 1 || affiliate.getRoleType()==3) {
|
|
839
|
839
|
affiliate.setOperatorFlag(0);
|
|
840
|
840
|
// 申请人,从缓存中判断部门是否存在
|
|
841
|
|
-// Object deptCache = redisCache.getCacheObject(CacheConstants.DEPT_KEY + affiliate.getName());
|
|
842
|
|
- SysDept dept = sysDeptMapper.selectDeptByName(affiliate.getName());
|
|
|
841
|
+ SysDept dept = null;
|
|
|
842
|
+ if(!updateFlag) {
|
|
|
843
|
+ // 新增则根据部门名称查
|
|
|
844
|
+ dept = sysDeptMapper.selectDeptByName(affiliate.getName());
|
|
|
845
|
+ }else {
|
|
|
846
|
+ if(affiliate.getApplicantDeptId()!=null){
|
|
|
847
|
+ // 修改根据部门id查
|
|
|
848
|
+ dept = sysDeptMapper.selectDeptById(affiliate.getApplicantDeptId());
|
|
|
849
|
+ }else {
|
|
|
850
|
+ dept = sysDeptMapper.selectDeptByName(affiliate.getName());
|
|
|
851
|
+ }
|
|
|
852
|
+ }
|
|
843
|
853
|
if (dept==null) {
|
|
844
|
854
|
// 不存在该部门,新增
|
|
845
|
855
|
dept = new SysDept();
|
|
|
@@ -872,7 +882,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
872
|
882
|
}
|
|
873
|
883
|
affiliate.setApplicantDeptId(dept.getDeptId());
|
|
874
|
884
|
} else {
|
|
875
|
|
- caseApplicationService.insertAfficateUser(affiliate, roleIdList);
|
|
|
885
|
+ caseApplicationService.insertAfficateUser(affiliate, roleIdList, updateFlag);
|
|
876
|
886
|
}
|
|
877
|
887
|
}
|
|
878
|
888
|
// 保存人员
|
|
|
@@ -887,15 +897,27 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
887
|
897
|
* 新增案件相关人员信息
|
|
888
|
898
|
* @param affiliate 相关人员信息
|
|
889
|
899
|
* @param roleIdList 角色id
|
|
|
900
|
+ * @param updateFlag 是否修改案件
|
|
890
|
901
|
|
|
891
|
902
|
*/
|
|
892
|
903
|
@Transactional
|
|
893
|
|
- public void insertAfficateUser(MsCaseAffiliate affiliate, List<Long> roleIdList) {
|
|
|
904
|
+ public void insertAfficateUser(MsCaseAffiliate affiliate, List<Long> roleIdList,boolean updateFlag) {
|
|
894
|
905
|
|
|
895
|
906
|
if(StrUtil.isEmpty(affiliate.getEmail())){
|
|
896
|
907
|
return;
|
|
897
|
908
|
}
|
|
898
|
|
- SysUser user = sysUserMapper.selectUserByEmail(affiliate.getEmail());
|
|
|
909
|
+ SysUser user=null;
|
|
|
910
|
+ if(!updateFlag) {
|
|
|
911
|
+ // 新增案件则根据邮箱查用户
|
|
|
912
|
+ user = sysUserMapper.selectUserByEmail(affiliate.getEmail());
|
|
|
913
|
+ }else {
|
|
|
914
|
+ // 修改案件则根据userId查用户
|
|
|
915
|
+ if(affiliate.getUserId()!=null) {
|
|
|
916
|
+ user = sysUserMapper.selectUserById(affiliate.getUserId());
|
|
|
917
|
+ }else {
|
|
|
918
|
+ user = sysUserMapper.selectUserByEmail(affiliate.getEmail());
|
|
|
919
|
+ }
|
|
|
920
|
+ }
|
|
899
|
921
|
// 判断该用户是否存在
|
|
900
|
922
|
if(user==null){
|
|
901
|
923
|
// 不存在,则新增
|
|
|
@@ -1079,17 +1101,17 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
1079
|
1101
|
if(CollectionUtil.isNotEmpty(applicant)){
|
|
1080
|
1102
|
for (int i = 0; i < applicant.size(); i++) {
|
|
1081
|
1103
|
// 申请人
|
|
1082
|
|
- appOperatorCount=setCaseAfflicate(caseApplication, applicant.get(i).getApplicant(),i,appOperatorCount);
|
|
|
1104
|
+ appOperatorCount=setCaseAfflicate(caseApplication, applicant.get(i).getApplicant(),i,appOperatorCount,true);
|
|
1083
|
1105
|
// 申请人代理人
|
|
1084
|
|
- appOperatorCount= setCaseAfflicate(caseApplication, applicant.get(i).getApplicantAgent(),i,appOperatorCount);
|
|
|
1106
|
+ appOperatorCount= setCaseAfflicate(caseApplication, applicant.get(i).getApplicantAgent(),i,appOperatorCount,true);
|
|
1085
|
1107
|
}
|
|
1086
|
1108
|
}
|
|
1087
|
1109
|
if(CollectionUtil.isNotEmpty(res)){
|
|
1088
|
1110
|
for (int i = 0; i < res.size(); i++) {
|
|
1089
|
1111
|
// 申请人
|
|
1090
|
|
- resOperatorCount=setCaseAfflicate(caseApplication, res.get(i).getRes(),i,resOperatorCount);
|
|
|
1112
|
+ resOperatorCount=setCaseAfflicate(caseApplication, res.get(i).getRes(),i,resOperatorCount,true);
|
|
1091
|
1113
|
// 申请人代理人
|
|
1092
|
|
- resOperatorCount=setCaseAfflicate(caseApplication, res.get(i).getResAgent(),i,resOperatorCount);
|
|
|
1114
|
+ resOperatorCount=setCaseAfflicate(caseApplication, res.get(i).getResAgent(),i,resOperatorCount,true);
|
|
1093
|
1115
|
}
|
|
1094
|
1116
|
}
|
|
1095
|
1117
|
if (appOperatorCount < 1 && resOperatorCount < 1) {
|