|
|
@@ -102,7 +102,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
|
|
|
@Autowired
|
|
|
private ConfigUtil configUtil;
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
private com.fs.system.service.ISysConfigService configService;
|
|
|
|
|
|
@@ -183,14 +183,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
*/
|
|
|
@Override
|
|
|
public FsStoreProductScrm selectFsStoreProductById(Long productId){
|
|
|
- String key = "fs:product:id:" + productId;
|
|
|
- FsStoreProductScrm scrm = redisCacheT.getCacheObject(key);
|
|
|
- if(scrm != null){
|
|
|
- return scrm;
|
|
|
- }
|
|
|
- scrm = fsStoreProductMapper.selectFsStoreProductById(productId);
|
|
|
- redisCacheT.setCacheObject(key, scrm);
|
|
|
- return scrm;
|
|
|
+ return fsStoreProductMapper.selectFsStoreProductById(productId);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -1071,7 +1064,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
String productName = product != null ? product.getProductName() : "商品";
|
|
|
throw new CustomException(productName + "库存不足,当前库存:" + (productStock != null ? productStock : 0) + ",需要数量:" + cartNum);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 如果有规格,检查规格库存
|
|
|
if (productAttrValueId != null) {
|
|
|
Integer attrStock = fsStoreProductAttrValueMapper.selectProductAttrStockForUpdate(productAttrValueId);
|
|
|
@@ -1082,7 +1075,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
@Override
|
|
|
public void decProductStock(Long productId, Long productAttrValueId, Integer cartNum) {
|
|
|
// 检查配置是否开启库存检查
|
|
|
@@ -1098,7 +1091,7 @@ public class FsStoreProductScrmServiceImpl implements IFsStoreProductScrmService
|
|
|
} catch (Exception e) {
|
|
|
log.error("检查库存配置失败", e);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//处理属性sku
|
|
|
fsStoreProductAttrValueMapper.decProductAttrStock(productAttrValueId,cartNum);
|
|
|
fsStoreProductMapper.decProductAttrStock(productId,cartNum);
|