Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
zhengyuan-danger-chemistry-manage
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
耿迪迪
zhengyuan-danger-chemistry-manage
Commits
fe0bd735
Commit
fe0bd735
authored
Jan 11, 2023
by
耿迪迪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
门禁人脸识别 gengdidi
parent
55ef20cc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
394 additions
and
1 deletion
+394
-1
SubscriptionEventController.java
.../controller/videomonitor/SubscriptionEventController.java
+47
-1
ArtemisUtils.java
...dmin/src/main/java/com/zehong/web/uitls/ArtemisUtils.java
+70
-0
ArtemisPerson.java
.../main/java/com/zehong/system/domain/vo/ArtemisPerson.java
+219
-0
ArtemisPersonExpressions.java
...com/zehong/system/domain/vo/ArtemisPersonExpressions.java
+58
-0
No files found.
danger-manage-admin/src/main/java/com/zehong/web/controller/videomonitor/SubscriptionEventController.java
View file @
fe0bd735
...
...
@@ -2,11 +2,16 @@ package com.zehong.web.controller.videomonitor;
import
cn.hutool.core.util.ObjectUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.github.pagehelper.util.StringUtil
;
import
com.zehong.common.core.domain.AjaxResult
;
import
com.zehong.common.core.redis.RedisCache
;
import
com.zehong.system.domain.TDeviceAlarmInfo
;
import
com.zehong.system.domain.TEntranceGuardPersonInfo
;
import
com.zehong.system.domain.vo.ArtemisPerson
;
import
com.zehong.system.service.ITDeviceAlarmInfoService
;
import
com.zehong.system.service.ITEntranceGuardPersonInfoService
;
import
com.zehong.web.uitls.ArtemisUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -17,6 +22,7 @@ import org.springframework.web.bind.annotation.RestController;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
...
...
@@ -33,6 +39,8 @@ public class SubscriptionEventController {
private
RedisCache
redisCache
;
@Autowired
private
ITDeviceAlarmInfoService
tDeviceAlarmInfoService
;
@Autowired
private
ITEntranceGuardPersonInfoService
tEntranceGuardPersonInfoService
;
/**
* 烟雾检测订阅事件
...
...
@@ -58,7 +66,45 @@ public class SubscriptionEventController {
@PostMapping
(
"/faceVerification"
)
public
AjaxResult
faceVerification
(
@RequestBody
Map
<
String
,
Object
>
faceVeriy
){
logger
.
info
(
"人脸验证信息:"
+
JSON
.
toJSONString
(
faceVeriy
));
try
{
logger
.
info
(
"人脸验证信息:"
+
JSON
.
toJSONString
(
faceVeriy
));
//解析人脸信息
JSONObject
params
=
(
JSONObject
)
JSON
.
toJSON
(
faceVeriy
.
get
(
"params"
));
List
<
JSONObject
>
events
=
(
List
<
JSONObject
>)
params
.
get
(
"events"
);
if
(
null
==
events
||
events
.
size
()
==
0
){
throw
new
Exception
(
"人脸通过信息有误不包含events信息"
);
}
for
(
JSONObject
event
:
events
){
JSONObject
data
=
(
JSONObject
)
JSON
.
toJSON
(
event
.
get
(
"data"
));
String
personNo
=
(
String
)
data
.
get
(
"ExtEventPersonNo"
);
//获取人员信息
ArtemisPerson
artemisPerson
=
new
ArtemisPerson
();
artemisPerson
.
setPageNo
(
1
);
artemisPerson
.
setPageSize
(
1000
);
artemisPerson
.
setPersonIds
(
personNo
);
String
personInfoStr
=
ArtemisUtils
.
personList
(
artemisPerson
);
JSONObject
personInfo
=
(
JSONObject
)
JSON
.
toJSON
(
personInfoStr
);
if
(!
"0"
.
equals
(
personInfo
.
get
(
"code"
))){
throw
new
Exception
(
"人员信息接口信息获取错误"
);
}
List
<
JSONObject
>
list
=
(
List
<
JSONObject
>)
data
.
get
(
"list"
);
if
(
list
.
size
()
==
0
){
throw
new
Exception
(
"未获取到人员信息"
);
}
String
personName
=
(
String
)
list
.
get
(
0
).
get
(
"personName"
);
TEntranceGuardPersonInfo
tEntranceGuardPersonInfo
=
new
TEntranceGuardPersonInfo
();
tEntranceGuardPersonInfo
.
setPersonName
(
personName
);
tEntranceGuardPersonInfo
.
setPersonNum
(
personNo
);
if
(
"0"
.
equals
(
list
.
get
(
0
).
get
(
"ExtEventAlarmOutID"
))
||
"1"
.
equals
(
list
.
get
(
0
).
get
(
"ExtEventAlarmOutID"
))){
tEntranceGuardPersonInfo
.
setActionType
(
"0"
.
equals
(
list
.
get
(
0
).
get
(
"ExtEventAlarmOutID"
))
?
"1"
:
"0"
);
}
tEntranceGuardPersonInfo
.
setActionTime
(
new
Date
());
tEntranceGuardPersonInfoService
.
insertTEntranceGuardPersonInfo
(
tEntranceGuardPersonInfo
);
}
}
catch
(
Exception
e
)
{
logger
.
error
(
"人脸通过信息接收失败:"
+
e
);
}
return
AjaxResult
.
success
();
}
...
...
danger-manage-admin/src/main/java/com/zehong/web/uitls/ArtemisUtils.java
0 → 100644
View file @
fe0bd735
package
com
.
zehong
.
web
.
uitls
;
import
com.alibaba.fastjson.JSONObject
;
import
com.hikvision.artemis.sdk.ArtemisHttpUtil
;
import
com.hikvision.artemis.sdk.config.ArtemisConfig
;
import
com.zehong.common.utils.StringUtils
;
import
com.zehong.system.domain.vo.ArtemisPerson
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* 海康平台工具类
*/
public
class
ArtemisUtils
{
/**
* 请根据自己的appKey和appSecret更换static静态块中的三个参数. [1 host]
* 如果你选择的是和现场环境对接,host要修改为现场环境的ip,https端口默认为443,http端口默认为80.例如10.33.25.22:443 或者10.33.25.22:80
* appKey和appSecret请按照或得到的appKey和appSecret更改.
*/
static
{
// 代理API网关nginx服务器ip端口
ArtemisConfig
.
host
=
"27.128.189.137:1443"
;
// 秘钥appkey
ArtemisConfig
.
appKey
=
"28616162"
;
// 秘钥appSecret
ArtemisConfig
.
appSecret
=
"5ueTWDOJ21jRbpHACAzF"
;
}
/**
* 能力开放平台的网站路径
*/
private
static
final
String
ARTEMIS_PATH
=
"/artemis"
;
/**获取人员信息*/
private
static
final
String
PERSON_LIST
=
ARTEMIS_PATH
+
"/api/resource/v2/person/advance/personList"
;
public
static
String
personList
(
ArtemisPerson
artemisPerson
){
Map
<
String
,
String
>
path
=
new
HashMap
<
String
,
String
>(
2
)
{
{
//根据现场环境部署确认是http还是https
put
(
"https://"
,
PERSON_LIST
);
}
};
JSONObject
jsonBody
=
new
JSONObject
();
if
(
StringUtils
.
isNotEmpty
(
artemisPerson
.
getPersonIds
())){
jsonBody
.
put
(
"personIds"
,
artemisPerson
.
getPersonIds
());
}
if
(
StringUtils
.
isNotEmpty
(
artemisPerson
.
getPersonName
())){
jsonBody
.
put
(
"personName"
,
artemisPerson
.
getPersonName
());
}
if
(
StringUtils
.
isNotEmpty
(
artemisPerson
.
getOrgIndexCodes
())){
jsonBody
.
put
(
"orgIndexCodes"
,
artemisPerson
.
getOrgIndexCodes
());
}
if
(
StringUtils
.
isNotEmpty
(
artemisPerson
.
getCertificateNo
())){
jsonBody
.
put
(
"certificateNo"
,
artemisPerson
.
getCertificateNo
());
}
if
(
StringUtils
.
isNotEmpty
(
artemisPerson
.
getCardNo
())){
jsonBody
.
put
(
"cardNo"
,
artemisPerson
.
getCardNo
());
}
jsonBody
.
put
(
"pageNo"
,
artemisPerson
.
getPageNo
());
jsonBody
.
put
(
"pageSize"
,
artemisPerson
.
getPageSize
());
String
body
=
jsonBody
.
toJSONString
();
// post请求application/json类型参数
return
ArtemisHttpUtil
.
doPostStringArtemis
(
path
,
body
,
null
,
null
,
"application/json"
,
null
);
}
}
danger-manage-system/src/main/java/com/zehong/system/domain/vo/ArtemisPerson.java
0 → 100644
View file @
fe0bd735
package
com
.
zehong
.
system
.
domain
.
vo
;
import
java.util.List
;
public
class
ArtemisPerson
{
/**
* 是否必须 False
* 人员ID集合
* 多个值使用英文逗号分隔,不超过1000个
* 获取人员列表v2 接口获取
*/
private
String
personIds
;
/**
* 是否必须 False
* 人员姓名
* 支持中英文字符,不能包含 ’ / \ : * ? " < >
*/
private
String
personName
;
/**
* 是否必须 False
* 性别
* 1:男
* 2:女
* 0:未知
*/
private
String
gender
;
/**
* 是否必须 False
* 所属组织唯一标识码集合
* 多个值使用英文逗号分隔,不超过1000个
*/
private
String
orgIndexCodes
;
/**
* 是否必须 False
* 证件类型
* 111:身份证
* 414:护照
* 113:户口簿
* 335:驾驶证
* 131:工作证
* 133:学生证
* 990:其他
* 平台上人员信息实名标识选择为身份证件时必填
*/
private
String
certificateType
;
/**
* 是否必须 False
* 证件号码(最大长度64)
*/
private
String
certificateNo
;
/**
* 是否必须 True
* 当前页码需大于0(pageNo>0)
*/
private
int
pageNo
;
/**
* 是否必须 True
* 每页记录展示的数目应大于0,小于等于1000(0<pageSize<=1000)
*/
private
int
pageSize
;
/**
* 是否必须 False
* 是否包含下级组织,true时,搜索orgIndexCodes及其所有子孙组织的人员;
* false时,只搜索orgIndexCodes的人员
*/
private
String
isSubOrg
;
/**
* 是否必须 False
* 卡号, 获取卡片列表接口可以获取
*/
private
String
cardNo
;
/**
* 是否必须 False
* 车牌号
*/
private
String
plateNo
;
/**
* 是否必须 False
* 排序字段,注意:排序字段必须是查询条件,否则返回参数错误
*/
private
String
orderBy
;
/**
* 是否必须 False
* 降序:desc
* 升序:asc
*/
private
String
orderType
;
/**
* 是否必须 False
* 查询表达式
*/
private
List
<
ArtemisPersonExpressions
>
expressions
;
public
String
getPersonIds
()
{
return
personIds
;
}
public
void
setPersonIds
(
String
personIds
)
{
this
.
personIds
=
personIds
;
}
public
String
getPersonName
()
{
return
personName
;
}
public
void
setPersonName
(
String
personName
)
{
this
.
personName
=
personName
;
}
public
String
getGender
()
{
return
gender
;
}
public
void
setGender
(
String
gender
)
{
this
.
gender
=
gender
;
}
public
String
getOrgIndexCodes
()
{
return
orgIndexCodes
;
}
public
void
setOrgIndexCodes
(
String
orgIndexCodes
)
{
this
.
orgIndexCodes
=
orgIndexCodes
;
}
public
String
getCertificateType
()
{
return
certificateType
;
}
public
void
setCertificateType
(
String
certificateType
)
{
this
.
certificateType
=
certificateType
;
}
public
String
getCertificateNo
()
{
return
certificateNo
;
}
public
void
setCertificateNo
(
String
certificateNo
)
{
this
.
certificateNo
=
certificateNo
;
}
public
int
getPageNo
()
{
return
pageNo
;
}
public
void
setPageNo
(
int
pageNo
)
{
this
.
pageNo
=
pageNo
;
}
public
int
getPageSize
()
{
return
pageSize
;
}
public
void
setPageSize
(
int
pageSize
)
{
this
.
pageSize
=
pageSize
;
}
public
String
getIsSubOrg
()
{
return
isSubOrg
;
}
public
void
setIsSubOrg
(
String
isSubOrg
)
{
this
.
isSubOrg
=
isSubOrg
;
}
public
String
getCardNo
()
{
return
cardNo
;
}
public
void
setCardNo
(
String
cardNo
)
{
this
.
cardNo
=
cardNo
;
}
public
String
getPlateNo
()
{
return
plateNo
;
}
public
void
setPlateNo
(
String
plateNo
)
{
this
.
plateNo
=
plateNo
;
}
public
String
getOrderBy
()
{
return
orderBy
;
}
public
void
setOrderBy
(
String
orderBy
)
{
this
.
orderBy
=
orderBy
;
}
public
String
getOrderType
()
{
return
orderType
;
}
public
void
setOrderType
(
String
orderType
)
{
this
.
orderType
=
orderType
;
}
public
List
<
ArtemisPersonExpressions
>
getExpressions
()
{
return
expressions
;
}
public
void
setExpressions
(
List
<
ArtemisPersonExpressions
>
expressions
)
{
this
.
expressions
=
expressions
;
}
}
danger-manage-system/src/main/java/com/zehong/system/domain/vo/ArtemisPersonExpressions.java
0 → 100644
View file @
fe0bd735
package
com
.
zehong
.
system
.
domain
.
vo
;
public
class
ArtemisPersonExpressions
{
/**
* 是否必须 True
* 资源属性名,支持按jobNo、phoneNo、email、updateTim、cerateTime查询,例如:key传updateTime,operator传between可以查询特定时间段更新的数据,考虑到校时和夏令时,建议值查询过去一天的数据变更
*/
private
String
key
;
/**
* 是否必须 True
* 操作运算符,
* 0 :=
* 1 :>=
* 2 :<=
* 3 :in
* 4 :not in
* 5 :between
* 6 :like
* 7 :pre like
* 8 :suffix like
*/
private
int
operator
;
/**
* 是否必须 True
* 资源属性值,=、>=、<=、like、values数组长度只能是1;
* in、not in,values数组长度大于1,最大不超时20;
* in_array用于查询key值有多个value的情况,例如行车监控添加的设备类型为encodeDevice、encodeDeviceMss两个类型,使用encodeDevice或者encodeDeviceMss都可以查询到;between只能用于整形、日期(ISO8601格式)
* ;like只能用于字符串。
*/
private
String
[]
values
;
public
String
getKey
()
{
return
key
;
}
public
void
setKey
(
String
key
)
{
this
.
key
=
key
;
}
public
int
getOperator
()
{
return
operator
;
}
public
void
setOperator
(
int
operator
)
{
this
.
operator
=
operator
;
}
public
String
[]
getValues
()
{
return
values
;
}
public
void
setValues
(
String
[]
values
)
{
this
.
values
=
values
;
}
}
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