Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
middleware-automatic
Overview
Overview
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
shenjunjie
middleware-automatic
Commits
e61f13b9
Commit
e61f13b9
authored
Apr 27, 2023
by
liuyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2023年04月27 模板重置失败任务
parent
4e6076fd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
2 deletions
+25
-2
middleware-automatic-center-client/src/main/java/com/zhiwei/middleware/automatic/server/pojo/enums/TaskType.java
+2
-1
middleware-automatic-center-server/src/main/java/com/zhiwei/middleware/automatic/server/mission/ScheduledMission.java
+22
-1
middleware-automatic-center-son/src/main/java/com/zhiwei/middleware/automatic/son/task/service/TaskServiceTemplate.java
+1
-0
No files found.
middleware-automatic-center-client/src/main/java/com/zhiwei/middleware/automatic/server/pojo/enums/TaskType.java
View file @
e61f13b9
...
@@ -6,7 +6,8 @@ public enum TaskType {
...
@@ -6,7 +6,8 @@ public enum TaskType {
TEMPLATE
(
"template"
,
null
),
TEMPLATE
(
"template"
,
null
),
TEMPLATE_MODIFY
(
"template_modify"
,
null
),
TEMPLATE_MODIFY
(
"template_modify"
,
null
),
TEMPLATE_RESET
(
"template_reset"
,
null
),
TEMPLATE_RESET
(
"template_reset"
,
null
),
TEMPLATE_RECORD
(
"template_record"
,
null
);
TEMPLATE_RECORD
(
"template_record"
,
null
),
TEMPLATE_CLEAR_RETRY
(
"template_clear_retry"
,
null
);
final
String
type
;
final
String
type
;
...
...
middleware-automatic-center-server/src/main/java/com/zhiwei/middleware/automatic/server/mission/ScheduledMission.java
View file @
e61f13b9
...
@@ -3,8 +3,11 @@ package com.zhiwei.middleware.automatic.server.mission;
...
@@ -3,8 +3,11 @@ package com.zhiwei.middleware.automatic.server.mission;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.middleware.automatic.server.common.GenericAttribute
;
import
com.zhiwei.middleware.automatic.server.common.GenericAttribute
;
import
com.zhiwei.middleware.automatic.server.pojo.AutoTask
;
import
com.zhiwei.middleware.automatic.server.pojo.AutoTask
;
import
com.zhiwei.middleware.automatic.server.pojo.TemplateTitleVo
;
import
com.zhiwei.middleware.automatic.server.pojo.enums.TaskType
;
import
com.zhiwei.middleware.automatic.server.pojo.enums.TaskType
;
import
com.zhiwei.middleware.automatic.server.pojo.enums.TemplateStatus
;
import
com.zhiwei.middleware.automatic.server.redis.RedissonUtil
;
import
com.zhiwei.middleware.automatic.server.redis.RedissonUtil
;
import
com.zhiwei.middleware.automatic.server.service.TemplateTitleService
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.Async
;
...
@@ -13,6 +16,7 @@ import org.springframework.scheduling.annotation.Scheduled;
...
@@ -13,6 +16,7 @@ import org.springframework.scheduling.annotation.Scheduled;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.util.Calendar
;
import
java.util.Calendar
;
import
java.util.Map
;
@Component
@Component
@EnableScheduling
@EnableScheduling
...
@@ -26,9 +30,13 @@ public class ScheduledMission {
...
@@ -26,9 +30,13 @@ public class ScheduledMission {
private
final
AsyncTask
asyncTask
;
private
final
AsyncTask
asyncTask
;
public
ScheduledMission
(
RedissonUtil
redissonUtil
,
AsyncTask
asyncTask
)
{
private
final
TemplateTitleService
templateTitleService
;
public
ScheduledMission
(
RedissonUtil
redissonUtil
,
AsyncTask
asyncTask
,
TemplateTitleService
templateTitleService
)
{
this
.
redissonUtil
=
redissonUtil
;
this
.
redissonUtil
=
redissonUtil
;
this
.
asyncTask
=
asyncTask
;
this
.
asyncTask
=
asyncTask
;
this
.
templateTitleService
=
templateTitleService
;
}
}
...
@@ -60,6 +68,7 @@ public class ScheduledMission {
...
@@ -60,6 +68,7 @@ public class ScheduledMission {
long
startTime
=
calendar
.
getTime
().
getTime
();
long
startTime
=
calendar
.
getTime
().
getTime
();
long
endTime
=
System
.
currentTimeMillis
();
long
endTime
=
System
.
currentTimeMillis
();
for
(
String
project
:
asyncTask
.
findAllGroup
())
{
for
(
String
project
:
asyncTask
.
findAllGroup
())
{
//模板聚合任务
putTask
(
project
,
startTime
,
endTime
);
putTask
(
project
,
startTime
,
endTime
);
}
}
...
@@ -84,4 +93,16 @@ public class ScheduledMission {
...
@@ -84,4 +93,16 @@ public class ScheduledMission {
redissonUtil
.
putQueue
(
GenericAttribute
.
KEY
,
JSONObject
.
toJSONString
(
autoTask
));
redissonUtil
.
putQueue
(
GenericAttribute
.
KEY
,
JSONObject
.
toJSONString
(
autoTask
));
}
}
private
void
putTaskBy
(
String
group
)
{
Map
<
String
,
TemplateTitleVo
>
project
=
templateTitleService
.
getTemplateTitleByProject
(
group
);
for
(
Map
.
Entry
<
String
,
TemplateTitleVo
>
entry
:
project
.
entrySet
())
{
if
(
entry
.
getValue
().
getStatus
()
==
TemplateStatus
.
重置失败
)
{
AutoTask
autoTask
=
new
AutoTask
(
TaskType
.
TEMPLATE_CLEAR_RETRY
.
getType
());
autoTask
.
getParamSource
().
put
(
GenericAttribute
.
GROUP_PARAM
,
group
);
autoTask
.
getParamSource
().
put
(
GenericAttribute
.
TEMPLATE_TITLE
,
entry
.
getKey
());
redissonUtil
.
putQueue
(
GenericAttribute
.
KEY
,
JSONObject
.
toJSONString
(
autoTask
));
}
}
}
}
}
middleware-automatic-center-son/src/main/java/com/zhiwei/middleware/automatic/son/task/service/TaskServiceTemplate.java
View file @
e61f13b9
...
@@ -67,6 +67,7 @@ public class TaskServiceTemplate implements TaskService {
...
@@ -67,6 +67,7 @@ public class TaskServiceTemplate implements TaskService {
TYPE_MAP
.
put
(
TaskType
.
TEMPLATE
.
getType
(),
Pair
.
of
(
TaskType
.
TEMPLATE
,
this
::
runTask
));
TYPE_MAP
.
put
(
TaskType
.
TEMPLATE
.
getType
(),
Pair
.
of
(
TaskType
.
TEMPLATE
,
this
::
runTask
));
TYPE_MAP
.
put
(
TaskType
.
TEMPLATE_MODIFY
.
getType
(),
Pair
.
of
(
TaskType
.
TEMPLATE_MODIFY
,
this
::
templateModify
));
TYPE_MAP
.
put
(
TaskType
.
TEMPLATE_MODIFY
.
getType
(),
Pair
.
of
(
TaskType
.
TEMPLATE_MODIFY
,
this
::
templateModify
));
TYPE_MAP
.
put
(
TaskType
.
TEMPLATE_RESET
.
getType
(),
Pair
.
of
(
TaskType
.
TEMPLATE_RESET
,
this
::
templateReset
));
TYPE_MAP
.
put
(
TaskType
.
TEMPLATE_RESET
.
getType
(),
Pair
.
of
(
TaskType
.
TEMPLATE_RESET
,
this
::
templateReset
));
TYPE_MAP
.
put
(
TaskType
.
TEMPLATE_CLEAR_RETRY
.
getType
(),
Pair
.
of
(
TaskType
.
TEMPLATE_CLEAR_RETRY
,
this
::
templateReset
));
TYPE_MAP
.
put
(
TaskType
.
TEMPLATE_RECORD
.
getType
(),
Pair
.
of
(
TaskType
.
TEMPLATE_RECORD
,
this
::
templateRecordClean
));
TYPE_MAP
.
put
(
TaskType
.
TEMPLATE_RECORD
.
getType
(),
Pair
.
of
(
TaskType
.
TEMPLATE_RECORD
,
this
::
templateRecordClean
));
}
}
...
...
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