|  |  | 
 |  |  |             String sensorCode = sensor.getCode(); | 
 |  |  |             //转换公式 | 
 |  |  |             String formula = sensor.getFormula(); | 
 |  |  |             //转换单位前因子值 | 
 |  |  |             String sensorValue = (String) deviceData.get(sensorCode); | 
 |  |  |             double value = Double.parseDouble(sensorValue); | 
 |  |  |             //单位转换 | 
 |  |  |             if (formula != null) { | 
 |  |  |                 //转换后因子值 | 
 |  |  |                 sensorValue = formula.replace("{0}", sensorValue); | 
 |  |  |                 expression = AviatorEvaluator.compile(sensorValue); | 
 |  |  |                 value = Double.parseDouble(expression.execute().toString()); | 
 |  |  |             } | 
 |  |  |             int sensorState = judgeState(list, value); | 
 |  |  |             if (sensorState > state) { | 
 |  |  |                 state = sensorState; | 
 |  |  |  | 
 |  |  |             //设备所传因子与配置型号因子不一致的处理逻辑 | 
 |  |  |             if (deviceData.get(sensorCode) != null) { | 
 |  |  |                 String sensorValue = (String) deviceData.get(sensorCode); | 
 |  |  |                 double value = Double.parseDouble(sensorValue); | 
 |  |  |                 if (formula != null) { | 
 |  |  |                     //转换后因子值 | 
 |  |  |                     sensorValue = formula.replace("{0}", sensorValue); | 
 |  |  |                     expression = AviatorEvaluator.compile(sensorValue); | 
 |  |  |                     value = Double.parseDouble(expression.execute().toString()); | 
 |  |  |                 } | 
 |  |  |                 int sensorState = judgeState(list, value); | 
 |  |  |                 if (sensorState > state) { | 
 |  |  |                     state = sensorState; | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         //修改设备状态 | 
 |  |  | 
 |  |  |     @Override | 
 |  |  |     public List<Map<String, Object>> selectMonitorPiontAndDeviceByOrgId(int orgId) { | 
 |  |  |         QueryWrapper<MonitorPoint> monitorPointQueryWrapper = new QueryWrapper<>(); | 
 |  |  |         monitorPointQueryWrapper.eq("is_delete",Constants.NOT_DELETE); | 
 |  |  |         monitorPointQueryWrapper.eq("organization_id",orgId); | 
 |  |  |         monitorPointQueryWrapper.eq("is_delete", Constants.NOT_DELETE); | 
 |  |  |         monitorPointQueryWrapper.eq("organization_id", orgId); | 
 |  |  |         List<MonitorPoint> monitorPointList = monitorPointMapper.selectList(monitorPointQueryWrapper); | 
 |  |  |         List<Map<String, Object>> resultList = new ArrayList<>(); | 
 |  |  |         for (MonitorPoint monitorPoint:monitorPointList) { | 
 |  |  |             Map<String,Object> resultMap = new HashMap<>(); | 
 |  |  |         for (MonitorPoint monitorPoint : monitorPointList) { | 
 |  |  |             Map<String, Object> resultMap = new HashMap<>(); | 
 |  |  |             resultMap = JSON.parseObject(JSON.toJSONString(monitorPoint), Map.class); | 
 |  |  |             int mp_id = monitorPoint.getId(); | 
 |  |  |             QueryWrapper<Device> deviceQueryWrapper = new QueryWrapper<>(); | 
 |  |  |             deviceQueryWrapper.eq("is_delete", Constants.NOT_DELETE); | 
 |  |  |             deviceQueryWrapper.eq("monitor_point_id",mp_id); | 
 |  |  |             deviceQueryWrapper.eq("monitor_point_id", mp_id); | 
 |  |  |             List<Device> devices = new ArrayList<>(); | 
 |  |  |             devices = deviceMapper.selectList(deviceQueryWrapper); | 
 |  |  |             resultMap.put("devices",devices); | 
 |  |  |             resultMap.put("devices", devices); | 
 |  |  |             resultList.add(resultMap); | 
 |  |  |         } | 
 |  |  |         return resultList; | 
 |  |  | 
 |  |  |         for (int i = levels.size() - 1; i >= 0; i--) { | 
 |  |  |             Double level = Double.parseDouble(levels.get(i).toString()); | 
 |  |  |             if (data >= level) { | 
 |  |  |                 state = i + 1; | 
 |  |  |                 state = i + 2; | 
 |  |  |                 break; | 
 |  |  |             } | 
 |  |  |         } |