From ec0809a7833d8a91f96f5c93c6071465795d277d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9D=BE?= <8605635+zhang3064194730@user.noreply.gitee.com> Date: Sat, 15 Feb 2025 11:16:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=97=E9=93=BA=E8=AF=A6=E6=83=85=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../czg/controller/admin/ShopInfoController.java | 4 ++-- .../com/czg/account/service/ShopInfoService.java | 2 +- .../account/service/impl/ShopInfoServiceImpl.java | 14 ++++++++++++-- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/cash-api/account-server/src/main/java/com/czg/controller/admin/ShopInfoController.java b/cash-api/account-server/src/main/java/com/czg/controller/admin/ShopInfoController.java index 744ea36c..680cbb32 100644 --- a/cash-api/account-server/src/main/java/com/czg/controller/admin/ShopInfoController.java +++ b/cash-api/account-server/src/main/java/com/czg/controller/admin/ShopInfoController.java @@ -42,8 +42,8 @@ public class ShopInfoController { */ @SaAdminCheckPermission("shopInfo:detail") @GetMapping("/detail") - public CzgResult detail() { - return CzgResult.success(shopInfoService.detail()); + public CzgResult detail(Integer id) { + return CzgResult.success(shopInfoService.detail(id)); } /** diff --git a/cash-common/cash-common-service/src/main/java/com/czg/account/service/ShopInfoService.java b/cash-common/cash-common-service/src/main/java/com/czg/account/service/ShopInfoService.java index 405882f3..c2dc5c8e 100644 --- a/cash-common/cash-common-service/src/main/java/com/czg/account/service/ShopInfoService.java +++ b/cash-common/cash-common-service/src/main/java/com/czg/account/service/ShopInfoService.java @@ -18,7 +18,7 @@ public interface ShopInfoService extends IService { Boolean edit(ShopInfoEditDTO shopInfoEditDTO); - ShopInfo detail(); + ShopInfo detail(Integer id); ShopInfoByCodeDTO getByCode(String tableCode, String lat, String lng, boolean checkState); } diff --git a/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/ShopInfoServiceImpl.java b/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/ShopInfoServiceImpl.java index 1f197c71..f3a273fd 100644 --- a/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/ShopInfoServiceImpl.java +++ b/cash-service/account-service/src/main/java/com/czg/service/account/service/impl/ShopInfoServiceImpl.java @@ -26,6 +26,8 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.RequestParam; +import java.util.Objects; + /** * @author Administrator */ @@ -118,8 +120,16 @@ public class ShopInfoServiceImpl extends ServiceImpl i } @Override - public ShopInfo detail() { - return queryChain().eq(ShopInfo::getId, StpKit.USER.getLoginIdAsLong()).one(); + public ShopInfo detail(Integer id) { + ShopInfo shopInfo = queryChain().eq(ShopInfo::getId, id).one(); + if (shopInfo == null) { + throw new ApiNotPrintException("店铺信息不存在"); + } + + if (!StpKit.USER.isAdmin() && !Objects.equals(StpKit.USER.getShopId(), shopInfo.getId())) { + throw new ApiNotPrintException("店铺信息不存在"); + } + return shopInfo; } @Override