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=否")
|
@Excel(name = "是否监测数据", readConverterExp = "1==是,0=否")
|
||||||
private Integer isMonitor;
|
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() {
|
public Date getTs() {
|
||||||
return ts;
|
return ts;
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.ruoyi.iot.model.ThingsModels;
|
package com.ruoyi.iot.model.ThingsModels;
|
||||||
|
|
||||||
|
import com.ruoyi.common.annotation.Excel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设备输入物模型值参数
|
* 设备输入物模型值参数
|
||||||
*
|
*
|
||||||
@@ -24,9 +26,53 @@ public class ThingsModelValuesOutput
|
|||||||
/** 设备ID **/
|
/** 设备ID **/
|
||||||
private String serialNumber;
|
private String serialNumber;
|
||||||
|
|
||||||
|
/** 用户ID */
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/** 用户昵称 */
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
/** 租户ID */
|
||||||
|
private Long tenantId;
|
||||||
|
|
||||||
|
/** 租户名称 */
|
||||||
|
private String tenantName;
|
||||||
|
|
||||||
/** 设备物模型值 **/
|
/** 设备物模型值 **/
|
||||||
private String thingsModelValue;
|
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() {
|
public int getIsShadow() {
|
||||||
return isShadow;
|
return isShadow;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -199,6 +199,10 @@ public class EmqxService {
|
|||||||
deviceLog.setIdentity(thingsModelValueRemarkItems.get(i).getId());
|
deviceLog.setIdentity(thingsModelValueRemarkItems.get(i).getId());
|
||||||
deviceLog.setLogType(3);
|
deviceLog.setLogType(3);
|
||||||
deviceLog.setIsMonitor(0);
|
deviceLog.setIsMonitor(0);
|
||||||
|
deviceLog.setUserId(device.getUserId());
|
||||||
|
deviceLog.setUserName(device.getUserName());
|
||||||
|
deviceLog.setTenantId(device.getTenantId());
|
||||||
|
deviceLog.setTenantName(device.getTenantName());
|
||||||
logService.saveDeviceLog(deviceLog);
|
logService.saveDeviceLog(deviceLog);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -238,6 +238,10 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||||||
deviceLog.setCreateTime(DateUtils.getNowDate());
|
deviceLog.setCreateTime(DateUtils.getNowDate());
|
||||||
deviceLog.setIsMonitor(valueList.get(k).getIsMonitor());
|
deviceLog.setIsMonitor(valueList.get(k).getIsMonitor());
|
||||||
deviceLog.setLogType(type);
|
deviceLog.setLogType(type);
|
||||||
|
deviceLog.setUserId(deviceThings.getUserId());
|
||||||
|
deviceLog.setUserName(deviceThings.getUserName());
|
||||||
|
deviceLog.setTenantId(deviceThings.getTenantId());
|
||||||
|
deviceLog.setTenantName(deviceThings.getTenantName());
|
||||||
logService.saveDeviceLog(deviceLog);
|
logService.saveDeviceLog(deviceLog);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -722,6 +726,10 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||||||
deviceLog.setDeviceName(device.getDeviceName());
|
deviceLog.setDeviceName(device.getDeviceName());
|
||||||
deviceLog.setSerialNumber(device.getSerialNumber());
|
deviceLog.setSerialNumber(device.getSerialNumber());
|
||||||
deviceLog.setIsMonitor(0);
|
deviceLog.setIsMonitor(0);
|
||||||
|
deviceLog.setUserId(device.getUserId());
|
||||||
|
deviceLog.setUserName(device.getUserName());
|
||||||
|
deviceLog.setTenantId(device.getTenantId());
|
||||||
|
deviceLog.setTenantName(device.getTenantName());
|
||||||
if(device.getStatus()==3){
|
if(device.getStatus()==3){
|
||||||
deviceLog.setLogValue("1");
|
deviceLog.setLogValue("1");
|
||||||
deviceLog.setRemark("设备上线");
|
deviceLog.setRemark("设备上线");
|
||||||
|
|||||||
@@ -20,11 +20,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="createBy" column="create_by" />
|
<result property="createBy" column="create_by" />
|
||||||
<result property="isMonitor" column="is_monitor" />
|
<result property="isMonitor" column="is_monitor" />
|
||||||
<result property="createTime" column="create_time" />
|
<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" />
|
<result property="remark" column="remark" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectDeviceLogVo">
|
<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>
|
</sql>
|
||||||
|
|
||||||
<select id="selectMonitorList" parameterType="com.ruoyi.iot.domain.DeviceLog" resultMap="MonitorResult">
|
<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="isMonitor != null">is_monitor,</if>
|
||||||
<if test="createTime != null">create_time,</if>
|
<if test="createTime != null">create_time,</if>
|
||||||
<if test="remark != null">remark,</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>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="logType != null">#{logType},</if>
|
<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="isMonitor != null">#{isMonitor},</if>
|
||||||
<if test="createTime != null">#{createTime},</if>
|
<if test="createTime != null">#{createTime},</if>
|
||||||
<if test="remark != null">#{remark},</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>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@@ -133,6 +145,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="isMonitor != null">is_monitor = #{isMonitor},</if>
|
<if test="isMonitor != null">is_monitor = #{isMonitor},</if>
|
||||||
<if test="createTime != null">create_time = #{createTime},</if>
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
<if test="remark != null">remark = #{remark},</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>
|
</trim>
|
||||||
where log_id = #{logId}
|
where log_id = #{logId}
|
||||||
</update>
|
</update>
|
||||||
|
|||||||
@@ -94,6 +94,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="productName" column="product_name" />
|
<result property="productName" column="product_name" />
|
||||||
<result property="serialNumber" column="serial_number" />
|
<result property="serialNumber" column="serial_number" />
|
||||||
<result property="thingsModelValue" column="things_model_value" />
|
<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>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectDeviceVo">
|
<sql id="selectDeviceVo">
|
||||||
@@ -178,7 +182,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDeviceThingsModelValueBySerialNumber" parameterType="String" resultMap="DeviceThingsValueResult">
|
<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>
|
</select>
|
||||||
|
|
||||||
<update id="updateDeviceThingsModelValue" parameterType="com.ruoyi.iot.model.ThingsModels.ThingsModelValuesInput">
|
<update id="updateDeviceThingsModelValue" parameterType="com.ruoyi.iot.model.ThingsModels.ThingsModelValuesInput">
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
/** 连接Mqtt */
|
/** 连接Mqtt */
|
||||||
connectMqtt(subscribeTopics) {
|
connectMqtt(subscribeTopics) {
|
||||||
let randomClientId='web-' + Math.random().toString(16).substr(2);
|
let randomClientId = 'web-' + Math.random().toString(16).substr(2);
|
||||||
let options = {
|
let options = {
|
||||||
username: "wumei-smart",
|
username: "wumei-smart",
|
||||||
password: getToken(),
|
password: getToken(),
|
||||||
@@ -53,7 +53,7 @@ export default {
|
|||||||
console.log("mqtt地址:", url);
|
console.log("mqtt地址:", url);
|
||||||
this.client = mqtt.connect(url, options);
|
this.client = mqtt.connect(url, options);
|
||||||
this.client.on("connect", (e) => {
|
this.client.on("connect", (e) => {
|
||||||
console.log("客户端:"+randomClientId+",成功连接服务器:", e);
|
console.log("客户端:" + randomClientId + ",成功连接服务器:", e);
|
||||||
// 订阅主题
|
// 订阅主题
|
||||||
if (subscribeTopics != '' && subscribeTopics.length > 0) {
|
if (subscribeTopics != '' && subscribeTopics.length > 0) {
|
||||||
this.client.subscribe(subscribeTopics, {
|
this.client.subscribe(subscribeTopics, {
|
||||||
@@ -89,7 +89,11 @@ export default {
|
|||||||
if (!err) {
|
if (!err) {
|
||||||
console.log('成功发布主题:' + topic)
|
console.log('成功发布主题:' + topic)
|
||||||
console.log('主题内容:' + message);
|
console.log('主题内容:' + message);
|
||||||
this.$modal.notifySuccess("[ " + name + " ] 指令发送成功");
|
if (topic.indexOf('offline') > 0) {
|
||||||
|
this.$modal.notify("[ " + name + " ] 影子指令发送成功");
|
||||||
|
} else {
|
||||||
|
this.$modal.notifySuccess("[ " + name + " ] 指令发送成功");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -41,17 +41,17 @@
|
|||||||
<table>
|
<table>
|
||||||
<tr>
|
<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 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:10px 30px 0 0;">wumei</td>
|
||||||
<td style="padding-top:10px;">123456</td>
|
<td style="padding-top:10px;">123456</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="padding:0 20px 0 10px;">租户账号</td>
|
<td style="padding:0 15px 0 10px;">租户账号</td>
|
||||||
<td>wumei-t1</td>
|
<td>wumei-t1</td>
|
||||||
<td>123456</td>
|
<td>123456</td>
|
||||||
</tr>
|
</tr>
|
||||||
<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;">wumei-u1</td>
|
||||||
<td style="padding-bottom:10px;">123456</td>
|
<td style="padding-bottom:10px;">123456</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
Reference in New Issue
Block a user