Commit ebd707b8 by huangjy

feat,设备状态枚举

parent a8b90e59
package com.makeit.module.iot.vo;
import lombok.Data;
@Data
public class DeviceState {
private String text;
private String value;
}
package com.makeit.task;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.makeit.common.entity.BaseBusEntity;
import com.makeit.entity.platform.device.PlatDevice;
......@@ -8,6 +9,7 @@ import com.makeit.enums.CommonEnum;
import com.makeit.global.aspect.tenant.TenantIdIgnore;
import com.makeit.module.iot.service.IotOrgService;
import com.makeit.module.iot.vo.DeviceInstanceEntity;
import com.makeit.module.iot.vo.DeviceState;
import com.makeit.module.system.service.SysDictionaryCategoryService;
import com.makeit.module.system.vo.DictionaryVo;
import com.makeit.service.platform.device.PlatDeviceService;
......@@ -106,7 +108,8 @@ public class IotSyncTask {
platDevice.setRegistrationDate(registryTime);
platDevice.setDescription(iotDevice.getDescribe());
String state = iotDevice.getState();
platDevice.setStatus(state);
DeviceState deviceState = JSON.parseObject(state, DeviceState.class);
platDevice.setStatus(deviceState.getValue());
//todo 根据类型名称来匹配
platDevice.setCategory(dicNameIdMap.get(iotDevice.getProductName()));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment