diff options
author | Anton Tananaev <anton@traccar.org> | 2022-10-28 06:08:10 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-10-28 06:08:10 -0700 |
commit | 87d54329d8d6ba14f37e15967079bcfc7299228c (patch) | |
tree | c05a3f116ca9ecf539b98dd76be7bba71bcf23e8 /src | |
parent | 0508411fc388d8a7495b43378cfa6265a24c02d2 (diff) | |
download | trackermap-server-87d54329d8d6ba14f37e15967079bcfc7299228c.tar.gz trackermap-server-87d54329d8d6ba14f37e15967079bcfc7299228c.tar.bz2 trackermap-server-87d54329d8d6ba14f37e15967079bcfc7299228c.zip |
Address in events report (fix #4761)
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/traccar/reports/EventsReportProvider.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/reports/EventsReportProvider.java b/src/main/java/org/traccar/reports/EventsReportProvider.java index d0d4fe8bf..30f55ba80 100644 --- a/src/main/java/org/traccar/reports/EventsReportProvider.java +++ b/src/main/java/org/traccar/reports/EventsReportProvider.java @@ -24,6 +24,7 @@ import org.traccar.model.Event; import org.traccar.model.Geofence; import org.traccar.model.Group; import org.traccar.model.Maintenance; +import org.traccar.model.Position; import org.traccar.reports.common.ReportUtils; import org.traccar.reports.model.DeviceReportSection; import org.traccar.storage.Storage; @@ -102,6 +103,7 @@ public class EventsReportProvider { ArrayList<String> sheetNames = new ArrayList<>(); HashMap<Long, String> geofenceNames = new HashMap<>(); HashMap<Long, String> maintenanceNames = new HashMap<>(); + HashMap<Long, Position> positions = new HashMap<>(); for (Device device: reportUtils.getAccessibleDevices(userId, deviceIds, groupIds)) { Collection<Event> events = getEvents(device.getId(), from, to); boolean all = types.isEmpty() || types.contains(Event.ALL_EVENTS); @@ -129,6 +131,14 @@ public class EventsReportProvider { iterator.remove(); } } + for (Event event : events) { + long positionId = event.getPositionId(); + if (positionId > 0) { + Position position = storage.getObject(Position.class, new Request( + new Columns.All(), new Condition.Equals("id", positionId))); + positions.put(positionId, position); + } + } DeviceReportSection deviceEvents = new DeviceReportSection(); deviceEvents.setDeviceName(device.getName()); sheetNames.add(WorkbookUtil.createSafeSheetName(deviceEvents.getDeviceName())); @@ -150,6 +160,7 @@ public class EventsReportProvider { context.putVar("sheetNames", sheetNames); context.putVar("geofenceNames", geofenceNames); context.putVar("maintenanceNames", maintenanceNames); + context.putVar("positions", positions); context.putVar("from", from); context.putVar("to", to); reportUtils.processTemplateWithSheets(inputStream, outputStream, context); |