|
@@ -33,18 +33,25 @@ public class WebSocketUtil {
|
|
|
public static Map<String, Map<String, Boolean>> objInfoId2idList = new ConcurrentHashMap<String, Map<String, Boolean>>();
|
|
|
public static Map<String, Map<String, Boolean>> id2objInfoIdList = new ConcurrentHashMap<String, Map<String, Boolean>>();
|
|
|
|
|
|
- public static synchronized void ProcessConnected(String id, Object ContentJSON) {
|
|
|
+ public static Map<String, Map<String, Object>> id2objId2Tag = new ConcurrentHashMap<String, Map<String, Object>>();
|
|
|
+
|
|
|
+ public static synchronized void ProcessReceive(String id, Object ContentJSON) {
|
|
|
ProcessDisconnected(id);
|
|
|
-
|
|
|
+
|
|
|
idMap.put(id, ContentJSON);
|
|
|
Map<String, Boolean> objIdList = new ConcurrentHashMap<String, Boolean>();
|
|
|
id2objIdList.put(id, objIdList);
|
|
|
Map<String, Boolean> objInfoIdList = new ConcurrentHashMap<String, Boolean>();
|
|
|
id2objInfoIdList.put(id, objInfoIdList);
|
|
|
+ Map<String, Object> objId2Tag = new ConcurrentHashMap<String, Object>();
|
|
|
+ id2objId2Tag.put(id, objId2Tag);
|
|
|
JSONArray objArray = (JSONArray) ContentJSON;
|
|
|
for (int i = 0; i < objArray.size(); i++) {
|
|
|
JSONObject objJSON = objArray.getJSONObject(i);
|
|
|
String objId = (String) objJSON.get("objId");
|
|
|
+ if (objJSON.containsKey("websocket_tag")) {
|
|
|
+ objId2Tag.put(objId, objJSON.get("websocket_tag"));
|
|
|
+ }
|
|
|
if (objJSON.containsKey("infoCodeArray")) {
|
|
|
JSONArray infoCodeArray = (JSONArray) objJSON.get("infoCodeArray");
|
|
|
for (int ii = 0; ii < infoCodeArray.size(); ii++) {
|
|
@@ -91,6 +98,7 @@ public class WebSocketUtil {
|
|
|
}
|
|
|
id2objInfoIdList.remove(id);
|
|
|
|
|
|
+ id2objId2Tag.remove(id);
|
|
|
idMap.remove(id);
|
|
|
}
|
|
|
|
|
@@ -100,6 +108,7 @@ public class WebSocketUtil {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
RepositoryImpl Repository = RepositoryContainer.instance;
|
|
|
+ Map<String, Object> objId2Tag = id2objId2Tag.get(id);
|
|
|
|
|
|
JSONArray sendArray = new JSONArray();
|
|
|
Map<String, JSONObject> sendObj = new HashMap<String, JSONObject>();
|
|
@@ -148,6 +157,9 @@ public class WebSocketUtil {
|
|
|
for (String objId : sendObj.keySet()) {
|
|
|
JSONObject sendItem = sendObj.get(objId);
|
|
|
sendItem.put("id", objId);
|
|
|
+ if (objId2Tag.containsKey(objId)) {
|
|
|
+ sendItem.put("websocket_tag", objId2Tag.get(objId));
|
|
|
+ }
|
|
|
sendArray.add(sendItem);
|
|
|
}
|
|
|
if (sendArray.size() > 0) {
|
|
@@ -172,6 +184,7 @@ public class WebSocketUtil {
|
|
|
String message = json.getString("data");
|
|
|
String[] splits = message.split(";");
|
|
|
for (String id : idMap.keySet()) {
|
|
|
+ Map<String, Object> objId2Tag = id2objId2Tag.get(id);
|
|
|
try {
|
|
|
Map<String, Boolean> objIdList = id2objIdList.get(id);
|
|
|
Map<String, Boolean> objInfoIdList = id2objInfoIdList.get(id);
|
|
@@ -201,6 +214,9 @@ public class WebSocketUtil {
|
|
|
for (String objId : sendObj.keySet()) {
|
|
|
JSONObject sendItem = sendObj.get(objId);
|
|
|
sendItem.put("id", objId);
|
|
|
+ if (objId2Tag.containsKey(objId)) {
|
|
|
+ sendItem.put("websocket_tag", objId2Tag.get(objId));
|
|
|
+ }
|
|
|
sendArray.add(sendItem);
|
|
|
}
|
|
|
if (sendArray.size() > 0) {
|