|
|
@@ -30,6 +30,7 @@ import com.ruoyi.wisdomarbitrate.domain.dto.mscase.SealSignRecord;
|
|
30
|
30
|
import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord;
|
|
31
|
31
|
import com.ruoyi.wisdomarbitrate.domain.dto.template.FatchRule;
|
|
32
|
32
|
import com.ruoyi.wisdomarbitrate.domain.dto.template.TemplateManage;
|
|
|
33
|
+import com.ruoyi.wisdomarbitrate.domain.entity.mscase.*;
|
|
33
|
34
|
import com.ruoyi.wisdomarbitrate.domain.entity.dept.MsSealSignRecord;
|
|
34
|
35
|
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAffiliate;
|
|
35
|
36
|
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
|
|
|
@@ -121,6 +122,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
121
|
122
|
@Autowired
|
|
122
|
123
|
private MsCaseLogRecordMapper caseLogRecordMapper;
|
|
123
|
124
|
@Autowired
|
|
|
125
|
+ private MsCaseMediatorMapper msCaseMediatorMapper;
|
|
|
126
|
+ @Autowired
|
|
124
|
127
|
private SysUserMapper sysUserMapper;
|
|
125
|
128
|
@Autowired
|
|
126
|
129
|
private DeptIdentifyMapper deptIdentifyMapper;
|
|
|
@@ -300,6 +303,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
300
|
303
|
}
|
|
301
|
304
|
columnValueMapper.batchSave(columnValueList);
|
|
302
|
305
|
}
|
|
|
306
|
+ // todo 发送短信
|
|
303
|
307
|
CaseLogUtils.insertCaseLog(caseApplication.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), "");
|
|
304
|
308
|
return 1;
|
|
305
|
309
|
}
|
|
|
@@ -584,9 +588,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
584
|
588
|
// 案件ids
|
|
585
|
589
|
List<Long> caseIds = caseApplicationList.stream().map(MsCaseApplication::getId).collect(Collectors.toList());
|
|
586
|
590
|
// 根据ids查询案件关联人员
|
|
587
|
|
- Example afflicateExample = new Example(MsCaseFlow.class);
|
|
|
591
|
+ Example afflicateExample = new Example(MsCaseAffiliate.class);
|
|
588
|
592
|
afflicateExample.createCriteria().andIn("case_appli_id", caseIds);
|
|
589
|
|
- List<MsCaseAffiliate> affiliateList = msCaseAffiliateMapper.selectByExample(caseIds);
|
|
|
593
|
+ List<MsCaseAffiliate> affiliateList = msCaseAffiliateMapper.selectByExample(afflicateExample);
|
|
590
|
594
|
if(CollectionUtil.isEmpty(affiliateList)){
|
|
591
|
595
|
throw new ServiceException("该批次号下未找到案件关联人员");
|
|
592
|
596
|
}
|
|
|
@@ -628,11 +632,11 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
628
|
632
|
*/
|
|
629
|
633
|
|
|
630
|
634
|
public List<MsCaseApplication> listByBatchNumber(String batchNumber,Integer caseFlowId) {
|
|
631
|
|
- Example example = new Example(MsCaseFlow.class);
|
|
632
|
|
- example.createCriteria().andEqualTo("batch_number", batchNumber);
|
|
633
|
|
- example.createCriteria().andEqualTo("lock_status", 0);
|
|
|
635
|
+ Example example = new Example(MsCaseApplication.class);
|
|
|
636
|
+ example.createCriteria().andEqualTo("batchNumber", batchNumber);
|
|
|
637
|
+ example.createCriteria().andEqualTo("lockStatus", 0);
|
|
634
|
638
|
if(caseFlowId!=null){
|
|
635
|
|
- example.createCriteria().andEqualTo("case_flow_id",caseFlowId);
|
|
|
639
|
+ example.createCriteria().andEqualTo("caseFlowId",caseFlowId);
|
|
636
|
640
|
}
|
|
637
|
641
|
return msCaseApplicationMapper.selectByExample(example);
|
|
638
|
642
|
|
|
|
@@ -749,10 +753,12 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
749
|
753
|
}
|
|
750
|
754
|
for (MsCaseApplication application : list) {
|
|
751
|
755
|
MsCaseFlow caseFlow = nextFlow(application.getId(), req.getCaseFlowId(), YesOrNoEnum.NO.getCode());
|
|
|
756
|
+ // todo 发送短信
|
|
752
|
757
|
CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), "提交成功");
|
|
753
|
758
|
}
|
|
754
|
759
|
}else {
|
|
755
|
760
|
MsCaseFlow caseFlow = nextFlow(req.getId(), req.getCaseFlowId(), YesOrNoEnum.NO.getCode());
|
|
|
761
|
+ // todo 发送短信
|
|
756
|
762
|
CaseLogUtils.insertCaseLog(req.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), "提交成功");
|
|
757
|
763
|
|
|
758
|
764
|
}
|
|
|
@@ -804,8 +810,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
804
|
810
|
return AjaxResult.success(mediatorVOS);
|
|
805
|
811
|
}
|
|
806
|
812
|
@Transactional
|
|
807
|
|
- @Override
|
|
808
|
|
- public AjaxResult updateBooking(BookingVO vo) {
|
|
|
813
|
+ public AjaxResult updateBooking1(BookingVO vo) {
|
|
809
|
814
|
// 查询被申请人是否预约过(从日志表查),否则不更新流程节点
|
|
810
|
815
|
MsCaseAffiliate msCaseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(vo.getId());
|
|
811
|
816
|
if(msCaseAffiliate==null) {
|
|
|
@@ -818,7 +823,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
818
|
823
|
if(applicantCount<1){
|
|
819
|
824
|
return AjaxResult.error("保存失败");
|
|
820
|
825
|
}
|
|
821
|
|
- // 新增申请人签署日志
|
|
|
826
|
+ // 查询当前节点
|
|
822
|
827
|
MsCaseFlow currentFlow = caseFlowMapper.selectByPrimaryKey(vo.getCaseFlowId());
|
|
823
|
828
|
if(currentFlow==null){
|
|
824
|
829
|
return AjaxResult.error("当前流程不存在");
|
|
|
@@ -848,18 +853,113 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
848
|
853
|
application.setCaseStatusName(nextFlow.getCaseStatusName());
|
|
849
|
854
|
application.setLockStatus(null);
|
|
850
|
855
|
msCaseApplicationMapper.updateByPrimaryKeySelective(application);
|
|
|
856
|
+ // todo 发送短信
|
|
851
|
857
|
}
|
|
852
|
|
-// else {
|
|
853
|
|
-// return AjaxResult.error("被申请人未选择调解员");
|
|
854
|
|
-// }
|
|
855
|
858
|
}
|
|
856
|
|
-// else {
|
|
857
|
|
-// return AjaxResult.error("被申请人未选择调解员");
|
|
858
|
|
-// }
|
|
859
|
859
|
}
|
|
860
|
860
|
return AjaxResult.success();
|
|
861
|
861
|
}
|
|
862
|
862
|
|
|
|
863
|
+ /**
|
|
|
864
|
+ * 申请人/被申请人预约
|
|
|
865
|
+ * @param vo
|
|
|
866
|
+ * @return
|
|
|
867
|
+ */
|
|
|
868
|
+ @Transactional
|
|
|
869
|
+ public AjaxResult updateBooking(BookingVO vo) {
|
|
|
870
|
+ // 查询案件相关人员
|
|
|
871
|
+ MsCaseAffiliate msCaseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(vo.getId());
|
|
|
872
|
+ if (msCaseAffiliate == null) {
|
|
|
873
|
+ return AjaxResult.error("该案件不存在");
|
|
|
874
|
+ }
|
|
|
875
|
+ // 查询当前节点
|
|
|
876
|
+ MsCaseFlow currentFlow = caseFlowMapper.selectByPrimaryKey(vo.getCaseFlowId());
|
|
|
877
|
+ if (currentFlow == null) {
|
|
|
878
|
+ return AjaxResult.error("当前流程不存在");
|
|
|
879
|
+ }
|
|
|
880
|
+ // 新增案件预约表
|
|
|
881
|
+ MsCaseMediator mediator = new MsCaseMediator();
|
|
|
882
|
+ mediator.setCaseAppliId(vo.getId());
|
|
|
883
|
+ mediator.setMediatorId(String.valueOf(vo.getUserList().get(0).getUserId()));
|
|
|
884
|
+ mediator.setMediatorName(String.valueOf(vo.getUserList().get(0).getUserName()));
|
|
|
885
|
+ mediator.setHearDate(String.valueOf(vo.getHerDates().get(0)));
|
|
|
886
|
+ mediator.setType(vo.getMiniProgressFlag());
|
|
|
887
|
+ msCaseMediatorMapper.insert(mediator);
|
|
|
888
|
+ // 申请人预约
|
|
|
889
|
+ if (vo.getMiniProgressFlag() == null) {
|
|
|
890
|
+ // 新增日志
|
|
|
891
|
+ CaseLogUtils.insertCaseLog(vo.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "申请人选择调解员");
|
|
|
892
|
+
|
|
|
893
|
+ if (StrUtil.isEmpty(msCaseAffiliate.getRespondentIdentityNum())) {
|
|
|
894
|
+ return AjaxResult.error("被申请人身份证为空");
|
|
|
895
|
+ }
|
|
|
896
|
+
|
|
|
897
|
+ SysUser user = userMapper.selectUserByIdCard(msCaseAffiliate.getRespondentIdentityNum());
|
|
|
898
|
+ // 被申请人存在
|
|
|
899
|
+ if (user != null) {
|
|
|
900
|
+ // 判断被申请人信息查询案件预约表
|
|
|
901
|
+ isReservation( vo,user);
|
|
|
902
|
+ }
|
|
|
903
|
+
|
|
|
904
|
+ } else {
|
|
|
905
|
+ // 被申请人预约
|
|
|
906
|
+ // 新增日志
|
|
|
907
|
+ CaseLogUtils.insertCaseLog(vo.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "被申请人选择调解员");
|
|
|
908
|
+ if (StrUtil.isEmpty(msCaseAffiliate.getContactTelphoneAgent())) {
|
|
|
909
|
+ return AjaxResult.error("申请代理人手机号为空");
|
|
|
910
|
+ }
|
|
|
911
|
+
|
|
|
912
|
+ SysUser user = userMapper.selectUserByPhone(msCaseAffiliate.getContactTelphoneAgent());
|
|
|
913
|
+ if(user!=null){
|
|
|
914
|
+ // 判断申请人是否预约
|
|
|
915
|
+ isReservation( vo,user);
|
|
|
916
|
+ }
|
|
|
917
|
+
|
|
|
918
|
+ }
|
|
|
919
|
+ return AjaxResult.success();
|
|
|
920
|
+ }
|
|
|
921
|
+
|
|
|
922
|
+ /**
|
|
|
923
|
+ * 判断申请人/被申请人是否预约
|
|
|
924
|
+ * @param vo
|
|
|
925
|
+ * @param user
|
|
|
926
|
+ */
|
|
|
927
|
+ private void isReservation( BookingVO vo, SysUser user) {
|
|
|
928
|
+ Example example = new Example(MsCaseMediator.class);
|
|
|
929
|
+ Example.Criteria criteria = example.createCriteria();
|
|
|
930
|
+ if(vo.getMiniProgressFlag() == null) {
|
|
|
931
|
+ // 申请人预约,需要查询被申请人是否预约,identity_type不为空
|
|
|
932
|
+ criteria.andIsNotNull("type");
|
|
|
933
|
+ }else {
|
|
|
934
|
+ // 被申请人预约,需要查询申请人是否预约,identity_type为空
|
|
|
935
|
+ criteria.andIsNull("type");
|
|
|
936
|
+ }
|
|
|
937
|
+ criteria.andEqualTo("caseAppliId", vo.getId());
|
|
|
938
|
+ criteria.andEqualTo("mediatorId", user.getUserId());
|
|
|
939
|
+ int count = msCaseMediatorMapper.selectCountByExample(example);
|
|
|
940
|
+ if (count > 0) {
|
|
|
941
|
+ // 申请人已预约,更新主表流程节点
|
|
|
942
|
+ MsCaseFlow nextFlow = caseFlowMapper.nextFlow(vo.getCaseFlowId());
|
|
|
943
|
+ if (nextFlow == null) {
|
|
|
944
|
+ throw new ServiceException("未找到下一个流程");
|
|
|
945
|
+ }
|
|
|
946
|
+ MsCaseApplication application = new MsCaseApplication();
|
|
|
947
|
+ application.setId(vo.getId());
|
|
|
948
|
+ application.setCaseFlowId(nextFlow.getId());
|
|
|
949
|
+ application.setCaseStatusName(nextFlow.getCaseStatusName());
|
|
|
950
|
+ application.setLockStatus(null);
|
|
|
951
|
+ msCaseApplicationMapper.updateByPrimaryKeySelective(application);
|
|
|
952
|
+ // 新增日志
|
|
|
953
|
+ if(vo.getMiniProgressFlag() == null) {
|
|
|
954
|
+ CaseLogUtils.insertCaseLog(vo.getId(), nextFlow.getNodeId(), nextFlow.getCaseStatusName(), "申请人选择调解员");
|
|
|
955
|
+ }else {
|
|
|
956
|
+ CaseLogUtils.insertCaseLog(vo.getId(), nextFlow.getNodeId(), nextFlow.getCaseStatusName(), "被申请人选择调解员");
|
|
|
957
|
+
|
|
|
958
|
+ }
|
|
|
959
|
+ // todo 发送短信
|
|
|
960
|
+ }
|
|
|
961
|
+ }
|
|
|
962
|
+
|
|
863
|
963
|
/**
|
|
864
|
964
|
* 设置调解员调解时间
|
|
865
|
965
|
* @param application
|
|
|
@@ -912,16 +1012,27 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
912
|
1012
|
*/
|
|
913
|
1013
|
@Override
|
|
914
|
1014
|
public AjaxResult selectReservation(Long id) {
|
|
915
|
|
-
|
|
916
|
|
- MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(id);
|
|
917
|
|
- if(caseApplication == null){
|
|
918
|
|
- return AjaxResult.error("该案件不存在");
|
|
919
|
|
- }
|
|
920
|
1015
|
BookingVO result = new BookingVO();
|
|
|
1016
|
+
|
|
|
1017
|
+ // MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(id);
|
|
|
1018
|
+ // todo 返回申请人预约信息,预约信息查预约表
|
|
|
1019
|
+ Example example = new Example(MsCaseMediator.class);
|
|
|
1020
|
+ Example.Criteria criteria = example.createCriteria();
|
|
|
1021
|
+ criteria.andIsNull("type");
|
|
|
1022
|
+ criteria.andEqualTo("caseAppliId", id);
|
|
|
1023
|
+ // criteria.andEqualTo("mediatorId", SecurityUtils.getUserId());
|
|
|
1024
|
+ MsCaseMediator msCaseMediator = msCaseMediatorMapper.selectOneByExample(example);
|
|
|
1025
|
+ if(msCaseMediator==null){
|
|
|
1026
|
+ return AjaxResult.success(result);
|
|
|
1027
|
+ }
|
|
|
1028
|
+// if(caseApplication == null){
|
|
|
1029
|
+// return AjaxResult.error("该案件不存在");
|
|
|
1030
|
+// }
|
|
|
1031
|
+
|
|
921
|
1032
|
// 调解员是一个的处理
|
|
922
|
|
- if( StrUtil.isNotEmpty(caseApplication.getMediatorId()) && StrUtil.isNotEmpty(caseApplication.getMediatorName())){
|
|
|
1033
|
+ if( StrUtil.isNotEmpty(msCaseMediator.getMediatorId()) && StrUtil.isNotEmpty(msCaseMediator.getMediatorName())){
|
|
923
|
1034
|
// 查询用户
|
|
924
|
|
- SysUser user = userMapper.selectUserById(Long.valueOf(caseApplication.getMediatorId()));
|
|
|
1035
|
+ SysUser user = userMapper.selectUserById(Long.valueOf(msCaseMediator.getMediatorId()));
|
|
925
|
1036
|
if(user==null){
|
|
926
|
1037
|
return AjaxResult.error("调解员已被删除");
|
|
927
|
1038
|
}
|
|
|
@@ -959,9 +1070,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
959
|
1070
|
mediatorVOS.add(mediatorVO);
|
|
960
|
1071
|
result.setMediatorList(mediatorVOS);
|
|
961
|
1072
|
}
|
|
962
|
|
- if(StrUtil.isNotEmpty(caseApplication.getHearDate())){
|
|
|
1073
|
+ if(StrUtil.isNotEmpty(msCaseMediator.getHearDate())){
|
|
963
|
1074
|
List<String> herdates = new ArrayList<>();
|
|
964
|
|
- herdates.add(caseApplication.getHearDate());
|
|
|
1075
|
+ herdates.add(msCaseMediator.getHearDate());
|
|
965
|
1076
|
result.setHerDates(herdates);
|
|
966
|
1077
|
}
|
|
967
|
1078
|
return AjaxResult.success(result);
|
|
|
@@ -979,7 +1090,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
979
|
1090
|
// 批量
|
|
980
|
1091
|
if(StrUtil.isNotEmpty(req.getBatchNumber())){
|
|
981
|
1092
|
// 查询调解书模板是否存在
|
|
982
|
|
- Example example = new Example(MsCaseFlow.class);
|
|
|
1093
|
+ Example example = new Example(MsCaseApplication.class);
|
|
983
|
1094
|
Example.Criteria criteria = example.createCriteria();
|
|
984
|
1095
|
criteria.andEqualTo("batch_number", req.getBatchNumber());
|
|
985
|
1096
|
criteria.andIsNotNull("template_id");
|
|
|
@@ -1036,6 +1147,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
1036
|
1147
|
msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(attach.getCaseAppliId(),AnnexTypeEnum.MEDIATE_BOOK.getCode());
|
|
1037
|
1148
|
msCaseAttachMapper.updateCaseAttach(attach);
|
|
1038
|
1149
|
}
|
|
|
1150
|
+ // todo 发送短信
|
|
1039
|
1151
|
// 更新流程节点
|
|
1040
|
1152
|
nextFlow(attach.getCaseAppliId(),attach.getCaseFlowId(),YesOrNoEnum.YES.getCode());
|
|
1041
|
1153
|
|
|
|
@@ -1328,6 +1440,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
1328
|
1440
|
application.setCaseFlowId(nextFlow.getNodeId());
|
|
1329
|
1441
|
application.setCaseStatusName(nextFlow.getCaseStatusName());
|
|
1330
|
1442
|
msCaseApplicationMapper.updateByPrimaryKeySelective(application);
|
|
|
1443
|
+ // todo 发送短信
|
|
1331
|
1444
|
// 新增日志
|
|
1332
|
1445
|
CaseLogUtils.insertCaseLog(application.getId(), nextFlow.getNodeId(), nextFlow.getCaseStatusName(), "");
|
|
1333
|
1446
|
|
|
|
@@ -1470,6 +1583,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
1470
|
1583
|
// 生成调解书成功,需要更新流程节点
|
|
1471
|
1584
|
if (templateType!=null&&templateType==1) {
|
|
1472
|
1585
|
nextFlow(application.getId(), application.getCaseFlowId(), application.getLockStatus());
|
|
|
1586
|
+ // todo 发送短信
|
|
1473
|
1587
|
}
|
|
1474
|
1588
|
}
|
|
1475
|
1589
|
|