Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
traffic-signal-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
signal
traffic-signal-platform
Commits
2d4f99d8
Commit
2d4f99d8
authored
Apr 22, 2024
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[update] 济南测试平台-常发性偶发性优化
parent
56882d8d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
5 deletions
+20
-5
TrendServiceImpl.java
...ain/java/net/wanji/opt/service/impl/TrendServiceImpl.java
+20
-5
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/service/impl/TrendServiceImpl.java
View file @
2d4f99d8
...
@@ -7,6 +7,7 @@ import cn.hutool.core.util.ObjectUtil;
...
@@ -7,6 +7,7 @@ import cn.hutool.core.util.ObjectUtil;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
net.wanji.common.enums.*
;
import
net.wanji.common.enums.*
;
import
net.wanji.common.utils.tool.CrossUtil
;
import
net.wanji.common.utils.tool.CrossUtil
;
import
net.wanji.common.utils.tool.StringUtils
;
import
net.wanji.databus.bo.CrossIdBO
;
import
net.wanji.databus.bo.CrossIdBO
;
import
net.wanji.databus.dao.entity.*
;
import
net.wanji.databus.dao.entity.*
;
import
net.wanji.databus.dao.mapper.*
;
import
net.wanji.databus.dao.mapper.*
;
...
@@ -42,6 +43,7 @@ import java.math.RoundingMode;
...
@@ -42,6 +43,7 @@ import java.math.RoundingMode;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.time.*
;
import
java.time.*
;
import
java.time.format.DateTimeFormatter
;
import
java.time.temporal.ChronoUnit
;
import
java.time.temporal.ChronoUnit
;
import
java.util.*
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.function.Function
;
...
@@ -252,9 +254,8 @@ public class TrendServiceImpl implements TrendService {
...
@@ -252,9 +254,8 @@ public class TrendServiceImpl implements TrendService {
Double
congestionIndex
=
abnormalCrossListVO
.
getCongestionIndex
();
Double
congestionIndex
=
abnormalCrossListVO
.
getCongestionIndex
();
double
lastWeekIndex
=
getIndex
(
congestionIndex
,
crossId
,
batchTime
-
604800
);
double
lastWeekIndex
=
getIndex
(
congestionIndex
,
crossId
,
batchTime
-
604800
);
double
lastPeriodIndex
=
getIndex
(
congestionIndex
,
crossId
,
batchTime
-
300
);
double
lastPeriodIndex
=
getIndex
(
congestionIndex
,
crossId
,
batchTime
-
300
);
abnormalCrossListVO
.
setLastWeekIndex
(
Math
.
floor
(
lastWeekIndex
));
abnormalCrossListVO
.
setLastWeekIndex
(
lastWeekIndex
);
abnormalCrossListVO
.
setLastPeriodIndex
(
Math
.
floor
(
lastPeriodIndex
));
abnormalCrossListVO
.
setLastPeriodIndex
(
lastPeriodIndex
);
// 常发性偶发性 一个月内超过三次
// 常发性偶发性 一个月内超过三次
int
frequent
=
getFrequent
(
crossId
,
batchTime
);
int
frequent
=
getFrequent
(
crossId
,
batchTime
);
...
@@ -277,9 +278,23 @@ public class TrendServiceImpl implements TrendService {
...
@@ -277,9 +278,23 @@ public class TrendServiceImpl implements TrendService {
LambdaQueryWrapper
<
CrossDataHistPO
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
CrossDataHistPO
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
CrossDataHistPO:
:
getCrossId
,
crossId
);
queryWrapper
.
eq
(
CrossDataHistPO:
:
getCrossId
,
crossId
);
queryWrapper
.
between
(
CrossDataHistPO:
:
getBatchTime
,
batchTime
-
30
*
86400
,
batchTime
);
queryWrapper
.
between
(
CrossDataHistPO:
:
getBatchTime
,
batchTime
-
30
*
86400
,
batchTime
);
queryWrapper
.
eq
(
CrossDataHistPO:
:
getIsCongestion
,
1
);
List
<
CrossDataHistPO
>
crossDataHistPOS
=
crossDataHistMapper
.
selectList
(
queryWrapper
);
List
<
CrossDataHistPO
>
crossDataHistPOS
=
crossDataHistMapper
.
selectList
(
queryWrapper
);
int
frequent
=
crossDataHistPOS
.
size
()
>
3
?
1
:
0
;
List
<
CrossDataHistPO
>
result
=
new
ArrayList
<>();
return
frequent
;
for
(
CrossDataHistPO
crossDataHistPO
:
crossDataHistPOS
)
{
Date
startTime
=
crossDataHistPO
.
getStartTime
();
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
"HH:mm"
);
LocalTime
localTime
=
startTime
.
toInstant
().
atZone
(
ZoneId
.
of
(
"Asia/Shanghai"
)).
toLocalTime
();
if
((
localTime
.
isAfter
(
LocalTime
.
parse
(
"06:30"
,
formatter
))
&&
localTime
.
isBefore
(
LocalTime
.
parse
(
"09:30"
,
formatter
))
&&
StringUtils
.
equalsIgnoreCase
(
crossId
,
crossDataHistPO
.
getCrossId
()))
||
(
localTime
.
isAfter
(
LocalTime
.
parse
(
"16:30"
,
formatter
))
&&
localTime
.
isBefore
(
LocalTime
.
parse
(
"19:30"
,
formatter
))
&&
StringUtils
.
equalsIgnoreCase
(
crossId
,
crossDataHistPO
.
getCrossId
())))
{
result
.
add
(
crossDataHistPO
);
}
}
return
result
.
size
()
>
3
?
1
:
0
;
}
}
private
double
getIndex
(
Double
congestionIndex
,
String
crossId
,
Integer
batchTime
)
{
private
double
getIndex
(
Double
congestionIndex
,
String
crossId
,
Integer
batchTime
)
{
...
...
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