From 4c99ee7028c3fe58a2cd4b8273b22c75c45574fc Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期五, 16 五月 2025 10:27:41 +0800 Subject: [PATCH] 修改文档bug --- ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TOpenCityController.java | 121 +++++++++------------------------------- 1 files changed, 28 insertions(+), 93 deletions(-) diff --git a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TOpenCityController.java b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TOpenCityController.java index f61070e..009b4c9 100644 --- a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TOpenCityController.java +++ b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TOpenCityController.java @@ -7,14 +7,21 @@ import com.baomidou.mybatisplus.plugins.Page; import com.stylefeng.guns.core.base.controller.BaseController; import com.stylefeng.guns.core.common.constant.factory.PageFactory; +import com.stylefeng.guns.core.common.exception.BizExceptionEnum; +import com.stylefeng.guns.core.exception.GunsException; import com.stylefeng.guns.core.shiro.ShiroKit; import com.stylefeng.guns.core.util.DateUtil; import com.stylefeng.guns.core.util.SinataUtil; +import com.stylefeng.guns.modular.system.model.City; import com.stylefeng.guns.modular.system.model.TOpenCityBusiness; import com.stylefeng.guns.modular.system.model.TRegion; +import com.stylefeng.guns.modular.system.service.ICityService; import com.stylefeng.guns.modular.system.service.ITOpenCityBusinessService; import com.stylefeng.guns.modular.system.service.ITRegionService; import com.stylefeng.guns.modular.system.util.GaoDeMapUtil; +import com.stylefeng.guns.modular.system.util.GoogleMap.FindPlaceFromTextVo; +import com.stylefeng.guns.modular.system.util.GoogleMap.GoogleMapUtil; +import com.stylefeng.guns.modular.system.util.ResultUtil; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; @@ -52,6 +59,12 @@ @Autowired private ITOpenCityBusinessService tOpenCityBusinessService; + @Autowired + private ICityService cityService; + + + + /** * 跳转到城市管理首页 */ @@ -65,8 +78,8 @@ */ @RequestMapping("/tOpenCity_add") public String tOpenCityAdd(Model model) { - List<TRegion> provinceList = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", 0)); - model.addAttribute("provinceList",provinceList); + List<City> city = cityService.selectList(new EntityWrapper<City>().orderBy("id")); + model.addAttribute("city", city); return PREFIX + "tOpenCity_add.html"; } @@ -79,15 +92,8 @@ model.addAttribute("item",tOpenCity); LogObjectHolder.me().set(tOpenCity); - //省 - List<TRegion> provinceList = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", 0)); - model.addAttribute("provinceList",provinceList); - //市 - List<TRegion> cityList = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", tOpenCity.getAreaId())); - model.addAttribute("cityList",cityList); - //区 - List<TRegion> areaList = tRegionService.selectList(new EntityWrapper<TRegion>().eq("parent_id", tOpenCity.getCityId())); - model.addAttribute("areaList",areaList); + List<City> city = cityService.selectList(new EntityWrapper<City>().orderBy("id")); + model.addAttribute("city", city); //经营业务 List<Map<String,Object>> businessList = tOpenCityService.getBusinessByCityId(tOpenCityId); model.addAttribute("businessList",businessList); @@ -129,41 +135,17 @@ @ResponseBody public Object add(TOpenCity tOpenCity,@RequestParam String businessTypeStr,Integer areaId,Integer cityId,Integer provinceId) { //获取code - if (SinataUtil.isNotEmpty(areaId)){ - TRegion area = tRegionService.selectById(areaId); - tOpenCity.setCode(area.getCode()); - } - if (SinataUtil.isNotEmpty(cityId)){ - TRegion city = tRegionService.selectById(cityId); - tOpenCity.setCode(city.getCode()); - } - if (SinataUtil.isNotEmpty(provinceId)){ - TRegion province = tRegionService.selectById(provinceId); - tOpenCity.setCode(province.getCode()); - } - tOpenCity.setAreaId(areaId); tOpenCity.setCityId(cityId); - tOpenCity.setProvinceId(provinceId); - //获取经纬度 - String address = tOpenCity.getAreaName(); - if (SinataUtil.isNotEmpty(tOpenCity.getCityName())){ - address+=tOpenCity.getCityName(); - } - if (SinataUtil.isNotEmpty(tOpenCity.getProvinceName())){ - address+=tOpenCity.getProvinceName(); - } - JSONObject positionObj = GaoDeMapUtil.getLngAndLat(address); - String longitude = positionObj.getString("longitude"); - String latitude = positionObj.getString("latitude"); - tOpenCity.setLon(Double.valueOf(longitude)); - tOpenCity.setLat(Double.valueOf(latitude)); + City city = cityService.selectById(cityId); + tOpenCity.setLat(city.getLat()); + tOpenCity.setLon(city.getLon()); tOpenCity.setInsertTime(new Date()); tOpenCity.setInsertUser(ShiroKit.getUser().getId()); tOpenCityService.insert(tOpenCity); //添加经营业务 testJSONStrToJSONArray(businessTypeStr,tOpenCity.getId()); - return SUCCESS_TIP; + return ResultUtil.success(); } public void testJSONStrToJSONArray(String subArr,Integer tOpenCityId){ @@ -186,16 +168,8 @@ Integer businessType = 0; if ("专车".equals(type)){ businessType = 1; - }else if ("出租车".equals(type)){ - businessType = 2; - }else if ("跨城出行".equals(type)){ - businessType = 3; - }else if ("跨城小件物流".equals(type)){ + }else if ("市内小件物流".equals(type)){ businessType = 4; - }else if ("同城小件物流".equals(type)){ - businessType = 5; - }else if ("包车".equals(type)){ - businessType = 6; } business.setBusinessType(businessType); business.setSort(jsonObject.getInteger("sort")); @@ -225,50 +199,11 @@ @RequestMapping(value = "/update") @ResponseBody public Object update(TOpenCity tOpenCity,@RequestParam String businessTypeStr,Integer areaId,Integer cityId,Integer provinceId) { - if (SinataUtil.isNotEmpty(areaId)){ - TRegion area = tRegionService.selectById(areaId); - tOpenCity.setCode(area.getCode()); - } - if (SinataUtil.isNotEmpty(cityId)){ - TRegion city = tRegionService.selectById(cityId); - tOpenCity.setCode(city.getCode()); - } - if (SinataUtil.isNotEmpty(provinceId)){ - TRegion province = tRegionService.selectById(provinceId); - tOpenCity.setCode(province.getCode()); - } - if (SinataUtil.isEmpty(areaId)){ - tOpenCity.setAreaId(0); - tOpenCity.setAreaName(""); - }else{ - tOpenCity.setAreaId(areaId); - } - if (SinataUtil.isEmpty(cityId)){ - tOpenCity.setCityId(0); - tOpenCity.setCityName(""); - }else{ - tOpenCity.setCityId(cityId); - } - if (SinataUtil.isEmpty(provinceId)){ - tOpenCity.setProvinceId(0); - tOpenCity.setProvinceName(""); - }else{ - tOpenCity.setProvinceId(provinceId); - } - - //获取经纬度 - String address = tOpenCity.getAreaName(); - if (SinataUtil.isNotEmpty(tOpenCity.getCityName())){ - address+=tOpenCity.getCityName(); - } - if (SinataUtil.isNotEmpty(tOpenCity.getProvinceName())){ - address+=tOpenCity.getProvinceName(); - } - JSONObject positionObj = GaoDeMapUtil.getLngAndLat(address); - String longitude = positionObj.getString("longitude"); - String latitude = positionObj.getString("latitude"); - tOpenCity.setLon(Double.valueOf(longitude)); - tOpenCity.setLat(Double.valueOf(latitude)); + //获取code + tOpenCity.setCityId(cityId); + City city = cityService.selectById(cityId); + tOpenCity.setLat(city.getLat()); + tOpenCity.setLon(city.getLon()); tOpenCity.setUpdateTime(new Date()); tOpenCity.setUpdateUser(ShiroKit.getUser().getId()); tOpenCityService.updateById(tOpenCity); @@ -279,7 +214,7 @@ tOpenCityBusinessService.update(business,new EntityWrapper<TOpenCityBusiness>().eq("openCityId",tOpenCity.getId())); //添加经营业务 testJSONStrToJSONArray(businessTypeStr,tOpenCity.getId()); - return SUCCESS_TIP; + return ResultUtil.success(); } /** -- Gitblit v1.7.1