diff --git a/sec-beidou/src/main/java/com/imdroid/beidou/controller/GnssDeviceController.java b/sec-beidou/src/main/java/com/imdroid/beidou/controller/GnssDeviceController.java index eb72a590..db8e1cad 100644 --- a/sec-beidou/src/main/java/com/imdroid/beidou/controller/GnssDeviceController.java +++ b/sec-beidou/src/main/java/com/imdroid/beidou/controller/GnssDeviceController.java @@ -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 pageable = new Page<>(page, limit); + QueryWrapper 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 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 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 { diff --git a/sec-beidou/src/main/java/com/imdroid/beidou/service/RtkMonitorService.java b/sec-beidou/src/main/java/com/imdroid/beidou/service/RtkMonitorService.java index dbbba160..1230e2d6 100644 --- a/sec-beidou/src/main/java/com/imdroid/beidou/service/RtkMonitorService.java +++ b/sec-beidou/src/main/java/com/imdroid/beidou/service/RtkMonitorService.java @@ -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 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); diff --git a/sec-beidou/src/main/resources/templates/page/rtkrcv.html b/sec-beidou/src/main/resources/templates/page/rtkrcv.html index d73a0706..97b10531 100644 --- a/sec-beidou/src/main/resources/templates/page/rtkrcv.html +++ b/sec-beidou/src/main/resources/templates/page/rtkrcv.html @@ -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; } @@ -24,13 +27,37 @@
    -
  • 分组管理
  • +
  • Ntrip 推送管理
  • +
  • 分组管理
  • 设备管理
  • 单设备定位
  • 组设备定位
+
+
+
+
+
+ +
+ +
+
+
+ +
+
+
+
+
+
+
+
+
+ +
@@ -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: "
{{layui.util.toDateString(d.updatetime, 'yyyy-MM-dd HH:mm:ss')}}
"}, + {field:'forward_to_ntrip', title:'推送Ntrip', width:120, fixed:'right', align:'center', templet: function(d){ + var checked = d.forward_to_ntrip? 'checked' : ''; + return ''; + }} + ] ], + 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(){ + + + +