From eb5d7885fa9e4bd20c0827eec9b4cdd48c47b509 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期二, 07 一月 2025 09:11:20 +0800
Subject: [PATCH] 修改bug

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java |   50 +++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 47 insertions(+), 3 deletions(-)

diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java
index 859cc37..ff0db3a 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java
@@ -12,9 +12,13 @@
 import com.ruoyi.common.security.service.TokenService;
 import com.ruoyi.common.security.utils.SecurityUtils;
 import com.ruoyi.order.vo.VerifiableShopVo;
+import com.ruoyi.other.api.domain.Goods;
+import com.ruoyi.other.api.domain.GoodsShop;
 import com.ruoyi.other.api.domain.Shop;
 import com.ruoyi.other.api.domain.ShopScore;
 import com.ruoyi.other.mapper.ShopMapper;
+import com.ruoyi.other.service.GoodsService;
+import com.ruoyi.other.service.GoodsShopService;
 import com.ruoyi.other.service.ShopScoreService;
 import com.ruoyi.other.service.ShopService;
 import com.ruoyi.other.util.GeodesyUtil;
@@ -69,6 +73,10 @@
     private UserShopClient userShopClient;
     @Resource
     private AppUserShopClient appUserShopClient;
+    @Resource
+    private GoodsService goodsService;
+    @Resource
+    private GoodsShopService goodsShopService;
 
 
 
@@ -127,6 +135,7 @@
                 userShop.setUserId(sysUser.getUserId());
                 userShop.setShopId(shop.getId());
                 userShop.setRoleType(1);
+                userShop.setRoleId(2L);
                 userShopClient.saveUserShop(userShop);
             }
         }else{
@@ -150,6 +159,7 @@
             userShop.setUserId(userId);
             userShop.setShopId(shop.getId());
             userShop.setRoleType(1);
+            userShop.setRoleId(2L);
             userShopClient.saveUserShop(userShop);
         }
         return R.ok();
@@ -243,6 +253,7 @@
                 userShop.setUserId(sysUser.getUserId());
                 userShop.setShopId(shop.getId());
                 userShop.setRoleType(1);
+                userShop.setRoleId(2L);
                 userShopClient.saveUserShop(userShop);
             }
         }else{
@@ -266,10 +277,27 @@
             userShop.setUserId(userId);
             userShop.setShopId(shop.getId());
             userShop.setRoleType(1);
+            userShop.setRoleId(2L);
             userShopClient.saveUserShop(userShop);
         }
         return R.ok();
     }
+
+
+    @PutMapping("/freezingOrThawing")
+    @ApiOperation(value = "门店管理-冻结/解冻门店", tags = {"管理后台-门店管理"})
+    public R freezingOrThawing(@RequestParam("id") Integer id, @RequestParam("status") Integer status){
+        Shop shop = shopService.getById(id);
+        if(shop.getStatus().equals(status)){
+            return R.fail("不能重复操作");
+        }
+        shop.setStatus(status);
+        shopService.updateById(shop);
+        return R.ok();
+    }
+
+
+
 
     @GetMapping("/list")
     @ApiOperation(value = "门店列表", tags = {"管理后台-门店管理"})
@@ -406,7 +434,7 @@
     @ResponseBody
     @PostMapping("/getShopByUserId")
     public R<List<Shop>> getShopByUserId(@RequestParam("id") Long id){
-        List<Shop> list = shopService.lambdaQuery().eq(Shop::getAppUserId, id).list();
+        List<Shop> list = shopService.lambdaQuery().eq(Shop::getAppUserId, id).eq(Shop::getDelFlag,0).list();
         return R.ok(list);
     }
     
@@ -462,15 +490,31 @@
     @ResponseBody
     @GetMapping("/getVerifiableShop")
     @ApiOperation(value = "获取可核销门店列表", tags = {"购物车-小程序"})
-    public R<List<VerifiableShopVo>> getVerifiableShop(String longitude, String latitude){
+    public R<List<VerifiableShopVo>> getVerifiableShop(String longitude, String latitude, Integer goodsId){
         String city = TencentMapUtil.inverseGeographicalAnalysis(longitude, latitude, false);
+        if(null == city){
+            city = "510100";
+        }
         city = city.substring(0, 4) + "00";
-        List<Shop> list = shopService.list(new LambdaQueryWrapper<Shop>().eq(Shop::getDelFlag, 0).eq(Shop::getCityCode, city));
+        LambdaQueryWrapper<Shop> wrapper = new LambdaQueryWrapper<Shop>().eq(Shop::getDelFlag, 0).eq(Shop::getCityCode, city);
+        if(null != goodsId){
+            Goods goods = goodsService.getById(goodsId);
+            if(1 == goods.getType() && 1 == goods.getAppointStore()){
+                List<Integer> collect = goodsShopService.list(new LambdaQueryWrapper<GoodsShop>().eq(GoodsShop::getGoodsId, goods.getId()))
+                        .stream().map(GoodsShop::getShopId).collect(Collectors.toList());
+                if(collect.size() > 0){
+                    wrapper.in(Shop::getId, collect);
+                }
+            }
+        }
+        List<Shop> list = shopService.list(wrapper);
         List<VerifiableShopVo> verifiableShopVoList = new ArrayList<>();
         for (Shop shop : list) {
             VerifiableShopVo vo = new VerifiableShopVo();
             vo.setId(shop.getId());
             vo.setName(shop.getName());
+            vo.setAddress(shop.getAddress());
+            vo.setHomePicture(shop.getHomePicture());
             Double wgs84 = GeodesyUtil.getDistance(longitude + "," + latitude, shop.getLongitude() + "," + shop.getLatitude()).get("WGS84");
             vo.setDistance(wgs84.longValue());
             verifiableShopVoList.add(vo);

--
Gitblit v1.7.1