websocket设置ip

detached
王宇航 2024-01-09 17:24:56 +08:00
parent 27065756e4
commit e053fa3e7a
3 changed files with 27 additions and 8 deletions

View File

@ -14,10 +14,10 @@
雷达位置:<input type="text" name="radarLocation" placeholder="雷达位置"/>
</li>
<li>
识别类型:<select name="status" th:with="type=${@dict.getType('sys_job_status')}">
<option value="">车架</option>
<option value=""></option>
</select>
识别类型:<select type="select" name="type">
<option value="铁">铁包</option>
<option value="车"></option>
</select>
</li>
<li>
标签号:<input type="text" name="tagId" placeholder="标签号"/>

View File

@ -20,7 +20,7 @@
<div class="contact-box">
<div class="col-sm-4">
<div class="text-center">
<div class="text-center" >
<img alt="image" class="img-circle m-t-xs img-responsive" src="%IMAGE%">
<div class="m-t-xs font-bold">%radarIp%</div>
</div>
@ -97,7 +97,7 @@
$.table.init(options);
});
var socket = new WebSocket("ws://localhost/websocket");
var socket = new WebSocket("ws://192.168.120.15/websocket");
socket.onopen = function(event) {
console.log("WebSocket连接已打开");
@ -116,14 +116,21 @@
var template = $('#profileTemplate').html()
var view = ''
$.each(data, function (i, row) {
view += template.replace('%userCode%', row.userCode)
.replace('%IMAGE%', "https://xjl559.oss-cn-shanghai.aliyuncs.com/2023/12/11/%E6%88%AA%E5%B1%8F2024-01-08%2013.57.36.png")
view += template
.replace('%IMAGE%', getImageUrl(row.radarIp))
.replace('%radarIp%', row.radarIp)
.replace('%radarLocation%', row.radarLocation)
})
return `<div class="row mx-0">${view}</div>`
}
function getImageUrl(radarIp) {
if (radarIp === '192.168.0.7') {
return "https://xjl559.oss-cn-shanghai.aliyuncs.com/2023/12/11/%E6%88%AA%E5%B1%8F2024-01-08%2013.57.36.png";
} else if (radarIp === '192.168.0.8') {
return "https://xjl559.oss-cn-shanghai.aliyuncs.com/2023/12/11/%E6%88%AA%E5%B1%8F2024-01-09%2016.59.50.png";
}
}
</script>
</body>
</html>

View File

@ -96,6 +96,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM sys_primary_radar_data
) subquery
WHERE row_num = 1
<if test="tagId != null and tagId != ''">
AND tag_id like concat('%',#{tagId}, '%')
</if>
<if test="radarLocation != null and radarLocation != ''">
AND radar_location like concat('%',#{radarLocation}, '%')
</if>
<if test="type != null and type != ''">
AND ladle_number like concat('%',#{type}, '%')
</if>
<if test="createTime != null and updateTime != null">
AND DATE_FORMAT(update_time,'%Y-%m-%d') between DATE_FORMAT(#{createTime},'%Y-%m-%d') and DATE_FORMAT(#{updateTime},'%Y-%m-%d')
</if>
</select>
<!-- <insert id="insertPrimaryRadarData">-->