From c5c5e7d92933e31b3b9097165551df72e3c6df83 Mon Sep 17 00:00:00 2001 From: Jack <46790855@qq.com> Date: Thu, 19 Jun 2025 09:06:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E5=95=86=E5=93=81?= =?UTF-8?q?=E5=BA=93=E7=9B=B8=E5=85=B3=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/ShopProductItemServiceImpl.java | 5 +- .../admin/ShopStoreBaseController.java | 13 +++++ .../store/service/ShopStoreBaseService.java | 10 +++- .../impl/ShopStoreBaseServiceImpl.java | 52 +++++++++++++++++-- 4 files changed, 72 insertions(+), 8 deletions(-) diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/product/service/impl/ShopProductItemServiceImpl.java b/mall-shop/src/main/java/com/suisung/mall/shop/product/service/impl/ShopProductItemServiceImpl.java index 1a3ed487..3107d1f6 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/product/service/impl/ShopProductItemServiceImpl.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/product/service/impl/ShopProductItemServiceImpl.java @@ -157,7 +157,6 @@ public class ShopProductItemServiceImpl extends BaseServiceImpl { */ BigDecimal getStorePlatformRatio(Integer storeId, boolean reCalculate); + /** + * 修改店铺的营业状态 + * + * @param storeId + * @param bizState 营业状态 1-营业;2-打烊 + * @return + */ + Boolean updateStoreBizState(Integer storeId, Integer bizState); + } diff --git a/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopStoreBaseServiceImpl.java b/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopStoreBaseServiceImpl.java index 9dcd3438..86c4537c 100644 --- a/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopStoreBaseServiceImpl.java +++ b/mall-shop/src/main/java/com/suisung/mall/shop/store/service/impl/ShopStoreBaseServiceImpl.java @@ -6,7 +6,6 @@ import cn.hutool.core.collection.ListUtil; import cn.hutool.core.convert.Convert; import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateUtil; -import cn.hutool.core.map.MapUtil; import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; @@ -65,7 +64,6 @@ import com.suisung.mall.shop.store.service.*; import com.suisung.mall.shop.user.service.ShopUserFavoritesStoreService; import com.suisung.mall.shop.wechat.service.WxQrCodeService; import io.seata.spring.annotation.GlobalTransactional; -import org.apache.poi.ss.formula.functions.T; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -740,6 +738,7 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl() + .eq("store_id", storeId) + .set("store_biz_state", bizState)); + + if (updated) { + logger.info("成功更新店铺营业状态,店铺ID: {},营业状态: {}", storeId, bizState); + } else { + logger.warn("更新店铺营业状态失败,店铺ID: {}。更新操作返回 false。", storeId); + } + + return updated; + } catch (Exception e) { + // 捕获并记录异常 + logger.error("更新店铺营业状态时发生异常,店铺ID: {}", storeId, e); + return false; // 发生异常时返回 false + } + } + /** * 处理 store_slide 字段 * @@ -3680,7 +3724,7 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl fixStoreDataShopBaseProductType(List rows) { if (CollUtil.isNotEmpty(rows)) { - List shopBaseProductTypes= rows; + List shopBaseProductTypes = rows; List store_ids = shopBaseProductTypes.stream().map(s -> Convert.toInt(s.getStore_id())).distinct().collect(Collectors.toList()); List store_rows = gets(store_ids); for (ShopBaseProductType row : shopBaseProductTypes) { @@ -3702,7 +3746,7 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl fixStoreDataShopBaseProductSpec(List rows) { if (CollUtil.isNotEmpty(rows)) { - List shopBaseProductSpecs= rows; + List shopBaseProductSpecs = rows; List store_ids = shopBaseProductSpecs.stream().map(s -> Convert.toInt(s.getStore_id())).distinct().collect(Collectors.toList()); List store_rows = gets(store_ids); for (ShopBaseProductSpec row : shopBaseProductSpecs) {