雷达设备状态
parent
e053fa3e7a
commit
78870baf7d
|
|
@ -93,7 +93,7 @@ public class SysDiscernController extends BaseController {
|
||||||
}
|
}
|
||||||
).collect(Collectors.toList());
|
).collect(Collectors.toList());
|
||||||
ExcelUtil<RadarTableVO> util = new ExcelUtil<RadarTableVO>(RadarTableVO.class);
|
ExcelUtil<RadarTableVO> util = new ExcelUtil<RadarTableVO>(RadarTableVO.class);
|
||||||
return util.exportExcel(collect, "标识器数据");
|
return util.exportExcel(collect, "雷达识别报表");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Log(title = "定时任务", businessType = BusinessType.DELETE)
|
@Log(title = "定时任务", businessType = BusinessType.DELETE)
|
||||||
|
|
|
||||||
|
|
@ -72,17 +72,18 @@ public class RadarStatusController
|
||||||
// 异步连接硬件
|
// 异步连接硬件
|
||||||
CompletableFuture<List<ModbusResponse>> listCompletableFuture = CompletableFuture.supplyAsync(() -> {
|
CompletableFuture<List<ModbusResponse>> listCompletableFuture = CompletableFuture.supplyAsync(() -> {
|
||||||
List<ModbusResponse> responses = new ArrayList<>();
|
List<ModbusResponse> responses = new ArrayList<>();
|
||||||
|
final ConnectionStatus connectionStatus = new ConnectionStatus();
|
||||||
Timer timer = new Timer();
|
Timer timer = new Timer();
|
||||||
|
boolean connected = false;
|
||||||
TimerTask task = new TimerTask() {
|
TimerTask task = new TimerTask() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
for (SysRadar radar : radarList) {
|
for (SysRadar radar : radarList) {
|
||||||
// ModbusResponse modbusResponse = new ModbusResponse();
|
|
||||||
ModbusMaster master = ModbusUtils.getSlave(radar.getRadarIp(), 23);
|
ModbusMaster master = ModbusUtils.getSlave(radar.getRadarIp(), 23);
|
||||||
System.out.println(radar.getRadarIp());
|
System.out.println(radar.getRadarIp());
|
||||||
ModbusResponse modbusResponse = ModbusUtils.holdingRegister();
|
ModbusResponse modbusResponse = ModbusUtils.holdingRegister();
|
||||||
|
connectionStatus.connected= true;
|
||||||
System.out.println(modbusResponse);
|
System.out.println(modbusResponse);
|
||||||
String tag = modbusResponse.getTagId();
|
String tag = modbusResponse.getTagId();
|
||||||
PrimaryRadarData primaryRadarData = new PrimaryRadarData();
|
PrimaryRadarData primaryRadarData = new PrimaryRadarData();
|
||||||
|
|
@ -104,6 +105,7 @@ public class RadarStatusController
|
||||||
System.err.println("从串口读取失败:" + "连接超时");
|
System.err.println("从串口读取失败:" + "连接超时");
|
||||||
}
|
}
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
connectionStatus.connected= false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -129,5 +131,9 @@ public class RadarStatusController
|
||||||
return rspData;
|
return rspData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class ConnectionStatus {
|
||||||
|
boolean connected = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.ruoyi.web.core.config;
|
package com.ruoyi.web.core.config;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.entity.PrimaryRadarData;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.websocket.*;
|
import javax.websocket.*;
|
||||||
|
|
@ -33,4 +34,14 @@ public class RadarStatusWebSocket {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void sendToAll(PrimaryRadarData primaryRadarData) {
|
||||||
|
for (Session session : sessions) {
|
||||||
|
try {
|
||||||
|
session.getBasicRemote().sendObject(primaryRadarData);
|
||||||
|
} catch (IOException | EncodeException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
识别类型:<select type="select" name="type">
|
识别类型:<select type="select" name="type">
|
||||||
|
<option value="" selected>所有</option>
|
||||||
<option value="铁">铁包</option>
|
<option value="铁">铁包</option>
|
||||||
<option value="车">车架</option>
|
<option value="车">车架</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
@ -39,21 +40,7 @@
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- <div class="btn-group-sm" id="toolbar" role="group">-->
|
|
||||||
<!-- <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="monitor:job:add">-->
|
|
||||||
<!-- <i class="fa fa-plus"></i> 新增-->
|
|
||||||
<!-- </a>-->
|
|
||||||
<!-- <a class="btn btn-primary single disabled" onclick="$.operate.edit()" >-->
|
|
||||||
<!-- <i class="fa fa-edit"></i> 修改-->
|
|
||||||
<!-- </a>-->
|
|
||||||
<!-- <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()">-->
|
|
||||||
<!-- <i class="fa fa-remove"></i> 删除-->
|
|
||||||
<!-- </a>-->
|
|
||||||
<!-- <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="monitor:job:export">-->
|
|
||||||
<!-- <i class="fa fa-download"></i> 导出-->
|
|
||||||
<!-- </a>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
|
|
||||||
<div class="col-sm-12 select-table table-striped">
|
<div class="col-sm-12 select-table table-striped">
|
||||||
<table id="bootstrap-table"></table>
|
<table id="bootstrap-table"></table>
|
||||||
|
|
@ -83,10 +70,6 @@
|
||||||
columns: [{
|
columns: [{
|
||||||
checkbox: true
|
checkbox: true
|
||||||
},
|
},
|
||||||
// {
|
|
||||||
// field: 'id',
|
|
||||||
// title: '序号'
|
|
||||||
// },
|
|
||||||
{
|
{
|
||||||
field: 'radarLocation',
|
field: 'radarLocation',
|
||||||
title: '雷达位置',
|
title: '雷达位置',
|
||||||
|
|
@ -120,104 +103,20 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'createTime',
|
field: 'createTime',
|
||||||
title: '记录时间',
|
title: '记录开始时间',
|
||||||
sortable: true,
|
sortable: true,
|
||||||
// formatter: function(value, row, index) {
|
},
|
||||||
// // Assuming value is a timestamp in milliseconds
|
{
|
||||||
// var startTime = row.updateTime;
|
field: 'updateTime',
|
||||||
//
|
title: '记录结束时间',
|
||||||
// // Get the value of the end time field
|
}
|
||||||
// var endTime = row.updateTime;
|
|
||||||
// var endTimeString = '';
|
|
||||||
//
|
|
||||||
// // Check if the endTime field exists and is not null
|
|
||||||
// if (endTime !== undefined && endTime !== null) {
|
|
||||||
// // Assuming endTime is also a timestamp in milliseconds
|
|
||||||
// endTime = '';
|
|
||||||
//
|
|
||||||
// // Format the end time as desired
|
|
||||||
// endTimeString = endTime.toLocaleTimeString();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // Format the start time as desired
|
|
||||||
// var startTimeString = startTime.toLocaleTimeString();
|
|
||||||
//
|
|
||||||
// // Return the formatted time range
|
|
||||||
// return startTimeString + ' - ' + endTimeString;
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
// {
|
|
||||||
// title: '操作',
|
|
||||||
// align: 'center',
|
|
||||||
// formatter: function(value, row, index) {
|
|
||||||
// var actions = [];
|
|
||||||
// actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:;" onclick="$.operate.edit(\'' + row.jobId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
|
|
||||||
// actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:;" onclick="$.operate.remove(\'' + row.jobId + '\')"><i class="fa fa-remove"></i>删除</a> ');
|
|
||||||
// var more = [];
|
|
||||||
// more.push("<a class='btn btn-default btn-xs " + statusFlag + "' href='javascript:void(0)' onclick='run(" + row.jobId + ")'><i class='fa fa-play-circle-o'></i> 执行一次</a> ");
|
|
||||||
// more.push("<a class='btn btn-default btn-xs " + detailFlag + "' href='javascript:void(0)' onclick='$.operate.detail(" + row.jobId + ")'><i class='fa fa-search'></i>任务详细</a> ");
|
|
||||||
// more.push("<a class='btn btn-default btn-xs " + detailFlag + "' href='javascript:void(0)' onclick='jobLog(" + row.jobId + ")'><i class='fa fa-list'></i>调度日志</a>");
|
|
||||||
// actions.push('<a class="btn btn-info btn-xs" role="button" data-container="body" data-placement="left" data-toggle="popover" data-html="true" data-trigger="hover" data-content="' + more.join('') + '"><i class="fa fa-chevron-circle-right"></i>更多操作</a>');
|
|
||||||
// return actions.join('');
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
$.table.init(options);
|
$.table.init(options);
|
||||||
});
|
});
|
||||||
|
|
||||||
/* 调度任务状态显示 */
|
|
||||||
function statusTools(row) {
|
|
||||||
if (row.status == 1) {
|
|
||||||
return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="start(\'' + row.jobId + '\', \'' + row.jobGroup + '\')"></i> ';
|
|
||||||
} else {
|
|
||||||
return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="stop(\'' + row.jobId + '\', \'' + row.jobGroup + '\')"></i> ';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 立即执行一次 */
|
|
||||||
function run(jobId) {
|
|
||||||
$.modal.confirm("确认要立即执行一次任务吗?", function() {
|
|
||||||
$.operate.post(prefix + "/run", { "jobId": jobId});
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 调度任务-停用 */
|
|
||||||
function stop(jobId, jobGroup) {
|
|
||||||
$.modal.confirm("确认要停用任务吗?", function() {
|
|
||||||
$.operate.post(prefix + "/changeStatus", { "jobId": jobId, "jobGroup": jobGroup, "status": 1 });
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 调度任务-启用 */
|
|
||||||
function start(jobId, jobGroup) {
|
|
||||||
$.modal.confirm("确认要启用任务吗?", function() {
|
|
||||||
$.operate.post(prefix + "/changeStatus", { "jobId": jobId, "jobGroup": jobGroup, "status": 0 });
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 调度日志查询 */
|
|
||||||
function jobLog(jobId) {
|
|
||||||
var url = ctx + 'monitor/jobLog';
|
|
||||||
if ($.common.isNotEmpty(jobId)) {
|
|
||||||
url += '?jobId=' + jobId;
|
|
||||||
}
|
|
||||||
$.modal.openTab("调度日志", url);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* cron表达式生成 */
|
|
||||||
function cron() {
|
|
||||||
var url = prefix + '/cron';
|
|
||||||
var height = $(window).height() - 50;
|
|
||||||
top.layer.open({
|
|
||||||
maxmin: true,
|
|
||||||
title: "Cron表达式生成器",
|
|
||||||
type: 2,
|
|
||||||
area: ['800px', height + "px" ], //宽高
|
|
||||||
shadeClose: true,
|
|
||||||
content: url
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
@ -48,34 +48,16 @@
|
||||||
showToggle: false,
|
showToggle: false,
|
||||||
showColumns: false,
|
showColumns: false,
|
||||||
showExport: true,
|
showExport: true,
|
||||||
columns: [{
|
columns: [
|
||||||
checkbox: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field : 'userId',
|
|
||||||
title : '用户ID'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field : 'userCode',
|
|
||||||
title : '用户编号'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
field : 'radarIp',
|
field : 'radarIp',
|
||||||
title : '雷达ip'
|
title : '雷达ip'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field : 'userPhone',
|
field : 'radarLocation',
|
||||||
title : '用户手机'
|
title : '用户手机'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field : 'userEmail',
|
|
||||||
title : '用户邮箱'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field : 'userBalance',
|
|
||||||
title : '用户余额'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'status',
|
field: 'status',
|
||||||
title: '用户状态',
|
title: '用户状态',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
|
|
@ -128,7 +110,7 @@
|
||||||
if (radarIp === '192.168.0.7') {
|
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";
|
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') {
|
} 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";
|
return "https://xjl559.oss-cn-shanghai.aliyuncs.com/2023/12/11/%E6%88%AA%E5%B1%8F2024-01-08%2013.57.36.png";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.ruoyi.common.core.domain.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DataResponse {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 雷达ip
|
||||||
|
*/
|
||||||
|
private String radarIp;
|
||||||
|
/**
|
||||||
|
* 雷达工位
|
||||||
|
*/
|
||||||
|
private String radarLocation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 雷达连接状态
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -54,8 +54,11 @@ public class RadarTableVO extends BaseEntity
|
||||||
@Excel(name = "读取次数")
|
@Excel(name = "读取次数")
|
||||||
private String totalCount;
|
private String totalCount;
|
||||||
|
|
||||||
|
@Excel(name = "记录开始时间" ,dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
|
@Excel(name = "记录结束时间" , dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue