日志添加租户和用户信息

This commit is contained in:
kerwincui
2022-06-10 15:10:58 +08:00
parent 6f2800cdb8
commit a8f6dcf882
8 changed files with 137 additions and 8 deletions

View File

@@ -50,6 +50,53 @@ public class DeviceLog extends BaseEntity
@Excel(name = "是否监测数据", readConverterExp = "1==是0=否")
private Integer isMonitor;
/** 用户ID */
@Excel(name = "用户ID")
private Long userId;
/** 用户昵称 */
@Excel(name = "用户昵称")
private String userName;
/** 租户ID */
@Excel(name = "租户ID")
private Long tenantId;
/** 租户名称 */
@Excel(name = "租户名称")
private String tenantName;
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public Long getTenantId() {
return tenantId;
}
public void setTenantId(Long tenantId) {
this.tenantId = tenantId;
}
public String getTenantName() {
return tenantName;
}
public void setTenantName(String tenantName) {
this.tenantName = tenantName;
}
public Date getTs() {
return ts;

View File

@@ -1,5 +1,7 @@
package com.ruoyi.iot.model.ThingsModels;
import com.ruoyi.common.annotation.Excel;
/**
* 设备输入物模型值参数
*
@@ -24,9 +26,53 @@ public class ThingsModelValuesOutput
/** 设备ID **/
private String serialNumber;
/** 用户ID */
private Long userId;
/** 用户昵称 */
private String userName;
/** 租户ID */
private Long tenantId;
/** 租户名称 */
private String tenantName;
/** 设备物模型值 **/
private String thingsModelValue;
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public Long getTenantId() {
return tenantId;
}
public void setTenantId(Long tenantId) {
this.tenantId = tenantId;
}
public String getTenantName() {
return tenantName;
}
public void setTenantName(String tenantName) {
this.tenantName = tenantName;
}
public int getIsShadow() {
return isShadow;
}

View File

@@ -199,6 +199,10 @@ public class EmqxService {
deviceLog.setIdentity(thingsModelValueRemarkItems.get(i).getId());
deviceLog.setLogType(3);
deviceLog.setIsMonitor(0);
deviceLog.setUserId(device.getUserId());
deviceLog.setUserName(device.getUserName());
deviceLog.setTenantId(device.getTenantId());
deviceLog.setTenantName(device.getTenantName());
logService.saveDeviceLog(deviceLog);
}
} catch (Exception e) {

View File

@@ -238,6 +238,10 @@ public class DeviceServiceImpl implements IDeviceService {
deviceLog.setCreateTime(DateUtils.getNowDate());
deviceLog.setIsMonitor(valueList.get(k).getIsMonitor());
deviceLog.setLogType(type);
deviceLog.setUserId(deviceThings.getUserId());
deviceLog.setUserName(deviceThings.getUserName());
deviceLog.setTenantId(deviceThings.getTenantId());
deviceLog.setTenantName(deviceThings.getTenantName());
logService.saveDeviceLog(deviceLog);
break;
}
@@ -722,6 +726,10 @@ public class DeviceServiceImpl implements IDeviceService {
deviceLog.setDeviceName(device.getDeviceName());
deviceLog.setSerialNumber(device.getSerialNumber());
deviceLog.setIsMonitor(0);
deviceLog.setUserId(device.getUserId());
deviceLog.setUserName(device.getUserName());
deviceLog.setTenantId(device.getTenantId());
deviceLog.setTenantName(device.getTenantName());
if(device.getStatus()==3){
deviceLog.setLogValue("1");
deviceLog.setRemark("设备上线");