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
9c4e09c6
Commit
9c4e09c6
authored
Mar 23, 2026
by
gdj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加aiInfo的新增接口。
parent
c3be5a33
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
77 additions
and
0 deletions
+77
-0
sample/src/main/java/com/dji/sample/ai/controller/AiInfoController.java
+34
-0
sample/src/main/java/com/dji/sample/ai/model/dto/TopicAiInfoDTO.java
+42
-0
sample/src/main/java/com/dji/sample/configuration/mvc/GlobalMVCConfigurer.java
+1
-0
No files found.
sample/src/main/java/com/dji/sample/ai/controller/AiInfoController.java
View file @
9c4e09c6
...
@@ -18,6 +18,12 @@ import org.springframework.web.bind.annotation.*;
...
@@ -18,6 +18,12 @@ import org.springframework.web.bind.annotation.*;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.validation.Valid
;
import
javax.validation.Valid
;
import
com.dji.sample.ai.model.dto.TopicAiInfoDTO
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
java.time.Instant
;
import
java.time.LocalDateTime
;
import
java.time.ZoneId
;
import
static
com
.
dji
.
sample
.
component
.
AuthInterceptor
.
TOKEN_CLAIM
;
import
static
com
.
dji
.
sample
.
component
.
AuthInterceptor
.
TOKEN_CLAIM
;
...
@@ -35,6 +41,9 @@ public class AiInfoController {
...
@@ -35,6 +41,9 @@ public class AiInfoController {
@Autowired
@Autowired
private
IAiInfoService
aiInfoService
;
private
IAiInfoService
aiInfoService
;
@Autowired
private
ObjectMapper
objectMapper
;
/**
/**
* Paging to query all users in a workspace.
* Paging to query all users in a workspace.
* @param param param
* @param param param
...
@@ -56,6 +65,31 @@ public class AiInfoController {
...
@@ -56,6 +65,31 @@ public class AiInfoController {
return
HttpResultResponse
.
success
(
dto
);
return
HttpResultResponse
.
success
(
dto
);
}
}
@PostMapping
(
"/addFromTopic"
)
public
HttpResultResponse
<
AiInfoDTO
>
addAiInfoFromTopic
(
@RequestBody
TopicAiInfoDTO
topicDto
)
throws
Exception
{
AiInfoDTO
dto
=
new
AiInfoDTO
();
dto
.
setDeviceSn
(
topicDto
.
getDeviceSn
());
dto
.
setPayloadSn
(
topicDto
.
getPayloadSn
());
dto
.
setWarnType
(
topicDto
.
getWarnType
());
dto
.
setWarnEvent
(
topicDto
.
getWarnEvent
());
dto
.
setImageUrl
(
topicDto
.
getImageUrl
());
dto
.
setWarnLocation
(
topicDto
.
getWarnLocation
());
dto
.
setAlgorithmType
(
topicDto
.
getAlgorithmType
());
if
(
topicDto
.
getWarnTime
()
!=
null
)
{
dto
.
setWarnTime
(
LocalDateTime
.
ofInstant
(
Instant
.
ofEpochMilli
(
topicDto
.
getWarnTime
()),
ZoneId
.
systemDefault
()));
}
dto
.
setCreateTime
(
LocalDateTime
.
now
());
if
(
topicDto
.
getObj
()
!=
null
)
{
dto
.
setJson
(
objectMapper
.
writeValueAsString
(
topicDto
.
getObj
()));
}
AiInfoDTO
result
=
aiInfoService
.
createAiInfo
(
dto
);
return
HttpResultResponse
.
success
(
result
);
}
@GetMapping
(
"/get"
)
@GetMapping
(
"/get"
)
public
HttpResultResponse
<
AiInfoDTO
>
getAiInfo
(
@RequestParam
Long
id
)
{
public
HttpResultResponse
<
AiInfoDTO
>
getAiInfo
(
@RequestParam
Long
id
)
{
AiInfoDTO
dto
=
aiInfoService
.
getAiInfoById
(
id
);
AiInfoDTO
dto
=
aiInfoService
.
getAiInfoById
(
id
);
...
...
sample/src/main/java/com/dji/sample/ai/model/dto/TopicAiInfoDTO.java
0 → 100644
View file @
9c4e09c6
package
com
.
dji
.
sample
.
ai
.
model
.
dto
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @author guan
*/
@Data
public
class
TopicAiInfoDTO
implements
Serializable
{
@JsonProperty
(
"device_sn"
)
private
String
deviceSn
;
@JsonProperty
(
"payload_sn"
)
private
String
payloadSn
;
@JsonProperty
(
"warn_type"
)
private
String
warnType
;
@JsonProperty
(
"warn_event"
)
private
String
warnEvent
;
/** epoch milli */
@JsonProperty
(
"warn_time"
)
private
Long
warnTime
;
@JsonProperty
(
"image_url"
)
private
String
imageUrl
;
@JsonProperty
(
"warn_location"
)
private
String
warnLocation
;
@JsonProperty
(
"algorithm_type"
)
private
String
algorithmType
;
/** Raw object payload (may be JSON object) */
@JsonProperty
(
"obj"
)
private
Object
obj
;
}
sample/src/main/java/com/dji/sample/configuration/mvc/GlobalMVCConfigurer.java
View file @
9c4e09c6
...
@@ -46,6 +46,7 @@ public class GlobalMVCConfigurer implements WebMvcConfigurer {
...
@@ -46,6 +46,7 @@ public class GlobalMVCConfigurer implements WebMvcConfigurer {
// 放行 aiInfo 新增与修改接口
// 放行 aiInfo 新增与修改接口
excludePaths
.
add
(
"/"
+
managePrefix
+
manageVersion
+
"/aiInfo/add"
);
excludePaths
.
add
(
"/"
+
managePrefix
+
manageVersion
+
"/aiInfo/add"
);
excludePaths
.
add
(
"/"
+
managePrefix
+
manageVersion
+
"/aiInfo/update"
);
excludePaths
.
add
(
"/"
+
managePrefix
+
manageVersion
+
"/aiInfo/update"
);
excludePaths
.
add
(
"/"
+
managePrefix
+
manageVersion
+
"/aiInfo/addFromTopic"
);
// Intercept for all request interfaces.
// Intercept for all request interfaces.
registry
.
addInterceptor
(
authInterceptor
).
addPathPatterns
(
"/**"
).
excludePathPatterns
(
excludePaths
);
registry
.
addInterceptor
(
authInterceptor
).
addPathPatterns
(
"/**"
).
excludePathPatterns
(
excludePaths
);
}
}
...
...
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