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
1faf1d59
Commit
1faf1d59
authored
Feb 26, 2025
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[add] 交通状态分布折线图优化
parent
dc3384a5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
9 deletions
+17
-9
EventServiceImpl.java
...ain/java/net/wanji/opt/service/impl/EventServiceImpl.java
+8
-1
LocalDateTimeUtil.java
...n/java/net/wanji/common/utils/tool/LocalDateTimeUtil.java
+9
-8
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/service/impl/EventServiceImpl.java
View file @
1faf1d59
...
...
@@ -31,6 +31,7 @@ import org.joda.time.format.DateTimeFormat;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.text.ParseException
;
import
java.time.LocalDateTime
;
import
java.time.ZoneId
;
import
java.time.format.DateTimeFormatter
;
...
...
@@ -313,7 +314,13 @@ public class EventServiceImpl implements EventService {
eventInfoTrafficStatusPOS
.
add
(
eventInfoTrafficStatusPO
);
}
}
List
<
EventInfoTrafficStatusPO
>
trafficStatusPOS
=
eventInfoTrafficStatusPOS
.
stream
().
sorted
(
Comparator
.
comparing
(
time
->
Integer
.
valueOf
(
time
.
getTimeAxisStart
().
split
(
":"
)[
0
]))).
collect
(
Collectors
.
toList
());
List
<
EventInfoTrafficStatusPO
>
trafficStatusPOS
=
eventInfoTrafficStatusPOS
.
stream
().
sorted
(
Comparator
.
comparing
(
time
->
{
try
{
return
DateUtil
.
parse
(
time
.
getTimeAxisStart
(),
LocalDateTimeUtil
.
HOURMINITFORMATTER
);
}
catch
(
ParseException
e
)
{
throw
new
RuntimeException
(
e
);
}
})).
collect
(
Collectors
.
toList
());
List
<
Integer
>
durationList
=
trafficStatusPOS
.
stream
().
map
(
x
->
x
.
getDuration
()).
collect
(
Collectors
.
toList
());
List
<
Integer
>
countList
=
trafficStatusPOS
.
stream
().
map
(
x
->
x
.
getCount
()).
collect
(
Collectors
.
toList
());
eventInfoTrafficStatusVO
.
setEventCount
(
countList
);
...
...
wj-common/src/main/java/net/wanji/common/utils/tool/LocalDateTimeUtil.java
View file @
1faf1d59
package
net
.
wanji
.
common
.
utils
.
tool
;
import
java.text.MessageFormat
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.time.*
;
import
java.time.format.DateTimeFormatter
;
...
...
@@ -25,6 +26,7 @@ public class LocalDateTimeUtil {
public
static
final
String
YEARFORMATTER
=
"yyyy"
;
public
static
final
String
SIMPLE
=
"yyyyMMddHHmmss"
;
public
static
final
String
TIMEFORMATTERTILT
=
"yyyy/MM/dd HH:mm:ss"
;
public
static
final
String
HOURMINITFORMATTER
=
"HH:mm"
;
private
LocalDateTimeUtil
()
{
...
...
@@ -156,6 +158,7 @@ public class LocalDateTimeUtil {
return
LocalDateTime
.
parse
(
time
,
df
);
}
/**
* 将日期字符串转化为LocalDateTime
*
...
...
@@ -168,14 +171,12 @@ public class LocalDateTimeUtil {
return
LocalDateTime
.
parse
(
checkFormat
(
time
),
df
);
}
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
"--"
+
new
Date
());
String
date
=
"2021/10/22 17:45:20"
;
String
nowStageStartTime
=
date
==
null
?
""
:
date
.
toString
().
replaceAll
(
"\""
,
""
);
LocalDateTime
localDateTime
=
parseStringToDateTimeTwo
(
nowStageStartTime
,
LocalDateTimeUtil
.
TIMEFORMATTERTILT
);
String
time
=
nowStageStartTime
.
isEmpty
()
?
"0"
:
Long
.
toString
(
LocalDateTimeUtil
.
betweenTwoTime
(
localDateTime
,
LocalDateTime
.
now
(),
ChronoUnit
.
SECONDS
));
System
.
out
.
println
(
time
);
System
.
out
.
println
(
new
Date
().
getTime
());
public
static
void
main
(
String
[]
args
)
throws
ParseException
{
//LocalDateTime localDateTime = parseStringToDateTime("08:00", LocalDateTimeUtil.HOURMINITFORMATTER);
//System.out.println(localDateTime);
Date
parse
=
DateUtil
.
parse
(
"08:00"
,
LocalDateTimeUtil
.
HOURMINITFORMATTER
);
System
.
out
.
println
(
parse
);
}
/**
...
...
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