Improve device location history getting and storing functionalities

corrective-policy
tcdlpds@gmail.com 4 years ago
parent f7843e5c35
commit f9bcb808f9

@ -1851,7 +1851,8 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO {
+ "WHERE "
+ "DEVICE_ID_NAME = ? AND "
+ "DEVICE_TYPE_NAME = ? AND "
+ "TIMESTAMP BETWEEN ? AND ?";
+ "TIMESTAMP BETWEEN ? AND ? "
+ "ORDER BY timestamp";
try {
Connection conn = this.getConnection();
try (PreparedStatement stmt = conn.prepareStatement(sql)) {

@ -30,8 +30,6 @@ import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOException;
import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory;
import org.wso2.carbon.device.mgt.core.dao.impl.AbstractDeviceDAOImpl;
import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil;
import org.wso2.carbon.device.mgt.core.geo.GeoCluster;
import org.wso2.carbon.device.mgt.core.geo.geoHash.GeoCoordinate;
import org.wso2.carbon.device.mgt.core.report.mgt.Constants;
import java.sql.Connection;

@ -447,7 +447,7 @@ public class DeviceDetailsDAOImpl implements DeviceDetailsDAO {
stmt.setDouble(6, location.getLongitude());
stmt.setFloat(7, location.getSpeed());
stmt.setFloat(8, location.getBearing());
stmt.setLong(9, System.currentTimeMillis());
stmt.setLong(9, location.getUpdatedTime().getTime());
stmt.setString(10, GeoHashGenerator.encodeGeohash(location));
stmt.setString(11, device.getEnrolmentInfo().getOwner());
stmt.setDouble(12, location.getAltitude());

Loading…
Cancel
Save