Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
253d05303d
@ -4215,7 +4215,7 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
|||||||
if (ObjectUtil.equal(order_item_inventory_lock, 1001) || ObjectUtil.equal(order_item_inventory_lock, 1002)) {
|
if (ObjectUtil.equal(order_item_inventory_lock, 1001) || ObjectUtil.equal(order_item_inventory_lock, 1002)) {
|
||||||
Long item_id = order_item_row.getItem_id();
|
Long item_id = order_item_row.getItem_id();
|
||||||
ShopProductItem shopProductItem = shopProductItemService.get(item_id);
|
ShopProductItem shopProductItem = shopProductItemService.get(item_id);
|
||||||
if (shopProductItem != null && CheckUtil.isEmpty(shopProductItem.getItem_src_id())) {
|
if (shopProductItem != null && CheckUtil.isNotEmpty(shopProductItem.getItem_src_id())) {
|
||||||
shopProductItem.setItem_quantity_frozen(shopProductItem.getItem_quantity_frozen() - order_item_quantity);
|
shopProductItem.setItem_quantity_frozen(shopProductItem.getItem_quantity_frozen() - order_item_quantity);
|
||||||
if (!shopProductItemService.edit(shopProductItem)) {
|
if (!shopProductItemService.edit(shopProductItem)) {
|
||||||
throw new ApiException(String.format(I18nUtil._("释放: %s 冻结库存失败!"), order_item_row.getItem_id()));
|
throw new ApiException(String.format(I18nUtil._("释放: %s 冻结库存失败!"), order_item_row.getItem_id()));
|
||||||
@ -7228,7 +7228,7 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
|||||||
|
|
||||||
// start 判断增加冻结库存
|
// start 判断增加冻结库存
|
||||||
Integer _product_inventory_lock = Convert.toInt(_item.get("product_inventory_lock"));
|
Integer _product_inventory_lock = Convert.toInt(_item.get("product_inventory_lock"));
|
||||||
if (ObjectUtil.equal(_product_inventory_lock, 1001) && CheckUtil.isEmpty(item_src_id)) {
|
if (ObjectUtil.equal(_product_inventory_lock, 1001) && CheckUtil.isNotEmpty(item_src_id)) {
|
||||||
if (shopProductItemService.lockSkuStock(item_id, cart_quantity) <= 0) {
|
if (shopProductItemService.lockSkuStock(item_id, cart_quantity) <= 0) {
|
||||||
throw new ApiException(String.format(I18nUtil._("更改: %s 冻结库存失败!"), item.get("item_id")));
|
throw new ApiException(String.format(I18nUtil._("更改: %s 冻结库存失败!"), item.get("item_id")));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -853,20 +853,21 @@ public class SyncThirdDataServiceImpl extends SyncBaseThirdSxAbstract implements
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ShopProductItem spuItem = shopProductItems.get(0);
|
ShopProductItem spuItem = shopProductItems.get(0);
|
||||||
cn.hutool.json.JSONArray array_item_spec= JSONUtil.parseArray(spuItem.getItem_spec());
|
String key=RedisKey.STOREDATARELEASE+":"+spuItem.getStore_id();
|
||||||
if(array_item_spec.isEmpty()){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
cn.hutool.json.JSONObject item = (cn.hutool.json.JSONObject) ((cn.hutool.json.JSONObject) array_item_spec.get(0)).get("item");
|
|
||||||
String name = Convert.toStr(item.get("name"));
|
|
||||||
BigDecimal itemQuaryty = getBigDecimal(delta, name);
|
|
||||||
Long productId = spuItem.getProduct_id();
|
Long productId = spuItem.getProduct_id();
|
||||||
ShopProductBase productBase = shopProductBaseService.get(productId);
|
ShopProductBase productBase = shopProductBaseService.get(productId);
|
||||||
if(productBase==null){
|
if(productBase==null){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String itemId=productBase.getProduct_number();
|
String itemId=productBase.getProduct_number();
|
||||||
String key=RedisKey.STOREDATARELEASE+":"+productBase.getStore_id();
|
cn.hutool.json.JSONArray array_item_spec= JSONUtil.parseArray(spuItem.getItem_spec());
|
||||||
|
if(array_item_spec.isEmpty()){
|
||||||
|
redisTemplate.opsForHash().increment(key, spuItem.getItem_id(), delta.doubleValue());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
cn.hutool.json.JSONObject item = (cn.hutool.json.JSONObject) ((cn.hutool.json.JSONObject) array_item_spec.get(0)).get("item");
|
||||||
|
String name = Convert.toStr(item.get("name"));
|
||||||
|
BigDecimal itemQuaryty = getBigDecimal(delta, name);
|
||||||
// 使用 Redis 的 HINCRBY 保证原子性和高性能
|
// 使用 Redis 的 HINCRBY 保证原子性和高性能
|
||||||
redisTemplate.opsForHash().increment(key, itemId, itemQuaryty.doubleValue());
|
redisTemplate.opsForHash().increment(key, itemId, itemQuaryty.doubleValue());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user