Ver Fonte

增加康凯斯协议报文转发

syg há 4 anos atrás
pai
commit
81a3e7f9ed

+ 9 - 0
data-acceptance-client/src/main/java/com/tidecloud/dataacceptance/vo/LockClient2.java

@@ -0,0 +1,9 @@
+package com.tidecloud.dataacceptance.vo;
+
+/**
+ * @Author: syg
+ * @Date: 2020/7/17 15:47
+ * @Desc:
+ */
+public interface LockClient2 {
+}

+ 18 - 0
src/main/java/com/tidecloud/dataacceptance/service/HexBinaryAcceptanceHandlerAdapter.java

@@ -99,4 +99,22 @@ public abstract class HexBinaryAcceptanceHandlerAdapter extends AcceptanceInboun
                 });
     }
 
+    protected void sendOriginalMsg(byte[] dataByteArray, String deviceId, boolean isInitial,Integer protocolCode) {
+        MsgWrapper msgWrapper = new MsgWrapper(deviceId, DatatypeConverter.printHexBinary(dataByteArray), isInitial);
+        msgWrapper.setProtocolCode(protocolCode);
+        final Integer key = deviceId.hashCode();
+        kafkaTemplate.send(originalTopic, key, StringUtil.convert2String(msgWrapper))
+                .addCallback(new ListenableFutureCallback<SendResult<Integer, String>>() {
+                    @Override
+                    public void onFailure(Throwable ex) {
+                        logger.error(ex.getMessage(), ex);
+                    }
+
+                    @Override
+                    public void onSuccess(SendResult<Integer, String> result) {
+                        logger.info("send original msg success");
+                    }
+                });
+    }
+
 }

+ 6 - 0
src/main/java/com/tidecloud/dataacceptance/service/impl/YiTongGpsServerHandler.java

@@ -132,6 +132,12 @@ public class YiTongGpsServerHandler extends HexBinaryAcceptanceHandlerAdapter {
 			} else {
 				logger.info("client send data without handle type ...");
 			}
+
+			//增加KKS 协议报文转发
+			//KKS protocolCode = 3
+			Boolean isInitial = (LOGIN_MSG == msgType);
+			sendOriginalMsg(getOriginalData(in, deviceId), deviceId,isInitial,3);
+
 		}
 
 	}