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

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; private Boolean hasHost;
@TableField(exist = false)
private String productModel;// 产品型号
@TableField(exist = false)
private String deviceType;
@TableField(exist = false) @TableField(exist = false)
private LocationMessage locationMessage; private LocationMessage locationMessage;

View File

@@ -570,16 +570,16 @@ public class HostMessageHandler implements CustomMqttMessageHandler {
} }
} }
} }
// try { try {
// NettyDevice device = deviceSessionManager.getDevice(deviceId); NettyDevice device = deviceSessionManager.getDevice(deviceId);
// if (device != null && device.getDevice() != null) { if (device != null && device.getDevice() != null) {
// Long siteId = device.getDevice().getSiteId(); Long siteId = device.getDevice().getSiteId();
// websocketMesDispather.mapMessageDispather(siteId, websocketMesDispather.mapMessageDispather(siteId,
// JsonUtils.toJsonString(sendDto)); JsonUtils.toJsonString(sendDto));
// } }
// } catch (Exception e) { } catch (Exception e) {
// log.error("实时地图数据websocket推送失败: siteId={}, error={}", e); log.error("实时地图数据websocket推送失败: siteId={}, error={}", e);
// } }
// todo 推送实时位置和状态消息到外部 // todo 推送实时位置和状态消息到外部
try { try {
GlobalMemory.customMqttDeviceMonitor.publish(mqttClientId, 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, GlobalMemory.customMqttDeviceMonitor.publish(mqttClientId,
String.format(MqttTopic.DEVICE_ROUTE_PUSH_TOPIC, deviceId), String.format(MqttTopic.DEVICE_ROUTE_PUSH_TOPIC, deviceId),
JsonUtils.toJsonString(dto)); JsonUtils.toJsonString(dto));
@@ -248,8 +258,6 @@ public class HostComputerController extends BaseController {
String.format("%.6f", minLng), String.format("%.6f", maxLng)); String.format("%.6f", minLng), String.format("%.6f", maxLng));
} }
@GetMapping("/searchDevice") @GetMapping("/searchDevice")
public AjaxResult searchDevice(@RequestParam String deviceId) throws Exception { public AjaxResult searchDevice(@RequestParam String deviceId) throws Exception {
hostComputerService.searchDevice(deviceId); hostComputerService.searchDevice(deviceId);

View File

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