|
@@ -26,6 +26,7 @@ import org.springframework.context.annotation.Lazy;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -119,13 +120,23 @@ public class OrderService extends ServiceImpl<OrderMapper, Order> {
|
|
//计算商品价格
|
|
//计算商品价格
|
|
GoodImp goodImp = goodFactory.getClass(type);
|
|
GoodImp goodImp = goodFactory.getClass(type);
|
|
Double allPrice = goodImp.computePrice(goodVOS);
|
|
Double allPrice = goodImp.computePrice(goodVOS);
|
|
- Double withVocherPrice =allPrice-voucherMon;
|
|
|
|
- if(withVocherPrice<=0){
|
|
|
|
- withVocherPrice=0d;
|
|
|
|
|
|
+ System.out.println("总价"+allPrice);
|
|
|
|
+ System.out.println("卷值"+voucherMon);
|
|
|
|
+ BigDecimal allPriceBig =new BigDecimal(allPrice.toString());
|
|
|
|
+ BigDecimal voucherMonBig =new BigDecimal(voucherMon.toString());
|
|
|
|
+ BigDecimal withVocherPriceBig =allPriceBig.subtract(voucherMonBig);
|
|
|
|
+ BigDecimal discontBig =new BigDecimal(discount.toString());
|
|
|
|
+
|
|
|
|
+ if(voucherMonBig.doubleValue()<=0){
|
|
|
|
+ withVocherPriceBig=new BigDecimal("0");
|
|
}
|
|
}
|
|
//查看是否有折扣
|
|
//查看是否有折扣
|
|
// 计算价格 (商品总价格-优惠券) *折扣
|
|
// 计算价格 (商品总价格-优惠券) *折扣
|
|
- Double truePrice =withVocherPrice*discount;
|
|
|
|
|
|
+ BigDecimal truePriceBig =withVocherPriceBig.multiply(discontBig);
|
|
|
|
+ System.out.println("价格"+truePriceBig);
|
|
|
|
+
|
|
|
|
+ System.out.println("折扣"+discontBig);
|
|
|
|
+ Double truePrice=truePriceBig.doubleValue();
|
|
if(!truePrice.equals(price)){
|
|
if(!truePrice.equals(price)){
|
|
throw new BusinessException(ExceptionEnum.BUSINESS_ERROR,"价格错误");
|
|
throw new BusinessException(ExceptionEnum.BUSINESS_ERROR,"价格错误");
|
|
}
|
|
}
|