|
|
@@ -13,6 +13,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
|
|
13
|
13
|
import com.ruoyi.common.core.domain.entity.*;
|
|
14
|
14
|
import com.ruoyi.common.core.domain.model.LoginUser;
|
|
15
|
15
|
import com.ruoyi.common.enums.AnnexTypeEnum;
|
|
|
16
|
+import com.ruoyi.common.enums.MediatorTypeEnum;
|
|
16
|
17
|
import com.ruoyi.common.enums.YesOrNoEnum;
|
|
17
|
18
|
import com.ruoyi.common.exception.EsignDemoException;
|
|
18
|
19
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
@@ -271,7 +272,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
271
|
272
|
// 保存案件相关人员
|
|
272
|
273
|
if (affiliate != null) {
|
|
273
|
274
|
// 设置申请人
|
|
274
|
|
- if (StrUtil.isNotEmpty(affiliate.getApplicationOrganName())) {
|
|
|
275
|
+ if (StrUtil.isNotEmpty(affiliate.getApplicationName())&&affiliate.getOrganizeFlag()==1) {
|
|
275
|
276
|
// 组装申请机构
|
|
276
|
277
|
insertDept(affiliate);
|
|
277
|
278
|
// 新增申请机构代理人
|
|
|
@@ -344,7 +345,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
344
|
345
|
columnValueMapper.batchSave(columnValueList);
|
|
345
|
346
|
}
|
|
346
|
347
|
// todo 发送短信
|
|
347
|
|
- CaseLogUtils.insertCaseLog(caseApplication.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), "");
|
|
|
348
|
+ CaseLogUtils.insertCaseLog(caseApplication.getId(), 0, "新增案件", "");
|
|
348
|
349
|
return 1;
|
|
349
|
350
|
}
|
|
350
|
351
|
|
|
|
@@ -410,7 +411,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
410
|
411
|
if (affiliate != null) {
|
|
411
|
412
|
affiliate.setCaseAppliId(caseApplication.getId());
|
|
412
|
413
|
// 设置申请人
|
|
413
|
|
- if (StrUtil.isNotEmpty(affiliate.getApplicationOrganName())) {
|
|
|
414
|
+ if (StrUtil.isNotEmpty(affiliate.getApplicationName())&&affiliate.getOrganizeFlag()==1) {
|
|
414
|
415
|
// 组装申请机构
|
|
415
|
416
|
insertDept(affiliate);
|
|
416
|
417
|
// 新增申请机构代理人
|
|
|
@@ -786,6 +787,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
786
|
787
|
* @param affiliateMap
|
|
787
|
788
|
*/
|
|
788
|
789
|
private void accept(MsCaseApplication application, MsCaseApplication req, Map<Long, MsCaseAffiliate> affiliateMap) {
|
|
|
790
|
+ application.setPaperFlag(req.getPaperFlag());
|
|
|
791
|
+ application.setArbitrateConfirm(req.getArbitrateConfirm());
|
|
|
792
|
+ application.setMediationMethod(req.getMediationMethod());
|
|
789
|
793
|
application.setUpdateBy(SecurityUtils.getUsername());
|
|
790
|
794
|
application.setUpdateTime(new Date());
|
|
791
|
795
|
application.setBatchNumber(null);
|
|
|
@@ -866,8 +870,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
866
|
870
|
return AjaxResult.error("暂无调解员");
|
|
867
|
871
|
}
|
|
868
|
872
|
List<Long> userIds = users.stream().map(SysUser::getUserId).collect(Collectors.toList());
|
|
869
|
|
- // todo 状态为未结束的是待办数量,结束的是已办数量
|
|
870
|
|
- Map<String, List<MsCaseApplication>> caseMap=null;
|
|
|
873
|
+ // 状态为未结束的是待办数量,结束的是已办数量
|
|
|
874
|
+ Map<Long, List<MsCaseApplication>> caseMap=null;
|
|
871
|
875
|
|
|
872
|
876
|
List<MsCaseApplication> caseApplicationList = msCaseApplicationMapper.listMediator(userIds);
|
|
873
|
877
|
if (CollectionUtil.isNotEmpty(caseApplicationList)) {
|
|
|
@@ -879,9 +883,11 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
879
|
883
|
mediatorVO.setMediatorId(user.getUserId());
|
|
880
|
884
|
mediatorVO.setMediatorName(user.getNickName());
|
|
881
|
885
|
mediatorVO.setSpecialty(user.getSpecialty());
|
|
882
|
|
-
|
|
883
|
|
- if(caseMap!=null&&caseMap.containsKey(String.valueOf(user.getUserId()))) {
|
|
884
|
|
- List<MsCaseApplication> applications = caseMap.get(String.valueOf(user.getUserId()));
|
|
|
886
|
+ if(caseMap==null){
|
|
|
887
|
+ mediatorVO.setTodoAmount(0L);
|
|
|
888
|
+ mediatorVO.setCompleteAmount(0L);
|
|
|
889
|
+ } else if(caseMap.containsKey(user.getUserId())) {
|
|
|
890
|
+ List<MsCaseApplication> applications = caseMap.get(user.getUserId());
|
|
885
|
891
|
// 已办案件
|
|
886
|
892
|
long count = applications.stream().filter(caseApplication -> !caseApplication.getCaseStatusName().equals("结束")).count();
|
|
887
|
893
|
mediatorVO.setTodoAmount(applications.size()-count);
|
|
|
@@ -909,14 +915,18 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
909
|
915
|
if (currentFlow == null) {
|
|
910
|
916
|
return AjaxResult.error("当前流程不存在");
|
|
911
|
917
|
}
|
|
|
918
|
+ // 获取选择的调解员id
|
|
|
919
|
+ List<Long> userIds = vo.getUserList().stream().map(SysUser::getUserId).collect(Collectors.toList());
|
|
912
|
920
|
// 新增案件预约表
|
|
913
|
|
- MsCaseMediator mediator = new MsCaseMediator();
|
|
914
|
|
- mediator.setCaseAppliId(vo.getId());
|
|
915
|
|
- mediator.setMediatorId(String.valueOf(vo.getUserList().get(0).getUserId()));
|
|
916
|
|
- mediator.setMediatorName(String.valueOf(vo.getUserList().get(0).getUserName()));
|
|
917
|
|
- mediator.setHearDate(String.valueOf(vo.getHerDates().get(0)));
|
|
918
|
|
- mediator.setType(vo.getMiniProgressFlag());
|
|
919
|
|
- msCaseMediatorMapper.insert(mediator);
|
|
|
921
|
+ for (SysUser sysUser : vo.getUserList()) {
|
|
|
922
|
+ MsCaseMediator mediator = new MsCaseMediator();
|
|
|
923
|
+ mediator.setCaseAppliId(vo.getId());
|
|
|
924
|
+ mediator.setMediatorId(sysUser.getUserId());
|
|
|
925
|
+ mediator.setMediatorName(sysUser.getNickName());
|
|
|
926
|
+ mediator.setType(vo.getMiniProgressFlag()==null?MediatorTypeEnum.PC.getCode() : vo.getMiniProgressFlag());
|
|
|
927
|
+ msCaseMediatorMapper.insert(mediator);
|
|
|
928
|
+ }
|
|
|
929
|
+
|
|
920
|
930
|
// 申请人预约
|
|
921
|
931
|
if (vo.getMiniProgressFlag() == null) {
|
|
922
|
932
|
// 新增日志
|
|
|
@@ -926,12 +936,12 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
926
|
936
|
return AjaxResult.error("被申请人身份证为空");
|
|
927
|
937
|
}
|
|
928
|
938
|
|
|
929
|
|
- SysUser user = userMapper.selectUserByIdCard(msCaseAffiliate.getRespondentIdentityNum());
|
|
|
939
|
+ // SysUser user = userMapper.selectUserByIdCard(msCaseAffiliate.getRespondentIdentityNum());
|
|
930
|
940
|
// 被申请人存在
|
|
931
|
|
- if (user != null) {
|
|
|
941
|
+ // if (user != null) {
|
|
932
|
942
|
// 判断被申请人信息查询案件预约表
|
|
933
|
|
- isReservation( vo,user);
|
|
934
|
|
- }
|
|
|
943
|
+ isReservation( vo,userIds);
|
|
|
944
|
+ // }
|
|
935
|
945
|
|
|
936
|
946
|
} else {
|
|
937
|
947
|
// 被申请人预约
|
|
|
@@ -941,11 +951,11 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
941
|
951
|
return AjaxResult.error("申请代理人手机号为空");
|
|
942
|
952
|
}
|
|
943
|
953
|
|
|
944
|
|
- SysUser user = userMapper.selectUserByPhone(msCaseAffiliate.getContactTelphoneAgent());
|
|
945
|
|
- if(user!=null){
|
|
|
954
|
+ // SysUser user = userMapper.selectUserByPhone(msCaseAffiliate.getContactTelphoneAgent());
|
|
|
955
|
+ // if(user!=null){
|
|
946
|
956
|
// 判断申请人是否预约
|
|
947
|
|
- isReservation( vo,user);
|
|
948
|
|
- }
|
|
|
957
|
+ isReservation( vo,userIds);
|
|
|
958
|
+ // }
|
|
949
|
959
|
|
|
950
|
960
|
}
|
|
951
|
961
|
return AjaxResult.success();
|
|
|
@@ -954,9 +964,15 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
954
|
964
|
/**
|
|
955
|
965
|
* 判断申请人/被申请人是否预约
|
|
956
|
966
|
* @param vo
|
|
957
|
|
- * @param user
|
|
|
967
|
+ * @param userIds 选择的调解员ids
|
|
958
|
968
|
*/
|
|
959
|
|
- private void isReservation( BookingVO vo, SysUser user) {
|
|
|
969
|
+ private void isReservation( BookingVO vo, List<Long> userIds ) {
|
|
|
970
|
+ // 查询所有调解员
|
|
|
971
|
+ List<SysUser> mediatorUsers = sysUserMapper.selectUserByRole("调解员");
|
|
|
972
|
+ if (CollectionUtil.isEmpty(mediatorUsers)) {
|
|
|
973
|
+ throw new ServiceException("暂无调解员");
|
|
|
974
|
+ }
|
|
|
975
|
+ Map<Long, SysUser> userMap = mediatorUsers.stream().collect(Collectors.toMap(SysUser::getUserId, Function.identity()));
|
|
960
|
976
|
Example example = new Example(MsCaseMediator.class);
|
|
961
|
977
|
Example.Criteria criteria = example.createCriteria();
|
|
962
|
978
|
if(vo.getMiniProgressFlag() == null) {
|
|
|
@@ -968,14 +984,50 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
968
|
984
|
}
|
|
969
|
985
|
criteria.andEqualTo("caseAppliId", vo.getId());
|
|
970
|
986
|
// criteria.andEqualTo("mediatorId", user.getUserId());
|
|
971
|
|
- int count = msCaseMediatorMapper.selectCountByExample(example);
|
|
972
|
|
- if (count > 0) {
|
|
973
|
|
- // 申请人已预约,更新主表流程节点
|
|
|
987
|
+ List<MsCaseMediator> msCaseMediators = msCaseMediatorMapper.selectByExample(example);
|
|
|
988
|
+ if (CollectionUtil.isNotEmpty(msCaseMediators)) {
|
|
|
989
|
+ MsCaseApplication application = new MsCaseApplication();
|
|
|
990
|
+ // 申请人或者被申请人已预约,更新主表流程节点
|
|
974
|
991
|
MsCaseFlow nextFlow = caseFlowMapper.nextFlow(vo.getCaseFlowId());
|
|
975
|
992
|
if (nextFlow == null) {
|
|
976
|
993
|
throw new ServiceException("未找到下一个流程");
|
|
977
|
994
|
}
|
|
978
|
|
- MsCaseApplication application = new MsCaseApplication();
|
|
|
995
|
+ // 取出另一方的调解员id
|
|
|
996
|
+ List<Long> mediatorIds = msCaseMediators.stream().map(MsCaseMediator::getMediatorId).collect(Collectors.toList());
|
|
|
997
|
+ // 取出申请人和被申请人选择调解员交集,交集>1,根据优先级确定调解员(优先级查调解员已结束的案件)
|
|
|
998
|
+ List<Long> intersectionWithoutModifyOriginal = new ArrayList<>(userIds);
|
|
|
999
|
+ // 交集
|
|
|
1000
|
+ List<Long> intersection = new ArrayList<>(intersectionWithoutModifyOriginal);
|
|
|
1001
|
+ intersection.retainAll(mediatorIds);
|
|
|
1002
|
+ // 有一个交集,则直接更新主表调解员
|
|
|
1003
|
+ if(intersection.size()==1){
|
|
|
1004
|
+ application.setMediatorId(intersection.get(0));
|
|
|
1005
|
+ application.setMediatorName(userMap.get(intersection.get(0)).getNickName());
|
|
|
1006
|
+ }else if(intersection.size()>1){
|
|
|
1007
|
+ // 查询调解员的案件,有多个交集,根据优先级获取
|
|
|
1008
|
+ List<MsCaseApplication> caseApplicationList = msCaseApplicationMapper.listMediator(userIds);
|
|
|
1009
|
+ if (CollectionUtil.isNotEmpty(caseApplicationList)) {
|
|
|
1010
|
+ Map<Long, List<MsCaseApplication>> caseMap = caseApplicationList.stream().collect(Collectors.groupingBy(MsCaseApplication::getMediatorId, Collectors.toList()));
|
|
|
1011
|
+ long maxCount=0;
|
|
|
1012
|
+ for (Long userId : intersection) {
|
|
|
1013
|
+ if (caseMap.containsKey(userId)) {
|
|
|
1014
|
+ List<MsCaseApplication> applications = caseMap.get(userId);
|
|
|
1015
|
+ // 已办案件
|
|
|
1016
|
+ long count = applications.stream().filter(caseApplication -> !caseApplication.getCaseStatusName().equals("结束")).count();
|
|
|
1017
|
+ if(count>=maxCount){
|
|
|
1018
|
+ maxCount=count;
|
|
|
1019
|
+ application.setMediatorId(userId);
|
|
|
1020
|
+ application.setMediatorName(userMap.get(userId).getNickName());
|
|
|
1021
|
+ }
|
|
|
1022
|
+ }
|
|
|
1023
|
+ }
|
|
|
1024
|
+
|
|
|
1025
|
+ }else {
|
|
|
1026
|
+ // 没有案件,则随机取一个调解员
|
|
|
1027
|
+ application.setMediatorId(intersection.get(0));
|
|
|
1028
|
+ application.setMediatorName(userMap.get(intersection.get(0)).getNickName());
|
|
|
1029
|
+ }
|
|
|
1030
|
+ }
|
|
979
|
1031
|
application.setId(vo.getId());
|
|
980
|
1032
|
application.setCaseFlowId(nextFlow.getId());
|
|
981
|
1033
|
application.setCaseStatusName(nextFlow.getCaseStatusName());
|
|
|
@@ -997,21 +1049,21 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
997
|
1049
|
* @param application
|
|
998
|
1050
|
* @param vo
|
|
999
|
1051
|
*/
|
|
1000
|
|
- private void setMediatorAndDate(MsCaseApplication application, BookingVO vo) {
|
|
1001
|
|
- if(CollectionUtil.isNotEmpty(vo.getUserList())) {
|
|
1002
|
|
- List<SysUser> userList = vo.getUserList();
|
|
1003
|
|
- List<Long> userIds = userList.stream().map(SysUser::getUserId).collect(Collectors.toList());
|
|
1004
|
|
- List<String> userNames = userList.stream().map(SysUser::getUserName).collect(Collectors.toList());
|
|
1005
|
|
- String mediatorIds = StrUtil.join(",", userIds);
|
|
1006
|
|
- String mediatorNames = StrUtil.join(",", userNames);
|
|
1007
|
|
- application.setMediatorId(mediatorIds);
|
|
1008
|
|
- application.setMediatorName(mediatorNames);
|
|
1009
|
|
- }
|
|
1010
|
|
- if(CollectionUtil.isNotEmpty( vo.getHerDates())) {
|
|
1011
|
|
- String herDates = StrUtil.join(",", vo.getHerDates());
|
|
1012
|
|
- application.setHearDate(herDates);
|
|
1013
|
|
- }
|
|
1014
|
|
- }
|
|
|
1052
|
+// private void setMediatorAndDate(MsCaseApplication application, BookingVO vo) {
|
|
|
1053
|
+// if(CollectionUtil.isNotEmpty(vo.getUserList())) {
|
|
|
1054
|
+// List<SysUser> userList = vo.getUserList();
|
|
|
1055
|
+// List<Long> userIds = userList.stream().map(SysUser::getUserId).collect(Collectors.toList());
|
|
|
1056
|
+// List<String> userNames = userList.stream().map(SysUser::getUserName).collect(Collectors.toList());
|
|
|
1057
|
+// String mediatorIds = StrUtil.join(",", userIds);
|
|
|
1058
|
+// String mediatorNames = StrUtil.join(",", userNames);
|
|
|
1059
|
+// application.setMediatorId(mediatorIds);
|
|
|
1060
|
+// application.setMediatorName(mediatorNames);
|
|
|
1061
|
+// }
|
|
|
1062
|
+// if(CollectionUtil.isNotEmpty( vo.getHerDates())) {
|
|
|
1063
|
+// String herDates = StrUtil.join(",", vo.getHerDates());
|
|
|
1064
|
+// application.setHearDate(herDates);
|
|
|
1065
|
+// }
|
|
|
1066
|
+// }
|
|
1015
|
1067
|
|
|
1016
|
1068
|
/**
|
|
1017
|
1069
|
* 核实调解员
|
|
|
@@ -1044,56 +1096,58 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
1044
|
1096
|
*/
|
|
1045
|
1097
|
@Override
|
|
1046
|
1098
|
public AjaxResult selectReservation(Long id) {
|
|
|
1099
|
+ // 查询案件主表
|
|
|
1100
|
+ MsCaseApplication application = msCaseApplicationMapper.selectByPrimaryKey(id);
|
|
|
1101
|
+ if (application == null) {
|
|
|
1102
|
+ return AjaxResult.error("该案件不存在");
|
|
|
1103
|
+ }
|
|
1047
|
1104
|
BookingVO result = new BookingVO();
|
|
1048
|
|
-
|
|
1049
|
|
- // MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(id);
|
|
1050
|
|
- // todo 返回申请人预约信息,预约信息查预约表
|
|
1051
|
|
- // criteria.andEqualTo("mediatorId", SecurityUtils.getUserId());
|
|
1052
|
|
- MsCaseMediator msCaseMediator = msCaseMediatorMapper.selectLastApplicant(id);
|
|
1053
|
|
- if(msCaseMediator==null){
|
|
|
1105
|
+ result.setMediatorId(application.getMediatorId());
|
|
|
1106
|
+ result.setMediatorName(application.getMediatorName());
|
|
|
1107
|
+ Example example = new Example(MsCaseAffiliate.class);
|
|
|
1108
|
+ example.createCriteria().andEqualTo("caseAppliId", id);
|
|
|
1109
|
+ List<MsCaseMediator> msCaseMediators = msCaseMediatorMapper.selectByExample(example);
|
|
|
1110
|
+ if(CollectionUtil.isEmpty(msCaseMediators)){
|
|
1054
|
1111
|
return AjaxResult.success(result);
|
|
1055
|
1112
|
}
|
|
1056
|
|
-// if(caseApplication == null){
|
|
1057
|
|
-// return AjaxResult.error("该案件不存在");
|
|
1058
|
|
-// }
|
|
|
1113
|
+ Map<Integer, List<MsCaseMediator>> mediatorMap = msCaseMediators.stream().collect(Collectors.groupingBy(MsCaseMediator::getType));
|
|
|
1114
|
+ // 申请人
|
|
|
1115
|
+ result.setMediatorList(mediatorMap.get(MediatorTypeEnum.PC.getCode()));
|
|
|
1116
|
+ result.setResMediatorList(mediatorMap.get(MediatorTypeEnum.MI_NI_PROGRESS.getCode()));
|
|
1059
|
1117
|
|
|
1060
|
|
- // 调解员是一个的处理
|
|
1061
|
|
- if( StrUtil.isNotEmpty(msCaseMediator.getMediatorId()) && StrUtil.isNotEmpty(msCaseMediator.getMediatorName())){
|
|
1062
|
1118
|
// 查询用户
|
|
1063
|
|
- SysUser user = userMapper.selectUserById(Long.valueOf(msCaseMediator.getMediatorId()));
|
|
1064
|
|
- if(user==null){
|
|
1065
|
|
- return AjaxResult.error("调解员已被删除");
|
|
1066
|
|
- }
|
|
1067
|
|
- // 查询待办数量
|
|
1068
|
|
- List<Long> mediatorIds = new ArrayList<>();
|
|
1069
|
|
- mediatorIds.add(user.getUserId());
|
|
1070
|
|
- Map<String, List<MsCaseApplication>> caseMap=null;
|
|
1071
|
|
- List<MsCaseApplication> caseApplicationList = msCaseApplicationMapper.listMediator(mediatorIds);
|
|
1072
|
|
- if (CollectionUtil.isNotEmpty(caseApplicationList)) {
|
|
1073
|
|
- caseMap = caseApplicationList.stream().collect(Collectors.groupingBy(MsCaseApplication::getMediatorId, Collectors.toList()));
|
|
|
1119
|
+// SysUser user = userMapper.selectUserById(Long.valueOf(msCaseMediator.getMediatorId()));
|
|
|
1120
|
+// if(user==null){
|
|
|
1121
|
+// return AjaxResult.error("调解员已被删除");
|
|
|
1122
|
+// }
|
|
|
1123
|
+// // 查询待办数量
|
|
|
1124
|
+// List<Long> mediatorIds = new ArrayList<>();
|
|
|
1125
|
+// mediatorIds.add(user.getUserId());
|
|
|
1126
|
+// Map<Long, List<MsCaseApplication>> caseMap=null;
|
|
|
1127
|
+// List<MsCaseApplication> caseApplicationList = msCaseApplicationMapper.listMediator(mediatorIds);
|
|
|
1128
|
+// if (CollectionUtil.isNotEmpty(caseApplicationList)) {
|
|
|
1129
|
+// caseMap = caseApplicationList.stream().collect(Collectors.groupingBy(MsCaseApplication::getMediatorId, Collectors.toList()));
|
|
|
1130
|
+//
|
|
|
1131
|
+// }
|
|
|
1132
|
+// MediatorVO mediatorVO = new MediatorVO();
|
|
|
1133
|
+// mediatorVO.setMediatorId(user.getUserId());
|
|
|
1134
|
+// mediatorVO.setMediatorName(user.getNickName());
|
|
|
1135
|
+// mediatorVO.setSpecialty(user.getSpecialty());
|
|
|
1136
|
+// if(caseMap==null){
|
|
|
1137
|
+// mediatorVO.setTodoAmount(0L);
|
|
|
1138
|
+// mediatorVO.setCompleteAmount(0L);
|
|
|
1139
|
+// }
|
|
|
1140
|
+//
|
|
|
1141
|
+// else if(caseMap.containsKey(String.valueOf(user.getUserId()))) {
|
|
|
1142
|
+// List<MsCaseApplication> applications = caseMap.get(String.valueOf(user.getUserId()));
|
|
|
1143
|
+// // 已办案件
|
|
|
1144
|
+// long count = applications.stream().filter(caseApplication -> !caseApplication.getCaseStatusName().equals("结束")).count();
|
|
|
1145
|
+// mediatorVO.setTodoAmount(applications.size()-count);
|
|
|
1146
|
+// mediatorVO.setCompleteAmount(count);
|
|
|
1147
|
+// }
|
|
|
1148
|
+
|
|
1074
|
1149
|
|
|
1075
|
|
- }
|
|
1076
|
|
- MediatorVO mediatorVO = new MediatorVO();
|
|
1077
|
|
- mediatorVO.setMediatorId(user.getUserId());
|
|
1078
|
|
- mediatorVO.setMediatorName(user.getNickName());
|
|
1079
|
|
- mediatorVO.setSpecialty(user.getSpecialty());
|
|
1080
|
1150
|
|
|
1081
|
|
- if(caseMap!=null&&caseMap.containsKey(String.valueOf(user.getUserId()))) {
|
|
1082
|
|
- List<MsCaseApplication> applications = caseMap.get(String.valueOf(user.getUserId()));
|
|
1083
|
|
- // 已办案件
|
|
1084
|
|
- long count = applications.stream().filter(caseApplication -> !caseApplication.getCaseStatusName().equals("结束")).count();
|
|
1085
|
|
- mediatorVO.setTodoAmount(applications.size()-count);
|
|
1086
|
|
- mediatorVO.setCompleteAmount(count);
|
|
1087
|
|
- }
|
|
1088
|
|
- List<MediatorVO> mediatorVOS = new ArrayList<>();
|
|
1089
|
|
- mediatorVOS.add(mediatorVO);
|
|
1090
|
|
- result.setMediatorList(mediatorVOS);
|
|
1091
|
|
- }
|
|
1092
|
|
- if(StrUtil.isNotEmpty(msCaseMediator.getHearDate())){
|
|
1093
|
|
- List<String> herdates = new ArrayList<>();
|
|
1094
|
|
- herdates.add(msCaseMediator.getHearDate());
|
|
1095
|
|
- result.setHerDates(herdates);
|
|
1096
|
|
- }
|
|
1097
|
1151
|
return AjaxResult.success(result);
|
|
1098
|
1152
|
}
|
|
1099
|
1153
|
|
|
|
@@ -1211,9 +1265,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
1211
|
1265
|
//发起签署
|
|
1212
|
1266
|
sealSignRecord.setFilename(fileName);
|
|
1213
|
1267
|
|
|
1214
|
|
- String arbitratorId = caseApplication.getMediatorId();
|
|
1215
|
|
- if (StringUtils.isNotEmpty(arbitratorId)) {
|
|
1216
|
|
- SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(arbitratorId));
|
|
|
1268
|
+ Long arbitratorId = caseApplication.getMediatorId();
|
|
|
1269
|
+ if (null!=arbitratorId) {
|
|
|
1270
|
+ SysUser sysUser = sysUserMapper.selectUserById(arbitratorId);
|
|
1217
|
1271
|
if (sysUser == null) {
|
|
1218
|
1272
|
return AjaxResult.error();
|
|
1219
|
1273
|
}
|
|
|
@@ -1537,9 +1591,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
1537
|
1591
|
//发起签署
|
|
1538
|
1592
|
sealSignRecord.setFilename(fileName);
|
|
1539
|
1593
|
|
|
1540
|
|
- String arbitratorId = caseApplication.getMediatorId();
|
|
1541
|
|
- if (StringUtils.isNotEmpty(arbitratorId)) {
|
|
1542
|
|
- SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(arbitratorId));
|
|
|
1594
|
+ Long arbitratorId = caseApplication.getMediatorId();
|
|
|
1595
|
+ if (arbitratorId!=null) {
|
|
|
1596
|
+ SysUser sysUser = sysUserMapper.selectUserById(arbitratorId);
|
|
1543
|
1597
|
if (sysUser == null) {
|
|
1544
|
1598
|
return AjaxResult.error();
|
|
1545
|
1599
|
}
|
|
|
@@ -1781,7 +1835,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
1781
|
1835
|
if (nextFlow == null) {
|
|
1782
|
1836
|
throw new ServiceException("未找到下一个流程节点");
|
|
1783
|
1837
|
}
|
|
1784
|
|
- setMediatorAndDate(application,vo);
|
|
|
1838
|
+ // setMediatorAndDate(application,vo);
|
|
|
1839
|
+ application.setMediatorId(vo.getUserList().get(0).getUserId());
|
|
|
1840
|
+ application.setMediatorName(vo.getUserList().get(0).getNickName());
|
|
1785
|
1841
|
application.setCaseFlowId(nextFlow.getNodeId());
|
|
1786
|
1842
|
application.setCaseStatusName(nextFlow.getCaseStatusName());
|
|
1787
|
1843
|
msCaseApplicationMapper.updateByPrimaryKeySelective(application);
|
|
|
@@ -1802,6 +1858,11 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
1802
|
1858
|
*/
|
|
1803
|
1859
|
@Override
|
|
1804
|
1860
|
public MsCaseFlow nextFlow(Long caseId,Integer caseFlowId,Integer lockStatus) {
|
|
|
1861
|
+ // 查询当前流程节点
|
|
|
1862
|
+ MsCaseFlow currentFlow = caseFlowMapper.selectByPrimaryKey(caseFlowId);
|
|
|
1863
|
+ if (currentFlow == null) {
|
|
|
1864
|
+ throw new ServiceException("未找到当前流程节点");
|
|
|
1865
|
+ }
|
|
1805
|
1866
|
MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseFlowId);
|
|
1806
|
1867
|
if (nextFlow == null) {
|
|
1807
|
1868
|
throw new ServiceException("未找到下一个流程节点");
|
|
|
@@ -1815,7 +1876,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
1815
|
1876
|
application.setLockStatus(lockStatus);
|
|
1816
|
1877
|
msCaseApplicationMapper.updateByPrimaryKeySelective(application);
|
|
1817
|
1878
|
// 新增日志
|
|
1818
|
|
- CaseLogUtils.insertCaseLog(application.getId(), nextFlow.getNodeId(), nextFlow.getCaseStatusName(),"");
|
|
|
1879
|
+ CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),"");
|
|
1819
|
1880
|
return nextFlow;
|
|
1820
|
1881
|
}
|
|
1821
|
1882
|
|
|
|
@@ -2126,20 +2187,20 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
2126
|
2187
|
agentUser.setNickName(affiliate.getNameAgent());
|
|
2127
|
2188
|
agentUser.setPhonenumber(affiliate.getContactTelphoneAgent());
|
|
2128
|
2189
|
agentUser.setPassword(SecurityUtils.encryptPassword("abc123456"));
|
|
2129
|
|
- agentUser.setDeptId(Long.valueOf(affiliate.getApplicationOrganId()));
|
|
|
2190
|
+ agentUser.setDeptId(Long.valueOf(affiliate.getApplicationId()));
|
|
2130
|
2191
|
userMapper.insertUser(agentUser);
|
|
2131
|
2192
|
userRoleMapper.insertUserRole(agentUser.getUserId(), roleId);
|
|
2132
|
2193
|
} else if (null == agentUser.getDeptId() ) {
|
|
2133
|
2194
|
// todo 未关联部门,关联部门
|
|
2134
|
|
- agentUser.setDeptId(Long.valueOf(affiliate.getApplicationOrganId()));
|
|
|
2195
|
+ agentUser.setDeptId(Long.valueOf(affiliate.getApplicationId()));
|
|
2135
|
2196
|
userMapper.updateUser(agentUser);
|
|
2136
|
|
- }else if (null != agentUser.getDeptId() && !String.valueOf(agentUser.getDeptId()).equals(affiliate.getApplicationOrganId())) {
|
|
|
2197
|
+ }else if (null != agentUser.getDeptId() && !String.valueOf(agentUser.getDeptId()).equals(affiliate.getApplicationId())) {
|
|
2137
|
2198
|
if (null != agentUser.getDept() && StrUtil.isNotEmpty(agentUser.getDept().getDeptName())) {
|
|
2138
|
2199
|
throw new ServiceException("该申请代理人已在【" + agentUser.getDept().getDeptName() + "】申请机构下存在,请检查填写信息是否正确");
|
|
2139
|
2200
|
} else {
|
|
2140
|
2201
|
throw new ServiceException("该申请代理人已存在,与申请机构不匹配,请检查填写信息是否正确");
|
|
2141
|
2202
|
}
|
|
2142
|
|
- } else if (null != agentUser.getDeptId() && String.valueOf(agentUser.getDeptId()).equals(affiliate.getApplicationOrganId())) {
|
|
|
2203
|
+ } else if (null != agentUser.getDeptId() && String.valueOf(agentUser.getDeptId()).equals(affiliate.getApplicationId())) {
|
|
2143
|
2204
|
// 同步用户表和案件关联人表的手机号和名称
|
|
2144
|
2205
|
affiliate.setContactTelphoneAgent(StrUtil.isNotEmpty(agentUser.getPhonenumber()) ? agentUser.getPhonenumber() : affiliate.getContactTelphoneAgent());
|
|
2145
|
2206
|
affiliate.setNameAgent(agentUser.getNickName());
|
|
|
@@ -2173,13 +2234,13 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
2173
|
2234
|
Map<String, Long> deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptName, SysDept::getDeptId, (oldV, newV) -> newV));
|
|
2174
|
2235
|
|
|
2175
|
2236
|
// 将组织机构id设为申请人名称
|
|
2176
|
|
- if (deptMap.containsKey(affiliate.getApplicationOrganName())) {
|
|
2177
|
|
- affiliate.setApplicationOrganId(String.valueOf(deptMap.get(affiliate.getApplicationOrganName())));
|
|
|
2237
|
+ if (deptMap.containsKey(affiliate.getApplicationName())) {
|
|
|
2238
|
+ affiliate.setApplicationId(String.valueOf(deptMap.get(affiliate.getApplicationName())));
|
|
2178
|
2239
|
} else {
|
|
2179
|
2240
|
// 如果不存在则新增
|
|
2180
|
2241
|
SysDept dept = new SysDept();
|
|
2181
|
2242
|
dept.setParentId(0L);
|
|
2182
|
|
- dept.setDeptName(affiliate.getApplicationOrganName());
|
|
|
2243
|
+ dept.setDeptName(affiliate.getApplicationName());
|
|
2183
|
2244
|
dept.setAncestors("0");
|
|
2184
|
2245
|
dept.setOrderNum(1);
|
|
2185
|
2246
|
dept.setStatus("0");
|
|
|
@@ -2188,7 +2249,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
2188
|
2249
|
dept.setUpdateBy(getUsername());
|
|
2189
|
2250
|
sysDeptMapper.insertDept(dept);
|
|
2190
|
2251
|
deptMap.put(dept.getDeptName(), dept.getDeptId());
|
|
2191
|
|
- affiliate.setApplicationOrganId(String.valueOf(dept.getDeptId()));
|
|
|
2252
|
+ affiliate.setApplicationId(String.valueOf(dept.getDeptId()));
|
|
2192
|
2253
|
}
|
|
2193
|
2254
|
}
|
|
2194
|
2255
|
|