removed unwanted codes

feature/traccar-sync
Rushdi Mohamed 3 years ago
parent e88d5e9c3b
commit 6f79180920

@ -421,14 +421,13 @@ public class TraccarClientImpl implements TraccarClient {
authorizedKey(HttpReportingUtil.trackerUser(), HttpReportingUtil.trackerPassword()), authorizedKey(HttpReportingUtil.trackerUser(), HttpReportingUtil.trackerPassword()),
serverUrl(HttpReportingUtil.trackerServer()))); serverUrl(HttpReportingUtil.trackerServer())));
String result = res.get(); String result = res.get();
log.info("---------res--------" + result); log.info("---------result--------");
if(result.charAt(0)=='{'){ if(result.charAt(0)=='{'){
JSONObject obj = new JSONObject(result); JSONObject obj = new JSONObject(result);
if (obj.has("id")){ if (obj.has("id")){
int traccarDeviceId = obj.getInt("id"); int traccarDeviceId = obj.getInt("id");
int deviceId = traccarDevice.getId(); int deviceId = traccarDevice.getId();
log.info("TraccarDeviceId - " + traccarDeviceId); log.info("TraccarDeviceId - " + traccarDeviceId);
log.info("DeviceId - " + deviceId);
try { try {
TrackerManagementDAOFactory.beginTransaction(); TrackerManagementDAOFactory.beginTransaction();
trackerDAO.addTrackerDevice(traccarDeviceId, deviceId, tenantId); trackerDAO.addTrackerDevice(traccarDeviceId, deviceId, tenantId);
@ -486,6 +485,7 @@ public class TraccarClientImpl implements TraccarClient {
addDevice(device, tenantId); addDevice(device, tenantId);
}else{ }else{
//Update Location //Update Location
log.info("Updating Location");
String method = TraccarHandlerConstants.Methods.GET; String method = TraccarHandlerConstants.Methods.GET;
String url = locationUpdatePort+"/?id="+deviceInfo.getDeviceIdentifier()+ String url = locationUpdatePort+"/?id="+deviceInfo.getDeviceIdentifier()+
"&timestamp="+deviceInfo.getTimestamp()+"&lat="+deviceInfo.getLat()+ "&timestamp="+deviceInfo.getTimestamp()+"&lat="+deviceInfo.getLat()+
@ -494,7 +494,7 @@ public class TraccarClientImpl implements TraccarClient {
executor.submit(new OkHttpClientThreadPool(url, null, method, executor.submit(new OkHttpClientThreadPool(url, null, method,
authorizedKey(HttpReportingUtil.trackerUser(), HttpReportingUtil.trackerPassword()), authorizedKey(HttpReportingUtil.trackerUser(), HttpReportingUtil.trackerPassword()),
serverUrl(HttpReportingUtil.trackerServer()))); "http://localhost:"));
//executor.shutdown(); //executor.shutdown();
} }
} }
@ -515,9 +515,6 @@ public class TraccarClientImpl implements TraccarClient {
log.info("------deviceId-----" + deviceId); log.info("------deviceId-----" + deviceId);
log.info(trackerDeviceInfo); log.info(trackerDeviceInfo);
log.info(new Gson().toJson(trackerDeviceInfo));
log.info(trackerDeviceInfo.getDeviceId());
log.info(trackerDeviceInfo.getTraccarDeviceId());
if(trackerDeviceInfo!=null){ if(trackerDeviceInfo!=null){
//trackerDevice = new JSONObject(trackerDeviceInfo); //trackerDevice = new JSONObject(trackerDeviceInfo);
int status = trackerDAO.removeTrackerDevice(deviceId, tenantId); int status = trackerDAO.removeTrackerDevice(deviceId, tenantId);
@ -540,11 +537,7 @@ public class TraccarClientImpl implements TraccarClient {
TrackerManagementDAOFactory.closeConnection(); TrackerManagementDAOFactory.closeConnection();
} }
log.info("__________________"); log.info("--------Disenrolling Device--------");
log.info(new Gson().toJson(trackerPermissionInfo));
log.info(trackerPermissionInfo.get(0));
log.info(new Gson().toJson(trackerPermissionInfo.get(0)));
log.info("__________________");
//Delete from traccar //Delete from traccar
if(trackerDeviceInfo!=null){ if(trackerDeviceInfo!=null){
String method = TraccarHandlerConstants.Methods.DELETE; String method = TraccarHandlerConstants.Methods.DELETE;

@ -27,7 +27,7 @@
<Properties> <Properties>
<Property name="sample-property">sample</Property> <Property name="sample-property">sample</Property>
<Property name="api-endpoint">http://localhost:</Property> <Property name="api-endpoint">http://localhost:</Property>
<Property name="default-port">8085</Property> <Property name="default-port"></Property>
<Property name="location-update-port">5055</Property> <Property name="location-update-port">5055</Property>
<Property name="authorization">Authorization</Property> <Property name="authorization">Authorization</Property>
<Property name="authorization-key">Basic YWRtaW46YWRtaW4=</Property> <Property name="authorization-key">Basic YWRtaW46YWRtaW4=</Property>

Loading…
Cancel
Save