Browse Source

HttpClientUtil分开

menglu 3 years ago
parent
commit
c39abcdc64

+ 2 - 1
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/service/rest/LightingUtil.java

@@ -84,7 +84,8 @@ public class LightingUtil {
 			postBody.put("modelId", modelId);
 
 			String url = Constant.zkt_control_url + "/control/lighting/console/query";
-			String postResult = HttpClientUtil.post(url, JSONObject.toJSONString(postBody, SerializerFeature.WriteMapNullValue));
+			String postResult = HttpClientUtil.instance("zkt_control").post(url,
+					JSONObject.toJSONString(postBody, SerializerFeature.WriteMapNullValue));
 			return postResult;
 		} catch (Exception e) {
 			log.error("获取数据失败", e);

+ 2 - 2
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/service/rest/RedirectUtil.java

@@ -90,7 +90,7 @@ public class RedirectUtil {
 		otherMap.put("Url", url_ori);
 		log.warn(url_ori);
 		if (ConfigRedirect.http_request_type.equals("get")) {
-			resultString = HttpClientUtil.get(url, null, ConfigRedirect.headerMap);
+			resultString = HttpClientUtil.instance("redirect").get(url, null, ConfigRedirect.headerMap);
 		} else {
 			Object postBody = sql_json.get("postBody");
 			String postString;
@@ -101,7 +101,7 @@ public class RedirectUtil {
 			} else {
 				postString = postBody.toString();
 			}
-			resultString = HttpClientUtil.post(url, postString, null, ConfigRedirect.headerMap);
+			resultString = HttpClientUtil.instance("redirect").post(url, postString, null, ConfigRedirect.headerMap);
 		}
 		Object result;
 		try {

+ 1 - 1
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/service/rest/RestUtil.java

@@ -361,7 +361,7 @@ public class RestUtil {
 			// http://39.102.40.239:28888/labsl/graph/pub/query
 			// String post_url ="http://39.102.40.239:28888"+ "/labsl/graph/pub/query";
 			String post_url = Constant.adm_project_url + "/labsl/graph/pub/query";
-			String post_result = HttpClientUtil.post(post_url, postJSON.toJSONString(), null, head);
+			String post_result = HttpClientUtil.instance("adm").post(post_url, postJSON.toJSONString(), null, head);
 			// 4.解析返回结果
 			JSONObject resultJSON = JSON.parseObject(post_result);
 			Map<String, String> map = new ConcurrentHashMap<>();

+ 2 - 2
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/service/rest/fjd_Util.java

@@ -149,7 +149,7 @@ public class fjd_Util {
 		postJSON.put("building", RepositoryContainer.RepositoryProject.projectId.substring(2));
 		postJSON.put("points", points);
 		String post_url = Constant.iot_collect_url + "/fjd_query_batch_post";
-		String post_result = HttpClientUtil.post(post_url, postJSON.toJSONString());
+		String post_result = HttpClientUtil.instance("iot_collect").post(post_url, postJSON.toJSONString());
 		JSONObject resultJSON = JSON.parseObject(post_result);
 		JSONArray result_points = (JSONArray) resultJSON.get("points");
 		return result_points;
@@ -170,7 +170,7 @@ public class fjd_Util {
 		postJSON.put("building", RepositoryContainer.RepositoryProject.projectId.substring(2));
 		postJSON.put("points", points);
 		String post_url = Constant.iot_collect_url + "/fjd_query_batch_post";
-		String post_result = HttpClientUtil.post(post_url, postJSON.toJSONString());
+		String post_result = HttpClientUtil.instance("iot_collect").post(post_url, postJSON.toJSONString());
 		JSONObject resultJSON = JSON.parseObject(post_result);
 		JSONArray result_points = (JSONArray) resultJSON.get("points");
 		JSONObject result_point = (JSONObject) result_points.get(0);

+ 2 - 0
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/Constant.java

@@ -34,6 +34,7 @@ public class Constant {
 
 	public static String sdk_version;
 	public static String rwd_url;
+	public static boolean rwd_compress = false;
 	public static String zkt_monitor_url;
 	public static String zkt_control_url;
 	public static String physical_world;
@@ -118,6 +119,7 @@ public class Constant {
 					element = (Element) iter.next();
 					rwd_url = element.attribute("url").getValue();
 					rwd_url = StrUtil.removeSuffix(rwd_url, "/");
+					rwd_compress = element.attribute("compress").getValue().equalsIgnoreCase("true");
 				}
 				iter = document.selectNodes("/root/zkt_monitor").iterator();
 				if (iter.hasNext()) {

+ 3 - 3
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/ControlUtil.java

@@ -125,7 +125,7 @@ public class ControlUtil {
 						failure_points.add(point);
 					}
 				}
-				sb.append("控制结果:"+points.size()+"个控制指令," + success_points.size() + "个成功," + failure_points.size() + "个失败");
+				sb.append("控制结果:" + points.size() + "个控制指令," + success_points.size() + "个成功," + failure_points.size() + "个失败");
 				postParam.put("operateDetail", "【" + belongSystem + "】:" + objName + "-" + sb.toString());
 				postParam.put("sourceType", 1);
 			}
@@ -137,7 +137,7 @@ public class ControlUtil {
 
 	private static void saveOperationLog(JSONObject postParam) throws Exception {
 		String post_url = Constant.zkt_control_url + "/operationLog/saveOperationLog";
-		String post_result = HttpClientUtil.post(post_url, postParam.toJSONString());
+		String post_result = HttpClientUtil.instance("zkt_control").post(post_url, postParam.toJSONString());
 		JSONObject result = JSON.parseObject(post_result);
 		log.debug(result.toJSONString());
 	}
@@ -217,7 +217,7 @@ public class ControlUtil {
 		postJSON.put("points", points);
 		String post_url = Constant.iot_project_url + "/sync_pointsetbatch_post";
 		log.debug(postJSON.toJSONString());
-		String post_result = HttpClientUtil.post(post_url, postJSON.toJSONString());
+		String post_result = HttpClientUtil.instance("iot_project").post(post_url, postJSON.toJSONString());
 		JSONObject result = JSON.parseObject(post_result);
 		JSONArray result_points = (JSONArray) result.get("points");
 		log.debug(post_result);

+ 1 - 1
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/DeamonUtil.java

@@ -111,7 +111,7 @@ public class DeamonUtil {
 		postJSON.put("building", RepositoryContainer.RepositoryProject.projectId.substring(2));
 		postJSON.put("points", points);
 		String post_url = Constant.iot_collect_url + "/fjd_query_batch_post";
-		String post_result = HttpClientUtil.post(post_url, postJSON.toJSONString());
+		String post_result = HttpClientUtil.instance("iot_collect").post(post_url, postJSON.toJSONString());
 		JSONObject resultJSON = JSON.parseObject(post_result);
 		if (resultJSON == null) {
 			log.debug(points.toJSONString());

+ 104 - 115
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/ExeclReadEquipStaticInfoUtil.java

@@ -1,127 +1,116 @@
 package com.persagy.ibms.data.sdk.util;
 
-import cn.hutool.json.JSONString;
-import com.alibaba.fastjson.JSON;
+import java.io.BufferedInputStream;
+import java.io.FileInputStream;
+
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.ss.usermodel.WorkbookFactory;
+import org.apache.poi.ss.util.CellRangeAddress;
+
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-import com.alibaba.fastjson.serializer.SerializerFeature;
 import com.persagy.ibms.core.data.SceneDataObject;
 import com.persagy.ibms.core.data.SceneDataSet;
-import com.persagy.ibms.core.data.SceneDataValue;
-import com.persagy.ibms.core.util.ExamineUtil;
-import com.persagy.ibms.core.util.ExceptionItem;
-import com.persagy.ibms.core.util.QueryAssist;
-import com.persagy.ibms.core.util.QueryUtil;
-import com.persagy.ibms.data.sdk.service.rest.RestUtil;
-import org.apache.poi.ss.usermodel.*;
-import org.apache.poi.ss.util.CellRangeAddress;
-import org.springframework.core.serializer.Serializer;
-import springfox.documentation.spring.web.json.Json;
-
-import java.io.BufferedInputStream;
-import java.io.ByteArrayInputStream;
-import java.io.FileInputStream;
-import java.io.ObjectInputStream;
-import java.util.ArrayList;
-import java.util.List;
 
 public class ExeclReadEquipStaticInfoUtil {
 
-    public static JSONObject ReadEquipStaticInfo(String firstName, String sheetName) throws Exception {
-        FileInputStream fis = new FileInputStream(FileUtil.file(firstName + ".xlsx"));
-        Workbook workbook = WorkbookFactory.create(new BufferedInputStream(fis));
-        Sheet sheet = workbook.getSheet(sheetName);
-        JSONObject object = new JSONObject();
-        for (int i = 0; i < sheet.getNumMergedRegions(); i++) {
-            // 获取合并单元格的值
-            CellRangeAddress ca = sheet.getMergedRegion(i);
-            int firstRow = ca.getFirstRow();
-            Row fRow = sheet.getRow(firstRow);
-            Cell fCell = fRow.getCell(0);
-            String caVal = getCellValue(fCell);
-            // 获取合并单元格之后的值,形成树形结构
-            JSONArray dic = new JSONArray();
-            for (int j = firstRow; j <= ca.getLastRow(); j++) {
-                Row row = sheet.getRow(j);
-                JSONObject obj = new JSONObject();
-                obj.put("name", getCellValue(row.getCell(1)));
-                obj.put("code", getCellValue(row.getCell(2)));
-                obj.put("enable", row.getCell(3).getBooleanCellValue());
-                dic.add(obj);
-            }
-            object.put(caVal, dic);
-        }
-        fis.close();
-        return object;
-    }
+	public static JSONObject ReadEquipStaticInfo(String firstName, String sheetName) throws Exception {
+		FileInputStream fis = new FileInputStream(FileUtil.file(firstName + ".xlsx"));
+		Workbook workbook = WorkbookFactory.create(new BufferedInputStream(fis));
+		Sheet sheet = workbook.getSheet(sheetName);
+		JSONObject object = new JSONObject();
+		for (int i = 0; i < sheet.getNumMergedRegions(); i++) {
+			// 获取合并单元格的值
+			CellRangeAddress ca = sheet.getMergedRegion(i);
+			int firstRow = ca.getFirstRow();
+			Row fRow = sheet.getRow(firstRow);
+			Cell fCell = fRow.getCell(0);
+			String caVal = getCellValue(fCell);
+			// 获取合并单元格之后的值,形成树形结构
+			JSONArray dic = new JSONArray();
+			for (int j = firstRow; j <= ca.getLastRow(); j++) {
+				Row row = sheet.getRow(j);
+				JSONObject obj = new JSONObject();
+				obj.put("name", getCellValue(row.getCell(1)));
+				obj.put("code", getCellValue(row.getCell(2)));
+				obj.put("enable", row.getCell(3).getBooleanCellValue());
+				dic.add(obj);
+			}
+			object.put(caVal, dic);
+		}
+		fis.close();
+		return object;
+	}
 
-    public static JSONObject ReadEquipStaticInfoById(String objId) throws Exception {
-        RepositoryImpl Repository = RepositoryContainer.instance;
-        JSONObject object = new JSONObject();
-        String code = "classCode";
-        //获取此设备的对象数据
-        JSONObject eqObj= Repository.id2object.get(objId);
-        //获取classCode的值
-        String pointString = eqObj.getString(code);
-        //获取管理范围的classArray
-        SceneDataSet zktClassArray = Repository.ZKTClassArray;
-        String ibmsSceneCode = null;
-        String ibmsClassCode = null;
-        String classCode = "";
-        for (int i = 0; i < zktClassArray.set.size(); i++) {
-            SceneDataObject classObj = zktClassArray.set.get(i);
-            String codeVal = classObj.get("code").value_prim.toString();
-            //遍历查询classCode对应的ibmsSceneCode和ibmsClassCode
-            if (codeVal.equals(pointString)) {
-                classCode = codeVal;
-                ibmsSceneCode = classObj.get("ibmsSceneCode").value_prim.toString();
-                ibmsClassCode = classObj.get("ibmsClassCode").value_prim.toString();
-                break;
-            }
-        }
-        //如果ibmsClassCode和ibmsSceneCode为空则返回,意味着查询失败
-        if (ibmsSceneCode==null && ibmsClassCode==null) {
-            return object;
-        }
-        //根据ibmsSceneCode和ibmsClassCode查询对应的excel获取台账信息点
-        FileInputStream fis = new FileInputStream(FileUtil.file(ibmsSceneCode + ".xlsx"));
-        Workbook workbook = WorkbookFactory.create(new BufferedInputStream(fis));
-        Sheet sheet = workbook.getSheet(ibmsClassCode);
-        for (int i = 0; i < sheet.getNumMergedRegions(); i++) {
-            // 获取合并单元格的值
-            CellRangeAddress ca = sheet.getMergedRegion(i);
-            int firstRow = ca.getFirstRow();
-            Row fRow = sheet.getRow(firstRow);
-            Cell fCell = fRow.getCell(0);
-            String caVal = getCellValue(fCell);
-            // 获取合并单元格之后的值,形成树形结构
-            JSONArray dic = new JSONArray();
-            //获取这个设备类的信息点列表
-            JSONArray array = Repository.infoArrayJson.get(classCode);
-            for (int j = firstRow; j <= ca.getLastRow(); j++) {
-                Row row = sheet.getRow(j);
-                String codeInfo = getCellValue(row.getCell(1));
-                for (int z = 0; z < array.size(); z++) {
-                    JSONObject obj= (JSONObject) array.get(z);
-                    String codeVal=obj.get("code").toString();
-                    if(codeVal.equals(codeInfo))
-                    {
-                        obj.put("data",eqObj.get(codeInfo));
-                        obj.put("enable",row.getCell(2).getBooleanCellValue());
-                        dic.add(obj);
-                        break;
-                    }
-                }
-            }
-            object.put(caVal, dic);
-        }
-        fis.close();
-        return object;
-    }
+	public static JSONObject ReadEquipStaticInfoById(String objId) throws Exception {
+		RepositoryImpl Repository = RepositoryContainer.instance;
+		JSONObject object = new JSONObject();
+		String code = "classCode";
+		// 获取此设备的对象数据
+		JSONObject eqObj = Repository.id2object.get(objId);
+		// 获取classCode的值
+		String pointString = eqObj.getString(code);
+		// 获取管理范围的classArray
+		SceneDataSet zktClassArray = Repository.ZKTClassArray;
+		String ibmsSceneCode = null;
+		String ibmsClassCode = null;
+		String classCode = "";
+		for (int i = 0; i < zktClassArray.set.size(); i++) {
+			SceneDataObject classObj = zktClassArray.set.get(i);
+			String codeVal = classObj.get("code").value_prim.toString();
+			// 遍历查询classCode对应的ibmsSceneCode和ibmsClassCode
+			if (codeVal.equals(pointString)) {
+				classCode = codeVal;
+				ibmsSceneCode = classObj.get("ibmsSceneCode").value_prim.toString();
+				ibmsClassCode = classObj.get("ibmsClassCode").value_prim.toString();
+				break;
+			}
+		}
+		// 如果ibmsClassCode和ibmsSceneCode为空则返回,意味着查询失败
+		if (ibmsSceneCode == null && ibmsClassCode == null) {
+			return object;
+		}
+		// 根据ibmsSceneCode和ibmsClassCode查询对应的excel获取台账信息点
+		FileInputStream fis = new FileInputStream(FileUtil.file(ibmsSceneCode + ".xlsx"));
+		Workbook workbook = WorkbookFactory.create(new BufferedInputStream(fis));
+		Sheet sheet = workbook.getSheet(ibmsClassCode);
+		for (int i = 0; i < sheet.getNumMergedRegions(); i++) {
+			// 获取合并单元格的值
+			CellRangeAddress ca = sheet.getMergedRegion(i);
+			int firstRow = ca.getFirstRow();
+			Row fRow = sheet.getRow(firstRow);
+			Cell fCell = fRow.getCell(0);
+			String caVal = getCellValue(fCell);
+			// 获取合并单元格之后的值,形成树形结构
+			JSONArray dic = new JSONArray();
+			// 获取这个设备类的信息点列表
+			JSONArray array = Repository.infoArrayJson.get(classCode);
+			for (int j = firstRow; j <= ca.getLastRow(); j++) {
+				Row row = sheet.getRow(j);
+				String codeInfo = getCellValue(row.getCell(1));
+				for (int z = 0; z < array.size(); z++) {
+					JSONObject obj = (JSONObject) array.get(z);
+					String codeVal = obj.get("code").toString();
+					if (codeVal.equals(codeInfo)) {
+						obj.put("data", eqObj.get(codeInfo));
+						obj.put("enable", row.getCell(2).getBooleanCellValue());
+						dic.add(obj);
+						break;
+					}
+				}
+			}
+			object.put(caVal, dic);
+		}
+		fis.close();
+		return object;
+	}
 
-    public static String getCellValue(Cell cell) {
-        if (cell == null)
-            return "";
-        return cell.getStringCellValue();
-    }
+	public static String getCellValue(Cell cell) {
+		if (cell == null)
+			return "";
+		return cell.getStringCellValue();
+	}
 }

+ 42 - 3
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/GZIPCompressUtil.java

@@ -5,12 +5,46 @@ import lombok.extern.slf4j.Slf4j;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
+import java.io.OutputStream;
+import java.util.zip.DeflaterOutputStream;
 import java.util.zip.GZIPInputStream;
 import java.util.zip.GZIPOutputStream;
+import java.util.zip.InflaterOutputStream;
+
+import cn.hutool.core.codec.Base64;
+
 @Slf4j
 public class GZIPCompressUtil {
+	public static String zipBase64(String text) {
+		try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
+			try (DeflaterOutputStream deflaterOutputStream = new DeflaterOutputStream(out)) {
+				deflaterOutputStream.write(text.getBytes("UTF-8"));
+			}
+			return new String(Base64.encode(out.toByteArray()));
+		} catch (IOException e) {
+			log.error("压缩文本失败:{}", text, e);
+		}
+		return null;
+	}
+
+	public static String unzipBase64(String text) {
+		try (ByteArrayOutputStream os = new ByteArrayOutputStream()) {
+			try (OutputStream outputStream = new InflaterOutputStream(os)) {
+				outputStream.write(Base64.decode(text));
+			}
+			return new String(os.toByteArray(), "UTF-8");
+		} catch (IOException e) {
+			log.error("解压文本失败:{}", text, e);
+		}
+		return null;
+	}
 
 	public static String compress(String str) throws IOException {
+		String result = compress(str, "ISO-8859-1");
+		return result;
+	}
+
+	public static String compress(String str, String charset) throws IOException {
 		if (str == null || str.length() == 0) {
 			return str;
 		}
@@ -18,11 +52,16 @@ public class GZIPCompressUtil {
 		GZIPOutputStream gzip = new GZIPOutputStream(out);
 		gzip.write(str.getBytes());
 		gzip.close();
-		return out.toString("ISO-8859-1");
+		return out.toString();
 	}
 
 	public static String uncompress(String str) throws IOException {
-		String message = new String(GZIPCompressUtil.uncompress(str.getBytes("ISO-8859-1")));
+		String result = uncompress(str, "ISO-8859-1");
+		return result;
+	}
+
+	public static String uncompress(String str, String charset) throws IOException {
+		String message = new String(uncompress(str.getBytes(charset)));
 		return message;
 	}
 
@@ -40,7 +79,7 @@ public class GZIPCompressUtil {
 				out.write(buffer, 0, n);
 			}
 		} catch (Exception e) {
-			log.error(e.getMessage(),e);
+			log.error(e.getMessage(), e);
 		}
 		return out.toByteArray();
 	}

+ 35 - 7
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/HttpClientUtil.java

@@ -3,6 +3,7 @@ package com.persagy.ibms.data.sdk.util;
 import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.http.HttpResponse;
 import org.apache.http.client.HttpClient;
@@ -14,15 +15,31 @@ import org.apache.http.entity.StringEntity;
 import org.apache.http.impl.client.HttpClients;
 
 public class HttpClientUtil {
+	private static Map<String, HttpClientUtil> instanceMap = new ConcurrentHashMap<String, HttpClientUtil>();
 
-	private static final HttpClient client = HttpClients.createDefault();
+	private HttpClient client;
 
-	public synchronized static String put(String url, String content) throws Exception {
+	public static HttpClientUtil instance() {
+		HttpClientUtil result = instance("default");
+		return result;
+	}
+
+	public static HttpClientUtil instance(String name) {
+		HttpClientUtil newObj = new HttpClientUtil();
+		HttpClientUtil exist = instanceMap.putIfAbsent(name, newObj);
+		if (exist == null) {
+			newObj.client = HttpClients.createDefault();
+		}
+		HttpClientUtil instance = instanceMap.get(name);
+		return instance;
+	}
+
+	public synchronized String put(String url, String content) throws Exception {
 		String result = put(url, content, 300000, null);
 		return result;
 	}
 
-	public synchronized static String put(String url, String content, Integer timeout, Map<String, String> headerMap) throws Exception {
+	public synchronized String put(String url, String content, Integer timeout, Map<String, String> headerMap) throws Exception {
 		HttpPut httpost = new HttpPut(url);
 		if (headerMap != null) {
 			for (String key : headerMap.keySet()) {
@@ -54,12 +71,12 @@ public class HttpClientUtil {
 		return result;
 	}
 
-	public synchronized static String get(String url) throws Exception {
+	public synchronized String get(String url) throws Exception {
 		String result = get(url, 300000, null);
 		return result;
 	}
 
-	public synchronized static String get(String url, Integer timeout, Map<String, String> headerMap) throws Exception {
+	public synchronized String get(String url, Integer timeout, Map<String, String> headerMap) throws Exception {
 		HttpGet httpget = new HttpGet(url);
 		if (headerMap != null) {
 			for (String key : headerMap.keySet()) {
@@ -90,12 +107,23 @@ public class HttpClientUtil {
 		return result;
 	}
 
-	public synchronized static String post(String url, String content) throws Exception {
+	public synchronized String post_compress(String url, String content) throws Exception {
+		if (Constant.rwd_compress) {
+			String resultOri = post(url + "&compress=true", content);
+			String result = GZIPCompressUtil.unzipBase64(resultOri);
+			return result;
+		} else {
+			String result = post(url, content);
+			return result;
+		}
+	}
+
+	public synchronized String post(String url, String content) throws Exception {
 		String result = post(url, content, 300000, null);
 		return result;
 	}
 
-	public synchronized static String post(String url, String content, Integer timeout, Map<String, String> headerMap) throws Exception {
+	public synchronized String post(String url, String content, Integer timeout, Map<String, String> headerMap) throws Exception {
 		HttpPost httpost = new HttpPost(url);
 		if (headerMap != null) {
 			for (String key : headerMap.keySet()) {

+ 32 - 32
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/NearestCameraUtil.java

@@ -1,42 +1,42 @@
 package com.persagy.ibms.data.sdk.util;
 
+import java.util.List;
+
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.persagy.ibms.core.data.SceneDataObject;
 import com.persagy.ibms.core.data.SceneDataSet;
-import java.util.List;
-import java.util.Optional;
-import java.util.stream.Collectors;
 
 public class NearestCameraUtil {
-    public static JSONArray NearestCamera(String objectId) throws Exception {
-        RepositoryImpl Repository = RepositoryContainer.instance;
-        String groupCode = RepositoryContainer.RepositoryProject.groupCode;
-        String projectId = RepositoryContainer.RepositoryProject.projectId;
-        JSONObject param = new JSONObject();
-        param.put("userId", "0");
-        param.put("appId", "0");
-        param.put("groupCode", groupCode);
-        param.put("projectId", projectId);
-        param.put("objectId", objectId);
-        String post_result = HttpClientUtil.post(Constant.zkt_monitor_url + "/camera/nearest/v2", param.toJSONString());
-        JSONObject resultJSON = JSON.parseObject(post_result);
-        List<JSONObject> content = (List<JSONObject>) resultJSON.get("Content");
-        SceneDataSet arr = Repository.ZKTObjectArrayDic.get("spjk").get("shexiangtou").value_array;
-        JSONArray cameraArray = new JSONArray();
-        for (JSONObject obj : content) {
-            String objId = obj.get("id").toString();
-            SceneDataObject obj2= arr.set.stream().filter(item->item.get("id").value_prim.value.equals(objId)).findFirst().get();
-            cameraArray.add(obj2.toJSON(1));
-//            for (SceneDataObject data : arr.set) {
-//                Object itemId = data.get("id").value_prim.value;
-//                if (objId.equals(itemId)) {
-//                    cameraArray.add(data.toJSON(1));
-//                    break;
-//                }
-//            }
-        }
-        return cameraArray;
-    }
+	@SuppressWarnings("unchecked")
+	public static JSONArray NearestCamera(String objectId) throws Exception {
+		RepositoryImpl Repository = RepositoryContainer.instance;
+		String groupCode = RepositoryContainer.RepositoryProject.groupCode;
+		String projectId = RepositoryContainer.RepositoryProject.projectId;
+		JSONObject param = new JSONObject();
+		param.put("userId", "0");
+		param.put("appId", "0");
+		param.put("groupCode", groupCode);
+		param.put("projectId", projectId);
+		param.put("objectId", objectId);
+		String post_result = HttpClientUtil.instance("zkt_monitor").post(Constant.zkt_monitor_url + "/camera/nearest/v2", param.toJSONString());
+		JSONObject resultJSON = JSON.parseObject(post_result);
+		List<JSONObject> content = (List<JSONObject>) resultJSON.get("Content");
+		SceneDataSet arr = Repository.ZKTObjectArrayDic.get("spjk").get("shexiangtou").value_array;
+		JSONArray cameraArray = new JSONArray();
+		for (JSONObject obj : content) {
+			String objId = obj.get("id").toString();
+			SceneDataObject obj2 = arr.set.stream().filter(item -> item.get("id").value_prim.value.equals(objId)).findFirst().get();
+			cameraArray.add(obj2.toJSON(1));
+			// for (SceneDataObject data : arr.set) {
+			// Object itemId = data.get("id").value_prim.value;
+			// if (objId.equals(itemId)) {
+			// cameraArray.add(data.toJSON(1));
+			// break;
+			// }
+			// }
+		}
+		return cameraArray;
+	}
 }

+ 15 - 12
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/RWDAlarmUtil.java

@@ -72,7 +72,7 @@ public class RWDAlarmUtil {
 		try {
 			if (Constant.alarm_service_name.equalsIgnoreCase("ibms-alarm")) {
 				String get_url = Constant.alarm_url + "/alarm-record/query";
-				String getResultString = HttpClientUtil.get(get_url + "/" + alarmId);
+				String getResultString = HttpClientUtil.instance("alarm").get(get_url + "/" + alarmId);
 				JSONObject getResult = JSON.parseObject(getResultString);
 				JSONObject Item = getResult.getJSONObject("Item");
 				modify_alarm(Item);
@@ -88,7 +88,7 @@ public class RWDAlarmUtil {
 						ids.add(alarmId);
 						postParamInner.put("ids", ids);
 						String post_url = Constant.alarm_url + "/alarmToWorkOrder/queryOrderStateByAlarmIds";
-						String postResultString = HttpClientUtil.post(post_url, postParamInner.toJSONString());
+						String postResultString = HttpClientUtil.instance("alarm").post(post_url, postParamInner.toJSONString());
 						JSONObject postResult = JSON.parseObject(postResultString);
 						JSONArray Content = (JSONArray) postResult.get("Content");
 						if (Content != null && Content.size() == 1) {
@@ -155,7 +155,7 @@ public class RWDAlarmUtil {
 					sb.append("&objId=" + params.get("objId"));
 				}
 
-				String getResultString = HttpClientUtil.get(get_url + sb.toString());
+				String getResultString = HttpClientUtil.instance("alarm").get(get_url + sb.toString());
 				JSONObject getResult = JSON.parseObject(getResultString);
 				JSONArray ContentInner = getResult.getJSONArray("Content");
 				Content.addAll(ContentInner);
@@ -200,7 +200,7 @@ public class RWDAlarmUtil {
 						postParam.put("page", pageIndex + 1);
 					}
 				}
-				String postResultString = HttpClientUtil.post(post_url, postParam.toJSONString());
+				String postResultString = HttpClientUtil.instance("alarm").post(post_url, postParam.toJSONString());
 				JSONObject postResult = JSON.parseObject(postResultString);
 				Content = (JSONArray) postResult.get("Content");
 				result.put("count", postResult.get("Count"));
@@ -652,7 +652,7 @@ public class RWDAlarmUtil {
 					String get_url = Constant.alarm_url + "/alarm-record/page" + "?appId=" + "0" + "&userId=" + "systemId" + "&projectId="
 							+ RepositoryContainer.RepositoryProject.projectId + "&groupCode=" + RepositoryContainer.RepositoryProject.groupCode
 							+ "&dealType=0&size=" + page_size + "&current=" + page_current;
-					String getResultString = HttpClientUtil.get(get_url);
+					String getResultString = HttpClientUtil.instance("alarm").get(get_url);
 					JSONObject getResult = JSON.parseObject(getResultString);
 					JSONArray ContentInner = (JSONArray) getResult.get("Content");
 					JSONArray ids = new JSONArray();
@@ -676,7 +676,7 @@ public class RWDAlarmUtil {
 						postParamInner.put("groupCode", RepositoryContainer.RepositoryProject.groupCode);
 						postParamInner.put("ids", ids);
 						String post_url = Constant.alarm_url + "/alarmToWorkOrder/queryOrderStateByAlarmIds";
-						String postResultString = HttpClientUtil.post(post_url, postParamInner.toJSONString());
+						String postResultString = HttpClientUtil.instance("alarm").post(post_url, postParamInner.toJSONString());
 						JSONObject postResult = JSON.parseObject(postResultString);
 						JSONArray ContentOrderState = (JSONArray) postResult.get("Content");
 						for (int i = 0; i < ContentOrderState.size(); i++) {
@@ -719,7 +719,7 @@ public class RWDAlarmUtil {
 			treatState.add(1);
 			treatState.add(2);
 			postParam.put("treatState", treatState);
-			String postResultString = HttpClientUtil.post(post_url, postParam.toJSONString());
+			String postResultString = HttpClientUtil.instance("alarm").post(post_url, postParam.toJSONString());
 			JSONObject postResult = JSON.parseObject(postResultString);
 			Content = (JSONArray) postResult.get("Content");
 		}
@@ -761,7 +761,8 @@ public class RWDAlarmUtil {
 						}
 					}
 					log.warn(Constant.alarm_url + "/alarm-record/handleAlarm" + "\n" + handleJSON.toJSONString());
-					String post_result = HttpClientUtil.put(Constant.alarm_url + "/alarm-record/handleAlarm", handleJSON.toJSONString());
+					String post_result = HttpClientUtil.instance("alarm").put(Constant.alarm_url + "/alarm-record/handleAlarm",
+							handleJSON.toJSONString());
 					result = JSON.parseObject(post_result);
 				}
 				if (paramJSON.containsKey("comment") && paramJSON.containsKey("userId")) {
@@ -773,7 +774,7 @@ public class RWDAlarmUtil {
 					commentJSON.put("id", paramJSON.get("id"));
 					commentJSON.put("alarmRecordCommentDto", dtoJSON);
 					log.warn(Constant.alarm_url + "/alarm-record/updateComment" + "\n" + commentJSON.toJSONString());
-					HttpClientUtil.put(Constant.alarm_url + "/alarm-record/updateComment", commentJSON.toJSONString());
+					HttpClientUtil.instance("alarm").put(Constant.alarm_url + "/alarm-record/updateComment", commentJSON.toJSONString());
 					dtoJSON.put("commentTime", sdf_.format(currTime));
 					ProcessAlarm_comment((String) paramJSON.get("id"), dtoJSON);
 				}
@@ -808,7 +809,8 @@ public class RWDAlarmUtil {
 					handleJSON.put("id", paramJSON.get("id"));
 					handleJSON.put("alarmDescribe", paramJSON.get("comment"));
 					log.warn(Constant.alarm_url + "/alarmToWorkOrder/transfer" + "\n" + handleJSON.toJSONString());
-					String post_result = HttpClientUtil.post(Constant.alarm_url + "/alarmToWorkOrder/transfer", handleJSON.toJSONString());
+					String post_result = HttpClientUtil.instance("alarm").post(Constant.alarm_url + "/alarmToWorkOrder/transfer",
+							handleJSON.toJSONString());
 					result = JSON.parseObject(post_result);
 				}
 				{
@@ -817,7 +819,8 @@ public class RWDAlarmUtil {
 					handleJSON.put("treatMode", 2);
 					handleJSON.put("treatState", 2);
 					log.warn(Constant.alarm_url + "/alarm-record/handleAlarm" + "\n" + handleJSON.toJSONString());
-					String post_result = HttpClientUtil.put(Constant.alarm_url + "/alarm-record/handleAlarm", handleJSON.toJSONString());
+					String post_result = HttpClientUtil.instance("alarm").put(Constant.alarm_url + "/alarm-record/handleAlarm",
+							handleJSON.toJSONString());
 					result = JSON.parseObject(post_result);
 				}
 				if (paramJSON.containsKey("comment") && paramJSON.containsKey("userId")) {
@@ -829,7 +832,7 @@ public class RWDAlarmUtil {
 					commentJSON.put("id", paramJSON.get("id"));
 					commentJSON.put("alarmRecordCommentDto", dtoJSON);
 					log.warn(Constant.alarm_url + "/alarm-record/updateComment" + "\n" + commentJSON.toJSONString());
-					HttpClientUtil.put(Constant.alarm_url + "/alarm-record/updateComment", commentJSON.toJSONString());
+					HttpClientUtil.instance("alarm").put(Constant.alarm_url + "/alarm-record/updateComment", commentJSON.toJSONString());
 
 					dtoJSON.put("commentTime", sdf_.format(currTime));
 					ProcessAlarm_comment((String) paramJSON.get("id"), dtoJSON);

+ 35 - 29
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/RWDDownloadUtil.java

@@ -41,7 +41,8 @@ public class RWDDownloadUtil {
 			param.put("projectId", projectId);
 			param.put("dictType", Constant.sdk_version);
 			param.put("code", "1");
-			String post_result = HttpClientUtil.post(Constant.zkt_monitor_url + "/generalDictionary/list", param.toJSONString());
+			String post_result = HttpClientUtil.instance("zkt_monitor").post(Constant.zkt_monitor_url + "/generalDictionary/list",
+					param.toJSONString());
 			JSONObject resultJSON = JSON.parseObject(post_result);
 			classArray = resultJSON.getJSONArray("Content");
 			if (classArray != null && classArray.size() == 1) {
@@ -133,8 +134,9 @@ public class RWDDownloadUtil {
 			JSONObject param = new JSONObject();
 			JSONObject criteria = new JSONObject();
 			param.put("criteria", criteria);
-			String post_result = HttpClientUtil.post(Constant.rwd_url + "/rwd/def/class?projectId=" + RepositoryContainer.RepositoryProject.projectId
-					+ "&groupCode=" + RepositoryContainer.RepositoryProject.groupCode, param.toJSONString());
+			String post_result = HttpClientUtil.instance("rwd").post_compress(Constant.rwd_url + "/rwd/def/class?projectId="
+					+ RepositoryContainer.RepositoryProject.projectId + "&groupCode=" + RepositoryContainer.RepositoryProject.groupCode,
+					param.toJSONString());
 			JSONObject resultJSON = JSON.parseObject(post_result);
 			classArray = resultJSON.getJSONArray("data");
 			classArray = classArray == null ? new JSONArray() : classArray;
@@ -150,7 +152,7 @@ public class RWDDownloadUtil {
 				criteria.put("classCode", code);
 				param.put("criteria", criteria);
 				log.debug("Download info " + code);
-				String post_result = HttpClientUtil.post(Constant.rwd_url + "/rwd/def/funcid?projectId="
+				String post_result = HttpClientUtil.instance("rwd").post_compress(Constant.rwd_url + "/rwd/def/funcid?projectId="
 						+ RepositoryContainer.RepositoryProject.projectId + "&groupCode=" + RepositoryContainer.RepositoryProject.groupCode,
 						param.toJSONString());
 				JSONObject resultJSON = JSON.parseObject(post_result);
@@ -186,7 +188,7 @@ public class RWDDownloadUtil {
 				criteria.put("valid", 1);
 				param.put("criteria", criteria);
 				log.debug("Download object " + code);
-				String post_result = HttpClientUtil.post(Constant.rwd_url + "/rwd/instance/object/query?projectId="
+				String post_result = HttpClientUtil.instance("rwd").post_compress(Constant.rwd_url + "/rwd/instance/object/query?projectId="
 						+ RepositoryContainer.RepositoryProject.projectId + "&groupCode=" + RepositoryContainer.RepositoryProject.groupCode,
 						param.toJSONString());
 				JSONObject resultJSON = JSON.parseObject(post_result);
@@ -218,7 +220,7 @@ public class RWDDownloadUtil {
 					criteria.put("relCode", relCode);
 					param.put("criteria", criteria);
 					log.debug("Download relation " + graphCode + " " + relCode);
-					String post_result = HttpClientUtil.post(Constant.rwd_url + "/rwd/instance/relation/query?projectId="
+					String post_result = HttpClientUtil.instance("rwd").post_compress(Constant.rwd_url + "/rwd/instance/relation/query?projectId="
 							+ RepositoryContainer.RepositoryProject.projectId + "&groupCode=" + RepositoryContainer.RepositoryProject.groupCode,
 							param.toJSONString());
 					JSONObject resultJSON = JSON.parseObject(post_result);
@@ -305,8 +307,9 @@ public class RWDDownloadUtil {
 			pathInner.add("产品模块");
 			JSONObject param = new JSONObject();
 			param.put("path", pathInner);
-			String post_result = HttpClientUtil.post(Constant.rwd_url + "/post?projectId=" + RepositoryContainer.RepositoryProject.projectId
-					+ "&groupCode=" + RepositoryContainer.RepositoryProject.groupCode, param.toJSONString());
+			String post_result = HttpClientUtil.instance("zkt_dmp").post_compress(Constant.rwd_url + "/post?projectId="
+					+ RepositoryContainer.RepositoryProject.projectId + "&groupCode=" + RepositoryContainer.RepositoryProject.groupCode,
+					param.toJSONString());
 			sceneArray = JSON.parseArray(post_result);
 			sceneArray = sceneArray == null ? new JSONArray() : sceneArray;
 			FileUtil.Save(path + Constant.getSeperator() + "sceneArray.json", FastJsonUtil.toFormatString(sceneArray));
@@ -317,8 +320,9 @@ public class RWDDownloadUtil {
 			JSONObject criteria = new JSONObject();
 			criteria.put("ibms", true);
 			param.put("criteria", criteria);
-			String post_result = HttpClientUtil.post(Constant.rwd_url + "/rwd/def/class?projectId=" + RepositoryContainer.RepositoryProject.projectId
-					+ "&groupCode=" + RepositoryContainer.RepositoryProject.groupCode, param.toJSONString());
+			String post_result = HttpClientUtil.instance("zkt_dmp").post_compress(Constant.rwd_url + "/rwd/def/class?projectId="
+					+ RepositoryContainer.RepositoryProject.projectId + "&groupCode=" + RepositoryContainer.RepositoryProject.groupCode,
+					param.toJSONString());
 			JSONObject resultJSON = JSON.parseObject(post_result);
 			classArray = resultJSON.getJSONArray("data");
 			classArray = classArray == null ? new JSONArray() : classArray;
@@ -336,7 +340,7 @@ public class RWDDownloadUtil {
 				criteria.put("ibmsClassCode", ibmsClassCode);
 				param.put("criteria", criteria);
 				log.debug("Download object " + ibmsSceneCode + "-" + ibmsClassCode);
-				String post_result = HttpClientUtil.post(Constant.rwd_url + "/rwd/instance/object/query?projectId="
+				String post_result = HttpClientUtil.instance("zkt_dmp").post_compress(Constant.rwd_url + "/rwd/instance/object/query?projectId="
 						+ RepositoryContainer.RepositoryProject.projectId + "&groupCode=" + RepositoryContainer.RepositoryProject.groupCode,
 						param.toJSONString());
 				JSONObject resultJSON = JSON.parseObject(post_result);
@@ -357,9 +361,10 @@ public class RWDDownloadUtil {
 			if (Constant.alarm_service_name.equalsIgnoreCase("ibms-alarm")) {
 				boolean use_group = true;
 				if (use_group) {
-					String post_result = HttpClientUtil.get(Constant.alarm_url + "/alarm-record/selectItemGroupCode" + "?appId=" + "0" + "&userId="
-							+ "systemId" + "&projectId=" + RepositoryContainer.RepositoryProject.projectId + "&groupCode="
-							+ RepositoryContainer.RepositoryProject.groupCode);
+					String post_result = HttpClientUtil.instance("alarm")
+							.get(Constant.alarm_url + "/alarm-record/selectItemGroupCode" + "?appId=" + "0" + "&userId=" + "systemId" + "&projectId="
+									+ RepositoryContainer.RepositoryProject.projectId + "&groupCode="
+									+ RepositoryContainer.RepositoryProject.groupCode);
 					JSONObject resultJSON = JSON.parseObject(post_result);
 					JSONArray Content = resultJSON.getJSONArray("Item");
 					for (int ii = 0; ii < Content.size(); ii++) {
@@ -373,9 +378,10 @@ public class RWDDownloadUtil {
 						JSONObject classItem = classArray.getJSONObject(i);
 						String ibmsSceneCode = classItem.getString("ibmsSceneCode");
 						String ibmsClassCode = classItem.getString("ibmsClassCode");
-						String post_result = HttpClientUtil.get(Constant.alarm_url + "/alarm-config/itemList/" + ibmsSceneCode + "/" + ibmsClassCode
-								+ "?appId=" + "0" + "&userId=" + "systemId" + "&projectId=" + RepositoryContainer.RepositoryProject.projectId
-								+ "&groupCode=" + RepositoryContainer.RepositoryProject.groupCode);
+						String post_result = HttpClientUtil.instance("alarm")
+								.get(Constant.alarm_url + "/alarm-config/itemList/" + ibmsSceneCode + "/" + ibmsClassCode + "?appId=" + "0"
+										+ "&userId=" + "systemId" + "&projectId=" + RepositoryContainer.RepositoryProject.projectId + "&groupCode="
+										+ RepositoryContainer.RepositoryProject.groupCode);
 						JSONObject resultJSON = JSON.parseObject(post_result);
 						JSONArray Content = resultJSON.getJSONArray("Content");
 						for (int ii = 0; ii < Content.size(); ii++) {
@@ -392,7 +398,7 @@ public class RWDDownloadUtil {
 				criteria.put("userId", "systemId");
 				criteria.put("projectId", RepositoryContainer.RepositoryProject.projectId);
 				criteria.put("groupCode", RepositoryContainer.RepositoryProject.groupCode);
-				String post_result = HttpClientUtil.post(Constant.alarm_url + "/alarm/queryItem", criteria.toJSONString());
+				String post_result = HttpClientUtil.instance("alarm").post(Constant.alarm_url + "/alarm/queryItem", criteria.toJSONString());
 				JSONObject resultJSON = JSON.parseObject(post_result);
 				JSONArray Content = resultJSON.getJSONArray("Content");
 				for (int ii = 0; ii < Content.size(); ii++) {
@@ -422,17 +428,18 @@ public class RWDDownloadUtil {
 					JSONObject classItem = classArray.getJSONObject(i);
 					String ibmsSceneCode = classItem.getString("ibmsSceneCode");
 					String ibmsClassCode = classItem.getString("ibmsClassCode");
-					String itemListResultString = HttpClientUtil
+					String itemListResultString = HttpClientUtil.instance("alarm")
 							.get(Constant.alarm_url + "/alarm-config/itemList/" + ibmsSceneCode + "/" + ibmsClassCode);
 					JSONObject itemListResultJSON = JSON.parseObject(itemListResultString);
 					JSONArray itemListResultContent = itemListResultJSON.getJSONArray("Content");
 					for (int ii = 0; ii < itemListResultContent.size(); ii++) {
 						JSONObject itemAlarmType = itemListResultContent.getJSONObject(ii);
 						String itemId = itemAlarmType.getString("id");
-						String alarmDefineListString = HttpClientUtil.get(Constant.alarm_url + "/alarm-config/configPage" + "?appId=" + "0"
-								+ "&userId=" + "systemId" + "&projectId=" + RepositoryContainer.RepositoryProject.projectId + "&groupCode="
-								+ RepositoryContainer.RepositoryProject.groupCode + "&ibmsSceneCode=" + ibmsSceneCode + "&ibmsClassCode="
-								+ ibmsClassCode + "&itemId=" + itemId);
+						String alarmDefineListString = HttpClientUtil.instance("alarm")
+								.get(Constant.alarm_url + "/alarm-config/configPage" + "?appId=" + "0" + "&userId=" + "systemId" + "&projectId="
+										+ RepositoryContainer.RepositoryProject.projectId + "&groupCode="
+										+ RepositoryContainer.RepositoryProject.groupCode + "&ibmsSceneCode=" + ibmsSceneCode + "&ibmsClassCode="
+										+ ibmsClassCode + "&itemId=" + itemId);
 						JSONObject alarmDefineListJSON = JSON.parseObject(alarmDefineListString);
 						JSONArray alarmDefineListContent = alarmDefineListJSON.getJSONArray("Content");
 						for (int iii = 0; iii < alarmDefineListContent.size(); iii++) {
@@ -455,7 +462,7 @@ public class RWDDownloadUtil {
 				param.put("appId", "datautils");
 				param.put("groupCode", RepositoryContainer.RepositoryProject.groupCode);
 				param.put("projectId", RepositoryContainer.RepositoryProject.projectId);
-				String post_result = HttpClientUtil.post(Constant.alarm_url + "/alarm/queryConfig", param.toJSONString());
+				String post_result = HttpClientUtil.instance("alarm").post(Constant.alarm_url + "/alarm/queryConfig", param.toJSONString());
 				JSONObject resultJSON = JSON.parseObject(post_result);
 				alarmConfigArray = resultJSON.getJSONArray("Content");
 			}
@@ -514,7 +521,7 @@ public class RWDDownloadUtil {
 		return result;
 	}
 
-	private static JSONArray post_by_page(String url, JSONObject criteria_base, int page_size) throws Exception {
+	private static JSONArray post_by_page(String name, String url, JSONObject criteria_base, int page_size) throws Exception {
 		JSONArray result;
 		while (true) {
 			Integer Count = null;
@@ -528,7 +535,7 @@ public class RWDDownloadUtil {
 				}
 				criteria.put("size", page_size);
 				criteria.put("page", page_current);
-				String post_result = HttpClientUtil.post(url, criteria.toJSONString());
+				String post_result = HttpClientUtil.instance(name).post(url, criteria.toJSONString());
 				JSONObject resultJSON = JSON.parseObject(post_result);
 				JSONArray ContentInner = (JSONArray) resultJSON.get("Content");
 				Content_this_time.addAll(ContentInner);
@@ -577,8 +584,7 @@ public class RWDDownloadUtil {
 			criteria.put("userId", "systemId");
 			criteria.put("projectId", RepositoryContainer.RepositoryProject.projectId);
 			criteria.put("groupCode", RepositoryContainer.RepositoryProject.groupCode);
-			String url = Constant.zkt_monitor_url + "/logicalGrouping/list";
-			classArray = post_by_page(url, criteria, page_size);
+			classArray = post_by_page("zkt_monitor", Constant.zkt_monitor_url + "/logicalGrouping/list", criteria, page_size);
 			FileUtil.Save(path + Constant.getSeperator() + "groupArray.json", FastJsonUtil.toFormatString(classArray));
 		}
 		Map<String, Map<String, List<String>>> idListMapMap = new ConcurrentHashMap<String, Map<String, List<String>>>();
@@ -612,7 +618,7 @@ public class RWDDownloadUtil {
 					criteria.put("projectId", RepositoryContainer.RepositoryProject.projectId);
 					criteria.put("groupCode", RepositoryContainer.RepositoryProject.groupCode);
 					criteria.put("logicalGroupingId", logicalGroupingId);
-					JSONArray Content = post_by_page(Constant.zkt_monitor_url + "/logicalObject/listPage", criteria, page_size);
+					JSONArray Content = post_by_page("zkt_monitor", Constant.zkt_monitor_url + "/logicalObject/listPage", criteria, page_size);
 					for (int i = 0; i < Content.size(); i++) {
 						JSONObject ContentItem = (JSONObject) Content.get(i);
 						ContentItem.put("logicalGroupingId", logicalGroupingId);

+ 15 - 15
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/RWDLoadUtil.java

@@ -974,20 +974,20 @@ public class RWDLoadUtil {
 					String id = (String) sdo.get("回路编号").value_prim.value;
 					if (Repository.id2sdv.containsKey(id)) {
 						SceneDataObject equipment = Repository.id2sdv.get(id);
-						SceneDataValue sdv_null=new SceneDataValue(null,null,null,null);
-						sdv_null.value_prim=new SceneDataPrimitive();
-						sdv_null.value_prim.change=false;
-						equipment.put("模块名称", sdo.containsKey("模块名称")? sdo.get("模块名称"):sdv_null);
-						equipment.put("配电箱名称", sdo.containsKey("配电箱名称")?sdo.get("配电箱名称"):sdv_null);
-						equipment.put("配电箱编号", sdo.containsKey("配电箱编号")?sdo.get("配电箱编号"):sdv_null);
-						equipment.put("电井名称", sdo.containsKey("电井名称")?sdo.get("电井名称"):sdv_null);
-						equipment.put("电井编号", sdo.containsKey("电井编号")?sdo.get("电井编号"):sdv_null);
-						equipment.put("一级编组名称", sdo.containsKey("一级编组名称")?sdo.get("一级编组名称"):sdv_null);
-						equipment.put("二级编组名称", sdo.containsKey("二级编组名称")?sdo.get("二级编组名称"):sdv_null); 
-						equipment.put("编组类型", sdo.containsKey("编组类型")?sdo.get("编组类型"):sdv_null);
+						SceneDataValue sdv_null = new SceneDataValue(null, null, null, null);
+						sdv_null.value_prim = new SceneDataPrimitive();
+						sdv_null.value_prim.change = false;
+						equipment.put("模块名称", sdo.containsKey("模块名称") ? sdo.get("模块名称") : sdv_null);
+						equipment.put("配电箱名称", sdo.containsKey("配电箱名称") ? sdo.get("配电箱名称") : sdv_null);
+						equipment.put("配电箱编号", sdo.containsKey("配电箱编号") ? sdo.get("配电箱编号") : sdv_null);
+						equipment.put("电井名称", sdo.containsKey("电井名称") ? sdo.get("电井名称") : sdv_null);
+						equipment.put("电井编号", sdo.containsKey("电井编号") ? sdo.get("电井编号") : sdv_null);
+						equipment.put("一级编组名称", sdo.containsKey("一级编组名称") ? sdo.get("一级编组名称") : sdv_null);
+						equipment.put("二级编组名称", sdo.containsKey("二级编组名称") ? sdo.get("二级编组名称") : sdv_null);
+						equipment.put("编组类型", sdo.containsKey("编组类型") ? sdo.get("编组类型") : sdv_null);
 						if (product.equals("ggzm")) {
-							equipment.put("楼层编号", sdo.containsKey("楼层编号")?sdo.get("楼层编号"):sdv_null);
-							equipment.put("楼层名称", sdo.containsKey("楼层名称")?sdo.get("楼层名称"):sdv_null);
+							equipment.put("楼层编号", sdo.containsKey("楼层编号") ? sdo.get("楼层编号") : sdv_null);
+							equipment.put("楼层名称", sdo.containsKey("楼层名称") ? sdo.get("楼层名称") : sdv_null);
 						}
 					}
 				}
@@ -1089,7 +1089,7 @@ public class RWDLoadUtil {
 			param.put("userId", "0");
 			param.put("appId", "0");
 			param.put("projectId", projectId);
-			String post_result = HttpClientUtil.post(Constant.zkt_control_url + "/tab/model/query", param.toJSONString());
+			String post_result = HttpClientUtil.instance("zkt_control").post(Constant.zkt_control_url + "/tab/model/query", param.toJSONString());
 			JSONObject resultJSON = JSON.parseObject(post_result);
 			JSONArray Content = (JSONArray) resultJSON.get("Content");
 			JSONArray array = new JSONArray();
@@ -1116,7 +1116,7 @@ public class RWDLoadUtil {
 			param.put("appId", "0");
 			param.put("projectId", projectId);
 			param.put("year", "" + year);
-			String post_result = HttpClientUtil.post(Constant.zkt_control_url + "/calendar/binding/query", param.toJSONString());
+			String post_result = HttpClientUtil.instance("zkt_control").post(Constant.zkt_control_url + "/calendar/binding/query", param.toJSONString());
 			JSONObject resultJSON = JSON.parseObject(post_result);
 			JSONObject Item = (JSONObject) resultJSON.get("Item");
 			JSONArray arrayToday = new JSONArray();

+ 2 - 2
ibms-data-sdk/src/main/resources/config.xml

@@ -7,7 +7,7 @@
 	<projectId>Pj4403070003</projectId>
 	<sdk_version>SDK-D</sdk_version>
 	<!-- zkt-dmp的服务地址 -->
-	<rwd url="http://192.168.100.33:9976/" />
+	<rwd url="http://192.168.100.33:9976/" compress="true" />
 	<config path="D-config" refresh_enable="true" refresh_interval_second="60" />
 	<physical_world path="D-physical_world" refresh_enable="true" refresh_interval_second="3600" />
 	<zkt_physical_world path="D-zkt_physical_world" enable="true" refresh_enable="true" refresh_interval_second="3600" />
@@ -35,7 +35,7 @@
 	<!-- 场景/产品模块编码与后台tab页名称的对应关系 -->
 	<SceneCode2TabName sceneCode="ggzm" tabName="公共照明" />
 	<SceneCode2TabName sceneCode="yjzm" tabName="夜景照明" />
-	
+
 	<info_replace objType="building" from="localId" to="ibmsxianshibianma" />
 	<info_replace objType="building" from="localName" to="ibmsxianshimingcheng" />
 	<info_replace objType="floor" from="localId" to="ibmsxianshibianma" />