From e28d33c09405e246a2d75fcb1f69a9e8e9d911b8 Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期四, 29 九月 2022 09:07:31 +0800 Subject: [PATCH] 更新最新代码 --- UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/OpenCityServiceImpl.java | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-) diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/OpenCityServiceImpl.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/OpenCityServiceImpl.java index 94f88dc..5101328 100644 --- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/OpenCityServiceImpl.java +++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/OpenCityServiceImpl.java @@ -41,12 +41,12 @@ */ @Override public List<BaseWarpper> queryOpenCity(Integer uid, Integer language) throws Exception { - if(null == language){ - language = 2; - } if(null != uid){ UserInfo userInfo = userInfoService.selectById(uid); language = userInfo.getLanguage(); + } + if(null == language){ + language = 2; } List<OpenCity> openCities = openCityMapper.queryOpenCity(); List<BaseWarpper> list = new ArrayList<>(); @@ -69,10 +69,10 @@ * @throws Exception */ @Override - public boolean openCity(Double lat, Double lnt) throws Exception { + public String openCity(Double lat, Double lnt, Integer language) throws Exception { ReverseGeocodeVo reverseGeocode = GoogleMapUtil.getReverseGeocode(lat, lnt); if(null == reverseGeocode){ - return false; + return ""; } AddressComponentsVo[] addressComponentsVos = reverseGeocode.getAddressComponentsVos(); String[] city = new String[addressComponentsVos.length]; @@ -81,8 +81,9 @@ } List<OpenCity> openCities = openCityMapper.queryByCode(city); if(openCities.size() == 0){ - return false; + return ""; } - return true; + City city1 = cityService.selectById(openCities.get(0).getCityId()); + return language == 1 ? city1.getChineseName() : language == 2 ? city1.getEnglishName() : city1.getFrenchName(); } } -- Gitblit v1.7.1