mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-17 16:36:03 +08:00
日志添加租户和用户信息
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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("设备上线");
|
||||
|
||||
@@ -20,11 +20,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="isMonitor" column="is_monitor" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="userName" column="user_name" />
|
||||
<result property="tenantId" column="tenant_id" />
|
||||
<result property="tenantName" column="tenant_name" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDeviceLogVo">
|
||||
select log_id, log_type, log_value, device_id, device_name,serial_number, identity, create_by, is_monitor, create_time, remark from iot_device_log
|
||||
select log_id, log_type, log_value, device_id, device_name,serial_number, identity, create_by, is_monitor, user_id, user_name, tenant_id, tenant_name, create_time, remark from iot_device_log
|
||||
</sql>
|
||||
|
||||
<select id="selectMonitorList" parameterType="com.ruoyi.iot.domain.DeviceLog" resultMap="MonitorResult">
|
||||
@@ -105,6 +109,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="isMonitor != null">is_monitor,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="userName != null and userName != ''">user_name,</if>
|
||||
<if test="tenantId != null">tenant_id,</if>
|
||||
<if test="tenantName != null and tenantName != ''">tenant_name,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="logType != null">#{logType},</if>
|
||||
@@ -117,6 +125,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="isMonitor != null">#{isMonitor},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="userName != null and userName != ''">#{userName},</if>
|
||||
<if test="tenantId != null">#{tenantId},</if>
|
||||
<if test="tenantName != null and tenantName != ''">#{tenantName},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@@ -133,6 +145,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="isMonitor != null">is_monitor = #{isMonitor},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="userId != null">user_id = #{userId},</if>
|
||||
<if test="userName != null and userName != ''">user_name = #{userName},</if>
|
||||
<if test="tenantId != null">tenant_id = #{tenantId},</if>
|
||||
<if test="tenantName != null and tenantName != ''">tenant_name = #{tenantName},</if>
|
||||
</trim>
|
||||
where log_id = #{logId}
|
||||
</update>
|
||||
|
||||
@@ -94,6 +94,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="productName" column="product_name" />
|
||||
<result property="serialNumber" column="serial_number" />
|
||||
<result property="thingsModelValue" column="things_model_value" />
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="userName" column="user_name" />
|
||||
<result property="tenantId" column="tenant_id" />
|
||||
<result property="tenantName" column="tenant_name" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDeviceVo">
|
||||
@@ -178,7 +182,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</select>
|
||||
|
||||
<select id="selectDeviceThingsModelValueBySerialNumber" parameterType="String" resultMap="DeviceThingsValueResult">
|
||||
select product_id,product_name,device_id,device_name,serial_number,is_shadow,status,things_model_value from iot_device where serial_number = #{serialNumber}
|
||||
select product_id,product_name,device_id,device_name,serial_number,is_shadow,status,user_id, user_name, tenant_id, tenant_name,things_model_value from iot_device where serial_number = #{serialNumber}
|
||||
</select>
|
||||
|
||||
<update id="updateDeviceThingsModelValue" parameterType="com.ruoyi.iot.model.ThingsModels.ThingsModelValuesInput">
|
||||
|
||||
@@ -89,8 +89,12 @@ export default {
|
||||
if (!err) {
|
||||
console.log('成功发布主题:' + topic)
|
||||
console.log('主题内容:' + message);
|
||||
if (topic.indexOf('offline') > 0) {
|
||||
this.$modal.notify("[ " + name + " ] 影子指令发送成功");
|
||||
} else {
|
||||
this.$modal.notifySuccess("[ " + name + " ] 指令发送成功");
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
@@ -41,17 +41,17 @@
|
||||
<table>
|
||||
<tr>
|
||||
<td rowspan="3" style="width:60px;font-weight:bold;color:#fff;line-height:28px;background-color:#F56C6C;text-align:center;font-size:18px;">演 示<br />账 号</td>
|
||||
<td style="padding:10px 20px 0 10px;">管理员</td>
|
||||
<td style="padding:10px 15px 0 10px;">受限管理</td>
|
||||
<td style="padding:10px 30px 0 0;">wumei</td>
|
||||
<td style="padding-top:10px;">123456</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding:0 20px 0 10px;">租户账号</td>
|
||||
<td style="padding:0 15px 0 10px;">租户账号</td>
|
||||
<td>wumei-t1</td>
|
||||
<td>123456</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding:0 20px 10px 10px;">普通用户</td>
|
||||
<td style="padding:0 15px 10px 10px;">普通用户</td>
|
||||
<td style="padding-bottom:10px;">wumei-u1</td>
|
||||
<td style="padding-bottom:10px;">123456</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user