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
285a5c1e
Commit
285a5c1e
authored
Aug 02, 2025
by
gdj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
测试一键起飞保存
parent
668c47af
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
24 deletions
+61
-24
cloud-sdk/src/main/java/com/dji/sdk/cloudapi/control/TakeoffToPointRequest.java
+12
-0
sample/src/main/java/com/dji/sample/control/service/impl/ControlServiceImpl.java
+7
-1
sample/src/main/java/com/dji/sample/media/service/impl/MediaServiceImpl.java
+42
-23
No files found.
cloud-sdk/src/main/java/com/dji/sdk/cloudapi/control/TakeoffToPointRequest.java
View file @
285a5c1e
...
@@ -25,6 +25,8 @@ public class TakeoffToPointRequest extends BaseModel {
...
@@ -25,6 +25,8 @@ public class TakeoffToPointRequest extends BaseModel {
@NotNull
@NotNull
private
String
flightId
;
private
String
flightId
;
private
String
orgId
;
@Min
(-
180
)
@Min
(-
180
)
@Max
(
180
)
@Max
(
180
)
@NotNull
@NotNull
...
@@ -91,6 +93,7 @@ public class TakeoffToPointRequest extends BaseModel {
...
@@ -91,6 +93,7 @@ public class TakeoffToPointRequest extends BaseModel {
public
String
toString
()
{
public
String
toString
()
{
return
"TakeoffToPointRequest{"
+
return
"TakeoffToPointRequest{"
+
"flightId='"
+
flightId
+
'\''
+
"flightId='"
+
flightId
+
'\''
+
", orgId="
+
orgId
+
", targetLongitude="
+
targetLongitude
+
", targetLongitude="
+
targetLongitude
+
", targetLatitude="
+
targetLatitude
+
", targetLatitude="
+
targetLatitude
+
", targetHeight="
+
targetHeight
+
", targetHeight="
+
targetHeight
+
...
@@ -116,6 +119,15 @@ public class TakeoffToPointRequest extends BaseModel {
...
@@ -116,6 +119,15 @@ public class TakeoffToPointRequest extends BaseModel {
return
this
;
return
this
;
}
}
public
String
getOrgId
()
{
return
orgId
;
}
public
TakeoffToPointRequest
setOrgId
(
String
orgId
)
{
this
.
orgId
=
orgId
;
return
this
;
}
public
Float
getTargetLongitude
()
{
public
Float
getTargetLongitude
()
{
return
targetLongitude
;
return
targetLongitude
;
}
}
...
...
sample/src/main/java/com/dji/sample/control/service/impl/ControlServiceImpl.java
View file @
285a5c1e
package
com
.
dji
.
sample
.
control
.
service
.
impl
;
package
com
.
dji
.
sample
.
control
.
service
.
impl
;
import
com.dji.sample.common.util.SecurityUtils
;
import
com.dji.sample.component.redis.RedisOpsUtils
;
import
com.dji.sample.component.websocket.service.IWebSocketMessageService
;
import
com.dji.sample.component.websocket.service.IWebSocketMessageService
;
import
com.dji.sample.control.model.entity.ManageDeviceOperatingRecord
;
import
com.dji.sample.control.model.entity.ManageDeviceOperatingRecord
;
import
com.dji.sample.control.model.enums.DroneAuthorityEnum
;
import
com.dji.sample.control.model.enums.DroneAuthorityEnum
;
...
@@ -183,8 +185,12 @@ public class ControlServiceImpl implements IControlService {
...
@@ -183,8 +185,12 @@ public class ControlServiceImpl implements IControlService {
checkTakeoffCondition
(
sn
);
checkTakeoffCondition
(
sn
);
param
.
setFlightId
(
UUID
.
randomUUID
().
toString
());
param
.
setFlightId
(
UUID
.
randomUUID
().
toString
());
TakeoffToPointRequest
takeoffToPointRequest
=
mapper
.
convertValue
(
param
,
TakeoffToPointRequest
.
class
);
takeoffToPointRequest
.
setOrgId
(
SecurityUtils
.
getOrgId
());
RedisOpsUtils
.
setWithExpire
(
"templateTask:"
+
param
.
getFlightId
(),
takeoffToPointRequest
,
24
*
60
*
60
);
TopicServicesResponse
<
ServicesReplyData
>
response
=
abstractControlService
.
takeoffToPoint
(
TopicServicesResponse
<
ServicesReplyData
>
response
=
abstractControlService
.
takeoffToPoint
(
SDKManager
.
getDeviceSDK
(
sn
),
mapper
.
convertValue
(
param
,
TakeoffToPointRequest
.
class
)
);
SDKManager
.
getDeviceSDK
(
sn
),
takeoffToPointRequest
);
ServicesReplyData
reply
=
response
.
getData
();
ServicesReplyData
reply
=
response
.
getData
();
return
reply
.
getResult
().
isSuccess
()
?
return
reply
.
getResult
().
isSuccess
()
?
HttpResultResponse
.
success
()
HttpResultResponse
.
success
()
...
...
sample/src/main/java/com/dji/sample/media/service/impl/MediaServiceImpl.java
View file @
285a5c1e
package
com
.
dji
.
sample
.
media
.
service
.
impl
;
package
com
.
dji
.
sample
.
media
.
service
.
impl
;
import
com.dji.sample.component.oss.model.OssConfiguration
;
import
com.dji.sample.component.oss.model.OssConfiguration
;
import
com.dji.sample.component.redis.RedisOpsUtils
;
import
com.dji.sample.component.websocket.model.BizCodeEnum
;
import
com.dji.sample.component.websocket.model.BizCodeEnum
;
import
com.dji.sample.component.websocket.service.IWebSocketMessageService
;
import
com.dji.sample.component.websocket.service.IWebSocketMessageService
;
import
com.dji.sample.manage.model.dto.DeviceDTO
;
import
com.dji.sample.manage.model.dto.DeviceDTO
;
...
@@ -14,6 +15,7 @@ import com.dji.sample.media.service.IMediaRedisService;
...
@@ -14,6 +15,7 @@ import com.dji.sample.media.service.IMediaRedisService;
import
com.dji.sample.media.service.IMediaService
;
import
com.dji.sample.media.service.IMediaService
;
import
com.dji.sample.wayline.model.dto.WaylineJobDTO
;
import
com.dji.sample.wayline.model.dto.WaylineJobDTO
;
import
com.dji.sample.wayline.service.IWaylineJobService
;
import
com.dji.sample.wayline.service.IWaylineJobService
;
import
com.dji.sdk.cloudapi.control.TakeoffToPointRequest
;
import
com.dji.sdk.cloudapi.media.*
;
import
com.dji.sdk.cloudapi.media.*
;
import
com.dji.sdk.cloudapi.media.api.AbstractMediaService
;
import
com.dji.sdk.cloudapi.media.api.AbstractMediaService
;
import
com.dji.sdk.mqtt.MqttReply
;
import
com.dji.sdk.mqtt.MqttReply
;
...
@@ -164,41 +166,58 @@ public class MediaServiceImpl extends AbstractMediaService implements IMediaServ
...
@@ -164,41 +166,58 @@ public class MediaServiceImpl extends AbstractMediaService implements IMediaServ
// moveFile path wayline/workspaceId/jobId/fileName -> wayline/worksapceId/orgId/jobId/fileName
// moveFile path wayline/workspaceId/jobId/fileName -> wayline/worksapceId/orgId/jobId/fileName
// file.path name objectKey
// file.path name objectKey
// 查询 任务的orgId
String
orgId
=
""
;
WaylineJobDTO
jobDTO
=
null
;
Optional
<
WaylineJobDTO
>
jobOpt
=
waylineJobService
.
getJobByJobId
(
device
.
getWorkspaceId
(),
callback
.
getFile
().
getExt
().
getFlightId
());
if
(
jobOpt
.
isPresent
())
{
jobDTO
=
jobOpt
.
get
();
orgId
=
jobDTO
.
getOrgId
();
}
MediaUploadCallbackRequest
file
=
convert2callbackRequest
(
callback
.
getFile
());
MediaUploadCallbackRequest
file
=
convert2callbackRequest
(
callback
.
getFile
());
// Set the drone sn that shoots the media
// Set the drone sn that shoots the media
file
.
getExt
().
setSn
(
device
.
getChildDeviceSn
());
file
.
getExt
().
setSn
(
device
.
getChildDeviceSn
());
// set path
// todo? 是否需要修改?
String
objectKey
=
file
.
getObjectKey
();
String
objectKey
=
file
.
getObjectKey
();
String
path
=
objectKey
.
substring
(
Optional
.
of
(
objectKey
.
indexOf
(
OssConfiguration
.
objectDirPrefix
))
String
path
=
objectKey
.
substring
(
Optional
.
of
(
objectKey
.
indexOf
(
OssConfiguration
.
objectDirPrefix
))
.
filter
(
index
->
index
>
0
).
map
(
index
->
index
++).
orElse
(
0
),
objectKey
.
lastIndexOf
(
"/"
));
.
filter
(
index
->
index
>
0
).
map
(
index
->
index
++).
orElse
(
0
),
objectKey
.
lastIndexOf
(
"/"
));
if
(
StringUtils
.
hasText
(
orgId
))
{
String
orgFilePath
=
path
;
String
orgFilePath
=
path
;
// 增加 org路径
//可能是临时任务
path
=
path
.
replace
(
OssConfiguration
.
objectDirPrefix
+
"/"
+
device
.
getWorkspaceId
(),
OssConfiguration
.
objectDirPrefix
+
"/"
+
device
.
getWorkspaceId
()
+
"/"
+
orgId
);
if
(
RedisOpsUtils
.
checkExist
(
"templateTask:"
+
callback
.
getFile
().
getExt
().
getFlightId
()))
{
// jobId改成 jobName
TakeoffToPointRequest
takeoffToPointRequest
=
(
TakeoffToPointRequest
)
RedisOpsUtils
.
get
(
"templateTask:"
+
callback
.
getFile
().
getExt
().
getFlightId
());
if
(
jobDTO
!=
null
)
{
path
=
path
.
replace
(
callback
.
getFile
().
getExt
().
getFlightId
(),
jobDTO
.
getJobName
());
String
orgId
=
takeoffToPointRequest
.
getOrgId
();
}
path
=
path
.
replace
(
OssConfiguration
.
objectDirPrefix
+
"/"
+
device
.
getWorkspaceId
(),
OssConfiguration
.
objectDirPrefix
+
"/"
+
device
.
getWorkspaceId
()
+
"/"
+
orgId
+
"/临时任务"
);
String
moveFilePath
=
path
;
String
moveFilePath
=
path
;
// DJI_20250801115516_0033_V.jpeg
// wayline/e3dea0f5-37f2-4d79-ae58-490af3228069/test-8-1-11-52-2025-08-01-11-52-49-9c08/DJI_202508011152_001_test-8-1-11-52-2025-08-01-11-52-49-9c08/DJI_20250801115516_0033_V.jpeg
file
.
setPath
(
path
);
file
.
setPath
(
path
);
file
.
setObjectKey
(
moveFilePath
);
file
.
setObjectKey
(
moveFilePath
);
moveFile
(
orgFilePath
,
moveFilePath
,
callback
.
getFile
().
getName
());
moveFile
(
orgFilePath
,
moveFilePath
,
callback
.
getFile
().
getName
());
}
else
{
}
else
{
file
.
setPath
(
path
);
// 查询 任务的orgId
String
orgId
=
""
;
WaylineJobDTO
jobDTO
=
null
;
Optional
<
WaylineJobDTO
>
jobOpt
=
waylineJobService
.
getJobByJobId
(
device
.
getWorkspaceId
(),
callback
.
getFile
().
getExt
().
getFlightId
());
if
(
jobOpt
.
isPresent
())
{
jobDTO
=
jobOpt
.
get
();
orgId
=
jobDTO
.
getOrgId
();
}
// set path
// todo? 是否需要修改?
if
(
StringUtils
.
hasText
(
orgId
))
{
// 增加 org路径
path
=
path
.
replace
(
OssConfiguration
.
objectDirPrefix
+
"/"
+
device
.
getWorkspaceId
(),
OssConfiguration
.
objectDirPrefix
+
"/"
+
device
.
getWorkspaceId
()
+
"/"
+
orgId
);
// jobId改成 jobName
// if (jobDTO != null) {
// path = path.replace(callback.getFile().getExt().getFlightId(), jobDTO.getJobName());
// }
String
moveFilePath
=
path
;
// DJI_20250801115516_0033_V.jpeg
// wayline/e3dea0f5-37f2-4d79-ae58-490af3228069/test-8-1-11-52-2025-08-01-11-52-49-9c08/DJI_202508011152_001_test-8-1-11-52-2025-08-01-11-52-49-9c08/DJI_20250801115516_0033_V.jpeg
file
.
setPath
(
path
);
file
.
setObjectKey
(
moveFilePath
);
moveFile
(
orgFilePath
,
moveFilePath
,
callback
.
getFile
().
getName
());
}
else
{
file
.
setPath
(
path
);
}
}
}
return
fileService
.
saveFile
(
device
.
getWorkspaceId
(),
file
)
>
0
;
return
fileService
.
saveFile
(
device
.
getWorkspaceId
(),
file
)
>
0
;
...
...
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