From 7da4caa40befd523033b8a1d01246ae468674680 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期一, 12 九月 2022 08:57:59 +0800
Subject: [PATCH] 更新用户端接口

---
 UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/OpenCityBusinessServiceImpl.java |   21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/OpenCityBusinessServiceImpl.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/OpenCityBusinessServiceImpl.java
index 20720c1..45b4c8b 100644
--- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/OpenCityBusinessServiceImpl.java
+++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/OpenCityBusinessServiceImpl.java
@@ -4,6 +4,9 @@
 import com.stylefeng.guns.modular.system.dao.OpenCityBusinessMapper;
 import com.stylefeng.guns.modular.system.model.OpenCityBusiness;
 import com.stylefeng.guns.modular.system.service.IOpenCityBusinessService;
+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.warpper.BaseWarpper;
 import org.springframework.stereotype.Service;
 
@@ -21,21 +24,21 @@
 
     /**
      * 获取业务类型
-     * @param province  省名
-     * @param city      市名称
-     * @param district  区县名称
      * @return
      * @throws Exception
      */
     @Override
-    public List<BaseWarpper> queryBusiness(String province, String city, String district) throws Exception {
-        List<OpenCityBusiness> openCityBusinesses = openCityBusinessMapper.queryBusiness(province, city, district);
-        if(openCityBusinesses.size() == 0){
-            openCityBusinesses = openCityBusinessMapper.queryBusiness(province, city, null);
+    public List<BaseWarpper> queryBusiness(Double lat, Double lnt) throws Exception {
+        ReverseGeocodeVo reverseGeocode = GoogleMapUtil.getReverseGeocode(lat, lnt);
+        if(null == reverseGeocode){
+            return new ArrayList<>();
         }
-        if(openCityBusinesses.size() == 0){
-            openCityBusinesses = openCityBusinessMapper.queryBusiness(province, null, null);
+        AddressComponentsVo[] addressComponentsVos = reverseGeocode.getAddressComponentsVos();
+        String[] city = new String[addressComponentsVos.length];
+        for (int i = 0; i < addressComponentsVos.length; i++) {
+            city[i] = addressComponentsVos[i].getLongName();
         }
+        List<OpenCityBusiness> openCityBusinesses = openCityBusinessMapper.queryBusiness(city);
         List<BaseWarpper> list = new ArrayList<>();
         for(OpenCityBusiness b : openCityBusinesses){
             BaseWarpper baseWarpper = new BaseWarpper();

--
Gitblit v1.7.1