bug fix --商品是否可售控制

This commit is contained in:
Tankaikai
2025-04-17 10:14:20 +08:00
parent 855d7e7ea4
commit 9615aa33b3
5 changed files with 13 additions and 12 deletions

View File

@@ -407,12 +407,9 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
}
super.updateById(entity);
// 清除商品分类列表缓存
Long categoryId = ObjUtil.defaultIfNull(dto.getCategoryId(), old.getCategoryId());
if (!old.getCategoryId().equals(categoryId)) {
// 清除旧分类缓存&新分类缓存
clearProductCache(old.getCategoryId(), entity.getCategoryId());
} else {
clearProductCache(old.getCategoryId());
clearProductCache(old.getCategoryId());
if (!old.getCategoryId().equals(dto.getCategoryId())) {
clearProductCache(entity.getCategoryId());
}
if (ObjUtil.defaultIfNull(dto.getIsStock(), old.getIsStock()) == YesNoEnum.NO.value()) {
redisService.del(StrUtil.format(CacheConstant.SHOP_PRODUCT_STOCK, shopId, dto.getId()));

View File

@@ -233,9 +233,9 @@ public class UProductServiceImpl extends ServiceImpl<ProductMapper, Product> imp
* @return 是否可售时间 1-是0-否
*/
@Override
public Integer calcIsSaleTime(Integer useTime, LocalTime startTime, LocalTime endTime) {
public Integer calcIsSaleTime(int prodIsSaleTime, Integer useTime, LocalTime startTime, LocalTime endTime) {
if (NumberUtil.nullToZero(useTime) == 0) {
return YesNoEnum.YES.value();
return prodIsSaleTime;
}
if (ObjUtil.isNull(startTime) || ObjUtil.isNull(endTime)) {
return YesNoEnum.NO.value();