aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/api
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-08-04 13:32:12 +0500
committerAbyss777 <abyss@fox5.ru>2016-08-04 16:33:35 +0500
commit7c96911d3770eafe4625b27acd732b10d717b9d0 (patch)
tree26c94e10fda919e07712d1f2901cee8eac4297d9 /src/org/traccar/api
parent504a555b40ee0c2c14e8679ed320b8c2578f8610 (diff)
downloadtraccar-server-7c96911d3770eafe4625b27acd732b10d717b9d0.tar.gz
traccar-server-7c96911d3770eafe4625b27acd732b10d717b9d0.tar.bz2
traccar-server-7c96911d3770eafe4625b27acd732b10d717b9d0.zip
General report implementation
Diffstat (limited to 'src/org/traccar/api')
-rw-r--r--src/org/traccar/api/resource/ReportResource.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/org/traccar/api/resource/ReportResource.java b/src/org/traccar/api/resource/ReportResource.java
index cf11cd4e4..0885a3638 100644
--- a/src/org/traccar/api/resource/ReportResource.java
+++ b/src/org/traccar/api/resource/ReportResource.java
@@ -12,6 +12,7 @@ import javax.ws.rs.core.Response.ResponseBuilder;
import org.traccar.api.BaseResource;
import org.traccar.reports.Events;
+import org.traccar.reports.General;
import org.traccar.reports.ReportUtils;
import org.traccar.reports.Route;
import org.traccar.web.JsonConverter;
@@ -54,4 +55,21 @@ public class ReportResource extends BaseResource {
return response.build();
}
+ @Path("general")
+ @GET
+ public Response getGeneral(
+ @QueryParam("deviceId") final List<Long> deviceIds, @QueryParam("groupId") final List<Long> groupIds,
+ @QueryParam("from") String from, @QueryParam("to") String to) throws SQLException {
+ if (getAcceptHeader().equals("application/ms-excel")) {
+ ResponseBuilder response = Response.ok(ReportUtils.getOut(General.getCsv(getUserId(), deviceIds, groupIds,
+ JsonConverter.parseDate(from), JsonConverter.parseDate(to))));
+ response.type("application/ms-excel");
+ return response.build();
+ }
+ ResponseBuilder response = Response.ok(General.getJson(getUserId(), deviceIds, groupIds,
+ JsonConverter.parseDate(from), JsonConverter.parseDate(to)));
+ response.type(MediaType.APPLICATION_JSON);
+ return response.build();
+ }
+
}