18792927508 2 年 前
コミット
e2f956beac

+ 53
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/entity/mscase/MsCaseMediator.java ファイルの表示

1
+package com.ruoyi.wisdomarbitrate.domain.entity.mscase;
2
+
3
+import lombok.Getter;
4
+import lombok.Setter;
5
+import lombok.ToString;
6
+
7
+import javax.persistence.Column;
8
+import javax.persistence.GeneratedValue;
9
+import javax.persistence.Id;
10
+import javax.persistence.Table;
11
+
12
+/**
13
+ * 案件预约表
14
+ */
15
+@Getter
16
+@Setter
17
+@ToString
18
+@Table(name = "ms_case_mediator")
19
+public class MsCaseMediator {
20
+    @Id
21
+    @GeneratedValue(generator = "JDBC")
22
+    private Long id;
23
+
24
+    /**
25
+     * 案件主表id
26
+     */
27
+    @Column(name = "case_appli_id")
28
+    private Long caseAppliId;
29
+
30
+    /**
31
+     * 调解员id
32
+     */
33
+    @Column(name = "mediator_id")
34
+    private String mediatorId;
35
+
36
+    /**
37
+     * 调解员名称
38
+     */
39
+    @Column(name = "mediator_name")
40
+    private String mediatorName;
41
+
42
+    /**
43
+     * 调解时间
44
+     */
45
+    @Column(name = "hear_date")
46
+    private String hearDate;
47
+
48
+    /**
49
+     * 身份类别,1申请人,2被申请人
50
+     */
51
+    @Column(name = "type")
52
+    private Integer type;
53
+}

+ 4
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/mscase/BookingVO.java ファイルの表示

38
      * 批次
38
      * 批次
39
      */
39
      */
40
     private String batchNumber;
40
     private String batchNumber;
41
+    /**
42
+     * 是否被申请人,1-被申请人,空为申请人
43
+     */
44
+    private Integer miniProgressFlag;
41
 }
45
 }

+ 10
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/mscase/MsCaseMediatorMapper.java ファイルの表示

1
+package com.ruoyi.wisdomarbitrate.mapper.mscase;
2
+
3
+import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseMediator;
4
+import tk.mybatis.mapper.common.Mapper;
5
+
6
+/**
7
+ * 案件预约表
8
+ */
9
+public interface MsCaseMediatorMapper extends Mapper<MsCaseMediator> {
10
+}

+ 139
- 25
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/mscase/impl/MsCaseApplicationServiceImpl.java ファイルの表示

30
 import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord;
30
 import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord;
31
 import com.ruoyi.wisdomarbitrate.domain.dto.template.FatchRule;
31
 import com.ruoyi.wisdomarbitrate.domain.dto.template.FatchRule;
32
 import com.ruoyi.wisdomarbitrate.domain.dto.template.TemplateManage;
32
 import com.ruoyi.wisdomarbitrate.domain.dto.template.TemplateManage;
33
+import com.ruoyi.wisdomarbitrate.domain.entity.mscase.*;
33
 import com.ruoyi.wisdomarbitrate.domain.entity.dept.MsSealSignRecord;
34
 import com.ruoyi.wisdomarbitrate.domain.entity.dept.MsSealSignRecord;
34
 import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAffiliate;
35
 import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAffiliate;
35
 import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
36
 import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
121
     @Autowired
122
     @Autowired
122
     private MsCaseLogRecordMapper caseLogRecordMapper;
123
     private MsCaseLogRecordMapper caseLogRecordMapper;
123
     @Autowired
124
     @Autowired
125
+    private MsCaseMediatorMapper msCaseMediatorMapper;
126
+    @Autowired
124
     private SysUserMapper sysUserMapper;
127
     private SysUserMapper sysUserMapper;
125
     @Autowired
128
     @Autowired
126
     private DeptIdentifyMapper deptIdentifyMapper;
129
     private DeptIdentifyMapper deptIdentifyMapper;
300
                 }
303
                 }
301
                 columnValueMapper.batchSave(columnValueList);
304
                 columnValueMapper.batchSave(columnValueList);
302
             }
305
             }
306
+            // todo 发送短信
303
             CaseLogUtils.insertCaseLog(caseApplication.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), "");
307
             CaseLogUtils.insertCaseLog(caseApplication.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), "");
304
             return 1;
308
             return 1;
305
         }
309
         }
584
             // 案件ids
588
             // 案件ids
585
             List<Long> caseIds = caseApplicationList.stream().map(MsCaseApplication::getId).collect(Collectors.toList());
589
             List<Long> caseIds = caseApplicationList.stream().map(MsCaseApplication::getId).collect(Collectors.toList());
586
             // 根据ids查询案件关联人员
590
             // 根据ids查询案件关联人员
587
-            Example afflicateExample = new Example(MsCaseFlow.class);
591
+            Example afflicateExample = new Example(MsCaseAffiliate.class);
588
             afflicateExample.createCriteria().andIn("case_appli_id", caseIds);
592
             afflicateExample.createCriteria().andIn("case_appli_id", caseIds);
589
-            List<MsCaseAffiliate> affiliateList = msCaseAffiliateMapper.selectByExample(caseIds);
593
+            List<MsCaseAffiliate> affiliateList = msCaseAffiliateMapper.selectByExample(afflicateExample);
590
             if(CollectionUtil.isEmpty(affiliateList)){
594
             if(CollectionUtil.isEmpty(affiliateList)){
591
                 throw new ServiceException("该批次号下未找到案件关联人员");
595
                 throw new ServiceException("该批次号下未找到案件关联人员");
592
             }
596
             }
628
      */
632
      */
629
 
633
 
630
     public List<MsCaseApplication> listByBatchNumber(String batchNumber,Integer caseFlowId) {
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
         if(caseFlowId!=null){
638
         if(caseFlowId!=null){
635
-            example.createCriteria().andEqualTo("case_flow_id",caseFlowId);
639
+            example.createCriteria().andEqualTo("caseFlowId",caseFlowId);
636
         }
640
         }
637
         return msCaseApplicationMapper.selectByExample(example);
641
         return msCaseApplicationMapper.selectByExample(example);
638
 
642
 
749
             }
753
             }
750
             for (MsCaseApplication application : list) {
754
             for (MsCaseApplication application : list) {
751
                 MsCaseFlow caseFlow = nextFlow(application.getId(), req.getCaseFlowId(), YesOrNoEnum.NO.getCode());
755
                 MsCaseFlow caseFlow = nextFlow(application.getId(), req.getCaseFlowId(), YesOrNoEnum.NO.getCode());
756
+                // todo 发送短信
752
                 CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), "提交成功");
757
                 CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), "提交成功");
753
             }
758
             }
754
         }else {
759
         }else {
755
             MsCaseFlow caseFlow = nextFlow(req.getId(), req.getCaseFlowId(), YesOrNoEnum.NO.getCode());
760
             MsCaseFlow caseFlow = nextFlow(req.getId(), req.getCaseFlowId(), YesOrNoEnum.NO.getCode());
761
+            // todo 发送短信
756
             CaseLogUtils.insertCaseLog(req.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), "提交成功");
762
             CaseLogUtils.insertCaseLog(req.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), "提交成功");
757
 
763
 
758
         }
764
         }
804
         return AjaxResult.success(mediatorVOS);
810
         return AjaxResult.success(mediatorVOS);
805
     }
811
     }
806
     @Transactional
812
     @Transactional
807
-    @Override
808
-    public AjaxResult updateBooking(BookingVO vo) {
813
+    public AjaxResult updateBooking1(BookingVO vo) {
809
         // 查询被申请人是否预约过(从日志表查),否则不更新流程节点
814
         // 查询被申请人是否预约过(从日志表查),否则不更新流程节点
810
         MsCaseAffiliate msCaseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(vo.getId());
815
         MsCaseAffiliate msCaseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(vo.getId());
811
         if(msCaseAffiliate==null) {
816
         if(msCaseAffiliate==null) {
818
         if(applicantCount<1){
823
         if(applicantCount<1){
819
             return AjaxResult.error("保存失败");
824
             return AjaxResult.error("保存失败");
820
         }
825
         }
821
-        // 新增申请人签署日志
826
+        // 查询当前节点
822
         MsCaseFlow currentFlow = caseFlowMapper.selectByPrimaryKey(vo.getCaseFlowId());
827
         MsCaseFlow currentFlow = caseFlowMapper.selectByPrimaryKey(vo.getCaseFlowId());
823
         if(currentFlow==null){
828
         if(currentFlow==null){
824
             return AjaxResult.error("当前流程不存在");
829
             return AjaxResult.error("当前流程不存在");
848
                     application.setCaseStatusName(nextFlow.getCaseStatusName());
853
                     application.setCaseStatusName(nextFlow.getCaseStatusName());
849
                     application.setLockStatus(null);
854
                     application.setLockStatus(null);
850
                     msCaseApplicationMapper.updateByPrimaryKeySelective(application);
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
         return AjaxResult.success();
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
      * @param application
965
      * @param application
912
      */
1012
      */
913
     @Override
1013
     @Override
914
     public AjaxResult selectReservation(Long id) {
1014
     public AjaxResult selectReservation(Long id) {
915
-
916
-        MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(id);
917
-        if(caseApplication == null){
918
-            return AjaxResult.error("该案件不存在");
919
-        }
920
         BookingVO result = new BookingVO();
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
             if(user==null){
1036
             if(user==null){
926
                 return AjaxResult.error("调解员已被删除");
1037
                 return AjaxResult.error("调解员已被删除");
927
             }
1038
             }
959
             mediatorVOS.add(mediatorVO);
1070
             mediatorVOS.add(mediatorVO);
960
             result.setMediatorList(mediatorVOS);
1071
             result.setMediatorList(mediatorVOS);
961
         }
1072
         }
962
-        if(StrUtil.isNotEmpty(caseApplication.getHearDate())){
1073
+        if(StrUtil.isNotEmpty(msCaseMediator.getHearDate())){
963
             List<String> herdates = new ArrayList<>();
1074
             List<String> herdates = new ArrayList<>();
964
-            herdates.add(caseApplication.getHearDate());
1075
+            herdates.add(msCaseMediator.getHearDate());
965
             result.setHerDates(herdates);
1076
             result.setHerDates(herdates);
966
         }
1077
         }
967
         return AjaxResult.success(result);
1078
         return AjaxResult.success(result);
979
         // 批量
1090
         // 批量
980
         if(StrUtil.isNotEmpty(req.getBatchNumber())){
1091
         if(StrUtil.isNotEmpty(req.getBatchNumber())){
981
             // 查询调解书模板是否存在
1092
             // 查询调解书模板是否存在
982
-            Example example = new Example(MsCaseFlow.class);
1093
+            Example example = new Example(MsCaseApplication.class);
983
             Example.Criteria criteria = example.createCriteria();
1094
             Example.Criteria criteria = example.createCriteria();
984
             criteria.andEqualTo("batch_number", req.getBatchNumber());
1095
             criteria.andEqualTo("batch_number", req.getBatchNumber());
985
             criteria.andIsNotNull("template_id");
1096
             criteria.andIsNotNull("template_id");
1036
             msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(attach.getCaseAppliId(),AnnexTypeEnum.MEDIATE_BOOK.getCode());
1147
             msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(attach.getCaseAppliId(),AnnexTypeEnum.MEDIATE_BOOK.getCode());
1037
             msCaseAttachMapper.updateCaseAttach(attach);
1148
             msCaseAttachMapper.updateCaseAttach(attach);
1038
         }
1149
         }
1150
+        // todo 发送短信
1039
         // 更新流程节点
1151
         // 更新流程节点
1040
         nextFlow(attach.getCaseAppliId(),attach.getCaseFlowId(),YesOrNoEnum.YES.getCode());
1152
         nextFlow(attach.getCaseAppliId(),attach.getCaseFlowId(),YesOrNoEnum.YES.getCode());
1041
 
1153
 
1328
         application.setCaseFlowId(nextFlow.getNodeId());
1440
         application.setCaseFlowId(nextFlow.getNodeId());
1329
         application.setCaseStatusName(nextFlow.getCaseStatusName());
1441
         application.setCaseStatusName(nextFlow.getCaseStatusName());
1330
         msCaseApplicationMapper.updateByPrimaryKeySelective(application);
1442
         msCaseApplicationMapper.updateByPrimaryKeySelective(application);
1443
+        // todo 发送短信
1331
         // 新增日志
1444
         // 新增日志
1332
         CaseLogUtils.insertCaseLog(application.getId(), nextFlow.getNodeId(), nextFlow.getCaseStatusName(), "");
1445
         CaseLogUtils.insertCaseLog(application.getId(), nextFlow.getNodeId(), nextFlow.getCaseStatusName(), "");
1333
 
1446
 
1470
         // 生成调解书成功,需要更新流程节点
1583
         // 生成调解书成功,需要更新流程节点
1471
         if (templateType!=null&&templateType==1) {
1584
         if (templateType!=null&&templateType==1) {
1472
             nextFlow(application.getId(), application.getCaseFlowId(), application.getLockStatus());
1585
             nextFlow(application.getId(), application.getCaseFlowId(), application.getLockStatus());
1586
+            // todo 发送短信
1473
         }
1587
         }
1474
     }
1588
     }
1475
 
1589