aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/reports/Route.java
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-11-23 11:41:11 +0500
committerAbyss777 <abyss@fox5.ru>2016-11-23 11:41:11 +0500
commitb14169a2b7bfcaecaa0f5ea9baafad4e7e4f1ae2 (patch)
treea82bf3699fc76a6a46da9835de846970db7722e3 /src/org/traccar/reports/Route.java
parent5f867c6077f79a2a1d3b8ec18f78c3a2657ba698 (diff)
downloadtrackermap-server-b14169a2b7bfcaecaa0f5ea9baafad4e7e4f1ae2.tar.gz
trackermap-server-b14169a2b7bfcaecaa0f5ea9baafad4e7e4f1ae2.tar.bz2
trackermap-server-b14169a2b7bfcaecaa0f5ea9baafad4e7e4f1ae2.zip
- Pass client timezone to excel template
- Templates: adjust timezone, use "https" in links
Diffstat (limited to 'src/org/traccar/reports/Route.java')
-rw-r--r--src/org/traccar/reports/Route.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/org/traccar/reports/Route.java b/src/org/traccar/reports/Route.java
index b29e04b2e..f438c8f4d 100644
--- a/src/org/traccar/reports/Route.java
+++ b/src/org/traccar/reports/Route.java
@@ -26,6 +26,7 @@ import java.util.Collection;
import java.util.Date;
import java.util.List;
+import org.joda.time.DateTime;
import org.jxls.area.Area;
import org.jxls.builder.xls.XlsCommentAreaBuilder;
import org.jxls.common.CellRef;
@@ -34,6 +35,7 @@ import org.jxls.transform.Transformer;
import org.jxls.transform.poi.PoiTransformer;
import org.jxls.util.TransformerFactory;
import org.traccar.Context;
+import org.traccar.helper.DateUtil;
import org.traccar.model.Device;
import org.traccar.model.Group;
import org.traccar.model.Position;
@@ -56,12 +58,15 @@ public final class Route {
public static void getExcel(OutputStream outputStream,
long userId, Collection<Long> deviceIds, Collection<Long> groupIds,
- Date from, Date to) throws SQLException, IOException {
+ String fromString, String toString) throws SQLException, IOException {
ArrayList<DeviceReport> devicesRoutes = new ArrayList<>();
ArrayList<String> sheetNames = new ArrayList<>();
+ DateTime from = DateUtil.parseDateTime(fromString);
+ DateTime to = DateUtil.parseDateTime(toString);
for (long deviceId: ReportUtils.getDeviceList(deviceIds, groupIds)) {
Context.getPermissionsManager().checkDevice(userId, deviceId);
- Collection<Position> positions = Context.getDataManager().getPositions(deviceId, from, to);
+ Collection<Position> positions = Context.getDataManager()
+ .getPositions(deviceId, from.toDate(), to.toDate());
DeviceReport deviceRoutes = new DeviceReport();
Device device = Context.getIdentityManager().getDeviceById(deviceId);
deviceRoutes.setDeviceName(device.getName());
@@ -85,6 +90,7 @@ public final class Route {
jxlsContext.putVar("to", to);
jxlsContext.putVar("distanceUnit", ReportUtils.getDistanceUnit(userId));
jxlsContext.putVar("speedUnit", ReportUtils.getSpeedUnit(userId));
+ jxlsContext.putVar("timezone", from.getZone());
jxlsContext.putVar("bracketsRegex", "[\\{\\}\"]");
Transformer transformer = TransformerFactory.createTransformer(inputStream, outputStream);
List<Area> xlsAreas = new XlsCommentAreaBuilder(transformer).build();