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
893b5c55
Commit
893b5c55
authored
Feb 09, 2025
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[add] 小时流量统计优化
parent
fda6a763
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
6 deletions
+9
-6
RunningEvaluateServiceImpl.java
...et/wanji/opt/service/impl/RunningEvaluateServiceImpl.java
+1
-1
TrendServiceImpl.java
...ain/java/net/wanji/opt/service/impl/TrendServiceImpl.java
+7
-4
CrossDataHistMapper.xml
wj-databus/src/main/resources/mapper/CrossDataHistMapper.xml
+1
-1
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/service/impl/RunningEvaluateServiceImpl.java
View file @
893b5c55
...
@@ -412,7 +412,7 @@ public class RunningEvaluateServiceImpl implements RunningEvaluateService {
...
@@ -412,7 +412,7 @@ public class RunningEvaluateServiceImpl implements RunningEvaluateService {
// 按时间段分组
// 按时间段分组
Map
<
String
,
List
<
MetricHistDTO
>>
groupedByTime
=
metricHistDTOList
.
stream
()
Map
<
String
,
List
<
MetricHistDTO
>>
groupedByTime
=
metricHistDTOList
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
metricHistDTO
->
{
.
collect
(
Collectors
.
groupingBy
(
metricHistDTO
->
{
long
timestampInMillSeconds
=
metricHistDTO
.
getBatchTime
()
*
1000L
;
long
timestampInMillSeconds
=
metricHistDTO
.
getBatchTime
()
*
1000L
-
300000
;
Date
date
=
new
Date
(
timestampInMillSeconds
);
Date
date
=
new
Date
(
timestampInMillSeconds
);
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"HH:mm"
);
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"HH:mm"
);
int
minuteOfDay
=
date
.
getMinutes
()
+
date
.
getHours
()
*
60
;
int
minuteOfDay
=
date
.
getMinutes
()
+
date
.
getHours
()
*
60
;
...
...
signal-optimize-service/src/main/java/net/wanji/opt/service/impl/TrendServiceImpl.java
View file @
893b5c55
...
@@ -1938,10 +1938,13 @@ public class TrendServiceImpl implements TrendService {
...
@@ -1938,10 +1938,13 @@ public class TrendServiceImpl implements TrendService {
top5IndexVO
.
setCrossId
(
crossId
);
top5IndexVO
.
setCrossId
(
crossId
);
//metricsDetailBO.setDate(DateUtil.offsetDay(new Date(1705456500000L), -1));
//metricsDetailBO.setDate(DateUtil.offsetDay(new Date(1705456500000L), -1));
Date
date
=
new
Date
();
Date
date
=
new
Date
();
DateTime
start
=
DateUtil
.
offsetDay
(
DateUtil
.
offsetHour
(
date
,
2
),
-
1
);
LocalDateTime
now
=
LocalDateTime
.
now
();
DateTime
end
=
DateUtil
.
offsetDay
(
DateUtil
.
offsetHour
(
date
,
2
),
0
);
LocalDateTime
startDate
=
now
.
plusHours
(
1
).
minusDays
(
1
).
withMinute
(
0
).
withSecond
(
0
).
withNano
(
0
);
int
startStamp
=
(
int
)
(
start
.
getTime
()
/
1000
);
// 10位时间戳
LocalDateTime
endDate
=
now
.
withMinute
(
0
).
withSecond
(
0
).
withNano
(
0
);
int
endStamp
=
(
int
)
(
end
.
getTime
()
/
1000
+
300
);
long
startL
=
startDate
.
atZone
(
ZoneId
.
systemDefault
()).
toInstant
().
toEpochMilli
();
long
endL
=
endDate
.
atZone
(
ZoneId
.
systemDefault
()).
toInstant
().
toEpochMilli
();
int
startStamp
=
(
int
)
(
startL
/
1000
);
int
endStamp
=
(
int
)
(
endL
/
1000
);
List
<
MetricHistDTO
>
metricHistDTOS
=
crossDataHistMapper
.
selectMetricHistDTO
(
crossId
,
startStamp
,
endStamp
);
List
<
MetricHistDTO
>
metricHistDTOS
=
crossDataHistMapper
.
selectMetricHistDTO
(
crossId
,
startStamp
,
endStamp
);
// 使用全量数据按时间粒度聚合指标
// 使用全量数据按时间粒度聚合指标
List
<
RunningEvaluateMetricsDetailVO
.
CrossMetrics
>
crossMetrics
=
RunningEvaluateServiceImpl
.
buildMetricsList
(
metricHistDTOS
,
60
);
List
<
RunningEvaluateMetricsDetailVO
.
CrossMetrics
>
crossMetrics
=
RunningEvaluateServiceImpl
.
buildMetricsList
(
metricHistDTOS
,
60
);
...
...
wj-databus/src/main/resources/mapper/CrossDataHistMapper.xml
View file @
893b5c55
...
@@ -116,7 +116,7 @@
...
@@ -116,7 +116,7 @@
from t_cross_data_hist
from t_cross_data_hist
where cross_id = #{crossId}
where cross_id = #{crossId}
and batch_time
<![CDATA[ >= ]]>
#{startStamp}
and batch_time
<![CDATA[ >= ]]>
#{startStamp}
and batch_time
<![CDATA[ <
=
]]>
#{endStamp}
and batch_time
<![CDATA[ < ]]>
#{endStamp}
order by batch_time
order by batch_time
</select>
</select>
...
...
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