From b7edb0f3526d5ca32016d5f332ddf957d74c01c2 Mon Sep 17 00:00:00 2001 From: jiazx0107@163.com <jiazx0107@163.com> Date: 星期日, 24 十二月 2023 01:24:53 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/igds-api-gateway' into igds-api-gateway --- src/main/java/com/fzzy/protocol/bhzn/analysis/AnalysisService.java | 20 ++++++++++++-------- 1 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/fzzy/protocol/bhzn/analysis/AnalysisService.java b/src/main/java/com/fzzy/protocol/bhzn/analysis/AnalysisService.java index fb8b9ba..9f804ac 100644 --- a/src/main/java/com/fzzy/protocol/bhzn/analysis/AnalysisService.java +++ b/src/main/java/com/fzzy/protocol/bhzn/analysis/AnalysisService.java @@ -98,21 +98,22 @@ private void analysisGrain(IoMessage message) { try { + //鏍规嵁鍒嗘満SN鑾峰彇璁惧閰嶇疆淇℃伅 + GatewayDevice gatewayDevice = GatewayUtils.getCacheByDeviceSn(message.getAddr()); + if (null == gatewayDevice) { + replayGrain(message); + log.error("涓绘満-------->>骞冲彴锛岃В鏋愮伯鎯呭け璐ワ紝鏈幏鍙栧埌绯荤粺璁惧閰嶇疆淇℃伅锛�" + message.getAddr()); + return; + } //鏍规嵁鍒嗘満鍦板潃鑾峰彇鍒嗘満淇℃伅 - ApiCommonDevice commonDevice = Constant.getCommonDeviceCache(message.getAddr()); + ApiCommonDevice commonDevice = Constant.getCommonDeviceCache(message.getIp()); if (commonDevice == null) { replayGrain(message); log.error("涓绘満-------->>骞冲彴锛岃В鏋愮伯鎯呭け璐ワ紝鏈幏鍙栧埌绯荤粺绮儏涓绘満閰嶇疆锛�" + message.getAddr()); return; } - //鏍规嵁鍒嗘満SN鑾峰彇璁惧閰嶇疆淇℃伅 - GatewayDevice gatewayDevice = GatewayUtils.getCacheByDeviceSn(commonDevice.getSn()); - if (null == gatewayDevice) { - replayGrain(message); - log.error("涓绘満-------->>骞冲彴锛岃В鏋愮伯鎯呭け璐ワ紝鏈幏鍙栧埌绯荤粺璁惧閰嶇疆淇℃伅锛�" + message.getAddr()); - return; - } + //鑾峰彇璇锋眰淇℃伅 BaseReqData reqData = ProtocolUtils.getSyncReq(gatewayDevice.getDepotIdSys()); @@ -323,7 +324,10 @@ outPut.setAvgTemperature(NumberUtil.keepPrecision((sumT / sumNum), 1) + ""); outPut.setMinTemperature(min + ""); outPut.setMaxTemperature(min + ""); + List<GrainTH> ths = new ArrayList<>(); + ths.add(new GrainTH(thDto.getTempIn()!=null?thDto.getTempIn()+"":"",thDto.getHumidityIn()!=null?thDto.getHumidityIn()+"":"","1")); + outPut.setTemperatureAndhumidity(ths); grain.setOutput(JSONObject.toJSONString(outPut)); GatewayDevice gatewayDeviceWeather = GatewayUtils.getCacheByDeviceTypeOne(GatewayDeviceType.TYPE_09.getCode()); -- Gitblit v1.9.3