44323
2023-11-22 f6ba3e15355e22767e69f8fc14ae22523f8db8dc
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;
@@ -30,7 +32,50 @@
public class StoreServiceImpl extends ServiceImpl<StoreMapper,Store> implements StoreService {
    @Autowired
    private StoreMapper storeMapper;
    @Autowired
    private GDMapGeocodingUtil gdMapGeocodingUtil;
    /**
     * 根据城市管理员id获取门店集合
     * @param id
     * @return
     */
    @Override
    public List<Store> getStoreByCityManagerId(Integer id) {
        return storeMapper.getStoreByCityManagerId(id);
    }
    /**
     * 根据门店员工id获取门店集合
     * @param id
     * @return
     */
    @Override
    public List<Store> getStoreByStoreStaffId(Integer id) {
        return storeMapper.getStoreByStoreStaffId(id);
    }
    @Override
    public String getOName(Integer operatorId) {
        return this.baseMapper.getOName(operatorId);
    }
    @Override
    public List<Map<String, Object>> game(Integer appUserId) {
        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);
    }
    /**
@@ -62,20 +107,30 @@
     * @throws Exception
     */
    @Override
    public List<BaseVo> queryStoreLists(String lon, String lat) 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)){
            return list;
        }
        Map<String, String> geocode = gdMapGeocodingUtil.geocode(lon, lat);
        if(null != geocode){
            String provinceCode = geocode.get("provinceCode");
            String cityCode = geocode.get("cityCode");
            List<Store> stores = this.queryStorsList(provinceCode, 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 {
            Map<String, String> geocode = gdMapGeocodingUtil.geocode(lon, lat);
            if(null != geocode){
                String provinceCode = geocode.get("provinceCode");
                String cityCode1 = geocode.get("cityCode");
                List<Store> stores = this.queryStorsList(provinceCode, cityCode1);
                for (Store store : stores) {
                    BaseVo baseVo = new BaseVo();
                    BeanUtils.copyProperties(store, baseVo);
                    list.add(baseVo);
                }
            }
        }
        return list;
@@ -118,7 +173,9 @@
     * @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);
    }
}