|
@@ -10,10 +10,12 @@ import com.fjhx.enums.AgreementEnum;
|
|
|
import com.fjhx.enums.MessageTypeEnum;
|
|
|
import com.fjhx.service.Operation;
|
|
|
import com.fjhx.service.Service;
|
|
|
+import com.fjhx.utils.MyUtil;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.Objects;
|
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -30,21 +32,27 @@ public class ServiceImpl implements Service {
|
|
|
|
|
|
// 数据
|
|
|
JSONObject data = messageEntity.getData();
|
|
|
- String forwardUserId = ObjectUtil.defaultIfNull(data.getString(WebSocketConstant.FORWARD_USER_ID), "default");
|
|
|
- String forwardSessionId = ObjectUtil.defaultIfNull(data.getString(WebSocketConstant.FORWARD_SESSION_ID), "default");
|
|
|
+ String forwardUserId = data.getString(WebSocketConstant.FORWARD_USER_ID);
|
|
|
+ String forwardSessionId = data.getString(WebSocketConstant.FORWARD_SESSION_ID);
|
|
|
+
|
|
|
+ // 获取指令
|
|
|
+ String instructions = data.getString("instructions");
|
|
|
+
|
|
|
+ if (!ObjectUtil.isAllNotEmpty(forwardUserId, forwardSessionId, instructions)
|
|
|
+ && !Objects.equals(instructions, "check1") && !Objects.equals(instructions, "check4")) {
|
|
|
+ MyUtil.errorLog("未知数据:" + data.toJSONString());
|
|
|
+ }
|
|
|
|
|
|
// 操作上位机类型
|
|
|
Integer type = data.getInteger("type");
|
|
|
|
|
|
switch (MessageTypeEnum.get(type)) {
|
|
|
- // case READ:
|
|
|
- // read(sessionId, connectConfigList);
|
|
|
- // break;
|
|
|
case DISTINCT_READ:
|
|
|
- // 获取指令
|
|
|
- String instructions = data.getString("instructions");
|
|
|
// ip配置集合
|
|
|
List<ConnectConfig> connectConfigList = MyMain.config.getInstructionsMap().get(instructions);
|
|
|
+ if (connectConfigList == null || connectConfigList.size() == 0) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
distinctRead(forwardUserId, forwardSessionId, ObjectUtil.clone(connectConfigList), data);
|
|
|
break;
|
|
|
case CLOSE:
|