aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-10-20 09:55:49 +0500
committerAbyss777 <abyss@fox5.ru>2016-10-20 09:55:49 +0500
commit40d7ff2f9505150c85e87332fac9f67725beba8e (patch)
tree34c14e3ff4a7b9d94d68cd46d3a50b4bfefa7fdd
parent45302036168fe3adf1d9d184cd68e92e15dd3b1f (diff)
downloadtraccar-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.java22
-rw-r--r--src/org/traccar/reports/Route.java22
-rw-r--r--src/org/traccar/reports/Trips.java22
-rw-r--r--templates/export/events.xlsxbin11830 -> 11211 bytes
-rw-r--r--templates/export/route.xlsxbin12398 -> 11707 bytes
-rw-r--r--templates/export/summary.xlsxbin11896 -> 11209 bytes
-rw-r--r--templates/export/trips.xlsxbin12811 -> 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
index 99a3f7437..4f9569324 100644
--- a/templates/export/events.xlsx
+++ b/templates/export/events.xlsx
Binary files differ
diff --git a/templates/export/route.xlsx b/templates/export/route.xlsx
index 6f74cfb45..efd659e64 100644
--- a/templates/export/route.xlsx
+++ b/templates/export/route.xlsx
Binary files differ
diff --git a/templates/export/summary.xlsx b/templates/export/summary.xlsx
index a975c54fe..a989e0d19 100644
--- a/templates/export/summary.xlsx
+++ b/templates/export/summary.xlsx
Binary files differ
diff --git a/templates/export/trips.xlsx b/templates/export/trips.xlsx
index 8e13d5ff8..8e214a8a3 100644
--- a/templates/export/trips.xlsx
+++ b/templates/export/trips.xlsx
Binary files differ