mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-17 16:36:03 +08:00
refactor(字段规范): sip_device字段命名规范
This commit is contained in:
@@ -5,6 +5,8 @@ import com.fastbee.common.annotation.Excel;
|
||||
import com.fastbee.common.core.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
@@ -16,6 +18,8 @@ import java.util.Date;
|
||||
* @author zhuangpeng.li
|
||||
* @date 2023-02-24
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ApiModel(value = "SipDevice", description = "监控设备对象 sip_device")
|
||||
public class SipDevice extends BaseEntity
|
||||
{
|
||||
@@ -68,7 +72,7 @@ public class SipDevice extends BaseEntity
|
||||
/** 流模式 */
|
||||
@ApiModelProperty("流模式")
|
||||
@Excel(name = "流模式")
|
||||
private String streammode;
|
||||
private String streamMode;
|
||||
|
||||
/** 在线状态 */
|
||||
@ApiModelProperty("在线状态")
|
||||
@@ -79,13 +83,13 @@ public class SipDevice extends BaseEntity
|
||||
@ApiModelProperty("注册时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "注册时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date registertime;
|
||||
private Date registerTime;
|
||||
|
||||
/** 最后上线时间 */
|
||||
@ApiModelProperty("最后上线时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "最后上线时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date lastconnecttime;
|
||||
private Date lastConnectTime;
|
||||
|
||||
/** 激活时间 */
|
||||
@ApiModelProperty("激活时间")
|
||||
@@ -106,203 +110,12 @@ public class SipDevice extends BaseEntity
|
||||
/** 设备地址 */
|
||||
@ApiModelProperty("设备地址")
|
||||
@Excel(name = "设备地址")
|
||||
private String hostaddress;
|
||||
private String hostAddress;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
@ApiModelProperty("删除标志")
|
||||
private String delFlag;
|
||||
|
||||
public void setDeviceId(Long deviceId)
|
||||
{
|
||||
this.deviceId = deviceId;
|
||||
}
|
||||
|
||||
public Long getDeviceId()
|
||||
{
|
||||
return deviceId;
|
||||
}
|
||||
public void setProductId(Long productId)
|
||||
{
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public Long getProductId()
|
||||
{
|
||||
return productId;
|
||||
}
|
||||
public void setProductName(String productName)
|
||||
{
|
||||
this.productName = productName;
|
||||
}
|
||||
|
||||
public String getProductName()
|
||||
{
|
||||
return productName;
|
||||
}
|
||||
public void setDeviceSipId(String deviceSipId)
|
||||
{
|
||||
this.deviceSipId = deviceSipId;
|
||||
}
|
||||
|
||||
public String getDeviceSipId()
|
||||
{
|
||||
return deviceSipId;
|
||||
}
|
||||
public void setDeviceName(String deviceName)
|
||||
{
|
||||
this.deviceName = deviceName;
|
||||
}
|
||||
|
||||
public String getDeviceName()
|
||||
{
|
||||
return deviceName;
|
||||
}
|
||||
public void setManufacturer(String manufacturer)
|
||||
{
|
||||
this.manufacturer = manufacturer;
|
||||
}
|
||||
|
||||
public String getManufacturer()
|
||||
{
|
||||
return manufacturer;
|
||||
}
|
||||
public void setModel(String model)
|
||||
{
|
||||
this.model = model;
|
||||
}
|
||||
|
||||
public String getModel()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
public void setFirmware(String firmware)
|
||||
{
|
||||
this.firmware = firmware;
|
||||
}
|
||||
|
||||
public String getFirmware()
|
||||
{
|
||||
return firmware;
|
||||
}
|
||||
public void setTransport(String transport)
|
||||
{
|
||||
this.transport = transport;
|
||||
}
|
||||
|
||||
public String getTransport()
|
||||
{
|
||||
return transport;
|
||||
}
|
||||
public void setStreammode(String streammode)
|
||||
{
|
||||
this.streammode = streammode;
|
||||
}
|
||||
|
||||
public String getStreammode()
|
||||
{
|
||||
return streammode;
|
||||
}
|
||||
public void setOnline(String online)
|
||||
{
|
||||
this.online = online;
|
||||
}
|
||||
|
||||
public String getOnline()
|
||||
{
|
||||
return online;
|
||||
}
|
||||
public void setRegistertime(Date registertime)
|
||||
{
|
||||
this.registertime = registertime;
|
||||
}
|
||||
|
||||
public Date getRegistertime()
|
||||
{
|
||||
return registertime;
|
||||
}
|
||||
public void setLastconnecttime(Date lastconnecttime)
|
||||
{
|
||||
this.lastconnecttime = lastconnecttime;
|
||||
}
|
||||
|
||||
public Date getLastconnecttime()
|
||||
{
|
||||
return lastconnecttime;
|
||||
}
|
||||
public void setActiveTime(Date activeTime)
|
||||
{
|
||||
this.activeTime = activeTime;
|
||||
}
|
||||
|
||||
public Date getActiveTime()
|
||||
{
|
||||
return activeTime;
|
||||
}
|
||||
public void setIp(String ip)
|
||||
{
|
||||
this.ip = ip;
|
||||
}
|
||||
|
||||
public String getIp()
|
||||
{
|
||||
return ip;
|
||||
}
|
||||
public void setPort(Integer port)
|
||||
{
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public Integer getPort()
|
||||
{
|
||||
return port;
|
||||
}
|
||||
public void setHostaddress(String hostaddress)
|
||||
{
|
||||
this.hostaddress = hostaddress;
|
||||
}
|
||||
|
||||
public String getHostaddress()
|
||||
{
|
||||
return hostaddress;
|
||||
}
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("deviceId", getDeviceId())
|
||||
.append("productId", getProductId())
|
||||
.append("productName", getProductName())
|
||||
.append("deviceSipId", getDeviceSipId())
|
||||
.append("deviceName", getDeviceName())
|
||||
.append("manufacturer", getManufacturer())
|
||||
.append("model", getModel())
|
||||
.append("firmware", getFirmware())
|
||||
.append("transport", getTransport())
|
||||
.append("streammode", getStreammode())
|
||||
.append("online", getOnline())
|
||||
.append("registertime", getRegistertime())
|
||||
.append("lastconnecttime", getLastconnecttime())
|
||||
.append("activeTime", getActiveTime())
|
||||
.append("ip", getIp())
|
||||
.append("port", getPort())
|
||||
.append("hostaddress", getHostaddress())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
|
||||
public String getHostAndPort() {
|
||||
return getIp() + ":" + getPort();
|
||||
|
||||
@@ -124,11 +124,11 @@ public class RegisterReqHandler extends ReqAbstractHandler implements Initializi
|
||||
}
|
||||
SipDevice device = new SipDevice();
|
||||
;
|
||||
device.setStreammode("UDP");
|
||||
device.setStreamMode("UDP");
|
||||
device.setDeviceSipId(sipId);
|
||||
device.setIp(received);
|
||||
device.setPort(rPort);
|
||||
device.setHostaddress(received.concat(":").concat(String.valueOf(rPort)));
|
||||
device.setHostAddress(received.concat(":").concat(String.valueOf(rPort)));
|
||||
// 注销成功
|
||||
if (expiresHeader != null && expiresHeader.getExpires() == 0) {
|
||||
registerFlag = 2;
|
||||
@@ -147,7 +147,7 @@ public class RegisterReqHandler extends ReqAbstractHandler implements Initializi
|
||||
// 注册成功
|
||||
if (registerFlag == 1) {
|
||||
log.info("注册成功! sipId:" + device.getDeviceSipId());
|
||||
device.setRegistertime(DateUtils.getNowDate());
|
||||
device.setRegisterTime(DateUtils.getNowDate());
|
||||
sipDeviceService.updateDevice(device);
|
||||
List<SipDeviceChannel> channels = sipDeviceChannelService.selectSipDeviceChannelByDeviceSipId(device.getDeviceSipId());
|
||||
if (channels.size() > 0) {
|
||||
|
||||
@@ -52,11 +52,11 @@ public class KeepaliveHandler extends ReqAbstractHandler implements Initializing
|
||||
received = viaHeader.getHost();
|
||||
rPort = viaHeader.getPort();
|
||||
}
|
||||
device.setLastconnecttime(DateUtils.getNowDate());
|
||||
device.setLastConnectTime(DateUtils.getNowDate());
|
||||
device.setIp(received);
|
||||
device.setPort(rPort);
|
||||
device.setHostaddress(received.concat(":").concat(String.valueOf(rPort)));
|
||||
log.info("设备:{} 心跳上报时间:{}",deviceId,device.getLastconnecttime());
|
||||
device.setHostAddress(received.concat(":").concat(String.valueOf(rPort)));
|
||||
log.info("设备:{} 心跳上报时间:{}",deviceId,device.getLastConnectTime());
|
||||
//log.warn("设备:{} 心跳上报时间:{}",deviceId,device.getLastconnecttime());
|
||||
// 更新在线状态
|
||||
sipDeviceService.updateSipDeviceStatus(device);
|
||||
|
||||
@@ -38,8 +38,8 @@ public class DeviceInfoHandler extends ReqAbstractHandler implements Initializin
|
||||
device.setManufacturer(XmlUtil.getText(rootElement, "Manufacturer"));
|
||||
device.setModel(XmlUtil.getText(rootElement, "Model"));
|
||||
device.setFirmware(XmlUtil.getText(rootElement, "Firmware"));
|
||||
if (StringUtils.isEmpty(device.getStreammode())) {
|
||||
device.setStreammode("UDP");
|
||||
if (StringUtils.isEmpty(device.getStreamMode())) {
|
||||
device.setStreamMode("UDP");
|
||||
}
|
||||
// 更新到数据库
|
||||
sipDeviceService.updateDevice(device);
|
||||
|
||||
@@ -9,9 +9,9 @@ public class SipDeviceSummary {
|
||||
this.manufacturer = device.getManufacturer();
|
||||
this.firmware = device.getFirmware();
|
||||
this.transport = device.getTransport();
|
||||
this.streammode = device.getStreammode();
|
||||
this.streammode = device.getStreamMode();
|
||||
this.port = device.getPort();
|
||||
this.hostaddress = device.getHostaddress();
|
||||
this.hostaddress = device.getHostAddress();
|
||||
}
|
||||
public SipDeviceSummary() {
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ public class ReqMsgHeaderBuilder {
|
||||
public Request createInviteRequest(SipDevice device, SipConfig sipConfig, String channelId, String content, String ssrc, String fromTag) throws ParseException, InvalidArgumentException, PeerUnavailableException {
|
||||
Request request = null;
|
||||
// 请求行
|
||||
SipURI requestLine = sipFactory.createAddressFactory().createSipURI(channelId, device.getHostaddress());
|
||||
SipURI requestLine = sipFactory.createAddressFactory().createSipURI(channelId, device.getHostAddress());
|
||||
// via
|
||||
ArrayList<ViaHeader> viaHeaders = new ArrayList<ViaHeader>();
|
||||
ViaHeader viaHeader = sipFactory.createHeaderFactory().createViaHeader(device.getIp(), device.getPort(),
|
||||
@@ -78,7 +78,7 @@ public class ReqMsgHeaderBuilder {
|
||||
public Request createByeRequest(SipDevice device, SipConfig sipConfig, String channelId, InviteInfo invite) throws ParseException, InvalidArgumentException, PeerUnavailableException {
|
||||
Request request = null;
|
||||
//请求行
|
||||
SipURI requestLine = SipFactory.getInstance().createAddressFactory().createSipURI(channelId, device.getHostaddress());
|
||||
SipURI requestLine = SipFactory.getInstance().createAddressFactory().createSipURI(channelId, device.getHostAddress());
|
||||
// via
|
||||
ArrayList<ViaHeader> viaHeaders = new ArrayList<ViaHeader>();
|
||||
ViaHeader viaHeader = sipFactory.createHeaderFactory().createViaHeader(device.getIp(), device.getPort(),
|
||||
@@ -90,7 +90,7 @@ public class ReqMsgHeaderBuilder {
|
||||
Address fromAddress = SipFactory.getInstance().createAddressFactory().createAddress(fromSipURI);
|
||||
FromHeader fromHeader = SipFactory.getInstance().createHeaderFactory().createFromHeader(fromAddress, invite.getFromTag());
|
||||
//to
|
||||
SipURI toSipURI = SipFactory.getInstance().createAddressFactory().createSipURI(channelId, device.getHostaddress());
|
||||
SipURI toSipURI = SipFactory.getInstance().createAddressFactory().createSipURI(channelId, device.getHostAddress());
|
||||
Address toAddress = SipFactory.getInstance().createAddressFactory().createAddress(toSipURI);
|
||||
ToHeader toHeader = SipFactory.getInstance().createHeaderFactory().createToHeader(toAddress, SipUtil.getNewTag());
|
||||
//Forwards
|
||||
|
||||
@@ -75,7 +75,7 @@ public class SipCmdImpl implements ISipCmd {
|
||||
.mediaServerId(mediaInfo.getServerId())
|
||||
.deviceId(device.getDeviceSipId())
|
||||
.channelId(channelId)
|
||||
.streamMode(device.getStreammode().toUpperCase())
|
||||
.streamMode(device.getStreamMode().toUpperCase())
|
||||
.build();
|
||||
String fromTag;
|
||||
if (record) {
|
||||
|
||||
@@ -14,14 +14,14 @@
|
||||
<result property="model" column="model"/>
|
||||
<result property="firmware" column="firmware"/>
|
||||
<result property="transport" column="transport"/>
|
||||
<result property="streammode" column="streamMode"/>
|
||||
<result property="streamMode" column="stream_mode"/>
|
||||
<result property="online" column="online"/>
|
||||
<result property="registertime" column="registerTime"/>
|
||||
<result property="lastconnecttime" column="lastConnectTime"/>
|
||||
<result property="registerTime" column="register_time"/>
|
||||
<result property="lastConnectTime" column="last_connect_time"/>
|
||||
<result property="activeTime" column="active_time"/>
|
||||
<result property="ip" column="ip"/>
|
||||
<result property="port" column="port"/>
|
||||
<result property="hostaddress" column="hostAddress"/>
|
||||
<result property="hostAddress" column="host_address"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
@@ -40,14 +40,14 @@
|
||||
model,
|
||||
firmware,
|
||||
transport,
|
||||
streamMode,
|
||||
stream_mode,
|
||||
online,
|
||||
registerTime,
|
||||
lastConnectTime,
|
||||
register_time,
|
||||
last_connect_time,
|
||||
active_time,
|
||||
ip,
|
||||
port,
|
||||
hostAddress,
|
||||
host_address,
|
||||
del_flag,
|
||||
create_by,
|
||||
create_time,
|
||||
@@ -71,14 +71,14 @@
|
||||
<if test="model != null and model != ''">and model = #{model}</if>
|
||||
<if test="firmware != null and firmware != ''">and firmware = #{firmware}</if>
|
||||
<if test="transport != null and transport != ''">and transport = #{transport}</if>
|
||||
<if test="streammode != null and streammode != ''">and streamMode = #{streammode}</if>
|
||||
<if test="streamMode != null and streamMode != ''">and stream_mode = #{streamMode}</if>
|
||||
<if test="online != null and online != ''">and online = #{online}</if>
|
||||
<if test="registertime != null ">and registerTime = #{registertime}</if>
|
||||
<if test="lastconnecttime != null ">and lastConnectTime = #{lastconnecttime}</if>
|
||||
<if test="registerTime != null ">and register_time = #{registerTime}</if>
|
||||
<if test="lastConnectTime != null ">and last_connect_time = #{lastConnectTime}</if>
|
||||
<if test="activeTime != null ">and active_time = #{activeTime}</if>
|
||||
<if test="ip != null and ip != ''">and ip = #{ip}</if>
|
||||
<if test="port != null ">and port = #{port}</if>
|
||||
<if test="hostaddress != null and hostaddress != ''">and hostAddress = #{hostaddress}</if>
|
||||
<if test="hostAddress != null and hostAddress != ''">and host_address = #{hostAddress}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@@ -98,14 +98,14 @@
|
||||
<if test="model != null and model != ''">model,</if>
|
||||
<if test="firmware != null and firmware != ''">firmware,</if>
|
||||
<if test="transport != null and transport != ''">transport,</if>
|
||||
<if test="streammode != null and streammode != ''">streamMode,</if>
|
||||
<if test="streamMode != null and streamMode != ''">stream_mode,</if>
|
||||
<if test="online != null and online != ''">online,</if>
|
||||
<if test="registertime != null">registerTime,</if>
|
||||
<if test="lastconnecttime != null">lastConnectTime,</if>
|
||||
<if test="registerTime != null">register_time,</if>
|
||||
<if test="lastConnectTime != null">last_connect_time,</if>
|
||||
<if test="activeTime != null">active_time,</if>
|
||||
<if test="ip != null">ip,</if>
|
||||
<if test="port != null">port,</if>
|
||||
<if test="hostaddress != null">hostAddress,</if>
|
||||
<if test="hostAddress != null">host_address,</if>
|
||||
<if test="delFlag != null and delFlag != ''">del_flag,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
@@ -122,14 +122,14 @@
|
||||
<if test="model != null and model != ''">#{model},</if>
|
||||
<if test="firmware != null and firmware != ''">#{firmware},</if>
|
||||
<if test="transport != null and transport != ''">#{transport},</if>
|
||||
<if test="streammode != null and streammode != ''">#{streammode},</if>
|
||||
<if test="streamMode != null and streamMode != ''">#{streamMode},</if>
|
||||
<if test="online != null and online != ''">#{online},</if>
|
||||
<if test="registertime != null">#{registertime},</if>
|
||||
<if test="lastconnecttime != null">#{lastconnecttime},</if>
|
||||
<if test="registerTime != null">#{registerTime},</if>
|
||||
<if test="lastConnectTime != null">#{lastConnectTime},</if>
|
||||
<if test="activeTime != null">#{activeTime},</if>
|
||||
<if test="ip != null">#{ip},</if>
|
||||
<if test="port != null">#{port},</if>
|
||||
<if test="hostaddress != null">#{hostaddress},</if>
|
||||
<if test="hostAddress != null">#{hostAddress},</if>
|
||||
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
@@ -150,14 +150,14 @@
|
||||
<if test="model != null and model != ''">model = #{model},</if>
|
||||
<if test="firmware != null and firmware != ''">firmware = #{firmware},</if>
|
||||
<if test="transport != null and transport != ''">transport = #{transport},</if>
|
||||
<if test="streammode != null and streammode != ''">streamMode = #{streammode},</if>
|
||||
<if test="streamMode != null and streamMode != ''">stream_mode = #{streamMode},</if>
|
||||
<if test="online != null and online != ''">online = #{online},</if>
|
||||
<if test="registertime != null">registerTime = #{registertime},</if>
|
||||
<if test="lastconnecttime != null">lastConnectTime = #{lastconnecttime},</if>
|
||||
<if test="registerTime != null">register_time = #{registerTime},</if>
|
||||
<if test="lastConnectTime != null">last_connect_time = #{lastConnectTime},</if>
|
||||
<if test="activeTime != null">active_time = #{activeTime},</if>
|
||||
<if test="ip != null">ip = #{ip},</if>
|
||||
<if test="port != null">port = #{port},</if>
|
||||
<if test="hostaddress != null">hostAddress = #{hostaddress},</if>
|
||||
<if test="hostAddress != null">host_address = #{hostAddress},</if>
|
||||
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
|
||||
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
@@ -185,18 +185,20 @@
|
||||
update sip_device
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="online != null">online = #{online},</if>
|
||||
<if test="lastconnecttime != null">lastConnectTime = #{lastconnecttime},</if>
|
||||
<if test="lastConnectTime != null">last_connect_time = #{lastConnectTime},</if>
|
||||
<if test="activeTime != null">active_time = #{activeTime},</if>
|
||||
<if test="ip != null">ip = #{ip},</if>
|
||||
<if test="port != null">port = #{port},</if>
|
||||
<if test="hostaddress != null">hostaddress = #{hostaddress},</if>
|
||||
<if test="hostAddress != null">hostaddress = #{hostAddress},</if>
|
||||
</trim>
|
||||
where device_sip_id = #{deviceSipId}
|
||||
</update>
|
||||
|
||||
<select id="selectOfflineSipDevice" parameterType="Integer" resultMap="SipDeviceResult">
|
||||
<include refid="selectSipDeviceVo"/>
|
||||
${checkTimeCondition}
|
||||
<where>
|
||||
${checkTimeCondition}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectSipDeviceBySipId" parameterType="String" resultMap="SipDeviceResult">
|
||||
|
||||
Reference in New Issue
Block a user