Răsfoiți Sursa

Merge remote-tracking branch 'origin/test' into test

李进 2 ani în urmă
părinte
comite
ef805f0aaf

+ 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);

+ 13 - 10
device-api-service/src/main/java/com/xy/service/DeviceInfoServiceImpl.java

@@ -510,7 +510,7 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
     public R<List<DeviceInfoDto.Vo>> list(DeviceInfoDto.ListDto dto) {
         List<DeviceInfo> list = list(new LambdaQueryWrapper<DeviceInfo>()
                 .in(CollUtil.isNotEmpty(dto.getDeviceIds()), DeviceInfo::getDeviceId, dto.getDeviceIds())
-                .eq(Emptys.check(dto.getMercId()),DeviceInfo::getMercId,dto.getMercId())
+                .eq(Emptys.check(dto.getMercId()), DeviceInfo::getMercId, dto.getMercId())
         );
         return R.ok(copy(DeviceInfoDto.Vo.class, list));
     }
@@ -686,17 +686,20 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
                 if (netState == null) {
                     device.setNetStateName(StrUtil.EMPTY);
                 } else {
-                    device.setNetStateName(DeviceNetSateType.getEnumByCode(deviceStatus.getNetState()).getDescription());
+                    device.setNetStateName(DeviceNetSateType.getEnumByCode(netState).getDescription());
+                }
+
+                if (deviceStatus != null) {
+                    Integer deviceStateL = deviceStatus.getLockStateL();
+                    Integer deviceStateR = deviceStatus.getLockStateR();
+                    device.setDeviceStateL(deviceStateL);
+                    device.setDeviceStateR(deviceStateR);
+                    DeviceLockState deviceLockStateL = DeviceLockState.getEnumByCode(deviceStateL);
+                    DeviceLockState deviceLockStateR = DeviceLockState.getEnumByCode(deviceStateR);
+                    device.setDeviceStateRName(deviceLockStateR == null ? "未知" : deviceLockStateR.getDescription());
+                    device.setDeviceStateLName(deviceLockStateL == null ? "未知" : deviceLockStateL.getDescription());
                 }
 
-                Integer deviceStateL = deviceStatus.getLockStateL();
-                Integer deviceStateR = deviceStatus.getLockStateR();
-                device.setDeviceStateL(deviceStateL);
-                device.setDeviceStateR(deviceStateR);
-                DeviceLockState deviceLockStateL = DeviceLockState.getEnumByCode(deviceStateL);
-                DeviceLockState deviceLockStateR = DeviceLockState.getEnumByCode(deviceStateR);
-                device.setDeviceStateRName(deviceLockStateR == null ? "未知" : deviceLockStateR.getDescription());
-                device.setDeviceStateLName(deviceLockStateL == null ? "未知" : deviceLockStateL.getDescription());
 
             }