设备修改定位字段名称,添加设备摘要

This commit is contained in:
kerwincui
2022-06-06 13:11:06 +08:00
parent c9a036043e
commit 24f2e65f2b
8 changed files with 85 additions and 40 deletions

View File

@@ -97,17 +97,28 @@ public class Device extends BaseEntity
private String imgUrl; private String imgUrl;
/** 是否自定义位置 **/ /** 是否自定义位置 **/
private Integer isCustomLocation; private Integer locationWay;
/** 设备摘要 **/
private String summary;
/** 删除标志0代表存在 2代表删除 */ /** 删除标志0代表存在 2代表删除 */
private String delFlag; private String delFlag;
public Integer getIsCustomLocation() { public String getSummary() {
return isCustomLocation; return summary;
} }
public void setIsCustomLocation(Integer isCustomLocation) { public void setSummary(String summary) {
this.isCustomLocation = isCustomLocation; this.summary = summary;
}
public Integer getlocationWay() {
return locationWay;
}
public void setlocationWay(Integer locationWay) {
this.locationWay = locationWay;
} }
public String getImgUrl() { public String getImgUrl() {

View File

@@ -47,7 +47,7 @@ public class DeviceAllShortOutput
private Date activeTime; private Date activeTime;
/** 是否自定义位置 **/ /** 是否自定义位置 **/
private Integer isCustomLocation; private Integer locationWay;
/** 设备地址 */ /** 设备地址 */
private String networkAddress; private String networkAddress;
@@ -82,12 +82,12 @@ public class DeviceAllShortOutput
this.latitude = latitude; this.latitude = latitude;
} }
public Integer getIsCustomLocation() { public Integer getlocationWay() {
return isCustomLocation; return locationWay;
} }
public void setIsCustomLocation(Integer isCustomLocation) { public void setlocationWay(Integer locationWay) {
this.isCustomLocation = isCustomLocation; this.locationWay = locationWay;
} }
public Integer getIsShadow() { public Integer getIsShadow() {

View File

@@ -88,7 +88,7 @@ public class DeviceShortOutput
private Date activeTime; private Date activeTime;
/** 是否自定义位置 **/ /** 是否自定义位置 **/
private Integer isCustomLocation; private Integer locationWay;
/** 图片地址 */ /** 图片地址 */
private String imgUrl; private String imgUrl;
@@ -101,12 +101,12 @@ public class DeviceShortOutput
private List<BoolModelOutput> boolList; private List<BoolModelOutput> boolList;
private List<ReadOnlyModelOutput> readOnlyList; private List<ReadOnlyModelOutput> readOnlyList;
public Integer getIsCustomLocation() { public Integer getlocationWay() {
return isCustomLocation; return locationWay;
} }
public void setIsCustomLocation(Integer isCustomLocation) { public void setlocationWay(Integer locationWay) {
this.isCustomLocation = isCustomLocation; this.locationWay = locationWay;
} }
public String getImgUrl() { public String getImgUrl() {

View File

@@ -133,7 +133,7 @@ public class EmqxService {
device.setProductId(productId); device.setProductId(productId);
device.setSerialNumber(deviceNum); device.setSerialNumber(deviceNum);
// 未采用设备定位则清空定位,定位方式(1=ip自动定位2=设备定位3=自定义) // 未采用设备定位则清空定位,定位方式(1=ip自动定位2=设备定位3=自定义)
if(device.getIsCustomLocation()!=2){ if(device.getlocationWay()!=2){
device.setLatitude(null); device.setLatitude(null);
device.setLongitude(null); device.setLongitude(null);
} }

View File

@@ -472,7 +472,7 @@ public class DeviceServiceImpl implements IDeviceService {
device.setActiveTime(DateUtils.getNowDate()); device.setActiveTime(DateUtils.getNowDate());
device.setIsShadow(0); device.setIsShadow(0);
device.setRssi(0); device.setRssi(0);
device.setIsCustomLocation(1); // 1-自动定位2-设备定位3-自定义位置 device.setlocationWay(1); // 1-自动定位2-设备定位3-自定义位置
device.setCreateTime(DateUtils.getNowDate()); device.setCreateTime(DateUtils.getNowDate());
device.setThingsModelValue(JSONObject.toJSONString(getThingsModelDefaultValue(device.getProductId()))); device.setThingsModelValue(JSONObject.toJSONString(getThingsModelDefaultValue(device.getProductId())));
// 随机位置 // 随机位置
@@ -609,7 +609,7 @@ public class DeviceServiceImpl implements IDeviceService {
device.setActiveTime(DateUtils.getNowDate()); device.setActiveTime(DateUtils.getNowDate());
} }
// 定位方式(1=ip自动定位2=设备定位3=自定义) // 定位方式(1=ip自动定位2=设备定位3=自定义)
if (device.getIsCustomLocation() == 1) { if (device.getlocationWay() == 1) {
device.setNetworkIp(ipAddress); device.setNetworkIp(ipAddress);
setLocation(ipAddress, device); setLocation(ipAddress, device);
} }

View File

@@ -18,7 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="status" column="status" /> <result property="status" column="status" />
<result property="rssi" column="rssi" /> <result property="rssi" column="rssi" />
<result property="isShadow" column="is_shadow" /> <result property="isShadow" column="is_shadow" />
<result property="isCustomLocation" column="is_custom_location" /> <result property="locationWay" column="location_way" />
<result property="thingsModelValue" column="things_model_value" /> <result property="thingsModelValue" column="things_model_value" />
<result property="networkAddress" column="network_address" /> <result property="networkAddress" column="network_address" />
<result property="networkIp" column="network_ip" /> <result property="networkIp" column="network_ip" />
@@ -29,6 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="remark" column="remark" /> <result property="remark" column="remark" />
<result property="imgUrl" column="img_url" /> <result property="imgUrl" column="img_url" />
<result property="summary" column="summary" />
</resultMap> </resultMap>
<resultMap type="com.ruoyi.iot.model.DeviceShortOutput" id="DeviceShortResult"> <resultMap type="com.ruoyi.iot.model.DeviceShortOutput" id="DeviceShortResult">
@@ -46,7 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="activeTime" column="active_time" /> <result property="activeTime" column="active_time" />
<result property="rssi" column="rssi" /> <result property="rssi" column="rssi" />
<result property="isShadow" column="is_shadow" /> <result property="isShadow" column="is_shadow" />
<result property="isCustomLocation" column="is_custom_location" /> <result property="locationWay" column="location_way" />
<result property="thingsModelValue" column="things_model_value" /> <result property="thingsModelValue" column="things_model_value" />
<result property="imgUrl" column="img_url" /> <result property="imgUrl" column="img_url" />
</resultMap> </resultMap>
@@ -62,7 +63,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="activeTime" column="active_time" /> <result property="activeTime" column="active_time" />
<result property="rssi" column="rssi" /> <result property="rssi" column="rssi" />
<result property="isShadow" column="is_shadow" /> <result property="isShadow" column="is_shadow" />
<result property="isCustomLocation" column="is_custom_location" /> <result property="locationWay" column="location_way" />
<result property="networkAddress" column="network_address" /> <result property="networkAddress" column="network_address" />
<result property="longitude" column="longitude" /> <result property="longitude" column="longitude" />
<result property="latitude" column="latitude" /> <result property="latitude" column="latitude" />
@@ -96,15 +97,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectDeviceVo"> <sql id="selectDeviceVo">
select device_id, device_name, product_id, product_name, user_id, user_name, tenant_id, tenant_name, serial_number, firmware_version, status, rssi,is_shadow ,is_custom_location,things_model_value,network_address, network_ip, longitude, latitude, active_time, create_time, update_time, img_url,remark from iot_device select device_id, device_name, product_id, product_name, user_id, user_name, tenant_id, tenant_name, serial_number, firmware_version, status, rssi,is_shadow ,location_way,things_model_value,network_address, network_ip, longitude, latitude, active_time, create_time, update_time, img_url,summary,remark from iot_device
</sql> </sql>
<sql id="selectDeviceShortVo"> <sql id="selectDeviceShortVo">
select device_id, device_name, product_id, product_name, user_id, user_name, tenant_id, tenant_name, serial_number, firmware_version, status,rssi,is_shadow ,is_custom_location,things_model_value, active_time,img_url from iot_device select device_id, device_name, product_id, product_name, user_id, user_name, tenant_id, tenant_name, serial_number, firmware_version, status,rssi,is_shadow ,location_way,things_model_value, active_time,img_url from iot_device
</sql> </sql>
<sql id="selectWebhookDeviceVo"> <sql id="selectWebhookDeviceVo">
select device_id, device_name,product_id, serial_number, status,is_shadow ,is_custom_location,things_model_value, active_time from iot_device select device_id, device_name,product_id, serial_number, status,is_shadow ,location_way,things_model_value, active_time from iot_device
</sql> </sql>
<select id="selectDeviceList" parameterType="com.ruoyi.iot.domain.Device" resultMap="DeviceResult"> <select id="selectDeviceList" parameterType="com.ruoyi.iot.domain.Device" resultMap="DeviceResult">
@@ -127,7 +128,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectAllDeviceShortList" parameterType="com.ruoyi.iot.domain.Device" resultMap="DeviceAllShortResult"> <select id="selectAllDeviceShortList" parameterType="com.ruoyi.iot.domain.Device" resultMap="DeviceAllShortResult">
select d.device_id, d.device_name, d.product_name, d.user_name, d.serial_number, d.firmware_version, d.status,d.rssi,d.is_shadow , select d.device_id, d.device_name, d.product_name, d.user_name, d.serial_number, d.firmware_version, d.status,d.rssi,d.is_shadow ,
d.is_custom_location, d.active_time,d.network_address,d.longitude,latitude d.location_way, d.active_time,d.network_address,d.longitude,latitude
from iot_device d from iot_device d
left join iot_device_user u on u.device_id = d.device_id left join iot_device_user u on u.device_id = d.device_id
<where> <where>
@@ -147,7 +148,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectDeviceShortList" parameterType="com.ruoyi.iot.domain.Device" resultMap="DeviceShortResult"> <select id="selectDeviceShortList" parameterType="com.ruoyi.iot.domain.Device" resultMap="DeviceShortResult">
select d.device_id, d.device_name, d.product_id, d.product_name, select d.device_id, d.device_name, d.product_id, d.product_name,
d.user_id, d.user_name, d.tenant_id, d.tenant_name, d.serial_number, d.user_id, d.user_name, d.tenant_id, d.tenant_name, d.serial_number,
d.firmware_version, d.status,d.rssi,d.is_shadow ,d.is_custom_location, d.firmware_version, d.status,d.rssi,d.is_shadow ,d.location_way,
d.things_model_value, d.active_time,img_url d.things_model_value, d.active_time,img_url
from iot_device d from iot_device d
left join iot_device_user u on u.device_id = d.device_id left join iot_device_user u on u.device_id = d.device_id
@@ -211,7 +212,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null">status,</if> <if test="status != null">status,</if>
<if test="rssi != null">rssi,</if> <if test="rssi != null">rssi,</if>
<if test="isShadow != null">is_shadow,</if> <if test="isShadow != null">is_shadow,</if>
<if test="isCustomLocation != null">is_custom_location,</if> <if test="locationWay != null">location_way,</if>
<if test="thingsModelValue != null">things_model_value,</if> <if test="thingsModelValue != null">things_model_value,</if>
<if test="networkAddress != null">network_address,</if> <if test="networkAddress != null">network_address,</if>
<if test="networkIp != null">network_ip,</if> <if test="networkIp != null">network_ip,</if>
@@ -239,7 +240,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null">#{status},</if> <if test="status != null">#{status},</if>
<if test="rssi != null">#{rssi},</if> <if test="rssi != null">#{rssi},</if>
<if test="isShadow != null">#{isShadow},</if> <if test="isShadow != null">#{isShadow},</if>
<if test="isCustomLocation != null">#{isCustomLocation},</if> <if test="locationWay != null">#{locationWay},</if>
<if test="thingsModelValue != null">#{thingsModelValue},</if> <if test="thingsModelValue != null">#{thingsModelValue},</if>
<if test="networkAddress != null">#{networkAddress},</if> <if test="networkAddress != null">#{networkAddress},</if>
<if test="networkIp != null">#{networkIp},</if> <if test="networkIp != null">#{networkIp},</if>
@@ -271,7 +272,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null">status = #{status},</if> <if test="status != null">status = #{status},</if>
<if test="rssi != null">rssi = #{rssi},</if> <if test="rssi != null">rssi = #{rssi},</if>
<if test="isShadow != null">is_shadow = #{isShadow},</if> <if test="isShadow != null">is_shadow = #{isShadow},</if>
<if test="isCustomLocation != null">is_custom_location = #{isCustomLocation},</if> <if test="locationWay != null">location_way = #{locationWay},</if>
<if test="thingsModelValue != null">things_model_value = #{thingsModelValue},</if> <if test="thingsModelValue != null">things_model_value = #{thingsModelValue},</if>
<if test="networkAddress != null">network_address = #{networkAddress},</if> <if test="networkAddress != null">network_address = #{networkAddress},</if>
<if test="networkIp != null">network_ip = #{networkIp},</if> <if test="networkIp != null">network_ip = #{networkIp},</if>
@@ -323,7 +324,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null">status = #{status},</if> <if test="status != null">status = #{status},</if>
<if test="rssi != null">rssi = #{rssi},</if> <if test="rssi != null">rssi = #{rssi},</if>
<if test="isShadow != null">is_shadow = #{isShadow},</if> <if test="isShadow != null">is_shadow = #{isShadow},</if>
<if test="isCustomLocation != null">is_custom_location = #{isCustomLocation},</if> <if test="locationWay != null">location_way = #{locationWay},</if>
<if test="thingsModelValue != null">things_model_value = #{thingsModelValue},</if> <if test="thingsModelValue != null">things_model_value = #{thingsModelValue},</if>
<if test="networkAddress != null">network_address = #{networkAddress},</if> <if test="networkAddress != null">network_address = #{networkAddress},</if>
<if test="networkIp != null">network_ip = #{networkIp},</if> <if test="networkIp != null">network_ip = #{networkIp},</if>

View File

@@ -7,7 +7,9 @@
<el-row :gutter="100"> <el-row :gutter="100">
<el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8"> <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8">
<el-form-item label="设备名称" prop="deviceName"> <el-form-item label="设备名称" prop="deviceName">
<el-input v-model="form.deviceName" placeholder="请输入设备名称" /> <el-input v-model="form.deviceName" placeholder="请输入设备名称">
<el-button slot="append" @click="openSummaryDialog" :disabled="form.deviceId==0">摘要</el-button>
</el-input>
</el-form-item> </el-form-item>
<el-form-item label="" prop="serialNumber"> <el-form-item label="" prop="serialNumber">
<template slot="label"> <template slot="label">
@@ -43,23 +45,23 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8"> <el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8">
<el-form-item label="定位方式" prop="isCustomLocation"> <el-form-item label="定位方式" prop="locationWay">
<el-select v-model="form.isCustomLocation" placeholder="请选择设备状态" clearable size="small" style="width:100%;"> <el-select v-model="form.locationWay" placeholder="请选择设备状态" clearable size="small" style="width:100%;">
<el-option v-for="dict in dict.type.iot_location_way" :key="dict.value" :label="dict.label" :value="Number(dict.value)" /> <el-option v-for="dict in dict.type.iot_location_way" :key="dict.value" :label="dict.label" :value="Number(dict.value)" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="设备经度" prop="longitude"> <el-form-item label="设备经度" prop="longitude">
<el-input v-model="form.longitude" placeholder="请输入设备经度" type="number" :disabled="form.isCustomLocation!=3"> <el-input v-model="form.longitude" placeholder="请输入设备经度" type="number" :disabled="form.locationWay!=3">
<el-link slot="append" :underline="false" href="https://api.map.baidu.com/lbsapi/getpoint/index.html" target="_blank">坐标拾取</el-link> <el-link slot="append" :underline="false" href="https://api.map.baidu.com/lbsapi/getpoint/index.html" target="_blank">坐标拾取</el-link>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="设备纬度" prop="latitude"> <el-form-item label="设备纬度" prop="latitude">
<el-input v-model="form.latitude" placeholder="请输入设备纬度" type="number" :disabled="form.isCustomLocation!=3"> <el-input v-model="form.latitude" placeholder="请输入设备纬度" type="number" :disabled="form.locationWay!=3">
<el-link slot="append" :underline="false" href="https://api.map.baidu.com/lbsapi/getpoint/index.html" target="_blank">坐标拾取</el-link> <el-link slot="append" :underline="false" href="https://api.map.baidu.com/lbsapi/getpoint/index.html" target="_blank">坐标拾取</el-link>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="所在地址" prop="networkAddress"> <el-form-item label="所在地址" prop="networkAddress">
<el-input v-model="form.networkAddress" placeholder="请输入设备所在地址" :disabled="form.isCustomLocation!=3" /> <el-input v-model="form.networkAddress" placeholder="请输入设备所在地址" :disabled="form.locationWay!=3" />
</el-form-item> </el-form-item>
<el-form-item label="入网地址" prop="networkIp"> <el-form-item label="入网地址" prop="networkIp">
<el-input v-model="form.networkIp" placeholder="设备入网IP" disabled /> <el-input v-model="form.networkIp" placeholder="设备入网IP" disabled />
@@ -136,10 +138,27 @@
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
<!-- 设备配置JSON -->
<el-dialog title="摘要(设备上传的只读数据)" :visible.sync="openSummary" width="600px" append-to-body>
<div style="border:1px solid #ccc;margin-top:-15px;height:400px; overflow:scroll;">
<json-viewer :value="summary" :expand-depth=10 copyable>
<template v-slot:copy>
复制
</template>
</json-viewer>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="info" @click="closeSummaryDialog"> </el-button>
</div>
</el-dialog>
</el-card> </el-card>
</template> </template>
<script> <script>
import JsonViewer from 'vue-json-viewer'
import 'vue-json-viewer/style.css'
import productList from "./product-list" import productList from "./product-list"
import deviceLog from './device-log'; import deviceLog from './device-log';
import deviceUser from './device-user'; import deviceUser from './device-user';
@@ -166,6 +185,7 @@ export default {
runningStatus, runningStatus,
productList, productList,
deviceTimer, deviceTimer,
JsonViewer,
}, },
watch: { watch: {
activeName(val) { activeName(val) {
@@ -179,6 +199,8 @@ export default {
}, },
data() { data() {
return { return {
// 打开设备配置对话框
openSummary:false,
// 是否加载完成 // 是否加载完成
isLoaded: false, isLoaded: false,
// 生成设备编码是否禁用 // 生成设备编码是否禁用
@@ -193,9 +215,11 @@ export default {
form: { form: {
productId: 0, productId: 0,
status: 1, status: 1,
isCustomLocation: 1, locationWay: 1,
firmwareVersion: 1.0, firmwareVersion: 1.0,
}, },
// 设备摘要
summary:[],
// 图片地址 // 图片地址
imageUrl: require('@/assets/images/product.jpg'), imageUrl: require('@/assets/images/product.jpg'),
// 地址 // 地址
@@ -255,6 +279,7 @@ export default {
getDevice(deviceId) { getDevice(deviceId) {
getDevice(deviceId).then(response => { getDevice(deviceId).then(response => {
this.form = response.data; this.form = response.data;
this.summary=JSON.parse(this.form.summary);
// 禁用状态 // 禁用状态
if (this.form.status == 2) { if (this.form.status == 2) {
this.deviceStatus = 1; this.deviceStatus = 1;
@@ -311,7 +336,7 @@ export default {
updateBy: null, updateBy: null,
updateTime: null, updateTime: null,
remark: null, remark: null,
isCustomLocation: 1, locationWay: 1,
}; };
this.deviceStatus = 0; this.deviceStatus = 0;
this.resetForm("form"); this.resetForm("form");
@@ -358,6 +383,14 @@ export default {
getUserData(user) { getUserData(user) {
}, },
/**关闭物模型 */
openSummaryDialog() {
this.openSummary = true;
},
/**关闭物模型 */
closeSummaryDialog() {
this.openSummary = false;
},
// 地图定位 // 地图定位
getmap() { getmap() {

View File

@@ -53,7 +53,7 @@
<dict-tag :options="dict.type.iot_device_status" :value="item.status" size="small" style="display:inline-block;margin-right:10px;" /> <dict-tag :options="dict.type.iot_device_status" :value="item.status" size="small" style="display:inline-block;margin-right:10px;" />
<el-tag type="success" size="small" v-if="item.isShadow==1">启用影子</el-tag> <el-tag type="success" size="small" v-if="item.isShadow==1">启用影子</el-tag>
<el-tag type="info" size="small" v-else>禁用影子</el-tag> <el-tag type="info" size="small" v-else>禁用影子</el-tag>
<dict-tag :options="dict.type.iot_location_way" :value="item.isCustomLocation" size="small" style="display:inline-block;margin-left:10px;" /> <dict-tag :options="dict.type.iot_location_way" :value="item.locationWay" size="small" style="display:inline-block;margin-left:10px;" />
</div> </div>
<el-descriptions :column="1" size="mini"> <el-descriptions :column="1" size="mini">
<el-descriptions-item label="编号"> <el-descriptions-item label="编号">