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
a024b918
Commit
a024b918
authored
Jan 11, 2023
by
耿迪迪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
二道门人脸 gengdidi
parent
a4aaa8c8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
34 deletions
+50
-34
SubscriptionEventController.java
.../controller/videomonitor/SubscriptionEventController.java
+50
-34
No files found.
danger-manage-admin/src/main/java/com/zehong/web/controller/videomonitor/SubscriptionEventController.java
View file @
a024b918
...
...
@@ -20,6 +20,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -69,39 +70,7 @@ public class SubscriptionEventController {
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
);
}
entranceGuardEventDeal
(
faceVeriy
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"人脸通过信息接收失败:"
+
e
);
}
...
...
@@ -110,10 +79,57 @@ public class SubscriptionEventController {
@PostMapping
(
"/patrolCardCheck"
)
public
AjaxResult
patrolCardCheck
(
@RequestBody
Map
<
String
,
Object
>
patrolCard
){
logger
.
info
(
"巡查卡比对信息信息:"
+
JSON
.
toJSONString
(
patrolCard
));
try
{
logger
.
info
(
"巡查卡比对信息:"
+
JSON
.
toJSONString
(
patrolCard
));
//解析人脸信息
entranceGuardEventDeal
(
patrolCard
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"巡查卡比对信息接收失败:"
+
e
);
}
return
AjaxResult
.
success
();
}
/**
* 门禁事件解析
*/
private
void
entranceGuardEventDeal
(
Map
<
String
,
Object
>
entranceGuardEvent
)
throws
Exception
{
//解析人脸信息
JSONObject
params
=
(
JSONObject
)
JSON
.
toJSON
(
entranceGuardEvent
.
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
.
setCertificateNo
(
personNo
);
String
personInfoStr
=
ArtemisUtils
.
personList
(
artemisPerson
);
JSONObject
personInfo
=
JSON
.
parseObject
(
personInfoStr
);
if
(!
"0"
.
equals
(
personInfo
.
get
(
"code"
))){
throw
new
Exception
(
"人员信息接口信息获取错误"
);
}
JSONObject
personData
=
(
JSONObject
)
personInfo
.
get
(
"data"
);
List
<
JSONObject
>
list
=
(
List
<
JSONObject
>)
personData
.
get
(
"list"
);
if
(
null
==
list
||
list
.
size
()
==
0
){
throw
new
Exception
(
"未获取到人员信息"
);
}
String
personName
=
(
String
)
list
.
get
(
0
).
get
(
"personName"
);
TEntranceGuardPersonInfo
tEntranceGuardPersonInfo
=
new
TEntranceGuardPersonInfo
();
tEntranceGuardPersonInfo
.
setPersonName
(
personName
);
tEntranceGuardPersonInfo
.
setPersonNum
((
String
)
list
.
get
(
0
).
get
(
"certificateNo"
));
String
extEventInOut
=
String
.
valueOf
(
data
.
get
(
"ExtEventInOut"
));
if
(
"0"
.
equals
(
extEventInOut
)
||
"1"
.
equals
(
extEventInOut
)){
tEntranceGuardPersonInfo
.
setActionType
(
"0"
.
equals
(
extEventInOut
)
?
"1"
:
"0"
);
}
tEntranceGuardPersonInfo
.
setActionTime
(
new
SimpleDateFormat
(
"yyyy-MM-dd'T'HH:mm:ss.SSS'+'"
).
parse
((
String
)
event
.
get
(
"happenTime"
)));
tEntranceGuardPersonInfoService
.
insertTEntranceGuardPersonInfo
(
tEntranceGuardPersonInfo
);
}
}
/**
* 设置订阅事件缓存
* @param deviceCode 设备编号
...
...
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