| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.apache.commons.collections.CollectionUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.moral.common.bean.PageBean; |
| | | import com.moral.common.util.MyBatisBaseMapUtil; |
| | |
| | | import com.moral.service.MonitorPointService; |
| | | import com.moral.service.SensorService; |
| | | |
| | | import org.apache.commons.collections.CollectionUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import tk.mybatis.mapper.entity.Example; |
| | | |
| | | @Service |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getSensorByDId(String id) { |
| | | List<Map<String, Object>> list = sensorMapper.getSensorByDId(id); |
| | | return list; |
| | | } |
| | | @Override |
| | | public List<Map<String, Object>> getSensorByMonitorPointId(String monitor_point_id) { |
| | | List<Map<String, Object>> list = sensorMapper.getSensorByMonitorPointId(monitor_point_id); |
| | | return list; |
| | |
| | | @Override |
| | | public List<Map<String, String>> getSensorsMaps(String mac) { |
| | | List<Sensor> sensors = sensorMapper.getSensorsInfoByMac(mac); |
| | | Map<String, String> sensorsDescriptionMap = new HashMap<>(); |
| | | for (Sensor sensor : sensors) { |
| | | sensorsDescriptionMap.put(sensor.getSensorKey(), sensor.getDescription()); |
| | | } |
| | | Map<String, String> sensorsUnitMap = new HashMap<>(); |
| | | for (Sensor sensor : sensors) { |
| | | sensorsUnitMap.put(sensor.getSensorKey(), sensor.getUnit()); |
| | | } |
| | | List<Map<String, String>> sensorsMapList = new ArrayList<>(); |
| | | sensorsMapList.add(sensorsDescriptionMap); |
| | | sensorsMapList.add(sensorsUnitMap); |
| | | return sensorsMapList; |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, String>> getSensorsAllMap() { |
| | | List<Sensor> sensors = sensorMapper.selectAll(); |
| | | Map<String, String> sensorsDescriptionMap = new HashMap<>(); |
| | | for (Sensor sensor : sensors) { |
| | | sensorsDescriptionMap.put(sensor.getSensorKey(), sensor.getDescription()); |
| | |
| | | Map<String, Object> data = new LinkedHashMap<>(); |
| | | for (Map.Entry<String, Object> kv : list.get(j).entrySet()) { |
| | | if ("monitorPointName".equals(kv.getKey())) { |
| | | data.put("站点名称(单位:" + sensorInfos.get(2).get(i) + ")", kv.getValue()); |
| | | if ("null".equals(sensorInfos.get(2).get(i))) { |
| | | data.put("站点名称(单位:)", kv.getValue()); |
| | | } else { |
| | | data.put("站点名称(单位:" + sensorInfos.get(2).get(i) + ")", kv.getValue()); |
| | | } |
| | | } else if ("name".equals(kv.getKey())) { |
| | | data.put("设备名称", kv.getValue()); |
| | | } else { |
| | |
| | | return sheets; |
| | | } |
| | | |
| | | @Override |
| | | public List<String> getSensorKeys() { |
| | | return sensorMapper.getSensorKeys(); |
| | | } |
| | | |
| | | } |