Fix location update timestamp overwrite issue

This commit is contained in:
Pahansith 2021-08-25 15:09:55 +05:30
parent e349e9f029
commit ee95c8aca1

View File

@ -286,7 +286,11 @@ public class DeviceDetailsDAOImpl implements DeviceDetailsDAO {
stmt.setString(8, deviceLocation.getState()); stmt.setString(8, deviceLocation.getState());
stmt.setString(9, deviceLocation.getCountry()); stmt.setString(9, deviceLocation.getCountry());
stmt.setString(10, GeoHashGenerator.encodeGeohash(deviceLocation)); stmt.setString(10, GeoHashGenerator.encodeGeohash(deviceLocation));
if (deviceLocation.getUpdatedTime() == null) {
stmt.setLong(11, System.currentTimeMillis()); stmt.setLong(11, System.currentTimeMillis());
} else {
stmt.setLong(11, deviceLocation.getUpdatedTime().getTime());
}
stmt.setInt(12, enrollmentId); stmt.setInt(12, enrollmentId);
stmt.setDouble(13, deviceLocation.getAltitude()); stmt.setDouble(13, deviceLocation.getAltitude());
stmt.setFloat(14, deviceLocation.getSpeed()); stmt.setFloat(14, deviceLocation.getSpeed());
@ -417,7 +421,11 @@ public class DeviceDetailsDAOImpl implements DeviceDetailsDAO {
stmt.setDouble(6, deviceLocation.getLongitude()); stmt.setDouble(6, deviceLocation.getLongitude());
stmt.setFloat(7, deviceLocation.getSpeed()); stmt.setFloat(7, deviceLocation.getSpeed());
stmt.setFloat(8, deviceLocation.getBearing()); stmt.setFloat(8, deviceLocation.getBearing());
if (deviceLocation.getUpdatedTime() == null) {
stmt.setLong(9, System.currentTimeMillis()); stmt.setLong(9, System.currentTimeMillis());
} else {
stmt.setLong(9, deviceLocation.getUpdatedTime().getTime());
}
stmt.setString(10, GeoHashGenerator.encodeGeohash(deviceLocation)); stmt.setString(10, GeoHashGenerator.encodeGeohash(deviceLocation));
stmt.setString(11, device.getEnrolmentInfo().getOwner()); stmt.setString(11, device.getEnrolmentInfo().getOwner());
stmt.setDouble(12, deviceLocation.getAltitude()); stmt.setDouble(12, deviceLocation.getAltitude());