|
|
@@ -30,12 +30,11 @@ 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.*;
|
|
34
|
33
|
import com.ruoyi.wisdomarbitrate.domain.entity.dept.MsSealSignRecord;
|
|
35
|
34
|
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAffiliate;
|
|
36
|
35
|
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
|
|
37
|
36
|
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach;
|
|
38
|
|
-import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseLogRecord;
|
|
|
37
|
+import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseMediator;
|
|
39
|
38
|
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.*;
|
|
40
|
39
|
import com.ruoyi.wisdomarbitrate.mapper.dept.DeptIdentifyMapper;
|
|
41
|
40
|
import com.ruoyi.wisdomarbitrate.mapper.dept.MsSealSignRecordMapper;
|
|
|
@@ -764,21 +763,69 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
764
|
763
|
}
|
|
765
|
764
|
|
|
766
|
765
|
} else {
|
|
|
766
|
+ // 查询案件信息
|
|
|
767
|
+ MsCaseApplication application = msCaseApplicationMapper.selectByPrimaryKey(req.getId());
|
|
767
|
768
|
// 根据案件id查询案件相关人
|
|
768
|
769
|
MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(req.getId());
|
|
769
|
|
- if (caseAffiliate == null) {
|
|
|
770
|
+ if (application==null||caseAffiliate == null) {
|
|
770
|
771
|
return AjaxResult.error("该案件不存在");
|
|
771
|
772
|
}
|
|
772
|
773
|
// 锁定该案件
|
|
773
|
|
- req.setLockStatus(YesOrNoEnum.YES.getCode());
|
|
|
774
|
+ application.setLockStatus(YesOrNoEnum.YES.getCode());
|
|
774
|
775
|
Map<Long, MsCaseAffiliate> affiliateMap=new HashMap<>();
|
|
775
|
776
|
affiliateMap.put(req.getId(),caseAffiliate);
|
|
776
|
|
- accept(req,req,affiliateMap);
|
|
|
777
|
+ accept(application,req,affiliateMap);
|
|
777
|
778
|
}
|
|
778
|
779
|
|
|
779
|
780
|
return AjaxResult.success("受理成功");
|
|
780
|
781
|
}
|
|
|
782
|
+ /**
|
|
|
783
|
+ * 案件受理
|
|
|
784
|
+ * @param application
|
|
|
785
|
+ * @param req
|
|
|
786
|
+ * @param affiliateMap
|
|
|
787
|
+ */
|
|
|
788
|
+ private void accept(MsCaseApplication application, MsCaseApplication req, Map<Long, MsCaseAffiliate> affiliateMap) {
|
|
|
789
|
+ application.setUpdateBy(SecurityUtils.getUsername());
|
|
|
790
|
+ application.setUpdateTime(new Date());
|
|
|
791
|
+ application.setBatchNumber(null);
|
|
|
792
|
+ msCaseApplicationMapper.updateByPrimaryKeySelective(application);
|
|
|
793
|
+ MsCaseFlow caseFlow = nextFlow(application.getId(), req.getCaseFlowId(),req.getLockStatus());
|
|
|
794
|
+ // 给申请人被申请人发送短信
|
|
|
795
|
+ if (affiliateMap.containsKey(application.getId())) {
|
|
|
796
|
+ MsCaseAffiliate affiliate = affiliateMap.get(application.getId());
|
|
781
|
797
|
|
|
|
798
|
+ if (StrUtil.isNotEmpty(affiliate.getContactTelphoneAgent())) {
|
|
|
799
|
+ String sendContent = "尊敬的" + affiliate.getNameAgent() + "用户,您的" + application.getCaseNum() + "{2}仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信";
|
|
|
800
|
+ // 给申请人发送案件受理短信 尊敬的{1}用户,您的{2}仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信
|
|
|
801
|
+ Boolean smsFlag = SmsUtils.sendSms(application.getId(), "2049503", affiliate.getContactTelphoneAgent(), new String[]{affiliate.getNameAgent(), application.getCaseNum()});
|
|
|
802
|
+ CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getNodeName(), "向申请人发送短信," + sendContent);
|
|
|
803
|
+ SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), affiliate.getContactTelphoneAgent(), new Date(), sendContent);
|
|
|
804
|
+ if (smsFlag) {
|
|
|
805
|
+ // 发送成功
|
|
|
806
|
+ smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode());
|
|
|
807
|
+ } else {
|
|
|
808
|
+ smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode());
|
|
|
809
|
+ }
|
|
|
810
|
+ smsRecordMapper.saveSmsSendRecord(smsSendRecord);
|
|
|
811
|
+ }
|
|
|
812
|
+ // 给申请人被申请人发送短信
|
|
|
813
|
+ if (StrUtil.isNotEmpty(affiliate.getRespondentPhone())) {
|
|
|
814
|
+ String sendContent = "尊敬的" + affiliate.getRespondentName() + "用户,您的" + application.getCaseNum() + "{2}仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信";
|
|
|
815
|
+ // 给被申请人发送案件受理短信 尊敬的{1}用户,您的{2}仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信
|
|
|
816
|
+ Boolean smsFlag = SmsUtils.sendSms(application.getId(), "2049503", affiliate.getRespondentPhone(), new String[]{affiliate.getRespondentName(), application.getCaseNum()});
|
|
|
817
|
+ CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getNodeName(), "向被申请人发送短信," + sendContent);
|
|
|
818
|
+ SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), affiliate.getRespondentPhone(), new Date(), sendContent);
|
|
|
819
|
+ if (smsFlag) {
|
|
|
820
|
+ // 发送成功
|
|
|
821
|
+ smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode());
|
|
|
822
|
+ } else {
|
|
|
823
|
+ smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode());
|
|
|
824
|
+ }
|
|
|
825
|
+ smsRecordMapper.saveSmsSendRecord(smsSendRecord);
|
|
|
826
|
+ }
|
|
|
827
|
+ }
|
|
|
828
|
+ }
|
|
782
|
829
|
/**
|
|
783
|
830
|
* 案件提交
|
|
784
|
831
|
* @param req
|
|
|
@@ -819,18 +866,10 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
819
|
866
|
return AjaxResult.error("暂无调解员");
|
|
820
|
867
|
}
|
|
821
|
868
|
List<Long> userIds = users.stream().map(SysUser::getUserId).collect(Collectors.toList());
|
|
822
|
|
- // 查询调解员已办数量
|
|
823
|
|
- Map<String, List<MsCaseLogRecord>> recordMap =null;
|
|
824
|
|
- List<MsCaseLogRecord> recordList = caseLogRecordMapper.selectCompleteByCreateBy(users.stream().map(SysUser::getUserName).collect(Collectors.toList()));
|
|
825
|
|
- List<Long> recordCaeIdList = null;
|
|
826
|
|
- if (CollectionUtil.isNotEmpty(recordList)) {
|
|
827
|
|
- // 组装成id对应的list
|
|
828
|
|
- recordMap = recordList.stream().collect(Collectors.groupingBy(MsCaseLogRecord::getCreateBy, Collectors.toList()));
|
|
829
|
|
- recordCaeIdList = recordList.stream().map(MsCaseLogRecord::getCaseAppliId).collect(Collectors.toList());
|
|
830
|
|
- }
|
|
831
|
|
- // 查询待办数量
|
|
|
869
|
+ // todo 状态为未结束的是待办数量,结束的是已办数量
|
|
832
|
870
|
Map<String, List<MsCaseApplication>> caseMap=null;
|
|
833
|
|
- List<MsCaseApplication> caseApplicationList = msCaseApplicationMapper.listMediator(userIds, recordCaeIdList);
|
|
|
871
|
+
|
|
|
872
|
+ List<MsCaseApplication> caseApplicationList = msCaseApplicationMapper.listMediator(userIds);
|
|
834
|
873
|
if (CollectionUtil.isNotEmpty(caseApplicationList)) {
|
|
835
|
874
|
caseMap = caseApplicationList.stream().collect(Collectors.groupingBy(MsCaseApplication::getMediatorId, Collectors.toList()));
|
|
836
|
875
|
|
|
|
@@ -840,66 +879,18 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
840
|
879
|
mediatorVO.setMediatorId(user.getUserId());
|
|
841
|
880
|
mediatorVO.setMediatorName(user.getNickName());
|
|
842
|
881
|
mediatorVO.setSpecialty(user.getSpecialty());
|
|
843
|
|
- if(recordMap!=null &&recordMap.containsKey(String.valueOf(user.getUserName()))) {
|
|
844
|
|
- mediatorVO.setCompleteAmount(recordMap.get(String.valueOf(user.getUserName())).size());
|
|
845
|
|
- }
|
|
|
882
|
+
|
|
846
|
883
|
if(caseMap!=null&&caseMap.containsKey(String.valueOf(user.getUserId()))) {
|
|
847
|
|
- mediatorVO.setTodoAmount(caseMap.get(String.valueOf(user.getUserId())).size());
|
|
|
884
|
+ List<MsCaseApplication> applications = caseMap.get(String.valueOf(user.getUserId()));
|
|
|
885
|
+ // 已办案件
|
|
|
886
|
+ long count = applications.stream().filter(caseApplication -> !caseApplication.getCaseStatusName().equals("结束")).count();
|
|
|
887
|
+ mediatorVO.setTodoAmount(applications.size()-count);
|
|
|
888
|
+ mediatorVO.setCompleteAmount(count);
|
|
848
|
889
|
}
|
|
849
|
890
|
mediatorVOS.add(mediatorVO);
|
|
850
|
891
|
}
|
|
851
|
892
|
return AjaxResult.success(mediatorVOS);
|
|
852
|
893
|
}
|
|
853
|
|
- @Transactional
|
|
854
|
|
- public AjaxResult updateBooking1(BookingVO vo) {
|
|
855
|
|
- // 查询被申请人是否预约过(从日志表查),否则不更新流程节点
|
|
856
|
|
- MsCaseAffiliate msCaseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(vo.getId());
|
|
857
|
|
- if(msCaseAffiliate==null) {
|
|
858
|
|
- return AjaxResult.error("该案件不存在");
|
|
859
|
|
- }
|
|
860
|
|
- MsCaseApplication application = new MsCaseApplication();
|
|
861
|
|
- application.setId(vo.getId());
|
|
862
|
|
- setMediatorAndDate(application,vo);
|
|
863
|
|
- int applicantCount = msCaseApplicationMapper.updateByPrimaryKeySelective(application);
|
|
864
|
|
- if(applicantCount<1){
|
|
865
|
|
- return AjaxResult.error("保存失败");
|
|
866
|
|
- }
|
|
867
|
|
- // 查询当前节点
|
|
868
|
|
- MsCaseFlow currentFlow = caseFlowMapper.selectByPrimaryKey(vo.getCaseFlowId());
|
|
869
|
|
- if(currentFlow==null){
|
|
870
|
|
- return AjaxResult.error("当前流程不存在");
|
|
871
|
|
- }
|
|
872
|
|
- CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),"申请人选择调解员");
|
|
873
|
|
-
|
|
874
|
|
- if(StrUtil.isNotEmpty(msCaseAffiliate.getRespondentIdentityNum())){
|
|
875
|
|
- // 根据身份证查询用户表
|
|
876
|
|
- SysUser user = userMapper.selectUserByIdCard(msCaseAffiliate.getRespondentIdentityNum());
|
|
877
|
|
- if(user!=null){
|
|
878
|
|
- MsCaseFlow nextFlow = caseFlowMapper.nextFlow(vo.getCaseFlowId());
|
|
879
|
|
- if(nextFlow==null){
|
|
880
|
|
- return AjaxResult.error("未找到下一个流程");
|
|
881
|
|
- }
|
|
882
|
|
- // 查询日志中是否有该节点的被申请人操作
|
|
883
|
|
- Example example = new Example(MsCaseLogRecord.class);
|
|
884
|
|
- Example.Criteria criteria = example.createCriteria();
|
|
885
|
|
- criteria.andEqualTo("caseAppliId", vo.getId());
|
|
886
|
|
- criteria.andEqualTo("caseNode", nextFlow.getNodeId());
|
|
887
|
|
- criteria.andEqualTo("caseStatusName", nextFlow.getCaseStatusName());
|
|
888
|
|
- criteria.andEqualTo("createBy", user.getUserName());
|
|
889
|
|
- int count = caseLogRecordMapper.selectCountByExample(example);
|
|
890
|
|
- if(count>0){
|
|
891
|
|
- // 被申请人已预约,更新流程节点
|
|
892
|
|
- // 更改案件流程id和案件状态
|
|
893
|
|
- application.setCaseFlowId(nextFlow.getId());
|
|
894
|
|
- application.setCaseStatusName(nextFlow.getCaseStatusName());
|
|
895
|
|
- application.setLockStatus(null);
|
|
896
|
|
- msCaseApplicationMapper.updateByPrimaryKeySelective(application);
|
|
897
|
|
- // todo 发送短信
|
|
898
|
|
- }
|
|
899
|
|
- }
|
|
900
|
|
- }
|
|
901
|
|
- return AjaxResult.success();
|
|
902
|
|
- }
|
|
903
|
894
|
|
|
904
|
895
|
/**
|
|
905
|
896
|
* 申请人/被申请人预约
|
|
|
@@ -1073,22 +1064,11 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
1073
|
1064
|
if(user==null){
|
|
1074
|
1065
|
return AjaxResult.error("调解员已被删除");
|
|
1075
|
1066
|
}
|
|
1076
|
|
- // 查询调解员已办数量
|
|
1077
|
|
- Map<String, List<MsCaseLogRecord>> recordMap =null;
|
|
1078
|
|
- List<String> mediatorNames = new ArrayList<>();
|
|
1079
|
|
- mediatorNames.add(user.getUserName());
|
|
1080
|
|
- List<MsCaseLogRecord> recordList = caseLogRecordMapper.selectCompleteByCreateBy(mediatorNames);
|
|
1081
|
|
- List<Long> recordCaeIdList = null;
|
|
1082
|
|
- if (CollectionUtil.isNotEmpty(recordList)) {
|
|
1083
|
|
- // 组装成id对应的list
|
|
1084
|
|
- recordMap = recordList.stream().collect(Collectors.groupingBy(MsCaseLogRecord::getCreateBy, Collectors.toList()));
|
|
1085
|
|
- recordCaeIdList = recordList.stream().map(MsCaseLogRecord::getCaseAppliId).collect(Collectors.toList());
|
|
1086
|
|
- }
|
|
1087
|
1067
|
// 查询待办数量
|
|
1088
|
1068
|
List<Long> mediatorIds = new ArrayList<>();
|
|
1089
|
1069
|
mediatorIds.add(user.getUserId());
|
|
1090
|
1070
|
Map<String, List<MsCaseApplication>> caseMap=null;
|
|
1091
|
|
- List<MsCaseApplication> caseApplicationList = msCaseApplicationMapper.listMediator(mediatorIds, recordCaeIdList);
|
|
|
1071
|
+ List<MsCaseApplication> caseApplicationList = msCaseApplicationMapper.listMediator(mediatorIds);
|
|
1092
|
1072
|
if (CollectionUtil.isNotEmpty(caseApplicationList)) {
|
|
1093
|
1073
|
caseMap = caseApplicationList.stream().collect(Collectors.groupingBy(MsCaseApplication::getMediatorId, Collectors.toList()));
|
|
1094
|
1074
|
|
|
|
@@ -1097,11 +1077,13 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
1097
|
1077
|
mediatorVO.setMediatorId(user.getUserId());
|
|
1098
|
1078
|
mediatorVO.setMediatorName(user.getNickName());
|
|
1099
|
1079
|
mediatorVO.setSpecialty(user.getSpecialty());
|
|
1100
|
|
- if(recordMap!=null &&recordMap.containsKey(String.valueOf(user.getUserName()))) {
|
|
1101
|
|
- mediatorVO.setCompleteAmount(recordMap.get(String.valueOf(user.getUserName())).size());
|
|
1102
|
|
- }
|
|
|
1080
|
+
|
|
1103
|
1081
|
if(caseMap!=null&&caseMap.containsKey(String.valueOf(user.getUserId()))) {
|
|
1104
|
|
- mediatorVO.setTodoAmount(caseMap.get(String.valueOf(user.getUserId())).size());
|
|
|
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);
|
|
1105
|
1087
|
}
|
|
1106
|
1088
|
List<MediatorVO> mediatorVOS = new ArrayList<>();
|
|
1107
|
1089
|
mediatorVOS.add(mediatorVO);
|
|
|
@@ -1740,53 +1722,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
|
|
1740
|
1722
|
|
|
1741
|
1723
|
}
|
|
1742
|
1724
|
|
|
1743
|
|
- /**
|
|
1744
|
|
- * 案件受理
|
|
1745
|
|
- * @param application
|
|
1746
|
|
- * @param req
|
|
1747
|
|
- * @param affiliateMap
|
|
1748
|
|
- */
|
|
1749
|
|
- private void accept(MsCaseApplication application, MsCaseApplication req, Map<Long, MsCaseAffiliate> affiliateMap) {
|
|
1750
|
|
- application.setUpdateBy(SecurityUtils.getUsername());
|
|
1751
|
|
- application.setUpdateTime(new Date());
|
|
1752
|
|
- application.setBatchNumber(null);
|
|
1753
|
|
- msCaseApplicationMapper.updateByPrimaryKeySelective(application);
|
|
1754
|
|
- MsCaseFlow caseFlow = nextFlow(application.getId(), req.getCaseFlowId(),req.getLockStatus());
|
|
1755
|
|
- // 给申请人被申请人发送短信
|
|
1756
|
|
- if (affiliateMap.containsKey(application.getId())) {
|
|
1757
|
|
- MsCaseAffiliate affiliate = affiliateMap.get(application.getId());
|
|
1758
|
1725
|
|
|
1759
|
|
- if (StrUtil.isNotEmpty(affiliate.getContactTelphoneAgent())) {
|
|
1760
|
|
- String sendContent = "尊敬的" + affiliate.getNameAgent() + "用户,您的" + application.getCaseNum() + "{2}仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信";
|
|
1761
|
|
- // 给申请人发送案件受理短信 尊敬的{1}用户,您的{2}仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信
|
|
1762
|
|
- Boolean smsFlag = SmsUtils.sendSms(application.getId(), "2049503", affiliate.getContactTelphoneAgent(), new String[]{affiliate.getNameAgent(), application.getCaseNum()});
|
|
1763
|
|
- CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getNodeName(), "向申请人发送短信," + sendContent);
|
|
1764
|
|
- SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), affiliate.getContactTelphoneAgent(), new Date(), sendContent);
|
|
1765
|
|
- if (smsFlag) {
|
|
1766
|
|
- // 发送成功
|
|
1767
|
|
- smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode());
|
|
1768
|
|
- } else {
|
|
1769
|
|
- smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode());
|
|
1770
|
|
- }
|
|
1771
|
|
- smsRecordMapper.saveSmsSendRecord(smsSendRecord);
|
|
1772
|
|
- }
|
|
1773
|
|
- // 给申请人被申请人发送短信
|
|
1774
|
|
- if (StrUtil.isNotEmpty(affiliate.getRespondentPhone())) {
|
|
1775
|
|
- String sendContent = "尊敬的" + affiliate.getRespondentName() + "用户,您的" + application.getCaseNum() + "{2}仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信";
|
|
1776
|
|
- // 给被申请人发送案件受理短信 尊敬的{1}用户,您的{2}仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信
|
|
1777
|
|
- Boolean smsFlag = SmsUtils.sendSms(application.getId(), "2049503", affiliate.getRespondentPhone(), new String[]{affiliate.getRespondentName(), application.getCaseNum()});
|
|
1778
|
|
- CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getNodeName(), "向被申请人发送短信," + sendContent);
|
|
1779
|
|
- SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), affiliate.getRespondentPhone(), new Date(), sendContent);
|
|
1780
|
|
- if (smsFlag) {
|
|
1781
|
|
- // 发送成功
|
|
1782
|
|
- smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode());
|
|
1783
|
|
- } else {
|
|
1784
|
|
- smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode());
|
|
1785
|
|
- }
|
|
1786
|
|
- smsRecordMapper.saveSmsSendRecord(smsSendRecord);
|
|
1787
|
|
- }
|
|
1788
|
|
- }
|
|
1789
|
|
- }
|
|
1790
|
1726
|
|
|
1791
|
1727
|
/**
|
|
1792
|
1728
|
* 流向下一个流程节点
|