package dell_targets; import databases.DBConnector; import targets.LocationTag; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; public class Dell_tag { static List locationTags; public static List getlocationTags() throws SQLException{ List locationTags = new ArrayList<>(); ResultSet rs =DBConnector.queryTableData("location_tag"); 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")); locationTag.setCompany(rs.getString("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")); locationTags.add(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); } //»ñÈ¡ËùÓеÄtagid public static List getAlldeviceIds() { List types = new ArrayList<>(); try { // »ñÈ¡MessageType¶ÔÏóÁбí List typeList = getlocationTags(); // Ìáȡÿ¸ö¶ÔÏóµÄTypeName for (LocationTag mt : typeList) { types.add(mt.getDeviceNumber()); } } catch (SQLException e) { e.printStackTrace(); // ʵ¼ÊÓ¦ÓÃÖÐÓ¦´¦ÀíÒì³£ } return types; } }