Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
L
lefull-lot-microservice
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
yangqi
lefull-lot-microservice
Commits
a096ee4c
提交
a096ee4c
authored
11月 21, 2022
作者:
yangqi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1
上级
68dbed34
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
39 行增加
和
21 行删除
+39
-21
FaceController.java
...t-api-web/src/main/java/cn/lefull/api/FaceController.java
+8
-0
HikvisionService.java
.../main/java/cn/lefull/common/sdk/ali/HikvisionService.java
+0
-18
Face.java
...mon/src/main/java/cn/lefull/common/sdk/ali/base/Face.java
+24
-3
FaceService.java
...vice/src/main/java/cn/lefull/service/ali/FaceService.java
+7
-0
没有找到文件。
lefull-lot-api-web/src/main/java/cn/lefull/api/FaceController.java
浏览文件 @
a096ee4c
...
...
@@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author 杨奇
...
...
@@ -46,4 +47,11 @@ public class FaceController {
faceService
.
updateFace
(
dbName
,
entityId
,
labels
);
return
new
ApiResponse
<>();
}
@NoAuth
@GetMapping
(
"/getFace"
)
public
ApiResponse
<
Object
>
updateFace
(
String
dbName
,
String
entityId
)
throws
Exception
{
Map
<
String
,
Object
>
map
=
faceService
.
getFace
(
dbName
,
entityId
);
return
new
ApiResponse
<>(
map
);
}
}
lefull-lot-common/src/main/java/cn/lefull/common/sdk/ali/HikvisionService.java
浏览文件 @
a096ee4c
...
...
@@ -63,24 +63,6 @@ public class HikvisionService {
client
.
createFaceDbWithOptions
(
request
,
runtime
);
}
/**
* @link {https://help.aliyun.com/document_detail/161145.html}
*/
public
static
Map
<
String
,
Object
>
getFace
(
String
dbName
,
String
entityId
)
throws
Exception
{
com
.
aliyun
.
facebody20191230
.
Client
client
=
createClient
();
com
.
aliyun
.
facebody20191230
.
models
.
GetFaceEntityRequest
request
=
new
com
.
aliyun
.
facebody20191230
.
models
.
GetFaceEntityRequest
();
request
.
setDbName
(
dbName
);
request
.
setEntityId
(
entityId
);
com
.
aliyun
.
teautil
.
models
.
RuntimeOptions
runtime
=
new
com
.
aliyun
.
teautil
.
models
.
RuntimeOptions
();
GetFaceEntityResponse
res
=
client
.
getFaceEntityWithOptions
(
request
,
runtime
);
GetFaceEntityResponseBody
.
GetFaceEntityResponseBodyData
data
=
res
.
getBody
().
data
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"labels"
,
data
.
getLabels
());
map
.
put
(
"faces"
,
data
.
getFaces
());
return
map
;
}
/**
* @link {https://help.aliyun.com/document_detail/159216.html}
*/
...
...
lefull-lot-common/src/main/java/cn/lefull/common/sdk/ali/base/Face.java
浏览文件 @
a096ee4c
package
cn
.
lefull
.
common
.
sdk
.
ali
.
base
;
import
com.aliyun.com.viapi.FileUtils
;
import
com.aliyun.facebody20191230.models.ListFaceDbsRequest
;
import
com.aliyun.facebody20191230.models.ListFaceDbsResponse
;
import
com.aliyun.facebody20191230.models.ListFaceDbsResponseBody
;
import
com.aliyun.facebody20191230.models.*
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.CollectionUtils
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
@Component
...
...
@@ -111,6 +111,27 @@ public class Face {
client
.
updateFaceEntityWithOptions
(
request
,
runtime
);
}
/**
* @link {https://help.aliyun.com/document_detail/161145.html}
*/
public
Map
<
String
,
Object
>
getFace
(
String
dbName
,
String
entityId
)
throws
Exception
{
com
.
aliyun
.
facebody20191230
.
Client
client
=
createClient
();
com
.
aliyun
.
facebody20191230
.
models
.
GetFaceEntityRequest
request
=
new
com
.
aliyun
.
facebody20191230
.
models
.
GetFaceEntityRequest
();
request
.
setDbName
(
dbName
);
request
.
setEntityId
(
entityId
);
com
.
aliyun
.
teautil
.
models
.
RuntimeOptions
runtime
=
new
com
.
aliyun
.
teautil
.
models
.
RuntimeOptions
();
GetFaceEntityResponse
res
=
client
.
getFaceEntityWithOptions
(
request
,
runtime
);
GetFaceEntityResponseBody
.
GetFaceEntityResponseBodyData
data
=
res
.
getBody
().
data
;
if
(
data
==
null
){
return
null
;
}
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"labels"
,
data
.
getLabels
());
map
.
put
(
"faces"
,
data
.
getFaces
());
return
map
;
}
public
String
uploadImageUrl
(
String
file
)
throws
com
.
aliyuncs
.
exceptions
.
ClientException
,
IOException
{
FileUtils
fileUtils
=
FileUtils
.
getInstance
(
this
.
accessKeyId
,
this
.
accessKeySecret
);
return
fileUtils
.
upload
(
file
);
...
...
lefull-lot-service/src/main/java/cn/lefull/service/ali/FaceService.java
浏览文件 @
a096ee4c
...
...
@@ -6,6 +6,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author 杨奇
...
...
@@ -35,4 +36,10 @@ public class FaceService {
Utils
.
checkParamsNotEmpty
(
entityId
,
"entityId"
);
face
.
updateFace
(
dbName
,
entityId
,
labels
);
}
public
Map
<
String
,
Object
>
getFace
(
String
dbName
,
String
entityId
)
throws
Exception
{
Utils
.
checkParamsNotEmpty
(
dbName
,
"dbName"
);
Utils
.
checkParamsNotEmpty
(
entityId
,
"entityId"
);
return
face
.
getFace
(
dbName
,
entityId
);
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论