|
|
@@ -82,9 +82,17 @@ class CockpitCurrentEventsControllerTest {
|
|
|
.andExpect(jsonPath("$.data.sections.events.data[0].level").value(1))
|
|
|
.andExpect(jsonPath("$.data.sections.events.data[0].levelColor").value("RED"))
|
|
|
.andExpect(jsonPath("$.data.sections.events.data[0].deviceCode").value("D-GAS-1"))
|
|
|
+ .andExpect(jsonPath("$.data.sections.events.data[0].monitoringPointCode").value("MP-A-001"))
|
|
|
+ .andExpect(jsonPath("$.data.sections.events.data[0].monitoringPointName").value("城区A-燃气1号点"))
|
|
|
.andExpect(jsonPath("$.data.sections.events.data[0].industry").value("GAS"))
|
|
|
+ .andExpect(jsonPath("$.data.sections.events.data[0].coordinateValidation.state").value("VALID"))
|
|
|
+ .andExpect(jsonPath("$.data.sections.events.data[0].coordinateValidation.reason").value(nullValue()))
|
|
|
+ .andExpect(jsonPath("$.data.sections.events.data[0].coordinateValidation.renderable").value(true))
|
|
|
+ .andExpect(jsonPath("$.data.sections.events.data[0].coordinateValidation.crs").value("WGS84"))
|
|
|
+ .andExpect(jsonPath("$.data.sections.events.data[0].thresholdMinValue").value(nullValue()))
|
|
|
+ .andExpect(jsonPath("$.data.sections.events.data[0].thresholdMaxValue").value(nullValue()))
|
|
|
.andExpect(jsonPath("$.data.sections.events.data[0].workOrderSummary.workOrderCode").value("WO-1"))
|
|
|
- .andExpect(jsonPath("$.data.sections.events.data[0].workOrderSummary.stateCode").value(4))
|
|
|
+ .andExpect(jsonPath("$.data.sections.events.data[0].workOrderSummary.stateCode").value(3))
|
|
|
.andExpect(jsonPath("$.data.sections.events.data[0].workOrderSummary.stateName").value("处理中"))
|
|
|
.andExpect(jsonPath("$.data.sections.events.data[1].eventNo").value("W-002"))
|
|
|
.andExpect(jsonPath("$.data.sections.events.data[1].levelColor").value("YELLOW"))
|
|
|
@@ -93,8 +101,15 @@ class CockpitCurrentEventsControllerTest {
|
|
|
.andExpect(jsonPath("$.data.sections.events.data[2].levelColor").value("BLUE"))
|
|
|
.andExpect(jsonPath("$.data.sections.events.data[3].eventNo").value("W-004"))
|
|
|
.andExpect(jsonPath("$.data.sections.events.data[3].levelColor").value("GREEN"))
|
|
|
+ .andExpect(jsonPath("$.data.sections.events.data[3].coordinateValidation.state").value("INVALID"))
|
|
|
+ .andExpect(jsonPath("$.data.sections.events.data[3].coordinateValidation.reason").value("LONGITUDE_OUT_OF_RANGE"))
|
|
|
+ .andExpect(jsonPath("$.data.sections.events.data[3].coordinateValidation.renderable").value(false))
|
|
|
+ .andExpect(jsonPath("$.data.sections.events.data[3].monitoringPointCode").value(nullValue()))
|
|
|
.andExpect(jsonPath("$.data.sections.events.data[4].eventNo").value("W-005"))
|
|
|
.andExpect(jsonPath("$.data.sections.events.data[4].levelColor").value("UNKNOWN"))
|
|
|
+ .andExpect(jsonPath("$.data.sections.events.data[4].coordinateValidation.state").value("UNVERIFIED"))
|
|
|
+ .andExpect(jsonPath("$.data.sections.events.data[4].coordinateValidation.reason").value("UNVERIFIED_COORDINATE"))
|
|
|
+ .andExpect(jsonPath("$.data.sections.events.data[4].coordinateValidation.renderable").value(false))
|
|
|
.andExpect(jsonPath("$.data.sections.events.data[4].workOrderSummary.stateName").value("已结案"))
|
|
|
.andExpect(jsonPath("$.data.sections.workOrders.state").value("SUCCESS"))
|
|
|
.andExpect(jsonPath("$.data.sections.workOrders.reason").value("SUCCESS"))
|
|
|
@@ -113,7 +128,13 @@ class CockpitCurrentEventsControllerTest {
|
|
|
.andExpect(jsonPath("$.data.sections.events.data[0].eventNo").value("A-001"))
|
|
|
.andExpect(jsonPath("$.data.sections.events.data[0].levelColor").value("RED"))
|
|
|
.andExpect(jsonPath("$.data.sections.events.data[0].workOrderSummary.stateName").value("已取消"))
|
|
|
+ .andExpect(jsonPath("$.data.sections.events.data[0].coordinateValidation.state").value("VALID"))
|
|
|
+ .andExpect(jsonPath("$.data.sections.events.data[0].coordinateValidation.renderable").value(true))
|
|
|
+ .andExpect(jsonPath("$.data.sections.events.data[0].thresholdMinValue").value(0.0))
|
|
|
+ .andExpect(jsonPath("$.data.sections.events.data[0].thresholdMaxValue").value(20.0))
|
|
|
.andExpect(jsonPath("$.data.sections.events.data[1].eventNo").value("A-002"))
|
|
|
+ .andExpect(jsonPath("$.data.sections.events.data[1].coordinateValidation.state").value("UNVERIFIED"))
|
|
|
+ .andExpect(jsonPath("$.data.sections.events.data[1].thresholdMinValue").value(nullValue()))
|
|
|
.andExpect(jsonPath("$.data.sections.events.data[1].workOrderSummary").value(nullValue()))
|
|
|
.andExpect(jsonPath("$.data.sections.workOrders.state").value("SUCCESS"))
|
|
|
.andExpect(jsonPath("$.data.mapFilter.deviceCodes", hasSize(2)));
|
|
|
@@ -255,10 +276,10 @@ class CockpitCurrentEventsControllerTest {
|
|
|
.andExpect(status().isBadRequest())
|
|
|
.andExpect(jsonPath("$.data.message").value("level must be an integer between 1 and 4"));
|
|
|
|
|
|
- mockMvc.perform(get(ENDPOINT).param("mode", "WARNING").param("industry", "MANHOLE"))
|
|
|
+ mockMvc.perform(get(ENDPOINT).param("mode", "WARNING").param("industry", "WHATEVER"))
|
|
|
.andExpect(status().isBadRequest())
|
|
|
.andExpect(jsonPath("$.data.message").value(
|
|
|
- "industry must be GAS, WATER_SUPPLY or DRAINAGE"));
|
|
|
+ "industry must be GAS, WATER_SUPPLY, DRAINAGE or MANHOLE"));
|
|
|
|
|
|
mockMvc.perform(get(ENDPOINT)
|
|
|
.param("mode", "WARNING")
|
|
|
@@ -328,45 +349,45 @@ class CockpitCurrentEventsControllerTest {
|
|
|
Arrays.asList(
|
|
|
warning("W-001", "燃气浓度预警", "GAS_CONCENTRATION", 1, "ACTIVE",
|
|
|
"2026-09-02T09:50:00+08:00", "2026-09-02T09:52:00+08:00",
|
|
|
- "12.5", "mg/m³", "D-GAS-1", "燃气浓度计-001", "城区A-燃气1号点",
|
|
|
- "GAS_SENSOR", "110.130", "28.440"),
|
|
|
+ "12.5", "mg/m³", "D-GAS-1", "燃气浓度计-001", "MP-A-001", "城区A-燃气1号点", "城区A-燃气1号点",
|
|
|
+ "GAS_SENSOR", "110.130", "28.440", true),
|
|
|
warning("W-002", "燃气压力预警", "GAS_PRESSURE", 2, "ACTIVE",
|
|
|
"2026-09-02T09:45:00+08:00", "2026-09-02T09:46:00+08:00",
|
|
|
- "0.32", "MPa", "D-GAS-2", "燃气浓度计-002", "城区A-燃气2号点",
|
|
|
+ "0.32", "MPa", "D-GAS-2", "燃气浓度计-002", "MP-A-002", "城区A-燃气2号点", "城区A-燃气2号点",
|
|
|
"GAS_SENSOR", "110.131", "28.441"),
|
|
|
warning("W-003", "供水压力预警", "WATER_PRESSURE", 3, "PENDING",
|
|
|
"2026-09-02T09:40:00+08:00", "2026-09-02T09:41:00+08:00",
|
|
|
- "0.18", "MPa", "D-WS-1", "供水压力计-001", "城区B-供水1号点",
|
|
|
+ "0.18", "MPa", "D-WS-1", "供水压力计-001", "MP-B-001", "城区B-供水1号点", "城区B-供水1号点",
|
|
|
"WATER_SUPPLY_SENSOR", "110.150", "28.460"),
|
|
|
warning("W-004", "污水浓度预警", "SEWAGE_CONCENTRATION", 4, "RELEASED",
|
|
|
"2026-09-02T09:35:00+08:00", "2026-09-02T09:36:00+08:00",
|
|
|
- "18.2", "mg/L", "D-DR-1", "污水环境监测仪-001", "城区C-污水1号点",
|
|
|
- "SEWAGE_ENV", "110.170", "28.480"),
|
|
|
+ "18.2", "mg/L", "D-DR-1", "污水环境监测仪-001", null, null, "城区C-污水1号点",
|
|
|
+ "SEWAGE_ENV", "181", "28.480", true),
|
|
|
warning("W-005", "供水流量预警", "WATER_FLOW", 9, "ACTIVE",
|
|
|
"2026-09-02T09:30:00+08:00", "2026-09-02T09:31:00+08:00",
|
|
|
- "66.6", "L/s", "D-WS-2", "供水压力计-002", "城区B-供水2号点",
|
|
|
+ "66.6", "L/s", "D-WS-2", "供水压力计-002", "MP-B-002", "城区B-供水2号点", "城区B-供水2号点",
|
|
|
"WATER_SUPPLY_SENSOR", "110.151", "28.461"),
|
|
|
warning("W-006", "未知类型预警", "LEGACY_EVENT", 1, "ACTIVE",
|
|
|
"2026-09-02T09:55:00+08:00", null,
|
|
|
- "1", "x", "D-LEGACY", "旧设备", "旧位置",
|
|
|
+ "1", "x", "D-LEGACY", "旧设备", null, null, "旧位置",
|
|
|
"LEGACY", "110.100", "28.400"),
|
|
|
warning("W-007", "智能井盖预警", "MANHOLE_EVENT", 1, "ACTIVE",
|
|
|
"2026-09-02T09:55:00+08:00", null,
|
|
|
- "1", "x", "D-MH", "智能井盖", "井盖位置",
|
|
|
+ "1", "x", "D-MH", "智能井盖", null, null, "井盖位置",
|
|
|
"SMART_MANHOLE", "110.101", "28.401")),
|
|
|
Arrays.asList(
|
|
|
alarm("A-001", "燃气浓度报警", "GAS_CONCENTRATION", 1, "HANDLED",
|
|
|
"2026-09-02T09:55:00+08:00", "2026-09-02T09:56:00+08:00",
|
|
|
- "22.6", "mg/m³", "D-GAS-3", "燃气浓度计-003", "城区A-燃气3号点",
|
|
|
- "GAS_SENSOR", "110.132", "28.442"),
|
|
|
+ "22.6", "mg/m³", "D-GAS-3", "燃气浓度计-003", "MP-A-003", "城区A-燃气3号点", "城区A-燃气3号点",
|
|
|
+ "GAS_SENSOR", "110.132", "28.442", true, "0.00", "20.00"),
|
|
|
alarm("A-002", "污水浓度报警", "SEWAGE_CONCENTRATION", 2, "PROCESSING",
|
|
|
"2026-09-02T09:32:00+08:00", "2026-09-02T09:33:00+08:00",
|
|
|
- "42.1", "mg/L", "D-DR-1", "污水环境监测仪-001", "城区C-污水1号点",
|
|
|
+ "42.1", "mg/L", "D-DR-1", "污水环境监测仪-001", "MP-C-001", "城区C-污水1号点", "城区C-污水1号点",
|
|
|
"SEWAGE_ENV", "110.170", "28.480")),
|
|
|
Arrays.asList(
|
|
|
- workOrder("W-001", "WO-1", 2, "燃气浓度处置", 4),
|
|
|
+ workOrder("W-001", "WO-1", 2, "燃气浓度处置", 3),
|
|
|
workOrder("W-003", "WO-2", 3, "供水压力处置", 1),
|
|
|
- workOrder("W-005", "WO-3", 2, "供水流量处置", 6),
|
|
|
+ workOrder("W-005", "WO-3", 2, "供水流量处置", 5),
|
|
|
workOrder("A-001", "WO-4", 1, "燃气浓度处置", 7)));
|
|
|
}
|
|
|
|
|
|
@@ -391,12 +412,12 @@ class CockpitCurrentEventsControllerTest {
|
|
|
Collections.singletonList(
|
|
|
warning("W-001", "燃气浓度预警", "GAS_CONCENTRATION", 1, "ACTIVE",
|
|
|
"2026-09-02T09:50:00+08:00", "2026-09-02T09:52:00+08:00",
|
|
|
- "12.5", "mg/m³", "D-GAS-1", "燃气浓度计-001", "城区A-燃气1号点",
|
|
|
+ "12.5", "mg/m³", "D-GAS-1", "燃气浓度计-001", "MP-A-001", "城区A-燃气1号点", "城区A-燃气1号点",
|
|
|
"GAS_SENSOR", "110.130", "28.440")),
|
|
|
Collections.singletonList(
|
|
|
alarm("A-001", "燃气浓度报警", "GAS_CONCENTRATION", 1, "HANDLED",
|
|
|
"2026-09-02T09:55:00+08:00", "2026-09-02T09:56:00+08:00",
|
|
|
- "22.6", "mg/m³", "D-GAS-3", "燃气浓度计-003", "城区A-燃气3号点",
|
|
|
+ "22.6", "mg/m³", "D-GAS-3", "燃气浓度计-003", "MP-A-003", "城区A-燃气3号点", "城区A-燃气3号点",
|
|
|
"GAS_SENSOR", "110.132", "28.442")),
|
|
|
Collections.emptyList());
|
|
|
}
|
|
|
@@ -414,23 +435,52 @@ class CockpitCurrentEventsControllerTest {
|
|
|
private static CockpitCurrentEventsSnapshot.SourceWarning warning(
|
|
|
String no, String name, String type, Integer level, String status,
|
|
|
String eventTime, String updatedTime, String value, String unit,
|
|
|
- String deviceCode, String deviceName, String location, String typeCode,
|
|
|
+ String deviceCode, String deviceName, String monitoringPointCode, String monitoringPointName,
|
|
|
+ String location, String typeCode,
|
|
|
String longitude, String latitude) {
|
|
|
+ return warning(no, name, type, level, status, eventTime, updatedTime, value, unit,
|
|
|
+ deviceCode, deviceName, monitoringPointCode, monitoringPointName, location, typeCode,
|
|
|
+ longitude, latitude, false);
|
|
|
+ }
|
|
|
+
|
|
|
+ private static CockpitCurrentEventsSnapshot.SourceWarning warning(
|
|
|
+ String no, String name, String type, Integer level, String status,
|
|
|
+ String eventTime, String updatedTime, String value, String unit,
|
|
|
+ String deviceCode, String deviceName, String monitoringPointCode, String monitoringPointName,
|
|
|
+ String location, String typeCode,
|
|
|
+ String longitude, String latitude, boolean coordinateVerified) {
|
|
|
return new CockpitCurrentEventsSnapshot.SourceWarning(
|
|
|
no, name, type, level, status, eventTime, updatedTime,
|
|
|
- new BigDecimal(value), unit, deviceCode, deviceName, location, typeCode,
|
|
|
- new BigDecimal(longitude), new BigDecimal(latitude));
|
|
|
+ new BigDecimal(value), unit, deviceCode, deviceName, monitoringPointCode, monitoringPointName,
|
|
|
+ location, typeCode,
|
|
|
+ new BigDecimal(longitude), new BigDecimal(latitude), coordinateVerified);
|
|
|
}
|
|
|
|
|
|
private static CockpitCurrentEventsSnapshot.SourceAlarm alarm(
|
|
|
String id, String name, String type, Integer level, String status,
|
|
|
String eventTime, String updatedTime, String value, String unit,
|
|
|
- String deviceCode, String deviceName, String location, String typeCode,
|
|
|
+ String deviceCode, String deviceName, String monitoringPointCode, String monitoringPointName,
|
|
|
+ String location, String typeCode,
|
|
|
String longitude, String latitude) {
|
|
|
+ return alarm(id, name, type, level, status, eventTime, updatedTime, value, unit,
|
|
|
+ deviceCode, deviceName, monitoringPointCode, monitoringPointName, location, typeCode,
|
|
|
+ longitude, latitude, false, null, null);
|
|
|
+ }
|
|
|
+
|
|
|
+ private static CockpitCurrentEventsSnapshot.SourceAlarm alarm(
|
|
|
+ String id, String name, String type, Integer level, String status,
|
|
|
+ String eventTime, String updatedTime, String value, String unit,
|
|
|
+ String deviceCode, String deviceName, String monitoringPointCode, String monitoringPointName,
|
|
|
+ String location, String typeCode,
|
|
|
+ String longitude, String latitude,
|
|
|
+ boolean coordinateVerified, String thresholdMinValue, String thresholdMaxValue) {
|
|
|
return new CockpitCurrentEventsSnapshot.SourceAlarm(
|
|
|
id, name, type, level, status, eventTime, updatedTime,
|
|
|
- new BigDecimal(value), unit, deviceCode, deviceName, location, typeCode,
|
|
|
- new BigDecimal(longitude), new BigDecimal(latitude));
|
|
|
+ new BigDecimal(value), unit, deviceCode, deviceName, monitoringPointCode, monitoringPointName,
|
|
|
+ location, typeCode,
|
|
|
+ new BigDecimal(longitude), new BigDecimal(latitude), coordinateVerified,
|
|
|
+ thresholdMinValue == null ? null : new BigDecimal(thresholdMinValue),
|
|
|
+ thresholdMaxValue == null ? null : new BigDecimal(thresholdMaxValue));
|
|
|
}
|
|
|
|
|
|
private static CockpitCurrentEventsSnapshot.SourceWorkOrderLink workOrder(
|