| | |
| | | Object vocsValue = ObjectUtils.isEmpty(deviceData.get(Constants.SENSOR_CODE_VOCS)) ? 0F : deviceData.get(Constants.SENSOR_CODE_VOCS); |
| | | env.put("vocs", vocsValue); |
| | | } |
| | | if (formula.contains("cel")) { |
| | | if (formula.contains("ce1")) { |
| | | //env.put("cel", Float.parseFloat((String) measuredValue)); |
| | | env.put("ce1", new BigDecimal(String.valueOf(measuredValue)).floatValue()); |
| | | }else if(formula.contains("cel")){ |
| | | env.put("cel", new BigDecimal(String.valueOf(measuredValue)).floatValue()); |
| | | } |
| | | |
| | | //校准 |
| | | measuredValue = expression.execute(env); |
| | | //温度处理 |
| | |
| | | } |
| | | if (code.equals("2")){ |
| | | HashMap<String, Object> result = new HashMap<>(); |
| | | String yearAndMonth = DateUtils.dateToDateString(DateUtils.addHours(time, -2), DateUtils.yyyyMM_EN); |
| | | String time1 = deviceData.get("time").toString(); |
| | | long l = Long.parseLong(time1); |
| | | |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:00:00"); |
| | | String format = simpleDateFormat.format(DateUtils.addHours(time, -2)); |
| | | String format1 = simpleDateFormat.format(l); |
| | | Date date = DateUtils.getDate(format1, DateUtils.yyyy_MM_dd_HH_mm_ss_EN); |
| | | |
| | | String yearAndMonth = DateUtils.dateToDateString(DateUtils.addHours(date, -2), DateUtils.yyyyMM_EN); |
| | | String format = simpleDateFormat.format(DateUtils.addHours(date, -2)); |
| | | result.put("timeUnits",yearAndMonth); |
| | | result.put("mac",mac); |
| | | result.put("time",format); |