Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-trialdrive-admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit b83d052a
authored
Mar 27, 2024
by
杨林龙
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1.50.0 开发1.50.0需求版本 优化用户行为查询
1 parent
87283fbf
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletions
src/main/java/cn/com/glsx/admin/modules/service/RiskAssessmentService.java
src/main/java/cn/com/glsx/admin/modules/service/RiskAssessmentService.java
View file @
b83d052
...
@@ -413,10 +413,13 @@ public class RiskAssessmentService {
...
@@ -413,10 +413,13 @@ public class RiskAssessmentService {
List
<
UserBehaviorWeekDTO
>
userBehaviorWeekDTOList
=
deviceJourneyMapper
.
statisticsDeviceJourneyWithWeek
(
sn
);
List
<
UserBehaviorWeekDTO
>
userBehaviorWeekDTOList
=
deviceJourneyMapper
.
statisticsDeviceJourneyWithWeek
(
sn
);
// 获取最大的年数
// 获取最大的年数
Integer
maxYearInt
=
userBehaviorWeekDTOList
.
stream
().
map
(
UserBehaviorWeekDTO:
:
getYearInt
).
max
(
Integer:
:
compareTo
).
orElse
(
0
);
Integer
maxYearInt
=
userBehaviorWeekDTOList
.
stream
().
map
(
UserBehaviorWeekDTO:
:
getYearInt
).
max
(
Integer:
:
compareTo
).
orElse
(
0
);
log
.
info
(
sn
+
"===maxYearInt==="
+
maxYearInt
);
// 获取最大年数的最大的周数
// 获取最大年数的最大的周数
Integer
maxWeekInt
=
userBehaviorWeekDTOList
.
stream
().
filter
(
item
->
Objects
.
equals
(
item
.
getYearInt
(),
maxYearInt
)).
map
(
UserBehaviorWeekDTO:
:
getWeekInt
).
max
(
Integer:
:
compareTo
).
orElse
(
0
);
Integer
maxWeekInt
=
userBehaviorWeekDTOList
.
stream
().
filter
(
item
->
Objects
.
equals
(
item
.
getYearInt
(),
maxYearInt
)).
map
(
UserBehaviorWeekDTO:
:
getWeekInt
).
max
(
Integer:
:
compareTo
).
orElse
(
0
);
log
.
info
(
sn
+
"===maxWeekInt==="
+
maxWeekInt
);
// 获取最大年数的最小的周数
// 获取最大年数的最小的周数
Integer
minWeekInt
=
userBehaviorWeekDTOList
.
stream
().
filter
(
item
->
Objects
.
equals
(
item
.
getYearInt
(),
maxYearInt
)).
map
(
UserBehaviorWeekDTO:
:
getWeekInt
).
min
(
Integer:
:
compareTo
).
orElse
(
0
);
Integer
minWeekInt
=
userBehaviorWeekDTOList
.
stream
().
filter
(
item
->
Objects
.
equals
(
item
.
getYearInt
(),
maxYearInt
)).
map
(
UserBehaviorWeekDTO:
:
getWeekInt
).
min
(
Integer:
:
compareTo
).
orElse
(
0
);
log
.
info
(
sn
+
"===minWeekInt==="
+
minWeekInt
);
// 如果数据不满一周 则按照每日数量进行统计
// 如果数据不满一周 则按照每日数量进行统计
if
(
Objects
.
equals
(
maxWeekInt
,
minWeekInt
))
{
if
(
Objects
.
equals
(
maxWeekInt
,
minWeekInt
))
{
userBehaviorInformationVO
.
setStatisticsType
(
2
);
userBehaviorInformationVO
.
setStatisticsType
(
2
);
...
@@ -435,7 +438,9 @@ public class RiskAssessmentService {
...
@@ -435,7 +438,9 @@ public class RiskAssessmentService {
List
<
UserBehaviorWeekDTO
>
newUserBehaviorWeekList
=
Lists
.
newArrayList
();
List
<
UserBehaviorWeekDTO
>
newUserBehaviorWeekList
=
Lists
.
newArrayList
();
userBehaviorWeekDTOList
.
stream
().
collect
(
Collectors
.
groupingBy
(
UserBehaviorWeekDTO:
:
getYearInt
)).
forEach
((
year
,
tempUserBehaviorWeekList
)
->
{
userBehaviorWeekDTOList
.
stream
().
collect
(
Collectors
.
groupingBy
(
UserBehaviorWeekDTO:
:
getYearInt
)).
forEach
((
year
,
tempUserBehaviorWeekList
)
->
{
int
maxWeekOfYear
=
DateUtil
.
getMaxWeekOfYear
(
year
);
int
maxWeekOfYear
=
DateUtil
.
getMaxWeekOfYear
(
year
);
log
.
info
(
sn
+
"===maxWeekOfYear==="
+
maxWeekOfYear
);
Map
<
Integer
,
UserBehaviorWeekDTO
>
tempUserBehaviorWeekMap
=
tempUserBehaviorWeekList
.
stream
().
collect
(
Collectors
.
toMap
(
UserBehaviorWeekDTO:
:
getWeekInt
,
Function
.
identity
(),
(
o
,
n
)
->
n
));
Map
<
Integer
,
UserBehaviorWeekDTO
>
tempUserBehaviorWeekMap
=
tempUserBehaviorWeekList
.
stream
().
collect
(
Collectors
.
toMap
(
UserBehaviorWeekDTO:
:
getWeekInt
,
Function
.
identity
(),
(
o
,
n
)
->
n
));
log
.
info
(
sn
+
"===tempUserBehaviorWeekMap==="
+
JSONUtil
.
toJsonStr
(
tempUserBehaviorWeekMap
));
// 最大的年 则使用最大的周计算即刻
// 最大的年 则使用最大的周计算即刻
if
(
Objects
.
equals
(
year
,
maxYearInt
))
{
if
(
Objects
.
equals
(
year
,
maxYearInt
))
{
maxWeekOfYear
=
maxWeekInt
;
maxWeekOfYear
=
maxWeekInt
;
...
@@ -445,7 +450,7 @@ public class RiskAssessmentService {
...
@@ -445,7 +450,7 @@ public class RiskAssessmentService {
newUserBehaviorWeekList
.
add
(
tempUserBehaviorWeekDTO
);
newUserBehaviorWeekList
.
add
(
tempUserBehaviorWeekDTO
);
}
}
});
});
log
.
info
(
"newUserBehaviorWeekList==="
+
JSONUtil
.
toJsonStr
(
newUserBehaviorWeekList
));
log
.
info
(
sn
+
"newUserBehaviorWeekList==="
+
JSONUtil
.
toJsonStr
(
newUserBehaviorWeekList
));
int
size
=
CollectionUtils
.
isNotEmpty
(
newUserBehaviorWeekList
)
?
newUserBehaviorWeekList
.
size
()
:
0
;
int
size
=
CollectionUtils
.
isNotEmpty
(
newUserBehaviorWeekList
)
?
newUserBehaviorWeekList
.
size
()
:
0
;
if
(
size
<
18
)
{
if
(
size
<
18
)
{
userBehaviorInformationVO
.
setUserBehaviorWeekDTOList
(
getUserBehaviorWeekList
(
newUserBehaviorWeekList
));
userBehaviorInformationVO
.
setUserBehaviorWeekDTOList
(
getUserBehaviorWeekList
(
newUserBehaviorWeekList
));
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment