#添加了设备类型查询显示

This commit is contained in:
2026-10-30 09:07:08 +08:00
parent e501d58563
commit f25a0b5018
4 changed files with 42 additions and 24 deletions

View File

@@ -234,6 +234,12 @@ public class Device extends BaseDO {
private Boolean hasHost;
@TableField(exist = false)
private String productModel;// 产品型号
@TableField(exist = false)
private String deviceType;
@TableField(exist = false)
private LocationMessage locationMessage;

View File

@@ -570,16 +570,16 @@ public class HostMessageHandler implements CustomMqttMessageHandler {
}
}
}
// try {
// NettyDevice device = deviceSessionManager.getDevice(deviceId);
// if (device != null && device.getDevice() != null) {
// Long siteId = device.getDevice().getSiteId();
// websocketMesDispather.mapMessageDispather(siteId,
// JsonUtils.toJsonString(sendDto));
// }
// } catch (Exception e) {
// log.error("实时地图数据websocket推送失败: siteId={}, error={}", e);
// }
try {
NettyDevice device = deviceSessionManager.getDevice(deviceId);
if (device != null && device.getDevice() != null) {
Long siteId = device.getDevice().getSiteId();
websocketMesDispather.mapMessageDispather(siteId,
JsonUtils.toJsonString(sendDto));
}
} catch (Exception e) {
log.error("实时地图数据websocket推送失败: siteId={}, error={}", e);
}
// todo 推送实时位置和状态消息到外部
try {
GlobalMemory.customMqttDeviceMonitor.publish(mqttClientId,

View File

@@ -174,6 +174,16 @@ public class HostComputerController extends BaseController {
}
}
}
try {
NettyDevice device = deviceSessionManager.getDevice(deviceId);
if (device != null && device.getDevice() != null) {
Long siteId = device.getDevice().getSiteId();
websocketMesDispather.mapMessageDispather(siteId,
JsonUtils.toJsonString(dto));
}
} catch (Exception e) {
log.error("实时地图数据websocket推送失败: siteId={}, error={}", e);
}
GlobalMemory.customMqttDeviceMonitor.publish(mqttClientId,
String.format(MqttTopic.DEVICE_ROUTE_PUSH_TOPIC, deviceId),
JsonUtils.toJsonString(dto));
@@ -248,8 +258,6 @@ public class HostComputerController extends BaseController {
String.format("%.6f", minLng), String.format("%.6f", maxLng));
}
@GetMapping("/searchDevice")
public AjaxResult searchDevice(@RequestParam String deviceId) throws Exception {
hostComputerService.searchDevice(deviceId);

View File

@@ -9,9 +9,9 @@
<result property="deviceAlias" column="device_alias"/>
<result property="orgId" column="org_id"/>
<result property="siteId" column="site_id"/>
<result property="deviceName" column="device_name"/>
<result property="productId" column="product_id"/>
<result property="productName" column="product_name"/>
<result property="deviceName" column="device_name"/>
<result property="productModel" column="product_model"/>
<result property="deviceType" column="device_type"/>
<result property="tenantId" column="tenant_id"/>
<result property="tenantName" column="tenant_name"/>
<result property="serialNumber" column="serial_number"/>
@@ -52,8 +52,8 @@
d.org_id,
d.site_id,
d.device_name,
d.product_id,
d.product_name,
p.product_model,
p.device_type,
d.tenant_id,
d.tenant_name,
d.serial_number,
@@ -77,7 +77,7 @@
d.remark,
d.slave_id
from iot_device d
left join device_product p on d.product_id = p.id
left join iot_device_run_param p on d.device_name = p.device_id
</sql>
<sql id="selectDeviceShortVo">
@@ -128,8 +128,10 @@
<if test="gwDevCode != null and gwDevCode != ''">and d.gw_dev_code = #{gwDevCode}</if>
<if test="deviceName != null and deviceName != ''">and d.device_name like concat('%', #{deviceName}, '%')
</if>
<if test="productId != null ">and d.product_id = #{productId}</if>
<if test="productName != null and productName != ''">and d.product_name like concat('%', #{productName},
<if test="deviceType != null and deviceType != ''">and p.device_type like concat('%', #{deviceType},
'%')
</if>
<if test="productModel != null and productModel != ''">and p.product_model like concat('%', #{productModel},
'%')
</if>
<if test="tenantId != null ">and d.tenant_id = #{tenantId}</if>
@@ -165,8 +167,10 @@
<if test="1==1">and ISNULL(a.device_id)</if>
<if test="deviceName != null and deviceName != ''">and d.device_name like concat('%', #{deviceName}, '%')
</if>
<if test="productId != null ">and d.product_id = #{productId}</if>
<if test="productName != null and productName != ''">and d.product_name like concat('%', #{productName},
<if test="deviceType != null and deviceType != ''">and p.device_type like concat('%', #{deviceType},
'%')
</if>
<if test="productModel != null and productModel != ''">and p.product_model like concat('%', #{productModel},
'%')
</if>
<if test="tenantId != null ">and d.tenant_id = #{tenantId}</if>
@@ -264,7 +268,7 @@
<select id="selectDeviceBySerialNumber" parameterType="String" resultMap="DeviceResult">
<include refid="selectDeviceVo"/>
where serial_number = #{serialNumber}
where d.serial_number = #{serialNumber}
</select>
<select id="selectDeviceCountBySerialNumber" parameterType="String" resultType="int">
@@ -507,6 +511,6 @@
<select id="selectDeviceBySpiltCode" parameterType="String" resultMap="DeviceResult">
<include refid="selectDeviceVo"/>
where device_name like concat('%', #{code}, '%')
where d.device_name like concat('%', #{code}, '%')
</select>
</mapper>