Commit 326951c7 authored by Carit Zhu's avatar Carit Zhu 🎱

Add checkShockPoint function to judge whether current point is a shock point…

Add checkShockPoint function to judge whether current point is a shock point instead of equal time only.
parent b4298805
......@@ -95,6 +95,23 @@ public class DataController {
add("\"ta\"");
}};
private boolean checkShockPoint(LocationDataVo current, LocationDataVo last, List<String> shockTimeList) {
try {
long curPointTs = Long.parseLong(current.getTime());
long lastPointTs = last != null ? Long.parseLong(last.getTime()) : 0;
for (String timeString : shockTimeList) {
long shockTs = Long.parseLong(timeString);
if (shockTs > lastPointTs && shockTs <= curPointTs) {
// The point is shocked
return true;
}
}
} catch (NumberFormatException ignored) {
}
return false;
}
//获取坐标数据数据
@ApiOperation(value = "获取坐标数据数据", notes = "获取坐标数据数据:" +
" time:时间," +
......@@ -141,7 +158,7 @@ public class DataController {
}
} else {
if ("baidu".equals(searchLocationVo.getType())) {
sql = "SELECT \"bdlng\",\"bdlat\",\"motion\" FROM \"tdl_policy\".\"" + device + "\"where \"data_type\" = 'location' and time >= " + startTime + " ORDER BY time ";
sql = "SELECT \"bdlng\",\"bdlat\",\"motion\" FROM \"tdl_policy\".\"" + device + "\"where \"data_type\" = 'location' and time >= " + startTime + " ORDER BY time ";
// sql = "SELECT \"bdlng\",\"bdlat\",\"motion\" FROM \"tdl_policy\".\"" + device + "\"where \"data_type\" = 'location' and time >= 1552579200000000000 ORDER BY time ";
} else {
sql = "SELECT \"lng\",\"lat\",\"motion\" FROM \"tdl_policy\".\"" + device + "\"where \"data_type\" = 'location' and time >= " + startTime + " ORDER BY time ";
......@@ -187,14 +204,17 @@ public class DataController {
if (queryResult3.getResults() != null) {
time = getShockLocation(queryResult3);
}
LocationDataVo lastLocationDataVo = null;
for (LocationDataVo locationDataVo : locationDataVos) {
if (time.contains(locationDataVo.getTime())) {
//if (time.contains(locationDataVo.getTime())) {
if (checkShockPoint(locationDataVo, lastLocationDataVo, time)) {
locationDataVo.setError(1);
locationDataVoList.add(locationDataVo);
} else {
locationDataVo.setError(0);
locationDataVoList.add(locationDataVo);
}
locationDataVoList.add(locationDataVo);
// Set current as last
lastLocationDataVo = locationDataVo;
}
return gson.toJson(locationDataVoList);
} else {
......
......@@ -3,6 +3,9 @@ spring.datasource.username=root
spring.datasource.password=37774020
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
#spring.datasource.url=jdbc:mysql://rm-bp12687cq31d42453so.mysql.rds.aliyuncs.com:3306/tdlcloud?useUnicode=true&characterEncoding=utf-8&useSSL=false
#spring.datasource.username=witcloud
#spring.datasource.password=Witcloud37774020
threadpool.corepoolsize = 30
threadpool.maxpoolsize = 50
......@@ -58,10 +61,10 @@ spring.influxdb.password=Witcloud37774020
spring.influxdb.url=http://172.16.1.24:8086
spring.influxdb.database=logistics
#spring.influxdb.url=http://47.97.184.225:8086
#spring.influxdb.username=admin
#spring.influxdb.password=37774020
#spring.influxdb.database=original
#spring.influxdb.url=https://ts-bp1q738i505oj79t7.influxdata.rds.aliyuncs.com:3242
#spring.influxdb.username=witcloud
#spring.influxdb.password=Witcloud37774020
#spring.influxdb.database=warehouse_bosch
spring.influxdb.retentionPolicy = tdl_policy
spring.influxdb.connent-timeout=10
spring.influxdb.read-timeout=30
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment