|
@@ -32,6 +32,7 @@ import org.mockito.ArgumentCaptor;
|
|
|
import org.mockito.Mockito;
|
|
import org.mockito.Mockito;
|
|
|
import org.springframework.test.util.ReflectionTestUtils;
|
|
import org.springframework.test.util.ReflectionTestUtils;
|
|
|
|
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
|
import java.util.Collections;
|
|
import java.util.Collections;
|
|
@@ -450,6 +451,29 @@ class WaterSupplyDeviceServiceImplTest {
|
|
|
.collect(Collectors.toList()));
|
|
.collect(Collectors.toList()));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Test
|
|
|
|
|
+ void deviceGisPointsIncludeWaterOnlyWithCoordinatesAndStatuses() {
|
|
|
|
|
+ pressureDevice.setLongitude(new BigDecimal("113.28000000"));
|
|
|
|
|
+ pressureDevice.setLatitude(new BigDecimal("23.12000000"));
|
|
|
|
|
+ gasDevice.setLongitude(new BigDecimal("113.32000000"));
|
|
|
|
|
+ gasDevice.setLatitude(new BigDecimal("23.16000000"));
|
|
|
|
|
+ when(equipmentStatusMapper.selectList(any())).thenReturn(Collections.singletonList(
|
|
|
|
|
+ status(pressureDevice.getEquipmentId(), 1, 1, 1)));
|
|
|
|
|
+ when(equipmentTypeMapper.selectBatchIds(any())).thenReturn(Collections.singletonList(
|
|
|
|
|
+ type("water-pressure", "压力监测", "water-root")));
|
|
|
|
|
+
|
|
|
|
|
+ List<DeviceGisVO> points = service.getAllDeviceGisPoints(null);
|
|
|
|
|
+
|
|
|
|
|
+ assertEquals(Collections.singletonList("water-pressure-1"), points.stream()
|
|
|
|
|
+ .map(DeviceGisVO::getEquipmentId)
|
|
|
|
|
+ .collect(Collectors.toList()));
|
|
|
|
|
+ assertEquals("压力监测", points.get(0).getEquipmentTypeName());
|
|
|
|
|
+ assertEquals(1, points.get(0).getOnlineStatus());
|
|
|
|
|
+ assertEquals(1, points.get(0).getAlarmStatus());
|
|
|
|
|
+ assertEquals(1, points.get(0).getCurrentStatus());
|
|
|
|
|
+ assertEquals(new BigDecimal("113.28000000"), points.get(0).getLongitude());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@Test
|
|
@Test
|
|
|
void deviceDetailIncludesAlarmAndRelatedWorkOrderSummary() {
|
|
void deviceDetailIncludesAlarmAndRelatedWorkOrderSummary() {
|
|
|
doReturn(pressureDevice).when(service).getById(pressureDevice.getEquipmentId());
|
|
doReturn(pressureDevice).when(service).getById(pressureDevice.getEquipmentId());
|