...
|
...
|
@@ -130,19 +130,14 @@ public class SellerOrderPrepareProcessor { |
|
|
throw new ServiceException(ServiceError.ORDER_ORDERS_GOODS_IS_EMPTY);
|
|
|
}
|
|
|
context.setSoldProduct(goodsInfo);
|
|
|
ProductProxyService.PrdPrice prdPrice = null;
|
|
|
ProductProxyService.PrdPrice prdPrice = checkPrice(storageId, salePrice);;
|
|
|
|
|
|
try {
|
|
|
prdPrice = checkPrice(storageId, salePrice, true);
|
|
|
checkSuggestPrice(prdPrice, salePrice);
|
|
|
}catch (Exception ex){
|
|
|
if (ex instanceof UfoServiceException
|
|
|
&& ((UfoServiceException) ex).getCode() == SellerOrderPrepareProcessor.TIPS_ERROR_CODE){
|
|
|
context.setPriceOverFlowTips(((UfoServiceException) ex).getMessage());
|
|
|
}else{
|
|
|
throw ex;
|
|
|
}
|
|
|
context.setPriceOverFlowTips( ex.getMessage());
|
|
|
}
|
|
|
|
|
|
|
|
|
// compute every fee from price
|
|
|
SellerOrderComputeResult computeResult = computeHandler.compute(goodsInfo.getPrice());
|
|
|
checkIncome(storageId, computeResult.getIncome());
|
...
|
...
|
@@ -189,7 +184,7 @@ public class SellerOrderPrepareProcessor { |
|
|
|
|
|
public static final int TIPS_ERROR_CODE = 505;
|
|
|
|
|
|
public ProductProxyService.PrdPrice checkPrice(int storageId, BigDecimal prdPrice, boolean validateMaxPrice) {
|
|
|
public ProductProxyService.PrdPrice checkPrice(int storageId, BigDecimal prdPrice) {
|
|
|
ProductProxyService.PrdPrice prdPriceRange = productProxyService.getPrdPriceRange(storageId);
|
|
|
log.info("in checkPrice, prdPrice {}, storageId {} prdPriceRange {}", prdPrice, storageId, prdPriceRange);
|
|
|
BigDecimal minPrice = prdPriceRange.getMinPrice();
|
...
|
...
|
@@ -199,16 +194,19 @@ public class SellerOrderPrepareProcessor { |
|
|
throw new UfoServiceException(501, "您的出价过低");
|
|
|
}
|
|
|
|
|
|
if (validateMaxPrice && prdPrice.subtract(maxPrice).doubleValue() > 0D){
|
|
|
if (prdPrice.subtract(maxPrice).doubleValue() > 0D){
|
|
|
log.warn("in computePublishPrd,maxPrice {}, storageId {}", maxPrice, storageId);
|
|
|
throw new UfoServiceException(501, "您的出价过高");
|
|
|
}
|
|
|
BigDecimal suggestMaxPrice = prdPriceRange.getSuggestMaxPrice();
|
|
|
if (isOverSuggestMaxPrice(suggestMaxPrice, prdPrice)){
|
|
|
log.warn("in computePublishPrd,prdPrice {}, storageId {} prdPriceRange {}", prdPrice, storageId, prdPriceRange);
|
|
|
return prdPriceRange;
|
|
|
}
|
|
|
|
|
|
public void checkSuggestPrice(ProductProxyService.PrdPrice prdPrice, BigDecimal salePrice){
|
|
|
BigDecimal suggestMaxPrice = prdPrice.getSuggestMaxPrice();
|
|
|
if (isOverSuggestMaxPrice(suggestMaxPrice, salePrice)){
|
|
|
log.warn("in computePublishPrd,prdPrice {}, prdPriceRange {}", salePrice, prdPrice);
|
|
|
throw new UfoServiceException(TIPS_ERROR_CODE, "您的出价已超出建议售价,此商品将不会给顾客展示!");
|
|
|
}
|
|
|
return prdPriceRange;
|
|
|
}
|
|
|
|
|
|
public void checkIncome(int storageId, BigDecimal income) throws GatewayException {
|
...
|
...
|
|