谭斌 пре 2 година
родитељ
комит
f3f852074b

+ 10 - 9
device-api-service-merc-mini/src/main/java/com/xy/controller/MercMiniDeviceController.java

@@ -115,15 +115,16 @@ public class MercMiniDeviceController {
             vo.setDistrictName(CollUtil.isEmpty(districtMap) ? StrUtil.EMPTY : districtMap.get(districtId));
             DeviceStatusDto.Vo deviceStatus = vo.getDeviceStatus();
             vo.setNetStateName(deviceStatus == null ? StrUtil.EMPTY : DeviceNetSateType.getEnumByCode(deviceStatus.getNetState()).getDescription());
-
-            Integer deviceStateL = deviceStatus.getLockStateL();
-            Integer deviceStateR = deviceStatus.getLockStateR();
-            vo.setDeviceStateL(deviceStateL);
-            vo.setDeviceStateR(deviceStateR);
-            DeviceLockState deviceLockStateL = DeviceLockState.getEnumByCode(deviceStateL);
-            DeviceLockState deviceLockStateR = DeviceLockState.getEnumByCode(deviceStateR);
-            vo.setDeviceStateRName(deviceLockStateR == null ? "未知" : deviceLockStateR.getDescription());
-            vo.setDeviceStateLName(deviceLockStateL == null ? "未知" : deviceLockStateL.getDescription());
+            if (deviceStatus != null) {
+                Integer deviceStateL = deviceStatus.getLockStateL();
+                Integer deviceStateR = deviceStatus.getLockStateR();
+                vo.setDeviceStateL(deviceStateL);
+                vo.setDeviceStateR(deviceStateR);
+                DeviceLockState deviceLockStateL = DeviceLockState.getEnumByCode(deviceStateL);
+                DeviceLockState deviceLockStateR = DeviceLockState.getEnumByCode(deviceStateR);
+                vo.setDeviceStateRName(deviceLockStateR == null ? "未知" : deviceLockStateR.getDescription());
+                vo.setDeviceStateLName(deviceLockStateL == null ? "未知" : deviceLockStateL.getDescription());
+            }
 
         }
         return R.ok(vo);