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
348b097c
Commit
348b097c
authored
Sep 21, 2023
by
hanbing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[updat] 新信号评价-运行评价-修改历史服务水平计算方式
parent
d102f097
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
8 deletions
+34
-8
RunningEvaluateServiceImpl.java
...et/wanji/opt/service/impl/RunningEvaluateServiceImpl.java
+22
-3
SchemeEvaluateServiceImpl.java
...net/wanji/opt/service/impl/SchemeEvaluateServiceImpl.java
+12
-5
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/service/impl/RunningEvaluateServiceImpl.java
View file @
348b097c
...
...
@@ -121,9 +121,19 @@ public class RunningEvaluateServiceImpl implements RunningEvaluateService {
String
crossId
=
bo
.
getCrossId
();
List
<
CrossDataHistPO
>
crossDataHistPOList
=
buildCrossDataHistPOList
(
bo
,
crossId
);
CrossDataRealtimePO
crossDataRealtimePO
=
crossDataRealtimeMapper
.
selectByCrossId
(
crossId
);
Double
sturation
=
crossDataRealtimePO
.
getSturation
();
String
serviceLevel
=
CrossUtil
.
getServiceLevel
(
sturation
);
// 服务水平
double
sumA
=
crossDataHistPOList
.
stream
()
.
filter
(
po
->
isInTimeRange
(
po
.
getBatchTime
()))
.
mapToDouble
(
po
->
po
.
getFlow
()
*
po
.
getSturation
())
.
sum
();
int
sumB
=
crossDataHistPOList
.
stream
()
.
filter
(
po
->
isInTimeRange
(
po
.
getBatchTime
()))
.
mapToInt
(
CrossDataHistPO:
:
getFlow
)
.
sum
();
double
saturation
=
sumA
/
sumB
;
String
serviceLevel
=
CrossUtil
.
getServiceLevel
(
saturation
);
vo
.
setServiceLevel
(
serviceLevel
);
...
...
@@ -140,6 +150,15 @@ public class RunningEvaluateServiceImpl implements RunningEvaluateService {
return
vo
;
}
private
boolean
isInTimeRange
(
Integer
batchTime
)
{
// 早晚高峰及平峰时段
int
hour
=
(
batchTime
%
86400
)
/
3600
;
int
minute
=
(
batchTime
%
3600
)
/
60
;
return
(
hour
>=
7
&&
hour
<
9
)
||
(
hour
>=
16
&&
(
hour
<
18
||
(
hour
==
18
&&
minute
<
30
)))
||
(
hour
>=
11
&&
hour
<
13
);
}
private
List
<
CrossDataHistPO
>
buildCrossDataHistPOList
(
CrossIdAndStartEndDateBO
bo
,
String
crossId
)
{
Date
startDate
=
bo
.
getStartDate
();
Date
endDate
=
bo
.
getEndDate
();
...
...
signal-optimize-service/src/main/java/net/wanji/opt/service/impl/SchemeEvaluateServiceImpl.java
View file @
348b097c
...
...
@@ -257,11 +257,6 @@ public class SchemeEvaluateServiceImpl implements SchemeEvaluateService {
String
endTime
=
schemeDetailOverallBO
.
getEndTime
();
SchemeEvaluateSchemeDetailOverallVO
vo
=
new
SchemeEvaluateSchemeDetailOverallVO
();
// 服务水平
CrossDataRealtimePO
crossDataRealtimePO
=
crossDataRealtimeMapper
.
selectByCrossId
(
crossId
);
Double
sturation
=
crossDataRealtimePO
.
getSturation
();
String
serviceLevel
=
CrossUtil
.
getServiceLevel
(
sturation
);
vo
.
setServiceLevel
(
serviceLevel
);
// 查询起止时间内历史数据
String
dateStr
=
dateFormat
.
format
(
problemDate
);
String
concatenatedStartTime
=
dateStr
+
" "
+
startTime
;
...
...
@@ -272,6 +267,18 @@ public class SchemeEvaluateServiceImpl implements SchemeEvaluateService {
crossId
,
startTimeStamp
,
endTimeStamp
);
List
<
CrossDirDataHistPO
>
crossDirDataHistPOList
=
crossDirDataHistMapper
.
selectByCrossIdAndStartEnd
(
crossId
,
startTimeStamp
,
endTimeStamp
);
// 服务水平
double
sumA
=
crossDataHistPOList
.
stream
()
.
filter
(
item
->
item
.
getBatchTime
()
>=
startTimeStamp
&&
item
.
getBatchTime
()
<=
endTimeStamp
)
.
mapToDouble
(
item
->
item
.
getFlow
()
*
item
.
getSturation
())
.
sum
();
double
sumB
=
crossDataHistPOList
.
stream
()
.
filter
(
item
->
item
.
getBatchTime
()
>=
startTimeStamp
&&
item
.
getBatchTime
()
<=
endTimeStamp
)
.
mapToDouble
(
CrossDataHistPO:
:
getFlow
)
.
sum
();
double
saturation
=
sumA
/
sumB
;
String
serviceLevel
=
CrossUtil
.
getServiceLevel
(
saturation
);
vo
.
setServiceLevel
(
serviceLevel
);
if
(
Objects
.
equals
(
strategyCode
,
StrategyAndMetricsEnum
.
Strategy
.
EFFICIENCY
.
getCode
()))
{
buildEfficiencyVO
(
crossDataHistPOList
,
crossDirDataHistPOList
,
vo
,
crossId
,
startTimeStamp
,
endTimeStamp
);
...
...
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