package dell_targets;
|
import databases.DBConnector;
|
import targets.LocationTag;
|
import java.sql.ResultSet;
|
import java.sql.SQLException;
|
import java.util.ArrayList;
|
import java.util.Collections;
|
import java.util.List;
|
import java.util.concurrent.ConcurrentHashMap;
|
public class Dell_tag {
|
public static List<LocationTag> locationTags;
|
private static ConcurrentHashMap<String, LocationTag> tagMap; // É豸ID->±êÇ©¶ÔÏóµÄÓ³Éä
|
public static List<LocationTag> getlocationTags() throws SQLException{
|
List<LocationTag> locationTags = new ArrayList<>();
|
tagMap = new ConcurrentHashMap<>(); // ³õʼ»¯Ó³Éä
|
ResultSet rs =DBConnector.queryTableData("location_tag");
|
if (rs == null) {
|
// ˵Ã÷µ×²ãÄò»µ½Êý¾Ý£¬Ö±½ÓÅ×Òì³£»ò´òÓ¡ÈÕÖ¾
|
throw new SQLException("DBConnector.queryTableData returned null, "
|
+ "please check database connection & SQL.");
|
}
|
while (rs.next()) {
|
LocationTag locationTag = new LocationTag();
|
locationTag.setId((int) rs.getLong("id"));
|
locationTag.setDeviceNumber(rs.getString("device_id"));
|
locationTag.setDeviceName(rs.getString("device_name"));
|
locationTag.setDeviceVersion(rs.getString("device_version"));
|
locationTag.setDeviceCardNumber(rs.getString("device_card_number"));
|
locationTag.setDeviceType(rs.getString("device_type"));
|
locationTag.setTeam(rs.getString("affiliated_class"));
|
locationTag.setGroup(rs.getString("affiliated_group"));
|
locationTag.setDepartment(rs.getString("department"));
|
locationTag.setIconAddress(rs.getString("icon_url"));
|
locationTag.setGender(rs.getString("gender"));
|
locationTag.setEthnicity(rs.getString("ethnic_group"));
|
locationTag.setCommunicationAddress(rs.getString("communication_address"));
|
locationTag.setBoundPhone(rs.getString("bound_phone"));
|
locationTag.setIdNumber(rs.getString("id_card_number"));
|
locationTag.setPosition(rs.getString("personnel_position"));
|
locationTag.setBoundPlateNumber(rs.getString("bound_license_plate"));
|
locationTag.setFaceAddress(rs.getString("face_image_url"));
|
locationTag.setHeartRate(rs.getString("heart_rate"));
|
locationTag.setBloodPressure(rs.getString("blood_pressure"));
|
locationTag.setBloodOxygen(rs.getString("blood_oxygen"));
|
locationTag.setTemperature(rs.getString("body_temperature"));
|
locationTag.setSosStatus(rs.getString("sos_status"));
|
locationTag.setMotionStatus(rs.getString("motion_status"));
|
locationTag.setOnlineStatus(rs.getString("online_status"));
|
locationTag.setSearchStatus(rs.getString("search_status"));
|
locationTag.setBatteryStatus(rs.getString("battery_status"));
|
locationTag.setDeviceBattery(rs.getString("device_battery"));
|
locationTag.setRemovalStatus(rs.getString("removal_status"));
|
locationTag.setCollisionStatus(rs.getString("collision_status"));
|
locationTag.setElevationStatus(rs.getString("climbing_status"));
|
locationTag.setGatheringCount(rs.getString("gathering_count"));
|
locationTag.setProximityAlarm(rs.getString("proximity_alarm"));
|
locationTag.setArea(rs.getString("current_area"));
|
locationTag.setXCoordinate(rs.getString("x_coordinate"));
|
locationTag.setYCoordinate(rs.getString("y_coordinate"));
|
locationTag.setZCoordinate(rs.getString("z_coordinate"));
|
locationTag.setFloor(rs.getString("current_floor"));
|
locationTag.setSpeed(rs.getString("movement_speed"));
|
locationTag.setLocationSource(rs.getString("position_source"));
|
locationTag.setLastUwbSignalTime(rs.getString("last_uwb_signal_time"));
|
locationTag.setLastSatelliteSignalTime(rs.getString("last_satellite_signal_time"));
|
locationTag.setUwbTimeSlot(rs.getString("uwb_time_slot"));
|
locationTag.setLatestRangingSeq(rs.getString("latest_ranging_packet_sequence"));
|
locationTag.setLatestRangingBaseId(rs.getString("latest_ranging_base_station_id"));
|
locationTag.setLatestRangingDistance(rs.getString("latest_ranging_base_station_distance"));
|
locationTag.setLatestRangingBaseCount(rs.getString("latest_ranging_uwb_base_station_count"));
|
locationTag.setLatestRangingSignalStrength(rs.getString("latest_ranging_base_station_signal_strength"));
|
locationTag.setUtcTime(rs.getString("utc_times"));
|
locationTag.setLatitude(rs.getString("latitude"));
|
locationTag.setLongitude(rs.getString("longitude"));
|
locationTag.setSatelliteQuality(rs.getString("satellite_positioning_quality"));
|
locationTag.setHdop(rs.getString("hdop"));
|
locationTag.setSatelliteCount(rs.getString("satellite_count"));
|
locationTag.setAltitude(rs.getString("altitude"));
|
locationTag.setDifferentialTime(rs.getString("differential_time"));
|
locationTag.setGeoidHeight(rs.getString("geoid_height"));
|
locationTag.setSatelliteSpeed(rs.getString("satellite_speed"));
|
locationTag.setLastBarometricValue(rs.getString("last_barometric_pressure"));
|
locationTag.setRecentCoordinates(rs.getString("recent_five_positions"));
|
locationTag.setRecentBarometricValues(rs.getString("recent_five_barometric_values"));
|
locationTag.setOfflineTime(rs.getString("offline_time"));
|
locationTag.setOnlineTime(rs.getString("online_time"));
|
locationTag.setOfflineDuration(rs.getString("offline_duration"));
|
locationTag.setOnlineDuration(rs.getString("online_duration"));
|
locationTag.setMotionlessStartTime(rs.getString("stationary_start_time"));
|
locationTag.setMotionlessEndTime(rs.getString("stationary_end_time"));
|
locationTag.setMotionlessDuration(rs.getString("stationary_duration"));
|
locationTag.setValidSatelliteSignal(rs.getString("tag_valid_satellite_signal"));
|
String company=rs.getString("company");
|
if (company == null || company.trim().isEmpty() || company.equals("-1") ) {
|
company = "Unknown";
|
}
|
locationTag.setCompany(company);
|
locationTag.setSleepTime(rs.getString("sleep_time"));
|
locationTag.setVibrationTime(rs.getString("vibration_time"));
|
locationTag.setFrequency(rs.getString("frequency"));
|
locationTag.setMotionlessTime(rs.getString("stationary_time"));
|
locationTag.setAccelerationValue(rs.getString("acceleration_value"));
|
locationTag.setImuTime(rs.getString("imu_time"));
|
locationTag.setReserved1(rs.getString("reserved1"));
|
locationTag.setReserved2(rs.getString("reserved2"));
|
locationTag.setReserved3(rs.getString("reserved3"));
|
locationTag.setReserved4(rs.getString("reserved4"));
|
locationTag.setReserved5(rs.getString("reserved5"));
|
locationTag.setIpAndPort(rs.getString("ip_and_port"));
|
locationTag.setInteractionType(rs.getString("Interaction_Type"));
|
locationTag.setIpAddress(rs.getString("ipAddress"));
|
locationTag.setIpPort(rs.getString("Interaction_Type"));
|
|
locationTag.setId((int) rs.getLong("id"));
|
|
String deviceNumber = rs.getString("device_id");
|
if (deviceNumber == null || deviceNumber.trim().isEmpty() || deviceNumber.equals("-1")) {
|
deviceNumber = "Unknown";
|
}
|
locationTag.setDeviceNumber(deviceNumber);
|
|
String deviceName = rs.getString("device_name");
|
if (deviceName == null || deviceName.trim().isEmpty() || deviceName.equals("-1")) {
|
deviceName = "Unknown";
|
}
|
locationTag.setDeviceName(deviceName);
|
|
String deviceVersion = rs.getString("device_version");
|
if (deviceVersion == null || deviceVersion.trim().isEmpty() || deviceVersion.equals("-1")) {
|
deviceVersion = "Unknown";
|
}
|
locationTag.setDeviceVersion(deviceVersion);
|
|
String deviceCardNumber = rs.getString("device_card_number");
|
if (deviceCardNumber == null || deviceCardNumber.trim().isEmpty() || deviceCardNumber.equals("-1")) {
|
deviceCardNumber = "Unknown";
|
}
|
locationTag.setDeviceCardNumber(deviceCardNumber);
|
|
String deviceType = rs.getString("device_type");
|
if (deviceType == null || deviceType.trim().isEmpty() || deviceType.equals("-1")) {
|
deviceType = "Unknown";
|
}
|
locationTag.setDeviceType(deviceType);
|
|
String team = rs.getString("affiliated_class");
|
if (team == null || team.trim().isEmpty() || team.equals("-1")) {
|
team = "Unknown";
|
}
|
locationTag.setTeam(team);
|
|
String group = rs.getString("affiliated_group");
|
if (group == null || group.trim().isEmpty() || group.equals("-1")) {
|
group = "Unknown";
|
}
|
locationTag.setGroup(group);
|
|
String department = rs.getString("department");
|
if (department == null || department.trim().isEmpty() || department.equals("-1")) {
|
department = "Unknown";
|
}
|
locationTag.setDepartment(department);
|
|
String iconAddress = rs.getString("icon_url");
|
if (iconAddress == null || iconAddress.trim().isEmpty() || iconAddress.equals("-1")) {
|
iconAddress = "Unknown";
|
}
|
locationTag.setIconAddress(iconAddress);
|
|
String gender = rs.getString("gender");
|
if (gender == null || gender.trim().isEmpty() || gender.equals("-1")) {
|
gender = "Unknown";
|
}
|
locationTag.setGender(gender);
|
|
String ethnicity = rs.getString("ethnic_group");
|
if (ethnicity == null || ethnicity.trim().isEmpty() || ethnicity.equals("-1")) {
|
ethnicity = "Unknown";
|
}
|
locationTag.setEthnicity(ethnicity);
|
|
String communicationAddress = rs.getString("communication_address");
|
if (communicationAddress == null || communicationAddress.trim().isEmpty() || communicationAddress.equals("-1")) {
|
communicationAddress = "Unknown";
|
}
|
locationTag.setCommunicationAddress(communicationAddress);
|
|
String boundPhone = rs.getString("bound_phone");
|
if (boundPhone == null || boundPhone.trim().isEmpty() || boundPhone.equals("-1")) {
|
boundPhone = "Unknown";
|
}
|
locationTag.setBoundPhone(boundPhone);
|
|
String idNumber = rs.getString("id_card_number");
|
if (idNumber == null || idNumber.trim().isEmpty() || idNumber.equals("-1")) {
|
idNumber = "Unknown";
|
}
|
locationTag.setIdNumber(idNumber);
|
|
String position = rs.getString("personnel_position");
|
if (position == null || position.trim().isEmpty() || position.equals("-1")) {
|
position = "Unknown";
|
}
|
locationTag.setPosition(position);
|
|
String boundPlateNumber = rs.getString("bound_license_plate");
|
if (boundPlateNumber == null || boundPlateNumber.trim().isEmpty() || boundPlateNumber.equals("-1")) {
|
boundPlateNumber = "Unknown";
|
}
|
locationTag.setBoundPlateNumber(boundPlateNumber);
|
|
String faceAddress = rs.getString("face_image_url");
|
if (faceAddress == null || faceAddress.trim().isEmpty() || faceAddress.equals("-1")) {
|
faceAddress = "Unknown";
|
}
|
locationTag.setFaceAddress(faceAddress);
|
|
String heartRate = rs.getString("heart_rate");
|
if (heartRate == null || heartRate.trim().isEmpty() || heartRate.equals("-1")) {
|
heartRate = "Unknown";
|
}
|
locationTag.setHeartRate(heartRate);
|
|
String bloodPressure = rs.getString("blood_pressure");
|
if (bloodPressure == null || bloodPressure.trim().isEmpty() || bloodPressure.equals("-1")) {
|
bloodPressure = "Unknown";
|
}
|
locationTag.setBloodPressure(bloodPressure);
|
|
String bloodOxygen = rs.getString("blood_oxygen");
|
if (bloodOxygen == null || bloodOxygen.trim().isEmpty() || bloodOxygen.equals("-1")) {
|
bloodOxygen = "Unknown";
|
}
|
locationTag.setBloodOxygen(bloodOxygen);
|
|
String temperature = rs.getString("body_temperature");
|
if (temperature == null || temperature.trim().isEmpty() || temperature.equals("-1")) {
|
temperature = "Unknown";
|
}
|
locationTag.setTemperature(temperature);
|
|
String sosStatus = rs.getString("sos_status");
|
if (sosStatus == null || sosStatus.trim().isEmpty() || sosStatus.equals("-1")) {
|
sosStatus = "Unknown";
|
}
|
locationTag.setSosStatus(sosStatus);
|
|
String motionStatus = rs.getString("motion_status");
|
if (motionStatus == null || motionStatus.trim().isEmpty() || motionStatus.equals("-1")) {
|
motionStatus = "Unknown";
|
}
|
locationTag.setMotionStatus(motionStatus);
|
|
String onlineStatus = rs.getString("online_status");
|
if (onlineStatus == null || onlineStatus.trim().isEmpty() || onlineStatus.equals("-1")) {
|
onlineStatus = "Unknown";
|
}
|
locationTag.setOnlineStatus(onlineStatus);
|
|
String searchStatus = rs.getString("search_status");
|
if (searchStatus == null || searchStatus.trim().isEmpty() || searchStatus.equals("-1")) {
|
searchStatus = "Unknown";
|
}
|
locationTag.setSearchStatus(searchStatus);
|
|
String batteryStatus = rs.getString("battery_status");
|
if (batteryStatus == null || batteryStatus.trim().isEmpty() || batteryStatus.equals("-1")) {
|
batteryStatus = "Unknown";
|
}
|
locationTag.setBatteryStatus(batteryStatus);
|
|
String deviceBattery = rs.getString("device_battery");
|
if (deviceBattery == null || deviceBattery.trim().isEmpty() || deviceBattery.equals("-1")) {
|
deviceBattery = "Unknown";
|
}
|
locationTag.setDeviceBattery(deviceBattery);
|
|
String removalStatus = rs.getString("removal_status");
|
if (removalStatus == null || removalStatus.trim().isEmpty() || removalStatus.equals("-1")) {
|
removalStatus = "Unknown";
|
}
|
locationTag.setRemovalStatus(removalStatus);
|
|
String collisionStatus = rs.getString("collision_status");
|
if (collisionStatus == null || collisionStatus.trim().isEmpty() || collisionStatus.equals("-1")) {
|
collisionStatus = "Unknown";
|
}
|
locationTag.setCollisionStatus(collisionStatus);
|
|
String elevationStatus = rs.getString("climbing_status");
|
if (elevationStatus == null || elevationStatus.trim().isEmpty() || elevationStatus.equals("-1")) {
|
elevationStatus = "Unknown";
|
}
|
locationTag.setElevationStatus(elevationStatus);
|
|
String gatheringCount = rs.getString("gathering_count");
|
if (gatheringCount == null || gatheringCount.trim().isEmpty() || gatheringCount.equals("-1")) {
|
gatheringCount = "Unknown";
|
}
|
locationTag.setGatheringCount(gatheringCount);
|
|
String proximityAlarm = rs.getString("proximity_alarm");
|
if (proximityAlarm == null || proximityAlarm.trim().isEmpty() || proximityAlarm.equals("-1")) {
|
proximityAlarm = "Unknown";
|
}
|
locationTag.setProximityAlarm(proximityAlarm);
|
|
String area = rs.getString("current_area");
|
if (area == null || area.trim().isEmpty() || area.equals("-1")) {
|
area = "Unknown";
|
}
|
locationTag.setArea(area);
|
|
String xCoordinate = rs.getString("x_coordinate");
|
if (xCoordinate == null || xCoordinate.trim().isEmpty() || xCoordinate.equals("-1")) {
|
xCoordinate = "Unknown";
|
}
|
locationTag.setXCoordinate(xCoordinate);
|
|
String yCoordinate = rs.getString("y_coordinate");
|
if (yCoordinate == null || yCoordinate.trim().isEmpty() || yCoordinate.equals("-1")) {
|
yCoordinate = "Unknown";
|
}
|
locationTag.setYCoordinate(yCoordinate);
|
|
String zCoordinate = rs.getString("z_coordinate");
|
if (zCoordinate == null || zCoordinate.trim().isEmpty() || zCoordinate.equals("-1")) {
|
zCoordinate = "Unknown";
|
}
|
locationTag.setZCoordinate(zCoordinate);
|
|
String floor = rs.getString("current_floor");
|
if (floor == null || floor.trim().isEmpty() || floor.equals("-1")) {
|
floor = "Unknown";
|
}
|
locationTag.setFloor(floor);
|
|
String speed = rs.getString("movement_speed");
|
if (speed == null || speed.trim().isEmpty() || speed.equals("-1")) {
|
speed = "Unknown";
|
}
|
locationTag.setSpeed(speed);
|
|
String locationSource = rs.getString("position_source");
|
if (locationSource == null || locationSource.trim().isEmpty() || locationSource.equals("-1")) {
|
locationSource = "Unknown";
|
}
|
locationTag.setLocationSource(locationSource);
|
|
String lastUwbSignalTime = rs.getString("last_uwb_signal_time");
|
if (lastUwbSignalTime == null || lastUwbSignalTime.trim().isEmpty() || lastUwbSignalTime.equals("-1")) {
|
lastUwbSignalTime = "Unknown";
|
}
|
locationTag.setLastUwbSignalTime(lastUwbSignalTime);
|
|
String lastSatelliteSignalTime = rs.getString("last_satellite_signal_time");
|
if (lastSatelliteSignalTime == null || lastSatelliteSignalTime.trim().isEmpty() || lastSatelliteSignalTime.equals("-1")) {
|
lastSatelliteSignalTime = "Unknown";
|
}
|
|
locationTag.setAutoUpgraded("Unknown");
|
locationTag.setIsSatelliteDevice("-1");
|
locationTag.setRTKsource("Unknown");
|
locationTags.add(locationTag);
|
tagMap.put(locationTag.getDeviceNumber(), locationTag); // Ìí¼Óµ½Ó³Éä
|
}
|
return locationTags;
|
}
|
|
// ÐÂÔö²åÈë±êÇ©·½·¨
|
public static void insertLocationTag(LocationTag tag) throws SQLException {
|
String sql = "INSERT INTO location_tag (device_id, device_name, device_type, company) " +
|
"VALUES (?, ?, ?, ?)";
|
DBConnector.executeUpdate(sql,
|
tag.getDeviceNumber(),
|
tag.getDeviceName(),
|
tag.getDeviceType(),
|
tag.getCompany());
|
}
|
|
// ÐÂÔöɾ³ý±êÇ©·½·¨
|
public static void deleteLocationTag(String deviceId) throws SQLException {
|
String sql = "DELETE FROM location_tag WHERE device_id = ?";
|
DBConnector.executeUpdate(sql, deviceId);
|
}
|
|
/**
|
* ¸ù¾ÝÉ豸ID¸ßЧÐÞ¸ÄÊôÐÔÖµ
|
* @param deviceId É豸ID£¨device_id£©
|
* @param propertyName ÊôÐÔÃû£¨ÐèÓësetter·½·¨Æ¥Å䣩
|
* @param value ÐÂÊôÐÔÖµ
|
*/
|
public static void updateLocationTagProperty(String deviceId, String propertyName, String value) {
|
LocationTag tag = tagMap.get(deviceId);
|
if (tag == null) return; // ±êÇ©²»´æÔÚÔòºöÂÔ
|
|
// ¸ù¾ÝÊôÐÔÃûµ÷ÓöÔÓ¦setter
|
switch (propertyName) {
|
case "id": tag.setId(Integer.parseInt(value)); break;
|
case "deviceNumber": tag.setDeviceNumber(value); break;
|
case "deviceName": tag.setDeviceName(value); break;
|
case "deviceVersion": tag.setDeviceVersion(value); break;
|
case "deviceCardNumber": tag.setDeviceCardNumber(value); break;
|
case "deviceType": tag.setDeviceType(value); break;
|
case "team": tag.setTeam(value); break;
|
case "group": tag.setGroup(value); break;
|
case "department": tag.setDepartment(value); break;
|
case "iconAddress": tag.setIconAddress(value); break;
|
case "gender": tag.setGender(value); break;
|
case "ethnicity": tag.setEthnicity(value); break;
|
case "communicationAddress": tag.setCommunicationAddress(value); break;
|
case "boundPhone": tag.setBoundPhone(value); break;
|
case "idNumber": tag.setIdNumber(value); break;
|
case "position": tag.setPosition(value); break;
|
case "boundPlateNumber": tag.setBoundPlateNumber(value); break;
|
case "faceAddress": tag.setFaceAddress(value); break;
|
case "heartRate": tag.setHeartRate(value); break;
|
case "bloodPressure": tag.setBloodPressure(value); break;
|
case "bloodOxygen": tag.setBloodOxygen(value); break;
|
case "temperature": tag.setTemperature(value); break;
|
case "sosStatus": tag.setSosStatus(value); break;
|
case "motionStatus": tag.setMotionStatus(value); break;
|
case "onlineStatus": tag.setOnlineStatus(value); break;
|
case "searchStatus": tag.setSearchStatus(value); break;
|
case "batteryStatus": tag.setBatteryStatus(value); break;
|
case "deviceBattery": tag.setDeviceBattery(value); break;
|
case "removalStatus": tag.setRemovalStatus(value); break;
|
case "collisionStatus": tag.setCollisionStatus(value); break;
|
case "elevationStatus": tag.setElevationStatus(value); break;
|
case "gatheringCount": tag.setGatheringCount(value); break;
|
case "proximityAlarm": tag.setProximityAlarm(value); break;
|
case "area": tag.setArea(value); break;
|
case "xCoordinate": tag.setXCoordinate(value); break;
|
case "yCoordinate": tag.setYCoordinate(value); break;
|
case "zCoordinate": tag.setZCoordinate(value); break;
|
case "floor": tag.setFloor(value); break;
|
case "speed": tag.setSpeed(value); break;
|
case "locationSource": tag.setLocationSource(value); break;
|
case "lastUwbSignalTime": tag.setLastUwbSignalTime(value); break;
|
case "lastSatelliteSignalTime": tag.setLastSatelliteSignalTime(value); break;
|
case "uwbTimeSlot": tag.setUwbTimeSlot(value); break;
|
case "latestRangingSeq": tag.setLatestRangingSeq(value); break;
|
case "latestRangingBaseId": tag.setLatestRangingBaseId(value); break;
|
case "latestRangingDistance": tag.setLatestRangingDistance(value); break;
|
case "latestRangingBaseCount": tag.setLatestRangingBaseCount(value); break;
|
case "latestRangingSignalStrength": tag.setLatestRangingSignalStrength(value); break;
|
case "utcTime": tag.setUtcTime(value); break;
|
case "latitude": tag.setLatitude(value); break;
|
case "longitude": tag.setLongitude(value); break;
|
case "satelliteQuality": tag.setSatelliteQuality(value); break;
|
case "hdop": tag.setHdop(value); break;
|
case "satelliteCount": tag.setSatelliteCount(value); break;
|
case "altitude": tag.setAltitude(value); break;
|
case "differentialTime": tag.setDifferentialTime(value); break;
|
case "geoidHeight": tag.setGeoidHeight(value); break;
|
case "satelliteSpeed": tag.setSatelliteSpeed(value); break;
|
case "lastBarometricValue": tag.setLastBarometricValue(value); break;
|
case "recentCoordinates": tag.setRecentCoordinates(value); break;
|
case "recentBarometricValues": tag.setRecentBarometricValues(value); break;
|
case "offlineTime": tag.setOfflineTime(value); break;
|
case "onlineTime": tag.setOnlineTime(value); break;
|
case "offlineDuration": tag.setOfflineDuration(value); break;
|
case "onlineDuration": tag.setOnlineDuration(value); break;
|
case "motionlessStartTime": tag.setMotionlessStartTime(value); break;
|
case "motionlessEndTime": tag.setMotionlessEndTime(value); break;
|
case "motionlessDuration": tag.setMotionlessDuration(value); break;
|
case "validSatelliteSignal": tag.setValidSatelliteSignal(value); break;
|
case "company": tag.setCompany(value); break;
|
case "sleepTime": tag.setSleepTime(value); break;
|
case "vibrationTime": tag.setVibrationTime(value); break;
|
case "frequency": tag.setFrequency(value); break;
|
case "motionlessTime": tag.setMotionlessTime(value); break;
|
case "accelerationValue": tag.setAccelerationValue(value); break;
|
case "imuTime": tag.setImuTime(value); break;
|
case "reserved1": tag.setReserved1(value); break;
|
case "reserved2": tag.setReserved2(value); break;
|
case "reserved3": tag.setReserved3(value); break;
|
case "reserved4": tag.setReserved4(value); break;
|
case "reserved5": tag.setReserved5(value); break;
|
case "ipAndPort": tag.setIpAndPort(value); break;
|
case "interactionType": tag.setInteractionType(value); break;
|
case "ipAddress": tag.setIpAddress(value); break;
|
case "ipPort": tag.setIpPort(value); break;
|
case "gnGgaDataTime": tag.setGnGgaDataTime(value); break;
|
case "isSatelliteDevice": tag.setIsSatelliteDevice(value);break;
|
case "RTKsource": tag.setRTKsource(value);break;
|
default:
|
throw new IllegalArgumentException("ÎÞЧÊôÐÔ: " + propertyName);
|
}
|
}
|
|
/**
|
* ¸ù¾ÝÉ豸ID»ñÈ¡±êÇ©¶ÔÏ󣨸ßЧ·ÃÎÊ£©
|
* @param deviceId É豸ID
|
* @return ±êÇ©¶ÔÏ󣨲»´æÔÚ·µ»Ønull£©
|
*/
|
public static LocationTag getTagByDeviceId(String deviceId) {
|
return tagMap.get(deviceId);
|
}
|
|
//»ñÈ¡ËùÓеÄtagid
|
public static List<String> getAlldeviceIds() {
|
List<String> types = new ArrayList<>();
|
try {
|
// »ñÈ¡MessageType¶ÔÏóÁбí
|
List<LocationTag> typeList = getlocationTags();
|
// Ìáȡÿ¸ö¶ÔÏóµÄTypeName
|
for (LocationTag mt : typeList) {
|
types.add(mt.getDeviceNumber());
|
}
|
} catch (SQLException e) {
|
e.printStackTrace(); // ʵ¼ÊÓ¦ÓÃÖÐÓ¦´¦ÀíÒì³£
|
}
|
return types;
|
}
|
|
/**
|
* »ñÈ¡ËùÓÐÔÚÏß״̬(onlineStatus=1)µÄÉ豸£¨¸ßЧÄÚ´æ²Ù×÷£©
|
* @return ²»¿ÉÐ޸ĵÄLocationTag¼¯ºÏ£¨±ÜÃâÍⲿÐ޸Ļº´æ£©
|
*/
|
public static List<LocationTag> getOnlineLocationTags() {
|
if (tagMap == null || tagMap.isEmpty()) {
|
return Collections.emptyList(); // »º´æÎª¿Õʱ·µ»Ø¿Õ¼¯ºÏ
|
}
|
|
List<LocationTag> onlineTags = new ArrayList<>();
|
for (LocationTag tag : tagMap.values()) {
|
if ("1".equals(tag.getOnlineStatus())) { // ×Ö·û´®±È½Ï±ÜÃâNPE
|
onlineTags.add(tag);
|
}
|
}
|
return Collections.unmodifiableList(onlineTags); // ·µ»Ø²»¿É±ä¼¯ºÏ
|
}
|
|
/**
|
* ¿ìËÙ»ñÈ¡LocationTag¶ÔÏóµÄ×ÜÊý£¨Ê¹ÓÃÄڴ滺´æÌá¸ßÐÔÄÜ£©
|
* @return LocationTag¶ÔÏóµÄ×ÜÊý
|
*/
|
public static int getLocationTagCount() {
|
if (tagMap == null) {
|
synchronized (Dell_tag.class) {
|
if (tagMap == null) {
|
try {
|
getlocationTags(); // ³õʼ»¯»º´æ
|
} catch (SQLException e) {
|
e.printStackTrace();
|
return 0; // ³õʼ»¯Ê§°Ü·µ»Ø0
|
}
|
}
|
}
|
}
|
return tagMap.size();
|
}
|
|
/**
|
* ¸ù¾Ýµ¥¸öÊôÐÔ²éѯLocationTag¶ÔÏó
|
* @param propertyName ÊôÐÔÃû£¨deviceNumber/deviceVersion/company£©
|
* @param propertyValue ÊôÐÔÖµ
|
* @return Âú×ãÌõ¼þµÄLocationTag¶ÔÏóÁбí
|
*/
|
public static List<LocationTag> getLocationTagsByProperty(String propertyName, String propertyValue) {
|
if (tagMap == null || tagMap.isEmpty()) {
|
try {
|
getlocationTags(); // ³õʼ»¯Êý¾Ý
|
} catch (SQLException e) {
|
e.printStackTrace();
|
return Collections.emptyList();
|
}
|
}
|
|
List<LocationTag> result = new ArrayList<>();
|
|
for (LocationTag tag : tagMap.values()) {
|
switch (propertyName) {
|
case "deviceNumber":
|
if (propertyValue.equals(tag.getDeviceNumber())) {
|
result.add(tag);
|
}
|
break;
|
case "deviceVersion":
|
if (propertyValue.equals(tag.getDeviceVersion())) {
|
result.add(tag);
|
}
|
break;
|
case "company":
|
if (propertyValue.equals(tag.getCompany())) {
|
result.add(tag);
|
}
|
break;
|
default:
|
throw new IllegalArgumentException("²»Ö§³ÖµÄÊôÐÔ: " + propertyName);
|
}
|
}
|
|
return result;
|
}
|
}
|