...
|
...
|
@@ -16,8 +16,9 @@ public class VipPriceLogicService { |
|
|
/**
|
|
|
* 设置计划的vip价格
|
|
|
*/
|
|
|
public void fillProductPricePlanVipPrice(ProductPricePlan p){
|
|
|
VipPriceBO vipPriceBO = this.getVipPriceBO(p.getCurrentSaleprice(), p.getVipPrice(), p.getVip1Price(), p.getVip2Price(), p.getVip3Price(), p.getVipDiscountType(), p.getVipDiscount());
|
|
|
public void fillProductPricePlanVipPrice(ProductPricePlan p) {
|
|
|
VipPriceBO vipPriceBO = this.getVipPriceBO(p.getCurrentSaleprice(), p.getVipDiscountType(), p.getVipPrice(), p.getVip1Price(), p.getVip2Price(), p.getVip3Price(),
|
|
|
p.getVipDiscount());
|
|
|
p.setVip1Price(vipPriceBO.getVip1PriceBigDecimal());
|
|
|
p.setVip2Price(vipPriceBO.getVip2PriceBigDecimal());
|
|
|
p.setVip3Price(vipPriceBO.getVip3PriceBigDecimal());
|
...
|
...
|
@@ -26,18 +27,21 @@ public class VipPriceLogicService { |
|
|
/**
|
|
|
* 计算并重设vip相关价格
|
|
|
*/
|
|
|
public void fillProductPriceVipPrice(ProductPriceBO productPriceBO){
|
|
|
VipPriceBO vipPriceBO = this.getVipPriceBO(productPriceBO.getSalesPrice(), productPriceBO.getVipPrice(), productPriceBO.getVip1Price(), productPriceBO.getVip2Price(), productPriceBO.getVip3Price(), productPriceBO.getCurrentVipDiscountType(),
|
|
|
productPriceBO.getVipDiscount());
|
|
|
public void fillProductPriceVipPrice(ProductPriceBO productPriceBO) {
|
|
|
/**
|
|
|
* salesPrice等于productPrice表的currentPrice,
|
|
|
* type是productPrice表的currentVipDiscountType
|
|
|
*/
|
|
|
VipPriceBO vipPriceBO = this.getVipPriceBO(productPriceBO.getSalesPrice(), productPriceBO.getVipDiscountType(), productPriceBO.getVipPrice(),
|
|
|
productPriceBO.getVip1Price(), productPriceBO.getVip2Price(), productPriceBO.getVip3Price(), productPriceBO.getVipDiscount());
|
|
|
productPriceBO.setVip1Price(vipPriceBO.getVip1PriceBigDecimal());
|
|
|
productPriceBO.setVip2Price(vipPriceBO.getVip2PriceBigDecimal());
|
|
|
productPriceBO.setVip3Price(vipPriceBO.getVip3PriceBigDecimal());
|
|
|
|
|
|
//设置vipLevels
|
|
|
// 设置vipLevels
|
|
|
double salesPrice = this.getDoubleFromBigDecimal(productPriceBO.getSalesPrice());
|
|
|
double vip1Price = productPriceBO.getVip1Price().doubleValue();
|
|
|
double vip2Price = productPriceBO.getVip2Price().doubleValue();
|
|
|
double vip3Price = productPriceBO.getVip3Price().doubleValue();
|
|
|
double vip1Price = this.getDoubleFromBigDecimal(productPriceBO.getVip1Price());
|
|
|
double vip2Price = this.getDoubleFromBigDecimal(productPriceBO.getVip2Price());
|
|
|
double vip3Price = this.getDoubleFromBigDecimal(productPriceBO.getVip3Price());
|
|
|
List<String> vipLevels = new ArrayList<String>();
|
|
|
if (vip1Price > 0 && vip1Price < salesPrice) {
|
|
|
vipLevels.add("1");
|
...
|
...
|
@@ -52,20 +56,17 @@ public class VipPriceLogicService { |
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* salesPrice等于productPrice表的currentPrice,type是productPrice表的currentVipDiscountType
|
|
|
*/
|
|
|
private VipPriceBO getVipPriceBO(BigDecimal salesPrice, BigDecimal vipPrice, BigDecimal vip1Price, BigDecimal vip2Price, BigDecimal vip3Price, Integer type,
|
|
|
BigDecimal vipDiscount) {
|
|
|
double salesPriceDoubleCeil = Math.ceil(this.getDoubleFromBigDecimal(salesPrice));
|
|
|
private VipPriceBO getVipPriceBO(BigDecimal currentSalesPrice, Integer currentVipDiscountType, BigDecimal vipPrice, BigDecimal vip1Price, BigDecimal vip2Price,
|
|
|
BigDecimal vip3Price, BigDecimal vipDiscount) {
|
|
|
double salesPriceDoubleCeil = Math.ceil(this.getDoubleFromBigDecimal(currentSalesPrice));
|
|
|
// 默认取销售价
|
|
|
double vip1PriceResult = salesPriceDoubleCeil;
|
|
|
double vip2PriceResult = salesPriceDoubleCeil;
|
|
|
double vip3PriceResult = salesPriceDoubleCeil;
|
|
|
if (type == null) {
|
|
|
if (currentVipDiscountType == null) {
|
|
|
return new VipPriceBO(vip1PriceResult, vip2PriceResult, vip3PriceResult);
|
|
|
}
|
|
|
switch (type) {
|
|
|
switch (currentVipDiscountType) {
|
|
|
case 1:
|
|
|
vip1PriceResult = Double.valueOf(String.format("%.2f", salesPriceDoubleCeil * 0.95));
|
|
|
vip2PriceResult = Double.valueOf(String.format("%.2f", salesPriceDoubleCeil * 0.9));
|
...
|
...
|
|