Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
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
项目统一框架
amos-boot-biz
Commits
6140f643
Commit
6140f643
authored
Jun 07, 2022
by
zhangsen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改bug5980 维保定时任务
parent
c453e3ef
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
0 deletions
+33
-0
PlanTaskServiceImpl.java
...aintenance/business/service/impl/PlanTaskServiceImpl.java
+33
-0
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/business/service/impl/PlanTaskServiceImpl.java
View file @
6140f643
...
...
@@ -44,8 +44,10 @@ import org.springframework.util.StringUtils;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.math.BigDecimal
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalTime
;
import
java.util.*
;
import
java.util.concurrent.CompletionException
;
import
java.util.function.Function
;
...
...
@@ -239,6 +241,20 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
/**
* startTime > stopTime 且 startTime 与 stopTime相差1小时内返回true
* @param startTime
* @param stopTime
* @return
*/
public
static
boolean
getTimeDifference
(
LocalTime
startTime
,
LocalTime
stopTime
)
{
int
startSecond
=
startTime
.
getHour
()
*
3600
+
startTime
.
getMinute
()
*
60
+
startTime
.
getSecond
();
int
stopSecond
=
stopTime
.
getHour
()
*
3600
+
stopTime
.
getMinute
()
*
60
+
stopTime
.
getSecond
();
BigDecimal
bigDecimal
=
BigDecimal
.
valueOf
((
float
)
(
startSecond
-
stopSecond
)
/
3600
).
setScale
(
3
,
BigDecimal
.
ROUND_HALF_UP
);
BigDecimal
bigDecimal1
=
new
BigDecimal
(
1
).
setScale
(
3
,
BigDecimal
.
ROUND_HALF_UP
);
return
bigDecimal
.
compareTo
(
bigDecimal1
)
<=
0
&&
bigDecimal
.
compareTo
(
new
BigDecimal
(
0
))
>=
0
;
}
/**
* 自动任务执行
*/
@Override
...
...
@@ -257,6 +273,23 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
log
.
info
(
strDate
+
" "
+
" 暂无待生成执行数据的计划"
);
return
;
}
//bug 5980 待办任务消息应只触发执行中的任务,漏检的任务和未开始的任务不需要触发待办任务消息.
List
<
Plan
>
planListTwo
=
new
ArrayList
<>();
//将日期格式化
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"HH:mm:ss"
);
LocalTime
nowTime
=
LocalTime
.
parse
(
simpleDateFormat
.
format
(
new
Date
()));
for
(
Plan
plan
:
planList
)
{
LocalTime
dayTime
=
LocalTime
.
parse
(
plan
.
getDayTime
());
// LocalTime plusHoursTime = dayTime.plusHours(1);
if
(
getTimeDifference
(
nowTime
,
dayTime
))
{
planListTwo
.
add
(
plan
);
}
}
if
(
planListTwo
==
null
||
planListTwo
.
size
()
<=
0
)
{
log
.
info
(
strDate
+
" "
+
" 暂无待生成执行数据的计划 (更改后,只执行进行中的数据)"
);
return
;
}
planList
=
planListTwo
;
//2.循环遍历执行
HashMap
<
String
,
Object
>
paramMap
=
new
HashMap
<
String
,
Object
>();
for
(
Plan
plan
:
planList
)
{
...
...
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