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

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 Integer isCustomLocation;
private Integer locationWay;
/** 设备摘要 **/
private String summary;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
public Integer getIsCustomLocation() {
return isCustomLocation;
public String getSummary() {
return summary;
}
public void setIsCustomLocation(Integer isCustomLocation) {
this.isCustomLocation = isCustomLocation;
public void setSummary(String summary) {
this.summary = summary;
}
public Integer getlocationWay() {
return locationWay;
}
public void setlocationWay(Integer locationWay) {
this.locationWay = locationWay;
}
public String getImgUrl() {

View File

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

View File

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

View File

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

View File

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

View File

@@ -18,7 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="status" column="status" />
<result property="rssi" column="rssi" />
<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="networkAddress" column="network_address" />
<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="remark" column="remark" />
<result property="imgUrl" column="img_url" />
<result property="summary" column="summary" />
</resultMap>
<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="rssi" column="rssi" />
<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="imgUrl" column="img_url" />
</resultMap>
@@ -62,7 +63,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="activeTime" column="active_time" />
<result property="rssi" column="rssi" />
<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="longitude" column="longitude" />
<result property="latitude" column="latitude" />
@@ -96,15 +97,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<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 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 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>
<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 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
left join iot_device_user u on u.device_id = d.device_id
<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 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.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
from iot_device d
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="rssi != null">rssi,</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="networkAddress != null">network_address,</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="rssi != null">#{rssi},</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="networkAddress != null">#{networkAddress},</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="rssi != null">rssi = #{rssi},</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="networkAddress != null">network_address = #{networkAddress},</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="rssi != null">rssi = #{rssi},</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="networkAddress != null">network_address = #{networkAddress},</if>
<if test="networkIp != null">network_ip = #{networkIp},</if>

View File

@@ -7,7 +7,9 @@
<el-row :gutter="100">
<el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8">
<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 label="" prop="serialNumber">
<template slot="label">
@@ -43,23 +45,23 @@
</el-form-item>
</el-col>
<el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8">
<el-form-item label="定位方式" prop="isCustomLocation">
<el-select v-model="form.isCustomLocation" placeholder="请选择设备状态" clearable size="small" style="width:100%;">
<el-form-item label="定位方式" prop="locationWay">
<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-select>
</el-form-item>
<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-input>
</el-form-item>
<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-input>
</el-form-item>
<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 label="入网地址" prop="networkIp">
<el-input v-model="form.networkIp" placeholder="设备入网IP" disabled />
@@ -136,10 +138,27 @@
</el-tab-pane>
</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>
</template>
<script>
import JsonViewer from 'vue-json-viewer'
import 'vue-json-viewer/style.css'
import productList from "./product-list"
import deviceLog from './device-log';
import deviceUser from './device-user';
@@ -158,7 +177,7 @@ import {
export default {
name: "DeviceEdit",
dicts: ['iot_device_status','iot_location_way'],
dicts: ['iot_device_status', 'iot_location_way'],
components: {
deviceLog,
deviceUser,
@@ -166,6 +185,7 @@ export default {
runningStatus,
productList,
deviceTimer,
JsonViewer,
},
watch: {
activeName(val) {
@@ -179,6 +199,8 @@ export default {
},
data() {
return {
// 打开设备配置对话框
openSummary:false,
// 是否加载完成
isLoaded: false,
// 生成设备编码是否禁用
@@ -193,9 +215,11 @@ export default {
form: {
productId: 0,
status: 1,
isCustomLocation: 1,
locationWay: 1,
firmwareVersion: 1.0,
},
// 设备摘要
summary:[],
// 图片地址
imageUrl: require('@/assets/images/product.jpg'),
// 地址
@@ -255,6 +279,7 @@ export default {
getDevice(deviceId) {
getDevice(deviceId).then(response => {
this.form = response.data;
this.summary=JSON.parse(this.form.summary);
// 禁用状态
if (this.form.status == 2) {
this.deviceStatus = 1;
@@ -311,7 +336,7 @@ export default {
updateBy: null,
updateTime: null,
remark: null,
isCustomLocation: 1,
locationWay: 1,
};
this.deviceStatus = 0;
this.resetForm("form");
@@ -358,6 +383,14 @@ export default {
getUserData(user) {
},
/**关闭物模型 */
openSummaryDialog() {
this.openSummary = true;
},
/**关闭物模型 */
closeSummaryDialog() {
this.openSummary = false;
},
// 地图定位
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;" />
<el-tag type="success" size="small" v-if="item.isShadow==1">启用影子</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>
<el-descriptions :column="1" size="mini">
<el-descriptions-item label="编号">