From cc5ab22cb14f5a8d9657c0965437a236f71c1fd8 Mon Sep 17 00:00:00 2001 From: tiger_zhou Date: Thu, 7 Nov 2024 16:40:42 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=EF=BC=8C=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=95=85=E9=9A=9C=E6=9F=A5=E8=AF=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../joylink/xiannccda/alert/NccAlertInfo.java | 2 +- .../warn/lost/SwitchLostAndJammedTask.java | 11 +++++--- .../controller/FaultQueryController.java | 27 +++++++++---------- .../xiannccda/dto/fq/FaultQueryReqDTO.java | 2 ++ .../repository/impl/FaultQueryRepository.java | 4 ++- 5 files changed, 26 insertions(+), 20 deletions(-) diff --git a/src/main/java/club/joylink/xiannccda/alert/NccAlertInfo.java b/src/main/java/club/joylink/xiannccda/alert/NccAlertInfo.java index b0730eb..10d972c 100644 --- a/src/main/java/club/joylink/xiannccda/alert/NccAlertInfo.java +++ b/src/main/java/club/joylink/xiannccda/alert/NccAlertInfo.java @@ -133,7 +133,7 @@ public class NccAlertInfo implements AlertInfo, Cloneable { case BLUE_DISPLAY, PLATFORM_DOOR_CANNOT_CLOSE, PLATFORM_DOOR_CANNOT_OPEN, PLATFORM_DOOR_WITHOUT_LOCKED_SIGNAL, TRAIN_DELAY_10, SWITCH_LOST, SWITCH_FW_LOST, SWITCH_All_LOST, SWITCH_DW_LOST, SWITCH_LOST_MOST, SWITCH_LOST_INTERLOCK_AREA, AXLE_LED_RED, AXLE_LED_ORANGE, AXLE_LED_ORANGE_MOST, AXLE_LED_RED_MOST, TRAIN_EB_ATP, - ALL_LINE_BLUE_DISPLAY, AXLE_LED_RED_INTERLOCK_AREA, AXLE_LED_ORANGE_INTERLOCK_AREA -> { + ALL_LINE_BLUE_DISPLAY, AXLE_LED_RED_INTERLOCK_AREA, AXLE_LED_ORANGE_INTERLOCK_AREA, SWITCH_JAMMED -> { return "I"; } case PLATFORM_EMERG_STOP -> { diff --git a/src/main/java/club/joylink/xiannccda/ats/warn/lost/SwitchLostAndJammedTask.java b/src/main/java/club/joylink/xiannccda/ats/warn/lost/SwitchLostAndJammedTask.java index a4ca176..43aa186 100644 --- a/src/main/java/club/joylink/xiannccda/ats/warn/lost/SwitchLostAndJammedTask.java +++ b/src/main/java/club/joylink/xiannccda/ats/warn/lost/SwitchLostAndJammedTask.java @@ -92,10 +92,13 @@ public class SwitchLostAndJammedTask implements AlertMonitoringTask { private void checkJammed(Switch.Builder switchBuild, String layoutId) { if (switchBuild.getIpSingleSwitchStusJammed()) { - String alertMsg = String.format("设备[%s]挤岔", switchBuild.getId()); - NccAlertInfo alertInfo = this.alertInfoService.createAlert2(Optional.empty(), AlertType.SWITCH_JAMMED, switchBuild, alertMsg, layoutId, - AlertDeviceType.DEVICE_TYPE_SWITCH, false); - alertManager.emit(alertInfo); + if (alertDataSource.putAlterDevice(switchBuild.getLineId(), JAMMED_NAME, switchBuild.getId())) { + String alertMsg = String.format("设备[%s]挤岔", switchBuild.getId()); + NccAlertInfo alertInfo = this.alertInfoService.createAlert2(Optional.empty(), AlertType.SWITCH_JAMMED, switchBuild, alertMsg, layoutId, + AlertDeviceType.DEVICE_TYPE_SWITCH, false); + alertManager.emit(alertInfo); + } + } else { alertDataSource.removeAlterDevice(switchBuild.getLineId(), JAMMED_NAME, switchBuild.getId()); } diff --git a/src/main/java/club/joylink/xiannccda/controller/FaultQueryController.java b/src/main/java/club/joylink/xiannccda/controller/FaultQueryController.java index ec7decb..09aca71 100644 --- a/src/main/java/club/joylink/xiannccda/controller/FaultQueryController.java +++ b/src/main/java/club/joylink/xiannccda/controller/FaultQueryController.java @@ -13,12 +13,14 @@ import club.joylink.xiannccda.entity.AlertTip; import club.joylink.xiannccda.entity.FaultQuery; import club.joylink.xiannccda.repository.IFaultQueryRepository; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.google.common.collect.Maps; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; import java.util.Collections; import java.util.List; +import java.util.Map; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; @@ -37,7 +39,7 @@ import org.springframework.web.bind.annotation.RestController; * @since 2024-11-06 */ @RestController -@RequestMapping("/fault/query") +@RequestMapping("/api/fault/query") @Tag(name = "故障查询管理") public class FaultQueryController { @@ -50,19 +52,17 @@ public class FaultQueryController { @SecurityRequirement(name = "jwt") @Operation(summary = "查询故障类型") - @GetMapping("/type/{lineId}") + @GetMapping("/type") // @CommonLogAnno(name = "决策信息-查看", logType = CommonLogTypeEnum.OPERATE, subLogType = SubEventType.QUERY) - public List faultType(@PathVariable("lineId") Integer lineId) { - if (lineId == 3) { - return List.of(new FaultType(FaultQueryType.FAULT_EMERGENCY_GUIDE, "车辆故障应急处置指导关键点"), new FaultType(FaultQueryType.FAULT_EXIT_SERVICE, "车辆故障退出服务地点")); - } else if (lineId == 4) { - return List.of(new FaultType(FaultQueryType.FAULT_EMERGENCY_GUIDE_T_DK37, "车辆故障应急处置指导关键点-DK37车型"), - new FaultType(FaultQueryType.FAULT_EXIT_SERVICE_T_DK37, "车辆故障退出服务地点-DK37车型") - , new FaultType(FaultQueryType.FAULT_EMERGENCY_GUIDE_T_CCD_5037, "车辆故障应急处置指导关键点CCD-5037车型"), - new FaultType(FaultQueryType.FAULT_EXIT_SERVICE_T_CCD_5037, "车辆故障退出服务地点CCD-5037车型") - ); - } - return Collections.emptyList(); + public Map> faultType() { + Map> mapTypList = Maps.newHashMap(); + mapTypList.put(3, List.of(new FaultType(FaultQueryType.FAULT_EMERGENCY_GUIDE, "车辆故障应急处置指导关键点"), new FaultType(FaultQueryType.FAULT_EXIT_SERVICE, "车辆故障退出服务地点"))); + mapTypList.put(4, List.of(new FaultType(FaultQueryType.FAULT_EMERGENCY_GUIDE_T_DK37, "车辆故障应急处置指导关键点-DK37车型"), + new FaultType(FaultQueryType.FAULT_EXIT_SERVICE_T_DK37, "车辆故障退出服务地点-DK37车型") + , new FaultType(FaultQueryType.FAULT_EMERGENCY_GUIDE_T_CCD_5037, "车辆故障应急处置指导关键点CCD-5037车型"), + new FaultType(FaultQueryType.FAULT_EXIT_SERVICE_T_CCD_5037, "车辆故障退出服务地点CCD-5037车型"))); + + return mapTypList; } @SecurityRequirement(name = "jwt") @@ -80,7 +80,6 @@ public class FaultQueryController { // @CommonLogAnno(name = "决策信息-查看", logType = CommonLogTypeEnum.OPERATE, subLogType = SubEventType.QUERY) public FaultQuery getById(@PathVariable int id) { return faultQueryRepository.getById(id); - } @SecurityRequirement(name = "jwt") diff --git a/src/main/java/club/joylink/xiannccda/dto/fq/FaultQueryReqDTO.java b/src/main/java/club/joylink/xiannccda/dto/fq/FaultQueryReqDTO.java index 196c7bd..953624c 100644 --- a/src/main/java/club/joylink/xiannccda/dto/fq/FaultQueryReqDTO.java +++ b/src/main/java/club/joylink/xiannccda/dto/fq/FaultQueryReqDTO.java @@ -9,4 +9,6 @@ public class FaultQueryReqDTO extends CommonPage { private Integer lineId; private FaultQueryType queryType; + + private String faultName; } diff --git a/src/main/java/club/joylink/xiannccda/repository/impl/FaultQueryRepository.java b/src/main/java/club/joylink/xiannccda/repository/impl/FaultQueryRepository.java index e21bcb9..104ab86 100644 --- a/src/main/java/club/joylink/xiannccda/repository/impl/FaultQueryRepository.java +++ b/src/main/java/club/joylink/xiannccda/repository/impl/FaultQueryRepository.java @@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import java.util.Objects; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; /** @@ -39,7 +40,8 @@ public class FaultQueryRepository extends ServiceImpl page(FaultQueryReqDTO reqDTO) { QueryWrapper qw = new QueryWrapper<>(); qw.lambda().eq(Objects.nonNull(reqDTO.getLineId()), FaultQuery::getLineId, reqDTO.getLineId()) - .eq(Objects.nonNull(reqDTO.getQueryType()), FaultQuery::getFaultType, reqDTO.getQueryType()); + .eq(Objects.nonNull(reqDTO.getQueryType()), FaultQuery::getFaultType, reqDTO.getQueryType()) + .eq(StringUtils.isNotEmpty(reqDTO.getFaultName()), FaultQuery::getFaultNameShower, reqDTO.getFaultName()); return this.page(CommonPageRequest.defaultPage(), qw); } }