diff options
author | Abyss777 <abyss@fox5.ru> | 2016-10-20 09:55:49 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2016-10-20 09:55:49 +0500 |
commit | 40d7ff2f9505150c85e87332fac9f67725beba8e (patch) | |
tree | 34c14e3ff4a7b9d94d68cd46d3a50b4bfefa7fdd | |
parent | 45302036168fe3adf1d9d184cd68e92e15dd3b1f (diff) | |
download | traccar-server-40d7ff2f9505150c85e87332fac9f67725beba8e.tar.gz traccar-server-40d7ff2f9505150c85e87332fac9f67725beba8e.tar.bz2 traccar-server-40d7ff2f9505150c85e87332fac9f67725beba8e.zip |
- Fix export empty reports
- Cleanup templates metadata
-rw-r--r-- | src/org/traccar/reports/Events.java | 22 | ||||
-rw-r--r-- | src/org/traccar/reports/Route.java | 22 | ||||
-rw-r--r-- | src/org/traccar/reports/Trips.java | 22 | ||||
-rw-r--r-- | templates/export/events.xlsx | bin | 11830 -> 11211 bytes | |||
-rw-r--r-- | templates/export/route.xlsx | bin | 12398 -> 11707 bytes | |||
-rw-r--r-- | templates/export/summary.xlsx | bin | 11896 -> 11209 bytes | |||
-rw-r--r-- | templates/export/trips.xlsx | bin | 12811 -> 12124 bytes |
7 files changed, 30 insertions, 36 deletions
diff --git a/src/org/traccar/reports/Events.java b/src/org/traccar/reports/Events.java index 37bf7b227..77d995f56 100644 --- a/src/org/traccar/reports/Events.java +++ b/src/org/traccar/reports/Events.java @@ -98,20 +98,18 @@ public final class Events { iterator.remove(); } } - if (!events.isEmpty()) { - DeviceReport deviceEvents = new DeviceReport(); - Device device = Context.getIdentityManager().getDeviceById(deviceId); - deviceEvents.setDeviceName(device.getName()); - sheetNames.add(deviceEvents.getDeviceName()); - if (device.getGroupId() != 0) { - Group group = Context.getDeviceManager().getGroupById(device.getGroupId()); - if (group != null) { - deviceEvents.setGroupName(group.getName()); - } + DeviceReport deviceEvents = new DeviceReport(); + Device device = Context.getIdentityManager().getDeviceById(deviceId); + deviceEvents.setDeviceName(device.getName()); + sheetNames.add(deviceEvents.getDeviceName()); + if (device.getGroupId() != 0) { + Group group = Context.getDeviceManager().getGroupById(device.getGroupId()); + if (group != null) { + deviceEvents.setGroupName(group.getName()); } - deviceEvents.setObjects(events); - devicesEvents.add(deviceEvents); } + deviceEvents.setObjects(events); + devicesEvents.add(deviceEvents); } String templatePath = Context.getConfig().getString("report.templatesPath", "templates/export/"); diff --git a/src/org/traccar/reports/Route.java b/src/org/traccar/reports/Route.java index 7cefe04a3..6992c89cc 100644 --- a/src/org/traccar/reports/Route.java +++ b/src/org/traccar/reports/Route.java @@ -68,20 +68,18 @@ public final class Route { for (long deviceId: ReportUtils.getDeviceList(deviceIds, groupIds)) { Context.getPermissionsManager().checkDevice(userId, deviceId); Collection<Position> positions = Context.getDataManager().getPositions(deviceId, from, to); - if (positions != null && !positions.isEmpty()) { - DeviceReport deviceRoutes = new DeviceReport(); - Device device = Context.getIdentityManager().getDeviceById(deviceId); - deviceRoutes.setDeviceName(device.getName()); - sheetNames.add(deviceRoutes.getDeviceName()); - if (device.getGroupId() != 0) { - Group group = Context.getDeviceManager().getGroupById(device.getGroupId()); - if (group != null) { - deviceRoutes.setGroupName(group.getName()); - } + DeviceReport deviceRoutes = new DeviceReport(); + Device device = Context.getIdentityManager().getDeviceById(deviceId); + deviceRoutes.setDeviceName(device.getName()); + sheetNames.add(deviceRoutes.getDeviceName()); + if (device.getGroupId() != 0) { + Group group = Context.getDeviceManager().getGroupById(device.getGroupId()); + if (group != null) { + deviceRoutes.setGroupName(group.getName()); } - deviceRoutes.setObjects(positions); - devicesRoutes.add(deviceRoutes); } + deviceRoutes.setObjects(positions); + devicesRoutes.add(deviceRoutes); } String templatePath = Context.getConfig().getString("report.templatesPath", "templates/export/"); diff --git a/src/org/traccar/reports/Trips.java b/src/org/traccar/reports/Trips.java index 27863d877..705644849 100644 --- a/src/org/traccar/reports/Trips.java +++ b/src/org/traccar/reports/Trips.java @@ -187,20 +187,18 @@ public final class Trips { for (long deviceId: ReportUtils.getDeviceList(deviceIds, groupIds)) { Context.getPermissionsManager().checkDevice(userId, deviceId); Collection<TripReport> trips = detectTrips(deviceId, from, to); - if (!trips.isEmpty()) { - DeviceReport deviceTrips = new DeviceReport(); - Device device = Context.getIdentityManager().getDeviceById(deviceId); - deviceTrips.setDeviceName(device.getName()); - sheetNames.add(deviceTrips.getDeviceName()); - if (device.getGroupId() != 0) { - Group group = Context.getDeviceManager().getGroupById(device.getGroupId()); - if (group != null) { - deviceTrips.setGroupName(group.getName()); - } + DeviceReport deviceTrips = new DeviceReport(); + Device device = Context.getIdentityManager().getDeviceById(deviceId); + deviceTrips.setDeviceName(device.getName()); + sheetNames.add(deviceTrips.getDeviceName()); + if (device.getGroupId() != 0) { + Group group = Context.getDeviceManager().getGroupById(device.getGroupId()); + if (group != null) { + deviceTrips.setGroupName(group.getName()); } - deviceTrips.setObjects(detectTrips(deviceId, from, to)); - devicesTrips.add(deviceTrips); } + deviceTrips.setObjects(trips); + devicesTrips.add(deviceTrips); } String templatePath = Context.getConfig().getString("report.templatesPath", "templates/export/"); diff --git a/templates/export/events.xlsx b/templates/export/events.xlsx Binary files differindex 99a3f7437..4f9569324 100644 --- a/templates/export/events.xlsx +++ b/templates/export/events.xlsx diff --git a/templates/export/route.xlsx b/templates/export/route.xlsx Binary files differindex 6f74cfb45..efd659e64 100644 --- a/templates/export/route.xlsx +++ b/templates/export/route.xlsx diff --git a/templates/export/summary.xlsx b/templates/export/summary.xlsx Binary files differindex a975c54fe..a989e0d19 100644 --- a/templates/export/summary.xlsx +++ b/templates/export/summary.xlsx diff --git a/templates/export/trips.xlsx b/templates/export/trips.xlsx Binary files differindex 8e13d5ff8..8e214a8a3 100644 --- a/templates/export/trips.xlsx +++ b/templates/export/trips.xlsx |