支付完善
This commit is contained in:
parent
65754161b6
commit
93181b4f21
|
@ -222,7 +222,7 @@ public class SybUtil {
|
|||
Map reqMap = request.getParameterMap();
|
||||
for(Object key:reqMap.keySet()){
|
||||
String value = ((String[])reqMap.get(key))[0];
|
||||
System.out.println(key+";"+value);
|
||||
// System.out.println(key+";"+value);
|
||||
map.put(key.toString(),value);
|
||||
}
|
||||
return map;
|
||||
|
|
|
@ -33,4 +33,9 @@ public enum PayBillStatus {
|
|||
public static List<String> getCanCancelList() {
|
||||
return asList(WAIT_PAY, PAYING);
|
||||
}
|
||||
|
||||
// 已经支付过的状态
|
||||
public static List<String> payedList() {
|
||||
return asList(PAY_SUCCESS, REFUNDING, REFUNDED);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -257,8 +257,12 @@ public class PayBillServiceImpl implements PayBillService
|
|||
}
|
||||
|
||||
private void handleSuccess(PayBillVO payBill, LocalDateTime payTime) {
|
||||
log.info("获取支付订单:{}", payBill);
|
||||
ServiceUtil.assertion(payBill == null, "支付订单不存在");
|
||||
log.info("获取支付订单:{}", payBill.getPayNo());
|
||||
// 若已经支付成功,则跳过
|
||||
if (PayBillStatus.payedList().contains(payBill.getStatus())) {
|
||||
return;
|
||||
}
|
||||
ServiceUtil.assertion(!PayBillStatus.PAYING.getStatus().equals(payBill.getStatus()), "该支付订单不是正在支付的支付订单");
|
||||
|
||||
transactionTemplate.execute(status -> {
|
||||
|
|
|
@ -1440,7 +1440,7 @@ public class TransactionBillServiceImpl implements TransactionBillService, After
|
|||
// 按比例计算退款金额
|
||||
BigDecimal refundAmount = dto.getRefundAmount();
|
||||
BigDecimal refundRate = refundAmount.divide(bill.getMoney(), 2, RoundingMode.HALF_UP); // 退款金额比例
|
||||
BigDecimal refundServiceAmount = bill.getServiceCharge().multiply(refundRate); // 退款的手续费
|
||||
BigDecimal refundServiceAmount = bill.getServiceCharge().multiply(refundRate).setScale(2, RoundingMode.HALF_UP); // 退款的手续费
|
||||
BigDecimal refundMchAmount = refundAmount.subtract(refundServiceAmount); // 退款的商户余额
|
||||
userService.subtractBalance(bill.getMchId(), refundMchAmount, dto.getRefundReason(), RecordBalanceBstType.RECHARGE, bill.getBillId());
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user