feat(video): 添加设备名称字段并优化巡检任务关联查询
- 在 Device 实体类中新增 deviceName 字段及其 getter/setter 方法 - 更新 DeviceMapper.xml,支持 device_name 字段的查询、插入和更新操作 - 修改 InspectionTask 实体类,增加 deviceIp 字段用于联查返回设备 IP - 调整 InspectionTaskMapper.xml,通过左连接获取设备名称与 IP 信息- 移除冗余的 device_name 插入与更新逻辑 - 注释掉旧有的设备信息设置代码,避免重复赋值 - 更新 toString 方法以包含新的 deviceName 属性
This commit is contained in:
@@ -14,6 +14,8 @@ public class Device extends BaseEntity {
|
||||
private Long deviceId;
|
||||
@Excel(name = "IP地址")
|
||||
private String ip;
|
||||
@Excel(name = "设备名称")
|
||||
private String deviceName;
|
||||
@Excel(
|
||||
name = "设备类型(1=haikan,2=dahua)"
|
||||
)
|
||||
@@ -51,7 +53,7 @@ public class Device extends BaseEntity {
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "Device{deviceId=" + this.deviceId + ", ip='" + this.ip + "', type='" + this.type + "', mediaKey='" + this.mediaKey + "', userName='" + this.userName + "', password='" + this.password + "', url='" + this.url + "', enabledFlv='" + this.enabledFlv + "', enabledHls='" + this.enabledHls + "', mode='" + this.mode + "'}";
|
||||
return "Device{deviceId=" + this.deviceId + ", deviceName='" + this.deviceName + "', ip='" + this.ip + "', type='" + this.type + "', mediaKey='" + this.mediaKey + "', userName='" + this.userName + "', password='" + this.password + "', url='" + this.url + "', enabledFlv='" + this.enabledFlv + "', enabledHls='" + this.enabledHls + "', mode='" + this.mode + "'}";
|
||||
}
|
||||
|
||||
public Long getDeviceId() {
|
||||
@@ -62,6 +64,14 @@ public class Device extends BaseEntity {
|
||||
this.deviceId = deviceId;
|
||||
}
|
||||
|
||||
public String getDeviceName() {
|
||||
return deviceName;
|
||||
}
|
||||
|
||||
public void setDeviceName(String deviceName) {
|
||||
this.deviceName = deviceName;
|
||||
}
|
||||
|
||||
public String getIp() {
|
||||
return this.ip;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import java.util.Date;
|
||||
|
||||
/**
|
||||
* 巡检任务对象 v_inspection_task
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-09-27
|
||||
*/
|
||||
@@ -22,9 +22,12 @@ public class InspectionTask extends BaseEntity {
|
||||
/** 设备ID */
|
||||
private Long deviceId;
|
||||
|
||||
/** 设备名称 */
|
||||
/** 设备名称(联查返回) */
|
||||
private String deviceName;
|
||||
|
||||
/** 设备IP(联查返回) */
|
||||
private String deviceIp;
|
||||
|
||||
/** Cron表达式 */
|
||||
private String cronExpression;
|
||||
|
||||
@@ -57,11 +60,11 @@ public class InspectionTask extends BaseEntity {
|
||||
public void setModelName(String modelName) {
|
||||
this.modelName = modelName;
|
||||
}
|
||||
|
||||
public String getModelName() {
|
||||
return modelName;
|
||||
}
|
||||
|
||||
|
||||
public void setTaskId(Long taskId) {
|
||||
this.taskId = taskId;
|
||||
}
|
||||
@@ -94,6 +97,14 @@ public class InspectionTask extends BaseEntity {
|
||||
return deviceName;
|
||||
}
|
||||
|
||||
public String getDeviceIp() {
|
||||
return deviceIp;
|
||||
}
|
||||
|
||||
public void setDeviceIp(String deviceIp) {
|
||||
this.deviceIp = deviceIp;
|
||||
}
|
||||
|
||||
public void setCronExpression(String cronExpression) {
|
||||
this.cronExpression = cronExpression;
|
||||
}
|
||||
|
||||
@@ -88,11 +88,11 @@ public class InspectionTaskServiceImpl implements InspectionTaskService {
|
||||
inspectionTask.setAlarmCount(0L);
|
||||
|
||||
// 获取设备信息
|
||||
Device device = deviceService.selectDeviceByDeviceId(inspectionTask.getDeviceId());
|
||||
|
||||
if (device != null) {
|
||||
inspectionTask.setDeviceName(device.getIp());
|
||||
}
|
||||
// Device device = deviceService.selectDeviceByDeviceId(inspectionTask.getDeviceId());
|
||||
//
|
||||
// if (device != null) {
|
||||
// inspectionTask.setDeviceName(device.getIp());
|
||||
// }
|
||||
|
||||
return inspectionTaskMapper.insertInspectionTask(inspectionTask);
|
||||
}
|
||||
@@ -457,7 +457,7 @@ public class InspectionTaskServiceImpl implements InspectionTaskService {
|
||||
alarm.setTaskId(task.getTaskId());
|
||||
alarm.setTaskName(task.getTaskName());
|
||||
alarm.setDeviceId(task.getDeviceId());
|
||||
alarm.setDeviceName(task.getDeviceName());
|
||||
// alarm.setDeviceName(task.getDeviceName());
|
||||
alarm.setAlarmType(best.getLabel());
|
||||
// 这里需要转换double为float
|
||||
alarm.setAlarmLevel(getAlarmLevel((float)best.getConfidence()));
|
||||
|
||||
Reference in New Issue
Block a user