Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
YZG
yzg-util
Commits
2b9294b0
Commit
2b9294b0
authored
Feb 10, 2023
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改地址
parent
a44bc5c5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
PlanInfo.java
...l-redis/src/main/java/com.yanzuoguang.redis/PlanInfo.java
+12
-1
No files found.
yzg-util-redis/src/main/java/com.yanzuoguang.redis/PlanInfo.java
View file @
2b9294b0
...
@@ -101,6 +101,17 @@ public class PlanInfo<T> {
...
@@ -101,6 +101,17 @@ public class PlanInfo<T> {
* @return 下次执行间隔时间
* @return 下次执行间隔时间
*/
*/
public
int
getNextDayHourMillSecond
(
int
day
,
int
hour
)
{
public
int
getNextDayHourMillSecond
(
int
day
,
int
hour
)
{
return
getNextDayHourMillSecond
(
day
,
(
double
)
hour
);
}
/**
* 间隔N天后第N个小时执行
*
* @param day N天
* @param hour N小时
* @return 下次执行间隔时间
*/
public
int
getNextDayHourMillSecond
(
int
day
,
double
hour
)
{
if
(
this
.
getTime
()
==
0
)
{
if
(
this
.
getTime
()
==
0
)
{
return
0
;
return
0
;
}
}
...
@@ -109,7 +120,7 @@ public class PlanInfo<T> {
...
@@ -109,7 +120,7 @@ public class PlanInfo<T> {
String
prevToday
=
DateHelper
.
getToday
(
prevTime
);
String
prevToday
=
DateHelper
.
getToday
(
prevTime
);
// 通过MQ设置明天凌晨2点开始计算
// 通过MQ设置明天凌晨2点开始计算
Date
nextDay
=
DateHelper
.
addDay
(
DateHelper
.
getDateTime
(
prevToday
),
day
);
Date
nextDay
=
DateHelper
.
addDay
(
DateHelper
.
getDateTime
(
prevToday
),
day
);
Date
nextDayHour
=
DateHelper
.
add
Hour
(
nextDay
,
hour
);
Date
nextDayHour
=
DateHelper
.
add
Minute
(
nextDay
,
(
int
)
(
hour
*
60
)
);
// 下次执行时间
// 下次执行时间
long
dedTime
=
Math
.
max
(
0
,
nextDayHour
.
getTime
()
-
this
.
getTime
());
long
dedTime
=
Math
.
max
(
0
,
nextDayHour
.
getTime
()
-
this
.
getTime
());
return
(
int
)
dedTime
;
return
(
int
)
dedTime
;
...
...
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