aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/api
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2024-03-02 21:31:37 -0800
committerAnton Tananaev <anton@traccar.org>2024-03-02 21:31:37 -0800
commitf1680218e85ff3310eb5898d8ec28feaac5797c6 (patch)
tree7e950235bf9de910bd3a2b6839ec749960535d85 /src/main/java/org/traccar/api
parentcf85d6ab0b31b7b51a8f55554592c6524ceb3474 (diff)
downloadtrackermap-server-f1680218e85ff3310eb5898d8ec28feaac5797c6.tar.gz
trackermap-server-f1680218e85ff3310eb5898d8ec28feaac5797c6.tar.bz2
trackermap-server-f1680218e85ff3310eb5898d8ec28feaac5797c6.zip
Add device export report
Diffstat (limited to 'src/main/java/org/traccar/api')
-rw-r--r--src/main/java/org/traccar/api/resource/ReportResource.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/api/resource/ReportResource.java b/src/main/java/org/traccar/api/resource/ReportResource.java
index b4882f219..55a96fa90 100644
--- a/src/main/java/org/traccar/api/resource/ReportResource.java
+++ b/src/main/java/org/traccar/api/resource/ReportResource.java
@@ -23,6 +23,7 @@ import org.traccar.model.Position;
import org.traccar.model.Report;
import org.traccar.model.UserRestrictions;
import org.traccar.reports.CombinedReportProvider;
+import org.traccar.reports.DevicesReportProvider;
import org.traccar.reports.EventsReportProvider;
import org.traccar.reports.RouteReportProvider;
import org.traccar.reports.StopsReportProvider;
@@ -78,6 +79,9 @@ public class ReportResource extends SimpleObjectResource<Report> {
private TripsReportProvider tripsReportProvider;
@Inject
+ private DevicesReportProvider devicesReportProvider;
+
+ @Inject
private ReportMailer reportMailer;
public ReportResource() {
@@ -319,4 +323,15 @@ public class ReportResource extends SimpleObjectResource<Report> {
return getStopsExcel(deviceIds, groupIds, from, to, type.equals("mail"));
}
+ @Path("devices/{type:xlsx|mail}")
+ @GET
+ @Produces(EXCEL)
+ public Response geDevicesExcel(
+ @PathParam("type") String type) throws StorageException {
+ permissionsService.checkRestriction(getUserId(), UserRestrictions::getDisableReports);
+ return executeReport(getUserId(), type.equals("mail"), stream -> {
+ devicesReportProvider.getExcel(stream, getUserId());
+ });
+ }
+
}