Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bill-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
赵啸非
bill-platform
Commits
b90658f3
Commit
b90658f3
authored
Jul 30, 2024
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加统计子站点
parent
6ed66f98
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
141 additions
and
140 deletions
+141
-140
bill-manager/src/main/java/com/mortals/xhx/daemon/task/SiteStatTaskImpl.java
...in/java/com/mortals/xhx/daemon/task/SiteStatTaskImpl.java
+141
-140
No files found.
bill-manager/src/main/java/com/mortals/xhx/daemon/task/SiteStatTaskImpl.java
View file @
b90658f3
...
@@ -77,27 +77,150 @@ public class SiteStatTaskImpl implements ITaskExcuteService {
...
@@ -77,27 +77,150 @@ public class SiteStatTaskImpl implements ITaskExcuteService {
updateSiteCache
();
updateSiteCache
();
}
}
private
void
updateSiteCache
()
{
private
void
statByDate
()
{
List
<
SitePdu
>
sitePduList
=
getStatSiteList
();
for
(
SitePdu
site
:
sitePduList
)
{
if
(
ObjectUtils
.
isEmpty
(
site
.
getId
()))
continue
;
StopWatch
allStopWatch
=
new
StopWatch
(
"allStopWatch"
);
StopWatch
pjqStopWatch
=
new
StopWatch
(
"pjqStopWatch"
);
StopWatch
pdjStopWatch
=
new
StopWatch
(
"pdjStopWatch"
);
allStopWatch
.
start
();
AccessStatLogEntity
statLogAllEntity
=
new
AccessStatLogEntity
();
statLogAllEntity
.
initAttrValue
();
statLogAllEntity
.
setCreateUserId
(
1L
);
statLogAllEntity
.
setCreateTime
(
new
Date
());
statLogAllEntity
.
setSiteId
(
site
.
getId
());
statLogAllEntity
.
setSiteCode
(
site
.
getSiteCode
());
statLogAllEntity
.
setSiteName
(
site
.
getSiteName
());
statLogAllEntity
.
setStatStartTime
(
new
Date
());
statLogAllEntity
.
setType
(
AccessTypeEnum
.
全部
.
getValue
());
pjqStopWatch
.
start
();
AccessStatLogEntity
statLogEntity
=
new
AccessStatLogEntity
();
statLogEntity
.
initAttrValue
();
statLogEntity
.
setCreateUserId
(
1L
);
statLogEntity
.
setCreateTime
(
new
Date
());
statLogEntity
.
setSiteId
(
site
.
getId
());
statLogEntity
.
setSiteCode
(
site
.
getSiteCode
());
statLogEntity
.
setSiteName
(
site
.
getSiteName
());
AccessQuery
accessQuery
=
new
AccessQuery
();
accessQuery
.
setSiteId
(
site
.
getId
()
==
null
?
0L
:
site
.
getId
());
AccessEntity
accessEntity
=
accessService
.
selectOne
(
accessQuery
);
if
(!
ObjectUtils
.
isEmpty
(
accessEntity
))
{
statLogEntity
.
setAccessId
(
accessEntity
.
getId
());
}
statLogEntity
.
setStatStartTime
(
new
Date
());
statLogEntity
.
setType
(
AccessTypeEnum
.
评价器
.
getValue
());
int
range
=
4
;
for
(
int
i
=
0
;
i
<
range
;
i
++)
{
DateTime
beforeDate
=
DateUtil
.
offsetDay
(
new
Date
(),
-
i
);
int
year
=
beforeDate
.
year
();
int
month
=
beforeDate
.
month
()
+
1
;
int
day
=
beforeDate
.
dayOfMonth
();
PjEvaluateStatEntity
sitestatEntity
=
new
PjEvaluateStatEntity
();
sitestatEntity
.
initAttrValue
();
sitestatEntity
.
setSiteId
(
site
.
getId
());
sitestatEntity
.
setSiteName
(
site
.
getSiteName
());
sitestatEntity
.
setSiteCode
(
site
.
getSiteCode
());
sitestatEntity
.
setYear
(
year
);
sitestatEntity
.
setMonth
(
month
);
sitestatEntity
.
setDay
(
day
);
//设置年月日
pjEvaluateStatService
.
updateSitePjStat
(
sitestatEntity
,
null
);
}
pjqStopWatch
.
stop
();
statLogEntity
.
setStatEndTime
(
new
Date
());
statLogEntity
.
setDuration
(
pjqStopWatch
.
getLastTaskTimeMillis
());
accessStatLogService
.
save
(
statLogEntity
,
null
);
pdjStopWatch
.
start
();
statLogEntity
.
setStatStartTime
(
new
Date
());
statLogEntity
.
setType
(
AccessTypeEnum
.
排队机
.
getValue
());
for
(
int
i
=
0
;
i
<
range
;
i
++)
{
DateTime
beforeDate
=
DateUtil
.
offsetDay
(
new
Date
(),
-
i
);
int
year
=
beforeDate
.
year
();
int
month
=
beforeDate
.
month
()
+
1
;
int
day
=
beforeDate
.
dayOfMonth
();
//设置排号
PhQueueStatEntity
phQueueStatEntity
=
new
PhQueueStatEntity
();
phQueueStatEntity
.
initAttrValue
();
phQueueStatEntity
.
setSiteId
(
site
.
getId
());
phQueueStatEntity
.
setSiteName
(
site
.
getSiteName
());
phQueueStatEntity
.
setSiteCode
(
site
.
getSiteCode
());
phQueueStatEntity
.
setYear
(
year
);
phQueueStatEntity
.
setMonth
(
month
);
phQueueStatEntity
.
setDay
(
day
);
phQueueStatService
.
updateSitePhStat
(
phQueueStatEntity
,
null
);
}
pdjStopWatch
.
stop
();
statLogEntity
.
setStatEndTime
(
new
Date
());
statLogEntity
.
setDuration
(
pjqStopWatch
.
getLastTaskTimeMillis
());
accessStatLogService
.
save
(
statLogEntity
,
null
);
for
(
int
i
=
0
;
i
<
range
;
i
++)
{
DateTime
beforeDate
=
DateUtil
.
offsetDay
(
new
Date
(),
-
i
);
int
year
=
beforeDate
.
year
();
int
month
=
beforeDate
.
month
()
+
1
;
int
day
=
beforeDate
.
dayOfMonth
();
StatEntity
statEntity
=
new
StatEntity
();
statEntity
.
initAttrValue
();
statEntity
.
setSiteId
(
site
.
getId
());
statEntity
.
setSiteName
(
site
.
getSiteName
());
statEntity
.
setSiteCode
(
site
.
getSiteCode
());
statEntity
.
setYear
(
year
);
statEntity
.
setMonth
(
month
);
statEntity
.
setDay
(
day
);
//设置年月日
statService
.
updateSiteStat
(
statEntity
,
null
);
}
allStopWatch
.
stop
();
statLogAllEntity
.
setStatEndTime
(
new
Date
());
statLogAllEntity
.
setDuration
(
pjqStopWatch
.
getLastTaskTimeMillis
());
accessStatLogService
.
save
(
statLogAllEntity
,
null
);
}
}
private
List
<
SitePdu
>
getStatSiteList
()
{
AccessQuery
accessQuery
=
new
AccessQuery
();
AccessQuery
accessQuery
=
new
AccessQuery
();
accessQuery
.
setTagNotList
(
Arrays
.
asList
(
""
));
accessQuery
.
setTagNotList
(
Arrays
.
asList
(
""
));
List
<
AccessEntity
>
accessEntities
=
accessService
.
find
(
accessQuery
);
List
<
AccessEntity
>
accessEntities
=
accessService
.
find
(
accessQuery
);
int
total
=
0
;
List
<
SitePdu
>
sitePduList
=
new
ArrayList
<>();
List
<
SitePdu
>
sitePduList
=
new
ArrayList
<>();
for
(
AccessEntity
accessEntity
:
accessEntities
)
{
for
(
AccessEntity
accessEntity
:
accessEntities
)
{
SitePdu
sitePdu
=
new
SitePdu
();
SitePdu
sitePdu
=
new
SitePdu
();
sitePdu
.
setId
(
accessEntity
.
getId
());
sitePdu
.
setId
(
accessEntity
.
getId
());
Rest
<
List
<
SitePdu
>>
sitesRest
=
siteFeign
.
getFlatSitesBySiteId
(
sitePdu
);
Rest
<
List
<
SitePdu
>>
sitesRest
=
siteFeign
.
getFlatSitesBySiteId
(
sitePdu
);
if
(
YesNoEnum
.
YES
.
getValue
()==
sitesRest
.
getCode
())
{
if
(
YesNoEnum
.
YES
.
getValue
()
==
sitesRest
.
getCode
())
{
sitePduList
.
addAll
(
sitesRest
.
getData
());
sitePduList
.
addAll
(
sitesRest
.
getData
());
}
}
}
}
if
(!
ObjectUtils
.
isEmpty
(
sitePduList
))
{
if
(!
ObjectUtils
.
isEmpty
(
sitePduList
))
{
sitePduList
=
sitePduList
.
stream
().
collect
(
sitePduList
=
sitePduList
.
stream
().
collect
(
collectingAndThen
(
collectingAndThen
(
toCollection
(()
->
new
TreeSet
<>(
Comparator
.
comparing
(
SitePdu:
:
getId
))),
ArrayList:
:
new
));
toCollection
(()
->
new
TreeSet
<>(
Comparator
.
comparing
(
SitePdu:
:
getId
))),
ArrayList:
:
new
));
}
return
sitePduList
;
}
private
void
updateSiteCache
()
{
List
<
SitePdu
>
sitePduList
=
getStatSiteList
();
for
(
SitePdu
site
:
sitePduList
)
{
for
(
SitePdu
site
:
sitePduList
)
{
updatePjSectionCache
(
site
);
updatePjSectionCache
(
site
);
updatePjWindowCache
(
site
);
updatePjWindowCache
(
site
);
...
@@ -109,8 +232,8 @@ public class SiteStatTaskImpl implements ITaskExcuteService {
...
@@ -109,8 +232,8 @@ public class SiteStatTaskImpl implements ITaskExcuteService {
updatePhQueueHallNameCache
(
site
);
updatePhQueueHallNameCache
(
site
);
}
}
total
=
sitePduList
.
size
();
int
total
=
sitePduList
.
size
();
}
...
@@ -151,8 +274,8 @@ public class SiteStatTaskImpl implements ITaskExcuteService {
...
@@ -151,8 +274,8 @@ public class SiteStatTaskImpl implements ITaskExcuteService {
}*/
}*/
cacheService
.
set
(
RedisKey
.
KEY_SITE_STAT_COUNT_CHCHE
,
total
);
cacheService
.
set
(
RedisKey
.
KEY_SITE_STAT_COUNT_CHCHE
,
total
);
cacheService
.
set
(
RedisKey
.
KEY_SITE_STAT_TIME_CHCHE
,
DateUtil
.
formatDateTime
(
new
Date
()));
cacheService
.
set
(
RedisKey
.
KEY_SITE_STAT_TIME_CHCHE
,
DateUtil
.
formatDateTime
(
new
Date
()));
...
@@ -266,128 +389,6 @@ public class SiteStatTaskImpl implements ITaskExcuteService {
...
@@ -266,128 +389,6 @@ public class SiteStatTaskImpl implements ITaskExcuteService {
}
}
}
}
private
void
statByDate
()
{
SitePdu
sitePdu
=
new
SitePdu
();
sitePdu
.
setSize
(-
1
);
Rest
<
RespData
<
List
<
SitePdu
>>>
resp
=
siteFeign
.
list
(
sitePdu
);
if
(
resp
.
getCode
()
==
1
)
{
List
<
SitePdu
>
sitePduList
=
resp
.
getData
().
getData
();
for
(
SitePdu
site
:
sitePduList
)
{
if
(
ObjectUtils
.
isEmpty
(
site
.
getId
()))
continue
;
StopWatch
allStopWatch
=
new
StopWatch
(
"allStopWatch"
);
StopWatch
pjqStopWatch
=
new
StopWatch
(
"pjqStopWatch"
);
StopWatch
pdjStopWatch
=
new
StopWatch
(
"pdjStopWatch"
);
allStopWatch
.
start
();
AccessStatLogEntity
statLogAllEntity
=
new
AccessStatLogEntity
();
statLogAllEntity
.
initAttrValue
();
statLogAllEntity
.
setCreateUserId
(
1L
);
statLogAllEntity
.
setCreateTime
(
new
Date
());
statLogAllEntity
.
setSiteId
(
site
.
getId
());
statLogAllEntity
.
setSiteCode
(
site
.
getSiteCode
());
statLogAllEntity
.
setSiteName
(
site
.
getSiteName
());
statLogAllEntity
.
setStatStartTime
(
new
Date
());
statLogAllEntity
.
setType
(
AccessTypeEnum
.
全部
.
getValue
());
pjqStopWatch
.
start
();
AccessStatLogEntity
statLogEntity
=
new
AccessStatLogEntity
();
statLogEntity
.
initAttrValue
();
statLogEntity
.
setCreateUserId
(
1L
);
statLogEntity
.
setCreateTime
(
new
Date
());
statLogEntity
.
setSiteId
(
site
.
getId
());
statLogEntity
.
setSiteCode
(
site
.
getSiteCode
());
statLogEntity
.
setSiteName
(
site
.
getSiteName
());
AccessQuery
accessQuery
=
new
AccessQuery
();
accessQuery
.
setSiteId
(
site
.
getId
()
==
null
?
0L
:
site
.
getId
());
AccessEntity
accessEntity
=
accessService
.
selectOne
(
accessQuery
);
if
(!
ObjectUtils
.
isEmpty
(
accessEntity
))
{
statLogEntity
.
setAccessId
(
accessEntity
.
getId
());
}
statLogEntity
.
setStatStartTime
(
new
Date
());
statLogEntity
.
setType
(
AccessTypeEnum
.
评价器
.
getValue
());
int
range
=
4
;
for
(
int
i
=
0
;
i
<
range
;
i
++)
{
DateTime
beforeDate
=
DateUtil
.
offsetDay
(
new
Date
(),
-
i
);
int
year
=
beforeDate
.
year
();
int
month
=
beforeDate
.
month
()
+
1
;
int
day
=
beforeDate
.
dayOfMonth
();
PjEvaluateStatEntity
sitestatEntity
=
new
PjEvaluateStatEntity
();
sitestatEntity
.
initAttrValue
();
sitestatEntity
.
setSiteId
(
site
.
getId
());
sitestatEntity
.
setSiteName
(
site
.
getSiteName
());
sitestatEntity
.
setSiteCode
(
site
.
getSiteCode
());
sitestatEntity
.
setYear
(
year
);
sitestatEntity
.
setMonth
(
month
);
sitestatEntity
.
setDay
(
day
);
//设置年月日
pjEvaluateStatService
.
updateSitePjStat
(
sitestatEntity
,
null
);
}
pjqStopWatch
.
stop
();
statLogEntity
.
setStatEndTime
(
new
Date
());
statLogEntity
.
setDuration
(
pjqStopWatch
.
getLastTaskTimeMillis
());
accessStatLogService
.
save
(
statLogEntity
,
null
);
pdjStopWatch
.
start
();
statLogEntity
.
setStatStartTime
(
new
Date
());
statLogEntity
.
setType
(
AccessTypeEnum
.
排队机
.
getValue
());
for
(
int
i
=
0
;
i
<
range
;
i
++)
{
DateTime
beforeDate
=
DateUtil
.
offsetDay
(
new
Date
(),
-
i
);
int
year
=
beforeDate
.
year
();
int
month
=
beforeDate
.
month
()
+
1
;
int
day
=
beforeDate
.
dayOfMonth
();
//设置排号
PhQueueStatEntity
phQueueStatEntity
=
new
PhQueueStatEntity
();
phQueueStatEntity
.
initAttrValue
();
phQueueStatEntity
.
setSiteId
(
site
.
getId
());
phQueueStatEntity
.
setSiteName
(
site
.
getSiteName
());
phQueueStatEntity
.
setSiteCode
(
site
.
getSiteCode
());
phQueueStatEntity
.
setYear
(
year
);
phQueueStatEntity
.
setMonth
(
month
);
phQueueStatEntity
.
setDay
(
day
);
phQueueStatService
.
updateSitePhStat
(
phQueueStatEntity
,
null
);
}
pdjStopWatch
.
stop
();
statLogEntity
.
setStatEndTime
(
new
Date
());
statLogEntity
.
setDuration
(
pjqStopWatch
.
getLastTaskTimeMillis
());
accessStatLogService
.
save
(
statLogEntity
,
null
);
for
(
int
i
=
0
;
i
<
range
;
i
++)
{
DateTime
beforeDate
=
DateUtil
.
offsetDay
(
new
Date
(),
-
i
);
int
year
=
beforeDate
.
year
();
int
month
=
beforeDate
.
month
()
+
1
;
int
day
=
beforeDate
.
dayOfMonth
();
StatEntity
statEntity
=
new
StatEntity
();
statEntity
.
initAttrValue
();
statEntity
.
setSiteId
(
site
.
getId
());
statEntity
.
setSiteName
(
site
.
getSiteName
());
statEntity
.
setSiteCode
(
site
.
getSiteCode
());
statEntity
.
setYear
(
year
);
statEntity
.
setMonth
(
month
);
statEntity
.
setDay
(
day
);
//设置年月日
statService
.
updateSiteStat
(
statEntity
,
null
);
}
allStopWatch
.
stop
();
statLogAllEntity
.
setStatEndTime
(
new
Date
());
statLogAllEntity
.
setDuration
(
pjqStopWatch
.
getLastTaskTimeMillis
());
accessStatLogService
.
save
(
statLogAllEntity
,
null
);
}
}
}
@Override
@Override
public
void
stopTask
(
ITask
task
)
throws
AppException
{
public
void
stopTask
(
ITask
task
)
throws
AppException
{
...
...
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