From 00f3a60a31dd5f6bcc4a02f03beb15d91cd4b6f8 Mon Sep 17 00:00:00 2001
From: jiangqs <jiangqs>
Date: 星期三, 03 五月 2023 17:43:47 +0800
Subject: [PATCH] 小程序初步完成

---
 ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java |   70 +++++++++++++++++++++++++++--------
 1 files changed, 54 insertions(+), 16 deletions(-)

diff --git a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java
index e448515..85710a6 100644
--- a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java
+++ b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java
@@ -1,24 +1,25 @@
 package com.ruoyi.shop.service.impl.shop;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.shop.domain.dto.*;
 import com.ruoyi.shop.domain.pojo.shop.*;
+import com.ruoyi.shop.domain.vo.AppNearbyShopVo;
 import com.ruoyi.shop.mapper.shop.ShopMapper;
 import com.ruoyi.shop.service.shop.*;
 import com.ruoyi.shop.util.CodeFactoryUtil;
+import com.ruoyi.system.api.RemoteConfigService;
+import com.ruoyi.system.api.RemoteUserService;
+import com.ruoyi.system.api.domain.poji.activity.ActivityGoods;
+import com.ruoyi.system.api.domain.poji.shop.Shop;
+import com.ruoyi.system.api.domain.poji.config.SysTag;
+import com.ruoyi.system.api.domain.poji.member.Member;
 import com.ruoyi.system.api.domain.poji.sys.SysUser;
-import com.ruoyi.shop.domain.dto.MgtChangeCoopDto;
-import com.ruoyi.shop.domain.dto.MgtEditShopDto;
-import com.ruoyi.shop.domain.dto.MgtEditShopTagDto;
-import com.ruoyi.shop.domain.dto.MgtShopPageDto;
-import com.ruoyi.system.domain.pojo.config.SysTag;
-import com.ruoyi.system.domain.pojo.shop.*;
 import com.ruoyi.shop.domain.vo.AppShopInfoVo;
 import com.ruoyi.shop.domain.vo.MgtShopInfoVo;
 import com.ruoyi.shop.domain.vo.MgtShopPageVo;
-import com.ruoyi.system.service.config.SysTagService;
-import com.ruoyi.system.service.shop.*;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.system.service.sys.ISysUserService;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
@@ -50,8 +51,11 @@
     @Resource
     private ShopCertificateService shopCertificateService;
 
+    /*@Resource
+    private RemoteConfigService configService;*/
+
     @Resource
-    private SysTagService sysTagService;
+    private RemoteUserService sysUserService;
 
     @Resource
     private ShopRelTagService shopRelTagService;
@@ -59,8 +63,6 @@
     @Resource
     private ShopRelUserService shopRelUserService;
 
-    @Resource
-    private ISysUserService sysUserService;
 
     /**
      * 获取商户详情
@@ -136,12 +138,12 @@
             for(String str : shopTagIdArray){
                 shopRelTag = new ShopRelTag();
                 tagid = Long.valueOf(str);
-                sysTag = sysTagService.getById(tagid);
+                //sysTag = configService.getSysTag(tagid).getData();
                 shopRelTag.setDelFlag(0);
                 shopRelTag.setShopId(shop.getShopId());
                 shopRelTag.setTagId(tagid);
                 shopRelTagService.save(shopRelTag);
-                shopTagSj.add(sysTag.getTagName());
+                //shopTagSj.add(sysTag.getTagName());
             }
             shop.setShopTags(shopTagSj.toString());
             this.saveOrUpdate(shop);
@@ -156,7 +158,7 @@
             for(String str : relUserIdArray){
                 shopRelUser = new ShopRelUser();
                 userId = Long.valueOf(str);
-                sysUser = sysUserService.selectUserById(userId);
+                sysUser = sysUserService.getSysUser(userId).getData();
                 shopRelUser.setDelFlag(0);
                 shopRelUser.setShopId(shop.getShopId());
                 shopRelUser.setUserId(userId);
@@ -301,7 +303,7 @@
             StringJoiner shopTagSj = new StringJoiner(",");
             for(String str : shopTagIdArray){
                 tagId = Long.valueOf(str);
-                sysTag = sysTagService.getById(tagId);
+                sysTag = sysUserService.getSysTag(tagId).getData();
                 shopRelTag = new ShopRelTag();
                 shopRelTag.setDelFlag(0);
                 shopRelTag.setShopId(shopId);
@@ -316,4 +318,40 @@
         this.saveOrUpdate(shop);
     }
 
+    /**
+     * 获取附近门店
+     * @param appNearbyShopDto
+     * @return
+     */
+    @Override
+    public AppNearbyShopVo getNearbyShop(AppNearbyShopDto appNearbyShopDto,Member member){
+        AppNearbyShopVo appNearbyShopVo = new AppNearbyShopVo();
+        Shop shop = null;
+        if(member.getRelationShopId()!=null){
+            //获取绑定商户
+            shop = this.getById(member.getRelationShopId());
+        }else{
+            //获取附近商户
+            shop = this.getById(1L);
+        }
+        appNearbyShopVo.setShopId(shop.getShopId());
+        appNearbyShopVo.setShopName(shop.getShopName());
+        appNearbyShopVo.setShopAddress(shop.getShopAreaName()+shop.getShopAddress());
+        appNearbyShopVo.setShopLatitude(shop.getShopLatitude());
+        appNearbyShopVo.setShopLongitude(shop.getShopLongitude());
+        return appNearbyShopVo;
+    }
+
+    /**
+     *
+     * @param shopId
+     * @return
+     */
+    @Override
+    public Shop getByShopId(Long shopId){
+        LambdaQueryWrapper<Shop> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.eq(Shop::getDelFlag, 0).eq(Shop::getShopId, shopId);
+        Shop shop = this.getOne(queryWrapper);
+        return shop;
+    }
 }

--
Gitblit v1.7.1