Merge branch 'wq1' of SH-Arbitrate/Mediation-Backend into dev

This commit was merged in pull request #82.
This commit is contained in:
2024-02-21 09:38:22 +08:00
committed by Gitea
14 changed files with 388 additions and 83 deletions
@@ -10,6 +10,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.exception.EsignDemoException; import com.ruoyi.common.exception.EsignDemoException;
import com.ruoyi.common.utils.IdCardUtils; import com.ruoyi.common.utils.IdCardUtils;
import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.*; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.*;
@@ -354,4 +355,15 @@ public class MsCaseApplicationController extends BaseController {
return success(videoService.reserveConferenceList(caseId)); return success(videoService.reserveConferenceList(caseId));
} }
/**
* 查询短信发送记录
* @param smsSendRecord
* @return
*/
@PostMapping("/smsRecord")
public TableDataInfo getSmsSendRecord(@RequestBody SmsSendRecord smsSendRecord){
startPage();
List<SmsSendRecord> list = caseApplicationService.getSmsSendRecord(smsSendRecord);
return getDataTable(list);
}
} }
@@ -65,7 +65,7 @@ public class MsCaseApplicationPayController extends BaseController {
} }
/** /**
* 确认缴费,支持批量(batchNumber不为空,则为批量) * 申请人/被申请人确认缴费,支持批量(batchNumber不为空,则为批量)
* @param dto 缴费传入参数 * @param dto 缴费传入参数
* @return 统一响应结果 * @return 统一响应结果
*/ */
@@ -79,7 +79,7 @@ public class MsCaseApplicationPayController extends BaseController {
return casePaymentService.confirmPayment(dto); return casePaymentService.confirmPayment(dto);
} }
/** /**
* 确认已缴费,支持批量(batchNumber不为空,则为批量) * 财务确认已缴费,支持批量(batchNumber不为空,则为批量)
* @param dto 缴费传入参数 * @param dto 缴费传入参数
* @return 统一响应结果 * @return 统一响应结果
*/ */
@@ -91,5 +91,17 @@ public class MsCaseApplicationPayController extends BaseController {
} }
return casePaymentService.confirmPaid(dto); return casePaymentService.confirmPaid(dto);
} }
/**
* 财务确认被申请人已缴费,支持批量(batchNumber不为空,则为批量)
* @param dto 缴费传入参数
* @return 统一响应结果
*/
@PostMapping("/resConfirmPaid")
public AjaxResult resConfirmPaid(@RequestBody CaseConfirmPayDTO dto) {
if ((dto.getCaseId() == null && StrUtil.isEmpty(dto.getBatchNumber()))
|| dto.getCaseFlowId() == null) {
return error("参数校验失败");
}
return casePaymentService.confirmPaid(dto);
}
} }
@@ -30,5 +30,17 @@ public class CaseConfirmPayDTO {
* 缴费凭证 * 缴费凭证
*/ */
private List<MsCaseAttach> payOrderList; private List<MsCaseAttach> payOrderList;
/**
* 是否同意,0-拒绝,1-同意
*/
private Integer yesOrNo;
/**
* 拒绝原因
*/
private String reason;
/**
* 是否申请人确认缴费
*/
private Boolean applicantConfirm=true;
} }
@@ -0,0 +1,68 @@
package com.ruoyi.wisdomarbitrate.domain.entity.mscase;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;
@Getter
@Setter
@ToString
@Table(name = "ms_case_audit")
public class MsCaseAudit {
@Id
@GeneratedValue(generator = "JDBC")
private Long id;
/**
* 案件申请id
*/
@Column(name = "case_appli_id")
private Long caseAppliId;
/**
* 案件节点
*/
@Column(name = "case_node")
private Integer caseNode;
/**
* 案件状态
*/
@Column(name = "case_status_name")
private String caseStatusName;
/**
* 是否同意,0-拒绝,1-同意,默认1同意
*/
@Column(name = "yes_or_no")
private Integer yesOrNo;
/**
* 操作人用户名
*/
@Column(name = "create_by")
private String createBy;
/**
* 操作人用户昵称
*/
@Column(name = "create_nick_name")
private String createNickName;
/**
* 创建时间
*/
@Column(name = "create_time")
private Date createTime;
/**
* 拒绝原因
*/
private String reason;
}
@@ -95,6 +95,10 @@ public class MsCaseApplicationReq {
* 是否小程序,1-是 * 是否小程序,1-是
*/ */
private Integer miniProgressFlag ; private Integer miniProgressFlag ;
/**
* 是否线上调解,1-线上调解
*/
private Integer mediationMethod ;
/** /**
* 附件 * 附件
*/ */
@@ -69,6 +69,10 @@ public class MsCaseApplicationVO extends MsCaseApplication {
* 调解方式名称,1-线上调解,2-线下调解 * 调解方式名称,1-线上调解,2-线下调解
*/ */
private String mediationMethodName; private String mediationMethodName;
/**
* 缴费拒绝原因
*/
private String reason;
} }
@@ -58,7 +58,12 @@ public interface MsCaseApplicationMapper extends Mapper<MsCaseApplication> {
"</if> " + "</if> " +
"<if test=\"req.caseFlowId != null \">" + "<if test=\"req.caseFlowId != null \">" +
" AND c.case_flow_id = #{req.caseFlowId} " + " AND c.case_flow_id = #{req.caseFlowId} " +
"</if> " + "</if> "
+
"<if test=\"req.mediationMethod != null \">" +
" AND c.mediation_method = #{req.mediationMethod} " +
"</if> "
+
"<if test=\"req.caseNum != null and req.caseNum != ''\">" + "<if test=\"req.caseNum != null and req.caseNum != ''\">" +
" AND c.case_num like concat('%', #{req.caseNum}, '%') "+ " AND c.case_num like concat('%', #{req.caseNum}, '%') "+
"</if> " "</if> "
@@ -82,6 +87,11 @@ public interface MsCaseApplicationMapper extends Mapper<MsCaseApplication> {
"join ms_case_affiliate a on c.id=a.case_appli_id <where> r.create_by=#{req.userName} and c.id not in (" + "join ms_case_affiliate a on c.id=a.case_appli_id <where> r.create_by=#{req.userName} and c.id not in (" +
"select c1.id from ms_case_application c1 JOIN ms_case_affiliate a1 ON a1.case_appli_id = c1.id" "select c1.id from ms_case_application c1 JOIN ms_case_affiliate a1 ON a1.case_appli_id = c1.id"
+ +
"<if test=\"req.mediationMethod != null \">" +
" AND c.mediation_method = #{req.mediationMethod} " +
"</if> "
+
"<if test='req.applicantFlag != null and req.applicationOrganIds != null and req.applicationOrganIds.size() > 0 '> and a.application_id in" + "<if test='req.applicantFlag != null and req.applicationOrganIds != null and req.applicationOrganIds.size() > 0 '> and a.application_id in" +
"<foreach item='organId' index='index' collection='req.applicationOrganIds' open='(' separator=',' close=')'>" + "<foreach item='organId' index='index' collection='req.applicationOrganIds' open='(' separator=',' close=')'>" +
"#{organId}" + "#{organId}" +
@@ -0,0 +1,17 @@
package com.ruoyi.wisdomarbitrate.mapper.mscase;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAudit;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;
public interface MsCaseAuditMapper extends Mapper<MsCaseAudit> {
/**
* 查询拒绝原因
* @param id
* @param caseFlowId
* @return
*/
@Select("select reason from ms_case_audit where case_appli_id=#{caseAppliId} and case_node=#{caseFlowId} order by id desc limit 1")
String selectByCaseId(@Param("caseAppliId") Long id, @Param("caseFlowId") Integer caseFlowId);
}
@@ -5,6 +5,7 @@ import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.exception.EsignDemoException; import com.ruoyi.common.exception.EsignDemoException;
import com.ruoyi.system.domain.entity.flow.MsCaseFlow; import com.ruoyi.system.domain.entity.flow.MsCaseFlow;
import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAffiliate; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAffiliate;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach;
@@ -220,4 +221,10 @@ public interface MsCaseApplicationService {
* 根据登录人返回用户信息 * 根据登录人返回用户信息
*/ */
SysUser getUserInfo(); SysUser getUserInfo();
/**
* 查询短信发送记录
* @param smsSendRecord
* @return
*/
List<SmsSendRecord> getSmsSendRecord(SmsSendRecord smsSendRecord);
} }
@@ -47,7 +47,14 @@ public interface MsCasePaymentService {
* @param nextFlow * @param nextFlow
* @param application * @param application
*/ */
public void confirmPaid(MsCaseFlow currentFlow, MsCaseFlow nextFlow, MsCaseApplication application); public void confirmPaid(CaseConfirmPayDTO dto,MsCaseFlow currentFlow, MsCaseFlow nextFlow, MsCaseApplication application);
/**
* 被申请人确认已缴费
* @param dto
* @return
*/
AjaxResult resConfirmPaid(CaseConfirmPayDTO dto);
/** /**
* 确认缴费 * 确认缴费
* *
@@ -140,6 +140,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
private SealManageMapper sealManageMapper; private SealManageMapper sealManageMapper;
@Autowired @Autowired
private MsSealSignRecordMapper sealSignRecordMapper; private MsSealSignRecordMapper sealSignRecordMapper;
@Autowired
private MsCaseAuditMapper auditMapper;
// 案件基本字段 // 案件基本字段
public static final List<String> CASE_BASE_COLUMN = Arrays.asList("caseSubjectAmount", "arbitratClaims", "facts", "requestRule"); public static final List<String> CASE_BASE_COLUMN = Arrays.asList("caseSubjectAmount", "arbitratClaims", "facts", "requestRule");
public static final SimpleDateFormat yyyymmddFormat = new SimpleDateFormat("yyyy-MM-dd"); public static final SimpleDateFormat yyyymmddFormat = new SimpleDateFormat("yyyy-MM-dd");
@@ -207,6 +209,10 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
} }
} }
} }
if(req.getMediationMethod()!=null){
// 查询视频审理
req.setCaseFlowId(9);
}
startPage(); startPage();
// 查询案件列表 // 查询案件列表
return msCaseApplicationMapper.list(req, caseStatusNames); return msCaseApplicationMapper.list(req, caseStatusNames);
@@ -226,6 +232,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
// 自定义字段 // 自定义字段
List<MsColumnValueVO> columnValueVOS = columnValueMapper.listByCaseId(id); List<MsColumnValueVO> columnValueVOS = columnValueMapper.listByCaseId(id);
vo.setColumnValueList(columnValueVOS); vo.setColumnValueList(columnValueVOS);
// 查询拒绝原因
vo.setReason(auditMapper.selectByCaseId(id,caseApplication.getCaseFlowId()));
return vo; return vo;
} }
@@ -314,7 +322,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
if (StrUtil.isNotEmpty(affiliate.getRespondentEmail())) { if (StrUtil.isNotEmpty(affiliate.getRespondentEmail())) {
affiliate.setRespondentEmail(affiliate.getRespondentEmail().replace("\n", "").replaceAll("\\s", "")); affiliate.setRespondentEmail(affiliate.getRespondentEmail().replace("\n", "").replaceAll("\\s", ""));
} }
msCaseAffiliateMapper.insert(affiliate); msCaseAffiliateMapper.insert(affiliate);
// 批量生成调解申请书 // 批量生成调解申请书
MsCaseApplicationReq req = new MsCaseApplicationReq(); MsCaseApplicationReq req = new MsCaseApplicationReq();
req.setCaseFlowId(caseFlow.getId()); req.setCaseFlowId(caseFlow.getId());
@@ -326,6 +334,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
} }
// 生成调解申请书 // 生成调解申请书
req.setTemplateType(TemplateTypeEnum.MEDIATION_APPLICATION.getCode()); req.setTemplateType(TemplateTypeEnum.MEDIATION_APPLICATION.getCode());
req.setTemplateId(String.valueOf(templateId));
caseApplicationService.generateApplication(req); caseApplicationService.generateApplication(req);
// 保存案件附件 // 保存案件附件
@@ -876,8 +885,6 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
*/ */
@Transactional @Transactional
public void accept(MsCaseApplication application, MsCaseApplicationVO req, Map<Long, MsCaseAffiliate> affiliateMap) { public void accept(MsCaseApplication application, MsCaseApplicationVO req, Map<Long, MsCaseAffiliate> affiliateMap) {
application.setPaperFlag(req.getPaperFlag()); application.setPaperFlag(req.getPaperFlag());
application.setArbitrateConfirm(req.getArbitrateConfirm()); application.setArbitrateConfirm(req.getArbitrateConfirm());
application.setMediationMethod(req.getMediationMethod()); application.setMediationMethod(req.getMediationMethod());
@@ -885,30 +892,30 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
application.setUpdateTime(new Date()); application.setUpdateTime(new Date());
application.setBatchNumber(null); application.setBatchNumber(null);
msCaseApplicationMapper.updateByPrimaryKeySelective(application); msCaseApplicationMapper.updateByPrimaryKeySelective(application);
MsCaseFlow caseFlow = caseApplicationService.nextFlow(application.getId(), req.getCaseFlowId(),req.getLockStatus()); // MsCaseFlow caseFlow = caseApplicationService.nextFlow(application.getId(), req.getCaseFlowId(),req.getLockStatus());
// 给申请人被申请人发送短信 // 给申请人被申请人发送短信
if (affiliateMap.containsKey(application.getId())) { if (affiliateMap.containsKey(application.getId())) {
MsCaseAffiliate affiliate = affiliateMap.get(application.getId()); MsCaseAffiliate affiliate = affiliateMap.get(application.getId());
if (StrUtil.isNotEmpty(affiliate.getContactTelphoneAgent())) { // if (StrUtil.isNotEmpty(affiliate.getContactTelphoneAgent())||StrUtil.isNotEmpty(affiliate.getApplicationPhone())) {
String sendContent = "尊敬的" + affiliate.getNameAgent() + "用户,您的" + application.getCaseNum() + "案件,已成功受理,请知晓,如非本人操作,请忽略本短信"; // String sendContent = "尊敬的" + affiliate.getNameAgent() + "用户,您的" + application.getCaseNum() + "案件,已成功受理,请知晓,如非本人操作,请忽略本短信";
// 给申请人发送案件受理短信 尊敬的{1}用户,您的{2}仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信 // // 给申请人发送案件受理短信 尊敬的{1}用户,您的{2}仲裁案件,已成功受理,请知晓,如非本人操作,请忽略本短信
Boolean smsFlag = SmsUtils.sendSms(application.getId(), "2073601", affiliate.getContactTelphoneAgent(), new String[]{affiliate.getNameAgent(), application.getCaseNum()}); // Boolean smsFlag = SmsUtils.sendSms(application.getId(), "2073601", affiliate.getContactTelphoneAgent(), new String[]{affiliate.getNameAgent(), application.getCaseNum()});
// CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getNodeName(), "向申请人发送短信," + sendContent); // // CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getNodeName(), "向申请人发送短信," + sendContent);
SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), affiliate.getContactTelphoneAgent(), new Date(), sendContent); // SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), affiliate.getContactTelphoneAgent(), new Date(), sendContent);
if (smsFlag) { // if (smsFlag) {
// 发送成功 // // 发送成功
smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); // smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode());
} else { // } else {
smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); // smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode());
} // }
smsRecordMapper.saveSmsSendRecord(smsSendRecord); // smsRecordMapper.saveSmsSendRecord(smsSendRecord);
} // }
// 被申请人发送短信 // 被申请人发送短信
if (StrUtil.isNotEmpty(affiliate.getRespondentPhone())) { if (StrUtil.isNotEmpty(affiliate.getRespondentPhone())) {
String sendContent = "尊敬的用户,您的" + application.getCaseNum() + "的案件已经受理,请登录调解系统进行缴费处理。请知晓,如非本人操作,请忽略本短信"; String sendContent = "尊敬的用户,您的" + application.getCaseNum() + "的案件已成功提交,请登录调解系统进行缴费处理。请知晓,如非本人操作,请忽略本短信";
// 给被申请人发送案件受理短信 2068468 待缴费通知 尊敬的用户,您编号为{1}的案件已经受理,请登录调解系统进行缴费处理。请知晓,如非本人操作,请忽略本短信 // 给被申请人发送案件受理短信 2074247 待缴费通知 尊敬的用户,您编号为{1}的案件已成功提交,请登录调解系统进行缴费处理。请知晓,如非本人操作,请忽略本短信
Boolean smsFlag = SmsUtils.sendSms(application.getId(), "2068468", affiliate.getRespondentPhone(), new String[]{ application.getCaseNum()}); Boolean smsFlag = SmsUtils.sendSms(application.getId(), "2074247", affiliate.getRespondentPhone(), new String[]{ application.getCaseNum()});
// CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getNodeName(), "向被申请人发送短信," + sendContent); // CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getNodeName(), "向被申请人发送短信," + sendContent);
SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), affiliate.getRespondentPhone(), new Date(), sendContent); SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), application.getCaseNum(), affiliate.getRespondentPhone(), new Date(), sendContent);
if (smsFlag) { if (smsFlag) {
@@ -1063,7 +1070,18 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
if (currentFlow == null) { if (currentFlow == null) {
return AjaxResult.error("当前流程不存在"); return AjaxResult.error("当前流程不存在");
} }
Integer miniProgressFlag = vo.getMiniProgressFlag() == null ? MediatorTypeEnum.PC.getCode() : vo.getMiniProgressFlag(); // Integer miniProgressFlag = vo.getMiniProgressFlag() == null ? MediatorTypeEnum.PC.getCode() : vo.getMiniProgressFlag();
// 预约,申请人预约为Null,否则为被申请人预约
Integer miniProgressFlag=null;
List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
if(CollectionUtil.isNotEmpty(roles)){
for (SysRole role : roles) {
if(role.getRoleName().equals("被申请人")){
miniProgressFlag=YesOrNoEnum.YES.getCode();
}
}
}
// 先删除已选择的调解员,在新增 // 先删除已选择的调解员,在新增
Example mediatorExample = new Example(MsCaseMediator.class); Example mediatorExample = new Example(MsCaseMediator.class);
Example.Criteria mediatorCriteria = mediatorExample.createCriteria(); Example.Criteria mediatorCriteria = mediatorExample.createCriteria();
@@ -1314,6 +1332,10 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
} }
return sysUser; return sysUser;
} }
@Override
public List<SmsSendRecord> getSmsSendRecord(SmsSendRecord smsSendRecord) {
return smsRecordMapper.getSmsSendRecord(smsSendRecord);
}
/** /**
* 查询预约信息 * 查询预约信息
@@ -11,6 +11,7 @@ import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.enums.AnnexTypeEnum; import com.ruoyi.common.enums.AnnexTypeEnum;
import com.ruoyi.common.enums.PaymentStatusEnum; import com.ruoyi.common.enums.PaymentStatusEnum;
import com.ruoyi.common.enums.YesOrNoEnum; import com.ruoyi.common.enums.YesOrNoEnum;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.SmsUtils; import com.ruoyi.common.utils.SmsUtils;
import com.ruoyi.dto.PayRequest; import com.ruoyi.dto.PayRequest;
import com.ruoyi.dto.PayResponse; import com.ruoyi.dto.PayResponse;
@@ -19,15 +20,9 @@ import com.ruoyi.system.mapper.flow.MsCaseFlowMapper;
import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseConfirmPayDTO; import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseConfirmPayDTO;
import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CasePayDTO; import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CasePayDTO;
import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord; import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAffiliate; import com.ruoyi.wisdomarbitrate.domain.entity.mscase.*;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCasePaymentRecord;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.PaymentDetailVO; import com.ruoyi.wisdomarbitrate.domain.vo.mscase.PaymentDetailVO;
import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseAffiliateMapper; import com.ruoyi.wisdomarbitrate.mapper.mscase.*;
import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseApplicationMapper;
import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseAttachMapper;
import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCasePaymentRecordMapper;
import com.ruoyi.wisdomarbitrate.mapper.sendrecord.SmsRecordMapper; import com.ruoyi.wisdomarbitrate.mapper.sendrecord.SmsRecordMapper;
import com.ruoyi.wisdomarbitrate.service.mscase.MsCaseApplicationService; import com.ruoyi.wisdomarbitrate.service.mscase.MsCaseApplicationService;
import com.ruoyi.wisdomarbitrate.service.mscase.MsCasePaymentService; import com.ruoyi.wisdomarbitrate.service.mscase.MsCasePaymentService;
@@ -66,6 +61,8 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
MsCasePaymentService casePaymentService; MsCasePaymentService casePaymentService;
@Autowired @Autowired
private RedisCache redisCache; private RedisCache redisCache;
@Autowired
private MsCaseAuditMapper auditMapper;
@Override @Override
@@ -273,101 +270,206 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
if (currentFlow == null) { if (currentFlow == null) {
return AjaxResult.error("未找到当前流程节点"); return AjaxResult.error("未找到当前流程节点");
} }
MsCaseFlow flow =null;
// 如果同意,查找下一个流程节点,拒绝,查找上一个流程
if (dto.getYesOrNo().equals(YesOrNoEnum.YES.getCode())) {
// 同意,根据流程id查找下一个流程节点
flow = caseFlowMapper.nextFlow(dto.getCaseFlowId());
if (flow == null) {
return AjaxResult.error("未找到下一个流程节点");
}
} else {
if (currentFlow.getBackFlowId() == null) {
return AjaxResult.error("未找到驳回流程");
}
// 拒绝,查找驳回流程
flow = caseFlowMapper.selectByPrimaryKey(currentFlow.getBackFlowId());
if (flow == null) {
return AjaxResult.error("未找到驳回流程");
}
// 根据流程id查找下一个流程节点
MsCaseFlow nextFlow = caseFlowMapper.nextFlow(dto.getCaseFlowId());
if (nextFlow == null) {
return AjaxResult.error("未找到下一个流程节点");
} }
if (StrUtil.isNotEmpty(dto.getBatchNumber())) { if (StrUtil.isNotEmpty(dto.getBatchNumber())) {
// 批量 // 批量
List<MsCaseApplication> applicationList = applicationService.listByBatchNumber(dto.getBatchNumber(), dto.getCaseFlowId()); List<MsCaseApplication> applicationList = applicationService.listByBatchNumber(dto.getBatchNumber(), dto.getCaseFlowId());
if(CollectionUtil.isEmpty(applicationList)){ if (CollectionUtil.isEmpty(applicationList)) {
return AjaxResult.error("该批号下未找到案件"); return AjaxResult.error("该批号下未找到案件");
} }
for (MsCaseApplication application : applicationList) { for (MsCaseApplication application : applicationList) {
casePaymentService.confirmPaid(currentFlow,nextFlow, application); casePaymentService.confirmPaid(dto, currentFlow, flow, application);
} }
}else { } else {
MsCaseApplication caseApplication=new MsCaseApplication(); MsCaseApplication caseApplication = new MsCaseApplication();
caseApplication.setId(dto.getCaseId()); caseApplication.setId(dto.getCaseId());
caseApplication.setLockStatus(YesOrNoEnum.YES.getCode()); caseApplication.setLockStatus(YesOrNoEnum.YES.getCode());
casePaymentService.confirmPaid(currentFlow,nextFlow,caseApplication ); casePaymentService.confirmPaid(dto, currentFlow, flow, caseApplication);
} }
return AjaxResult.success("确认缴费成功");
return AjaxResult.success();
} }
/** /**
* 确认已缴费 * 确认已缴费
* @param nextFlow * @param flow
* @param application * @param application
* @param * @param
*/ */
@Transactional @Transactional
public void confirmPaid(MsCaseFlow currentFlow,MsCaseFlow nextFlow, MsCaseApplication application) { public void confirmPaid(CaseConfirmPayDTO dto, MsCaseFlow currentFlow, MsCaseFlow flow, MsCaseApplication application) {
// 查询案件 // 查询案件
MsCaseApplication caseAppllication = caseApplicationMapper.selectByPrimaryKey(application.getId()); MsCaseApplication caseAppllication = caseApplicationMapper.selectByPrimaryKey(application.getId());
if(caseAppllication==null){ if (caseAppllication == null) {
throw new RuntimeException("未找到该案件"); throw new RuntimeException("未找到该案件");
} }
//更改记录表里的支付状态和支付时间 //更改记录表里的支付状态和支付时间
MsCasePaymentRecord casePaymentRecord = new MsCasePaymentRecord(); MsCasePaymentRecord casePaymentRecord = new MsCasePaymentRecord();
casePaymentRecord.setPaymentStatus(1); if (dto.getYesOrNo().equals(YesOrNoEnum.YES.getCode())) {
// 同意
casePaymentRecord.setPaymentStatus(1);
casePaymentRecord.setPaymentTime(new Date());
casePaymentRecord.setUpdateTime(new Date());
}else {
casePaymentRecord.setPaymentStatus(0);
}
casePaymentRecord.setCaseId(application.getId()); casePaymentRecord.setCaseId(application.getId());
casePaymentRecord.setPaymentTime(new Date());
casePaymentRecord.setUpdateTime(new Date());
Example example = new Example(MsCasePaymentRecord.class); Example example = new Example(MsCasePaymentRecord.class);
example.createCriteria().andEqualTo("caseId", casePaymentRecord.getCaseId()); example.createCriteria().andEqualTo("caseId", casePaymentRecord.getCaseId());
casePaymentRecordMapper.updateByExampleSelective(casePaymentRecord,example); casePaymentRecordMapper.updateByExampleSelective(casePaymentRecord, example);
// 更改案件流程id和案件状态 // 更改案件流程id和案件状态
application.setCaseFlowId(nextFlow.getId()); application.setCaseFlowId(flow.getId());
application.setCaseStatusName(nextFlow.getCaseStatusName()); application.setCaseStatusName(flow.getCaseStatusName());
caseApplicationMapper.updateByPrimaryKeySelective(application); caseApplicationMapper.updateByPrimaryKeySelective(application);
// 将该案件存放到redis,5日之内如果案件状态还是待受理状态,则发送不受理通知书并自动结束 if (dto.getApplicantConfirm() && dto.getYesOrNo().equals(YesOrNoEnum.YES.getCode())) {
redisCache.setCacheObject(String.valueOf(application.getId()), application, Constants.CASE_ACCEPT_EXPIRATION, TimeUnit.DAYS); // 申请人确认缴费后将该案件存放到redis,5日之内如果案件状态还是待受理状态,则发送不受理通知书并自动结束
redisCache.setCacheObject(String.valueOf(application.getId()), application, Constants.CASE_ACCEPT_EXPIRATION, TimeUnit.DAYS);
}
// 新增日志 // 新增日志
CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),"确认已缴费"); if (dto.getYesOrNo().equals(YesOrNoEnum.YES.getCode())) {
CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "确认已缴费");
}else {
CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "拒绝确认缴费,拒绝原因为:"+dto.getReason());
}
if (dto.getYesOrNo().equals(YesOrNoEnum.NO.getCode())) {
// 拒绝,新增审核记录
MsCaseAudit audit = new MsCaseAudit();
audit.setCaseNode(flow.getNodeId());
audit.setCaseStatusName(flow.getCaseStatusName());
audit.setCaseAppliId(dto.getCaseId());
audit.setYesOrNo(dto.getYesOrNo());
audit.setReason(dto.getReason());
audit.setCreateTime(new Date());
if (SecurityUtils.getLoginUser().getUser() != null) {
audit.setCreateBy(SecurityUtils.getUsername());
audit.setCreateNickName(SecurityUtils.getLoginUser().getUser().getNickName());
}
auditMapper.insert(audit);
}
// 查询申请人电话,如果是自然人,代理人不为空,则给代理人发短信,代理人为空,给申请人发短信 // 查询申请人电话,如果是自然人,代理人不为空,则给代理人发短信,代理人为空,给申请人发短信
MsCaseAffiliate affiliate = caseAffiliateMapper.selectByPrimaryKey(application.getId()); MsCaseAffiliate affiliate = caseAffiliateMapper.selectByPrimaryKey(application.getId());
if(affiliate != null) { // 发送缴费通知
String phone=""; sendPaymentSms(dto,caseAppllication, affiliate,flow);
String userName="";
if(affiliate.getOrganizeFlag().equals(0)){
}
/**
* 被申请人确认已缴费
* @param dto
* @return
*/
@Transactional
@Override
public AjaxResult resConfirmPaid(CaseConfirmPayDTO dto) {
dto.setApplicantConfirm(false);
confirmPaid(dto);
return AjaxResult.success();
}
/**
* 发送缴费短信
* @param dto
* @param caseAppllication
* @param affiliate
*/
private void sendPaymentSms(CaseConfirmPayDTO dto, MsCaseApplication caseAppllication, MsCaseAffiliate affiliate,MsCaseFlow flow) {
if (affiliate != null) {
// 受理通知
String phone = "";
String userName = "";
// 缴费通知
String payPhone = "";
String payUserName = "";
if (affiliate.getOrganizeFlag().equals(0)) {
// 自然人 // 自然人
if(StrUtil.isNotEmpty(affiliate.getContactTelphoneAgent())){ if (StrUtil.isNotEmpty(affiliate.getContactTelphoneAgent())) {
phone=affiliate.getContactTelphoneAgent(); phone = affiliate.getContactTelphoneAgent();
userName=affiliate.getNameAgent(); userName = affiliate.getNameAgent();
}else { } else {
phone=affiliate.getApplicationPhone(); phone = affiliate.getApplicationPhone();
userName=affiliate.getApplicationName(); userName = affiliate.getApplicationName();
} }
}else { } else {
phone=affiliate.getContactTelphoneAgent(); phone = affiliate.getContactTelphoneAgent();
userName=affiliate.getNameAgent(); userName = affiliate.getNameAgent();
} }
if(StrUtil.isNotEmpty(phone)) { if (StrUtil.isNotEmpty(phone)) {
// 发送短信 2051914 调解缴费成功通知 尊敬的{1},您的调解申请费用已缴费成功。 payPhone=phone;
Boolean smsFlag = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2051914", phone, new String[]{userName}); payUserName=userName;
// CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "申请人调解缴费成功通知短信,尊敬的" + userName + ",您的调解申请费用已缴费成功。"); if(!dto.getApplicantConfirm()) {
// 被申请人发送通知
payPhone=affiliate.getRespondentPhone();
payUserName=affiliate.getRespondentName();
}
Boolean smsFlag =true;
SmsSendRecord smsSendRecord=null;
// 申请人被申请人发送缴费成功短信 2051914 调解缴费成功通知 尊敬的{1},您的调解申请费用已缴费成功。
if (dto.getYesOrNo().equals(YesOrNoEnum.YES.getCode())) {
smsFlag = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2051914", payPhone, new String[]{payUserName});
smsSendRecord = new SmsSendRecord(caseAppllication.getId(), caseAppllication.getCaseNum(), payPhone, new Date(), "尊敬的" + payUserName + ",您的调解申请费用已缴费成功。");
} else {
smsFlag = SmsUtils.sendSms(affiliate.getCaseAppliId(), "2074402", payPhone, new String[]{payUserName, caseAppllication.getCaseNum(), dto.getReason()});
// 2074402 调解系统确认缴费不通过通知 尊敬的{1}用户,您的{2}案件,确认缴费未通过,理由为{3},请知晓,如非本人操作,请忽略本短信
smsSendRecord = new SmsSendRecord(caseAppllication.getId(), caseAppllication.getCaseNum(), payPhone, new Date(), "尊敬的" + payUserName + "用户,您的" + caseAppllication.getCaseNum() + "案件,确认缴费未通过,理由为" + dto.getReason() + ",请知晓,如非本人操作,请忽略本短信");
}
// 新增短信记录 // 新增短信记录
SmsSendRecord smsSendRecord = new SmsSendRecord(application.getId(), caseAppllication.getCaseNum(), phone, new Date(), "尊敬的" + userName + ",您的调解申请费用已缴费成功。"); if (smsFlag) {
if(smsFlag){
smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode()); smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode());
}else { } else {
smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode()); smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode());
} }
smsRecordMapper.saveSmsSendRecord(smsSendRecord); smsRecordMapper.saveSmsSendRecord(smsSendRecord);
if(dto.getApplicantConfirm()&& dto.getYesOrNo().equals(YesOrNoEnum.YES.getCode())) {
// 申请人发送受理短信
sendAcceptSms(dto, caseAppllication, userName, phone);
// 被申请人发送受理短信
sendAcceptSms(dto, caseAppllication, affiliate.getRespondentName(), affiliate.getRespondentPhone());
}
} }
} }
} }
/**
* 发送受理短信
* @param dto
* @param caseAppllication
*/
private void sendAcceptSms(CaseConfirmPayDTO dto, MsCaseApplication caseAppllication,String userName,String phone ) {
// 申请人被申请人发送受理通知书 2073601 尊敬的{1}用户,您的{2}案件,已成功受理,请知晓,如非本人操作,请忽略本短信。
Boolean smsFlag = SmsUtils.sendSms(caseAppllication.getId(), "2073601", phone, new String[]{userName, caseAppllication.getCaseNum()});
SmsSendRecord smsSendRecord = new SmsSendRecord(caseAppllication.getId(), caseAppllication.getCaseNum(), phone, new Date(), "尊敬的" + userName + "用户,您的" + caseAppllication.getCaseNum() + "案件,已成功受理,请知晓,如非本人操作,请忽略本短信。");
// 新增短信记录
if (smsFlag) {
smsSendRecord.setSendStatus(YesOrNoEnum.YES.getCode());
} else {
smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode());
}
smsRecordMapper.saveSmsSendRecord(smsSendRecord);
}
/** /**
* 确认缴费 * 确认缴费
* *
@@ -380,7 +482,17 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
application.setPayType(dto.getPayType()); application.setPayType(dto.getPayType());
// 修改缴费附件 // 修改缴费附件
if (CollectionUtil.isNotEmpty(dto.getPayOrderList())) { if (CollectionUtil.isNotEmpty(dto.getPayOrderList())) {
for (MsCaseAttach caseAttach : dto.getPayOrderList()) { for (MsCaseAttach caseAttach : dto.getPayOrderList()) {
// 先删除之前的缴费
if(currentFlow.getButtonAuthFlag().equals("caseManagement:list:pay")){
// 申请人附件
caseAttachMapper.deleteCaseAttachByCasedIdAndType(application.getId(),AnnexTypeEnum.PAYMENT_RECEIPT.getCode());
}else {
// 被申请人缴费附件
caseAttachMapper.deleteCaseAttachByCasedIdAndType(application.getId(),AnnexTypeEnum.RES_PAYMENT_RECEIPT.getCode());
}
caseAttach.setCaseAppliId(application.getId()); caseAttach.setCaseAppliId(application.getId());
caseAttachMapper.updateCaseAttach(caseAttach); caseAttachMapper.updateCaseAttach(caseAttach);
} }
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseAuditMapper">
<resultMap id="BaseResultMap" type="com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAudit">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="case_appli_id" jdbcType="BIGINT" property="caseAppliId" />
<result column="case_node" jdbcType="INTEGER" property="caseNode" />
<result column="case_status_name" jdbcType="VARCHAR" property="caseStatusName" />
<result column="yes_or_no" jdbcType="INTEGER" property="yesOrNo" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
<result column="create_nick_name" jdbcType="VARCHAR" property="createNickName" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="reason" jdbcType="LONGVARCHAR" property="reason" />
</resultMap>
</mapper>
@@ -19,7 +19,7 @@
<select id="selectSendMailRecord" parameterType="com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SendMailRecord" resultMap="SendMailRecordResult"> <select id="selectSendMailRecord" parameterType="com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SendMailRecord" resultMap="SendMailRecordResult">
SELECT s.id ,s.mail_name ,s.mail_content ,s.mail_address ,s.send_time ,s.case_id ,s.create_time ,s.create_by , SELECT s.id ,s.mail_name ,s.mail_content ,s.mail_address ,s.send_time ,s.case_id ,s.create_time ,s.create_by ,
s.update_by ,s.update_time , s.send_status ,c.case_num s.update_by ,s.update_time , s.send_status ,c.case_num
from send_mail_record s left join ms_case_application c from ms_send_mail_record s left join ms_case_application c
on s.case_id = c.id on s.case_id = c.id
<where> <where>
<if test="caseNum != null and caseNum != ''"> <if test="caseNum != null and caseNum != ''">
@@ -30,7 +30,7 @@
</select> </select>
<insert id="saveSendMailRecord"> <insert id="saveSendMailRecord">
insert into send_mail_record( insert into ms_send_mail_record(
<if test="mailName != null and mailName != ''">mail_name,</if> <if test="mailName != null and mailName != ''">mail_name,</if>
<if test="mailContent != null and mailContent != ''">mail_content,</if> <if test="mailContent != null and mailContent != ''">mail_content,</if>
<if test="mailAddress != null and mailAddress != ''">mail_address,</if> <if test="mailAddress != null and mailAddress != ''">mail_address,</if>