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/fzzy/analysis/AnalysisGrain.java | 23 ++++++++++++++++------- 1 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/fzzy/protocol/fzzy/analysis/AnalysisGrain.java b/src/main/java/com/fzzy/protocol/fzzy/analysis/AnalysisGrain.java index 945f152..dd5a3b2 100644 --- a/src/main/java/com/fzzy/protocol/fzzy/analysis/AnalysisGrain.java +++ b/src/main/java/com/fzzy/protocol/fzzy/analysis/AnalysisGrain.java @@ -13,6 +13,7 @@ import com.fzzy.gateway.entity.GatewayDevice; import com.fzzy.gateway.hx2023.ScConstant; import com.fzzy.gateway.hx2023.data.*; +import com.fzzy.protocol.ProtocolUtils; import com.fzzy.protocol.fzzy.builder.SimpleCommandBuilder; import com.fzzy.protocol.fzzy.cmd.BaseRemoteImpl; import com.fzzy.protocol.fzzy.data.ReMessage; @@ -93,13 +94,14 @@ private void buildBizInfo1(Response2102 response) { //鑾峰彇璇锋眰淇℃伅 - BaseReqData reqData = ServerUtils.getSyncReq(response.getHouseId()); - + BaseReqData reqData = ProtocolUtils.getSyncReq(response.getHouseId()); + log.info("--绮儏灏佽瑙f瀽锛岃幏鍙栧埌璇锋眰鍛戒护鍙傛暟----"); if (null == reqData) { log.error("--绮儏灏佽瑙f瀽锛屾湭鑾峰彇鍒拌姹傜浉鍏冲弬鏁�----"); return; } - + ProtocolUtils.delSyncReq(response.getHouseId()); + log.info(reqData.toString()); int cableZ = Integer.valueOf(response.getLay()); int cableY = Integer.valueOf(response.getRow()); @@ -142,7 +144,7 @@ } //鏁版嵁浼樺寲 - if (curTemp > 35) { + if (curTemp > 40) { curTemp = response.getTAvg(); } @@ -158,7 +160,11 @@ } outPut.setTemperature(temperature); + List<GrainTH> ths = new ArrayList<>(); + ths.add(new GrainTH(response.getTIn()!=null?response.getTIn()+"":"",response.getHIn()!=null?response.getHIn()+"":"","1")); + outPut.setTemperatureAndhumidity(ths); + //grain.setOutput(JSONObject.toJSONString(outPut)); grain.setOutput(com.alibaba.fastjson2.JSONObject.toJSONString(outPut)); @@ -179,7 +185,7 @@ weatherStation.setId(device.getDeviceId()); } weatherStation.setAirPressure(weather.getPressure()); - weatherStation.setHumidity(weather.getHumidity()); + weatherStation.setHumidity(weather.getHumidity().replaceAll("%","")); weatherStation.setPm(weather.getAir_pm25()); weatherStation.setRadiation("0"); weatherStation.setRainfallAmount(weather.getWea()); @@ -194,16 +200,19 @@ log.info("---绮儏鏈烘灏佽瀹屾垚----寮�濮嬫墽琛屾帹閫�"); reqData.setData(JSONObject.toJSONString(grain)); - doPushGrain(reqData); + doPushGrain(reqData,grain); } - private void doPushGrain(BaseReqData reqData) { + private void doPushGrain(BaseReqData reqData,GrainData grainData) { GatewayDeviceReportService reportService = gatewayRemoteManager.getDeviceReportService(reqData.getDevice().getPushProtocol()); if (null == reportService) { log.error("------------绮儏鎺ㄩ�佸け璐ワ紝绯荤粺涓嶅瓨鍦ㄥ綋鍓嶅崗璁墽琛岀被----{}", reqData.getDevice().getDeviceName()); + return; } reportService.reportGrainData(reqData); + reqData.setData(reportService.grainData2GatewayApiInfoKafka(grainData,reqData.getDevice()).getData()); + reportService.reportGrainDataByKafka(reqData); } private void returnMsg(ApiCommonDevice ser) { -- Gitblit v1.9.3