| | |
| | | @Override |
| | | public Map<Integer,List<SensorUnit>> queryGroupSensorBySids(List<Integer> sensorIds){ |
| | | SensorUnit sensorUnitQuery = new SensorUnit(); |
| | | Map<Integer,List<SensorUnit>> resultList = new HashMap<>(); |
| | | Map<Integer,List<SensorUnit>> resultListMap = new HashMap<>(); |
| | | for(Integer sensorId: sensorIds) { |
| | | sensorUnitQuery.setSensorId(sensorId); |
| | | sensorUnitQuery.setIsDelete(false); |
| | | List<SensorUnit> sensorUnitList = sensorUnitMapper.select(sensorUnitQuery); |
| | | if(sensorUnitList!=null&&sensorUnitList.size()>0){ |
| | | resultList.put(sensorId,sensorUnitList); |
| | | resultListMap.put(sensorId,sensorUnitList); |
| | | } |
| | | } |
| | | return resultList; |
| | | return resultListMap; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getSensorByMac(String mac) { |
| | | System.out.println("SensorUnitServiceImpl-----getSensorByMac-----mac:"+mac); |
| | | List<Map<String, Object>> list = sensorUnitMapper.getSensorsByDeviceMac(mac); |
| | | System.out.println("SensorUnitServiceImpl----getSensorByMac----list:"+list); |
| | | if (list!=null && !list.isEmpty()) { |
| | | Map<String, Object> sensorUnitMap = new HashMap<>(); |
| | | for(Map<String, Object> sensorMap : list) { |
| | | String sensor_key = (String) sensorMap.get("sensor_key"); |
| | | System.out.println("SensorUnitServiceImpl----getSensorByMac----sensor_key:"+sensor_key); |
| | | String name = (String) sensorMap.get("name"); |
| | | System.out.println("SensorUnitServiceImpl----getSensorByMac----name:"+name); |
| | | sensorUnitMap.put(sensor_key, name); |
| | | } |
| | | System.out.println(sensorUnitMap); |
| | | return sensorUnitMap; |
| | | } else { |
| | | Map<String, Object> sensorUnitMap = null; |
| | | return sensorUnitMap; |
| | | } |
| | | } |
| | | |
| | | /*@Override |
| | | public Map<String, Object> getSensorsByMonitPointId(String id) { |
| | | System.out.println("SensorUnitServiceImpl-----getSensorsByMonitPointId-----id:"+id); |
| | | List<Map<String, Object>> list = sensorUnitMapper.getSensorsByMonitPointId(id); |
| | | System.out.println("SensorUnitServiceImpl----getSensorsByMonitPointId----list:"+list); |
| | | if (list!=null && !list.isEmpty()) { |
| | | Map<String, Object> sensorUnitMap = new HashMap<>(); |
| | | for(Map<String, Object> sensorMap : list) { |
| | | String sensor_key = (String) sensorMap.get("sensor_key"); |
| | | System.out.println("SensorUnitServiceImpl----getSensorsByMonitPointId----sensor_key:"+sensor_key); |
| | | String name = (String) sensorMap.get("name"); |
| | | System.out.println("SensorUnitServiceImpl----getSensorsByMonitPointId----name:"+name); |
| | | sensorUnitMap.put(sensor_key, name); |
| | | } |
| | | System.out.println(sensorUnitMap); |
| | | return sensorUnitMap; |
| | | } else { |
| | | Map<String, Object> sensorUnitMap = null; |
| | | return sensorUnitMap; |
| | | } |
| | | }*/ |
| | | |
| | | @Override |
| | | public Map<String, Map<String, Object>> getSensorsByMonitPointId(String id) { |
| | | System.out.println("SensorUnitServiceImpl-----getSensorsByMonitPointId-----id:"+id); |
| | | List<Map<String, Object>> list = sensorUnitMapper.getSensorsByMonitPointId(id); |
| | | System.out.println("SensorUnitServiceImpl----getSensorsByMonitPointId----list:"+list); |
| | | if (list!=null && !list.isEmpty()) { |
| | | Map<String, Object> innerMap = new HashMap<>(); |
| | | Map<String, Map<String, Object>> sensorUnitMap = new HashMap<>(); |
| | | for(Map<String, Object> sensorMap : list) { |
| | | innerMap.put("unit", sensorMap.get("unit")); |
| | | innerMap.put("name", sensorMap.get("name")); |
| | | innerMap.put("rules", sensorMap.get("rules")); |
| | | String sensor_key = (String) sensorMap.get("sensor_key"); |
| | | System.out.println("SensorUnitServiceImpl----getSensorsByMonitPointId----sensor_key:"+sensor_key); |
| | | String name = (String) sensorMap.get("name"); |
| | | System.out.println("SensorUnitServiceImpl----getSensorsByMonitPointId----name:"+name); |
| | | sensorUnitMap.put(sensor_key, innerMap); |
| | | } |
| | | System.out.println(sensorUnitMap); |
| | | return sensorUnitMap; |
| | | } else { |
| | | Map<String, Map<String, Object>> sensorUnitMap = null; |
| | | return sensorUnitMap; |
| | | } |
| | | } |
| | | } |