|
|
@@ -168,8 +168,8 @@ public class MapLogRepository implements SensLogRepository {
|
|
|
.map(rs -> StreamSupport.stream(rs.spliterator(), false)
|
|
|
.map((row) -> Unit.of(
|
|
|
row.getLong("unit_id"),
|
|
|
- row.getString("imei"),
|
|
|
row.getString("name"),
|
|
|
+ row.getString("imei"),
|
|
|
row.getString("description")
|
|
|
))
|
|
|
.collect(toList())
|
|
|
@@ -319,7 +319,7 @@ public class MapLogRepository implements SensLogRepository {
|
|
|
return client.preparedQuery("SELECT s.sensor_id, s.name, s.type " +
|
|
|
"FROM maplog.unit_to_sensor AS uts " +
|
|
|
"JOIN maplog.sensor s on s.sensor_id = uts.sensor_id " +
|
|
|
- "WHERE uts.unit_id = $1 AND s.io_id != 0 ORDER BY s.sensor_id")
|
|
|
+ "WHERE uts.unit_id = $1 ORDER BY s.sensor_id")
|
|
|
.execute(Tuple.of(unitId))
|
|
|
.map(rs -> StreamSupport.stream(rs.spliterator(), false)
|
|
|
.map((row) -> Sensor.of(
|
|
|
@@ -1310,7 +1310,7 @@ public class MapLogRepository implements SensLogRepository {
|
|
|
case SENSOR -> {
|
|
|
switch (filter.getAttribute()) {
|
|
|
case ID -> of(tupleParams.addLong(filter.getAttributeValueAsLong()).addFloat(optValue))
|
|
|
- .map(p -> format(" AND (tel.observed_values::jsonb ->> $%d::bigint::text::varchar)::integer %s $%d", p.size()-1, opt, p.size()))
|
|
|
+ .map(p -> format(" AND (tel.observed_values::jsonb ->> $%d::bigint::text::varchar)::double precision %s $%d", p.size()-1, opt, p.size()))
|
|
|
.ifPresent(whereFiltersClause::append);
|
|
|
}
|
|
|
}
|
|
|
@@ -1390,7 +1390,7 @@ public class MapLogRepository implements SensLogRepository {
|
|
|
case SENSOR -> {
|
|
|
switch (filter.getAttribute()) {
|
|
|
case ID -> of(tupleParams.addLong(filter.getAttributeValueAsLong()).addFloat(optValue))
|
|
|
- .map(p -> format(" AND (tel.observed_values::jsonb ->> $%d::bigint::text::varchar)::integer %s $%d", p.size()-1, opt, p.size()))
|
|
|
+ .map(p -> format(" AND (tel.observed_values::jsonb ->> $%d::bigint::text::varchar)::double precision %s $%d", p.size()-1, opt, p.size()))
|
|
|
.ifPresent(whereFiltersClause::append);
|
|
|
}
|
|
|
}
|
|
|
@@ -1444,7 +1444,7 @@ public class MapLogRepository implements SensLogRepository {
|
|
|
String whereTimestampClause;
|
|
|
Tuple tupleParams;
|
|
|
if (from != null && to != null) {
|
|
|
- whereTimestampClause = "tel.time_stamp <= (CASE WHEN $5 > utc.to_time THEN utc.to_time ELSE $5 END) AND tel.time_stamp >= (CASE WHEN $6 > utc.from_time THEN utc.from_time ELSE $6 END)";
|
|
|
+ whereTimestampClause = "tel.time_stamp >= (CASE WHEN $5 > utc.from_time THEN utc.from_time ELSE $5 END) AND tel.time_stamp <= (CASE WHEN $6 > utc.to_time THEN utc.to_time ELSE $6 END)";
|
|
|
tupleParams = Tuple.of(campaignId, unitId, offset, limit, from, to);
|
|
|
} else if (from != null) {
|
|
|
whereTimestampClause = "tel.time_stamp >= (CASE WHEN $5 > utc.from_time THEN utc.from_time ELSE $5 END) AND tel.time_stamp <= utc.to_time";
|
|
|
@@ -1473,7 +1473,7 @@ public class MapLogRepository implements SensLogRepository {
|
|
|
case SENSOR -> {
|
|
|
switch (filter.getAttribute()) {
|
|
|
case ID -> of(tupleParams.addLong(filter.getAttributeValueAsLong()).addFloat(optValue))
|
|
|
- .map(p -> format(" AND (tel.observed_values::jsonb ->> $%d::bigint::text::varchar)::integer %s $%d", p.size()-1, opt, p.size()))
|
|
|
+ .map(p -> format(" AND (tel.observed_values::jsonb ->> $%d::bigint::text::varchar)::double precision %s $%d", p.size()-1, opt, p.size()))
|
|
|
.ifPresent(whereFiltersClause::append);
|
|
|
}
|
|
|
}
|
|
|
@@ -1551,7 +1551,7 @@ public class MapLogRepository implements SensLogRepository {
|
|
|
case SENSOR -> {
|
|
|
switch (filter.getAttribute()) {
|
|
|
case ID -> of(tupleParams.addLong(filter.getAttributeValueAsLong()).addFloat(optValue))
|
|
|
- .map(p -> format(" AND (tel.observed_values::jsonb ->> $%d::bigint::text::varchar)::integer %s $%d", p.size()-1, opt, p.size()))
|
|
|
+ .map(p -> format(" AND (tel.observed_values::jsonb ->> $%d::bigint::text::varchar)::double precision %s $%d", p.size()-1, opt, p.size()))
|
|
|
.ifPresent(whereFiltersClause::append);
|
|
|
}
|
|
|
}
|
|
|
@@ -1632,7 +1632,7 @@ public class MapLogRepository implements SensLogRepository {
|
|
|
case SENSOR -> {
|
|
|
switch (filter.getAttribute()) {
|
|
|
case ID -> of(tupleParams.addLong(filter.getAttributeValueAsLong()).addFloat(optValue))
|
|
|
- .map(p -> format(" AND (tel.observed_values::jsonb ->> $%d::bigint::text::varchar)::integer %s $%d", p.size()-1, opt, p.size()))
|
|
|
+ .map(p -> format(" AND (tel.observed_values::jsonb ->> $%d::bigint::text::varchar)::double precision %s $%d", p.size()-1, opt, p.size()))
|
|
|
.ifPresent(whereFiltersClause::append);
|
|
|
}
|
|
|
}
|
|
|
@@ -1711,7 +1711,7 @@ public class MapLogRepository implements SensLogRepository {
|
|
|
case SENSOR -> {
|
|
|
switch (filter.getAttribute()) {
|
|
|
case ID -> of(tupleParams.addLong(filter.getAttributeValueAsLong()).addFloat(optValue))
|
|
|
- .map(p -> format(" AND (tel.observed_values::jsonb ->> $%d::bigint::text::varchar)::integer %s $%d", p.size()-1, opt, p.size()))
|
|
|
+ .map(p -> format(" AND (tel.observed_values::jsonb ->> $%d::bigint::text::varchar)::double precision %s $%d", p.size()-1, opt, p.size()))
|
|
|
.ifPresent(whereFiltersClause::append);
|
|
|
}
|
|
|
}
|
|
|
@@ -1793,14 +1793,14 @@ public class MapLogRepository implements SensLogRepository {
|
|
|
case SENSOR -> {
|
|
|
switch (filter.getAttribute()) {
|
|
|
case ID -> of(tupleParams.addLong(filter.getAttributeValueAsLong()).addFloat(optValue))
|
|
|
- .map(p -> format(" AND (tel.observed_values::jsonb ->> $%d::bigint::text::varchar)::integer %s $%d", p.size()-1, opt, p.size()))
|
|
|
+ .map(p -> format(" AND (tel.observed_values::jsonb ->> $%d::bigint::text::varchar)::double precision %s $%d", p.size()-1, opt, p.size()))
|
|
|
.ifPresent(whereFiltersClause::append);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- String sql = "SELECT tel.id, (tel.observed_values::jsonb ->> $3::bigint::text::varchar)::integer AS value, tel.speed, tel.time_stamp, " +
|
|
|
+ String sql = "SELECT tel.id, (tel.observed_values::jsonb ->> $3::bigint::text::varchar)::double precision AS value, tel.speed, tel.time_stamp, " +
|
|
|
"ST_X (ST_Transform (tel.the_geom, 4326)) AS long, " +
|
|
|
"ST_Y (ST_Transform (tel.the_geom, 4326)) AS lat, " +
|
|
|
"ST_Z (ST_Transform (tel.the_geom, 4326)) AS alt, " +
|
|
|
@@ -1816,7 +1816,7 @@ public class MapLogRepository implements SensLogRepository {
|
|
|
.map(rs -> StreamSupport.stream(rs.spliterator(), false)
|
|
|
.map(r -> SensorTelemetry.of(
|
|
|
r.getLong("id"),
|
|
|
- r.getLong("value"),
|
|
|
+ r.getDouble("value"),
|
|
|
r.getOffsetDateTime("time_stamp"),
|
|
|
Location.of(
|
|
|
r.getFloat("long"),
|
|
|
@@ -1864,14 +1864,14 @@ public class MapLogRepository implements SensLogRepository {
|
|
|
case SENSOR -> {
|
|
|
switch (filter.getAttribute()) {
|
|
|
case ID -> of(tupleParams.addLong(filter.getAttributeValueAsLong()).addFloat(optValue))
|
|
|
- .map(p -> format(" AND (tel.observed_values::jsonb ->> $%d::bigint::text::varchar)::integer %s $%d", p.size()-1, opt, p.size()))
|
|
|
+ .map(p -> format(" AND (tel.observed_values::jsonb ->> $%d::bigint::text::varchar)::double precision %s $%d", p.size()-1, opt, p.size()))
|
|
|
.ifPresent(whereFiltersClause::append);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- String sql = "SELECT tel.id, (tel.observed_values::jsonb ->> $3::bigint::text::varchar)::integer AS value, tel.speed, tel.time_stamp, " +
|
|
|
+ String sql = "SELECT tel.id, (tel.observed_values::jsonb ->> $3::bigint::text::varchar)::double precision AS value, tel.speed, tel.time_stamp, " +
|
|
|
"ST_X (ST_Transform (tel.the_geom, 4326)) AS long, " +
|
|
|
"ST_Y (ST_Transform (tel.the_geom, 4326)) AS lat, " +
|
|
|
"ST_Z (ST_Transform (tel.the_geom, 4326)) AS alt, " +
|
|
|
@@ -1891,7 +1891,7 @@ public class MapLogRepository implements SensLogRepository {
|
|
|
.map(rs -> StreamSupport.stream(rs.spliterator(), false)
|
|
|
.map(r -> SensorTelemetry.of(
|
|
|
r.getLong("id"),
|
|
|
- r.getLong("value"),
|
|
|
+ r.getDouble("value"),
|
|
|
r.getOffsetDateTime("time_stamp"),
|
|
|
Location.of(
|
|
|
r.getFloat("long"),
|
|
|
@@ -1939,7 +1939,7 @@ public class MapLogRepository implements SensLogRepository {
|
|
|
case SENSOR -> {
|
|
|
switch (filter.getAttribute()) {
|
|
|
case ID -> of(tupleParams.addLong(filter.getAttributeValueAsLong()).addFloat(optValue))
|
|
|
- .map(p -> format(" AND (tel.observed_values::jsonb ->> $%d::bigint::text::varchar)::integer %s $%d", p.size()-1, opt, p.size()))
|
|
|
+ .map(p -> format(" AND (tel.observed_values::jsonb ->> $%d::bigint::text::varchar)::double precision %s $%d", p.size()-1, opt, p.size()))
|
|
|
.ifPresent(whereFiltersClause::append);
|
|
|
}
|
|
|
}
|
|
|
@@ -2008,7 +2008,7 @@ public class MapLogRepository implements SensLogRepository {
|
|
|
case SENSOR -> {
|
|
|
switch (filter.getAttribute()) {
|
|
|
case ID -> of(tupleParams.addLong(filter.getAttributeValueAsLong()).addFloat(optValue))
|
|
|
- .map(p -> format(" AND (tel.observed_values::jsonb ->> $%d::bigint::text::varchar)::integer %s $%d", p.size()-1, opt, p.size()))
|
|
|
+ .map(p -> format(" AND (tel.observed_values::jsonb ->> $%d::bigint::text::varchar)::double precision %s $%d", p.size()-1, opt, p.size()))
|
|
|
.ifPresent(whereFiltersClause::append);
|
|
|
}
|
|
|
}
|
|
|
@@ -2080,7 +2080,7 @@ public class MapLogRepository implements SensLogRepository {
|
|
|
case SENSOR -> {
|
|
|
switch (filter.getAttribute()) {
|
|
|
case ID -> of(tupleParams.addLong(filter.getAttributeValueAsLong()).addFloat(optValue))
|
|
|
- .map(p -> format(" AND (tel.observed_values::jsonb ->> $%d::bigint::text::varchar)::integer %s $%d", p.size()-1, opt, p.size()))
|
|
|
+ .map(p -> format(" AND (tel.observed_values::jsonb ->> $%d::bigint::text::varchar)::double precision %s $%d", p.size()-1, opt, p.size()))
|
|
|
.ifPresent(whereFiltersClause::append);
|
|
|
}
|
|
|
}
|
|
|
@@ -2148,7 +2148,7 @@ public class MapLogRepository implements SensLogRepository {
|
|
|
case SENSOR -> {
|
|
|
switch (filter.getAttribute()) {
|
|
|
case ID -> of(tupleParams.addLong(filter.getAttributeValueAsLong()).addFloat(optValue))
|
|
|
- .map(p -> format(" AND (tel.observed_values::jsonb ->> $%d::bigint::text::varchar)::integer %s $%d", p.size()-1, opt, p.size()))
|
|
|
+ .map(p -> format(" AND (tel.observed_values::jsonb ->> $%d::bigint::text::varchar)::double precision %s $%d", p.size()-1, opt, p.size()))
|
|
|
.ifPresent(whereFiltersClause::append);
|
|
|
}
|
|
|
}
|
|
|
@@ -2218,7 +2218,7 @@ public class MapLogRepository implements SensLogRepository {
|
|
|
case SENSOR -> {
|
|
|
switch (filter.getAttribute()) {
|
|
|
case ID -> of(tupleParams.addLong(filter.getAttributeValueAsLong()).addFloat(optValue))
|
|
|
- .map(p -> format(" AND (observed_values::jsonb ->> $%d::bigint::text::varchar)::integer %s $%d", p.size()-1, opt, p.size()))
|
|
|
+ .map(p -> format(" AND (observed_values::jsonb ->> $%d::bigint::text::varchar)::double precision %s $%d", p.size()-1, opt, p.size()))
|
|
|
.ifPresent(whereFiltersClause::append);
|
|
|
}
|
|
|
}
|
|
|
@@ -2285,7 +2285,7 @@ public class MapLogRepository implements SensLogRepository {
|
|
|
case SENSOR -> {
|
|
|
switch (filter.getAttribute()) {
|
|
|
case ID -> of(tupleParams.addLong(filter.getAttributeValueAsLong()).addFloat(optValue))
|
|
|
- .map(p -> format(" AND (observed_values::jsonb ->> $%d::bigint::text::varchar)::integer %s $%d", p.size()-1, opt, p.size()))
|
|
|
+ .map(p -> format(" AND (observed_values::jsonb ->> $%d::bigint::text::varchar)::double precision %s $%d", p.size()-1, opt, p.size()))
|
|
|
.ifPresent(whereFiltersClause::append);
|
|
|
}
|
|
|
}
|