| | |
| | | int cableY = cableData.getCableY(); |
| | | int cableX = cableData.getCableX(); |
| | | |
| | | int sumNum = temps.size(); |
| | | int sumNum = 0; |
| | | |
| | | //数据封装 |
| | | GrainData grain = new GrainData(); |
| | |
| | | temperature.add(new GrainTemp(cableNum + "", z + "", curTemp + "", position + "")); |
| | | |
| | | //求最大最小值 |
| | | if (curTemp < -900) { |
| | | sumNum--; |
| | | } else { |
| | | // if (curTemp < -900) { |
| | | // sumNum--; |
| | | // } else { |
| | | // sumT += curTemp; |
| | | // if (curTemp > max) { |
| | | // max = curTemp; |
| | | // } |
| | | // if (curTemp < min) { |
| | | // min = curTemp; |
| | | // } |
| | | // } |
| | | if (curTemp > max && curTemp < 40) { |
| | | max = curTemp; |
| | | } |
| | | if (curTemp < min && curTemp > 3) { |
| | | min = curTemp; |
| | | } |
| | | if(curTemp > 3 && curTemp < 40){ |
| | | sumT += curTemp; |
| | | if (curTemp > max) { |
| | | max = curTemp; |
| | | } |
| | | if (curTemp < min) { |
| | | min = curTemp; |
| | | } |
| | | sumNum++; |
| | | } |
| | | } |
| | | |
| | |
| | | outPut.setTemperature(temperature); |
| | | outPut.setAvgTemperature(NumberUtil.keepPrecision((sumT / sumNum), 1) + ""); |
| | | outPut.setMinTemperature(min + ""); |
| | | outPut.setMaxTemperature(min + ""); |
| | | outPut.setMaxTemperature(max + ""); |
| | | |
| | | |
| | | JSONObject properties = new JSONObject(); |
| | |
| | | GrainOutPut outPut = new GrainOutPut(); |
| | | |
| | | |
| | | double max = ReMessageBuilder.MAX_TEMP, min = ReMessageBuilder.MIN_TEMP, sumT = 0.0, sumNum = cableData.getSumNum(); |
| | | double max = ReMessageBuilder.MAX_TEMP, min = ReMessageBuilder.MIN_TEMP, sumT = 0.0, sumNum = 0; |
| | | |
| | | List<GrainTemp> temperature = new ArrayList<>(); |
| | | //根号 |
| | |
| | | temperature.add(new GrainTemp(cableNum + "", z + "", curTemp + "", position + "")); |
| | | |
| | | //求最大最小值 |
| | | if (curTemp < -900) { |
| | | sumNum--; |
| | | } else { |
| | | // if (curTemp < -900) { |
| | | // sumNum--; |
| | | // } else { |
| | | // sumT += curTemp; |
| | | // if (curTemp > max) { |
| | | // max = curTemp; |
| | | // } |
| | | // if (curTemp < min) { |
| | | // min = curTemp; |
| | | // } |
| | | // } |
| | | if (curTemp > max && curTemp < 40) { |
| | | max = curTemp; |
| | | } |
| | | if (curTemp < min && curTemp > 3) { |
| | | min = curTemp; |
| | | } |
| | | if(curTemp > 3 && curTemp < 40){ |
| | | sumT += curTemp; |
| | | if (curTemp > max) { |
| | | max = curTemp; |
| | | } |
| | | if (curTemp < min) { |
| | | min = curTemp; |
| | | } |
| | | sumNum++; |
| | | } |
| | | } |
| | | |
| | |
| | | weatherStation.setMessageId(ScConstant.getMessageId()); |
| | | weatherStation.setMessgeId(weatherStation.getMessageId()); |
| | | |
| | | if (null != gatewayDeviceWeather) { |
| | | if (null != gatewayDeviceWeather) { |
| | | weatherStation.setId(gatewayDeviceWeather.getDeviceId()); |
| | | } else { |
| | | 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()); |