|
|
@@ -83,6 +83,8 @@ import static com.ruoyi.common.utils.SecurityUtils.getUsername;
|
|
83
|
83
|
*/
|
|
84
|
84
|
@Service
|
|
85
|
85
|
public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
|
86
|
+ @Autowired
|
|
|
87
|
+ MsCaseApplicationService caseApplicationService;
|
|
86
|
88
|
@Autowired
|
|
87
|
89
|
MsCaseApplicationMapper msCaseApplicationMapper;
|
|
88
|
90
|
@Autowired
|
|
|
@@ -110,6 +112,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
110
|
112
|
@Autowired
|
|
111
|
113
|
SysUserMapper userMapper;
|
|
112
|
114
|
@Autowired
|
|
|
115
|
+ SysUserDeptMapper userDeptMapper;
|
|
|
116
|
+ @Autowired
|
|
113
|
117
|
SysUserRoleMapper userRoleMapper;
|
|
114
|
118
|
@Autowired
|
|
115
|
119
|
FatchRuleMapper fatchRuleMapper;
|
|
|
@@ -181,9 +185,6 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
181
|
185
|
List<String> caseStatusNames = caseFlows.stream().map(MsCaseFlow::getCaseStatusName).collect(Collectors.toList());
|
|
182
|
186
|
for (SysRole role : roles) {
|
|
183
|
187
|
if(StrUtil.isNotEmpty(role.getRoleName())&&StrUtil.equals(role.getRoleName(),"申请人")){
|
|
184
|
|
- if(sysUser.getDeptId()!=null) {
|
|
185
|
|
- req.setApplicationOrganId(String.valueOf(sysUser.getDeptId()));
|
|
186
|
|
- }
|
|
187
|
188
|
req.setApplicantFlag(1);
|
|
188
|
189
|
break;
|
|
189
|
190
|
|
|
|
@@ -244,6 +245,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
244
|
245
|
if (caseApplication.getId() == null) {
|
|
245
|
246
|
caseApplication.setId(IdWorkerUtil.getId());
|
|
246
|
247
|
}
|
|
|
248
|
+
|
|
247
|
249
|
// 根据角色获取案件流程
|
|
248
|
250
|
List<MsCaseFlow> caseFlows= selectCaseFlows();
|
|
249
|
251
|
if (CollectionUtil.isEmpty(caseFlows)) {
|
|
|
@@ -265,20 +267,25 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
265
|
267
|
caseApplication.setUpdateBy(SecurityUtils.getUsername());
|
|
266
|
268
|
caseApplication.setVersion(1);
|
|
267
|
269
|
MsCaseAffiliate affiliate = caseApplication.getAffiliate();
|
|
|
270
|
+ affiliate.setCaseAppliId(caseApplication.getId());
|
|
268
|
271
|
// 保存案件基本信息
|
|
269
|
272
|
if (msCaseApplicationMapper.insertSelective(caseApplication) > 0) {
|
|
270
|
273
|
List<MsCaseAttach> caseAttachList = caseApplication.getCaseAttachList();
|
|
271
|
274
|
// 保存案件相关人员
|
|
272
|
|
- if (affiliate != null) {
|
|
273
|
275
|
// 设置申请机构
|
|
274
|
276
|
if (StrUtil.isNotEmpty(affiliate.getApplicationName())&&affiliate.getOrganizeFlag()==1) {
|
|
275
|
277
|
// 组装申请机构
|
|
276
|
|
- insertDept(affiliate);
|
|
277
|
|
- // 新增申请机构代理人
|
|
278
|
|
- insertAgentUser(affiliate);
|
|
|
278
|
+ // insertDept(affiliate);
|
|
|
279
|
+ // 新增申请机构和代理人
|
|
|
280
|
+ caseApplicationService.insertAgentUser(affiliate);
|
|
279
|
281
|
}else if(StrUtil.isNotEmpty(affiliate.getApplicationName())&&affiliate.getOrganizeFlag()==0){
|
|
280
|
|
- // 申请人为自然人
|
|
281
|
|
- //
|
|
|
282
|
+ // todo 申请人为自然人,如果系统不存在申请人和代理人用户,分别新增用户,新增完用户需要发送短信
|
|
|
283
|
+ // 查询申请人角色id
|
|
|
284
|
+ Long roleId = roleMapper.selectRoleIdByName("申请人");
|
|
|
285
|
+ caseApplicationService.insertApplicantUser(affiliate,false,roleId);
|
|
|
286
|
+ caseApplicationService.insertApplicantUser(affiliate,true,roleId);
|
|
|
287
|
+
|
|
|
288
|
+
|
|
282
|
289
|
}
|
|
283
|
290
|
// 压缩包导入,则根据身份证号获取性别和出生日期
|
|
284
|
291
|
String identityNum = affiliate.getRespondentIdentityNum();
|
|
|
@@ -286,18 +293,20 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
286
|
293
|
|
|
287
|
294
|
identityNum = identityNum.replace("\n", "");
|
|
288
|
295
|
Map<String, String> identityNumMap = IdCardUtils.getBirAgeSex(identityNum);
|
|
289
|
|
- String birthday = identityNumMap.get("birthday");
|
|
290
|
|
- if (StrUtil.isNotEmpty(birthday)) {
|
|
291
|
|
- Date birthdayDate = null;
|
|
292
|
|
- try {
|
|
293
|
|
- birthdayDate = yyyymmddFormat.parse(birthday);
|
|
294
|
|
- } catch (Exception e) {
|
|
295
|
|
- e.printStackTrace();
|
|
|
296
|
+ if (identityNumMap != null) {
|
|
|
297
|
+ String birthday = identityNumMap.get("birthday");
|
|
|
298
|
+ if (StrUtil.isNotEmpty(birthday)) {
|
|
|
299
|
+ Date birthdayDate = null;
|
|
|
300
|
+ try {
|
|
|
301
|
+ birthdayDate = yyyymmddFormat.parse(birthday);
|
|
|
302
|
+ } catch (Exception e) {
|
|
|
303
|
+ e.printStackTrace();
|
|
|
304
|
+ }
|
|
|
305
|
+ affiliate.setRespondentBirth(birthdayDate);
|
|
296
|
306
|
}
|
|
297
|
|
- affiliate.setRespondentBirth(birthdayDate);
|
|
|
307
|
+ //从身份证抓取性别
|
|
|
308
|
+ affiliate.setRespondentSex(identityNumMap.get("sexCode"));
|
|
298
|
309
|
}
|
|
299
|
|
- //从身份证抓取性别
|
|
300
|
|
- affiliate.setRespondentSex(identityNumMap.get("sexCode"));
|
|
301
|
310
|
}
|
|
302
|
311
|
if (StrUtil.isNotEmpty(affiliate.getAgentEmail())) {
|
|
303
|
312
|
affiliate.setAgentEmail(affiliate.getAgentEmail().replace("\n", "").replaceAll("\\s", ""));
|
|
|
@@ -305,7 +314,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
305
|
314
|
if (StrUtil.isNotEmpty(affiliate.getRespondentEmail())) {
|
|
306
|
315
|
affiliate.setRespondentEmail(affiliate.getRespondentEmail().replace("\n", "").replaceAll("\\s", ""));
|
|
307
|
316
|
}
|
|
308
|
|
- affiliate.setCaseAppliId(caseApplication.getId());
|
|
|
317
|
+
|
|
309
|
318
|
msCaseAffiliateMapper.insert(affiliate);
|
|
310
|
319
|
// 查询调解申请书模板id
|
|
311
|
320
|
TemplateManage templateManage=templateManageMapper.selectByType(2);
|
|
|
@@ -321,10 +330,11 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
321
|
330
|
}
|
|
322
|
331
|
// 生成调解申请书
|
|
323
|
332
|
req.setTemplateId(String.valueOf(templateManage.getId()));
|
|
324
|
|
- generateApplication(req);
|
|
|
333
|
+ // todo 部署放开
|
|
|
334
|
+ // caseApplicationService.generateApplication(req);
|
|
325
|
335
|
|
|
326
|
336
|
}
|
|
327
|
|
- }
|
|
|
337
|
+
|
|
328
|
338
|
// 保存案件附件
|
|
329
|
339
|
|
|
330
|
340
|
if (CollectionUtil.isNotEmpty(caseAttachList)) {
|
|
|
@@ -354,6 +364,65 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
354
|
364
|
return 0;
|
|
355
|
365
|
}
|
|
356
|
366
|
|
|
|
367
|
+ /**
|
|
|
368
|
+ * 新增用户
|
|
|
369
|
+ * @param affiliate
|
|
|
370
|
+ * @param agentFlag 是否代理人,0-否,1-是
|
|
|
371
|
+ * @param roleId
|
|
|
372
|
+ */
|
|
|
373
|
+ @Transactional
|
|
|
374
|
+ public void insertApplicantUser( MsCaseAffiliate affiliate,boolean agentFlag, Long roleId) {
|
|
|
375
|
+ String phone="";
|
|
|
376
|
+ String name="";
|
|
|
377
|
+ if(agentFlag){
|
|
|
378
|
+ // 代理人
|
|
|
379
|
+ phone=affiliate.getContactTelphoneAgent();
|
|
|
380
|
+ name=affiliate.getNameAgent();
|
|
|
381
|
+
|
|
|
382
|
+ }else {
|
|
|
383
|
+ // 申请人
|
|
|
384
|
+ phone=affiliate.getApplicationPhone();
|
|
|
385
|
+ name=affiliate.getApplicationName();
|
|
|
386
|
+ }
|
|
|
387
|
+ if(StrUtil.isNotEmpty(phone) && StrUtil.isNotEmpty(name)){
|
|
|
388
|
+ // 查询用户是否存在
|
|
|
389
|
+ SysUser sysUser = sysUserMapper.selectUserByUserName(name);
|
|
|
390
|
+ if(sysUser==null){
|
|
|
391
|
+ // 新增用户
|
|
|
392
|
+ sysUser = new SysUser();
|
|
|
393
|
+ sysUser.setUserName(phone);
|
|
|
394
|
+ sysUser.setNickName(name);
|
|
|
395
|
+ sysUser.setPhonenumber(phone);
|
|
|
396
|
+ sysUser.setPassword(SecurityUtils.encryptPassword("abc123456"));
|
|
|
397
|
+ sysUser.setCreateBy(SecurityUtils.getUsername());
|
|
|
398
|
+ userMapper.insertUser(sysUser);
|
|
|
399
|
+ userRoleMapper.insertUserRole(sysUser.getUserId(), roleId);
|
|
|
400
|
+ // 发送短信 2064355 调解系统自动创建用户短信通知 尊敬的用户,您的案件已经创建,请使用账号为{1},密码为{2}登录调解系统,请知晓,如非本人操作,请忽略本短信。
|
|
|
401
|
+ Boolean smsFlag = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2064355", phone, new String[]{phone, "abc123456"});
|
|
|
402
|
+
|
|
|
403
|
+ }else {
|
|
|
404
|
+ // 用户不为空,查询角色是否为申请人
|
|
|
405
|
+ if (CollectionUtil.isNotEmpty(sysUser.getRoles())) {
|
|
|
406
|
+ List<Long> longList = sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList());
|
|
|
407
|
+ if (!longList.contains(roleId)) {
|
|
|
408
|
+ userRoleMapper.insertUserRole(sysUser.getUserId(), roleId);
|
|
|
409
|
+ }
|
|
|
410
|
+ } else {
|
|
|
411
|
+ userRoleMapper.insertUserRole(sysUser.getUserId(), roleId);
|
|
|
412
|
+ }
|
|
|
413
|
+
|
|
|
414
|
+ }
|
|
|
415
|
+ if(!agentFlag){
|
|
|
416
|
+ // 自然人,将用户id设为申请人id
|
|
|
417
|
+ affiliate.setApplicationId(String.valueOf(sysUser.getUserId()));
|
|
|
418
|
+ affiliate.setApplicationName(sysUser.getNickName());
|
|
|
419
|
+
|
|
|
420
|
+ }
|
|
|
421
|
+
|
|
|
422
|
+
|
|
|
423
|
+ }
|
|
|
424
|
+ }
|
|
|
425
|
+
|
|
357
|
426
|
/**
|
|
358
|
427
|
* 查询案件流程
|
|
359
|
428
|
* @return
|
|
|
@@ -415,9 +484,19 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
415
|
484
|
// 设置申请人
|
|
416
|
485
|
if (StrUtil.isNotEmpty(affiliate.getApplicationName())&&affiliate.getOrganizeFlag()==1) {
|
|
417
|
486
|
// 组装申请机构
|
|
418
|
|
- insertDept(affiliate);
|
|
|
487
|
+ // insertDept(affiliate);
|
|
419
|
488
|
// 新增申请机构代理人
|
|
420
|
|
- insertAgentUser(affiliate);
|
|
|
489
|
+ caseApplicationService.insertAgentUser(affiliate);
|
|
|
490
|
+ }else if(StrUtil.isNotEmpty(affiliate.getApplicationName())&&affiliate.getOrganizeFlag()==0){
|
|
|
491
|
+ // todo 申请人为自然人,如果系统不存在申请人和代理人用户,分别新增用户,新增完用户需要发送短信
|
|
|
492
|
+ // 查询申请人角色id
|
|
|
493
|
+ Long roleId = roleMapper.selectRoleIdByName("申请人");
|
|
|
494
|
+ caseApplicationService.insertApplicantUser(affiliate,false,roleId);
|
|
|
495
|
+ caseApplicationService.insertApplicantUser(affiliate,true,roleId);
|
|
|
496
|
+
|
|
|
497
|
+ }
|
|
|
498
|
+ if (StrUtil.isNotEmpty(affiliate.getRespondentEmail())) {
|
|
|
499
|
+ affiliate.setRespondentEmail(affiliate.getRespondentEmail().replace("\n", "").replaceAll("\\s", ""));
|
|
421
|
500
|
}
|
|
422
|
501
|
msCaseAffiliateMapper.updateByPrimaryKeySelective(affiliate);
|
|
423
|
502
|
}
|
|
|
@@ -558,7 +637,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
558
|
637
|
caseApplicationVO.setCaseAttachList(attachList);
|
|
559
|
638
|
caseApplicationVO.setColumnValueList(columnValueList);
|
|
560
|
639
|
caseApplicationVO.setImportFlag(true);
|
|
561
|
|
- insert(caseApplicationVO);
|
|
|
640
|
+ caseApplicationService.insert(caseApplicationVO);
|
|
562
|
641
|
caseCount++;
|
|
563
|
642
|
|
|
564
|
643
|
}
|
|
|
@@ -567,21 +646,6 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
567
|
646
|
|
|
568
|
647
|
}
|
|
569
|
648
|
if(caseCount>0) {
|
|
570
|
|
-
|
|
571
|
|
-// // 查询调解申请书模板id
|
|
572
|
|
-// TemplateManage templateManage=templateManageMapper.selectByType(2);
|
|
573
|
|
-// if(templateManage!=null) {
|
|
574
|
|
-// List<MsCaseFlow> caseFlows = selectCaseFlows();
|
|
575
|
|
-// // 批量生成调解申请书
|
|
576
|
|
-// MsCaseApplicationReq req = new MsCaseApplicationReq();
|
|
577
|
|
-// if (CollectionUtil.isNotEmpty(caseFlows)) {
|
|
578
|
|
-// MsCaseFlow caseFlow = caseFlows.get(0);
|
|
579
|
|
-// req.setCaseFlowId(caseFlow.getId());
|
|
580
|
|
-// req.setBatchNumber(batchNumber);
|
|
581
|
|
-// req.setTemplateId(String.valueOf(templateManage.getId()));
|
|
582
|
|
-// generateApplication(req);
|
|
583
|
|
-// }
|
|
584
|
|
-// }
|
|
585
|
649
|
return AjaxResult.success();
|
|
586
|
650
|
}else {
|
|
587
|
651
|
return AjaxResult.error("请检查压缩包!");
|
|
|
@@ -647,7 +711,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
647
|
711
|
if(affiliate==null){
|
|
648
|
712
|
continue;
|
|
649
|
713
|
}
|
|
650
|
|
- createMediateApplication(application, affiliate, templatePath, bookmarkList,dictDataList,req.getTemplateType());
|
|
|
714
|
+ caseApplicationService.createMediateApplication(application, affiliate, templatePath, bookmarkList,dictDataList,req.getTemplateType());
|
|
651
|
715
|
|
|
652
|
716
|
}
|
|
653
|
717
|
}else {
|
|
|
@@ -660,7 +724,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
660
|
724
|
throw new ServiceException("该案件不存在");
|
|
661
|
725
|
}
|
|
662
|
726
|
|
|
663
|
|
- createMediateApplication(application, caseAffiliate, templatePath, bookmarkList,dictDataList,req.getTemplateType());
|
|
|
727
|
+ caseApplicationService.createMediateApplication(application, caseAffiliate, templatePath, bookmarkList,dictDataList,req.getTemplateType());
|
|
664
|
728
|
}
|
|
665
|
729
|
|
|
666
|
730
|
|
|
|
@@ -690,6 +754,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
690
|
754
|
* @param req
|
|
691
|
755
|
* @return
|
|
692
|
756
|
*/
|
|
|
757
|
+ @Transactional
|
|
693
|
758
|
@Override
|
|
694
|
759
|
public AjaxResult batchUpdateAttach(MsCaseApplicationVO req) {
|
|
695
|
760
|
for (MsCaseAttach attach : req.getCaseAttachList()) {
|
|
|
@@ -706,6 +771,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
706
|
771
|
* @param id
|
|
707
|
772
|
* @return
|
|
708
|
773
|
*/
|
|
|
774
|
+ @Transactional
|
|
709
|
775
|
@Override
|
|
710
|
776
|
public AjaxResult batchUpload(MultipartFile[] files, Integer annexType, Long id) {
|
|
711
|
777
|
List<MsCaseAttach> successList = new ArrayList<>();
|
|
|
@@ -745,6 +811,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
745
|
811
|
* @param req
|
|
746
|
812
|
* @return
|
|
747
|
813
|
*/
|
|
|
814
|
+ @Transactional
|
|
748
|
815
|
@Override
|
|
749
|
816
|
public AjaxResult accept(MsCaseApplication req) {
|
|
750
|
817
|
if (StrUtil.isNotEmpty(req.getBatchNumber())) {
|
|
|
@@ -762,7 +829,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
762
|
829
|
}
|
|
763
|
830
|
Map<Long, MsCaseAffiliate> affiliateMap = affiliateList.stream().collect(Collectors.toMap(MsCaseAffiliate::getCaseAppliId, Function.identity()));
|
|
764
|
831
|
for (MsCaseApplication application : applicationList) {
|
|
765
|
|
- accept(application,req,affiliateMap);
|
|
|
832
|
+ caseApplicationService.accept(application,req,affiliateMap);
|
|
766
|
833
|
}
|
|
767
|
834
|
|
|
768
|
835
|
} else {
|
|
|
@@ -777,7 +844,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
777
|
844
|
application.setLockStatus(YesOrNoEnum.YES.getCode());
|
|
778
|
845
|
Map<Long, MsCaseAffiliate> affiliateMap=new HashMap<>();
|
|
779
|
846
|
affiliateMap.put(req.getId(),caseAffiliate);
|
|
780
|
|
- accept(application,req,affiliateMap);
|
|
|
847
|
+ caseApplicationService.accept(application,req,affiliateMap);
|
|
781
|
848
|
}
|
|
782
|
849
|
|
|
783
|
850
|
return AjaxResult.success("受理成功");
|
|
|
@@ -788,7 +855,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
788
|
855
|
* @param req
|
|
789
|
856
|
* @param affiliateMap
|
|
790
|
857
|
*/
|
|
791
|
|
- private void accept(MsCaseApplication application, MsCaseApplication req, Map<Long, MsCaseAffiliate> affiliateMap) {
|
|
|
858
|
+ @Transactional
|
|
|
859
|
+ public void accept(MsCaseApplication application, MsCaseApplication req, Map<Long, MsCaseAffiliate> affiliateMap) {
|
|
792
|
860
|
application.setPaperFlag(req.getPaperFlag());
|
|
793
|
861
|
application.setArbitrateConfirm(req.getArbitrateConfirm());
|
|
794
|
862
|
application.setMediationMethod(req.getMediationMethod());
|
|
|
@@ -796,7 +864,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
796
|
864
|
application.setUpdateTime(new Date());
|
|
797
|
865
|
application.setBatchNumber(null);
|
|
798
|
866
|
msCaseApplicationMapper.updateByPrimaryKeySelective(application);
|
|
799
|
|
- MsCaseFlow caseFlow = nextFlow(application.getId(), req.getCaseFlowId(),req.getLockStatus());
|
|
|
867
|
+ MsCaseFlow caseFlow = caseApplicationService.nextFlow(application.getId(), req.getCaseFlowId(),req.getLockStatus());
|
|
800
|
868
|
// 给申请人被申请人发送短信
|
|
801
|
869
|
if (affiliateMap.containsKey(application.getId())) {
|
|
802
|
870
|
MsCaseAffiliate affiliate = affiliateMap.get(application.getId());
|
|
|
@@ -846,12 +914,12 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
846
|
914
|
return AjaxResult.error("该批次号下未找到案件");
|
|
847
|
915
|
}
|
|
848
|
916
|
for (MsCaseApplication application : list) {
|
|
849
|
|
- MsCaseFlow caseFlow = nextFlow(application.getId(), req.getCaseFlowId(), YesOrNoEnum.NO.getCode());
|
|
|
917
|
+ MsCaseFlow caseFlow = caseApplicationService.nextFlow(application.getId(), req.getCaseFlowId(), YesOrNoEnum.NO.getCode());
|
|
850
|
918
|
// todo 发送短信
|
|
851
|
919
|
// CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), "提交成功");
|
|
852
|
920
|
}
|
|
853
|
921
|
}else {
|
|
854
|
|
- MsCaseFlow caseFlow = nextFlow(req.getId(), req.getCaseFlowId(), YesOrNoEnum.NO.getCode());
|
|
|
922
|
+ MsCaseFlow caseFlow = caseApplicationService.nextFlow(req.getId(), req.getCaseFlowId(), YesOrNoEnum.NO.getCode());
|
|
855
|
923
|
// todo 发送短信
|
|
856
|
924
|
// CaseLogUtils.insertCaseLog(req.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), "提交成功");
|
|
857
|
925
|
|
|
|
@@ -927,13 +995,13 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
927
|
995
|
msCaseMediatorMapper.deleteByExample(mediatorExample);
|
|
928
|
996
|
|
|
929
|
997
|
// 获取选择的调解员id
|
|
930
|
|
- List<Long> userIds = vo.getUserList().stream().map(SysUser::getUserId).collect(Collectors.toList());
|
|
|
998
|
+ List<Long> userIds = vo.getMediatorList().stream().map(MsCaseMediator::getMediatorId).collect(Collectors.toList());
|
|
931
|
999
|
// 新增案件预约表
|
|
932
|
|
- for (SysUser sysUser : vo.getUserList()) {
|
|
|
1000
|
+ for (MsCaseMediator sysUser : vo.getMediatorList()) {
|
|
933
|
1001
|
MsCaseMediator mediator = new MsCaseMediator();
|
|
934
|
1002
|
mediator.setCaseAppliId(vo.getId());
|
|
935
|
|
- mediator.setMediatorId(sysUser.getUserId());
|
|
936
|
|
- mediator.setMediatorName(sysUser.getNickName());
|
|
|
1003
|
+ mediator.setMediatorId(sysUser.getMediatorId());
|
|
|
1004
|
+ mediator.setMediatorName(sysUser.getMediatorName());
|
|
937
|
1005
|
mediator.setType(miniProgressFlag);
|
|
938
|
1006
|
msCaseMediatorMapper.insert(mediator);
|
|
939
|
1007
|
}
|
|
|
@@ -946,13 +1014,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
946
|
1014
|
if (StrUtil.isEmpty(msCaseAffiliate.getRespondentIdentityNum())) {
|
|
947
|
1015
|
return AjaxResult.error("被申请人身份证为空");
|
|
948
|
1016
|
}
|
|
949
|
|
-
|
|
950
|
|
- // SysUser user = userMapper.selectUserByIdCard(msCaseAffiliate.getRespondentIdentityNum());
|
|
951
|
|
- // 被申请人存在
|
|
952
|
|
- // if (user != null) {
|
|
953
|
1017
|
// 判断被申请人信息查询案件预约表
|
|
954
|
1018
|
isReservation( vo,userIds);
|
|
955
|
|
- // }
|
|
956
|
1019
|
|
|
957
|
1020
|
} else {
|
|
958
|
1021
|
// 被申请人预约
|
|
|
@@ -961,12 +1024,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
961
|
1024
|
if (StrUtil.isEmpty(msCaseAffiliate.getContactTelphoneAgent())) {
|
|
962
|
1025
|
return AjaxResult.error("申请代理人手机号为空");
|
|
963
|
1026
|
}
|
|
964
|
|
-
|
|
965
|
|
- // SysUser user = userMapper.selectUserByPhone(msCaseAffiliate.getContactTelphoneAgent());
|
|
966
|
|
- // if(user!=null){
|
|
967
|
|
- // 判断申请人是否预约
|
|
968
|
|
- isReservation( vo,userIds);
|
|
969
|
|
- // }
|
|
|
1027
|
+ // 判断申请人是否预约
|
|
|
1028
|
+ caseApplicationService. isReservation( vo,userIds);
|
|
970
|
1029
|
|
|
971
|
1030
|
}
|
|
972
|
1031
|
return AjaxResult.success();
|
|
|
@@ -977,7 +1036,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
977
|
1036
|
* @param vo
|
|
978
|
1037
|
* @param userIds 选择的调解员ids
|
|
979
|
1038
|
*/
|
|
980
|
|
- private void isReservation( BookingVO vo, List<Long> userIds ) {
|
|
|
1039
|
+ @Transactional
|
|
|
1040
|
+ public void isReservation( BookingVO vo, List<Long> userIds ) {
|
|
981
|
1041
|
// 查询所有调解员
|
|
982
|
1042
|
List<SysUser> mediatorUsers = sysUserMapper.selectUserByRole("调解员");
|
|
983
|
1043
|
if (CollectionUtil.isEmpty(mediatorUsers)) {
|
|
|
@@ -1055,32 +1115,13 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
1055
|
1115
|
}
|
|
1056
|
1116
|
}
|
|
1057
|
1117
|
|
|
1058
|
|
- /**
|
|
1059
|
|
- * 设置调解员调解时间
|
|
1060
|
|
- * @param application
|
|
1061
|
|
- * @param vo
|
|
1062
|
|
- */
|
|
1063
|
|
-// private void setMediatorAndDate(MsCaseApplication application, BookingVO vo) {
|
|
1064
|
|
-// if(CollectionUtil.isNotEmpty(vo.getUserList())) {
|
|
1065
|
|
-// List<SysUser> userList = vo.getUserList();
|
|
1066
|
|
-// List<Long> userIds = userList.stream().map(SysUser::getUserId).collect(Collectors.toList());
|
|
1067
|
|
-// List<String> userNames = userList.stream().map(SysUser::getUserName).collect(Collectors.toList());
|
|
1068
|
|
-// String mediatorIds = StrUtil.join(",", userIds);
|
|
1069
|
|
-// String mediatorNames = StrUtil.join(",", userNames);
|
|
1070
|
|
-// application.setMediatorId(mediatorIds);
|
|
1071
|
|
-// application.setMediatorName(mediatorNames);
|
|
1072
|
|
-// }
|
|
1073
|
|
-// if(CollectionUtil.isNotEmpty( vo.getHerDates())) {
|
|
1074
|
|
-// String herDates = StrUtil.join(",", vo.getHerDates());
|
|
1075
|
|
-// application.setHearDate(herDates);
|
|
1076
|
|
-// }
|
|
1077
|
|
-// }
|
|
1078
|
1118
|
|
|
1079
|
1119
|
/**
|
|
1080
|
1120
|
* 核实调解员
|
|
1081
|
1121
|
* @param vo
|
|
1082
|
1122
|
* @return
|
|
1083
|
1123
|
*/
|
|
|
1124
|
+ @Transactional
|
|
1084
|
1125
|
@Override
|
|
1085
|
1126
|
public AjaxResult verifyMediator(BookingVO vo) {
|
|
1086
|
1127
|
if(StrUtil.isNotEmpty(vo.getBatchNumber())){
|
|
|
@@ -1099,12 +1140,39 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
1099
|
1140
|
}
|
|
1100
|
1141
|
return AjaxResult.success();
|
|
1101
|
1142
|
}
|
|
|
1143
|
+ /**
|
|
|
1144
|
+ * 核实调解员
|
|
|
1145
|
+ * @param
|
|
|
1146
|
+ * @return
|
|
|
1147
|
+ */
|
|
|
1148
|
+ @Transactional
|
|
|
1149
|
+ public void verifyMediator(MsCaseApplication application,BookingVO vo) {
|
|
|
1150
|
+ MsCaseFlow nextFlow = caseFlowMapper.nextFlow(vo.getCaseFlowId());
|
|
|
1151
|
+ if (nextFlow == null) {
|
|
|
1152
|
+ throw new ServiceException("未找到下一个流程节点");
|
|
|
1153
|
+ }
|
|
|
1154
|
+ if(vo.getMediatorId()!=null) {
|
|
|
1155
|
+ // setMediatorAndDate(application,vo);
|
|
|
1156
|
+ application.setMediatorId(vo.getMediatorId());
|
|
|
1157
|
+ application.setMediatorName(vo.getMediatorName());
|
|
|
1158
|
+ }
|
|
|
1159
|
+ if(CollectionUtil.isNotEmpty(vo.getHerDates())){
|
|
|
1160
|
+ application.setHearDate(vo.getHerDates().get(0));
|
|
|
1161
|
+ }
|
|
|
1162
|
+ application.setCaseFlowId(nextFlow.getNodeId());
|
|
|
1163
|
+ application.setCaseStatusName(nextFlow.getCaseStatusName());
|
|
|
1164
|
+ msCaseApplicationMapper.updateByPrimaryKeySelective(application);
|
|
|
1165
|
+ // todo 发送短信
|
|
|
1166
|
+ // 新增日志
|
|
|
1167
|
+ CaseLogUtils.insertCaseLog(application.getId(), nextFlow.getNodeId(), nextFlow.getCaseStatusName(), "");
|
|
1102
|
1168
|
|
|
|
1169
|
+ }
|
|
1103
|
1170
|
/**
|
|
1104
|
1171
|
* 查询预约信息
|
|
1105
|
1172
|
* @param id
|
|
1106
|
1173
|
* @return
|
|
1107
|
1174
|
*/
|
|
|
1175
|
+ @Transactional
|
|
1108
|
1176
|
@Override
|
|
1109
|
1177
|
public AjaxResult selectReservation(Long id) {
|
|
1110
|
1178
|
// 查询案件主表
|
|
|
@@ -1122,43 +1190,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
1122
|
1190
|
return AjaxResult.success(result);
|
|
1123
|
1191
|
}
|
|
1124
|
1192
|
Map<Integer, List<MsCaseMediator>> mediatorMap = msCaseMediators.stream().collect(Collectors.groupingBy(MsCaseMediator::getType));
|
|
1125
|
|
- // 申请人
|
|
|
1193
|
+ // todo 申请人
|
|
1126
|
1194
|
result.setMediatorList(mediatorMap.get(MediatorTypeEnum.PC.getCode()));
|
|
1127
|
1195
|
result.setResMediatorList(mediatorMap.get(MediatorTypeEnum.MI_NI_PROGRESS.getCode()));
|
|
1128
|
|
-
|
|
1129
|
|
- // 查询用户
|
|
1130
|
|
-// SysUser user = userMapper.selectUserById(Long.valueOf(msCaseMediator.getMediatorId()));
|
|
1131
|
|
-// if(user==null){
|
|
1132
|
|
-// return AjaxResult.error("调解员已被删除");
|
|
1133
|
|
-// }
|
|
1134
|
|
-// // 查询待办数量
|
|
1135
|
|
-// List<Long> mediatorIds = new ArrayList<>();
|
|
1136
|
|
-// mediatorIds.add(user.getUserId());
|
|
1137
|
|
-// Map<Long, List<MsCaseApplication>> caseMap=null;
|
|
1138
|
|
-// List<MsCaseApplication> caseApplicationList = msCaseApplicationMapper.listMediator(mediatorIds);
|
|
1139
|
|
-// if (CollectionUtil.isNotEmpty(caseApplicationList)) {
|
|
1140
|
|
-// caseMap = caseApplicationList.stream().collect(Collectors.groupingBy(MsCaseApplication::getMediatorId, Collectors.toList()));
|
|
1141
|
|
-//
|
|
1142
|
|
-// }
|
|
1143
|
|
-// MediatorVO mediatorVO = new MediatorVO();
|
|
1144
|
|
-// mediatorVO.setMediatorId(user.getUserId());
|
|
1145
|
|
-// mediatorVO.setMediatorName(user.getNickName());
|
|
1146
|
|
-// mediatorVO.setSpecialty(user.getSpecialty());
|
|
1147
|
|
-// if(caseMap==null){
|
|
1148
|
|
-// mediatorVO.setTodoAmount(0L);
|
|
1149
|
|
-// mediatorVO.setCompleteAmount(0L);
|
|
1150
|
|
-// }
|
|
1151
|
|
-//
|
|
1152
|
|
-// else if(caseMap.containsKey(String.valueOf(user.getUserId()))) {
|
|
1153
|
|
-// List<MsCaseApplication> applications = caseMap.get(String.valueOf(user.getUserId()));
|
|
1154
|
|
-// // 已办案件
|
|
1155
|
|
-// long count = applications.stream().filter(caseApplication -> !caseApplication.getCaseStatusName().equals("结束")).count();
|
|
1156
|
|
-// mediatorVO.setTodoAmount(applications.size()-count);
|
|
1157
|
|
-// mediatorVO.setCompleteAmount(count);
|
|
1158
|
|
-// }
|
|
1159
|
|
-
|
|
1160
|
|
-
|
|
1161
|
|
-
|
|
1162
|
1196
|
return AjaxResult.success(result);
|
|
1163
|
1197
|
}
|
|
1164
|
1198
|
|
|
|
@@ -1170,36 +1204,50 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
1170
|
1204
|
@Transactional
|
|
1171
|
1205
|
@Override
|
|
1172
|
1206
|
public AjaxResult mediation(MsCaseApplicationReq req) {
|
|
1173
|
|
- String templateId=null;
|
|
1174
|
|
- // 批量
|
|
1175
|
|
- if(StrUtil.isNotEmpty(req.getBatchNumber())){
|
|
1176
|
|
- // 查询调解书模板是否存在
|
|
1177
|
|
- Example example = new Example(MsCaseApplication.class);
|
|
1178
|
|
- Example.Criteria criteria = example.createCriteria();
|
|
1179
|
|
- criteria.andEqualTo("batchNumber", req.getBatchNumber());
|
|
1180
|
|
- criteria.andIsNotNull("templateId");
|
|
1181
|
|
- MsCaseApplication caseApplication = msCaseApplicationMapper.selectOneByExample(example);
|
|
1182
|
|
- if(caseApplication==null||caseApplication.getTemplateId()==null){
|
|
|
1207
|
+ // 查询案件是否存在
|
|
|
1208
|
+ MsCaseApplication application = msCaseApplicationMapper.selectByPrimaryKey(req.getId());
|
|
|
1209
|
+ if (application == null) {
|
|
|
1210
|
+ return AjaxResult.error("未找到案件");
|
|
|
1211
|
+ }
|
|
|
1212
|
+ if (StrUtil.isEmpty(application.getMediationMethod())) {
|
|
|
1213
|
+ return AjaxResult.error("未选择调解方式");
|
|
|
1214
|
+ }
|
|
|
1215
|
+ if (application.getMediationMethod().equals("1")) {
|
|
|
1216
|
+ // 线上调解
|
|
|
1217
|
+ if (application.getTemplateId() == null) {
|
|
1183
|
1218
|
return AjaxResult.error("未找到模板");
|
|
1184
|
1219
|
}
|
|
1185
|
|
- templateId= String.valueOf(caseApplication.getTemplateId());
|
|
1186
|
|
-
|
|
1187
|
|
- }else {
|
|
1188
|
|
- // 单独生成
|
|
1189
|
|
- // 查询调解书模板是否存在
|
|
1190
|
|
- MsCaseApplication application = msCaseApplicationMapper.selectByPrimaryKey(req.getId());
|
|
1191
|
|
- if(application==null||application.getTemplateId()==null){
|
|
1192
|
|
- return AjaxResult.error("未找到模板");
|
|
|
1220
|
+ String templateId = String.valueOf(application.getTemplateId());
|
|
|
1221
|
+ req.setTemplateId(templateId);
|
|
|
1222
|
+ req.setTemplateType(1);
|
|
|
1223
|
+ AjaxResult result = generateApplication(req);
|
|
|
1224
|
+ if (result != null && result.isSuccess()) {
|
|
|
1225
|
+ return result;
|
|
1193
|
1226
|
}
|
|
1194
|
|
- templateId= String.valueOf(application.getTemplateId());
|
|
1195
|
|
- }
|
|
1196
|
|
- req.setTemplateId(templateId);
|
|
1197
|
|
- req.setTemplateType(1);
|
|
1198
|
|
- AjaxResult result = generateApplication(req);
|
|
1199
|
|
- if(result!=null && result.isSuccess()){
|
|
1200
|
|
- return result;
|
|
|
1227
|
+ } else {
|
|
|
1228
|
+ // 线下调解
|
|
|
1229
|
+ List<MsCaseAttach> attachList = req.getAttachList();
|
|
|
1230
|
+ if(CollectionUtil.isEmpty(attachList)){
|
|
|
1231
|
+ return AjaxResult.error("请上传调解资料");
|
|
|
1232
|
+ }
|
|
|
1233
|
+ for (MsCaseAttach attach : attachList) {
|
|
|
1234
|
+ attach.setCaseAppliId(req.getId());
|
|
|
1235
|
+ }
|
|
|
1236
|
+ msCaseAttachMapper.batchSave(attachList);
|
|
|
1237
|
+ // 修改案件状态为待送达
|
|
|
1238
|
+ Example flowExample = new Example(MsCaseFlow.class);
|
|
|
1239
|
+ flowExample.createCriteria().andEqualTo("caseStatusName", "待送达");
|
|
|
1240
|
+ MsCaseFlow caseFlow = caseFlowMapper.selectOneByExample(flowExample);
|
|
|
1241
|
+ if(caseFlow != null){
|
|
|
1242
|
+ application.setCaseFlowId(caseFlow.getId());
|
|
|
1243
|
+ application.setCaseStatusName(caseFlow.getCaseStatusName());
|
|
|
1244
|
+ msCaseApplicationMapper.updateByPrimaryKey(application);
|
|
|
1245
|
+ }
|
|
|
1246
|
+ return AjaxResult.success();
|
|
1201
|
1247
|
}
|
|
1202
|
|
- return AjaxResult.error("生成失败");
|
|
|
1248
|
+
|
|
|
1249
|
+
|
|
|
1250
|
+ return AjaxResult.error();
|
|
1203
|
1251
|
}
|
|
1204
|
1252
|
|
|
1205
|
1253
|
/**
|
|
|
@@ -1232,7 +1280,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
1232
|
1280
|
}
|
|
1233
|
1281
|
// todo 发送短信
|
|
1234
|
1282
|
// 更新流程节点
|
|
1235
|
|
- nextFlow(attach.getCaseAppliId(),attach.getCaseFlowId(),YesOrNoEnum.YES.getCode());
|
|
|
1283
|
+ caseApplicationService.nextFlow(attach.getCaseAppliId(),attach.getCaseFlowId(),YesOrNoEnum.YES.getCode());
|
|
1236
|
1284
|
|
|
1237
|
1285
|
Long id = attach.getCaseAppliId();
|
|
1238
|
1286
|
MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(id);
|
|
|
@@ -1901,29 +1949,6 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
1901
|
1949
|
}
|
|
1902
|
1950
|
|
|
1903
|
1951
|
|
|
1904
|
|
- /**
|
|
1905
|
|
- * 核实调解员
|
|
1906
|
|
- * @param
|
|
1907
|
|
- * @return
|
|
1908
|
|
- */
|
|
1909
|
|
- private void verifyMediator(MsCaseApplication application,BookingVO vo) {
|
|
1910
|
|
- MsCaseFlow nextFlow = caseFlowMapper.nextFlow(vo.getCaseFlowId());
|
|
1911
|
|
- if (nextFlow == null) {
|
|
1912
|
|
- throw new ServiceException("未找到下一个流程节点");
|
|
1913
|
|
- }
|
|
1914
|
|
- // setMediatorAndDate(application,vo);
|
|
1915
|
|
- application.setMediatorId(vo.getMediatorId());
|
|
1916
|
|
- application.setMediatorName(vo.getMediatorName());
|
|
1917
|
|
- application.setCaseFlowId(nextFlow.getNodeId());
|
|
1918
|
|
- application.setCaseStatusName(nextFlow.getCaseStatusName());
|
|
1919
|
|
- msCaseApplicationMapper.updateByPrimaryKeySelective(application);
|
|
1920
|
|
- // todo 发送短信
|
|
1921
|
|
- // 新增日志
|
|
1922
|
|
- CaseLogUtils.insertCaseLog(application.getId(), nextFlow.getNodeId(), nextFlow.getCaseStatusName(), "");
|
|
1923
|
|
-
|
|
1924
|
|
- }
|
|
1925
|
|
-
|
|
1926
|
|
-
|
|
1927
|
1952
|
|
|
1928
|
1953
|
/**
|
|
1929
|
1954
|
* 流向下一个流程节点
|
|
|
@@ -1932,6 +1957,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
1932
|
1957
|
* @param lockStatus '是否锁定,0-否,1-是',单独操作案件时需要锁定
|
|
1933
|
1958
|
* @return
|
|
1934
|
1959
|
*/
|
|
|
1960
|
+ @Transactional
|
|
1935
|
1961
|
@Override
|
|
1936
|
1962
|
public MsCaseFlow nextFlow(Long caseId,Integer caseFlowId,Integer lockStatus) {
|
|
1937
|
1963
|
// 查询当前流程节点
|
|
|
@@ -1964,7 +1990,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
1964
|
1990
|
* @param bookmarkList 标签
|
|
1965
|
1991
|
* @param dictDataList 内置字段
|
|
1966
|
1992
|
*/
|
|
1967
|
|
- private void createMediateApplication(MsCaseApplication application, MsCaseAffiliate affiliate, String templatePath, List<String> bookmarkList, List<SysDictData> dictDataList,Integer templateType) {
|
|
|
1993
|
+ @Transactional
|
|
|
1994
|
+ public void createMediateApplication(MsCaseApplication application, MsCaseAffiliate affiliate, String templatePath, List<String> bookmarkList, List<SysDictData> dictDataList,Integer templateType) {
|
|
1968
|
1995
|
// 申请书需要的字段和内容,valueMap<占位符,替换的值>
|
|
1969
|
1996
|
Map<String, String> valueMap = new HashMap<>();
|
|
1970
|
1997
|
for (SysDictData dictData : dictDataList) {
|
|
|
@@ -2018,7 +2045,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
2018
|
2045
|
msCaseAttachMapper.save(caseAttach);
|
|
2019
|
2046
|
// 生成调解书成功,需要更新流程节点
|
|
2020
|
2047
|
if (templateType!=null&&templateType==1) {
|
|
2021
|
|
- nextFlow(application.getId(), application.getCaseFlowId(), application.getLockStatus());
|
|
|
2048
|
+ caseApplicationService.nextFlow(application.getId(), application.getCaseFlowId(), application.getLockStatus());
|
|
2022
|
2049
|
// todo 发送短信
|
|
2023
|
2050
|
}
|
|
2024
|
2051
|
}
|
|
|
@@ -2086,16 +2113,10 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
2086
|
2113
|
continue;
|
|
2087
|
2114
|
}
|
|
2088
|
2115
|
// 上传
|
|
2089
|
|
- // String filePath = RuoYiConfig.getUploadPath();
|
|
2090
|
2116
|
MsCaseAttach caseAttach = new MsCaseAttach();
|
|
2091
|
2117
|
caseAttach.setCaseAppliId(caseApplication.getId());
|
|
2092
|
2118
|
caseAttach.setAnnexPath(fileUrl.replace(RuoYiConfig.getProfile(),Constants.RESOURCE_PREFIX));
|
|
2093
|
2119
|
caseAttach.setAnnexName(entry.getKey());
|
|
2094
|
|
- // todo
|
|
2095
|
|
-// if (StrUtil.isNotEmpty(fileUrl)) {
|
|
2096
|
|
-// String fileName = fileUrl.replace(filePath, "/profile/upload");
|
|
2097
|
|
-// caseAttach.setAnnexName(entry.getKey());
|
|
2098
|
|
-// }
|
|
2099
|
2120
|
// 申请人提供的证据材料
|
|
2100
|
2121
|
caseAttach.setAnnexType(AnnexTypeEnum.APPLICATION_EVIDENCE.getCode());
|
|
2101
|
2122
|
attachList.add(caseAttach);
|
|
|
@@ -2263,37 +2284,79 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
2263
|
2284
|
agentUser.setNickName(affiliate.getNameAgent());
|
|
2264
|
2285
|
agentUser.setPhonenumber(affiliate.getContactTelphoneAgent());
|
|
2265
|
2286
|
agentUser.setPassword(SecurityUtils.encryptPassword("abc123456"));
|
|
2266
|
|
- agentUser.setDeptId(Long.valueOf(affiliate.getApplicationId()));
|
|
|
2287
|
+ // agentUser.setDeptId(Long.valueOf(affiliate.getApplicationId()));
|
|
2267
|
2288
|
userMapper.insertUser(agentUser);
|
|
2268
|
2289
|
userRoleMapper.insertUserRole(agentUser.getUserId(), roleId);
|
|
2269
|
2290
|
// 新增部门用户关联表
|
|
2270
|
|
-// sysUserMapper.insertUser()
|
|
2271
|
|
- } else if (null == agentUser.getDeptId() ) {
|
|
2272
|
|
- // todo 未关联部门,关联部门
|
|
2273
|
|
- agentUser.setDeptId(Long.valueOf(affiliate.getApplicationId()));
|
|
2274
|
|
- userMapper.updateUser(agentUser);
|
|
2275
|
|
- }else if (null != agentUser.getDeptId() && !String.valueOf(agentUser.getDeptId()).equals(affiliate.getApplicationId())) {
|
|
2276
|
|
- if (null != agentUser.getDept() && StrUtil.isNotEmpty(agentUser.getDept().getDeptName())) {
|
|
2277
|
|
- throw new ServiceException("该申请代理人已在【" + agentUser.getDept().getDeptName() + "】申请机构下存在,请检查填写信息是否正确");
|
|
2278
|
|
- } else {
|
|
2279
|
|
- throw new ServiceException("该申请代理人已存在,与申请机构不匹配,请检查填写信息是否正确");
|
|
|
2291
|
+ SysUserDept sysUserDept = new SysUserDept();
|
|
|
2292
|
+ sysUserDept.setUserId(agentUser.getUserId());
|
|
|
2293
|
+ sysUserDept.setDeptId(Long.valueOf(affiliate.getApplicationId()));
|
|
|
2294
|
+ userDeptMapper.insert(sysUserDept);
|
|
|
2295
|
+ // 发送短信 2064355 调解系统自动创建用户短信通知 尊敬的用户,您的案件已经创建,请使用账号为{1},密码为{2}登录调解系统,请知晓,如非本人操作,请忽略本短信。
|
|
|
2296
|
+ Boolean smsFlag = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2064355", affiliate.getContactTelphoneAgent(), new String[]{affiliate.getContactTelphoneAgent(), "abc123456"});
|
|
|
2297
|
+ } else {
|
|
|
2298
|
+ // 查询所有部门
|
|
|
2299
|
+ List<SysDept> sysDepts = sysDeptMapper.selectDeptList(new SysDept());
|
|
|
2300
|
+ Map<String, List<SysDept>> deptMap=new HashMap<>();
|
|
|
2301
|
+ if(CollectionUtil.isNotEmpty(sysDepts)){
|
|
|
2302
|
+ deptMap = sysDepts.stream().collect(Collectors.groupingBy(SysDept::getDeptName));
|
|
2280
|
2303
|
}
|
|
2281
|
|
- } else if (null != agentUser.getDeptId() && String.valueOf(agentUser.getDeptId()).equals(affiliate.getApplicationId())) {
|
|
2282
|
|
- // 同步用户表和案件关联人表的手机号和名称
|
|
2283
|
|
- affiliate.setContactTelphoneAgent(StrUtil.isNotEmpty(agentUser.getPhonenumber()) ? agentUser.getPhonenumber() : affiliate.getContactTelphoneAgent());
|
|
2284
|
|
- affiliate.setNameAgent(agentUser.getNickName());
|
|
2285
|
|
- affiliate.setAgentEmail(StrUtil.isNotEmpty(agentUser.getEmail()) ? agentUser.getEmail() : affiliate.getAgentEmail());
|
|
2286
|
|
- List<Long> longList = new ArrayList<>();
|
|
2287
|
|
- // 新增角色为申请人
|
|
2288
|
|
- if (CollectionUtil.isNotEmpty(agentUser.getRoles())) {
|
|
2289
|
|
- longList = agentUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList());
|
|
2290
|
|
- if (!longList.contains(roleId)) {
|
|
2291
|
|
- userRoleMapper.insertUserRole(agentUser.getUserId(), roleId);
|
|
2292
|
|
- }
|
|
2293
|
|
- } else {
|
|
2294
|
|
- userRoleMapper.insertUserRole(agentUser.getUserId(), roleId);
|
|
|
2304
|
+
|
|
|
2305
|
+ if(!deptMap.containsKey(affiliate.getApplicationName())){
|
|
|
2306
|
+ // 如果不存在则新增
|
|
|
2307
|
+ SysDept dept = new SysDept();
|
|
|
2308
|
+ dept.setParentId(0L);
|
|
|
2309
|
+ dept.setDeptName(affiliate.getApplicationName());
|
|
|
2310
|
+ dept.setAncestors("0");
|
|
|
2311
|
+ dept.setOrderNum(1);
|
|
|
2312
|
+ dept.setStatus("0");
|
|
|
2313
|
+ dept.setDelFlag("0");
|
|
|
2314
|
+ dept.setCreateBy(getUsername());
|
|
|
2315
|
+ dept.setUpdateBy(getUsername());
|
|
|
2316
|
+ sysDeptMapper.insertDept(dept);
|
|
|
2317
|
+ List<SysDept> depts = new ArrayList<>();
|
|
|
2318
|
+ depts.add(dept);
|
|
|
2319
|
+ deptMap.put(dept.getDeptName(), depts);
|
|
|
2320
|
+ affiliate.setApplicationId(String.valueOf(dept.getDeptId()));
|
|
|
2321
|
+ affiliate.setApplicationName(affiliate.getApplicationName());
|
|
|
2322
|
+ }else {
|
|
|
2323
|
+ // 将组织机构id设为申请人名称
|
|
|
2324
|
+ affiliate.setApplicationId(deptMap.get(affiliate.getApplicationName()).get(0).getDeptId().toString());
|
|
|
2325
|
+ affiliate.setApplicationName(affiliate.getApplicationName());
|
|
2295
|
2326
|
}
|
|
|
2327
|
+ // 根据userId查询部门
|
|
|
2328
|
+ List<SysUserDept> userDeptList = userDeptMapper.selectUserDeptById(agentUser.getUserId());
|
|
|
2329
|
+ if(CollectionUtil.isEmpty(userDeptList)){
|
|
|
2330
|
+ // 未关联部门,关联部门,新增部门用户关联表
|
|
|
2331
|
+ SysUserDept sysUserDept = new SysUserDept();
|
|
|
2332
|
+ sysUserDept.setUserId(agentUser.getUserId());
|
|
|
2333
|
+ sysUserDept.setDeptId(Long.valueOf(affiliate.getApplicationId()));
|
|
|
2334
|
+ userDeptMapper.insert(sysUserDept);
|
|
|
2335
|
+ }else {
|
|
|
2336
|
+ List<Long> deptIdList = userDeptList.stream().map(SysUserDept::getDeptId).collect(Collectors.toList());
|
|
|
2337
|
+ if(!deptIdList.contains(Long.valueOf(affiliate.getApplicationId()))){
|
|
|
2338
|
+ // 未关联该部门,关联部门,新增部门用户关联表
|
|
|
2339
|
+ SysUserDept sysUserDept = new SysUserDept();
|
|
|
2340
|
+ sysUserDept.setUserId(agentUser.getUserId());
|
|
|
2341
|
+ sysUserDept.setDeptId(Long.valueOf(affiliate.getApplicationId()));
|
|
|
2342
|
+ userDeptMapper.insert(sysUserDept);
|
|
|
2343
|
+ // 同步用户表和案件关联人表的手机号和名称
|
|
|
2344
|
+ affiliate.setContactTelphoneAgent(StrUtil.isNotEmpty(agentUser.getPhonenumber()) ? agentUser.getPhonenumber() : affiliate.getContactTelphoneAgent());
|
|
|
2345
|
+ affiliate.setNameAgent(agentUser.getNickName());
|
|
|
2346
|
+ affiliate.setAgentEmail(StrUtil.isNotEmpty(agentUser.getEmail()) ? agentUser.getEmail() : affiliate.getAgentEmail());
|
|
|
2347
|
+ List<Long> longList = new ArrayList<>();
|
|
|
2348
|
+ // 新增角色为申请人
|
|
|
2349
|
+ if (CollectionUtil.isNotEmpty(agentUser.getRoles())) {
|
|
|
2350
|
+ longList = agentUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList());
|
|
|
2351
|
+ if (!longList.contains(roleId)) {
|
|
|
2352
|
+ userRoleMapper.insertUserRole(agentUser.getUserId(), roleId);
|
|
|
2353
|
+ }
|
|
|
2354
|
+ } else {
|
|
|
2355
|
+ userRoleMapper.insertUserRole(agentUser.getUserId(), roleId);
|
|
|
2356
|
+ }
|
|
2296
|
2357
|
|
|
|
2358
|
+ }
|
|
|
2359
|
+ }
|
|
2297
|
2360
|
}
|
|
2298
|
2361
|
}
|
|
2299
|
2362
|
|
|
|
@@ -2303,7 +2366,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
2303
|
2366
|
* @param affiliate
|
|
2304
|
2367
|
*/
|
|
2305
|
2368
|
@Transactional
|
|
2306
|
|
- void insertDept(MsCaseAffiliate affiliate) {
|
|
|
2369
|
+ public void insertDept(MsCaseAffiliate affiliate) {
|
|
2307
|
2370
|
// 查询所有的组织机构,组装成map
|
|
2308
|
2371
|
List<SysDept> deptList = sysDeptMapper.selectDeptList(new SysDept());
|
|
2309
|
2372
|
if (CollectionUtil.isEmpty(deptList)) {
|