2 changed files with 126 additions and 0 deletions
@ -0,0 +1,79 @@ |
|||||
|
package com.threecloud.dataserviceyy.entity; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* 设备连接日志表 |
||||
|
* 对应 mid_voice.mid_voice_device_log |
||||
|
* |
||||
|
* 用于记录设备连接失败信息,便于排查问题 |
||||
|
*/ |
||||
|
public class MidVoiceDeviceLog { |
||||
|
|
||||
|
/** 自增ID主键 */ |
||||
|
private Long id; |
||||
|
|
||||
|
/** 设备ID */ |
||||
|
private String deviceId; |
||||
|
|
||||
|
/** 设备编号 */ |
||||
|
private String deviceNo; |
||||
|
|
||||
|
/** 地市编码 */ |
||||
|
private String cityCode; |
||||
|
|
||||
|
/** 地市名称 */ |
||||
|
private String cityName; |
||||
|
|
||||
|
/** IP地址 */ |
||||
|
private String ipAddress; |
||||
|
|
||||
|
/** 端口号 */ |
||||
|
private Integer devicePort; |
||||
|
|
||||
|
/** 连接类型:1登录,2查询录音列表,3下载文件 */ |
||||
|
private String connectType; |
||||
|
|
||||
|
/** 连接状态:0失败,1成功 */ |
||||
|
private String connectStatus; |
||||
|
|
||||
|
/** 失败原因 */ |
||||
|
private String failReason; |
||||
|
|
||||
|
/** 创建时间 */ |
||||
|
private Date createTime; |
||||
|
|
||||
|
// Getters and Setters
|
||||
|
public Long getId() { return id; } |
||||
|
public void setId(Long id) { this.id = id; } |
||||
|
|
||||
|
public String getDeviceId() { return deviceId; } |
||||
|
public void setDeviceId(String deviceId) { this.deviceId = deviceId; } |
||||
|
|
||||
|
public String getDeviceNo() { return deviceNo; } |
||||
|
public void setDeviceNo(String deviceNo) { this.deviceNo = deviceNo; } |
||||
|
|
||||
|
public String getCityCode() { return cityCode; } |
||||
|
public void setCityCode(String cityCode) { this.cityCode = cityCode; } |
||||
|
|
||||
|
public String getCityName() { return cityName; } |
||||
|
public void setCityName(String cityName) { this.cityName = cityName; } |
||||
|
|
||||
|
public String getIpAddress() { return ipAddress; } |
||||
|
public void setIpAddress(String ipAddress) { this.ipAddress = ipAddress; } |
||||
|
|
||||
|
public Integer getDevicePort() { return devicePort; } |
||||
|
public void setDevicePort(Integer devicePort) { this.devicePort = devicePort; } |
||||
|
|
||||
|
public String getConnectType() { return connectType; } |
||||
|
public void setConnectType(String connectType) { this.connectType = connectType; } |
||||
|
|
||||
|
public String getConnectStatus() { return connectStatus; } |
||||
|
public void setConnectStatus(String connectStatus) { this.connectStatus = connectStatus; } |
||||
|
|
||||
|
public String getFailReason() { return failReason; } |
||||
|
public void setFailReason(String failReason) { this.failReason = failReason; } |
||||
|
|
||||
|
public Date getCreateTime() { return createTime; } |
||||
|
public void setCreateTime(Date createTime) { this.createTime = createTime; } |
||||
|
} |
||||
@ -0,0 +1,47 @@ |
|||||
|
package com.threecloud.dataserviceyy.mapper; |
||||
|
|
||||
|
import com.threecloud.dataserviceyy.entity.MidVoiceDeviceLog; |
||||
|
import org.apache.ibatis.annotations.Insert; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
import org.apache.ibatis.annotations.Select; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 设备连接日志 Mapper |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface MidVoiceDeviceLogMapper { |
||||
|
|
||||
|
/** |
||||
|
* 插入设备连接日志 |
||||
|
*/ |
||||
|
@Insert("INSERT INTO mid_voice_device_log (" + |
||||
|
"device_id, device_no, city_code, city_name, ip_address, device_port, " + |
||||
|
"connect_type, connect_status, fail_reason, create_time" + |
||||
|
") VALUES (" + |
||||
|
"#{deviceId}, #{deviceNo}, #{cityCode}, #{cityName}, #{ipAddress}, #{devicePort}, " + |
||||
|
"#{connectType}, #{connectStatus}, #{failReason}, #{createTime}" + |
||||
|
")") |
||||
|
int insert(MidVoiceDeviceLog log); |
||||
|
|
||||
|
/** |
||||
|
* 查询设备的最近连接日志 |
||||
|
*/ |
||||
|
@Select("SELECT * FROM mid_voice_device_log " + |
||||
|
"WHERE device_id = #{deviceId} " + |
||||
|
"ORDER BY create_time DESC " + |
||||
|
"LIMIT #{limit}") |
||||
|
List<MidVoiceDeviceLog> selectRecentByDeviceId(@Param("deviceId") String deviceId, |
||||
|
@Param("limit") int limit); |
||||
|
|
||||
|
/** |
||||
|
* 查询失败的连接记录 |
||||
|
*/ |
||||
|
@Select("SELECT * FROM mid_voice_device_log " + |
||||
|
"WHERE connect_status = '0' " + |
||||
|
"AND create_time >= #{startTime} " + |
||||
|
"ORDER BY create_time DESC") |
||||
|
List<MidVoiceDeviceLog> selectFailedLogs(@Param("startTime") String startTime); |
||||
|
} |
||||
Loading…
Reference in new issue