fix:店铺分类问题修改,店铺商品默认值

This commit is contained in:
liyj 2025-06-21 10:20:55 +08:00
parent fc07545790
commit 6433360e5e
4 changed files with 12 additions and 7 deletions

View File

@ -483,7 +483,7 @@ public class SxDataDao extends BaseDao{
log.info("剩余批次更新数: {}", Arrays.toString(remainingCounts)); log.info("剩余批次更新数: {}", Arrays.toString(remainingCounts));
conn.commit(); // 最终提交事务 conn.commit(); // 最终提交事务
log.info("批量更新完成,总记录数: {}" , count); log.info("批量更新完成,总记录数: {}" , count);
baseUpdateImBrancStock(dataBaseInfo); //baseUpdateImBrancStock(dataBaseInfo);
} catch (SQLException e) { } catch (SQLException e) {
conn.rollback(); // 出错时回滚整个事务 conn.rollback(); // 出错时回滚整个事务
e.printStackTrace(); e.printStackTrace();

View File

@ -92,7 +92,7 @@ public interface ShopBaseProductCategoryService extends IBaseService<ShopBasePro
* *
* @access public * @access public
*/ */
boolean cleanCategoryCache(); boolean cleanCategoryCache(String storeId);
/** /**
* 获取查询店铺类型 * 获取查询店铺类型

View File

@ -1034,7 +1034,8 @@ public class ShopBaseProductCategoryServiceImpl extends BaseServiceImpl<ShopBase
throw new ApiException(String.format(I18nUtil._("商品编号 【%s】使用此分类不可以删除"), CollUtil.join(product_ids, ","))); throw new ApiException(String.format(I18nUtil._("商品编号 【%s】使用此分类不可以删除"), CollUtil.join(product_ids, ",")));
} }
cleanCategoryCache(); String storeId= ContextUtil.getCurrentUser().getStore_id();
cleanCategoryCache(storeId);
return remove(category_id); return remove(category_id);
} }
@ -1043,21 +1044,23 @@ public class ShopBaseProductCategoryServiceImpl extends BaseServiceImpl<ShopBase
public boolean editCategory(ShopBaseProductCategory shopBaseProductCategory) { public boolean editCategory(ShopBaseProductCategory shopBaseProductCategory) {
boolean flag = saveOrUpdate(shopBaseProductCategory); boolean flag = saveOrUpdate(shopBaseProductCategory);
cleanCategoryCache(); cleanCategoryCache(shopBaseProductCategory.getStore_id());
return flag; return flag;
} }
@Override @Override
public boolean cleanCategoryCache() { public boolean cleanCategoryCache(String storeId) {
String cache_key = String.format("productCategoryTree:%s", "*"); String cache_key = String.format("productCategoryTree:%s", "*");
Set<String> keys = redisService.keys(cache_key); Set<String> keys = redisService.keys(cache_key);
if (ObjectUtil.isNotNull(keys)) { if (ObjectUtil.isNotNull(keys)) {
redisService.del(keys); redisService.del(keys);
} }
String manageKey=RedisConstant.Product_Cate_Key;//清除管理员的key
redisService.del(RedisConstant.Product_Cate_Key); String storeKey=RedisConstant.Product_Cate_Key+":"+storeId;//清除店铺的key
redisService.del(storeKey);
redisService.del(manageKey);
return true; return true;
} }

View File

@ -0,0 +1,2 @@
alter table shop_product_base modify `shop_weight` decimal(18,4) default NULL COMMENT '总重量';
alter table shop_product_base modify `unit_price` decimal(18,4) default NULL COMMENT '单价';