Authored by mali

根据销售价算保证金价格去除最高售价

... ... @@ -130,14 +130,14 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi
return null;
}
checkPrice(storageId, prdPrice);
checkPrice(storageId, prdPrice, false);
return buildSoldPrdComputeBo(prdPrice);
}
void checkPrice(int storageId, BigDecimal prdPrice) throws GatewayException {
void checkPrice(int storageId, BigDecimal prdPrice, boolean validateMaxPrice) throws GatewayException {
ProductInfo productInfo = productProxyService.getPrdPriceRange(storageId);
BigDecimal minPrice = productInfo.getMinPrice();
BigDecimal maxPrice = productInfo.getMaxPrice();
... ... @@ -146,10 +146,10 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi
throw new GatewayException(501, "出售价格低于商品最低价:" + minPrice.toPlainString());
}
//if (prdPrice.subtract(maxPrice).doubleValue() > 0D){
// log.warn("in computePublishPrd,maxPrice {}, storageId {}", maxPrice, storageId);
// throw new GatewayException(501, "出售价格大于商品最高价:" + maxPrice.toPlainString());
//} 此处不校验是否超出最大销售价,超出的话,按最高保证金计算
if (validateMaxPrice && prdPrice.subtract(maxPrice).doubleValue() > 0D){
log.warn("in computePublishPrd,maxPrice {}, storageId {}", maxPrice, storageId);
throw new GatewayException(501, "出售价格大于商品最高价:" + maxPrice.toPlainString());
}
}
void checkIncome(int storageId, BigDecimal income) throws GatewayException {
... ... @@ -179,7 +179,7 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi
throw new GatewayException(400, "商品不存在");
}
context.setSoldProduct(goodsInfo);
checkPrice(storageId, goodsInfo.getPrice());
checkPrice(storageId, goodsInfo.getPrice(), true);
// compute every fee from price
SellerOrderComputeResult computeResult = computeHandler.compute(goodsInfo.getPrice());
checkIncome(storageId, computeResult.getIncome());
... ...