Selaa lähdekoodia

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

谭斌 2 vuotta sitten
vanhempi
commit
38748aadb6

+ 9 - 4
device-api-service/src/main/java/com/xy/service/DeviceInfoServiceImpl.java

@@ -28,10 +28,7 @@ import com.xy.mapper.DeviceInfoMapper;
 import com.xy.mapper.entity.DeviceInfoQueryPage;
 import com.xy.util.ExcelUtils;
 import com.xy.utils.*;
-import com.xy.utils.enums.DeviceActiveStateEnum;
-import com.xy.utils.enums.DeviceNetSateType;
-import com.xy.utils.enums.DictEnum;
-import com.xy.utils.enums.DictSonEnum;
+import com.xy.utils.enums.*;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import jodd.introspector.MapperFunction;
@@ -722,6 +719,14 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
                 merHomeSearchVO.setAppUpmVersion(deviceSysinfo.getAppUpmVersion());
                 merHomeSearchVO.setTempValue(deviceStatus.getTempValue());
                 merHomeSearchVO.setNetDbm(deviceStatus.getNetDbm());
+                Integer deviceStateL = deviceStatus.getDeviceStateL();
+                Integer deviceStateR = deviceStatus.getDeviceStateR();
+                merHomeSearchVO.setDeviceStateL(deviceStateL);
+                merHomeSearchVO.setDeviceStateR(deviceStateR);
+                DeviceLockState deviceLockStateL = DeviceLockState.getEnumByCode(deviceStateL);
+                DeviceLockState deviceLockStateR = DeviceLockState.getEnumByCode(deviceStateR);
+                merHomeSearchVO.setDeviceStateRName(deviceLockStateR == null ? "未知" : deviceLockStateR.getDescription());
+                merHomeSearchVO.setDeviceStateLName(deviceLockStateL == null ? "未知" : deviceLockStateL.getDescription());
                 merHomeSearchRecords.add(merHomeSearchVO);
             });
             pageData.setRecords(merHomeSearchRecords);

+ 14 - 0
device-api/src/main/java/com/xy/dto/DeviceInfoDto.java

@@ -400,6 +400,20 @@ public class DeviceInfoDto {
         private Integer busyState;
 
 
+        @ApiModelProperty("左门锁机状态,字典类型:devcie_lock_status")
+        private Integer deviceStateL;
+
+        @ApiModelProperty("左门锁机状态名称")
+        private String deviceStateLName;
+
+
+        @ApiModelProperty("右门锁机状态,字典类型:devcie_lock_status")
+        private Integer deviceStateR;
+
+        @ApiModelProperty("右门锁机状态名称")
+        private String deviceStateRName;
+
+
         @DictFormat(DictConsts.DEVICE_FAULT_LEVEL)
         @ApiModelProperty("故障等级")
         private Integer faultLevel;

+ 48 - 0
device-api/src/main/java/com/xy/utils/enums/DeviceLockState.java

@@ -0,0 +1,48 @@
+package com.xy.utils.enums;
+
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.ToString;
+
+/**
+ * 锁机状态 1 未锁机 2 已锁机
+ *
+ * @author 谭斌
+ */
+@Getter
+@ToString
+@AllArgsConstructor
+public enum DeviceLockState {
+
+
+    LOCK(1, "未锁机"),
+    UN_LOCK(2, "已锁机");
+
+    /**
+     * 编码值
+     */
+    private Integer code;
+
+    /**
+     * 描述
+     */
+    private String description;
+
+
+    /**
+     * 通过code获取enum
+     *
+     * @param code
+     * @return
+     */
+    public static DeviceLockState getEnumByCode(Integer code) {
+        DeviceLockState[] values = values();
+        for (DeviceLockState value : values) {
+            if (value.getCode().equals(code)) {
+                return value;
+            }
+        }
+        return null;
+    }
+}