device type
This commit is contained in:
parent
82f4eba535
commit
5f414ea91b
|
|
@ -262,14 +262,16 @@ public class KitchenDeviceInfoServiceImpl extends ServiceImpl<KitchenDeviceInfoM
|
|||
|
||||
@Override
|
||||
public Map<Integer, String> deviceType() {
|
||||
Map<Integer, String> deviceMap = DeviceTypeEnum.toMap();
|
||||
String [] stringArray = new String[]{"摄像头","门禁","留样秤","留样柜","温湿度传感器","烟雾检测传感器","水表","电表","智能出入库秤"};
|
||||
// 将 stringArray 转为 Set 便于快速查找
|
||||
Set<String> validValues = new HashSet<>(Arrays.asList(stringArray));
|
||||
// 使用 Stream 过滤,只保留 value 存在于 validValues 中的条目
|
||||
Map<Integer, String> filteredMap = deviceMap.entrySet().stream()
|
||||
.filter(entry -> validValues.contains(entry.getValue()))
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||
return filteredMap;
|
||||
Map<Integer, String> deviceMap = new HashMap<>();
|
||||
deviceMap.put(DeviceTypeEnum.CAMERA.getKey(), DeviceTypeEnum.CAMERA.getValue());
|
||||
deviceMap.put(DeviceTypeEnum.DOOR.getKey(), DeviceTypeEnum.DOOR.getValue());
|
||||
deviceMap.put(DeviceTypeEnum.SAMPLE_WEIGHT.getKey(), DeviceTypeEnum.SAMPLE_WEIGHT.getValue());
|
||||
deviceMap.put(DeviceTypeEnum.SAMPLECABINET.getKey(), DeviceTypeEnum.SAMPLECABINET.getValue());
|
||||
deviceMap.put(DeviceTypeEnum.TEMPERATURE_HUMIDITY_SENSOR.getKey(), DeviceTypeEnum.TEMPERATURE_HUMIDITY_SENSOR.getValue());
|
||||
deviceMap.put(DeviceTypeEnum.SMOKE_SENSOR.getKey(), DeviceTypeEnum.SMOKE_SENSOR.getValue());
|
||||
deviceMap.put(DeviceTypeEnum.WATER_METER.getKey(), DeviceTypeEnum.WATER_METER.getValue());
|
||||
deviceMap.put(DeviceTypeEnum.ELECTRIC_METER.getKey(), DeviceTypeEnum.ELECTRIC_METER.getValue());
|
||||
deviceMap.put(DeviceTypeEnum.SMART_IN_OUT_WEIGHT.getKey(), DeviceTypeEnum.SMART_IN_OUT_WEIGHT.getValue());
|
||||
return deviceMap;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue