无关风月
2024-07-11 eb6b6dbb35a9f029e0b7d269773685c19fd40976
cloud-server-other/src/main/java/com/dsh/other/service/impl/StoreServiceImpl.java
@@ -3,10 +3,12 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dsh.other.entity.OperatorUser;
import com.dsh.other.entity.Store;
import com.dsh.other.mapper.StoreMapper;
import com.dsh.other.model.BaseVo;
import com.dsh.other.model.ProvinceAndCityVo;
import com.dsh.other.model.dto.siteDto.StoreInfoDto;
import com.dsh.other.service.StoreService;
import com.dsh.other.util.GDMapGeocodingUtil;
import com.dsh.other.util.ToolUtil;
@@ -27,7 +29,7 @@
 * @since 2023-06-14
 */
@Service
public class StoreServiceImpl extends ServiceImpl<StoreMapper,Store> implements StoreService {
public class StoreServiceImpl extends ServiceImpl<StoreMapper, Store> implements StoreService {
    @Autowired
    private StoreMapper storeMapper;
@@ -37,6 +39,7 @@
    /**
     * 根据城市管理员id获取门店集合
     *
     * @param id
     * @return
     */
@@ -44,8 +47,10 @@
    public List<Store> getStoreByCityManagerId(Integer id) {
        return storeMapper.getStoreByCityManagerId(id);
    }
    /**
     * 根据门店员工id获取门店集合
     *
     * @param id
     * @return
     */
@@ -65,9 +70,20 @@
        return this.baseMapper.game(appUserId);
    }
    @Override
    public OperatorUser queryByStoreId(Integer id) {
        return this.baseMapper.queryByStoreId(id);
    }
    @Override
    public StoreInfoDto getStoreInfo(Integer id) {
        return this.baseMapper.getStoreInfo(id);
    }
    /**
     * 获取列表数据
     *
     * @param provinceCode
     * @param cityCode
     * @return
@@ -76,10 +92,10 @@
    @Override
    public List<Store> queryStorsList(String provinceCode, String cityCode) throws Exception {
        QueryWrapper objectQueryWrapper = new QueryWrapper<Store>().eq("state", 1);
        if(ToolUtil.isNotEmpty(provinceCode)){
        if (ToolUtil.isNotEmpty(provinceCode)) {
            objectQueryWrapper.eq("provinceCode", provinceCode);
        }
        if(ToolUtil.isNotEmpty(cityCode)){
        if (ToolUtil.isNotEmpty(cityCode)) {
            objectQueryWrapper.eq("cityCode", cityCode);
        }
        List<Store> list = this.list(objectQueryWrapper);
@@ -89,27 +105,28 @@
    /**
     * 获取列表数据
     *
     * @param lon
     * @param lat
     * @return
     * @throws Exception
     */
    @Override
    public List<BaseVo> queryStoreLists(String lon, String lat,String cityCode) throws Exception {
    public List<BaseVo> queryStoreLists(String lon, String lat, String cityCode) throws Exception {
        List<BaseVo> list = new ArrayList<>();
        if(ToolUtil.isEmpty(lon) || ToolUtil.isEmpty(lat)){
        if (ToolUtil.isEmpty(lon) || ToolUtil.isEmpty(lat)) {
            return list;
        }
        if(ToolUtil.isNotEmpty(cityCode)){
        if (ToolUtil.isNotEmpty(cityCode)) {
            List<Store> stores = this.queryStorsList(null, cityCode);
            for (Store store : stores) {
                BaseVo baseVo = new BaseVo();
                BeanUtils.copyProperties(store, baseVo);
                list.add(baseVo);
            }
        }else {
        } else {
            Map<String, String> geocode = gdMapGeocodingUtil.geocode(lon, lat);
            if(null != geocode){
            if (null != geocode) {
                String provinceCode = geocode.get("provinceCode");
                String cityCode1 = geocode.get("cityCode");
@@ -127,16 +144,17 @@
    /**
     * 获取开通省市
     *
     * @param pcode
     * @return
     * @throws Exception
     */
    @Override
    public List<ProvinceAndCityVo> queryProvinceAndCity(String pcode) throws Exception {
        if(ToolUtil.isEmpty(pcode)){
        if (ToolUtil.isEmpty(pcode)) {
            return this.baseMapper.queryProvince();
        }
        if(ToolUtil.isNotEmpty(pcode)){
        if (ToolUtil.isNotEmpty(pcode)) {
            return this.baseMapper.queryCity(pcode);
        }
        return null;
@@ -145,6 +163,7 @@
    /**
     * 获取所有开通城市
     *
     * @return
     * @throws Exception
     */
@@ -156,13 +175,14 @@
    /**
     * 根据城市code获取城市列表
     *
     * @param cityCode
     * @return
     * @throws Exception
     */
    @Override
    public List<BaseVo> queryStoreByCityCode(String cityCode) throws Exception {
        return this.baseMapper.queryStoreByCityCode(cityCode);
    public List<BaseVo> queryStoreByCityCode(String provinceCode, String cityCode) throws Exception {
        return this.baseMapper.queryStoreByCityCode(provinceCode, cityCode);
    }