|
|
@@ -160,7 +160,7 @@ public class FsStoreCartScrmServiceImpl implements IFsStoreCartScrmService
|
|
|
// 检查并调整限购数量
|
|
|
Integer adjustedNum = adjustPurchaseLimit(uid, cartParam.getProductId(), cartParam.getCartNum());
|
|
|
cartParam.setCartNum(adjustedNum);
|
|
|
-
|
|
|
+
|
|
|
//如果是直接购买,直接写入记录
|
|
|
if(cartParam.getIsBuy()==1){
|
|
|
FsStoreCartScrm storeCart = FsStoreCartScrm.builder()
|
|
|
@@ -254,19 +254,19 @@ public class FsStoreCartScrmServiceImpl implements IFsStoreCartScrmService
|
|
|
if (product == null) {
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 如果商品没有设置限购,直接返回
|
|
|
if (product.getPurchaseLimit() == null || product.getPurchaseLimit() <= 0) {
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 查询用户已购买的数量
|
|
|
FsStoreProductPurchaseLimitScrm purchaseLimit = purchaseLimitService.selectByProductIdAndUserId(productId, userId);
|
|
|
int purchasedNum = 0;
|
|
|
if (purchaseLimit != null) {
|
|
|
purchasedNum = purchaseLimit.getNum();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 检查是否超过限购数量
|
|
|
if (purchasedNum + num > product.getPurchaseLimit()) {
|
|
|
int productTotalNum = purchasedNum + num;
|
|
|
@@ -291,19 +291,19 @@ public class FsStoreCartScrmServiceImpl implements IFsStoreCartScrmService
|
|
|
if (product == null) {
|
|
|
return num;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 如果商品没有设置限购,直接返回原数量
|
|
|
if (product.getPurchaseLimit() == null || product.getPurchaseLimit() <= 0) {
|
|
|
return num;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 查询用户已购买的数量
|
|
|
FsStoreProductPurchaseLimitScrm purchaseLimit = purchaseLimitService.selectByProductIdAndUserId(productId, userId);
|
|
|
int purchasedNum = 0;
|
|
|
if (purchaseLimit != null) {
|
|
|
purchasedNum = purchaseLimit.getNum();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 检查是否超过限购数量
|
|
|
if (purchasedNum + num > product.getPurchaseLimit()) {
|
|
|
// 如果超过限购,设置数量为限购的最大数量
|
|
|
@@ -313,7 +313,7 @@ public class FsStoreCartScrmServiceImpl implements IFsStoreCartScrmService
|
|
|
}
|
|
|
return maxAllowed; // 返回最大可购买数量
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
return num; // 未超过限购,返回原数量
|
|
|
}
|
|
|
|
|
|
@@ -327,7 +327,7 @@ public class FsStoreCartScrmServiceImpl implements IFsStoreCartScrmService
|
|
|
//单品
|
|
|
ErpGoodsStockQueryRequert queryRequert = new ErpGoodsStockQueryRequert();
|
|
|
queryRequert.setBarcode(productAttrValue.getBarCode());
|
|
|
- ErpGoodsStockQueryResponse goodsStock = goodsService.getGoodsStockScrm(queryRequert);
|
|
|
+ ErpGoodsStockQueryResponse goodsStock = goodsService.getGoodsStock(queryRequert);
|
|
|
if(goodsStock != null && goodsStock.getStocks() != null && !goodsStock.getStocks().isEmpty()){
|
|
|
|
|
|
// int stocks = Double.valueOf(goodsStock.getStocks().get(0).getSalable_qty()).intValue();
|