jiangqs
2023-04-30 dca0031ad5552679d6dfbb80d6edd7adbfc7ec2c
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java
@@ -1,24 +1,22 @@
package com.ruoyi.shop.service.impl.shop;
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.RemoteActivityService;
import com.ruoyi.system.api.RemoteConfigService;
import com.ruoyi.system.api.RemoteUserService;
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;
@@ -51,7 +49,10 @@
    private ShopCertificateService shopCertificateService;
    @Resource
    private SysTagService sysTagService;
    private RemoteConfigService configService;
    @Resource
    private RemoteUserService sysUserService;
    @Resource
    private ShopRelTagService shopRelTagService;
@@ -59,8 +60,6 @@
    @Resource
    private ShopRelUserService shopRelUserService;
    @Resource
    private ISysUserService sysUserService;
    /**
     * 获取商户详情
@@ -136,7 +135,7 @@
            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);
@@ -156,7 +155,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 +300,7 @@
            StringJoiner shopTagSj = new StringJoiner(",");
            for(String str : shopTagIdArray){
                tagId = Long.valueOf(str);
                sysTag = sysTagService.getById(tagId);
                sysTag = configService.getSysTag(tagId).getData();
                shopRelTag = new ShopRelTag();
                shopRelTag.setDelFlag(0);
                shopRelTag.setShopId(shopId);
@@ -316,4 +315,27 @@
        this.saveOrUpdate(shop);
    }
    /**
     * 获取附近门店
     * @param appNearbyShopDto
     * @return
     */
    @Override
    public AppNearbyShopVo getNearbyShop(AppNearbyShopDto appNearbyShopDto,Member member){
        AppNearbyShopVo appNearbyShopVo = new AppNearbyShopVo();
        Shop shop = null;
        if(member.getRealtionShopId()!=null){
            //获取绑定商户
            shop = this.getById(member.getRealtionShopId());
        }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;
    }
}