feat: 新增 ntrip 推送 list
This commit is contained in:
parent
c25772ae68
commit
2adc892fd2
@ -230,6 +230,50 @@ public class GnssDeviceController extends BasicController{
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
@GetMapping("/gnss/ntrip/list")
|
||||
@ResponseBody
|
||||
public JSONObject ntripList(HttpSession session,
|
||||
@RequestParam int page,
|
||||
@RequestParam int limit,
|
||||
@RequestParam(value = "device_id", required = false) String deviceId) {
|
||||
Page<GnssDevice> pageable = new Page<>(page, limit);
|
||||
QueryWrapper<GnssDevice> qw = new QueryWrapper<>();
|
||||
Integer tenantId = getTenantId(session);
|
||||
if (tenantId != null && tenantId != Tenant.SAAS_PROVIDER_ID) {
|
||||
qw.eq("tenantid", tenantId);
|
||||
}
|
||||
if (StringUtils.hasText(deviceId)) {
|
||||
qw.like("deviceid", deviceId);
|
||||
}
|
||||
qw.orderByDesc("forward_to_ntrip");
|
||||
qw.orderByDesc("updatetime", "createtime");
|
||||
IPage<GnssDevice> cs = gnssDeviceMapper.selectPage(pageable, qw);
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("code", 0);
|
||||
json.put("msg", "");
|
||||
json.put("count", cs.getTotal());
|
||||
json.put("data", cs.getRecords());
|
||||
return json;
|
||||
}
|
||||
|
||||
/*** 更新是否推送到 NtripCaster ***/
|
||||
@PostMapping("/gnss/ntrip/update_forward")
|
||||
@ResponseBody
|
||||
public String updateNtripForward(HttpSession session,
|
||||
@RequestParam("device_id") String deviceId,
|
||||
@RequestParam("forward") Boolean forward) {
|
||||
QueryWrapper<GnssDevice> qw = new QueryWrapper<>();
|
||||
qw.eq("deviceid", deviceId).last("limit 1");
|
||||
GnssDevice exist = gnssDeviceMapper.selectOne(qw);
|
||||
if (exist == null) return HttpResult.failed("设备不存在");
|
||||
GnssDevice upd = new GnssDevice();
|
||||
upd.setId(exist.getId());
|
||||
upd.setForward_to_ntrip(forward);
|
||||
upd.setUpdatetime(LocalDateTime.now());
|
||||
gnssDeviceMapper.updateById(upd);
|
||||
return "ok";
|
||||
}
|
||||
|
||||
@PostMapping("/gnss/device/update")
|
||||
@ResponseBody
|
||||
public String update(HttpSession session, @RequestBody JSONObject object) throws Exception {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package com.imdroid.beidou.service;
|
||||
|
||||
import com.imdroid.common.util.GeoCoordConverterUtil;
|
||||
import com.imdroid.secapi.client.RtkrcvClient;
|
||||
import com.imdroid.secapi.dto.RtkTransactionMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -19,6 +21,10 @@ public class RtkMonitorService {
|
||||
@Autowired
|
||||
GroupRtkScheduler groupRtkScheduler;
|
||||
|
||||
@Autowired
|
||||
RtkTransactionMapper rtkTransactionMapper;
|
||||
|
||||
|
||||
public void onStart(String deviceId){
|
||||
running.put(deviceId, true);
|
||||
consecFix.put(deviceId, 0);
|
||||
@ -68,8 +74,7 @@ public class RtkMonitorService {
|
||||
}
|
||||
}
|
||||
|
||||
@org.springframework.beans.factory.annotation.Autowired
|
||||
com.imdroid.secapi.dto.RtkTransactionMapper rtkTransactionMapper;
|
||||
|
||||
|
||||
private void writeTransaction(String deviceId){
|
||||
java.util.LinkedList<double[]> buf = fixBuffer.get(deviceId);
|
||||
@ -82,16 +87,16 @@ public class RtkMonitorService {
|
||||
double lat = trimmedMean(latArr);
|
||||
double lon = trimmedMean(lonArr);
|
||||
double alt = trimmedMean(hArr);
|
||||
com.imdroid.beidou.util.GeoCoordConverterUtil.LLA_Coordinate L = new com.imdroid.beidou.util.GeoCoordConverterUtil.LLA_Coordinate(lat,lon,alt);
|
||||
com.imdroid.beidou.util.GeoCoordConverterUtil.ECEF_Coordinate E = com.imdroid.beidou.util.GeoCoordConverterUtil.LLA2ECEF(L);
|
||||
GeoCoordConverterUtil.LLA_Coordinate L = new GeoCoordConverterUtil.LLA_Coordinate(lat,lon,alt);
|
||||
GeoCoordConverterUtil.ECEF_Coordinate E = GeoCoordConverterUtil.LLA2ECEF(L);
|
||||
com.imdroid.secapi.dto.RtkTransaction t = new com.imdroid.secapi.dto.RtkTransaction();
|
||||
t.setDevice_id(deviceId);
|
||||
t.setLatitude(lat);
|
||||
t.setLongitude(lon);
|
||||
t.setAltitude(alt);
|
||||
t.setEcef_x(E.ECEF_X);
|
||||
t.setEcef_y(E.ECEF_Y);
|
||||
t.setEcef_z(E.ECEF_Z);
|
||||
t.setEcef_x(E.getECEF_X());
|
||||
t.setEcef_y(E.getECEF_Y());
|
||||
t.setEcef_z(E.getECEF_Z());
|
||||
t.setStatus((short)1);
|
||||
t.setChecked((short)0);
|
||||
rtkTransactionMapper.insert(t);
|
||||
|
||||
@ -17,6 +17,9 @@
|
||||
/* RTK panel ~80vh */
|
||||
#rtk-panel{height:80vh;}
|
||||
#rtk-info{max-height:calc(80vh - 120px);} /* leave room for header/badges */
|
||||
#table-ntrip + .layui-table-view{ width:100% !important; }
|
||||
#table-device + .layui-table-view{ width:100% !important; }
|
||||
#table-group + .layui-table-view{ width:100% !important; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@ -24,13 +27,37 @@
|
||||
<div class="layuimini-main">
|
||||
<div class="layui-tab layui-tab-card" lay-filter="rtk-tab">
|
||||
<ul class="layui-tab-title">
|
||||
<li class="layui-this">分组管理</li>
|
||||
<li class="layui-this">Ntrip 推送管理</li>
|
||||
<li>分组管理</li>
|
||||
<li>设备管理</li>
|
||||
<li>单设备定位</li>
|
||||
<li>组设备定位</li>
|
||||
</ul>
|
||||
<div class="layui-tab-content">
|
||||
<div class="layui-tab-item layui-show">
|
||||
<div class="layui-row" style="margin:10px 0;">
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-form layui-form-pane">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">设备号</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="ntrip-deviceid" placeholder="设备号" autocomplete="off" class="layui-input" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<button class="layui-btn" id="btn-ntrip-search">搜索</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="margin-top:10px;">
|
||||
<table class="layui-hide" id="table-ntrip" lay-filter="table-ntrip-filter"></table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-tab-item">
|
||||
<div class="layui-row">
|
||||
<div class="layui-col-md12">
|
||||
<div class="btn-bar">
|
||||
@ -189,6 +216,51 @@ layui.use(['form','table','element','layer','transfer'], function(){
|
||||
|
||||
form.render();
|
||||
|
||||
// Ntrip 推送管理
|
||||
var ntripTableIns = table.render({
|
||||
elem: '#table-ntrip',
|
||||
url: '/gnss/ntrip/list',
|
||||
id: 'ntrip-table-id',
|
||||
cols: [ [
|
||||
{field:'deviceid', title:'设备号', sort:true},
|
||||
{field:'tenantname', title:'所属组织', sort:true},
|
||||
{field:'devicetype', title:'设备类型', templet: '#ntripDevTypeTrans'},
|
||||
{field:'model', title:'型号', templet: '#ntripModelTrans'},
|
||||
{field:'project_id', title:'项目号'},
|
||||
{field:'updatetime', title:'更新时间', templet: "<div>{{layui.util.toDateString(d.updatetime, 'yyyy-MM-dd HH:mm:ss')}}</div>"},
|
||||
{field:'forward_to_ntrip', title:'推送Ntrip', width:120, fixed:'right', align:'center', templet: function(d){
|
||||
var checked = d.forward_to_ntrip? 'checked' : '';
|
||||
return '<input type="checkbox" lay-filter="ntrip-fwd-switch" data-device="'+ (d.deviceid||'') +'" '+checked+' lay-skin="switch" lay-text="开|关">';
|
||||
}}
|
||||
] ],
|
||||
limits:[10,20,50,100],
|
||||
limit:10,
|
||||
page:true,
|
||||
skin:'line'
|
||||
});
|
||||
|
||||
$('#btn-ntrip-search').on('click', function(){
|
||||
var did = $('#ntrip-deviceid').val();
|
||||
ntripTableIns.reload({ where:{ device_id: did }, page:{ curr:1 } });
|
||||
});
|
||||
|
||||
form.on('switch(ntrip-fwd-switch)', function(obj){
|
||||
var el = $(obj.elem);
|
||||
var device = el.attr('data-device');
|
||||
var val = obj.elem.checked;
|
||||
$.post('/gnss/ntrip/update_forward', { device_id: device, forward: val }, function(res){
|
||||
if(res === 'ok' || (res && res.code === 0)){
|
||||
layer.msg('已更新');
|
||||
} else {
|
||||
layer.alert((res && res.msg) || '更新失败');
|
||||
obj.elem.checked = !val; form.render('checkbox');
|
||||
}
|
||||
}).fail(function(){
|
||||
layer.alert('请求失败');
|
||||
obj.elem.checked = !val; form.render('checkbox');
|
||||
});
|
||||
});
|
||||
|
||||
var selectedGroup = null;
|
||||
var transferIns = null;
|
||||
var groupTableIns = table.render({
|
||||
@ -203,7 +275,8 @@ layui.use(['form','table','element','layer','transfer'], function(){
|
||||
] ],
|
||||
limits: [10,20,50,100],
|
||||
limit: 10,
|
||||
page: true
|
||||
page: true,
|
||||
skin: 'line'
|
||||
});
|
||||
|
||||
table.on('radio(table-group-filter)', function(obj){
|
||||
@ -332,7 +405,8 @@ layui.use(['form','table','element','layer','transfer'], function(){
|
||||
] ],
|
||||
limits: [10,20,50,100],
|
||||
limit: 10,
|
||||
page: true
|
||||
page: true,
|
||||
skin: 'line'
|
||||
});
|
||||
|
||||
$('#btn-device-search').on('click', function(){
|
||||
@ -557,5 +631,21 @@ layui.use(['form','table','element','layer','transfer'], function(){
|
||||
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="ntripDevTypeTrans">
|
||||
{{# if(d.devicetype == 1){ }}
|
||||
<span>基准站</span>
|
||||
{{# } else { }}
|
||||
<span>监测站</span>
|
||||
{{# } }}
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="ntripModelTrans">
|
||||
{{# if(d.model == 1){ }}
|
||||
<span>G510</span>
|
||||
{{# } else { }}
|
||||
<span>G505</span>
|
||||
{{# } }}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user