|
|
@@ -14,6 +14,7 @@ import com.zksy.base.domain.EquipmentType;
|
|
|
import com.zksy.base.domain.WorkOrder;
|
|
|
import com.zksy.base.domain.vo.AbnormalDeviceVO;
|
|
|
import com.zksy.base.domain.vo.DeviceGisVO;
|
|
|
+import com.zksy.base.domain.vo.DeviceLedgerStatisticsVO;
|
|
|
import com.zksy.base.domain.vo.DeviceTypeStatisticsVO;
|
|
|
import com.zksy.base.domain.vo.MaintainOrderVO;
|
|
|
import com.zksy.base.mapper.EquipmentMaintainMapper;
|
|
|
@@ -127,6 +128,20 @@ class WaterSupplyDeviceServiceImplTest {
|
|
|
assertEquals(Arrays.asList("water-flow", "water-pressure"), childTypeIds);
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ void ledgerStatisticsCountsOnlyWaterDevicesAndMissingStatusAsOffline() {
|
|
|
+ when(equipmentStatusMapper.selectList(any())).thenReturn(Arrays.asList(
|
|
|
+ status(pressureDevice.getEquipmentId(), 1, 1, 1),
|
|
|
+ status(gasDevice.getEquipmentId(), 1, 1, 1)));
|
|
|
+
|
|
|
+ DeviceLedgerStatisticsVO stats = service.getDeviceLedgerStatistics();
|
|
|
+
|
|
|
+ assertEquals(2, stats.getTotal());
|
|
|
+ assertEquals(1, stats.getOnline());
|
|
|
+ assertEquals(1, stats.getOffline());
|
|
|
+ assertEquals(50.0, stats.getOnlineRate());
|
|
|
+ }
|
|
|
+
|
|
|
@Test
|
|
|
void ledgerResolvesTypeNameByEquipmentTypePrimaryKey() {
|
|
|
pressureDevice.setEquipmentTypeId("db-pressure-id");
|