mirror of
https://github.com/traccar/traccar.git
synced 2025-01-07 03:07:01 +08:00
Merge pull request #5484 from hypoclone/master
Add quantity of fuel drop/increase in notification
This commit is contained in:
commit
cfefe03ff1
@ -55,13 +55,19 @@ public class FuelEventHandler extends BaseEventHandler {
|
||||
double threshold = AttributeUtil.lookup(
|
||||
cacheManager, Keys.EVENT_FUEL_INCREASE_THRESHOLD, position.getDeviceId());
|
||||
if (threshold > 0 && change >= threshold) {
|
||||
callback.eventDetected(new Event(Event.TYPE_DEVICE_FUEL_INCREASE, position));
|
||||
Event event = new Event(Event.TYPE_DEVICE_FUEL_INCREASE, position);
|
||||
event.set("before", before);
|
||||
event.set("after", after);
|
||||
callback.eventDetected(event);
|
||||
}
|
||||
} else if (change < 0) {
|
||||
double threshold = AttributeUtil.lookup(
|
||||
cacheManager, Keys.EVENT_FUEL_DROP_THRESHOLD, position.getDeviceId());
|
||||
if (threshold > 0 && Math.abs(change) >= threshold) {
|
||||
callback.eventDetected(new Event(Event.TYPE_DEVICE_FUEL_DROP, position));
|
||||
Event event = new Event(Event.TYPE_DEVICE_FUEL_DROP, position);
|
||||
event.set("before", before);
|
||||
event.set("after", after);
|
||||
callback.eventDetected(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,8 @@
|
||||
<body>
|
||||
Device: $device.name<br>
|
||||
Time: $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.eventTime, $locale, $timezone)<br>
|
||||
Quantity Before: $event.attributes.before<br>
|
||||
Quantity After: $event.attributes.after<br>
|
||||
Point: <a href="$webUrl?eventId=$event.id">#{if}($position.address)$position.address#{else}$position.latitude°, $position.longitude°#{end}</a><br>
|
||||
<br>
|
||||
<a href="$webUrl/settings/notifications?token=$token">Unsubscribe</a>
|
||||
|
@ -4,6 +4,8 @@
|
||||
<body>
|
||||
Device: $device.name<br>
|
||||
Time: $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.eventTime, $locale, $timezone)<br>
|
||||
Quantity Before: $event.attributes.before<br>
|
||||
Quantity After: $event.attributes.after<br>
|
||||
Point: <a href="$webUrl?eventId=$event.id">#{if}($position.address)$position.address#{else}$position.latitude°, $position.longitude°#{end}</a><br>
|
||||
<br>
|
||||
<a href="$webUrl/settings/notifications?token=$token">Unsubscribe</a>
|
||||
|
Loading…
Reference in New Issue
Block a user