Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
refined-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
refined-platform
Commits
723f86a1
Commit
723f86a1
authored
May 10, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加服务追踪
parent
b7f0da7c
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
94 additions
and
99 deletions
+94
-99
refined-manager/src/main/java/com/mortals/xhx/busiz/web/TestController.java
...c/main/java/com/mortals/xhx/busiz/web/TestController.java
+83
-61
refined-manager/src/main/java/com/mortals/xhx/daemon/task/RealTimePeopleStatTaskImpl.java
...m/mortals/xhx/daemon/task/RealTimePeopleStatTaskImpl.java
+1
-35
refined-manager/src/main/java/com/mortals/xhx/module/realtime/model/RealtimeDataflowStatEntity.java
...xhx/module/realtime/model/RealtimeDataflowStatEntity.java
+3
-3
refined-manager/src/test/java/com/mortals/httpclient/TestController.http
.../src/test/java/com/mortals/httpclient/TestController.http
+7
-0
No files found.
refined-manager/src/main/java/com/mortals/xhx/busiz/web/TestController.java
View file @
723f86a1
package
com.mortals.xhx.busiz.web
;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.NumberUtil
;
import
cn.hutool.core.util.RandomUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.TypeReference
;
import
com.mortals.framework.common.Rest
;
...
...
@@ -17,11 +21,15 @@ import com.mortals.xhx.module.hik.person.model.req.person.PersonReq;
import
com.mortals.xhx.module.hik.person.model.rsp.org.OrgDataInfo
;
import
com.mortals.xhx.module.hik.person.model.rsp.person.PersonDataInfo
;
import
com.mortals.xhx.module.hik.person.service.IHikPersonService
;
import
com.mortals.xhx.module.realtime.model.RealtimeDataflowStatEntity
;
import
com.mortals.xhx.module.realtime.model.RealtimeDataflowStatQuery
;
import
com.mortals.xhx.module.realtime.service.RealtimeDataflowStatService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.checkerframework.checker.units.qual.A
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -44,7 +52,8 @@ public class TestController {
private
IHikEventService
hikEventService
;
@Autowired
private
FacePlanService
facePlanService
;
@Autowired
private
RealtimeDataflowStatService
realtimeDataflowStatService
;
@GetMapping
(
"webservice"
)
...
...
@@ -52,6 +61,7 @@ public class TestController {
log
.
info
(
"测试"
);
return
"ok"
;
}
@PostMapping
(
"getPersonList"
)
public
String
getPersonList
(
@RequestBody
PersonReq
personReq
)
{
Rest
<
PersonDataInfo
>
personList
=
hikPersonService
.
getPersonList
(
personReq
);
...
...
@@ -84,71 +94,83 @@ public class TestController {
}
@PostMapping
(
"mockStatData"
)
public
String
mockStatData
()
{
ArrayList
<
RealtimeDataflowStatEntity
>
statEntities
=
new
ArrayList
<>();
//模拟构造过去人流数据
DateTime
startDateTime
=
DateUtil
.
parseDate
(
"2023-03-01"
);
DateTime
endDateTime
=
DateUtil
.
parseDate
(
"2023-05-10"
);
Integer
subDay
=
Integer
.
parseInt
(
String
.
valueOf
(
DateUtil
.
betweenDay
(
startDateTime
,
endDateTime
,
false
)));
for
(
int
i
=
0
;
i
<=
subDay
;
i
++)
{
DateTime
date
=
DateUtil
.
offsetDay
(
startDateTime
,
i
);
boolean
weekend
=
DateUtil
.
isWeekend
(
date
);
if
(
weekend
)
{
//周末 默认数据
for
(
int
j
=
0
;
j
<=
23
;
j
++)
{
RealtimeDataflowStatEntity
statEntity
=
new
RealtimeDataflowStatEntity
();
statEntity
.
initAttrValue
();
statEntity
.
setSiteId
(
1L
);
statEntity
.
setSiteName
(
"宜宾市民中心"
);
int
year
=
DateUtil
.
year
(
date
);
int
month
=
DateUtil
.
month
(
date
)
+
1
;
int
day
=
DateUtil
.
dayOfMonth
(
date
);
statEntity
.
setYear
(
year
);
statEntity
.
setMonth
(
month
);
statEntity
.
setDay
(
day
);
statEntity
.
setHour
(
j
);
statEntity
.
setCreateUserId
(
1L
);
statEntity
.
setCreateTime
(
DateUtil
.
offsetHour
(
date
,
j
));
statEntities
.
add
(
statEntity
);
}
}
else
{
for
(
int
j
=
0
;
j
<=
23
;
j
++)
{
RealtimeDataflowStatEntity
statEntity
=
new
RealtimeDataflowStatEntity
();
statEntity
.
initAttrValue
();
statEntity
.
setSiteId
(
1L
);
statEntity
.
setSiteName
(
"宜宾市民中心"
);
if
(
j
>
8
&&
j
<
18
){
//随机500~1200人
int
total
=
RandomUtil
.
randomInt
(
400
,
1200
);
statEntity
.
setPersonSum
(
total
);
int
strangeNum
=
RandomUtil
.
randomInt
(
380
,
total
);
statEntity
.
setRecoginzeSum
(
total
-
strangeNum
);
statEntity
.
setStrangerSum
(
strangeNum
);
}
int
year
=
DateUtil
.
year
(
date
);
int
month
=
DateUtil
.
month
(
date
)
+
1
;
int
day
=
DateUtil
.
dayOfMonth
(
date
);
statEntity
.
setYear
(
year
);
statEntity
.
setMonth
(
month
);
statEntity
.
setDay
(
day
);
statEntity
.
setHour
(
j
);
statEntity
.
setCreateUserId
(
1L
);
statEntity
.
setCreateTime
(
DateUtil
.
offsetHour
(
date
,
j
));
statEntities
.
add
(
statEntity
);
}
}
}
log
.
info
(
"新增数量:{}"
,
statEntities
.
size
());
realtimeDataflowStatService
.
save
(
statEntities
);
return
"ok"
;
}
public
static
void
main
(
String
[]
args
)
{
DoorEventReq
doorEventReq
=
new
DoorEventReq
();
doorEventReq
.
setStartTime
(
new
Date
());
System
.
out
.
println
(
JSON
.
toJSONString
(
doorEventReq
));
String
json
=
"{\"startTime\":\"2023-04-13T10:48:22+08:00\"}"
;
DoorEventReq
doorEventReq1
=
JSON
.
parseObject
(
json
,
DoorEventReq
.
class
);
System
.
out
.
println
(
DateUtils
.
convertTime2Str
(
doorEventReq1
.
getStartTime
().
getTime
(),
DateUtils
.
P_yyyy_MM_dd_HH_mm_ss
));
String
respJson
=
"{\n"
+
" \"code\": \"0\",\n"
+
" \"msg\": \"success\",\n"
+
" \"data\": {\n"
+
" \"pageSize\": 1,\n"
+
" \"list\": [\n"
+
" {\n"
+
" \"eventId\": \"0f3ba98192f02d7f186b9eb33314ef44\",\n"
+
" \"eventName\": \"acs.acs.eventType.successFace\",\n"
+
" \"eventTime\": \"2023-04-12T11:59:37+08:00\",\n"
+
" \"personId\": \"31757ce46e09418ca926094f58935897\",\n"
+
" \"cardNo\": \"9990000008\",\n"
+
" \"personName\": \"何肃桃\",\n"
+
" \"orgIndexCode\": \"36553719-e462-498a-9664-cc7fdaf9c421\",\n"
+
" \"orgName\": \"默认组织/宜宾市民中心/1A公安大厅/市交警支队\",\n"
+
" \"doorName\": \"公安大厅1A_门_1\",\n"
+
" \"doorIndexCode\": \"38419b11af544d45a664dd27db15d8f2\",\n"
+
" \"doorRegionIndexCode\": \"bd1e680d-662f-45b3-a798-8bae7cd194e6\",\n"
+
" \"picUri\": null,\n"
+
" \"svrIndexCode\": null,\n"
+
" \"eventType\": 196893,\n"
+
" \"inAndOutType\": 1,\n"
+
" \"readerDevIndexCode\": \"fc6bc97929bb449e9c2fa91dbd6b1d01\",\n"
+
" \"readerDevName\": \"读卡器_1\",\n"
+
" \"devIndexCode\": \"73f5f57cb4cd486fba06e817c7555dd8\",\n"
+
" \"devName\": \"公安大厅1A\",\n"
+
" \"identityCardUri\": null,\n"
+
" \"receiveTime\": \"2023-04-12T11:59:39.727+08:00\",\n"
+
" \"jobNo\": \"8\",\n"
+
" \"studentId\": null,\n"
+
" \"certNo\": \"8\"\n"
+
" }\n"
+
" ],\n"
+
" \"total\": 3903,\n"
+
" \"totalPage\": 3903,\n"
+
" \"pageNo\": 1\n"
+
" }\n"
+
"}"
;
Rest
<
DoorEventDataInfo
>
rest
=
JSON
.
parseObject
(
respJson
,
new
TypeReference
<
Rest
<
DoorEventDataInfo
>>()
{
});
System
.
out
.
println
(
rest
.
getData
().
getTotal
());
System
.
out
.
println
(
rest
.
getData
().
getList
().
get
(
0
).
getPersonName
());
DateTime
startDateTime
=
DateUtil
.
parseDate
(
"2023-03-01"
);
DateTime
endDateTime
=
DateUtil
.
parseDate
(
"2023-05-10"
);
long
subDay
=
DateUtil
.
betweenDay
(
startDateTime
,
endDateTime
,
false
);
System
.
out
.
println
(
subDay
);
System
.
out
.
println
(
DateUtil
.
offsetDay
(
startDateTime
,
40
).
toDateStr
());
}
...
...
refined-manager/src/main/java/com/mortals/xhx/daemon/task/RealTimePeopleStatTaskImpl.java
View file @
723f86a1
...
...
@@ -71,7 +71,7 @@ public class RealTimePeopleStatTaskImpl implements ITaskExcuteService {
Long
recognizeCount
=
total
-
strangerCount
;
Date
date
=
new
Date
();
int
year
=
DateUtil
.
year
(
date
);
int
month
=
DateUtil
.
month
(
date
);
int
month
=
DateUtil
.
month
(
date
)
+
1
;
int
day
=
DateUtil
.
dayOfMonth
(
date
);
int
hour
=
DateUtil
.
hour
(
date
,
true
);
...
...
@@ -107,40 +107,6 @@ public class RealTimePeopleStatTaskImpl implements ITaskExcuteService {
}
private
void
donwnloadSnap
()
{
//下载最近一天的抓拍数据
RealtimeDataflowQuery
realtimeDataflowQuery
=
new
RealtimeDataflowQuery
();
realtimeDataflowQuery
.
setDetectTimeStart
(
DateUtil
.
yesterday
().
toStringDefaultTimeZone
());
realtimeDataflowQuery
.
setDetectTimeEnd
(
DateUtil
.
formatDateTime
(
new
Date
()));
//realtimeDataflowQuery.setPicture("");
List
<
RealtimeDataflowEntity
>
updateList
=
realtimeDataflowService
.
find
(
realtimeDataflowQuery
).
stream
()
.
filter
(
f
->
ObjectUtils
.
isEmpty
(
f
.
getPicture
())
&&
!
ObjectUtils
.
isEmpty
(
f
.
getPicUri
()))
.
map
(
item
->
{
ImgReq
imgReq
=
new
ImgReq
();
imgReq
.
setUrl
(
item
.
getPicUri
());
Rest
<
String
>
rest
=
faceService
.
downloadPicture
(
imgReq
);
if
(
YesNoEnum
.
YES
.
getValue
()
==
rest
.
getCode
())
{
byte
[]
bytes
=
Base64
.
decode
(
rest
.
getData
());
if
(!
ObjectUtils
.
isEmpty
(
bytes
))
{
InputStream
inputStream
=
new
ByteArrayInputStream
(
bytes
);
MultipartFile
file
=
ServletUtils
.
getMultipartFile
(
inputStream
,
"snap.jpg"
);
String
filePath
=
uploadService
.
saveFileUpload
(
file
,
"file/fileupload/snap/"
+
DateUtil
.
today
(),
null
);
item
.
setPicture
(
filePath
);
item
.
setUpdateTime
(
new
Date
());
item
.
setUpdateUserId
(
1L
);
item
.
setUpdateUserName
(
"system"
);
return
item
;
}
}
return
null
;
}).
filter
(
f
->
f
!=
null
).
collect
(
toList
());
log
.
info
(
"更新列表:{}"
,
updateList
.
size
());
if
(!
ObjectUtils
.
isEmpty
(
updateList
))
{
realtimeDataflowService
.
update
(
updateList
,
null
);
}
}
@Override
public
void
stopTask
(
ITask
task
)
throws
AppException
{
...
...
refined-manager/src/main/java/com/mortals/xhx/module/realtime/model/RealtimeDataflowStatEntity.java
View file @
723f86a1
...
...
@@ -74,11 +74,11 @@ public class RealtimeDataflowStatEntity extends RealtimeDataflowStatVo {
this
.
siteName
=
""
;
this
.
personSum
=
null
;
this
.
personSum
=
0
;
this
.
strangerSum
=
null
;
this
.
strangerSum
=
0
;
this
.
recoginzeSum
=
null
;
this
.
recoginzeSum
=
0
;
this
.
year
=
null
;
...
...
refined-manager/src/test/java/com/mortals/httpclient/TestController.http
View file @
723f86a1
...
...
@@ -47,3 +47,10 @@ Content-Type: application/json
{
}
###查询摄像头列表
POST {{baseUrl}}/test/mockStatData
Content-Type: application/json
{
}
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