Pu Zhibing
7 天以前 4c99ee7028c3fe58a2cd4b8273b22c75c45574fc
DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/PhoneServiceImpl.java
@@ -6,11 +6,13 @@
import com.stylefeng.guns.modular.system.dao.PhoneMapper;
import com.stylefeng.guns.modular.system.model.Company;
import com.stylefeng.guns.modular.system.model.Phone;
import com.stylefeng.guns.modular.system.service.ICompanyCityService;
import com.stylefeng.guns.modular.system.service.ICompanyService;
import com.stylefeng.guns.modular.system.service.IPhoneService;
import com.stylefeng.guns.modular.system.util.GoogleMap.AddressComponentsVo;
import com.stylefeng.guns.modular.system.util.GoogleMap.GoogleMapUtil;
import com.stylefeng.guns.modular.system.util.GoogleMap.ReverseGeocodeVo;
import com.stylefeng.guns.modular.system.util.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -25,9 +27,12 @@
    @Resource
    private PhoneMapper phoneMapper;
    @Autowired
    private ICompanyCityService companyCityService;
    @Resource
    private CompanyMapper companyMapper;
    private RedisUtil redisUtil;
    /**
     * 获取所有系统电话
@@ -52,35 +57,23 @@
    /**
     * 获取客服电话(个人中心)
     * @param code
     * @return
     * @throws Exception
     */
    @Override
    public Map<String, Object> queryCustomerPhone(Double lat, Double lnt) throws Exception {
        ReverseGeocodeVo reverseGeocode = GoogleMapUtil.getReverseGeocode(lat, lat);
        if(null == reverseGeocode){
            System.err.println("获取地图信息出错");
            return new HashMap<>();
        }
        AddressComponentsVo[] addressComponentsVos = reverseGeocode.getAddressComponentsVos();
        String[] city = new String[addressComponentsVos.length];
        for (int i = 0; i < addressComponentsVos.length; i++) {
            city[i] = addressComponentsVos[i].getLongName();
        }
    public Map<String, Object> queryCustomerPhone(Integer uid, Double lat, Double lnt) throws Exception {
        Map<String, Object> map = new HashMap<>();
        //平台电话
        Phone query = phoneMapper.query(2, 1, null, null, null);
        map.put("platform", null != query ? query.getPhone() : "");
        List<Company> companies = companyMapper.queryList(city, null);
        if(companies.size() > 0){
            Integer id = companies.get(0).getId();
        Company companies = companyCityService.query1(uid, lnt.toString(), lat.toString());
        if(null != companies){
            Integer id = companies.getId();
            Phone phone = this.selectOne(new EntityWrapper<Phone>().eq("type", 2).eq("companyId", id));
            map.put("company", phone.getPhone());
            map.put("company", null == phone ? "" : phone.getPhone());
            phone = this.selectOne(new EntityWrapper<Phone>().eq("type", 3).eq("companyId", id));
            map.put("scheduling", phone.getPhone());
            map.put("scheduling", null == phone ? "" : phone.getPhone());
        }
        return map;