aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/api/resource
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-06-14 11:39:15 +0500
committerAbyss777 <abyss@fox5.ru>2017-06-14 11:39:15 +0500
commit64888cfc53cceaf6ca545186b3eb44019923a954 (patch)
treeb125899f67eeafb20f360bde5348041ae38c675d /src/org/traccar/api/resource
parent659ade27a4e6dc56ff19dca4479f033472469479 (diff)
downloadtraccar-server-64888cfc53cceaf6ca545186b3eb44019923a954.tar.gz
traccar-server-64888cfc53cceaf6ca545186b3eb44019923a954.tar.bz2
traccar-server-64888cfc53cceaf6ca545186b3eb44019923a954.zip
Imlement Stops report
Diffstat (limited to 'src/org/traccar/api/resource')
-rw-r--r--src/org/traccar/api/resource/ReportResource.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/org/traccar/api/resource/ReportResource.java b/src/org/traccar/api/resource/ReportResource.java
index a0f686e80..7c472e84d 100644
--- a/src/org/traccar/api/resource/ReportResource.java
+++ b/src/org/traccar/api/resource/ReportResource.java
@@ -22,9 +22,11 @@ import org.traccar.model.Position;
import org.traccar.reports.Events;
import org.traccar.reports.Summary;
import org.traccar.reports.Trips;
+import org.traccar.reports.model.StopReport;
import org.traccar.reports.model.SummaryReport;
import org.traccar.reports.model.TripReport;
import org.traccar.reports.Route;
+import org.traccar.reports.Stops;
@Path("reports")
@Produces(MediaType.APPLICATION_JSON)
@@ -129,4 +131,29 @@ public class ReportResource extends BaseResource {
.header(HttpHeaders.CONTENT_DISPOSITION, CONTENT_DISPOSITION_VALUE_XLSX).build();
}
+ @Path("stops")
+ @GET
+ @Produces(MediaType.APPLICATION_JSON)
+ public Collection<StopReport> getStops(
+ @QueryParam("deviceId") final List<Long> deviceIds, @QueryParam("groupId") final List<Long> groupIds,
+ @QueryParam("from") String from, @QueryParam("to") String to) throws SQLException {
+ return Stops.getObjects(getUserId(), deviceIds, groupIds,
+ DateUtil.parseDate(from), DateUtil.parseDate(to));
+ }
+
+ @Path("stops")
+ @GET
+ @Produces(XLSX)
+ public Response getStopsExcel(
+ @QueryParam("deviceId") final List<Long> deviceIds, @QueryParam("groupId") final List<Long> groupIds,
+ @QueryParam("from") String from, @QueryParam("to") String to) throws SQLException, IOException {
+ ByteArrayOutputStream stream = new ByteArrayOutputStream();
+ Stops.getExcel(stream, getUserId(), deviceIds, groupIds,
+ DateUtil.parseDate(from), DateUtil.parseDate(to));
+
+ return Response.ok(stream.toByteArray())
+ .header(HttpHeaders.CONTENT_DISPOSITION, CONTENT_DISPOSITION_VALUE_XLSX).build();
+ }
+
+
}