| | |
| | | */ |
| | | public void analysis(InetAddress address, int port, String strMsg) { |
| | | |
| | | if (strMsg.startsWith("FE")) { |
| | | |
| | | //DO NOTHING |
| | | } else { |
| | | this.analysisGrainStep1(address, strMsg); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | points.add(-100.00); |
| | | continue; |
| | | } |
| | | temp = BytesUtil.hexToInt(BytesUtil.tran_LH(tag)) * 0.0625; |
| | | temp = BytesUtil.hexToInt(tag) * 0.0625; |
| | | temp = NumberUtil.keepPrecision(temp, 1); |
| | | points.add(temp); |
| | | } |
| | |
| | | outPut.setTemperature(temperature); |
| | | outPut.setAvgTemperature(NumberUtil.keepPrecision((sumT / sumNum), 1) + ""); |
| | | outPut.setMinTemperature(min + ""); |
| | | outPut.setMaxTemperature(min + ""); |
| | | outPut.setMaxTemperature(max + ""); |
| | | |
| | | |
| | | JSONObject properties = new JSONObject(); |
| | | properties.put("data", outPut); |
| | | properties.put("timestamp", grain.getTimestamp()); |
| | | |
| | | properties.put("timestamp", grain.getTimestamp()); |
| | | outPut.setDetectTime( grain.getTimestamp()); |
| | | if (StringUtils.isEmpty(height+"")) height = 0.0; |
| | | properties.put("liquidHeight", height); |
| | | |
| | | outPut.setLiquidHeight(height+""); |
| | | grain.setOutput(JSONObject.toJSONString(outPut)); |
| | | properties.put("output", outPut); |
| | | grain.setProperties(properties); |
| | | |
| | | //封装好的数据 |
| | |
| | | |
| | | 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); |
| | | } |
| | | } |