/** 该地点的地址* 判断地点表disaster_area中的ZZDD字段是否为空,如果为空,去数据库查经纬度,再调用高德api,查询地址*/if (disasterArea.getZZDD()==null) {String temple = "{}{}{}";String LngLat = StrUtil.format(temple, disasterAreaDao.getLng(disasterArea.getId()), ",", disasterAreaDao.getLat(disasterArea.getId()));try { //请求高德api,根据经纬度获取地址名称HttpClientResult httpClientResult = HttpClient.doGet("https://restapi.amap.com/v3/geocode/regeo?location="+LngLat+"&key="+gdkey+"&poitype=&radius=1000&extensions=base&batch=false&roadlevel=1");JSONObject jsonObject = JSONObject.parseObject(httpClientResult.getContent()); //转换成json格式String jsonString=jsonObject.toJSONString().replace("\"",""); //去掉斜杠String arr = StrUtil.removePrefix(jsonString, "{infocode:10000,regeocode:{formatted_address:"); //去掉前缀int i = arr.indexOf(",");String newArr = arr.substring(0,i); //去掉后缀historyHtmlEntiy.setArr(newArr); //赋值} catch (Exception e) {e.printStackTrace();}}else {historyHtmlEntiy.setArr(disasterArea.getZZDD());}
