From 6495040bbda5308c86e852ad1b080097bfa916a9 Mon Sep 17 00:00:00 2001 From: vince <757871790@qq.com> Date: 星期三, 09 七月 2025 09:22:17 +0800 Subject: [PATCH] 优化粮温检测 --- src/main/java/com/fzzy/protocol/weightyh/MessageConsumer.java | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/fzzy/protocol/weightyh/MessageConsumer.java b/src/main/java/com/fzzy/protocol/weightyh/MessageConsumer.java index 3e4fd02..4d88ea0 100644 --- a/src/main/java/com/fzzy/protocol/weightyh/MessageConsumer.java +++ b/src/main/java/com/fzzy/protocol/weightyh/MessageConsumer.java @@ -1,5 +1,6 @@ package com.fzzy.protocol.weightyh; +import com.fzzy.api.data.GatewayDeviceType; import com.fzzy.api.utils.BytesUtil; import com.fzzy.api.utils.SpringUtil; import com.fzzy.gateway.GatewayUtils; @@ -35,7 +36,7 @@ */ public void analysisInfo(String ip, Integer port, byte[] bytes) { String strMsg = BytesUtil.bytesToString(bytes); - //log.debug("寮�濮嬭В鏋愬湴纾呰繑鍥炰俊鎭�=" + strMsg); + if (strMsg.length() < 22) { return; } @@ -56,12 +57,11 @@ //鏈�缁堥噸閲忕粨鏋� double weigh = Double.valueOf(w) / d; - + log.debug("WEIGHT-MESSAGE=" + strMsg); log.debug("----------鍦扮绉伴噸鏁板�艰В鏋�------{}", weigh); //褰撳墠鍦扮鍗忚涓嶆敮鎸佷紶閫扴N锛屼娇鐢ㄥ眬鍩熺綉IP浣滀负SN String sn = ip; - //鏍规嵁淇℃伅鑾峰彇璁惧 GatewayDevice device = GatewayUtils.getCacheByDeviceSn(sn); @@ -83,7 +83,10 @@ reqData.setProductId(device.getProductId()); reqData.setDeviceName(device.getDeviceName()); reqData.setWeight(weigh); - gatewayRemoteManager.getDeviceReportService(device.getPushProtocol()).reportWeightData(reqData); + + if (weigh > 0) { + gatewayRemoteManager.getDeviceReportService(device.getPushProtocol()).reportWeightData(reqData); + } } /** -- Gitblit v1.9.3