|
|
|
@ -1,10 +1,11 @@ |
|
|
|
package com.elink.esua.epdc.utils; |
|
|
|
|
|
|
|
import com.elink.esua.epdc.commons.tools.exception.RenException; |
|
|
|
import com.elink.esua.epdc.commons.tools.redis.RedisKeys; |
|
|
|
import com.elink.esua.epdc.commons.tools.redis.RedisUtils; |
|
|
|
import com.elink.esua.httpclient.HttpClientUtils; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.mybatis.logging.Logger; |
|
|
|
import org.mybatis.logging.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
@ -12,14 +13,14 @@ import java.util.HashMap; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
/** |
|
|
|
* ArcGIS获取网格信息 |
|
|
|
* 远程调用 |
|
|
|
* |
|
|
|
* @author zhy |
|
|
|
* @date 2022/5/20 9:36 |
|
|
|
*/ |
|
|
|
@Component |
|
|
|
public class ArcGISUtil { |
|
|
|
private static Logger logger = LoggerFactory.getLogger(ArcGISUtil.class); |
|
|
|
public class HttpUtil { |
|
|
|
private static Logger logger = LoggerFactory.getLogger(HttpUtil.class); |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private RedisUtils redisUtils; |
|
|
|
@ -27,10 +28,18 @@ public class ArcGISUtil { |
|
|
|
@Autowired |
|
|
|
private HttpClientUtils httpClientUtils; |
|
|
|
|
|
|
|
/** |
|
|
|
* gis地图获取 |
|
|
|
*/ |
|
|
|
private final String GET_GIS_COORDINATE_URL = "http://120.221.72.15:6081/arcgis/rest/services/sbwgh/xzqh/MapServer/2/query"; |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取publicKey |
|
|
|
* 公司信息获取 |
|
|
|
*/ |
|
|
|
private final String GET_COMPANY_URL = "http://120.221.72.15:6081/arcgis/rest/services/sbwgh/xzqh/MapServer/2/query"; |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取gis信息 |
|
|
|
* |
|
|
|
* @param |
|
|
|
* @return void |
|
|
|
@ -43,7 +52,7 @@ public class ArcGISUtil { |
|
|
|
// if (null != obj) {
|
|
|
|
// return (String) obj;
|
|
|
|
// }
|
|
|
|
Map<String, String> headerMap = new HashMap<>(4); |
|
|
|
Map<String, String> headerMap = new HashMap<>(2); |
|
|
|
|
|
|
|
Map<String, Object> paramsMap = new HashMap<>(8); |
|
|
|
paramsMap.put("where", "1=1"); |
|
|
|
@ -65,5 +74,35 @@ public class ArcGISUtil { |
|
|
|
return data; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取公司信息 |
|
|
|
* |
|
|
|
* @param urlParams |
|
|
|
* @return java.lang.String |
|
|
|
* @author zhy |
|
|
|
* @date 2022/9/6 9:53 |
|
|
|
*/ |
|
|
|
public String getCompanyStr(Map<String, String> urlParams) { |
|
|
|
String key = RedisKeys.getCompanyKey(); |
|
|
|
Object obj = redisUtils.get(key); |
|
|
|
if (null != obj) { |
|
|
|
return (String) obj; |
|
|
|
} |
|
|
|
Map<String, String> headerMap = new HashMap<>(4); |
|
|
|
|
|
|
|
Map<String, Object> paramsMap = new HashMap<>(8); |
|
|
|
paramsMap.put("where", "1=1"); |
|
|
|
paramsMap.put("outFields", "网格名称,网格编码"); |
|
|
|
paramsMap.put("f", "pjson"); |
|
|
|
|
|
|
|
String data = httpClientUtils.sendPostAndHeader(GET_COMPANY_URL, paramsMap, headerMap).getResult(); |
|
|
|
|
|
|
|
if (null == data) { |
|
|
|
throw new RenException("公司信息获取失败"); |
|
|
|
} |
|
|
|
|
|
|
|
redisUtils.set(key, data, RedisUtils.DEFAULT_EXPIRE); |
|
|
|
return data; |
|
|
|
} |
|
|
|
|
|
|
|
} |