Browse Source

重整配置文件

menglu 3 years ago
parent
commit
32ab44d6cb

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

@@ -40,8 +40,8 @@ public class Constant {
 	public static String iot_project_url;
 	public static boolean alarm_enable;
 	public static String alarm_websocket_url;
-	public static String alarm_rest_url;
-	public static boolean alarm_rest_get;
+	public static String alarm_url;
+	public static String alarm_service_name;
 
 	public static String adm_project_url;
 
@@ -156,9 +156,9 @@ public class Constant {
 					alarm_enable = Boolean.parseBoolean(element.attribute("enable").getValue());
 					alarm_websocket_url = element.attribute("websocket").getValue();
 					alarm_websocket_url = StrUtil.removeSuffix(alarm_websocket_url, "/");
-					alarm_rest_url = element.attribute("rest").getValue();
-					alarm_rest_url = StrUtil.removeSuffix(alarm_rest_url, "/");
-					alarm_rest_get = Boolean.parseBoolean(element.attribute("rest_get").getValue());
+					alarm_url = element.attribute("url").getValue();
+					alarm_url = StrUtil.removeSuffix(alarm_url, "/");
+					alarm_service_name = element.attribute("service_name").getValue();
 				}
 
 				iter = document.selectNodes("/root/ConfigRelation").iterator();

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

@@ -62,8 +62,8 @@ public class RWDAlarmUtil {
 		JSONObject result = new JSONObject();
 		String alarmId = (String) paramObject.get("alarmId");
 		try {
-			if (Constant.alarm_rest_get) {
-				String get_url = Constant.alarm_rest_url + "/alarm-record/query";
+			if (Constant.alarm_service_name.equalsIgnoreCase("ibms-alarm")) {
+				String get_url = Constant.alarm_url + "/alarm-record/query";
 				String getResultString = HttpClientUtil.get(get_url + "/" + alarmId);
 				JSONObject getResult = JSON.parseObject(getResultString);
 				JSONObject Item = getResult.getJSONObject("Item");
@@ -79,7 +79,7 @@ public class RWDAlarmUtil {
 						JSONArray ids = new JSONArray();
 						ids.add(alarmId);
 						postParamInner.put("ids", ids);
-						String post_url = Constant.alarm_rest_url + "/alarmToWorkOrder/queryOrderStateByAlarmIds";
+						String post_url = Constant.alarm_url + "/alarmToWorkOrder/queryOrderStateByAlarmIds";
 						String postResultString = HttpClientUtil.post(post_url, postParamInner.toJSONString());
 						JSONObject postResult = JSON.parseObject(postResultString);
 						JSONArray Content = (JSONArray) postResult.get("Content");
@@ -107,8 +107,8 @@ public class RWDAlarmUtil {
 		try {
 			JSONObject params = (JSONObject) paramObject.get("params");
 			JSONArray Content;
-			if (Constant.alarm_rest_get) {
-				String get_url = Constant.alarm_rest_url + "/alarm-record/page";
+			if (Constant.alarm_service_name.equalsIgnoreCase("ibms-alarm")) {
+				String get_url = Constant.alarm_url + "/alarm-record/page";
 				StringBuffer sb = new StringBuffer();
 				sb.append("?appId=" + "0" + "&userId=" + "systemId" + "&projectId=" + RepositoryContainer.RepositoryBase.projectId + "&groupCode="
 						+ RepositoryContainer.RepositoryBase.groupCode);
@@ -152,7 +152,7 @@ public class RWDAlarmUtil {
 				Content = getResult.getJSONArray("Content");
 				result.put("count", getResult.get("Count"));
 			} else {
-				String post_url = Constant.alarm_rest_url + "/alarm/queryAlarmList";
+				String post_url = Constant.alarm_url + "/alarm/queryAlarmList";
 				JSONObject postParam = new JSONObject();
 				postParam.put("appId", "0");
 				postParam.put("userId", "systemId");
@@ -532,11 +532,11 @@ public class RWDAlarmUtil {
 		}
 
 		JSONArray Content;
-		if (Constant.alarm_rest_get) {
+		if (Constant.alarm_service_name.equalsIgnoreCase("ibms-alarm")) {
 			Content = new JSONArray();
 			int[] treatState_array = { 1, 2 };
 			for (int treatState : treatState_array) {
-				String get_url = Constant.alarm_rest_url + "/alarm-record/page" + "?appId=" + "0" + "&userId=" + "systemId" + "&projectId="
+				String get_url = Constant.alarm_url + "/alarm-record/page" + "?appId=" + "0" + "&userId=" + "systemId" + "&projectId="
 						+ RepositoryContainer.RepositoryBase.projectId + "&groupCode=" + RepositoryContainer.RepositoryBase.groupCode
 						+ "&size=65535&current=1&treatState=" + treatState;
 				String getResultString = HttpClientUtil.get(get_url);
@@ -562,7 +562,7 @@ public class RWDAlarmUtil {
 					postParamInner.put("projectId", RepositoryContainer.RepositoryBase.projectId);
 					postParamInner.put("groupCode", RepositoryContainer.RepositoryBase.groupCode);
 					postParamInner.put("ids", ids);
-					String post_url = Constant.alarm_rest_url + "/alarmToWorkOrder/queryOrderStateByAlarmIds";
+					String post_url = Constant.alarm_url + "/alarmToWorkOrder/queryOrderStateByAlarmIds";
 					String postResultString = HttpClientUtil.post(post_url, postParamInner.toJSONString());
 					JSONObject postResult = JSON.parseObject(postResultString);
 					JSONArray ContentOrderState = (JSONArray) postResult.get("Content");
@@ -577,7 +577,7 @@ public class RWDAlarmUtil {
 				Content.addAll(ContentInner);
 			}
 		} else {
-			String post_url = Constant.alarm_rest_url + "/alarm/queryAlarmList";
+			String post_url = Constant.alarm_url + "/alarm/queryAlarmList";
 			JSONObject postParam = new JSONObject();
 			postParam.put("userId", "systemId");
 			postParam.put("groupCode", RepositoryContainer.RepositoryBase.groupCode);
@@ -610,7 +610,7 @@ public class RWDAlarmUtil {
 			SimpleDateFormat sdf_ = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
 			Date currTime = new Date();
 			JSONObject paramJSON = JSON.parseObject(param);
-			if (Constant.alarm_rest_get) {
+			if (Constant.alarm_service_name.equalsIgnoreCase("ibms-alarm")) {
 				{
 					JSONObject handleJSON = new JSONObject();
 					handleJSON.put("id", paramJSON.get("id"));
@@ -623,8 +623,8 @@ public class RWDAlarmUtil {
 					if (paramJSON.containsKey("nature")) {
 						handleJSON.put("nature", paramJSON.get("nature"));
 					}
-					log.warn(Constant.alarm_rest_url + "/alarm-record/handleAlarm" + "\n" + handleJSON.toJSONString());
-					String post_result = HttpClientUtil.put(Constant.alarm_rest_url + "/alarm-record/handleAlarm", handleJSON.toJSONString());
+					log.warn(Constant.alarm_url + "/alarm-record/handleAlarm" + "\n" + handleJSON.toJSONString());
+					String post_result = HttpClientUtil.put(Constant.alarm_url + "/alarm-record/handleAlarm", handleJSON.toJSONString());
 					result = JSON.parseObject(post_result);
 				}
 				if (paramJSON.containsKey("comment") && paramJSON.containsKey("userId")) {
@@ -635,8 +635,8 @@ public class RWDAlarmUtil {
 					dtoJSON.put("commentTime", sdf.format(currTime));
 					commentJSON.put("id", paramJSON.get("id"));
 					commentJSON.put("alarmRecordCommentDto", dtoJSON);
-					log.warn(Constant.alarm_rest_url + "/alarm-record/updateComment" + "\n" + commentJSON.toJSONString());
-					HttpClientUtil.put(Constant.alarm_rest_url + "/alarm-record/updateComment", commentJSON.toJSONString());
+					log.warn(Constant.alarm_url + "/alarm-record/updateComment" + "\n" + commentJSON.toJSONString());
+					HttpClientUtil.put(Constant.alarm_url + "/alarm-record/updateComment", commentJSON.toJSONString());
 					dtoJSON.put("commentTime", sdf_.format(currTime));
 					ProcessAlarm_comment((String) paramJSON.get("id"), dtoJSON);
 				}
@@ -661,7 +661,7 @@ public class RWDAlarmUtil {
 			SimpleDateFormat sdf_ = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
 			Date currTime = new Date();
 			JSONObject paramJSON = JSON.parseObject(param);
-			if (Constant.alarm_rest_get) {
+			if (Constant.alarm_service_name.equalsIgnoreCase("ibms-alarm")) {
 				{
 					JSONObject handleJSON = new JSONObject();
 					handleJSON.put("groupCode", RepositoryContainer.RepositoryBase.groupCode);
@@ -670,8 +670,8 @@ public class RWDAlarmUtil {
 					handleJSON.put("userId", paramJSON.get("userId"));
 					handleJSON.put("id", paramJSON.get("id"));
 					handleJSON.put("alarmDescribe", "null");
-					log.warn(Constant.alarm_rest_url + "/alarmToWorkOrder/transfer" + "\n" + handleJSON.toJSONString());
-					String post_result = HttpClientUtil.post(Constant.alarm_rest_url + "/alarmToWorkOrder/transfer", handleJSON.toJSONString());
+					log.warn(Constant.alarm_url + "/alarmToWorkOrder/transfer" + "\n" + handleJSON.toJSONString());
+					String post_result = HttpClientUtil.post(Constant.alarm_url + "/alarmToWorkOrder/transfer", handleJSON.toJSONString());
 					result = JSON.parseObject(post_result);
 				}
 				{
@@ -679,8 +679,8 @@ public class RWDAlarmUtil {
 					handleJSON.put("id", paramJSON.get("id"));
 					handleJSON.put("treatMode", 2);
 					handleJSON.put("treatState", 2);
-					log.warn(Constant.alarm_rest_url + "/alarm-record/handleAlarm" + "\n" + handleJSON.toJSONString());
-					String post_result = HttpClientUtil.put(Constant.alarm_rest_url + "/alarm-record/handleAlarm", handleJSON.toJSONString());
+					log.warn(Constant.alarm_url + "/alarm-record/handleAlarm" + "\n" + handleJSON.toJSONString());
+					String post_result = HttpClientUtil.put(Constant.alarm_url + "/alarm-record/handleAlarm", handleJSON.toJSONString());
 					result = JSON.parseObject(post_result);
 				}
 				if (paramJSON.containsKey("comment") && paramJSON.containsKey("userId")) {
@@ -691,8 +691,8 @@ public class RWDAlarmUtil {
 					dtoJSON.put("commentTime", sdf.format(currTime));
 					commentJSON.put("id", paramJSON.get("id"));
 					commentJSON.put("alarmRecordCommentDto", dtoJSON);
-					log.warn(Constant.alarm_rest_url + "/alarm-record/updateComment" + "\n" + commentJSON.toJSONString());
-					HttpClientUtil.put(Constant.alarm_rest_url + "/alarm-record/updateComment", commentJSON.toJSONString());
+					log.warn(Constant.alarm_url + "/alarm-record/updateComment" + "\n" + commentJSON.toJSONString());
+					HttpClientUtil.put(Constant.alarm_url + "/alarm-record/updateComment", commentJSON.toJSONString());
 
 					dtoJSON.put("commentTime", sdf_.format(currTime));
 					ProcessAlarm_comment((String) paramJSON.get("id"), dtoJSON);

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

@@ -337,11 +337,11 @@ public class RWDDownloadUtil {
 
 		{
 			Map<String, String> alarmTypeMap = new HashMap<String, String>();
-			if (Constant.alarm_rest_get) {
+			if (Constant.alarm_service_name.equalsIgnoreCase("ibms-alarm")) {
 				boolean use_group = true;
 				if (use_group) {
 					String post_result = HttpClientUtil.get(
-							Constant.alarm_rest_url + "/alarm-record/selectItemGroupCode" + "?appId=" + "0" + "&userId=" + "systemId" + "&projectId="
+							Constant.alarm_url + "/alarm-record/selectItemGroupCode" + "?appId=" + "0" + "&userId=" + "systemId" + "&projectId="
 									+ RepositoryContainer.RepositoryBase.projectId + "&groupCode=" + RepositoryContainer.RepositoryBase.groupCode);
 					JSONObject resultJSON = JSON.parseObject(post_result);
 					JSONArray Content = resultJSON.getJSONArray("Item");
@@ -356,7 +356,7 @@ 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_rest_url + "/alarm-config/itemList/" + ibmsSceneCode + "/"
+						String post_result = HttpClientUtil.get(Constant.alarm_url + "/alarm-config/itemList/" + ibmsSceneCode + "/"
 								+ ibmsClassCode + "?appId=" + "0" + "&userId=" + "systemId" + "&projectId="
 								+ RepositoryContainer.RepositoryBase.projectId + "&groupCode=" + RepositoryContainer.RepositoryBase.groupCode);
 						JSONObject resultJSON = JSON.parseObject(post_result);
@@ -375,7 +375,7 @@ public class RWDDownloadUtil {
 				criteria.put("userId", "systemId");
 				criteria.put("projectId", RepositoryContainer.RepositoryBase.projectId);
 				criteria.put("groupCode", RepositoryContainer.RepositoryBase.groupCode);
-				String post_result = HttpClientUtil.post(Constant.alarm_rest_url + "/alarm/queryItem", criteria.toJSONString());
+				String post_result = HttpClientUtil.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++) {
@@ -399,21 +399,21 @@ public class RWDDownloadUtil {
 
 		{
 			JSONArray alarmConfigArray;
-			if (Constant.alarm_rest_get) {
+			if (Constant.alarm_service_name.equalsIgnoreCase("ibms-alarm")) {
 				alarmConfigArray = new JSONArray();
 				for (int i = 0; i < classArray.size(); i++) {
 					JSONObject classItem = classArray.getJSONObject(i);
 					String ibmsSceneCode = classItem.getString("ibmsSceneCode");
 					String ibmsClassCode = classItem.getString("ibmsClassCode");
 					String itemListResultString = HttpClientUtil
-							.get(Constant.alarm_rest_url + "/alarm-config/itemList/" + ibmsSceneCode + "/" + ibmsClassCode);
+							.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_rest_url + "/alarm-config/configPage" + "?appId=" + "0" + "&userId=" + "systemId" + "&projectId="
+								.get(Constant.alarm_url + "/alarm-config/configPage" + "?appId=" + "0" + "&userId=" + "systemId" + "&projectId="
 										+ RepositoryContainer.RepositoryBase.projectId + "&groupCode=" + RepositoryContainer.RepositoryBase.groupCode
 										+ "&ibmsSceneCode=" + ibmsSceneCode + "&ibmsClassCode=" + ibmsClassCode + "&itemId=" + itemId);
 						JSONObject alarmDefineListJSON = JSON.parseObject(alarmDefineListString);
@@ -438,7 +438,7 @@ public class RWDDownloadUtil {
 				param.put("appId", "datautils");
 				param.put("groupCode", RepositoryContainer.RepositoryBase.groupCode);
 				param.put("projectId", RepositoryContainer.RepositoryBase.projectId);
-				String post_result = HttpClientUtil.post(Constant.alarm_rest_url + "/alarm/queryConfig", param.toJSONString());
+				String post_result = HttpClientUtil.post(Constant.alarm_url + "/alarm/queryConfig", param.toJSONString());
 				JSONObject resultJSON = JSON.parseObject(post_result);
 				alarmConfigArray = resultJSON.getJSONArray("Content");
 			}

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

@@ -3,31 +3,30 @@
 	<groupCode>WD</groupCode>
 	<projectId>Pj4403070003</projectId>
 	<sdk_version>SDK-D</sdk_version>
-	<!-- rwd的服务地址 -->
-	<!-- <rwd url="http://192.168.100.33:9909/dmp-rwd/" /> -->
+	<!-- zkt-dmp的服务地址 -->
 	<rwd url="http://192.168.100.33:9976/" />
 	<physical_world path="D-physical_world" refresh_enable="true" />
 	<zkt_physical_world path="D-zkt_physical_world" enable="true" refresh_enable="true" />
 	<ibms_physical_world path="D-ibms_physical_world" enable="true" refresh_enable="true" />
 	<!-- zkt-monitor的服务地址 -->
 	<zkt_monitor url="http://192.168.100.33:9909/zkt-monitor/" />
+	<!-- zkt-control的服务地址 -->
 	<zkt_control url="http://192.168.100.33:9909/zkt-control/" />
 	<config path="D-config" refresh_enable="true" />
-	<!-- iot的websocket地址 -->
-	<!-- <iot_websocket url="ws://192.168.0.30:8868/websocket" /> -->
-	<iot_websocket url="ws://192.168.100.33:8858/websocket" />
 	<!-- iot-collect的服务地址 -->
 	<iot_collect url="http://192.168.100.33:9909/iot-collect/" />
+	<!-- iot-project的websocket地址 -->
+	<iot_websocket url="ws://192.168.100.33:8858/websocket" />
 	<!-- iot-project的服务地址 -->
-	<!-- <iot_project url="http://192.168.0.30:8862/" /> -->
 	<iot_project url="http://192.168.100.33:9909/iot-project/" />
 	<!-- adm-project的服务地址 -->
 	<adm_project url="http://39.102.40.239:28888/" />
-	<!-- 报警的websocket地址和服务地址 -->
-	<!-- <alarm enable="true" websocket="ws://192.168.100.33:9909/webSocketServer" rest="http://192.168.100.33:9909/zkt-alarm/" rest_get="false" /> -->
-	<alarm enable="true" websocket="ws://192.168.100.76:8835/webSocketServer" rest="http://192.168.100.33:9909/ibms-alarm/" rest_get="true" />
-	<!-- <alarm enable="true" websocket="http://39.102.43.179:9993/webSocketServer" rest="http://39.102.43.179:9993/" rest_get="true" /> -->
+	<!-- 报警的websocket地址、url服务地址、 service_name服务名(旧版本是zkt-alarm;新版本是ibms-alarm) -->
+	<!-- <alarm enable="true" websocket="ws://192.168.100.33:9909/webSocketServer" url="http://192.168.100.33:9909/zkt-alarm/" service_name="zkt-alarm" /> -->
+	<alarm enable="true" websocket="ws://192.168.100.76:8835/webSocketServer" url="http://192.168.100.33:9909/ibms-alarm/" service_name="ibms-alarm" />
+	<!-- <alarm enable="true" websocket="http://39.102.43.179:9993/webSocketServer" url="http://39.102.43.179:9993/" service_name="ibms-alarm" /> -->
 
+	<!-- 数据中台物理世界对象初始加载的关系,供SDK配置中使用 -->
 	<ConfigRelation graphCode="ArchSubset" relCode="Bd2Fl" objFrom="building" objTo="floor" nameInTo="所属建筑" multiplicityTo="1" />
 	<ConfigRelation graphCode="ArchSubset" relCode="Bd2Sp" objFrom="building" objTo="space" nameInTo="所属建筑" multiplicityTo="1" />
 	<ConfigRelation graphCode="ArchSubset" relCode="Fl2Sp" objFrom="floor" objTo="space" multiplicityFrom="n" nameInTo="所属楼层" multiplicityTo="1" />
@@ -41,7 +40,9 @@
 	<ConfigRelation graphCode="ValveRelationship" relCode="Vv2Eq" objFrom="equipment" objTo="equipment" nameInFrom="限制设备" multiplicityFrom="n" nameInTo="被设备限制" multiplicityTo="n" />
 	<ConfigRelation graphCode="ArchForArch" relCode="Sp2Sp" objFrom="space" objTo="space" nameInFrom="服务于空间" multiplicityFrom="n" nameInTo="被空间服务" multiplicityTo="n" />
 
+	<!-- 中转服务的编码、请求类型、url服务地址 -->
 	<Redirect code="获取报警时长" http_request_type="get" url="http://39.102.43.179:9982/alarmTime/query">
+		<!-- 中转服务的header,有几项就写几行 -->
 		<header key="Content-Type" value="application/json" />
 	</Redirect>
 	<Redirect code="查询项目概括" http_request_type="get" url="http://39.102.43.179:9982/projectSummary/query">