From 51b190f22aa8751bd9fbe5229ab5546facdef632 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期二, 11 二月 2025 16:23:53 +0800 Subject: [PATCH] 修改订单问题和定时任务bug --- DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/PhoneServiceImpl.java | 55 ++++++++++++++++++++++++++++++++----------------------- 1 files changed, 32 insertions(+), 23 deletions(-) diff --git a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/PhoneServiceImpl.java b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/PhoneServiceImpl.java index 2c21a67..7ea069f 100644 --- a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/PhoneServiceImpl.java +++ b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/PhoneServiceImpl.java @@ -1,9 +1,18 @@ package com.stylefeng.guns.modular.system.service.impl; +import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.stylefeng.guns.modular.system.dao.CompanyMapper; 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 org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -17,6 +26,9 @@ @Resource private PhoneMapper phoneMapper; + + @Autowired + private ICompanyCityService companyCityService; /** * 获取所有系统电话 @@ -41,39 +53,36 @@ /** * 获取客服电话(个人中心) - * @param code * @return * @throws Exception */ @Override - public Map<String, Object> queryCustomerPhone(String code) throws Exception { - String province = code.substring(0, 2) + "0000"; - String city = code.substring(0, 4) + "00"; + public Map<String, Object> queryCustomerPhone(Double lat, Double lnt) throws Exception { + ReverseGeocodeVo reverseGeocode = GoogleMapUtil.getReverseGeocode(lat, lat, null); + 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(); + } Map<String, Object> map = new HashMap<>(); //平台电话 Phone query = phoneMapper.query(2, 1, null, null, null); map.put("platform", null != query ? query.getPhone() : ""); + + Company companies = companyCityService.query(city); + 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()); + phone = this.selectOne(new EntityWrapper<Phone>().eq("type", 3).eq("companyId", id)); + map.put("scheduling", phone.getPhone()); + } - //公司 - query = phoneMapper.query(2, null, province, city, code); - if(query == null){ - query = phoneMapper.query(2, null, province, city, null); - } - if(query == null){ - query = phoneMapper.query(2, null, province, null, null); - } - map.put("company", null != query ? query.getPhone() : ""); - - //调度电话 - query = phoneMapper.query(3, null, province, city, code); - if(query == null){ - query = phoneMapper.query(3, null, province, city, null); - } - if(query == null){ - query = phoneMapper.query(3, null, province, null, null); - } - map.put("scheduling", null != query ? query.getPhone() : ""); return map; } } -- Gitblit v1.7.1