소스 검색

fix 优惠金额错误

zoujiajian 3 년 전
부모
커밋
73c8a4f09a
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      netflix-service/src/main/java/com/cyksj/service/order/impl/OrderDonServiceImpl.java

+ 4 - 0
netflix-service/src/main/java/com/cyksj/service/order/impl/OrderDonServiceImpl.java

@@ -1962,6 +1962,7 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 	 * 使用优惠营销 订单金额抵扣
 	 */
 	public void deductOrderMoney(OrderDon orderDon, CouponUser couponUser, BigDecimal balance, User user, BigDecimal skuMoney, Integer goodsType) {
+		BigDecimal first_money = orderDon.getMoney();
 		//存在优惠券
 		if (couponUser != null) {
 			Long couponId = couponUser.getCouponId();
@@ -1981,6 +1982,9 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 				orderDon.setMoney(subtractMoney);
 				couponMoney = orderDon.getRealMoney().subtract(subtractMoney);
 			}
+			if (couponMoney != null && couponMoney.compareTo(first_money) >= 0) {
+				throw BusinessRuntimeException.getInstance("支付金额不能小于优惠金额");
+			}
 			orderDon.setCouponMoney(couponMoney);
 			orderDon.setCouponUserId(couponUser.getId());
 		}