From 9317fed1cea5372d9997a8273c07f041db94f99c Mon Sep 17 00:00:00 2001
From: zhibing.pu <393733352@qq.com>
Date: 星期二, 28 五月 2024 09:40:11 +0800
Subject: [PATCH] 新增功能
---
DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/PhoneServiceImpl.java | 49 +++++++++++++++++++++++++++++--------------------
1 files changed, 29 insertions(+), 20 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..77dd8e0 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,17 @@
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.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 +25,9 @@
@Resource
private PhoneMapper phoneMapper;
+
+ @Resource
+ private CompanyMapper companyMapper;
/**
* 获取所有系统电话
@@ -46,34 +57,32 @@
* @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);
+ 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() : "");
- //公司
- query = phoneMapper.query(2, null, province, city, code);
- if(query == null){
- query = phoneMapper.query(2, null, province, city, null);
+ List<Company> companies = companyMapper.queryList(city, null);
+ if(companies.size() > 0){
+ Integer id = companies.get(0).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());
}
- 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