Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dinky
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
wangpeng
dinky
Commits
c2a7716e
Unverified
Commit
c2a7716e
authored
Nov 07, 2022
by
ZackYoung
Committed by
GitHub
Nov 07, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
udf添加空模板选择 (#1219)
parent
1828f3e3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
53 deletions
+67
-53
TaskServiceImpl.java
...src/main/java/com/dlink/service/impl/TaskServiceImpl.java
+51
-50
SimpleTaskForm.tsx
...omponents/Studio/StudioTree/components/SimpleTaskForm.tsx
+16
-3
No files found.
dlink-admin/src/main/java/com/dlink/service/impl/TaskServiceImpl.java
View file @
c2a7716e
...
...
@@ -137,6 +137,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.convert.Convert
;
import
cn.hutool.core.lang.tree.Tree
;
import
cn.hutool.core.lang.tree.TreeNode
;
import
cn.hutool.core.lang.tree.TreeUtil
;
...
...
@@ -197,7 +198,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
private
String
buildParas
(
Integer
id
)
{
return
"--id "
+
id
+
" --driver "
+
driver
+
" --url "
+
url
+
" --username "
+
username
+
" --password "
+
password
;
+
password
;
}
@Override
...
...
@@ -206,7 +207,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
Asserts
.
checkNull
(
task
,
Tips
.
TASK_NOT_EXIST
);
if
(
Dialect
.
notFlinkSql
(
task
.
getDialect
()))
{
return
executeCommonSql
(
SqlDTO
.
build
(
task
.
getStatement
(),
task
.
getDatabaseId
(),
null
));
task
.
getDatabaseId
(),
null
));
}
JobConfig
config
=
buildJobConfig
(
task
);
// init UDF
...
...
@@ -227,7 +228,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
task
.
setStep
(
JobLifeCycle
.
ONLINE
.
getValue
());
if
(
Dialect
.
notFlinkSql
(
task
.
getDialect
()))
{
return
executeCommonSql
(
SqlDTO
.
build
(
task
.
getStatement
(),
task
.
getDatabaseId
(),
null
));
task
.
getDatabaseId
(),
null
));
}
JobConfig
config
=
buildJobConfig
(
task
);
JobManager
jobManager
=
JobManager
.
build
(
config
);
...
...
@@ -247,7 +248,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
}
if
(
Dialect
.
notFlinkSql
(
task
.
getDialect
()))
{
return
executeCommonSql
(
SqlDTO
.
build
(
task
.
getStatement
(),
task
.
getDatabaseId
(),
null
));
task
.
getDatabaseId
(),
null
));
}
if
(
StringUtils
.
isBlank
(
savePointPath
))
{
task
.
setSavePointStrategy
(
SavePointStrategy
.
LATEST
.
getValue
());
...
...
@@ -366,19 +367,19 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
@Override
public
boolean
saveOrUpdateTask
(
Task
task
)
{
if
(
Dialect
.
isUDF
(
task
.
getDialect
()))
{
if
(
Dialect
.
isUDF
(
task
.
getDialect
())
&&
Convert
.
toInt
(
task
.
getConfig
().
get
(
0
).
get
(
"templateId"
),
0
)
!=
0
)
{
if
(
CollUtil
.
isNotEmpty
(
task
.
getConfig
())
&&
Asserts
.
isNullString
(
task
.
getStatement
()))
{
Map
<
String
,
String
>
config
=
task
.
getConfig
().
get
(
0
);
UDFTemplate
template
=
udfTemplateService
.
getById
(
config
.
get
(
"templateId"
));
if
(
template
!=
null
)
{
String
code
=
UDFUtil
.
templateParse
(
task
.
getDialect
(),
template
.
getTemplateCode
(),
config
.
get
(
"className"
));
config
.
get
(
"className"
));
task
.
setStatement
(
code
);
}
}
// to compiler udf
if
(
Asserts
.
isNotNullString
(
task
.
getDialect
())
&&
Dialect
.
JAVA
.
equalsVal
(
task
.
getDialect
())
&&
Asserts
.
isNotNullString
(
task
.
getStatement
()))
{
&&
Asserts
.
isNotNullString
(
task
.
getStatement
()))
{
CustomStringJavaCompiler
compiler
=
new
CustomStringJavaCompiler
(
task
.
getStatement
());
task
.
setSavePointPath
(
compiler
.
getFullClassName
());
}
else
if
(
Dialect
.
PYTHON
.
equalsVal
(
task
.
getDialect
()))
{
...
...
@@ -393,8 +394,8 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
Task
taskInfo
=
getById
(
task
.
getId
());
Assert
.
check
(
taskInfo
);
if
(
JobLifeCycle
.
RELEASE
.
equalsValue
(
taskInfo
.
getStep
())
||
JobLifeCycle
.
ONLINE
.
equalsValue
(
taskInfo
.
getStep
())
||
JobLifeCycle
.
CANCEL
.
equalsValue
(
taskInfo
.
getStep
()))
{
||
JobLifeCycle
.
ONLINE
.
equalsValue
(
taskInfo
.
getStep
())
||
JobLifeCycle
.
CANCEL
.
equalsValue
(
taskInfo
.
getStep
()))
{
throw
new
BusException
(
"该作业已"
+
JobLifeCycle
.
get
(
taskInfo
.
getStep
()).
getLabel
()
+
",禁止修改!"
);
}
task
.
setStep
(
JobLifeCycle
.
DEVELOP
.
getValue
());
...
...
@@ -505,8 +506,8 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
@Override
public
Task
getUDFByClassName
(
String
className
)
{
Task
task
=
getOne
(
new
QueryWrapper
<
Task
>().
in
(
"dialect"
,
Dialect
.
JAVA
,
Dialect
.
SCALA
,
Dialect
.
PYTHON
).
eq
(
"enabled"
,
1
)
.
eq
(
"save_point_path"
,
className
));
new
QueryWrapper
<
Task
>().
in
(
"dialect"
,
Dialect
.
JAVA
,
Dialect
.
SCALA
,
Dialect
.
PYTHON
).
eq
(
"enabled"
,
1
)
.
eq
(
"save_point_path"
,
className
));
Assert
.
check
(
task
);
task
.
setStatement
(
statementService
.
getById
(
task
.
getId
()).
getStatement
());
return
task
;
...
...
@@ -515,8 +516,8 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
@Override
public
List
<
Task
>
getAllUDF
()
{
List
<
Task
>
tasks
=
list
(
new
QueryWrapper
<
Task
>().
in
(
"dialect"
,
Dialect
.
JAVA
,
Dialect
.
SCALA
,
Dialect
.
PYTHON
)
.
eq
(
"enabled"
,
1
).
isNotNull
(
"save_point_path"
));
list
(
new
QueryWrapper
<
Task
>().
in
(
"dialect"
,
Dialect
.
JAVA
,
Dialect
.
SCALA
,
Dialect
.
PYTHON
)
.
eq
(
"enabled"
,
1
).
isNotNull
(
"save_point_path"
));
return
tasks
.
stream
().
peek
(
task
->
{
Assert
.
check
(
task
);
task
.
setStatement
(
statementService
.
getById
(
task
.
getId
()).
getStatement
());
...
...
@@ -553,7 +554,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
List
<
TaskVersion
>
taskVersions
=
taskVersionService
.
getTaskVersionByTaskId
(
task
.
getId
());
List
<
Integer
>
versionIds
=
taskVersions
.
stream
().
map
(
TaskVersion:
:
getVersionId
).
collect
(
Collectors
.
toList
());
Map
<
Integer
,
TaskVersion
>
versionMap
=
taskVersions
.
stream
().
collect
(
Collectors
.
toMap
(
TaskVersion:
:
getVersionId
,
t
->
t
));
taskVersions
.
stream
().
collect
(
Collectors
.
toMap
(
TaskVersion:
:
getVersionId
,
t
->
t
));
TaskVersion
taskVersion
=
new
TaskVersion
();
BeanUtil
.
copyProperties
(
task
,
taskVersion
);
...
...
@@ -592,14 +593,14 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
Task
taskInfo
=
getTaskInfoById
(
dto
.
getId
());
if
(
JobLifeCycle
.
RELEASE
.
equalsValue
(
taskInfo
.
getStep
())
||
JobLifeCycle
.
ONLINE
.
equalsValue
(
taskInfo
.
getStep
())
||
JobLifeCycle
.
CANCEL
.
equalsValue
(
taskInfo
.
getStep
()))
{
||
JobLifeCycle
.
ONLINE
.
equalsValue
(
taskInfo
.
getStep
())
||
JobLifeCycle
.
CANCEL
.
equalsValue
(
taskInfo
.
getStep
()))
{
// throw new BusException("该作业已" + JobLifeCycle.get(taskInfo.getStep()).getLabel() + ",禁止回滚!");
return
Result
.
failed
(
"该作业已"
+
JobLifeCycle
.
get
(
taskInfo
.
getStep
()).
getLabel
()
+
",禁止回滚!"
);
}
LambdaQueryWrapper
<
TaskVersion
>
queryWrapper
=
new
LambdaQueryWrapper
<
TaskVersion
>()
.
eq
(
TaskVersion:
:
getTaskId
,
dto
.
getId
()).
eq
(
TaskVersion:
:
getVersionId
,
dto
.
getVersionId
());
.
eq
(
TaskVersion:
:
getTaskId
,
dto
.
getId
()).
eq
(
TaskVersion:
:
getVersionId
,
dto
.
getVersionId
());
TaskVersion
taskVersion
=
taskVersionService
.
getOne
(
queryWrapper
);
...
...
@@ -746,7 +747,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
}
if
(
Asserts
.
isNotNull
(
cluster
.
getClusterConfigurationId
()))
{
Map
<
String
,
Object
>
gatewayConfig
=
clusterConfigurationService
.
getGatewayConfig
(
cluster
.
getClusterConfigurationId
());
clusterConfigurationService
.
getGatewayConfig
(
cluster
.
getClusterConfigurationId
());
jobConfig
.
buildGatewayConfig
(
gatewayConfig
);
jobConfig
.
getGatewayConfig
().
getClusterConfig
().
setAppId
(
cluster
.
getName
());
useGateway
=
true
;
...
...
@@ -782,7 +783,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
private
JobConfig
buildJobConfig
(
Task
task
)
{
boolean
isJarTask
=
Dialect
.
FLINKJAR
.
equalsVal
(
task
.
getDialect
())
||
Dialect
.
KUBERNETES_APPLICATION
.
equalsVal
(
task
.
getDialect
());
||
Dialect
.
KUBERNETES_APPLICATION
.
equalsVal
(
task
.
getDialect
());
if
(!
isJarTask
&&
Asserts
.
isNotNull
(
task
.
getFragment
())
?
task
.
getFragment
()
:
false
)
{
String
flinkWithSql
=
dataBaseService
.
getEnabledFlinkWithSql
();
if
(
Asserts
.
isNotNullString
(
flinkWithSql
))
{
...
...
@@ -802,20 +803,20 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
}
// support custom K8s app submit, rather than clusterConfiguration
else
if
(
Dialect
.
KUBERNETES_APPLICATION
.
equalsVal
(
task
.
getDialect
())
&&
GatewayType
.
KUBERNETES_APPLICATION
.
equalsValue
(
config
.
getType
()))
{
&&
GatewayType
.
KUBERNETES_APPLICATION
.
equalsValue
(
config
.
getType
()))
{
Map
<
String
,
Object
>
gatewayConfig
=
JSONUtil
.
toMap
(
task
.
getStatement
(),
String
.
class
,
Object
.
class
);
config
.
buildGatewayConfig
(
gatewayConfig
);
}
else
{
Map
<
String
,
Object
>
gatewayConfig
=
clusterConfigurationService
.
getGatewayConfig
(
task
.
getClusterConfigurationId
());
clusterConfigurationService
.
getGatewayConfig
(
task
.
getClusterConfigurationId
());
// submit application type with clusterConfiguration
if
(
GatewayType
.
YARN_APPLICATION
.
equalsValue
(
config
.
getType
())
||
GatewayType
.
KUBERNETES_APPLICATION
.
equalsValue
(
config
.
getType
()))
{
||
GatewayType
.
KUBERNETES_APPLICATION
.
equalsValue
(
config
.
getType
()))
{
if
(!
isJarTask
)
{
SystemConfiguration
systemConfiguration
=
SystemConfiguration
.
getInstances
();
gatewayConfig
.
put
(
"userJarPath"
,
systemConfiguration
.
getSqlSubmitJarPath
());
gatewayConfig
.
put
(
"userJarParas"
,
systemConfiguration
.
getSqlSubmitJarParas
()
+
buildParas
(
config
.
getTaskId
()));
systemConfiguration
.
getSqlSubmitJarParas
()
+
buildParas
(
config
.
getTaskId
()));
gatewayConfig
.
put
(
"userJarMainAppClass"
,
systemConfiguration
.
getSqlSubmitJarMainAppClass
());
}
else
{
Jar
jar
=
jarService
.
getById
(
task
.
getJarId
());
...
...
@@ -873,7 +874,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
history
.
setConfig
(
JSONUtil
.
parseObject
(
history
.
getConfigJson
()));
if
(
Asserts
.
isNotNull
(
history
)
&&
Asserts
.
isNotNull
(
history
.
getClusterConfigurationId
()))
{
jobInfoDetail
.
setClusterConfiguration
(
clusterConfigurationService
.
getClusterConfigById
(
history
.
getClusterConfigurationId
()));
clusterConfigurationService
.
getClusterConfigById
(
history
.
getClusterConfigurationId
()));
}
jobInfoDetail
.
setHistory
(
history
);
jobInfoDetail
.
setJobHistory
(
jobHistoryService
.
getJobHistory
(
id
));
...
...
@@ -883,12 +884,12 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
return
jobInfoDetail
.
getInstance
();
}
JobHistory
jobHistoryJson
=
jobHistoryService
.
refreshJobHistory
(
id
,
jobInfoDetail
.
getCluster
().
getJobManagerHost
(),
jobInfoDetail
.
getInstance
().
getJid
(),
jobInfoDetail
.
isNeedSave
());
jobHistoryService
.
refreshJobHistory
(
id
,
jobInfoDetail
.
getCluster
().
getJobManagerHost
(),
jobInfoDetail
.
getInstance
().
getJid
(),
jobInfoDetail
.
isNeedSave
());
JobHistory
jobHistory
=
jobHistoryService
.
getJobHistoryInfo
(
jobHistoryJson
);
jobInfoDetail
.
setJobHistory
(
jobHistory
);
if
(
JobStatus
.
isDone
(
jobInfoDetail
.
getInstance
().
getStatus
())
&&
(
Asserts
.
isNull
(
jobHistory
.
getJob
())
||
jobHistory
.
isError
()))
{
&&
(
Asserts
.
isNull
(
jobHistory
.
getJob
())
||
jobHistory
.
isError
()))
{
return
jobInfoDetail
.
getInstance
();
}
String
status
=
jobInfoDetail
.
getInstance
().
getStatus
();
...
...
@@ -897,12 +898,12 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
jobInfoDetail
.
getInstance
().
setStatus
(
JobStatus
.
UNKNOWN
.
getValue
());
}
else
{
jobInfoDetail
.
getInstance
().
setDuration
(
jobInfoDetail
.
getJobHistory
().
getJob
().
get
(
FlinkRestResultConstant
.
JOB_DURATION
).
asLong
()
/
1000
);
jobInfoDetail
.
getJobHistory
().
getJob
().
get
(
FlinkRestResultConstant
.
JOB_DURATION
).
asLong
()
/
1000
);
jobInfoDetail
.
getInstance
()
.
setStatus
(
jobInfoDetail
.
getJobHistory
().
getJob
().
get
(
FlinkRestResultConstant
.
JOB_STATE
).
asText
());
.
setStatus
(
jobInfoDetail
.
getJobHistory
().
getJob
().
get
(
FlinkRestResultConstant
.
JOB_STATE
).
asText
());
}
if
(
JobStatus
.
isDone
(
jobInfoDetail
.
getInstance
().
getStatus
())
&&
!
status
.
equals
(
jobInfoDetail
.
getInstance
().
getStatus
()))
{
&&
!
status
.
equals
(
jobInfoDetail
.
getInstance
().
getStatus
()))
{
jobStatusChanged
=
true
;
jobInfoDetail
.
getInstance
().
setFinishTime
(
LocalDateTime
.
now
());
// handleJobDone(jobInfoDetail.getInstance());
...
...
@@ -919,7 +920,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
private
boolean
inRefreshPlan
(
JobInstance
jobInstance
)
{
if
((!
JobStatus
.
isDone
(
jobInstance
.
getStatus
()))
||
(
Asserts
.
isNotNull
(
jobInstance
.
getFinishTime
())
&&
Duration
.
between
(
jobInstance
.
getFinishTime
(),
LocalDateTime
.
now
()).
toMinutes
()
<
1
))
{
&&
Duration
.
between
(
jobInstance
.
getFinishTime
(),
LocalDateTime
.
now
()).
toMinutes
()
<
1
))
{
return
true
;
}
else
{
return
false
;
...
...
@@ -966,9 +967,9 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
// clusterConfigurationName
if
(
Asserts
.
isNotNull
(
task
.
getClusterConfigurationId
()))
{
ClusterConfiguration
clusterConfiguration
=
clusterConfigurationService
.
getById
(
task
.
getClusterConfigurationId
());
clusterConfigurationService
.
getById
(
task
.
getClusterConfigurationId
());
((
ObjectNode
)
jsonNode
).
put
(
"clusterConfigurationName"
,
Asserts
.
isNotNull
(
clusterConfiguration
)
?
clusterConfiguration
.
getName
()
:
null
);
Asserts
.
isNotNull
(
clusterConfiguration
)
?
clusterConfiguration
.
getName
()
:
null
);
}
// databaseName
if
(
Asserts
.
isNotNull
(
task
.
getDatabaseId
()))
{
...
...
@@ -1044,15 +1045,15 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
}
if
(
Asserts
.
isNotNull
(
task
.
getClusterConfigurationName
()))
{
ClusterConfiguration
clusterConfiguration
=
clusterConfigurationService
.
getOne
(
new
QueryWrapper
<
ClusterConfiguration
>().
eq
(
"name"
,
task
.
getClusterConfigurationName
()));
.
getOne
(
new
QueryWrapper
<
ClusterConfiguration
>().
eq
(
"name"
,
task
.
getClusterConfigurationName
()));
if
(
Asserts
.
isNotNull
(
clusterConfiguration
))
{
task
.
setClusterConfigurationId
(
clusterConfiguration
.
getId
());
}
}
if
(
Asserts
.
isNotNull
(
task
.
getDatabaseName
()))
{
DataBase
dataBase
=
dataBaseService
.
getOne
(
new
QueryWrapper
<
DataBase
>().
eq
(
"name"
,
task
.
getDatabaseName
()));
dataBaseService
.
getOne
(
new
QueryWrapper
<
DataBase
>().
eq
(
"name"
,
task
.
getDatabaseName
()));
if
(
Asserts
.
isNotNull
(
dataBase
))
{
task
.
setDatabaseId
(
dataBase
.
getId
());
}
...
...
@@ -1069,7 +1070,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
*/
if
(
Asserts
.
isNotNull
(
task
.
getAlertGroupName
()))
{
AlertGroup
alertGroup
=
alertGroupService
.
getOne
(
new
QueryWrapper
<
AlertGroup
>().
eq
(
"name"
,
task
.
getAlertGroupName
()));
alertGroupService
.
getOne
(
new
QueryWrapper
<
AlertGroup
>().
eq
(
"name"
,
task
.
getAlertGroupName
()));
if
(
Asserts
.
isNotNull
(
alertGroup
))
{
task
.
setAlertGroupId
(
alertGroup
.
getId
());
}
...
...
@@ -1105,7 +1106,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
return
Result
.
failed
(
"一共"
+
jsonNodes
.
size
()
+
"个作业,全部导入失败"
);
}
else
if
(
errorNumber
>
0
)
{
return
Result
.
failed
(
"一共"
+
jsonNodes
.
size
()
+
"个作业,其中成功导入"
+
(
jsonNode
.
size
()
-
errorNumber
)
+
"个,失败"
+
errorNumber
+
"个"
);
+
errorNumber
+
"个"
);
}
return
Result
.
succeed
(
"成功导入"
+
jsonNodes
.
size
()
+
"个作业"
);
}
...
...
@@ -1156,7 +1157,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
long
minutes
=
ChronoUnit
.
MINUTES
.
between
(
startTime
,
endTime
);
long
seconds
=
ChronoUnit
.
SECONDS
.
between
(
startTime
,
endTime
);
String
duration
=
days
+
"天 "
+
(
hours
-
(
days
*
24
))
+
"小时 "
+
(
minutes
-
(
hours
*
60
))
+
"分 "
+
(
seconds
-
(
minutes
*
60
))
+
"秒"
;
+
(
seconds
-
(
minutes
*
60
))
+
"秒"
;
return
duration
;
}
...
...
@@ -1236,7 +1237,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
private
void
sendAlert
(
AlertInstance
alertInstance
,
JobInstance
jobInstance
,
Task
task
,
AlertMsg
alertMsg
)
{
AlertConfig
alertConfig
=
AlertConfig
.
build
(
alertInstance
.
getName
(),
alertInstance
.
getType
(),
JSONUtil
.
toMap
(
alertInstance
.
getParams
()));
JSONUtil
.
toMap
(
alertInstance
.
getParams
()));
Alert
alert
=
Alert
.
build
(
alertConfig
);
String
title
=
"任务【"
+
task
.
getAlias
()
+
"】:"
+
jobInstance
.
getStatus
();
String
content
=
alertMsg
.
toString
();
...
...
@@ -1255,10 +1256,10 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
@Override
public
Result
queryAllCatalogue
()
{
final
LambdaQueryWrapper
<
Catalogue
>
queryWrapper
=
new
LambdaQueryWrapper
<
Catalogue
>()
.
select
(
Catalogue:
:
getId
,
Catalogue:
:
getName
,
Catalogue:
:
getParentId
)
.
eq
(
Catalogue:
:
getIsLeaf
,
0
)
.
eq
(
Catalogue:
:
getEnabled
,
1
)
.
isNull
(
Catalogue:
:
getTaskId
);
.
select
(
Catalogue:
:
getId
,
Catalogue:
:
getName
,
Catalogue:
:
getParentId
)
.
eq
(
Catalogue:
:
getIsLeaf
,
0
)
.
eq
(
Catalogue:
:
getEnabled
,
1
)
.
isNull
(
Catalogue:
:
getTaskId
);
final
List
<
Catalogue
>
catalogueList
=
catalogueService
.
list
(
queryWrapper
);
return
Result
.
succeed
(
TreeUtil
.
build
(
dealWithCatalogue
(
catalogueList
),
-
1
).
get
(
0
));
}
...
...
@@ -1284,7 +1285,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
public
Result
<
List
<
Task
>>
queryOnLineTaskByDoneStatus
(
List
<
JobLifeCycle
>
jobLifeCycle
,
List
<
JobStatus
>
jobStatuses
,
boolean
includeNull
,
Integer
catalogueId
)
{
final
Tree
<
Integer
>
node
=
((
Tree
<
Integer
>)
queryAllCatalogue
().
getDatas
())
.
getNode
(
Objects
.
isNull
(
catalogueId
)
?
0
:
catalogueId
);
.
getNode
(
Objects
.
isNull
(
catalogueId
)
?
0
:
catalogueId
);
final
List
<
Integer
>
parentIds
=
new
ArrayList
<>(
0
);
parentIds
.
add
(
node
.
getId
());
childrenNodeParse
(
node
,
parentIds
);
...
...
@@ -1295,8 +1296,8 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
private
List
<
Task
>
getTasks
(
List
<
JobLifeCycle
>
jobLifeCycle
,
List
<
JobStatus
>
jobStatuses
,
boolean
includeNull
,
List
<
Integer
>
parentIds
)
{
return
this
.
baseMapper
.
queryOnLineTaskByDoneStatus
(
parentIds
,
jobLifeCycle
.
stream
().
filter
(
Objects:
:
nonNull
).
map
(
JobLifeCycle:
:
getValue
).
collect
(
Collectors
.
toList
()),
includeNull
,
jobStatuses
.
stream
().
map
(
JobStatus:
:
name
).
collect
(
Collectors
.
toList
()));
jobLifeCycle
.
stream
().
filter
(
Objects:
:
nonNull
).
map
(
JobLifeCycle:
:
getValue
).
collect
(
Collectors
.
toList
()),
includeNull
,
jobStatuses
.
stream
().
map
(
JobStatus:
:
name
).
collect
(
Collectors
.
toList
()));
}
private
void
childrenNodeParse
(
Tree
<
Integer
>
node
,
List
<
Integer
>
parentIds
)
{
...
...
@@ -1316,7 +1317,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
@Override
public
void
selectSavepointOnLineTask
(
TaskOperatingResult
taskOperatingResult
)
{
final
JobInstance
jobInstanceByTaskId
=
jobInstanceService
.
getJobInstanceByTaskId
(
taskOperatingResult
.
getTask
().
getId
());
jobInstanceService
.
getJobInstanceByTaskId
(
taskOperatingResult
.
getTask
().
getId
());
if
(
jobInstanceByTaskId
==
null
)
{
startGoingLiveTask
(
taskOperatingResult
,
null
);
return
;
...
...
@@ -1335,8 +1336,8 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
private
void
findTheConditionSavePointToOnline
(
TaskOperatingResult
taskOperatingResult
,
JobInstance
jobInstanceByTaskId
)
{
final
LambdaQueryWrapper
<
JobHistory
>
queryWrapper
=
new
LambdaQueryWrapper
<
JobHistory
>()
.
select
(
JobHistory:
:
getId
,
JobHistory:
:
getCheckpointsJson
)
.
eq
(
JobHistory:
:
getId
,
jobInstanceByTaskId
.
getId
());
.
select
(
JobHistory:
:
getId
,
JobHistory:
:
getCheckpointsJson
)
.
eq
(
JobHistory:
:
getId
,
jobInstanceByTaskId
.
getId
());
final
JobHistory
jobHistory
=
jobHistoryService
.
getOne
(
queryWrapper
);
if
(
jobHistory
!=
null
&&
StringUtils
.
isNotBlank
(
jobHistory
.
getCheckpointsJson
()))
{
final
ObjectNode
jsonNodes
=
JSONUtil
.
parseObject
(
jobHistory
.
getCheckpointsJson
());
...
...
dlink-web/src/components/Studio/StudioTree/components/SimpleTaskForm.tsx
View file @
c2a7716e
...
...
@@ -61,6 +61,7 @@ const SimpleTaskForm: React.FC<UpdateFormProps> = (props) => {
});
const
[
dialect
,
setDialect
]
=
useState
<
string
>
(
''
)
const
[
isShowUDFClassName
,
setShowUDFClassName
]
=
useState
<
boolean
>
(
true
)
const
[
templateTree
,
setTemplateTree
]
=
useState
<
Object
[]
>
([])
const
[
templateData
,
setTemplateData
]
=
useState
<
Object
[]
>
([])
const
[
form
]
=
Form
.
useForm
();
...
...
@@ -96,12 +97,23 @@ const SimpleTaskForm: React.FC<UpdateFormProps> = (props) => {
setFormVals
(
data
);
handleUpdate
(
data
);
};
const
handlerChangeUdf
=
(
value
:
any
[])
=>
{
if
(
value
[
1
]
==
0
)
{
setShowUDFClassName
(
false
)
}
else
{
setShowUDFClassName
(
true
)
}
}
const
handlerSetDialect
=
(
value
:
string
)
=>
{
setDialect
(
value
)
if
(
isUDF
(
value
))
{
templateTree
.
map
(
x
=>
{
if
(
x
.
label
==
value
)
{
setTemplateData
(
x
.
children
)
const
data
=
x
.
children
data
.
splice
(
data
.
length
,
0
,
{
label
:
"Empty"
,
value
:
"Empty"
,
children
:
[{
label
:
"Empty"
,
value
:
0
}]})
setTemplateData
(
data
)
setShowUDFClassName
(
true
)
form
.
setFieldsValue
({
"config.templateId"
:
[
x
.
children
[
0
].
label
,
x
.
children
[
0
].
children
[
0
].
label
,
x
.
children
[
0
].
children
[
0
].
value
]})
}
})
...
...
@@ -156,12 +168,13 @@ const SimpleTaskForm: React.FC<UpdateFormProps> = (props) => {
{
<
Cascader
displayRender=
{
(
label
:
string
[])
=>
label
.
slice
(
0
,
2
).
join
(
" / "
)
}
options=
{
templateData
}
onChange=
{
handlerChangeUdf
}
/>
}
</
Form
.
Item
>
<
Form
.
Item
hidden=
{
!
isShowUDFClassName
}
name=
"config.className"
label=
"类名或方法名"
rules=
{
[{
required
:
true
,
message
:
'请输入类名或方法名!'
}]
}
>
label=
"类名或方法名"
>
<
Input
placeholder=
"请输入"
/>
</
Form
.
Item
>
</>)
:
undefined
}
...
...
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