package com.ruoyi.sim.domain; import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.sim.domain.vo.SimSocketParamVo; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.core.domain.BaseEntity; import java.util.Date; /** * 座对象 sim_seat * * @author tom * @date 2024-12-13 */ public class Seat extends BaseEntity { private static final long serialVersionUID = 1L; /** * 座ID */ private Long seatId; /** * 座号 */ @Excel(name = "座号") private Integer seatNum; /** * [电脑]绑定的[IP地址] */ @Excel(name = "[电脑]绑定的[IP地址]") private String seatBindIp; /** * [RS485]绑定的[IP地址] */ @Excel(name = "[RS485]绑定的[IP地址]") private String seatRs485Ip; /** * [RS485]绑定的[端口] */ @Excel(name = "[RS485]绑定的[端口]") private Integer seatRs485Port; /** * Socket状态:[0]:初始化,[1]:打开,[2]:关闭,[5]:禁用 */ @Excel(name = "Socket状态:[0]:初始化,[1]:打开,[2]:关闭,[5]:禁用") private String seatRs485SocketState; /** * 当前座上学员/用户ID */ @Excel(name = "当前座上学员/用户ID") private Long currentUserId; /** * 模拟器的ID:[0]没有连接任何模拟器,[xx]:具体某台模拟器 */ @Excel(name = "模拟器的ID:[0]没有连接任何模拟器,[xx]:具体某台模拟器") private Long currentSimId; /** * 最后一次和模拟器成功连接并通信的时间 */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date lastConnectedTime; public void setSeatId(Long seatId) { this.seatId = seatId; } public Long getSeatId() { return seatId; } public void setSeatNum(Integer seatNum) { this.seatNum = seatNum; } public Integer getSeatNum() { return seatNum; } public void setSeatBindIp(String seatBindIp) { this.seatBindIp = seatBindIp; } public String getSeatBindIp() { return seatBindIp; } public void setSeatRs485Ip(String seatRs485Ip) { this.seatRs485Ip = seatRs485Ip; } public String getSeatRs485Ip() { return seatRs485Ip; } public void setSeatRs485Port(Integer seatRs485Port) { this.seatRs485Port = seatRs485Port; } public Integer getSeatRs485Port() { return seatRs485Port; } public void setSeatRs485SocketState(String seatRs485SocketState) { this.seatRs485SocketState = seatRs485SocketState; } public String getSeatRs485SocketState() { return seatRs485SocketState; } public void setCurrentUserId(Long currentUserId) { this.currentUserId = currentUserId; } public Long getCurrentUserId() { return currentUserId; } public void setCurrentSimId(Long currentSimId) { this.currentSimId = currentSimId; } public Long getCurrentSimId() { return currentSimId; } public void setLastConnectedTime(Date lastConnectedTime) { this.lastConnectedTime = lastConnectedTime; } public Date getLastConnectedTime() { return lastConnectedTime; } @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) .append("seatId", getSeatId()) .append("seatNum", getSeatNum()) .append("seatBindIp", getSeatBindIp()) .append("seatRs485Ip", getSeatRs485Ip()) .append("seatRs485Port", getSeatRs485Port()) .append("seatRs485SocketState", getSeatRs485SocketState()) .append("currentUserId", getCurrentUserId()) .append("currentSimId", getCurrentSimId()) .append("lastConnectedTime", getLastConnectedTime()) .append("createBy", getCreateBy()) .append("createTime", getCreateTime()) .append("updateBy", getUpdateBy()) .append("updateTime", getUpdateTime()) .append("remark", getRemark()) .toString(); } // -------------------------------- tom add -------------------------------- public static final Long ID_0 = 0L; public interface SocketState { String ENABLE_INIT = "0"; String ONLINE = "1"; String OFFLINE = "2"; String DISABLE = "5"; } public SimSocketParamVo toSimSocketParamVo() { return new SimSocketParamVo(this.getSeatRs485Ip(), this.getSeatRs485Port()); } }