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
26834802
Commit
26834802
authored
Jul 24, 2024
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改排队统计更新与组合查询
parent
63b2d619
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
25 deletions
+32
-25
bill-manager/src/main/java/com/mortals/xhx/module/ph/service/impl/PhQueueStatServiceImpl.java
...ls/xhx/module/ph/service/impl/PhQueueStatServiceImpl.java
+32
-25
No files found.
bill-manager/src/main/java/com/mortals/xhx/module/ph/service/impl/PhQueueStatServiceImpl.java
View file @
26834802
...
...
@@ -52,7 +52,7 @@ public class PhQueueStatServiceImpl extends AbstractCRUDServiceImpl<PhQueueStatD
SimpleDateFormat
date
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
//yyyy-年,MM-月,dd-日,HH-时,mm-分,ss-秒
String
currentDate
=
date
.
format
(
calendar
.
getTime
());
PhQueueQuery
phQueueQuery
=
new
PhQueueQuery
();
PhQueueQuery
phQueueQuery
=
new
PhQueueQuery
();
phQueueQuery
.
setSiteId
(
entity
.
getSiteId
());
phQueueQuery
.
setTaketimeStart
(
currentDate
);
phQueueQuery
.
setTaketimeEnd
(
currentDate
);
...
...
@@ -116,7 +116,7 @@ public class PhQueueStatServiceImpl extends AbstractCRUDServiceImpl<PhQueueStatD
private
void
updateSiteHallPhCount
(
String
currentDate
,
PhQueueStatEntity
entity
,
List
<
PhQueueEntity
>
phQueueEntities
)
{
Map
<
String
,
List
<
PhQueueEntity
>>
collect
=
phQueueEntities
.
parallelStream
().
collect
(
Collectors
.
groupingBy
(
x
->
x
.
getHallName
()));
List
<
PhQueueStatEntity
>
saveAndUpdatelist
=
collect
.
entrySet
().
parallelStream
().
map
(
item
->
{
List
<
PhQueueStatEntity
>
saveAndUpdatelist
=
collect
.
entrySet
().
parallelStream
().
map
(
item
->
{
String
hallName
=
item
.
getKey
();
if
(
ObjectUtils
.
isEmpty
(
hallName
))
return
null
;
List
<
PhQueueEntity
>
value
=
item
.
getValue
();
...
...
@@ -134,7 +134,7 @@ public class PhQueueStatServiceImpl extends AbstractCRUDServiceImpl<PhQueueStatD
private
void
updateSiteBussinessPhCount
(
String
currentDate
,
PhQueueStatEntity
entity
,
List
<
PhQueueEntity
>
phQueueEntities
)
{
Map
<
String
,
List
<
PhQueueEntity
>>
collect
=
phQueueEntities
.
parallelStream
().
collect
(
Collectors
.
groupingBy
(
x
->
x
.
getBusiness
()));
List
<
PhQueueStatEntity
>
saveAndUpdatelist
=
collect
.
entrySet
().
parallelStream
().
map
(
item
->
{
List
<
PhQueueStatEntity
>
saveAndUpdatelist
=
collect
.
entrySet
().
parallelStream
().
map
(
item
->
{
String
bussiness
=
item
.
getKey
();
if
(
ObjectUtils
.
isEmpty
(
bussiness
))
return
null
;
List
<
PhQueueEntity
>
value
=
item
.
getValue
();
...
...
@@ -152,7 +152,7 @@ public class PhQueueStatServiceImpl extends AbstractCRUDServiceImpl<PhQueueStatD
private
void
updateSiteWindowPhCount
(
String
currentDate
,
PhQueueStatEntity
entity
,
List
<
PhQueueEntity
>
phQueueEntities
)
{
Map
<
String
,
List
<
PhQueueEntity
>>
collect
=
phQueueEntities
.
parallelStream
().
collect
(
Collectors
.
groupingBy
(
x
->
x
.
getWindowFromnum
()));
List
<
PhQueueStatEntity
>
saveAndUpdatelist
=
collect
.
entrySet
().
parallelStream
().
map
(
item
->
{
List
<
PhQueueStatEntity
>
saveAndUpdatelist
=
collect
.
entrySet
().
parallelStream
().
map
(
item
->
{
String
window
=
item
.
getKey
();
if
(
ObjectUtils
.
isEmpty
(
window
))
return
null
;
List
<
PhQueueEntity
>
value
=
item
.
getValue
();
...
...
@@ -215,10 +215,10 @@ public class PhQueueStatServiceImpl extends AbstractCRUDServiceImpl<PhQueueStatD
private
void
updateBusinessAndSectionName
(
PhQueueStatEntity
entity
,
List
<
PhQueueEntity
>
phQueueEntities
)
{
Map
<
String
,
List
<
PhQueueEntity
>>
businessAndSectionCollect
=
phQueueEntities
.
parallelStream
()
.
collect
(
Collectors
.
groupingBy
(
x
->
x
.
getBusiness
()
+
"&"
+
x
.
getSectionName
()));
List
<
PhQueueStatEntity
>
saveAndUpdatelist
=
businessAndSectionCollect
.
entrySet
().
parallelStream
().
map
(
item
->
{
List
<
PhQueueStatEntity
>
saveAndUpdatelist
=
businessAndSectionCollect
.
entrySet
().
parallelStream
().
map
(
item
->
{
String
vals
=
item
.
getKey
();
String
[]
split
=
vals
.
split
(
"&"
);
if
(
ObjectUtils
.
isEmpty
(
split
[
0
])
||
ObjectUtils
.
isEmpty
(
split
[
1
]))
return
null
;
if
(
ObjectUtils
.
isEmpty
(
split
[
0
])
||
ObjectUtils
.
isEmpty
(
split
[
1
]))
return
null
;
Double
intAvg
=
item
.
getValue
().
parallelStream
().
mapToInt
(
e
->
e
.
getWaitTime
()).
average
().
orElse
(
0
D
);
// log.info("更新站点排队统计数据,站点名称:{},日期:{},窗口:{},排队数量:{}", entity.getSiteName(), currentDate,window, phQueueEntities.size());
PhQueueStatQuery
phQueueStatQuery
=
getPhQueueStatQuery
(
entity
);
...
...
@@ -236,10 +236,10 @@ public class PhQueueStatServiceImpl extends AbstractCRUDServiceImpl<PhQueueStatD
private
void
updateBusinessAndWindowFromnum
(
PhQueueStatEntity
entity
,
List
<
PhQueueEntity
>
phQueueEntities
)
{
Map
<
String
,
List
<
PhQueueEntity
>>
businessAndSectionCollect
=
phQueueEntities
.
parallelStream
()
.
collect
(
Collectors
.
groupingBy
(
x
->
x
.
getBusiness
()
+
"&"
+
x
.
getWindowFromnum
()));
List
<
PhQueueStatEntity
>
saveAndUpdatelist
=
businessAndSectionCollect
.
entrySet
().
parallelStream
().
map
(
item
->
{
List
<
PhQueueStatEntity
>
saveAndUpdatelist
=
businessAndSectionCollect
.
entrySet
().
parallelStream
().
map
(
item
->
{
String
vals
=
item
.
getKey
();
String
[]
split
=
vals
.
split
(
"&"
);
if
(
ObjectUtils
.
isEmpty
(
split
[
0
])
||
ObjectUtils
.
isEmpty
(
split
[
1
]))
return
null
;
if
(
ObjectUtils
.
isEmpty
(
split
[
0
])
||
ObjectUtils
.
isEmpty
(
split
[
1
]))
return
null
;
Double
intAvg
=
item
.
getValue
().
parallelStream
().
mapToInt
(
e
->
e
.
getWaitTime
()).
average
().
orElse
(
0
D
);
// log.info("更新站点排队统计数据,站点名称:{},日期:{},窗口:{},排队数量:{}", entity.getSiteName(), currentDate,window, phQueueEntities.size());
PhQueueStatQuery
phQueueStatQuery
=
getPhQueueStatQuery
(
entity
);
...
...
@@ -257,10 +257,10 @@ public class PhQueueStatServiceImpl extends AbstractCRUDServiceImpl<PhQueueStatD
private
void
updateSectionNameAndWindowFromnum
(
PhQueueStatEntity
entity
,
List
<
PhQueueEntity
>
phQueueEntities
)
{
Map
<
String
,
List
<
PhQueueEntity
>>
businessAndSectionCollect
=
phQueueEntities
.
parallelStream
()
.
collect
(
Collectors
.
groupingBy
(
x
->
x
.
getSectionName
()
+
"&"
+
x
.
getWindowFromnum
()));
List
<
PhQueueStatEntity
>
saveAndUpdatelist
=
businessAndSectionCollect
.
entrySet
().
parallelStream
().
map
(
item
->
{
List
<
PhQueueStatEntity
>
saveAndUpdatelist
=
businessAndSectionCollect
.
entrySet
().
parallelStream
().
map
(
item
->
{
String
vals
=
item
.
getKey
();
String
[]
split
=
vals
.
split
(
"&"
);
if
(
ObjectUtils
.
isEmpty
(
split
[
0
])
||
ObjectUtils
.
isEmpty
(
split
[
1
]))
return
null
;
if
(
ObjectUtils
.
isEmpty
(
split
[
0
])
||
ObjectUtils
.
isEmpty
(
split
[
1
]))
return
null
;
Double
intAvg
=
item
.
getValue
().
parallelStream
().
mapToInt
(
e
->
e
.
getWaitTime
()).
average
().
orElse
(
0
D
);
// log.info("更新站点排队统计数据,站点名称:{},日期:{},窗口:{},排队数量:{}", entity.getSiteName(), currentDate,window, phQueueEntities.size());
PhQueueStatQuery
phQueueStatQuery
=
getPhQueueStatQuery
(
entity
);
...
...
@@ -276,11 +276,12 @@ public class PhQueueStatServiceImpl extends AbstractCRUDServiceImpl<PhQueueStatD
private
void
updateBusinessAndSectionNameAndWindow
(
PhQueueStatEntity
entity
,
List
<
PhQueueEntity
>
phQueueEntities
)
{
Map
<
String
,
List
<
PhQueueEntity
>>
businessAndSectionCollect
=
phQueueEntities
.
parallelStream
()
.
collect
(
Collectors
.
groupingBy
(
x
->
x
.
getBusiness
()
+
"&"
+
x
.
getSectionName
()+
"&"
+
x
.
getWindowFromnum
()));
List
<
PhQueueStatEntity
>
saveAndUpdatelist
=
businessAndSectionCollect
.
entrySet
().
parallelStream
().
map
(
item
->
{
.
collect
(
Collectors
.
groupingBy
(
x
->
x
.
getBusiness
()
+
"&"
+
x
.
getSectionName
()
+
"&"
+
x
.
getWindowFromnum
()));
List
<
PhQueueStatEntity
>
saveAndUpdatelist
=
businessAndSectionCollect
.
entrySet
().
parallelStream
().
map
(
item
->
{
String
vals
=
item
.
getKey
();
String
[]
split
=
vals
.
split
(
"&"
);
if
(
ObjectUtils
.
isEmpty
(
split
[
0
])||
ObjectUtils
.
isEmpty
(
split
[
1
])||
ObjectUtils
.
isEmpty
(
split
[
2
]))
return
null
;
if
(
ObjectUtils
.
isEmpty
(
split
[
0
])
||
ObjectUtils
.
isEmpty
(
split
[
1
])
||
ObjectUtils
.
isEmpty
(
split
[
2
]))
return
null
;
Double
intAvg
=
item
.
getValue
().
parallelStream
().
mapToInt
(
e
->
e
.
getWaitTime
()).
average
().
orElse
(
0
D
);
// log.info("更新站点排队统计数据,站点名称:{},日期:{},窗口:{},排队数量:{}", entity.getSiteName(), currentDate,window, phQueueEntities.size());
PhQueueStatQuery
phQueueStatQuery
=
getPhQueueStatQuery
(
entity
);
...
...
@@ -333,23 +334,29 @@ public class PhQueueStatServiceImpl extends AbstractCRUDServiceImpl<PhQueueStatD
}
private
void
saveUpdatePhqueueStatList
(
List
<
PhQueueStatEntity
>
saveAndUpdatelist
)
{
if
(!
ObjectUtils
.
isEmpty
(
saveAndUpdatelist
))
{
Map
<
Boolean
,
List
<
PhQueueStatEntity
>>
saveUpdateCollect
=
saveAndUpdatelist
.
parallelStream
().
collect
(
Collectors
.
partitioningBy
(
i
->
i
.
newEntity
()));
if
(!
ObjectUtils
.
isEmpty
(
saveUpdateCollect
.
get
(
true
)))
{
//新增列表
log
.
info
(
"新增站点排队部门统计数据,数量:{}"
,
saveUpdateCollect
.
get
(
true
).
size
());
this
.
save
(
saveUpdateCollect
.
get
(
true
));
}
try
{
if
(!
ObjectUtils
.
isEmpty
(
saveUpdateCollect
.
get
(
false
)))
{
//更新列表
if
(!
ObjectUtils
.
isEmpty
(
saveAndUpdatelist
))
{
Map
<
Boolean
,
List
<
PhQueueStatEntity
>>
saveUpdateCollect
=
saveAndUpdatelist
.
parallelStream
().
collect
(
Collectors
.
partitioningBy
(
i
->
i
.
newEntity
()));
log
.
info
(
"新增站点排队部门统计数据,数量:{}"
,
saveUpdateCollect
.
get
(
true
).
size
());
if
(!
ObjectUtils
.
isEmpty
(
saveUpdateCollect
.
get
(
true
)))
{
//新增列表
this
.
save
(
saveUpdateCollect
.
get
(
true
));
}
log
.
info
(
"更新站点排队部门统计数据,数量:{}"
,
saveUpdateCollect
.
get
(
true
).
size
());
this
.
update
(
saveUpdateCollect
.
get
(
true
));
}
if
(!
ObjectUtils
.
isEmpty
(
saveUpdateCollect
.
get
(
false
)))
{
//更新列表
this
.
update
(
saveUpdateCollect
.
get
(
true
));
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
"异常,e"
);
}
}
...
...
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