src/main/java/com/moral/controller/ScreenController.java | ●●●●● patch | view | raw | blame | history | |
src/main/java/com/moral/service/impl/AreaServiceImpl.java | ●●●●● patch | view | raw | blame | history | |
src/main/webapp/js/moralmap.js | ●●●●● patch | view | raw | blame | history |
src/main/java/com/moral/controller/ScreenController.java
@@ -375,8 +375,6 @@ Account account = accountService.getAccountById(accountId); String regionName = areaService.queryFullNameByCode(code); if(account!=null&®ionName!=null){ //去除空格 regionName = regionName.replace(" ",""); Object sensors = sensorService.queryAll(); JSONObject params = new JSONObject(); params.put("regionCode",code); src/main/java/com/moral/service/impl/AreaServiceImpl.java
@@ -58,17 +58,20 @@ String cityCode = codeStr.substring(0,4)+"00"; City city = cityMapper.selectByPrimaryKey(Integer.valueOf(cityCode)); Area area = areaMapper.selectByPrimaryKey(code); fullName = province.getProvinceName()+city.getCityName()+area.getAreaName(); fullName = province.getProvinceName().replaceAll(" ", "") +" "+city.getCityName().replaceAll(" ", "") +" "+area.getAreaName().replaceAll(" ", ""); } else if(!codeStr.endsWith("0000")){ // 此时为 地级市code String provinceCode = codeStr.substring(0,2)+"0000"; Province province = provinceMapper.selectByPrimaryKey(Integer.valueOf(provinceCode)); City city = cityMapper.selectByPrimaryKey(code); fullName = province.getProvinceName()+city.getCityName(); fullName = province.getProvinceName().replaceAll(" ", "") +" "+city.getCityName().replaceAll(" ", ""); } else { // 此时为 省code Province province = provinceMapper.selectByPrimaryKey(code); fullName = province.getProvinceName(); fullName = province.getProvinceName().replaceAll(" ", ""); } return fullName; } src/main/webapp/js/moralmap.js
@@ -54,12 +54,21 @@ style: "normal" //设置地图风格为高端黑 } map.setMapStyle(mapStyle); var showZoom = 13; if(arguments.length == 2) { map.centerAndZoom(new BMap.Point(arguments[0], arguments[1]), showZoom); } else if(arguments.length == 1) { map.centerAndZoom(arguments[0], showZoom); } var showZoom = 12; var address = arguments[0]; var regoinNames = address.split(" "); var cityName = regoinNames.length>1?regoinNames[1]:regoinNames[0]; map.setCurrentCity(cityName); // 将地址解析结果显示在地图上,并调整地图视野 // 创建地址解析器实例 var myGeo = new BMap.Geocoder(); myGeo.getPoint(address, function(point){ if (point) { map.centerAndZoom(point, showZoom); }else{ alert("您选择地址没有解析到结果!"); } }, cityName); //增加导航控件 map.enableScrollWheelZoom(true); var navigation = new BMap.NavigationControl({ @@ -182,7 +191,6 @@ isOver = true; moralMap.setMaxBounds(bs); } else { debugger; isOver = (bs.northeastLng > _bounds.northeastLng || bs.northeastLat > _bounds.northeastLat || bs.southwestLng < _bounds.southwestLng