0元支付
This commit is contained in:
parent
9b59ab7e20
commit
7fbf87ff3f
|
@ -3,6 +3,7 @@ package com.ruoyi.ss.transactionBill.domain.dto;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.DecimalMin;
|
||||||
import javax.validation.constraints.Min;
|
import javax.validation.constraints.Min;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
@ -21,7 +22,7 @@ public class BillRefundDTO {
|
||||||
|
|
||||||
@ApiModelProperty("退款金额")
|
@ApiModelProperty("退款金额")
|
||||||
@NotNull(message = "退款金额不允许为空")
|
@NotNull(message = "退款金额不允许为空")
|
||||||
@Min(value = 0, message = "退款金额不允许小于0")
|
@DecimalMin(value = "0.01", message = "退款金额不允许小于0.01")
|
||||||
private BigDecimal refundAmount;
|
private BigDecimal refundAmount;
|
||||||
|
|
||||||
@ApiModelProperty("退款操作人类型")
|
@ApiModelProperty("退款操作人类型")
|
||||||
|
|
|
@ -162,7 +162,6 @@ public class TransactionBillServiceImpl implements TransactionBillService {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
|
||||||
public int insertSmTransactionBill(TransactionBill transactionBill)
|
public int insertSmTransactionBill(TransactionBill transactionBill)
|
||||||
{
|
{
|
||||||
transactionBill.setCreateTime(DateUtils.getNowDate());
|
transactionBill.setCreateTime(DateUtils.getNowDate());
|
||||||
|
@ -217,7 +216,6 @@ public class TransactionBillServiceImpl implements TransactionBillService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public String addOrder(TransactionBill data) {
|
public String addOrder(TransactionBill data) {
|
||||||
// 下单
|
// 下单
|
||||||
TransactionBill order = parseToOrder(data);
|
TransactionBill order = parseToOrder(data);
|
||||||
|
@ -225,11 +223,17 @@ public class TransactionBillServiceImpl implements TransactionBillService {
|
||||||
// 服务费处理
|
// 服务费处理
|
||||||
this.handleService(order);
|
this.handleService(order);
|
||||||
|
|
||||||
// 插入数据库
|
transactionTemplate.execute(status -> {
|
||||||
ServiceUtil.assertion(this.insertSmTransactionBill(order) != 1, "下单失败");
|
// 插入数据库
|
||||||
|
int insert = this.insertSmTransactionBill(order);
|
||||||
|
ServiceUtil.assertion(insert != 1, "下单失败");
|
||||||
|
return insert;
|
||||||
|
});
|
||||||
|
|
||||||
// 若订单金额为0元,则直接充值成功
|
// 若订单金额为0元,则直接充值成功
|
||||||
if (order.getMoney().compareTo(BigDecimal.ZERO) == 0) {
|
if (order.getMoney().compareTo(BigDecimal.ZERO) == 0) {
|
||||||
|
TransactionBillVo bill = this.selectSmTransactionBillByBillNo(order.getBillNo());
|
||||||
|
this.paying(bill.getBillId());
|
||||||
this.rechargeSuccess(order.getBillNo(), DateUtils.getNowDate());
|
this.rechargeSuccess(order.getBillNo(), DateUtils.getNowDate());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -589,11 +593,13 @@ public class TransactionBillServiceImpl implements TransactionBillService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
|
||||||
public void paying(Long billId) {
|
public void paying(Long billId) {
|
||||||
ServiceUtil.assertion(billId == null, "订单id不允许为空");
|
ServiceUtil.assertion(billId == null, "订单id不允许为空");
|
||||||
int updateCount = transactionBillMapper.paying(billId);
|
transactionTemplate.execute(status -> {
|
||||||
ServiceUtil.assertion(updateCount != 1, "订单状态发生变化,请刷新后重试");
|
int updateCount = transactionBillMapper.paying(billId);
|
||||||
|
ServiceUtil.assertion(updateCount != 1, "订单状态发生变化,请刷新后重试");
|
||||||
|
return updateCount;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -126,7 +126,6 @@ public class WxPayService implements IWxPayService {
|
||||||
|
|
||||||
PrepayWithRequestPaymentResponse res = this.prepayWithRequestPayment(bill);
|
PrepayWithRequestPaymentResponse res = this.prepayWithRequestPayment(bill);
|
||||||
|
|
||||||
// 支付中
|
|
||||||
try {
|
try {
|
||||||
// 支付中
|
// 支付中
|
||||||
transactionBillService.paying(bill.getBillId());
|
transactionBillService.paying(bill.getBillId());
|
||||||
|
|
Loading…
Reference in New Issue
Block a user