Commit 411a0652 by yangyang

伴随验证提交(重庆)

parent 1311b19e
......@@ -15,6 +15,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.*;
import java.util.*;
import java.util.stream.Collectors;
@RestController
@RequestMapping("skbs")
......@@ -132,9 +133,9 @@ public class SkbsController {
/**
* @param paramList 所有轨迹的集合
* @param paramList 所有轨迹的集合
* @param requestParams 请求传进来的参数,需要其中的 radius
* */
* */
public List getSkbsfx(TogetherEntity requestParams,List<TogetherEntity> paramList){
List<TogetherEntity> resultList = new ArrayList<>();
long timeItervalMinutes = requestParams.getMinutes() * 60 * 1000;
......@@ -142,6 +143,9 @@ public class SkbsController {
* list2为所有数据的集合,将集合按轨迹开始时间排序
* */
Collections.sort(paramList, Comparator.comparing(TogetherEntity::getTimestamp));
// 根据ObjectValue去重
List<TogetherEntity> resultListDistinct = resultList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(()
-> new TreeSet<>(Comparator.comparing(TogetherEntity :: getObjectValue))), ArrayList::new));
for (int i = 1; i < paramList.size(); i++) {
TogetherEntity a = paramList.get(i - 1);
......@@ -153,7 +157,7 @@ public class SkbsController {
BeanUtils.copyProperties(a, t);
BeanUtils.copyProperties(a1, t1);
if (!t.getObjectValue().equals(t1.getObjectValue())) {
if ((!t.getObjectType().equals(t1.getObjectType())&&t.getObjectValue().equals(t1.getObjectValue()))||!t.getObjectValue().equals(t1.getObjectValue())) {
long timeIterval = t1.getTimestamp() - t.getTimestamp();
double s = getDistance(t.getJ(), t.getW(), t1.getJ(), t1.getW());
if (s < requestParams.getRadius() && timeIterval < timeItervalMinutes) {
......@@ -172,7 +176,6 @@ public class SkbsController {
resultList.add(t1);
}
}
}
resultList.stream().sorted(Comparator.comparing(TogetherEntity::getTimestamp));
......@@ -208,7 +211,7 @@ public class SkbsController {
@Builder
@AllArgsConstructor
@NoArgsConstructor
static class SkbsParam{
static class SkbsParam{
private TogetherEntity requestParams;
private List<SkTrail> list;
}
......
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