Browse Source

支付接口微调

v1.0
15989082884@163.com 2 years ago
parent
commit
99e433c3a5
  1. 4
      src/main/java/com/qs/serve/modules/pay/entity/bo/PayPaymentBo.java
  2. 12
      src/main/java/com/qs/serve/modules/pay/service/impl/PayPaymentServiceImpl.java

4
src/main/java/com/qs/serve/modules/pay/entity/bo/PayPaymentBo.java

@ -31,8 +31,8 @@ public class PayPaymentBo implements Serializable {
private String verificationSubCode; private String verificationSubCode;
/** 支付金额 */ /** 支付金额 */
@DecimalMin(value = "0.01",message = "支付金额必须大于0元") // @DecimalMin(value = "0.01",message = "支付金额必须大于0元")
@NotNull(message = "支付金额不能为空") // @NotNull(message = "支付金额不能为空")
private BigDecimal payAmount; private BigDecimal payAmount;
/** ERP编码 */ /** ERP编码 */

12
src/main/java/com/qs/serve/modules/pay/service/impl/PayPaymentServiceImpl.java

@ -106,6 +106,10 @@ public class PayPaymentServiceImpl extends ServiceImpl<PayPaymentMapper,PayPayme
} }
BigDecimal notPayAmount = verificationAmount.subtract(payedAmount); BigDecimal notPayAmount = verificationAmount.subtract(payedAmount);
if(paymentBo.getPayAmount()==null){
Assert.throwEx("支付金额不能为空!");
}
if(paymentBo.getPayAmount().compareTo(notPayAmount)>0){ if(paymentBo.getPayAmount().compareTo(notPayAmount)>0){
Assert.throwEx("支付金额已超出可支付额"); Assert.throwEx("支付金额已超出可支付额");
} }
@ -218,10 +222,14 @@ public class PayPaymentServiceImpl extends ServiceImpl<PayPaymentMapper,PayPayme
} }
BigDecimal notPayAmount = verificationAmount.subtract(payedAmount); BigDecimal notPayAmount = verificationAmount.subtract(payedAmount);
if(paymentBo.getPayAmount().compareTo(notPayAmount)>0){ if(1 != paymentBo.getRelease()) {
if(paymentBo.getPayAmount()==null){
Assert.throwEx("支付金额不能为空!");
}
if (paymentBo.getPayAmount().compareTo(notPayAmount) > 0) {
Assert.throwEx("支付金额已超出可支付额"); Assert.throwEx("支付金额已超出可支付额");
} }
}
PayPayment payPayment = new PayPayment(); PayPayment payPayment = new PayPayment();
payPayment.setPayType("unPay"); payPayment.setPayType("unPay");

Loading…
Cancel
Save