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
f6ec1dcd
Commit
f6ec1dcd
authored
Jul 25, 2024
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[update] 代码优化-优化blocker异常
parent
cac32575
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
DateUtils.java
...c/main/java/net/wanji/web/common/util/date/DateUtils.java
+9
-4
No files found.
signal-control-service/src/main/java/net/wanji/web/common/util/date/DateUtils.java
View file @
f6ec1dcd
...
@@ -167,7 +167,9 @@ public class DateUtils {
...
@@ -167,7 +167,9 @@ public class DateUtils {
public
static
Double
getIntervalHours
(
String
startTime
,
String
endTime
)
{
public
static
Double
getIntervalHours
(
String
startTime
,
String
endTime
)
{
Date
staDate
=
DateUtils
.
stringToDate
(
startTime
,
DateStyle
.
HH_MM_SS
);
Date
staDate
=
DateUtils
.
stringToDate
(
startTime
,
DateStyle
.
HH_MM_SS
);
Date
endDate
=
DateUtils
.
stringToDate
(
endTime
,
DateStyle
.
HH_MM_SS
);
Date
endDate
=
DateUtils
.
stringToDate
(
endTime
,
DateStyle
.
HH_MM_SS
);
if
(
staDate
==
null
||
endDate
==
null
)
return
null
;
if
(
staDate
==
null
||
endDate
==
null
)
{
return
null
;
}
BigDecimal
startTimeStamp
=
BigDecimal
.
valueOf
(
staDate
.
getTime
());
BigDecimal
startTimeStamp
=
BigDecimal
.
valueOf
(
staDate
.
getTime
());
BigDecimal
endTimeStamp
=
BigDecimal
.
valueOf
(
endDate
.
getTime
());
BigDecimal
endTimeStamp
=
BigDecimal
.
valueOf
(
endDate
.
getTime
());
BigDecimal
hours
=
endTimeStamp
.
subtract
(
startTimeStamp
).
divide
(
new
BigDecimal
(
1000
*
60
*
60
),
2
,
BigDecimal
.
ROUND_DOWN
);
BigDecimal
hours
=
endTimeStamp
.
subtract
(
startTimeStamp
).
divide
(
new
BigDecimal
(
1000
*
60
*
60
),
2
,
BigDecimal
.
ROUND_DOWN
);
...
@@ -809,7 +811,9 @@ public class DateUtils {
...
@@ -809,7 +811,9 @@ public class DateUtils {
*/
*/
public
static
int
compareDate
(
Date
date1
,
Date
date2
)
{
public
static
int
compareDate
(
Date
date1
,
Date
date2
)
{
if
(
date1
==
null
||
date2
==
null
)
return
0
;
if
(
date1
==
null
||
date2
==
null
)
{
return
0
;
}
if
(
date1
.
getTime
()
>
date2
.
getTime
())
{
if
(
date1
.
getTime
()
>
date2
.
getTime
())
{
return
1
;
return
1
;
}
else
if
(
date1
.
getTime
()
<
date2
.
getTime
())
{
}
else
if
(
date1
.
getTime
()
<
date2
.
getTime
())
{
...
@@ -830,8 +834,9 @@ public class DateUtils {
...
@@ -830,8 +834,9 @@ public class DateUtils {
* @author: yinguijin
* @author: yinguijin
*/
*/
public
static
boolean
isSameDate
(
Date
d1
,
Date
d2
)
{
public
static
boolean
isSameDate
(
Date
d1
,
Date
d2
)
{
if
(
null
==
d1
||
null
==
d2
)
if
(
null
==
d1
||
null
==
d2
)
{
return
false
;
return
false
;
}
Calendar
cal1
=
Calendar
.
getInstance
();
Calendar
cal1
=
Calendar
.
getInstance
();
cal1
.
setTime
(
d1
);
cal1
.
setTime
(
d1
);
Calendar
cal2
=
Calendar
.
getInstance
();
Calendar
cal2
=
Calendar
.
getInstance
();
...
@@ -1208,7 +1213,7 @@ public class DateUtils {
...
@@ -1208,7 +1213,7 @@ public class DateUtils {
end
.
set
(
Integer
.
valueOf
(
dateEnds
[
0
]),
Integer
.
valueOf
(
dateEnds
[
1
])
-
1
,
Integer
.
valueOf
(
dateEnds
[
2
]));
end
.
set
(
Integer
.
valueOf
(
dateEnds
[
0
]),
Integer
.
valueOf
(
dateEnds
[
1
])
-
1
,
Integer
.
valueOf
(
dateEnds
[
2
]));
Long
endTime
=
end
.
getTimeInMillis
();
Long
endTime
=
end
.
getTimeInMillis
();
//定义一个一天的时间戳时长
//定义一个一天的时间戳时长
Long
oneDay
=
1000
*
60
*
60
*
24
l
;
Long
oneDay
=
1000
*
60
*
60
*
24
L
;
Long
time
=
startTIme
;
Long
time
=
startTIme
;
//循环得出
//循环得出
while
(
time
<=
endTime
)
{
while
(
time
<=
endTime
)
{
...
...
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