From 64a56ac4c2b5f9fb1482002b95b5933f8613c17c Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Thu, 26 Sep 2024 16:00:52 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E8=AF=A6=E6=83=85=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/cashierservice/controller/ProductController.java | 2 +- .../system/cashierservice/service/ProductService.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/controller/ProductController.java b/src/main/java/com/chaozhanggui/system/cashierservice/controller/ProductController.java index 3dc9fe1..8032b54 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/controller/ProductController.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/controller/ProductController.java @@ -45,7 +45,7 @@ public class ProductController { @RequestParam(required = false) String code, @RequestParam(required = false) Integer shopId ) { - if (shopId == null && StrUtil.isNotBlank(code)) { + if (shopId == null && StrUtil.isBlank(code)) { return Result.fail("参数缺失"); } return productService.queryShopIdByTableCode(userId, openId, code,lat,lng, shopId); diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/ProductService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/ProductService.java index 34eb0a0..8df6bc1 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/ProductService.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/ProductService.java @@ -131,7 +131,7 @@ public class ProductService { } } - TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(shopId); + TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(shopId != null ? shopId : tbShopTable.getShopId()); String distance = LocationUtils.getDistanceString( Double.parseDouble(lng), Double.parseDouble(lat), Double.parseDouble(shopInfo.getLng()), Double.parseDouble(shopInfo.getLat())); @@ -148,7 +148,7 @@ public class ProductService { concurrentMap.put("shopTableInfo", tbShopTable); concurrentMap.put("storeInfo", shopInfo); concurrentMap.put("distance", distance); - TbShopUser shopUser = tbShopUserMapper.selectByUserIdAndShopId(userId, shopId.toString()); + TbShopUser shopUser = tbShopUserMapper.selectByUserIdAndShopId(userId, shopId != null ? shopId.toString() : tbShopTable.getShopId().toString()); try { if (ObjectUtil.isEmpty(shopUser)) { TbUserInfo tbUserInfo = tbUserInfoMapper.selectByPrimaryKey(Integer.valueOf(userId)); @@ -169,7 +169,7 @@ public class ProductService { shopUser.setConsumeNumber(0); shopUser.setLevelConsume(BigDecimal.ZERO); shopUser.setStatus(Byte.parseByte("1")); - shopUser.setShopId(shopId.toString()); + shopUser.setShopId(shopId != null ? shopId.toString() : tbShopTable.getShopId().toString()); shopUser.setUserId(userId); shopUser.setMiniOpenId(openId); shopUser.setCreatedAt(System.currentTimeMillis());