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 { ...@@ -95,6 +95,23 @@ public class DataController {
add("\"ta\""); 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 = "获取坐标数据数据:" + @ApiOperation(value = "获取坐标数据数据", notes = "获取坐标数据数据:" +
" time:时间," + " time:时间," +
...@@ -187,14 +204,17 @@ public class DataController { ...@@ -187,14 +204,17 @@ public class DataController {
if (queryResult3.getResults() != null) { if (queryResult3.getResults() != null) {
time = getShockLocation(queryResult3); time = getShockLocation(queryResult3);
} }
LocationDataVo lastLocationDataVo = null;
for (LocationDataVo locationDataVo : locationDataVos) { for (LocationDataVo locationDataVo : locationDataVos) {
if (time.contains(locationDataVo.getTime())) { //if (time.contains(locationDataVo.getTime())) {
if (checkShockPoint(locationDataVo, lastLocationDataVo, time)) {
locationDataVo.setError(1); locationDataVo.setError(1);
locationDataVoList.add(locationDataVo);
} else { } else {
locationDataVo.setError(0); locationDataVo.setError(0);
locationDataVoList.add(locationDataVo);
} }
locationDataVoList.add(locationDataVo);
// Set current as last
lastLocationDataVo = locationDataVo;
} }
return gson.toJson(locationDataVoList); return gson.toJson(locationDataVoList);
} else { } else {
......
...@@ -3,6 +3,9 @@ spring.datasource.username=root ...@@ -3,6 +3,9 @@ spring.datasource.username=root
spring.datasource.password=37774020 spring.datasource.password=37774020
spring.datasource.driver-class-name=com.mysql.jdbc.Driver 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.corepoolsize = 30
threadpool.maxpoolsize = 50 threadpool.maxpoolsize = 50
...@@ -58,10 +61,10 @@ spring.influxdb.password=Witcloud37774020 ...@@ -58,10 +61,10 @@ spring.influxdb.password=Witcloud37774020
spring.influxdb.url=http://172.16.1.24:8086 spring.influxdb.url=http://172.16.1.24:8086
spring.influxdb.database=logistics spring.influxdb.database=logistics
#spring.influxdb.url=http://47.97.184.225:8086 #spring.influxdb.url=https://ts-bp1q738i505oj79t7.influxdata.rds.aliyuncs.com:3242
#spring.influxdb.username=admin #spring.influxdb.username=witcloud
#spring.influxdb.password=37774020 #spring.influxdb.password=Witcloud37774020
#spring.influxdb.database=original #spring.influxdb.database=warehouse_bosch
spring.influxdb.retentionPolicy = tdl_policy spring.influxdb.retentionPolicy = tdl_policy
spring.influxdb.connent-timeout=10 spring.influxdb.connent-timeout=10
spring.influxdb.read-timeout=30 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