Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
GeoFlyApi
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
GeoFly
GeoFlyApi
Commits
04c142d5
Commit
04c142d5
authored
Aug 18, 2025
by
gdj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
区分mqtt内外网地址。
parent
86701127
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
6 deletions
+44
-6
sample/src/main/java/com/dji/sample/component/mqtt/config/MqttPropertyConfiguration.java
+19
-0
sample/src/main/java/com/dji/sample/component/mqtt/model/MqttUseEnum.java
+5
-0
sample/src/main/java/com/dji/sample/manage/service/impl/UserServiceImpl.java
+3
-2
sample/src/main/resources/application.yml
+17
-4
No files found.
sample/src/main/java/com/dji/sample/component/mqtt/config/MqttPropertyConfiguration.java
View file @
04c142d5
...
...
@@ -54,6 +54,25 @@ public class MqttPropertyConfiguration {
}
/**
* Get the configuration options of the net link of the mqtt client.
* @return
*/
static
MqttClientOptions
getNetClientOptions
()
{
if
(!
mqtt
.
containsKey
(
MqttUseEnum
.
NET
))
{
throw
new
Error
(
"Please configure the net mqtt connection parameters first, otherwise application cannot be started."
);
}
return
mqtt
.
get
(
MqttUseEnum
.
NET
);
}
/**
* Get the mqtt address of the net link.
* @return
*/
public
static
String
getNetMqttAddress
()
{
return
getMqttAddress
(
getNetClientOptions
());
}
/**
* Splice the mqtt address according to the parameters of different clients.
* @param options
* @return
...
...
sample/src/main/java/com/dji/sample/component/mqtt/model/MqttUseEnum.java
View file @
04c142d5
...
...
@@ -8,6 +8,11 @@ package com.dji.sample.component.mqtt.model;
public
enum
MqttUseEnum
{
/**
* The broker is used for net link.
*/
NET
,
/**
* The broker is used for basic link.
*/
BASIC
,
...
...
sample/src/main/java/com/dji/sample/manage/service/impl/UserServiceImpl.java
View file @
04c142d5
...
...
@@ -181,7 +181,8 @@ public class UserServiceImpl extends ServiceImpl<IUserMapper, UserEntity> implem
String
token
=
JwtUtil
.
createToken
(
customClaim
.
convertToMap
());
UserDTO
userDTO
=
entityConvertToDTO
(
userEntity
);
userDTO
.
setMqttAddr
(
MqttPropertyConfiguration
.
getBasicMqttAddress
());
// 无人机登录 获取外网地址
userDTO
.
setMqttAddr
(
MqttPropertyConfiguration
.
getNetMqttAddress
());
userDTO
.
setAccessToken
(
token
);
userDTO
.
setWorkspaceId
(
workspaceOpt
.
get
().
getWorkspaceId
());
userDTO
.
setRoleType
(
roleType
);
...
...
@@ -684,7 +685,7 @@ public class UserServiceImpl extends ServiceImpl<IUserMapper, UserEntity> implem
.
roleType
(
entity
.
getRoleType
())
.
mqttUsername
(
entity
.
getMqttUsername
())
.
mqttPassword
(
entity
.
getMqttPassword
())
.
mqttAddr
(
MqttPropertyConfiguration
.
get
Basic
MqttAddress
())
.
mqttAddr
(
MqttPropertyConfiguration
.
get
Net
MqttAddress
())
.
build
();
}
...
...
sample/src/main/resources/application.yml
View file @
04c142d5
...
...
@@ -62,19 +62,32 @@ jwt:
mqtt
:
# @see com.dji.sample.component.mqtt.model.MqttUseEnum
# BASIC parameters are required.
NET
:
# protocol: MQTT # @see com.dji.sample.component.mqtt.model.MqttProtocolEnum
# host: 183.11.236.162
# port: 54418
# username: JavaServer
# password: 123456
# client-id: 123456
protocol
:
WSS
host
:
geofly.geotwin.cn
port
:
443
path
:
/mqtt
username
:
JavaServer
password
:
123456
BASIC
:
protocol
:
MQTT
# @see com.dji.sample.component.mqtt.model.MqttProtocolEnum
# 深圳
host
:
183.11.236.162
port
:
54418
#
host: 183.11.236.162
#
port: 54418
# host: 203.186.109.106
# host: emqx-broker
# host: 192.168.32.90
# port: 44418
# host: 203.186.109.106
# port: 54941
#
host: emqx-broker
#
port: 1883
host
:
emqx-broker
port
:
1883
username
:
JavaServer
password
:
123456
client-id
:
123456
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment