package com.github.microservice.busInfoModel.device; import cn.hutool.json.JSONObject; import com.github.microservice.models.baseParam.SuperModel; import com.github.microservice.types.common.DataState; import com.github.microservice.types.deviceUse.DeviceSpecType; import com.github.microservice.types.deviceUse.DeviceType; import com.github.microservice.types.deviceUse.OnLineState; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; /** * @author TRX * @date 2024/5/16 */ @Data @Slf4j public class DeviceInfoModel extends SuperModel { @Schema(description = "设备ID") private String deviceId; @Schema(description = "设备名称") private String deviceName; @Schema(description = "产品code") private String productCode; @Schema(description = "产品名称") private String productName; @Schema(description = "产品信息") private IotTemplateSimpleModel iotTemplate; @Schema(description = "在线状态") private OnLineState onLineState; private String onLineStateStr; public String getOnLineStateStr() { if (onLineState != null) { return onLineState.getRemark(); } return ""; } @Schema(description = "设备型号") private DeviceSpecType specType; private String deviceModelStr; public String getDeviceModelStr() { if (specType != null) { return specType.getRemark(); } return ""; } @Schema(description = "设备类型:消费机 闸机") private DeviceType deviceType; private String deviceTypeStr; public String getDeviceTypeStr() { if (deviceType != null) { return deviceType.getRemark(); } return ""; } @Schema(description = "数据状态") private DataState state; private String stateStr; public String getStateStr() { if (state != null) { return state.getRemark(); } return ""; } @Schema(description = "mqtt账号名称") private String mqttUserName; @Schema(description = "账号密码") private String mqttPassword; @Schema(description = "ip地址") private String ip; @Schema(description = "激活时间") private Long activityTime; @Schema(description = "最后上线时间") private Long lastOnlineTime; @Schema(description = "所属分组") private ProjectInfoSimpleModel projectInfo; @Schema(description = "分组code") private String projectInfoCode; @Schema(description = "分组名称") private String projectInfoName; public String getProjectInfoName() { if (ObjectUtils.isNotEmpty(projectInfo)) { return projectInfo.getName(); } return ""; } @Schema(description = "固件版本") private String firmwareVersion; @Schema(description = "连接参数") private JSONObject connectParam; @Schema(description = "最后离线时间") private Long lastOffLineTime; @Schema(description = "设备本地日志上报") private Boolean isReportLogs = Boolean.TRUE; }