diff --git a/src/main/java/club/joylink/xiannccda/mock/message/occ/MockOccServer.java b/src/main/java/club/joylink/xiannccda/mock/message/occ/MockOccServer.java index 1102be8..dd31701 100644 --- a/src/main/java/club/joylink/xiannccda/mock/message/occ/MockOccServer.java +++ b/src/main/java/club/joylink/xiannccda/mock/message/occ/MockOccServer.java @@ -43,6 +43,7 @@ import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import java.util.stream.Collectors; import lombok.Data; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.stereotype.Component; @@ -55,6 +56,7 @@ import org.springframework.web.bind.annotation.RestController; //@Component @RestController() @RequestMapping("/mock/server") +@Slf4j public class MockOccServer { @PostMapping("send") @@ -134,6 +136,10 @@ public class MockOccServer { } for (DeviceNameInfo di : md.getDeviceInfos()) { Integer rtuId_ = findDeviceRtuId((int) lineId, di.getDeviceType(), di.getDeviceName(), md.getAlertType()); + if (Objects.isNull(rtuId_)) { + log.error("{}没有找到对应的集中站,不予处理", di.getDeviceName()); + continue; + } if (messageId == MessageId.DEVICE_STATUS_CHANGE) { MockDeviceStatusReq mockDeviceStatusReq = new MockDeviceStatusReq(messageId, lineId, rtuId_.shortValue(), di.getDeviceType(), di.getDeviceName(), md.deviceStatus());