| | |
| | | |
| | | 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; |
| | |
| | | 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); |
| | | } |
| | | |
| | | |
| | | /** |
| | |
| | | * @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; |
| | |
| | | public List<BaseVo> queryStoreByCityCode(String cityCode) throws Exception { |
| | | return this.baseMapper.queryStoreByCityCode(cityCode); |
| | | } |
| | | |
| | | |
| | | } |