Authored by mali

下单的时候判断是否已经下架商品

... ... @@ -176,7 +176,7 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi
//step 2: generate skup ,action :set price status(unsaleable)
if (Objects.isNull(goodsInfo)){
log.warn("in computePublishPrd storageId not exist in prd , uid {}, storageId {}", uid, storageId);
throw new GatewayException(400, "商品不存在");
throw new GatewayException(400, "商品已下架");
}
context.setSoldProduct(goodsInfo);
checkPrice(storageId, goodsInfo.getPrice(), true);
... ... @@ -225,6 +225,12 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi
BigDecimal salePrice = context.getSalePrice();
try {
StorageDataResp prdResp = productProxyService.getStorageData(storageId);
if (!Integer.valueOf(1).equals(prdResp.getStatus())) {
log.info("in getProductDetail occur product out shelve, uid {}, storageId {}", uid, storageId);
return null;
}
GoodsInfo goodsInfo = new GoodsInfo();
goodsInfo.setUid(uid);
goodsInfo.setProductId(prdResp.getProductId());
... ...
... ... @@ -26,4 +26,6 @@ public class StorageDataResp {
@JSONField(name = "size")
private GoodsSize size;
@JSONField(name = "status")
private Integer status;
}
... ...
... ... @@ -158,6 +158,7 @@ public class ProductServiceImpl implements ProductService{
if (product != null) {
resp.setProductId(product.getId());
resp.setProductName(product.getProductName());
resp.setStatus(product.getShelveStatus());
}
}
return resp;
... ...