|
|
@@ -63,12 +63,12 @@ class CockpitMonitoringPointDetailSnapshotContractTest {
|
|
|
CockpitMapSnapshot snapshot = snapshotWith(SNAPSHOT_AT,
|
|
|
new CockpitMapSnapshot.SourceMonitoringPoint(
|
|
|
"MP-001", "供水干管监测点", null, "11",
|
|
|
- new BigDecimal("110.141"), new BigDecimal("28.452"), false,
|
|
|
+ new BigDecimal("110.371"), new BigDecimal("28.452"), false,
|
|
|
Arrays.asList(
|
|
|
- device("EQ-003", "110.142", "28.453", false, true, false, false, true),
|
|
|
- device("EQ-001", "110.143", "28.454", false, true, true, false, true),
|
|
|
- device("EQ-005", "110.144", "28.455", false, false, false, true, true),
|
|
|
- device("EQ-002", "110.145", "28.456", false, true, false, false, false),
|
|
|
+ device("EQ-003", "110.372", "28.453", false, true, false, false, true),
|
|
|
+ device("EQ-001", "110.373", "28.454", false, true, true, false, true),
|
|
|
+ device("EQ-005", "110.374", "28.455", false, false, false, true, true),
|
|
|
+ device("EQ-002", "110.375", "28.456", false, true, false, false, false),
|
|
|
device("EQ-004", null, null, false, false, false, false, false))));
|
|
|
when(mapAdapter.load(SNAPSHOT_AT)).thenReturn(snapshot);
|
|
|
|
|
|
@@ -102,12 +102,13 @@ class CockpitMonitoringPointDetailSnapshotContractTest {
|
|
|
CockpitMapSnapshot snapshot = snapshotWith(SNAPSHOT_AT,
|
|
|
new CockpitMapSnapshot.SourceMonitoringPoint(
|
|
|
"MP-001", "供水干管监测点", null, "11",
|
|
|
- new BigDecimal("110.141"), new BigDecimal("28.452"), false,
|
|
|
+ new BigDecimal("110.371"), new BigDecimal("28.452"), false,
|
|
|
Arrays.asList(
|
|
|
- device("EQ-VALID", "110.142", "28.453", false, true, true, false, false),
|
|
|
+ device("EQ-VALID", "110.372", "28.453", false, true, true, false, false),
|
|
|
device("EQ-MISSING", null, null, false, false, false, false, false),
|
|
|
device("EQ-INVALID", "200.000", "28.453", true, true, false, false, false),
|
|
|
- device("EQ-UNVERIFIED", "110.146", "28.457", false, true, false, false, false))));
|
|
|
+ // 110.146 刻意留在主场景区外,用于固化 OUTSIDE_PRIMARY_AREA 这一新原因
|
|
|
+ device("EQ-OUTSIDE", "110.146", "28.457", false, true, false, false, false))));
|
|
|
when(mapAdapter.load(SNAPSHOT_AT)).thenReturn(snapshot);
|
|
|
|
|
|
CockpitMonitoringPointDetailResponse response =
|
|
|
@@ -116,27 +117,31 @@ class CockpitMonitoringPointDetailSnapshotContractTest {
|
|
|
List<CockpitMonitoringPointDeviceCard> devices = response.getDevices();
|
|
|
assertEquals(4, devices.size());
|
|
|
|
|
|
+ // 2026-10-12 契约:区内坐标自动准入 → VALID / reason=null / 可上图。
|
|
|
CockpitMonitoringPointDeviceCard valid = byCode(devices, "EQ-VALID");
|
|
|
- assertEquals(new BigDecimal("110.142"), valid.getLongitude());
|
|
|
+ assertEquals(new BigDecimal("110.372"), valid.getLongitude());
|
|
|
assertEquals(new BigDecimal("28.453"), valid.getLatitude());
|
|
|
- assertEquals("UNVERIFIED", valid.getCoordinateValidation().getState());
|
|
|
- assertFalse(valid.getCoordinateValidation().isRenderable());
|
|
|
+ assertEquals("VALID", valid.getCoordinateValidation().getState());
|
|
|
+ assertNull(valid.getCoordinateValidation().getReason());
|
|
|
+ assertTrue(valid.getCoordinateValidation().isRenderable());
|
|
|
|
|
|
CockpitMonitoringPointDeviceCard missing = byCode(devices, "EQ-MISSING");
|
|
|
assertNull(missing.getLongitude());
|
|
|
assertNull(missing.getLatitude());
|
|
|
assertFalse(missing.getCoordinateValidation().isRenderable());
|
|
|
- assertEquals("UNVERIFIED_COORDINATE", missing.getCoordinateValidation().getReason());
|
|
|
+ assertEquals("MISSING_LONGITUDE", missing.getCoordinateValidation().getReason());
|
|
|
|
|
|
CockpitMonitoringPointDeviceCard invalid = byCode(devices, "EQ-INVALID");
|
|
|
assertEquals("INVALID", invalid.getCoordinateValidation().getState());
|
|
|
assertEquals("LONGITUDE_OUT_OF_RANGE", invalid.getCoordinateValidation().getReason());
|
|
|
assertFalse(invalid.getCoordinateValidation().isRenderable());
|
|
|
|
|
|
- CockpitMonitoringPointDeviceCard unverified = byCode(devices, "EQ-UNVERIFIED");
|
|
|
- assertEquals("UNVERIFIED", unverified.getCoordinateValidation().getState());
|
|
|
- assertEquals("UNVERIFIED_COORDINATE", unverified.getCoordinateValidation().getReason());
|
|
|
- assertFalse(unverified.getCoordinateValidation().isRenderable());
|
|
|
+ CockpitMonitoringPointDeviceCard outside = byCode(devices, "EQ-OUTSIDE");
|
|
|
+ assertEquals(new BigDecimal("110.146"), outside.getLongitude(), "区外原始坐标必须原样保留");
|
|
|
+ assertEquals(new BigDecimal("28.457"), outside.getLatitude());
|
|
|
+ assertEquals("INVALID", outside.getCoordinateValidation().getState());
|
|
|
+ assertEquals("OUTSIDE_PRIMARY_AREA", outside.getCoordinateValidation().getReason());
|
|
|
+ assertFalse(outside.getCoordinateValidation().isRenderable());
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
@@ -144,7 +149,7 @@ class CockpitMonitoringPointDetailSnapshotContractTest {
|
|
|
CockpitMapSnapshot snapshot = snapshotWith("2026-09-02T11:00:00+08:00",
|
|
|
new CockpitMapSnapshot.SourceMonitoringPoint(
|
|
|
"MP-001", "供水干管监测点", null, "11",
|
|
|
- new BigDecimal("110.141"), new BigDecimal("28.452"), false,
|
|
|
+ new BigDecimal("110.371"), new BigDecimal("28.452"), false,
|
|
|
Collections.emptyList()));
|
|
|
when(mapAdapter.load(SNAPSHOT_AT)).thenReturn(snapshot);
|
|
|
|
|
|
@@ -157,7 +162,7 @@ class CockpitMonitoringPointDetailSnapshotContractTest {
|
|
|
CockpitMapSnapshot snapshot = snapshotWith(SNAPSHOT_AT,
|
|
|
new CockpitMapSnapshot.SourceMonitoringPoint(
|
|
|
"MP-OTHER", "另一个点位", null, "11",
|
|
|
- new BigDecimal("110.1"), new BigDecimal("28.4"), false,
|
|
|
+ new BigDecimal("110.340"), new BigDecimal("28.4"), false,
|
|
|
Collections.emptyList()));
|
|
|
when(mapAdapter.load(SNAPSHOT_AT)).thenReturn(snapshot);
|
|
|
|
|
|
@@ -171,8 +176,8 @@ class CockpitMonitoringPointDetailSnapshotContractTest {
|
|
|
when(detailAdapter.load("MP-001"))
|
|
|
.thenReturn(new com.zksy.cockpit.point.CockpitMonitoringPointDetail(
|
|
|
"MP-001", "供水干管监测点",
|
|
|
- new BigDecimal("110.141"), new BigDecimal("28.452"), false,
|
|
|
- Collections.singletonList(device("EQ-001", "110.142", "28.453",
|
|
|
+ new BigDecimal("110.371"), new BigDecimal("28.452"), false,
|
|
|
+ Collections.singletonList(device("EQ-001", "110.372", "28.453",
|
|
|
false, true, false, false, false))));
|
|
|
|
|
|
CockpitMonitoringPointDetailResponse response =
|
|
|
@@ -187,8 +192,8 @@ class CockpitMonitoringPointDetailSnapshotContractTest {
|
|
|
when(detailAdapter.load("MP-001"))
|
|
|
.thenReturn(new com.zksy.cockpit.point.CockpitMonitoringPointDetail(
|
|
|
"MP-001", "供水干管监测点",
|
|
|
- new BigDecimal("110.141"), new BigDecimal("28.452"), false,
|
|
|
- Collections.singletonList(device("EQ-001", "110.142", "28.453",
|
|
|
+ new BigDecimal("110.371"), new BigDecimal("28.452"), false,
|
|
|
+ Collections.singletonList(device("EQ-001", "110.372", "28.453",
|
|
|
false, true, false, false, false))));
|
|
|
|
|
|
CockpitMonitoringPointDetailResponse response =
|
|
|
@@ -210,12 +215,12 @@ class CockpitMonitoringPointDetailSnapshotContractTest {
|
|
|
CockpitMapSnapshot snapshot = snapshotWith(SNAPSHOT_AT,
|
|
|
new CockpitMapSnapshot.SourceMonitoringPoint(
|
|
|
"MP-001", "供水干管监测点", null, "11",
|
|
|
- new BigDecimal("110.141"), new BigDecimal("28.452"), false,
|
|
|
+ new BigDecimal("110.371"), new BigDecimal("28.452"), false,
|
|
|
Arrays.asList(
|
|
|
- device("EQ-001", "110.142", "28.453", false, true, false, false, false),
|
|
|
- device(" EQ-001 ", "110.143", "28.454", false, true, false, false, false),
|
|
|
- device(null, "110.144", "28.455", false, false, false, false, false),
|
|
|
- device("", "110.145", "28.456", false, false, false, false, false),
|
|
|
+ device("EQ-001", "110.372", "28.453", false, true, false, false, false),
|
|
|
+ device(" EQ-001 ", "110.373", "28.454", false, true, false, false, false),
|
|
|
+ device(null, "110.374", "28.455", false, false, false, false, false),
|
|
|
+ device("", "110.375", "28.456", false, false, false, false, false),
|
|
|
device("EQ-002", null, null, false, false, false, false, false))));
|
|
|
when(mapAdapter.load(SNAPSHOT_AT)).thenReturn(snapshot);
|
|
|
|
|
|
@@ -244,9 +249,9 @@ class CockpitMonitoringPointDetailSnapshotContractTest {
|
|
|
CockpitMapSnapshot snapshot = snapshotWith(SNAPSHOT_AT,
|
|
|
new CockpitMapSnapshot.SourceMonitoringPoint(
|
|
|
"MP-001", "供水干管监测点", null, "11",
|
|
|
- new BigDecimal("110.141"), new BigDecimal("28.452"), false,
|
|
|
+ new BigDecimal("110.371"), new BigDecimal("28.452"), false,
|
|
|
Collections.singletonList(
|
|
|
- device("EQ-VERIFIED", "110.142", "28.453",
|
|
|
+ device("EQ-VERIFIED", "110.372", "28.453",
|
|
|
true, true, false, false, false))));
|
|
|
when(mapAdapter.load(SNAPSHOT_AT)).thenReturn(snapshot);
|
|
|
|
|
|
@@ -254,7 +259,7 @@ class CockpitMonitoringPointDetailSnapshotContractTest {
|
|
|
detailService.load("req", "MP-001", SNAPSHOT_AT);
|
|
|
|
|
|
CockpitMonitoringPointDeviceCard verified = byCode(response.getDevices(), "EQ-VERIFIED");
|
|
|
- assertEquals(new BigDecimal("110.142"), verified.getLongitude());
|
|
|
+ assertEquals(new BigDecimal("110.372"), verified.getLongitude());
|
|
|
assertEquals(new BigDecimal("28.453"), verified.getLatitude());
|
|
|
assertEquals("VALID", verified.getCoordinateValidation().getState());
|
|
|
assertTrue(verified.getCoordinateValidation().isRenderable());
|