案件受理

This commit is contained in:
18792927508
2024-01-31 17:33:24 +08:00
parent 8b1da3b4d9
commit fe51b4f655
10 changed files with 237 additions and 36 deletions
@@ -173,6 +173,7 @@ public class MsCaseApplication {
/**
* 版本号
*/
@Column(name = "version")
private Integer version;
/**
@@ -184,6 +185,7 @@ public class MsCaseApplication {
/**
* 事实和理由
*/
@Column(name = "facts")
private String facts;
@@ -57,5 +57,13 @@ public class MsCaseApplicationVO extends MsCaseApplication {
* 待办状态,0-待办,1-已办
*/
private Integer pendingStatus;
/**
* 是否同意。0-拒绝,1-同意
*/
private Integer agreeFlag;
/**
* 拒绝原因
*/
private String rejectReason;
}
@@ -117,7 +117,7 @@ public interface MsCaseApplicationService {
* @param req
* @return
*/
AjaxResult accept(MsCaseApplication req);
AjaxResult accept(MsCaseApplicationVO req);
/**
* 案件提交
@@ -189,7 +189,7 @@ public interface MsCaseApplicationService {
* @param req
* @param affiliateMap
*/
void accept(MsCaseApplication application, MsCaseApplication req, Map<Long, MsCaseAffiliate> affiliateMap) ;
void accept(MsCaseApplication application, MsCaseApplicationVO req, Map<Long, MsCaseAffiliate> affiliateMap) ;
/**
* 判断申请人/被申请人是否预约
* @param vo
@@ -202,4 +202,10 @@ public interface MsCaseApplicationService {
* @return
*/
void verifyMediator(MsCaseApplication application,BookingVO vo);
/**
* 案件不予受理
* @param caseId
*/
void notAccept(String caseId,String reason);
}
@@ -1,8 +1,10 @@
package com.ruoyi.wisdomarbitrate.service.mscase;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.entity.flow.MsCaseFlow;
import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseConfirmPayDTO;
import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CasePayDTO;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.PaymentDetailVO;
public interface MsCasePaymentService {
@@ -32,5 +34,27 @@ public interface MsCasePaymentService {
*/
PaymentDetailVO selectPaymentDetail(Long id);
/**
* 确认已缴费
* @param dto
* @return
*/
AjaxResult confirmPaid(CaseConfirmPayDTO dto);
/**
* 确认已缴费
* @param currentFlow
* @param nextFlow
* @param application
*/
public void confirmPaid(MsCaseFlow currentFlow, MsCaseFlow nextFlow, MsCaseApplication application);
/**
* 确认缴费
*
* @param nextFlow
* @param application
* @param dto
*/
public void confirmPayment(MsCaseFlow currentFlow,MsCaseFlow nextFlow, MsCaseApplication application, CaseConfirmPayDTO dto);
}
@@ -331,7 +331,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
// 生成调解申请书
req.setTemplateId(String.valueOf(templateManage.getId()));
// todo 部署放开
// caseApplicationService.generateApplication(req);
caseApplicationService.generateApplication(req);
}
@@ -523,17 +523,14 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
@Override
public AjaxResult uploadCaseZipFile(MultipartFile file, Long templateId) {
UUID uuid = UUID.randomUUID();
// todo 压缩包解压路径
// 压缩包解压路径
String targetPath = "/home/ruoyi/uploadPath/upload/unzipFile/" + uuid + "/";
// String targetPath = "D:/home/ruoyi/uploadPath/upload/unzipFile/"+uuid+ "/";
File zipFile = null;
InputStream ins = null;
try {
ins = file.getInputStream();
//上传的压缩包保存的路径
// todo
String savePath = "/home/ruoyi/uploadPath/upload/zipFile/";
// String savePath = "D:/home/ruoyi/uploadPath/upload/zipFile/";
String saveName = uuid + "_" + file.getOriginalFilename();
zipFile = new File(savePath + saveName);
inputChangeToFile(ins, zipFile);
@@ -813,7 +810,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
*/
@Transactional
@Override
public AjaxResult accept(MsCaseApplication req) {
public AjaxResult accept(MsCaseApplicationVO req) {
if (StrUtil.isNotEmpty(req.getBatchNumber())) {
// 根据批号查询未锁定的案件
List<MsCaseApplication> applicationList = listByBatchNumber(req.getBatchNumber(), req.getCaseFlowId());
@@ -829,25 +826,43 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
}
Map<Long, MsCaseAffiliate> affiliateMap = affiliateList.stream().collect(Collectors.toMap(MsCaseAffiliate::getCaseAppliId, Function.identity()));
for (MsCaseApplication application : applicationList) {
caseApplicationService.accept(application,req,affiliateMap);
// 不受理
if(req.getAgreeFlag().equals(YesOrNoEnum.NO.getCode())){
if(StrUtil.isEmpty(req.getRejectReason())){
throw new ServiceException("请填写拒绝原因");
}
caseApplicationService.notAccept(String.valueOf(req.getId()),req.getRejectReason());
}else {
caseApplicationService.accept(application,req,affiliateMap);
}
}
} else {
// 查询案件信息
MsCaseApplication application = msCaseApplicationMapper.selectByPrimaryKey(req.getId());
// 根据案件id查询案件相关人
MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(req.getId());
if (application==null||caseAffiliate == null) {
return AjaxResult.error("该案件不存在");
// 不受理
if(req.getAgreeFlag().equals(YesOrNoEnum.NO.getCode())){
if(StrUtil.isEmpty(req.getRejectReason())){
throw new ServiceException("请填写拒绝原因");
}
caseApplicationService.notAccept(String.valueOf(req.getId()),req.getRejectReason());
}else {
// 查询案件信息
MsCaseApplication application = msCaseApplicationMapper.selectByPrimaryKey(req.getId());
// 根据案件id查询案件相关人
MsCaseAffiliate caseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(req.getId());
if (application==null||caseAffiliate == null) {
return AjaxResult.error("该案件不存在");
}
// 锁定该案件
application.setLockStatus(YesOrNoEnum.YES.getCode());
Map<Long, MsCaseAffiliate> affiliateMap=new HashMap<>();
affiliateMap.put(req.getId(),caseAffiliate);
caseApplicationService.accept(application,req,affiliateMap);
}
// 锁定该案件
application.setLockStatus(YesOrNoEnum.YES.getCode());
Map<Long, MsCaseAffiliate> affiliateMap=new HashMap<>();
affiliateMap.put(req.getId(),caseAffiliate);
caseApplicationService.accept(application,req,affiliateMap);
}
return AjaxResult.success("受理成功");
return AjaxResult.success();
}
/**
* 案件受理
@@ -856,7 +871,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
* @param affiliateMap
*/
@Transactional
public void accept(MsCaseApplication application, MsCaseApplication req, Map<Long, MsCaseAffiliate> affiliateMap) {
public void accept(MsCaseApplication application, MsCaseApplicationVO req, Map<Long, MsCaseAffiliate> affiliateMap) {
application.setPaperFlag(req.getPaperFlag());
application.setArbitrateConfirm(req.getArbitrateConfirm());
application.setMediationMethod(req.getMediationMethod());
@@ -870,7 +887,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
MsCaseAffiliate affiliate = affiliateMap.get(application.getId());
if (StrUtil.isNotEmpty(affiliate.getContactTelphoneAgent())) {
String sendContent = "尊敬的" + affiliate.getNameAgent() + "用户,您的" + application.getCaseNum() + "{2}仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信";
String sendContent = "尊敬的" + affiliate.getNameAgent() + "用户,您的" + application.getCaseNum() + "仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信";
// 给申请人发送案件受理短信 尊敬的{1}用户,您的{2}仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信
Boolean smsFlag = SmsUtils.sendSms(application.getId(), "2049503", affiliate.getContactTelphoneAgent(), new String[]{affiliate.getNameAgent(), application.getCaseNum()});
CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getNodeName(), "向申请人发送短信," + sendContent);
@@ -885,7 +902,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
}
// 给申请人被申请人发送短信
if (StrUtil.isNotEmpty(affiliate.getRespondentPhone())) {
String sendContent = "尊敬的" + affiliate.getRespondentName() + "用户,您的" + application.getCaseNum() + "{2}仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信";
String sendContent = "尊敬的" + affiliate.getRespondentName() + "用户,您的" + application.getCaseNum() + "仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信";
// 给被申请人发送案件受理短信 尊敬的{1}用户,您的{2}仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信
Boolean smsFlag = SmsUtils.sendSms(application.getId(), "2049503", affiliate.getRespondentPhone(), new String[]{affiliate.getRespondentName(), application.getCaseNum()});
CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getNodeName(), "向被申请人发送短信," + sendContent);
@@ -1167,6 +1184,64 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
CaseLogUtils.insertCaseLog(application.getId(), nextFlow.getNodeId(), nextFlow.getCaseStatusName(), "");
}
/**
* 案件不予受理
* @param caseId
*/
@Transactional
@Override
public void notAccept(String caseId,String reason) {
if(StrUtil.isEmpty(caseId)){
return;
}
Long id = Long.valueOf(caseId);
// 根据案件id查询案件
MsCaseApplication application = msCaseApplicationMapper.selectByPrimaryKey(id);
MsCaseAffiliate affiliate = msCaseAffiliateMapper.selectByPrimaryKey(id);
if(application==null || affiliate==null){
return;
}
if(application.getCaseFlowId()!=null && application.getCaseFlowId()==4){
// 超过五日还没有受理,给申请人发送不受理通知
String phone="";
if(affiliate.getOrganizeFlag().equals(0)){
// 自然人
if(StrUtil.isNotEmpty(affiliate.getContactTelphoneAgent())){
phone=affiliate.getContactTelphoneAgent();
}else {
phone=affiliate.getApplicationPhone();
}
}else {
phone=affiliate.getContactTelphoneAgent();
}
if(StrUtil.isNotEmpty(phone)) {
// 发送短信 2065809 案件不予受理通知 尊敬的用户,您编号为{1}的案件由于{2}所以不予受理,请知晓,如非本人操作,请忽略本短信。
Boolean smsFlag = SmsUtils.sendSms(id, "2065809", phone, new String[]{application.getCaseNum(),reason});
String sendContent = "尊敬的用户,您编号为" + application.getCaseNum() + "的案件由于"+reason+"所以不予受理,请知晓,如非本人操作,请忽略本短信。";
CaseLogUtils.insertCaseLog(application.getId(), application.getCaseFlowId(), application.getCaseStatusName(), sendContent);
// 新增短信记录
SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), phone, new Date(), sendContent);
if(smsFlag){
smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode());
}else {
smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode());
}
smsRecordMapper.saveSmsSendRecord(smsSendRecord);
}
// 修改案件状态为17,结束
MsCaseApplication caseApplication = new MsCaseApplication();
caseApplication.setId(id);
caseApplication.setCaseFlowId(17);
caseApplication.setCaseStatusName("结束");
msCaseApplicationMapper.updateByPrimaryKeySelective(caseApplication);
CaseLogUtils.insertCaseLog(application.getId(), 17, "结束", null);
}
}
/**
* 查询预约信息
* @param id
@@ -5,16 +5,20 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import com.ruoyi.ElegentPay;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.enums.AnnexTypeEnum;
import com.ruoyi.common.enums.PaymentStatusEnum;
import com.ruoyi.common.enums.YesOrNoEnum;
import com.ruoyi.common.utils.SmsUtils;
import com.ruoyi.dto.PayRequest;
import com.ruoyi.dto.PayResponse;
import com.ruoyi.system.domain.entity.flow.MsCaseFlow;
import com.ruoyi.system.mapper.flow.MsCaseFlowMapper;
import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseConfirmPayDTO;
import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CasePayDTO;
import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAffiliate;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach;
@@ -38,6 +42,7 @@ import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
@Service
public class MsCasePaymentServiceImpl implements MsCasePaymentService {
@@ -57,6 +62,10 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
MsCaseFlowMapper caseFlowMapper;
@Autowired
MsCaseAffiliateMapper caseAffiliateMapper;
@Autowired
MsCasePaymentService casePaymentService;
@Autowired
private RedisCache redisCache;
@Override
@@ -161,7 +170,7 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
return AjaxResult.error("该批号下未找到案件");
}
for (MsCaseApplication application : applicationList) {
confirmPayment(currentFlow,nextFlow, application, dto);
casePaymentService.confirmPayment(currentFlow,nextFlow, application, dto);
}
} else {
@@ -169,7 +178,7 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
MsCaseApplication application = new MsCaseApplication();
application.setId(dto.getCaseId());
application.setLockStatus(YesOrNoEnum.YES.getCode());
confirmPayment(currentFlow,nextFlow, application, dto);
casePaymentService.confirmPayment(currentFlow,nextFlow, application, dto);
}
return AjaxResult.success("确认缴费成功");
@@ -277,13 +286,13 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
return AjaxResult.error("该批号下未找到案件");
}
for (MsCaseApplication application : applicationList) {
confirmPaid(currentFlow,nextFlow, application);
casePaymentService.confirmPaid(currentFlow,nextFlow, application);
}
}else {
MsCaseApplication caseApplication=new MsCaseApplication();
caseApplication.setId(dto.getCaseId());
caseApplication.setLockStatus(YesOrNoEnum.YES.getCode());
confirmPaid(currentFlow,nextFlow,caseApplication );
casePaymentService.confirmPaid(currentFlow,nextFlow,caseApplication );
}
@@ -296,7 +305,13 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
* @param application
* @param
*/
private void confirmPaid(MsCaseFlow currentFlow,MsCaseFlow nextFlow, MsCaseApplication application) {
@Transactional
public void confirmPaid(MsCaseFlow currentFlow,MsCaseFlow nextFlow, MsCaseApplication application) {
// 查询案件
MsCaseApplication caseAppllication = caseApplicationMapper.selectByPrimaryKey(application.getId());
if(caseAppllication==null){
throw new RuntimeException("未找到该案件");
}
//更改记录表里的支付状态和支付时间
MsCasePaymentRecord casePaymentRecord = new MsCasePaymentRecord();
casePaymentRecord.setPaymentStatus(1);
@@ -310,11 +325,46 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
application.setCaseFlowId(nextFlow.getId());
application.setCaseStatusName(nextFlow.getCaseStatusName());
caseApplicationMapper.updateByPrimaryKeySelective(application);
// 将该案件存放到redis,5日之内如果案件状态还是待受理状态,则发送不受理通知书并自动结束
redisCache.setCacheObject(String.valueOf(application.getId()), application, Constants.CASE_ACCEPT_EXPIRATION, TimeUnit.DAYS);
// 新增日志
CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),"确认已缴费");
// todo 发送短信
// 查询申请人电话,如果是自然人,代理人不为空,则给代理人发短信,代理人为空,给申请人发短信
MsCaseAffiliate affiliate = caseAffiliateMapper.selectByPrimaryKey(application.getId());
if(affiliate != null) {
String phone="";
String userName="";
if(affiliate.getOrganizeFlag().equals(0)){
// 自然人
if(StrUtil.isNotEmpty(affiliate.getContactTelphoneAgent())){
phone=affiliate.getContactTelphoneAgent();
userName=affiliate.getNameAgent();
}else {
phone=affiliate.getApplicationPhone();
userName=affiliate.getApplicationName();
}
}else {
phone=affiliate.getContactTelphoneAgent();
userName=affiliate.getNameAgent();
}
if(StrUtil.isNotEmpty(phone)) {
// 发送短信 2051914 调解缴费成功通知 尊敬的{1},您的调解申请费用已缴费成功。
Boolean smsFlag = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2051914", phone, new String[]{userName});
CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "申请人调解缴费成功通知短信,尊敬的" + userName + ",您的调解申请费用已缴费成功。");
// 新增短信记录
SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), caseAppllication.getCaseNum(), phone, new Date(), "尊敬的" + userName + ",您的调解申请费用已缴费成功。");
if(smsFlag){
smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode());
}else {
smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode());
}
smsRecordMapper.saveSmsSendRecord(smsSendRecord);
}
}
}
/**
@@ -324,8 +374,8 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
* @param application
* @param dto
*/
private void confirmPayment(MsCaseFlow currentFlow,MsCaseFlow nextFlow, MsCaseApplication application, CaseConfirmPayDTO dto) {
@Transactional
public void confirmPayment(MsCaseFlow currentFlow,MsCaseFlow nextFlow, MsCaseApplication application, CaseConfirmPayDTO dto) {
application.setPayType(dto.getPayType());
// 修改缴费附件
if (CollectionUtil.isNotEmpty(dto.getPayOrderList())) {