aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/reports/Events.java
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-03-15 16:56:55 +0500
committerAbyss777 <abyss@fox5.ru>2017-03-15 16:56:55 +0500
commit975d2850e245c880e9105b68746cb535ea09fa90 (patch)
tree195fc2b97ed9ff698b0d2a349209f559e09b77af /src/org/traccar/reports/Events.java
parent38c12eb011e47c131a9b1e47e2b29901270057b1 (diff)
downloadtrackermap-server-975d2850e245c880e9105b68746cb535ea09fa90.tar.gz
trackermap-server-975d2850e245c880e9105b68746cb535ea09fa90.tar.bz2
trackermap-server-975d2850e245c880e9105b68746cb535ea09fa90.zip
Use timezone from preferences for excel reports
Diffstat (limited to 'src/org/traccar/reports/Events.java')
-rw-r--r--src/org/traccar/reports/Events.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/org/traccar/reports/Events.java b/src/org/traccar/reports/Events.java
index d2255684f..e5acd28f9 100644
--- a/src/org/traccar/reports/Events.java
+++ b/src/org/traccar/reports/Events.java
@@ -27,9 +27,10 @@ import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.Locale;
import org.apache.poi.ss.util.WorkbookUtil;
-import org.joda.time.DateTime;
+import org.apache.velocity.tools.generic.DateTool;
import org.jxls.area.Area;
import org.jxls.builder.xls.XlsCommentAreaBuilder;
import org.jxls.common.CellRef;
@@ -70,13 +71,13 @@ public final class Events {
public static void getExcel(OutputStream outputStream,
long userId, Collection<Long> deviceIds, Collection<Long> groupIds,
- Collection<String> types, DateTime from, DateTime to) throws SQLException, IOException {
+ Collection<String> types, Date from, Date to) throws SQLException, IOException {
ArrayList<DeviceReport> devicesEvents = new ArrayList<>();
ArrayList<String> sheetNames = new ArrayList<>();
HashMap<Long, String> geofenceNames = new HashMap<>();
for (long deviceId: ReportUtils.getDeviceList(deviceIds, groupIds)) {
Context.getPermissionsManager().checkDevice(userId, deviceId);
- Collection<Event> events = Context.getDataManager().getEvents(deviceId, from.toDate(), to.toDate());
+ Collection<Event> events = Context.getDataManager().getEvents(deviceId, from, to);
boolean all = types.isEmpty() || types.contains(Event.ALL_EVENTS);
for (Iterator<Event> iterator = events.iterator(); iterator.hasNext();) {
Event event = iterator.next();
@@ -120,7 +121,10 @@ public final class Events {
jxlsContext.putVar("to", to);
jxlsContext.putVar("distanceUnit", ReportUtils.getDistanceUnit(userId));
jxlsContext.putVar("speedUnit", ReportUtils.getSpeedUnit(userId));
- jxlsContext.putVar("timezone", from.getZone());
+ jxlsContext.putVar("webUrl", Context.getVelocityEngine().getProperty("web.url"));
+ jxlsContext.putVar("dateTool", new DateTool());
+ jxlsContext.putVar("timezone", ReportUtils.getTimezone(userId));
+ jxlsContext.putVar("locale", Locale.getDefault());
jxlsContext.putVar("bracketsRegex", "[\\{\\}\"]");
Transformer transformer = TransformerFactory.createTransformer(inputStream, outputStream);
List<Area> xlsAreas = new XlsCommentAreaBuilder(transformer).build();