ScopeServiceTest.java
1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package com.sl.ms.scope.service;
import com.sl.ms.scope.entity.ServiceScopeEntity;
import com.sl.ms.scope.enums.ServiceTypeEnum;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.geo.Point;
import org.springframework.data.mongodb.core.geo.GeoJsonPoint;
import org.springframework.data.mongodb.core.geo.GeoJsonPolygon;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;
@SpringBootTest
public class ScopeServiceTest {
@Resource
private ScopeService scopeService;
@Test
void saveOrUpdate() {
List<Point> pointList = Arrays.asList(new Point(116.340064,40.061245),
new Point(116.347081,40.061836),
new Point(116.34751,40.05842),
new Point(116.342446,40.058092),
new Point(116.340064,40.061245));
Boolean result = this.scopeService.saveOrUpdate(2L, ServiceTypeEnum.ORGAN, new GeoJsonPolygon(pointList));
System.out.println(result);
}
@Test
void delete() {
}
@Test
void testDelete() {
}
@Test
void queryById() {
}
@Test
void queryByBidAndType() {
}
@Test
void queryListByPoint() {
}
@Test
void testQueryListByPoint() {
GeoJsonPoint point = new GeoJsonPoint(116.344828,40.05911);
List<ServiceScopeEntity> serviceScopeEntities = this.scopeService.queryListByPoint(ServiceTypeEnum.ORGAN, point);
serviceScopeEntities.forEach(serviceScopeEntity -> System.out.println(serviceScopeEntity));
}
@Test
void testQueryListByPoint2() {
String address = "北京市昌平区金燕龙办公楼";
List<ServiceScopeEntity> serviceScopeEntities = this.scopeService.queryListByPoint(ServiceTypeEnum.ORGAN, address);
serviceScopeEntities.forEach(serviceScopeEntity -> System.out.println(serviceScopeEntity));
}
}