Merge branch 'master' into feature/beidou

# Conflicts:
#	sec-beidou/src/main/resources/db/schema.sql
This commit is contained in:
fengyarnom 2024-11-21 15:31:59 +08:00
commit 09c05e4d17
16 changed files with 163 additions and 39 deletions

View File

@ -9,6 +9,9 @@ public interface RtcmClient {
@PostMapping("/config") @PostMapping("/config")
HttpResp config(@RequestParam(name = "deviceId") String deviceId, @RequestParam(name = "configuration") String configData); HttpResp config(@RequestParam(name = "deviceId") String deviceId, @RequestParam(name = "configuration") String configData);
@PostMapping("/config_by_udp")
HttpResp configByUdp(@RequestParam(name = "deviceId") String deviceId, @RequestParam(name = "configuration") String configData);
@PostMapping("/device_param_changed") @PostMapping("/device_param_changed")
HttpResp deviceParamChanged(@RequestParam(name = "deviceId") String deviceId,@RequestParam(name = "oldParentId") String oldParentId); HttpResp deviceParamChanged(@RequestParam(name = "deviceId") String deviceId,@RequestParam(name = "oldParentId") String oldParentId);

View File

@ -114,15 +114,7 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version><!-- 使用最新版本 -->
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>

View File

@ -2,13 +2,16 @@ package com.imdroid.sideslope.bd;
import com.imdroid.sideslope.sal.Device; import com.imdroid.sideslope.sal.Device;
import static com.imdroid.sideslope.bd.GeoCoordConverterUtil.ECEF2ENU;
import static com.imdroid.sideslope.bd.GeoCoordConverterUtil.LLA2ECEF;
/** /**
* 博通用GGA绝对坐标代替相对位置 * 博通用GGA绝对坐标代替相对位置
*/ */
public class FocusCalculator7 extends FocusCalculator3{ public class FocusCalculator7 extends FocusCalculator3{
final static long scale = 100000000L;//地球1°111km放大到mm乘以100,000,000 //final static long scale = 100000000L;//地球1°111km放大到mm乘以100,000,000
final static int bad_change_mm = 500;//固定解跳变连续10次超过500mm认为是周跳 final static int bad_change_mm = 500;//固定解跳变连续10次超过500mm认为是周跳
final static int bad_duration = 10; final static int bad_duration = 10;
@ -18,7 +21,7 @@ public class FocusCalculator7 extends FocusCalculator3{
super(bsDevice); super(bsDevice);
} }
@Override /*@Override
public void addGGA(Gga gga) { public void addGGA(Gga gga) {
if(gga == null) return; if(gga == null) return;
@ -41,6 +44,55 @@ public class FocusCalculator7 extends FocusCalculator3{
} }
else if(gga.getQuality() == 5) counterNoFixed++; else if(gga.getQuality() == 5) counterNoFixed++;
else counterNoB562 ++; else counterNoB562 ++;
}*/
@Override
public void addGGA(Gga gga) {
if(gga == null) return;
double[] end;
// 测站的GGA - 测站 LLA 数据
GeoCoordConverterUtil.LLA_Coordinate rover_lla = new GeoCoordConverterUtil.LLA_Coordinate(gga.getLatitude(),gga.getLongitude(),gga.getAltitude());
// 测站 LLA 坐标转 ECEF 坐标单位米
GeoCoordConverterUtil.ECEF_Coordinate rover_ecef = LLA2ECEF(rover_lla);
if(bsDevice==null || bsDevice.getEcefx()==null){
end = new double[]{
rover_ecef.getECEF_X()*1000,
rover_ecef.getECEF_Y()*1000,
rover_ecef.getECEF_Z()*1000,
gga.getQuality()};
}
else {
// 查询测站的绑定的基站
GeoCoordConverterUtil.ECEF_Coordinate reference_ecef = new GeoCoordConverterUtil.ECEF_Coordinate(bsDevice.getEcefx(), bsDevice.getEcefy(), bsDevice.getEcefz());
// 以基站为站心的 ENU 坐标
GeoCoordConverterUtil.ENU_Coordinate difference_enu = ECEF2ENU(reference_ecef, rover_ecef);
end = new double[]{
difference_enu.ENU_E*1000,
difference_enu.ENU_N*1000,
difference_enu.ENU_U*1000,
gga.getQuality()};
}
if(gga.isFixed()) {
counterFixedResult++;
if(pointList.size()>0){
double[] lastXyz = pointList.get(pointList.size()-1);
if(Math.abs(end[0]-lastXyz[0])>bad_change_mm ||
Math.abs(end[1]-lastXyz[1])>bad_change_mm ||
Math.abs(end[2]-lastXyz[2])>bad_change_mm){
bad_count++;
return;
}
}
bad_count = 0;
pointList.add(end);
}
else if(gga.getQuality() == 5) counterNoFixed++;
else counterNoB562 ++;
} }
@Override @Override

View File

@ -49,6 +49,9 @@ public class D3F0SelfCheckMessageExecutor implements Executor<D3F0SelfCheckMessa
Device device = deviceService.findByDeviceId(message.getId()); Device device = deviceService.findByDeviceId(message.getId());
if(device == null) return null; if(device == null) return null;
//应答
sendD3F1Ack(device);
// 检查是否需要对设备的F9P进行断电操作 // 检查是否需要对设备的F9P进行断电操作
checkAndSendF9PPowerOffCommand(device); checkAndSendF9PPowerOffCommand(device);
// 补齐tenantId // 补齐tenantId
@ -120,4 +123,14 @@ public class D3F0SelfCheckMessageExecutor implements Executor<D3F0SelfCheckMessa
rtcmClient.config(device.getDeviceId(), sendCmd); rtcmClient.config(device.getDeviceId(), sendCmd);
saveMsg(device.getDeviceId(), device.getTenantId(),0xD313, sendCmd, true); saveMsg(device.getDeviceId(), device.getTenantId(),0xD313, sendCmd, true);
} }
void sendD3F1Ack(Device device){
int flag = 0xD3F1;
short len = (short) (4);
String sendCmd = Integer.toHexString(flag)+
HexUtil.Short2HexString(len)+
HexUtil.Int2HexString(Integer.parseInt(device.getDeviceId()));
rtcmClient.config(device.getDeviceId(), sendCmd);
}
} }

View File

@ -57,6 +57,40 @@ public class D3F0SelfCheckMessage extends BaseMessage {
" blVer:"+src.readUnsignedByte() + " blVer:"+src.readUnsignedByte() +
" reboot:"+src.readUnsignedShort(); " reboot:"+src.readUnsignedShort();
} }
if(src.readableBytes()>=8){
long lastActiveDate = src.readUnsignedInt();
long lastActiveTime = src.readUnsignedInt();
short year = (short) ((lastActiveDate>>16)&0xFF);
short month = (short) ((lastActiveDate>>8)&0xFF);
short day = (short) (lastActiveDate&0xFF);
byte hour = (byte) (lastActiveTime/3600);
byte munite = (byte) (lastActiveTime/60 - hour*60);
auxInfo = auxInfo + " last active time:"+
year+"-"+month+"-"+day+" "+hour+":"+munite;
}
if(src.readableBytes()>=14){
int uart1Exception = src.readUnsignedShort();
int uart2Exception = src.readUnsignedShort();
int dtuException = src.readUnsignedShort();
long lastDtuErrDate = src.readUnsignedInt();
long lastDtuErrTime = src.readUnsignedInt();
if(uart1Exception>0) {
auxInfo = auxInfo + " uart1 err: "+uart1Exception;
}
if(uart2Exception>0) {
auxInfo = auxInfo + " uart2 err: "+uart2Exception;
}
if(lastDtuErrDate!=0){
auxInfo = auxInfo + " last dtu err state: "+dtuException;
short year = (short) ((lastDtuErrDate>>16)&0xFF);
short month = (short) ((lastDtuErrDate>>8)&0xFF);
short day = (short) (lastDtuErrDate&0xFF);
byte hour = (byte) (lastDtuErrTime/3600);
byte munite = (byte) (lastDtuErrTime/60 - hour*60);
auxInfo = auxInfo + " time: "+
year+"-"+month+"-"+day+" "+hour+":"+munite;
}
}
// read 会移动 bytebuf 的指针所以保存原始码流需要将此指针挑拨回开始处 // read 会移动 bytebuf 的指针所以保存原始码流需要将此指针挑拨回开始处
src.readerIndex(0); src.readerIndex(0);

View File

@ -32,11 +32,11 @@ public class RtcmUdpHandler extends ChannelInboundHandlerAdapter {
if (packet.content() == null) { if (packet.content() == null) {
return; return;
} }
if (logger.isDebugEnabled()) { /*if (logger.isDebugEnabled()) {
byte[] data = new byte[packet.content().readableBytes()]; byte[] data = new byte[packet.content().readableBytes()];
packet.content().getBytes(0, data); packet.content().getBytes(0, data);
logger.debug("receive message:" + DataTypeUtil.getHexString(data)); logger.debug("receive message:" + DataTypeUtil.getHexString(data));
} }*/
// 消息解析 // 消息解析
BaseMessage message = MessageParser.instance.parse(packet.content()); BaseMessage message = MessageParser.instance.parse(packet.content());
OnlineChannels.INSTANCE.updateDataChannel(message.getId(), ctx.channel(), packet.sender()); OnlineChannels.INSTANCE.updateDataChannel(message.getId(), ctx.channel(), packet.sender());

View File

@ -70,6 +70,33 @@ public class ApiController {
return resp; return resp;
} }
@PostMapping(value = "/config_by_udp")
public HttpResp configByUdp(String deviceId, String configuration) {
Map<String, Object> status = new HashMap<>();
HttpResp resp = new HttpResp();
DeviceChannel deviceChannel = OnlineChannels.INSTANCE.getDataChannel(deviceId);
if(deviceChannel!=null){
status.put("status", "Online");
// send command
ByteBuf buf = Unpooled.buffer();
byte[] data = getBinaryData(ConfigDataTypeEnum.HEX, configuration);
logger.info("send command:{}", configuration);
buf.writeBytes(data);
deviceChannel.writeAndFlush(buf);
}
if (status.isEmpty()) {
status.put("status", "Offline");
resp.setCode(HttpResp.HTTP_RSP_FAILED);
resp.setResponseMessage("Offline.");
} else {
resp.setResponseMessage("Command sent.");
}
resp.setResponseObject(status);
return resp;
}
@PostMapping("/device_param_changed") @PostMapping("/device_param_changed")
public HttpResp deviceParamChanged(String deviceId, String oldParentId) { public HttpResp deviceParamChanged(String deviceId, String oldParentId) {
// 更新设备缓存 // 更新设备缓存

View File

@ -20,7 +20,7 @@
</encoder> </encoder>
</appender> </appender>
<root level="debug"> <root level="info">
<appender-ref ref="STDOUT" /> <appender-ref ref="STDOUT" />
</root> </root>
<logger name="org.springframework" level="warn" /> <logger name="org.springframework" level="warn" />

View File

@ -155,7 +155,7 @@
</exclude> </exclude>
</excludes> </excludes>
</configuration> </configuration>
</plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><configuration><source>11</source><target>11</target></configuration></plugin> </plugin>
</plugins> </plugins>
</build> </build>

View File

@ -60,7 +60,8 @@ public class CmdLineController extends BasicController{
public HttpResult configCmd(HttpSession session, public HttpResult configCmd(HttpSession session,
@RequestParam("tx_win") String cmd, @RequestParam("tx_win") String cmd,
@RequestParam("device_id") String deviceId, @RequestParam("device_id") String deviceId,
@RequestParam("cmd_type") int cmdType) { @RequestParam("cmd_type") int cmdType,
@RequestParam("send_channel") int sendChannel) {
String sendCmd = cmd.replaceAll(" +",""); String sendCmd = cmd.replaceAll(" +","");
short len = 0; short len = 0;
int msgType = 0xD310 + cmdType; int msgType = 0xD310 + cmdType;
@ -75,7 +76,10 @@ public class CmdLineController extends BasicController{
sendCmd = Integer.toHexString(msgType) + HexUtil.Short2HexString(len)+ sendCmd = Integer.toHexString(msgType) + HexUtil.Short2HexString(len)+
HexUtil.Int2HexString(Integer.parseInt(deviceId))+sendCmd; HexUtil.Int2HexString(Integer.parseInt(deviceId))+sendCmd;
} }
HttpResp<HashMap<String, Object>> rsp = rtcmClient.config(deviceId,sendCmd); HttpResp<HashMap<String, Object>> rsp;
if(sendChannel == 0)
rsp = rtcmClient.config(deviceId,sendCmd);
else rsp = rtcmClient.configByUdp(deviceId,sendCmd);
String txInfo = "TX "+ dateFormat.format(System.currentTimeMillis())+ String txInfo = "TX "+ dateFormat.format(System.currentTimeMillis())+
" "+deviceId+" "+sendCmd; " "+deviceId+" "+sendCmd;

View File

@ -321,17 +321,3 @@ CREATE TABLE IF NOT EXISTS `ApiKey` (
`tenantname` varchar(100) DEFAULT NULL, `tenantname` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `gnssdevicesinglerecords` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`deviceid` varchar(64) NOT NULL COMMENT '设备ID',
`createtime` datetime(3) NOT NULL COMMENT '创建时间',
`model` smallint NOT NULL COMMENT '设备型号: 0-F9P(G505), 1-博通(G510)',
`x` double NOT NULL COMMENT 'GGA时是latitude, ECEF时是x',
`y` double NOT NULL COMMENT 'GGA时是longitude, ECEF时是y',
`z` double NOT NULL COMMENT 'GGA时是altitude, ECEF时是z',
`status` int NOT NULL DEFAULT '0' COMMENT 'GGA: 0初始化,1单点定位,2码差分,3无效PPS,4固定解,5浮点解,6估算,7人工固定,8模拟,9WAAS差分; ECEF: 0无B562,1浮点解,2固定解',
PRIMARY KEY (`id`),
KEY `idx_deviceid_createtime` (`deviceid`,`createtime`),
KEY `idx_createtime` (`createtime`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='GNSS单次解算记录表';

View File

@ -53,6 +53,15 @@
</select> </select>
</div> </div>
</div> </div>
<div class="layui-inline">
<label class="layui-form-label">发送通道</label>
<div class="layui-input-inline">
<select name="send_channel" id="send_channel" lay-filter="send_channel">
<option value="0">管理通道</option>
<option value="1">数据通道</option>
</select>
</div>
</div>
<div class="layui-inline"> <div class="layui-inline">
<div class="layui-input-block" style="float:right"> <div class="layui-input-block" style="float:right">

View File

@ -123,6 +123,9 @@
if([[${role}]] == "USER") { if([[${role}]] == "USER") {
cfg_cols[15].hide = true; cfg_cols[15].hide = true;
} }
if([[${tenant_id}]] != 0) {
cfg_cols[10].hide = true;
}
/** /**
* 初始化表单,要加上,不然刷新部分组件可能会不加载 * 初始化表单,要加上,不然刷新部分组件可能会不加载
*/ */

View File

@ -24,6 +24,12 @@
<input type="text" name="sl_user_name" autocomplete="off" class="layui-input"> <input type="text" name="sl_user_name" autocomplete="off" class="layui-input">
</div> </div>
</div> </div>
<div class="layui-inline">
<label class="layui-form-label">内容</label>
<div class="layui-input-inline">
<input type="text" name="sl_content" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label">范围</label> <label class="layui-form-label">范围</label>
<div class="layui-input-inline"> <div class="layui-input-inline">

View File

@ -100,14 +100,7 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>

View File

@ -20,3 +20,5 @@ app.format.time = HH:mm:ss
app.format.datetime = yyyy-MM-dd HH:mm:ss app.format.datetime = yyyy-MM-dd HH:mm:ss
mybatis-plus.configuration.map-underscore-to-camel-case=false mybatis-plus.configuration.map-underscore-to-camel-case=false
netty.test.port = 9917