订单折扣问题
付款金额0的问题
This commit is contained in:
@@ -95,6 +95,15 @@ public class CzgControllerAdvice {
|
||||
return CzgResult.failure(ex.getCode(), ex.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付成功
|
||||
* 支付金额为零的统一处理
|
||||
*/
|
||||
@ExceptionHandler(PaySuccessException.class)
|
||||
public CzgResult<Object> handlePaySuccessException() {
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理Hutool的断言抛出异常
|
||||
*/
|
||||
|
||||
@@ -9,6 +9,7 @@ import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -93,7 +94,10 @@ public class CheckOrderPay implements Serializable {
|
||||
}
|
||||
|
||||
public BigDecimal getDiscountRatio() {
|
||||
return discountRatio == null ? BigDecimal.ONE : discountRatio;
|
||||
if (discountRatio == null) {
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
return discountRatio.setScale(2, RoundingMode.UP);
|
||||
}
|
||||
|
||||
public BigDecimal getFullCouponDiscountAmount() {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
package com.czg.exception;
|
||||
|
||||
import com.czg.resp.CzgRespCode;
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.czg.exception;
|
||||
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 自定义异常
|
||||
*
|
||||
* @author admin admin@cashier.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public class PaySuccessException extends RuntimeException {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user