From 092d4d994a95a9df6775c90401887dfba684e8ee Mon Sep 17 00:00:00 2001
From: vince <757871790@qq.com>
Date: 星期一, 18 十二月 2023 21:13:04 +0800
Subject: [PATCH] 增加授权
---
src/main/java/com/fzzy/protocol/zldz/analysis/AnalysisConf.java | 46 +++++++++++++++++++++++-----------------------
1 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/src/main/java/com/fzzy/protocol/zldz/analysis/AnalysisConf.java b/src/main/java/com/fzzy/protocol/zldz/analysis/AnalysisConf.java
index ed5d024..18c2fc8 100644
--- a/src/main/java/com/fzzy/protocol/zldz/analysis/AnalysisConf.java
+++ b/src/main/java/com/fzzy/protocol/zldz/analysis/AnalysisConf.java
@@ -1,5 +1,7 @@
package com.fzzy.protocol.zldz.analysis;
+import com.fzzy.api.Constant;
+import com.fzzy.api.data.ApiCommonDevice;
import com.fzzy.api.utils.BytesUtil;
import com.fzzy.gateway.entity.GatewayDevice;
import com.fzzy.gateway.service.GatewayDeviceService;
@@ -25,11 +27,11 @@
* 瑙f瀽鍒嗘満閰嶇疆淇℃伅
*
* @param message
- * @param ser
+ * @param device
*/
- public void analysis8816(ReMessage message, GatewayDevice ser) {
+ public void analysis8816(ReMessage message, GatewayDevice device, ApiCommonDevice commonDevice) {
- log.debug("鍒嗘満---->>>骞冲彴锛氭秷鎭被鍨�=8816-----{}", ser.getDeviceName());
+ log.debug("鍒嗘満---->>>骞冲彴锛氭秷鎭被鍨�=8816-----{}", device.getDeviceName());
String content = message.getBody().getContent();
@@ -58,8 +60,9 @@
len = 1;
temp = content.substring(start * 2, start * 2 + len * 2);
- // 灞傛暟
+ //灞� -琛� -鍒�
String cable = "";
+ // 灞傛暟
start = 6;
len = 1;
temp = content.substring(start * 2, start * 2 + len * 2);
@@ -77,20 +80,18 @@
temp = content.substring(start * 2, start * 2 + len * 2);
cable += "-" + BytesUtil.hexToInt(temp);
- //灞� - 琛� - 鍒� 閰嶇疆
- ser.setCableRule(cable);
// 鐢电紗鍒跺紡
start = 9;
len = 1;
temp = content.substring(start * 2, start * 2 + len * 2);
- ser.setCableFormat("0" + BytesUtil.hexToInt(temp));
+ device.setCableFormat("0" + BytesUtil.hexToInt(temp));
// 鐢电紗绫诲瀷
start = 10;
len = 1;
temp = content.substring(start * 2, start * 2 + len * 2);
- ser.setCableType("0" + BytesUtil.hexToInt(temp));
+ device.setCableType("0" + BytesUtil.hexToInt(temp));
// 渚涚數妯″紡
start = 11;
@@ -98,34 +99,33 @@
temp = content.substring(start * 2, start * 2 + len * 2);
//ser.setPowerModel("0" + BytesUtil.hexToInt(temp));
- String msg = ser.getDeviceName() + " 杩滅▼鑾峰彇閰嶇疆鎴愬姛锛岃鍒锋柊鏁版嵁鏌ョ湅锛�";
// 缁勭粐缂栫爜
start = 12;
temp = content.substring(start * 2);
- if (readTag == 1) {// 琛ㄧず鍐欑殑鎴愬姛杩斿洖
- ser.setOrgId(ser.getOrgId());
- msg = ser.getDeviceName() + " 杩滅▼鍐欏叆鎴愬姛锛岃鍒锋柊鏁版嵁鏌ョ湅锛�";
- } else {
- ser.setOrgId(BytesUtil.hexToInt(BytesUtil.tran_LH(temp)) + "");
+ if (readTag != 1) {// 琛ㄧず鍐欑殑鎴愬姛杩斿洖
+ device.setOrgId(BytesUtil.hexToInt(BytesUtil.tran_LH(temp)) + "");
}
- if (null == ser.getDeviceSn()) {
- ser.setDeviceSn(ser.getId());
- }
- ser.setIp(message.getIp());
- ser.setPort(message.getPort());
+ device.setIp(message.getIp());
+ device.setPort(message.getPort());
// 寮�濮嬪垪榛樿=1
- if (ser.getCableStart() == 0) {
- ser.setCableStart(1);
+ if (null == device.getCableStart()) {
+ device.setCableStart("1");
}
log.info("鍒嗘満---->>>骞冲彴锛氬垎鏈洪厤缃В鏋愬畬鎴�---{}锛屾洿鏂板埌鏈嶆湇鍔″櫒",
- ser.getDeviceName());
+ device.getDeviceName());
//鏇存柊璁惧淇℃伅
- gatewayDeviceService.updateData(ser);
+ gatewayDeviceService.updateData(device);
+
+ //鏇存柊杩炴帴璁惧淇℃伅
+ commonDevice.setSn(device.getDeviceSn());
+ commonDevice.setCable(cable);
+ commonDevice.setOrgId(device.getOrgId());
+ Constant.updateCache(commonDevice);
}
/**
--
Gitblit v1.9.3