Merge branch 'qtz5' of SH-Arbitrate/Arbitrate-Backend into dev
This commit was merged in pull request #323.
This commit is contained in:
+24
@@ -2,6 +2,7 @@ package com.ruoyi.web.controller.wisdomarbitrate;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.wisdomarbitrate.domain.BatchCaseApplication;
|
||||
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
|
||||
import com.ruoyi.wisdomarbitrate.domain.dto.CaseConfirmPayDTO;
|
||||
@@ -46,6 +47,16 @@ public class CasePaymentController {
|
||||
return paymentService.confirmPay(payDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量缴费
|
||||
* @param casePayDTO 缴费传入参数
|
||||
* @return 统一响应结果
|
||||
*/
|
||||
@PostMapping("/casePayBatch")
|
||||
public AjaxResult casePayBatch(@Validated @RequestBody CasePayDTO casePayDTO) {
|
||||
return paymentService.casePayBatch(casePayDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量缴费
|
||||
* @param payDTO 缴费传入参数
|
||||
@@ -83,4 +94,17 @@ public class CasePaymentController {
|
||||
public AjaxResult casePayListBatch(@Validated @RequestBody CasePayDTO casePayDTO) {
|
||||
return paymentService.casePayListBatch(casePayDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量缴费确认
|
||||
* @param batchCaseApplication
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/confirmBatch")
|
||||
public AjaxResult confirmPaymentBatch(@Validated @RequestBody BatchCaseApplication batchCaseApplication) {
|
||||
if(StringUtils.isEmpty(batchCaseApplication.getBatchNumber())){
|
||||
return AjaxResult.error("参数校验失败");
|
||||
}
|
||||
return paymentService.confirmPaymentBatch(batchCaseApplication.getBatchNumber());
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -2,10 +2,12 @@ package com.ruoyi.wisdomarbitrate.mapper;
|
||||
|
||||
import com.ruoyi.wisdomarbitrate.domain.CasePaymentRecord;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CasePaymentRecordMapper {
|
||||
int saveRecord(CasePaymentRecord casePaymentRecord);
|
||||
|
||||
CasePaymentRecord queryRecord(String orderNumber);
|
||||
List<CasePaymentRecord> queryRecord(String orderNumber);
|
||||
|
||||
void update(CasePaymentRecord casePaymentRecord);
|
||||
|
||||
|
||||
@@ -29,4 +29,8 @@ public interface ICasePaymentService {
|
||||
AjaxResult confirmPayBatch(CasePayDTO payDTO);
|
||||
|
||||
AjaxResult casePayListBatch(CasePayDTO casePayDTO);
|
||||
|
||||
AjaxResult confirmPaymentBatch(String batchNumber);
|
||||
|
||||
AjaxResult casePayBatch(CasePayDTO casePayDTO);
|
||||
}
|
||||
|
||||
+148
-9
@@ -9,6 +9,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.wisdomarbitrate.domain.*;
|
||||
import com.ruoyi.wisdomarbitrate.domain.dto.CaseConfirmPayDTO;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.CasePayListVO;
|
||||
@@ -92,17 +93,19 @@ public class CasePaymentServiceImpl implements ICasePaymentService {
|
||||
@Transactional
|
||||
public AjaxResult callback(String orderNumber) {
|
||||
//查询记录
|
||||
CasePaymentRecord casePaymentRecord = casePaymentRecordMapper.queryRecord(orderNumber);
|
||||
if (casePaymentRecord == null) {
|
||||
List<CasePaymentRecord> casePaymentRecords = casePaymentRecordMapper.queryRecord(orderNumber);
|
||||
if(casePaymentRecords!=null&&casePaymentRecords.size()>0){
|
||||
for (CasePaymentRecord casePaymentRecord:casePaymentRecords){
|
||||
Long caseId = casePaymentRecord.getCaseId();
|
||||
//更改记录表里的支付状态和支付时间
|
||||
casePaymentRecord.setPaymentStatus(1);
|
||||
casePaymentRecord.setPaymentTime(new Date());
|
||||
casePaymentRecord.setUpdateTime(new Date());
|
||||
casePaymentRecordMapper.update(casePaymentRecord);
|
||||
}
|
||||
}else {
|
||||
return AjaxResult.error("未查询到相关记录");
|
||||
}
|
||||
Long caseId = casePaymentRecord.getCaseId();
|
||||
//更改记录表里的支付状态和支付时间
|
||||
casePaymentRecord.setPaymentStatus(1);
|
||||
casePaymentRecord.setPaymentTime(new Date());
|
||||
casePaymentRecord.setUpdateTime(new Date());
|
||||
casePaymentRecordMapper.update(casePaymentRecord);
|
||||
|
||||
return AjaxResult.success("支付成功");
|
||||
}
|
||||
|
||||
@@ -344,5 +347,141 @@ public class CasePaymentServiceImpl implements ICasePaymentService {
|
||||
return AjaxResult.success(listVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult confirmPaymentBatch(String batchNumber) {
|
||||
CaseApplication caseApplicationsel = new CaseApplication();
|
||||
caseApplicationsel.setBatchNumber(Integer.parseInt(batchNumber));
|
||||
caseApplicationsel.setCaseStatus(CaseApplicationConstants.PENDING_PAYMENT_CONFIRM);
|
||||
List<CaseApplication> caseApplications = caseApplicationMapper.listCaseApplicationByBatchNumber(caseApplicationsel);
|
||||
|
||||
if (caseApplications != null && caseApplications.size() > 0) {
|
||||
List<Long> caseIds = caseApplications.stream().map(CaseApplication::getId).collect(Collectors.toList());
|
||||
for (Long caseId : caseIds) {
|
||||
CaseApplication caseApplication = new CaseApplication();
|
||||
caseApplication.setId(caseId);
|
||||
caseApplication.setCaseStatus(CaseApplicationConstants.CASE_CROSSEXAMI);
|
||||
caseApplicationMapper.submitCaseApplication(caseApplication);
|
||||
//发送短信通知
|
||||
SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
|
||||
CaseAffiliate caseAffiliate = new CaseAffiliate();
|
||||
caseAffiliate.setCaseAppliId(caseApplication.getId());
|
||||
List<CaseAffiliate> caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); //获取案件关联人信息
|
||||
if (caseAffiliates != null && caseAffiliates.size() > 0) {
|
||||
for (CaseAffiliate affiliate : caseAffiliates) {
|
||||
//获取身份类型
|
||||
int identityType = affiliate.getIdentityType();
|
||||
//查询案件详细信息
|
||||
CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication);
|
||||
if (caseApplication1 == null) {
|
||||
continue;
|
||||
}
|
||||
String caseName = "仲裁"; //这里案件名称表里未定义,暂时写死
|
||||
String caseNum = caseApplication1.getCaseNum();
|
||||
if (identityType == 1) { //申请人
|
||||
request.setPhone(affiliate.getContactTelphone());
|
||||
request.setTemplateId("1928003"); //传入申请人模板id
|
||||
// 这个值,要看你的模板中是否预留了占位符,如果没有则不需要设置
|
||||
// 模板id:1928003 普通短信 案件受理通知
|
||||
String name = affiliate.getName();
|
||||
request.setTemplateParamSet(new String[]{name, caseName, caseNum});
|
||||
Boolean aBoolean = SmsUtils.sendSms(request);
|
||||
//保存短信发送记录
|
||||
SmsSendRecord smsSendRecord = new SmsSendRecord();
|
||||
smsSendRecord.setCaseId(caseApplication.getId());
|
||||
smsSendRecord.setCaseNum(caseNum);
|
||||
smsSendRecord.setPhone(request.getPhone());
|
||||
smsSendRecord.setSendTime(new Date());
|
||||
String content = "尊敬的" + name + "用户,您的" + caseName + "案件" + caseNum + "已成功受理。";
|
||||
smsSendRecord.setSendContent(content);
|
||||
smsSendRecord.setCreateBy(getUsername());
|
||||
if (aBoolean) {
|
||||
smsSendRecord.setSendStatus(1);
|
||||
} else {
|
||||
smsSendRecord.setSendStatus(0);
|
||||
}
|
||||
smsRecordMapper.saveSmsSendRecord(smsSendRecord);
|
||||
} else { //被申请人
|
||||
|
||||
request.setPhone(affiliate.getContactTelphone());
|
||||
request.setTemplateId("1952840");
|
||||
// 1952840 尊敬的{1}用户,您的{2}案件{3}已成功受理,请点击链接:https://miniapp-3gpama6l759911ef-1321289474.tcloudbaseapp.com/jump-mp.html 选择是否应诉。如非本人操作,请忽略本短信
|
||||
String name = affiliate.getName();
|
||||
request.setTemplateParamSet(new String[]{name, caseName, caseNum});
|
||||
Boolean aBoolean = SmsUtils.sendSms(request);
|
||||
//保存短信发送记录
|
||||
SmsSendRecord smsSendRecord = new SmsSendRecord();
|
||||
smsSendRecord.setCaseId(caseApplication.getId());
|
||||
smsSendRecord.setCaseNum(caseNum);
|
||||
smsSendRecord.setPhone(request.getPhone());
|
||||
smsSendRecord.setSendTime(new Date());
|
||||
String content = "尊敬的" + name + "用户,您的" + caseName + "案件" + caseNum + "已成功受理,请点击链接:https://miniapp-3gpama6l759911ef-1321289474.tcloudbaseapp.com/jump-mp.html 选择是否应诉。如非本人操作,请忽略本短信";
|
||||
smsSendRecord.setSendContent(content);
|
||||
smsSendRecord.setCreateBy(getUsername());
|
||||
if (aBoolean) {
|
||||
smsSendRecord.setSendStatus(1);
|
||||
} else {
|
||||
smsSendRecord.setSendStatus(0);
|
||||
}
|
||||
smsRecordMapper.saveSmsSendRecord(smsSendRecord);
|
||||
}
|
||||
}
|
||||
//更改记录表里的支付状态和支付时间
|
||||
CasePaymentRecord casePaymentRecord = new CasePaymentRecord();
|
||||
casePaymentRecord.setPaymentStatus(1);
|
||||
casePaymentRecord.setCaseId(caseId);
|
||||
casePaymentRecord.setPaymentTime(new Date());
|
||||
casePaymentRecord.setUpdateTime(new Date());
|
||||
casePaymentRecordMapper.update(casePaymentRecord);
|
||||
// 新增日志
|
||||
CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_CROSSEXAMI, "");
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult casePayBatch(CasePayDTO casePayDTO) {
|
||||
PayRequest payRequest = new PayRequest();
|
||||
payRequest.setBody("案件缴费");
|
||||
payRequest.setOrderSn(System.currentTimeMillis() + "");
|
||||
payRequest.setTotalFee(casePayDTO.getTotalFee());
|
||||
PayResponse response = elegentPay.requestPay(payRequest, casePayDTO.getTradeType(), casePayDTO.getPlatform());
|
||||
if (response.getCode_url() == null) {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
String batchNumber = casePayDTO.getBatchNumber();
|
||||
if(StringUtils.isEmpty(batchNumber) ){
|
||||
return AjaxResult.error("请检查参数是否有误");
|
||||
}
|
||||
CaseApplication caseApplicationsel = new CaseApplication();
|
||||
caseApplicationsel.setBatchNumber(Integer.parseInt(batchNumber));
|
||||
caseApplicationsel.setCaseStatus(CaseApplicationConstants.PENDING_PAYMENT);
|
||||
List<CaseApplication> caseApplications = caseApplicationMapper.listCaseApplicationByBatchNumber(caseApplicationsel);
|
||||
if(caseApplications!=null&&caseApplications.size()>0){
|
||||
List<Long> caseIds = caseApplications.stream().map(CaseApplication::getId).collect(Collectors.toList());
|
||||
for (Long caseId : caseIds) {
|
||||
//缴费记录表里新增数据
|
||||
CasePaymentRecord casePaymentRecord = new CasePaymentRecord();
|
||||
casePaymentRecord.setCaseId(caseId);
|
||||
casePaymentRecord.setOrderNumber(payRequest.getOrderSn());
|
||||
casePaymentRecord.setPaymentStatus(0);
|
||||
casePaymentRecord.setCreateTime(new Date());
|
||||
int count = casePaymentRecordMapper.saveRecord(casePaymentRecord);
|
||||
if (count < 1) {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return AjaxResult.success(response);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -27,13 +27,20 @@
|
||||
<if test="updateTime != null ">update_time = #{updateTime},</if>
|
||||
<if test="payType != null ">pay_type = #{payType},</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
<where>
|
||||
<if test="caseId != null ">
|
||||
AND case_id = #{caseId}
|
||||
</if>
|
||||
<if test="id != null ">
|
||||
AND id = #{id}
|
||||
</if>
|
||||
</where>
|
||||
</update>
|
||||
<select id="queryRecord" resultType="com.ruoyi.wisdomarbitrate.domain.CasePaymentRecord" resultMap="CasePaymentRecordResult">
|
||||
select c.id ,c.case_id ,c.order_number ,c.payment_time ,c.create_time ,c.update_time ,c.payment_status
|
||||
from case_payment_record c
|
||||
<where>
|
||||
<if test="orderNumber != null ">
|
||||
<if test="orderNumber != null and orderNumber != '' ">
|
||||
AND c.order_number = #{orderNumber}
|
||||
</if>
|
||||
</where>
|
||||
|
||||
Reference in New Issue
Block a user