Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jz-dmp-cmdexectool
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
姚本章
jz-dmp-cmdexectool
Commits
03a1c4e4
Commit
03a1c4e4
authored
Feb 24, 2021
by
sml
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码提交
parent
8e1c0ef7
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
126 additions
and
153 deletions
+126
-153
DmpSyncingDatasource.java
...a/com/jz/dmp/cmdexectool/entity/DmpSyncingDatasource.java
+15
-0
ShellParameters.java
...exectool/scheduler/common/task/shell/ShellParameters.java
+1
-40
SqlParameters.java
.../cmdexectool/scheduler/common/task/sql/SqlParameters.java
+8
-36
EnumUtils.java
.../jz/dmp/cmdexectool/scheduler/common/utils/EnumUtils.java
+2
-0
TaskExecutionContext.java
...xectool/scheduler/server/entity/TaskExecutionContext.java
+40
-1
AbstractTask.java
...mdexectool/scheduler/server/worker/task/AbstractTask.java
+0
-4
SqlTask.java
...cmdexectool/scheduler/server/worker/task/sql/SqlTask.java
+2
-1
ProcessService.java
...cmdexectool/scheduler/service/process/ProcessService.java
+5
-28
DmpDevelopTaskMapper.xml
src/main/resources/mapperconf/DmpDevelopTaskMapper.xml
+45
-42
DmpProjectConfigInfoMapper.xml
src/main/resources/mapperconf/DmpProjectConfigInfoMapper.xml
+1
-1
DmpSyncingDatasourceMapper.xml
src/main/resources/mapperconf/DmpSyncingDatasourceMapper.xml
+7
-0
No files found.
src/main/java/com/jz/dmp/cmdexectool/entity/DmpSyncingDatasource.java
View file @
03a1c4e4
...
@@ -195,6 +195,12 @@ public class DmpSyncingDatasource implements Serializable {
...
@@ -195,6 +195,12 @@ public class DmpSyncingDatasource implements Serializable {
*/
*/
@ApiModelProperty
(
value
=
"impalaMasterFqdn"
)
@ApiModelProperty
(
value
=
"impalaMasterFqdn"
)
private
String
impalaMasterFqdn
;
private
String
impalaMasterFqdn
;
/**
* driver(驱动)
*/
@ApiModelProperty
(
value
=
"driver驱动"
)
private
String
driverClassName
;
public
Integer
getId
()
{
public
Integer
getId
()
{
return
id
;
return
id
;
...
@@ -491,4 +497,13 @@ public class DmpSyncingDatasource implements Serializable {
...
@@ -491,4 +497,13 @@ public class DmpSyncingDatasource implements Serializable {
public
void
setImpalaMasterFqdn
(
String
impalaMasterFqdn
)
{
public
void
setImpalaMasterFqdn
(
String
impalaMasterFqdn
)
{
this
.
impalaMasterFqdn
=
impalaMasterFqdn
;
this
.
impalaMasterFqdn
=
impalaMasterFqdn
;
}
}
public
String
getDriverClassName
()
{
return
driverClassName
;
}
public
void
setDriverClassName
(
String
driverClassName
)
{
this
.
driverClassName
=
driverClassName
;
}
}
}
\ No newline at end of file
src/main/java/com/jz/dmp/cmdexectool/scheduler/common/task/shell/ShellParameters.java
View file @
03a1c4e4
...
@@ -18,11 +18,9 @@ package com.jz.dmp.cmdexectool.scheduler.common.task.shell;
...
@@ -18,11 +18,9 @@ package com.jz.dmp.cmdexectool.scheduler.common.task.shell;
import
java.util.List
;
import
java.util.List
;
import
com.jz.dmp.cmdexectool.common.constant.CommConstant
;
import
com.jz.dmp.cmdexectool.controller.bean.DmpProjectConfigInfoDto
;
import
com.jz.dmp.cmdexectool.controller.bean.DmpDevelopTaskDto
;
import
com.jz.dmp.cmdexectool.scheduler.common.process.ResourceInfo
;
import
com.jz.dmp.cmdexectool.scheduler.common.process.ResourceInfo
;
import
com.jz.dmp.cmdexectool.scheduler.common.task.AbstractParameters
;
import
com.jz.dmp.cmdexectool.scheduler.common.task.AbstractParameters
;
import
com.jz.dmp.cmdexectool.scheduler.server.entity.TaskExecutionContext
;
/**
/**
* shell parameters
* shell parameters
...
@@ -74,41 +72,4 @@ public class ShellParameters extends AbstractParameters {
...
@@ -74,41 +72,4 @@ public class ShellParameters extends AbstractParameters {
return
resourceList
;
return
resourceList
;
}
}
/**
* @Title: getTaskExecutionContext
* @Description: TODO(获取TaskExecutionContext)
* @param @param dmpDevelopTaskDto
* @param @return 参数
* @return TaskExecutionContext 返回类型
* @throws
*/
public
TaskExecutionContext
getTaskExecutionContext
()
{
TaskExecutionContext
taskExecutionContext
=
new
TaskExecutionContext
();
// taskName;
// taskType;
taskExecutionContext
.
setTaskType
(
CommConstant
.
WORK_TYPE_SHELL
);
// host;
// executePath;
//taskExecutionContext.setExecutePath("E:/test");
// logPath;
// taskJson;
// globalParams;
// projectId;
// taskParams;
taskExecutionContext
.
setTaskParams
(
script
);
// envFile;
// taskAppId
taskExecutionContext
.
setTaskAppId
(
taskAppId
);
return
taskExecutionContext
;
}
}
}
src/main/java/com/jz/dmp/cmdexectool/scheduler/common/task/sql/SqlParameters.java
View file @
03a1c4e4
...
@@ -37,6 +37,7 @@ import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;
...
@@ -37,6 +37,7 @@ import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;
* Sql/Hql parameter
* Sql/Hql parameter
*/
*/
public
class
SqlParameters
extends
AbstractParameters
{
public
class
SqlParameters
extends
AbstractParameters
{
/**
/**
* shell script
* shell script
*/
*/
...
@@ -75,6 +76,11 @@ public class SqlParameters extends AbstractParameters {
...
@@ -75,6 +76,11 @@ public class SqlParameters extends AbstractParameters {
private
List
<
ResourceInfo
>
resourceList
;
private
List
<
ResourceInfo
>
resourceList
;
public
SqlParameters
(
String
script
,
DmpProjectConfigInfoDto
projectConfigInfoDto
,
DmpSyncingDatasourceDao
dmpSyncingDatasourceDao
,
FreeMarkerConfigurer
freeMarkerConfig
)
{
public
SqlParameters
(
String
script
,
DmpProjectConfigInfoDto
projectConfigInfoDto
,
DmpSyncingDatasourceDao
dmpSyncingDatasourceDao
,
FreeMarkerConfigurer
freeMarkerConfig
)
{
source
=
""
;
env
=
""
;
sink
=
""
;
transform
=
""
;
this
.
script
=
script
;
this
.
script
=
script
;
JSONObject
scriptObj
=
JSONObject
.
parseObject
(
script
);
JSONObject
scriptObj
=
JSONObject
.
parseObject
(
script
);
...
@@ -94,7 +100,7 @@ public class SqlParameters extends AbstractParameters {
...
@@ -94,7 +100,7 @@ public class SqlParameters extends AbstractParameters {
String
[]
tableNameArr
=
sourceTableNames
.
split
(
","
);
String
[]
tableNameArr
=
sourceTableNames
.
split
(
","
);
for
(
String
tableName
:
tableNameArr
)
{
for
(
String
tableName
:
tableNameArr
)
{
Map
<
String
,
String
>
jdbcModel
=
new
HashMap
<
String
,
String
>();
Map
<
String
,
String
>
jdbcModel
=
new
HashMap
<
String
,
String
>();
jdbcModel
.
put
(
"driver"
,
"com.mysql.jdbc.Driver"
);
jdbcModel
.
put
(
"driver"
,
dmpSyncingDatasource
.
getDriverClassName
()
);
jdbcModel
.
put
(
"url"
,
dmpSyncingDatasource
.
getJdbcUrl
());
jdbcModel
.
put
(
"url"
,
dmpSyncingDatasource
.
getJdbcUrl
());
jdbcModel
.
put
(
"table"
,
tableName
);
jdbcModel
.
put
(
"table"
,
tableName
);
jdbcModel
.
put
(
"result_table_name"
,
tableName
);
jdbcModel
.
put
(
"result_table_name"
,
tableName
);
...
@@ -149,7 +155,7 @@ public class SqlParameters extends AbstractParameters {
...
@@ -149,7 +155,7 @@ public class SqlParameters extends AbstractParameters {
sinkJdbcModel
.
put
(
"save_mode"
,
"overwrite"
);
sinkJdbcModel
.
put
(
"save_mode"
,
"overwrite"
);
sinkJdbcModel
.
put
(
"truncate"
,
"true"
);
sinkJdbcModel
.
put
(
"truncate"
,
"true"
);
sinkJdbcModel
.
put
(
"url"
,
targetSource
.
getJdbcUrl
());
sinkJdbcModel
.
put
(
"url"
,
targetSource
.
getJdbcUrl
());
sinkJdbcModel
.
put
(
"driver"
,
"com.mysql.jdbc.Driver"
);
sinkJdbcModel
.
put
(
"driver"
,
targetSource
.
getDriverClassName
()
);
sinkJdbcModel
.
put
(
"user"
,
targetSource
.
getUserName
());
sinkJdbcModel
.
put
(
"user"
,
targetSource
.
getUserName
());
sinkJdbcModel
.
put
(
"password"
,
targetSource
.
getPassword
());
sinkJdbcModel
.
put
(
"password"
,
targetSource
.
getPassword
());
sinkJdbcModel
.
put
(
"dbtable"
,
targetSource
.
getDbName
());
sinkJdbcModel
.
put
(
"dbtable"
,
targetSource
.
getDbName
());
...
@@ -255,38 +261,4 @@ public class SqlParameters extends AbstractParameters {
...
@@ -255,38 +261,4 @@ public class SqlParameters extends AbstractParameters {
return
resourceList
;
return
resourceList
;
}
}
/**
* @Title: getTaskExecutionContext @Description:
* TODO(获取TaskExecutionContext) @param @param dmpDevelopTaskDto @param @return
* 参数 @return TaskExecutionContext 返回类型 @throws
*/
public
TaskExecutionContext
getTaskExecutionContext
()
{
TaskExecutionContext
taskExecutionContext
=
new
TaskExecutionContext
();
// taskName;
// taskType;
taskExecutionContext
.
setTaskType
(
CommConstant
.
WORK_TYPE_SQL
);
// host;
// executePath;
// taskExecutionContext.setExecutePath("E:/test");
// logPath;
// taskJson;
// globalParams;
// projectId;
// taskParams;
taskExecutionContext
.
setTaskParams
(
JSONObject
.
toJSONString
(
this
));
// envFile;
// taskAppId
taskExecutionContext
.
setTaskAppId
(
taskAppId
);
return
taskExecutionContext
;
}
}
}
src/main/java/com/jz/dmp/cmdexectool/scheduler/common/utils/EnumUtils.java
View file @
03a1c4e4
...
@@ -60,6 +60,8 @@ public class EnumUtils {
...
@@ -60,6 +60,8 @@ public class EnumUtils {
public
static
TaskType
getTaskType
(
String
taskType
)
{
public
static
TaskType
getTaskType
(
String
taskType
)
{
if
(
taskType
.
equals
(
CommConstant
.
WORK_TYPE_SHELL
))
{
if
(
taskType
.
equals
(
CommConstant
.
WORK_TYPE_SHELL
))
{
return
TaskType
.
SHELL
;
return
TaskType
.
SHELL
;
}
else
if
(
taskType
.
equals
(
CommConstant
.
WORK_TYPE_SQL
))
{
return
TaskType
.
SQL
;
}
}
return
null
;
return
null
;
}
}
...
...
src/main/java/com/jz/dmp/cmdexectool/scheduler/server/entity/TaskExecutionContext.java
View file @
03a1c4e4
...
@@ -17,7 +17,12 @@
...
@@ -17,7 +17,12 @@
package
com
.
jz
.
dmp
.
cmdexectool
.
scheduler
.
server
.
entity
;
package
com
.
jz
.
dmp
.
cmdexectool
.
scheduler
.
server
.
entity
;
import
com.jz.dmp.cmdexectool.common.constant.CommConstant
;
import
com.jz.dmp.cmdexectool.controller.bean.DmpProjectConfigInfoDto
;
import
com.jz.dmp.cmdexectool.scheduler.common.enums.ExecutionStatus
;
import
com.jz.dmp.cmdexectool.scheduler.common.enums.ExecutionStatus
;
import
com.jz.dmp.cmdexectool.scheduler.common.task.AbstractParameters
;
import
com.jz.dmp.cmdexectool.scheduler.common.task.shell.ShellParameters
;
import
com.jz.dmp.cmdexectool.scheduler.common.task.sql.SqlParameters
;
import
com.jz.dmp.cmdexectool.scheduler.remote.command.Command
;
import
com.jz.dmp.cmdexectool.scheduler.remote.command.Command
;
import
com.jz.dmp.cmdexectool.scheduler.remote.command.TaskExecuteRequestCommand
;
import
com.jz.dmp.cmdexectool.scheduler.remote.command.TaskExecuteRequestCommand
;
import
com.jz.dmp.cmdexectool.scheduler.remote.utils.JsonSerializer
;
import
com.jz.dmp.cmdexectool.scheduler.remote.utils.JsonSerializer
;
...
@@ -26,6 +31,7 @@ import java.io.Serializable;
...
@@ -26,6 +31,7 @@ import java.io.Serializable;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.Map
;
import
java.util.Map
;
import
com.alibaba.fastjson.JSONObject
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
/**
/**
...
@@ -216,6 +222,31 @@ public class TaskExecutionContext implements Serializable {
...
@@ -216,6 +222,31 @@ public class TaskExecutionContext implements Serializable {
* procedure TaskExecutionContext
* procedure TaskExecutionContext
*/
*/
private
ProcedureTaskExecutionContext
procedureTaskExecutionContext
;
private
ProcedureTaskExecutionContext
procedureTaskExecutionContext
;
private
AbstractParameters
parameters
;
public
TaskExecutionContext
()
{}
/**
* @param shellParameters
* @param configInfoDto
*/
public
TaskExecutionContext
(
ShellParameters
shellParameters
,
DmpProjectConfigInfoDto
configInfoDto
)
{
this
.
setTaskType
(
CommConstant
.
WORK_TYPE_SHELL
);
this
.
setExecutePath
(
configInfoDto
.
getDmpPublicConfigInfoDto
().
getAzkabanExectorShellPath
());
this
.
setTaskParams
(
JSONObject
.
toJSONString
(
shellParameters
));
this
.
setTaskAppId
(
shellParameters
.
getTaskAppId
());
this
.
setParameters
(
shellParameters
);
}
public
TaskExecutionContext
(
SqlParameters
sqlParameters
,
DmpProjectConfigInfoDto
configInfoDto
)
{
this
.
setTaskType
(
CommConstant
.
WORK_TYPE_SQL
);
this
.
setExecutePath
(
configInfoDto
.
getDmpPublicConfigInfoDto
().
getAzkabanExectorShellPath
());
this
.
setTaskParams
(
JSONObject
.
toJSONString
(
sqlParameters
));
this
.
setTaskAppId
(
sqlParameters
.
getTaskAppId
());
this
.
setParameters
(
sqlParameters
);
}
public
int
getTaskInstanceId
()
{
public
int
getTaskInstanceId
()
{
return
taskInstanceId
;
return
taskInstanceId
;
...
@@ -503,7 +534,15 @@ public class TaskExecutionContext implements Serializable {
...
@@ -503,7 +534,15 @@ public class TaskExecutionContext implements Serializable {
this
.
sqoopTaskExecutionContext
=
sqoopTaskExecutionContext
;
this
.
sqoopTaskExecutionContext
=
sqoopTaskExecutionContext
;
}
}
@Override
public
AbstractParameters
getParameters
()
{
return
parameters
;
}
public
void
setParameters
(
AbstractParameters
parameters
)
{
this
.
parameters
=
parameters
;
}
@Override
public
String
toString
()
{
public
String
toString
()
{
return
"TaskExecutionContext{"
return
"TaskExecutionContext{"
+
"taskInstanceId="
+
taskInstanceId
+
"taskInstanceId="
+
taskInstanceId
...
...
src/main/java/com/jz/dmp/cmdexectool/scheduler/server/worker/task/AbstractTask.java
View file @
03a1c4e4
...
@@ -23,7 +23,6 @@ import com.jz.dmp.cmdexectool.scheduler.common.task.AbstractParameters;
...
@@ -23,7 +23,6 @@ import com.jz.dmp.cmdexectool.scheduler.common.task.AbstractParameters;
import
com.jz.dmp.cmdexectool.scheduler.common.task.conditions.ConditionsParameters
;
import
com.jz.dmp.cmdexectool.scheduler.common.task.conditions.ConditionsParameters
;
import
com.jz.dmp.cmdexectool.scheduler.common.task.datax.DataxParameters
;
import
com.jz.dmp.cmdexectool.scheduler.common.task.datax.DataxParameters
;
import
com.jz.dmp.cmdexectool.scheduler.common.task.flink.FlinkParameters
;
import
com.jz.dmp.cmdexectool.scheduler.common.task.flink.FlinkParameters
;
import
com.jz.dmp.cmdexectool.scheduler.common.task.mr.MapreduceParameters
;
import
com.jz.dmp.cmdexectool.scheduler.common.task.procedure.ProcedureParameters
;
import
com.jz.dmp.cmdexectool.scheduler.common.task.procedure.ProcedureParameters
;
import
com.jz.dmp.cmdexectool.scheduler.common.task.python.PythonParameters
;
import
com.jz.dmp.cmdexectool.scheduler.common.task.python.PythonParameters
;
import
com.jz.dmp.cmdexectool.scheduler.common.task.shell.ShellParameters
;
import
com.jz.dmp.cmdexectool.scheduler.common.task.shell.ShellParameters
;
...
@@ -227,9 +226,6 @@ public abstract class AbstractTask {
...
@@ -227,9 +226,6 @@ public abstract class AbstractTask {
case
PROCEDURE:
case
PROCEDURE:
paramsClass
=
ProcedureParameters
.
class
;
paramsClass
=
ProcedureParameters
.
class
;
break
;
break
;
case
MR:
paramsClass
=
MapreduceParameters
.
class
;
break
;
case
SPARK:
case
SPARK:
paramsClass
=
SparkParameters
.
class
;
paramsClass
=
SparkParameters
.
class
;
break
;
break
;
...
...
src/main/java/com/jz/dmp/cmdexectool/scheduler/server/worker/task/sql/SqlTask.java
View file @
03a1c4e4
...
@@ -72,7 +72,8 @@ public class SqlTask extends AbstractTask {
...
@@ -72,7 +72,8 @@ public class SqlTask extends AbstractTask {
public
void
init
()
{
public
void
init
()
{
logger
.
info
(
"sql task params {}"
,
taskExecutionContext
.
getTaskParams
());
logger
.
info
(
"sql task params {}"
,
taskExecutionContext
.
getTaskParams
());
sqlParameters
=
JSONUtils
.
parseObject
(
taskExecutionContext
.
getTaskParams
(),
SqlParameters
.
class
);
//sqlParameters = JSONUtils.parseObject(taskExecutionContext.getTaskParams(), SqlParameters.class);
sqlParameters
=
(
SqlParameters
)
taskExecutionContext
.
getParameters
();
if
(!
sqlParameters
.
checkParameters
())
{
if
(!
sqlParameters
.
checkParameters
())
{
throw
new
RuntimeException
(
"sql task params is not valid"
);
throw
new
RuntimeException
(
"sql task params is not valid"
);
...
...
src/main/java/com/jz/dmp/cmdexectool/scheduler/service/process/ProcessService.java
View file @
03a1c4e4
...
@@ -23,7 +23,6 @@ import java.util.Map;
...
@@ -23,7 +23,6 @@ import java.util.Map;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.aop.ThrowsAdvice
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
...
@@ -105,31 +104,6 @@ public class ProcessService {
...
@@ -105,31 +104,6 @@ public class ProcessService {
}
}
}
}
/**
* @Title: findTaskInstanceById @Description:
* TODO(根据taskId,jobId等信息将job转成taskInstance) @param @param
* taskId @param @param jobId @param @param isSingle @param @return
* 参数 @return TaskInstance 返回类型 @throws
*/
public
TaskInstance
findTaskInstanceById
(
Integer
taskId
,
String
jobId
,
boolean
isSingle
)
throws
Exception
{
TaskInstance
taskInstance
=
new
TaskInstance
();
// 获取任务数据,并获取job json,并组装TaskInstance
DmpDevelopTaskDto
dmpDevelopTaskDto
=
dmpDevelopTaskMapper
.
findById
(
taskId
);
if
(
isSingle
)
{
taskInstance
=
MyDmpDevelopTaskConverter
.
INSTANCE
().
dto2instance
(
dmpDevelopTaskDto
,
jobId
);
}
else
{
Map
<
String
,
Object
>
param
=
new
HashMap
<
String
,
Object
>();
param
.
put
(
"taskId"
,
dmpDevelopTaskDto
.
getId
());
param
.
put
(
"version"
,
dmpDevelopTaskDto
.
getPublishVersion
());
List
<
DmpDevelopTaskHistoryDto
>
dmpDevelopTaskHistoryDtos
=
dmpDevelopTaskHistoryMapper
.
findList
(
param
);
if
(
CollectionUtils
.
isEmpty
(
dmpDevelopTaskHistoryDtos
))
{
throw
new
RuntimeException
(
""
);
}
}
return
taskInstance
;
}
/**
/**
* @throws Exception @Title: findTaskExecutionContextById @Description:
* @throws Exception @Title: findTaskExecutionContextById @Description:
* TODO(根据taskId,jobId等信息将job转成taskExecutionContext) @param @param
* TODO(根据taskId,jobId等信息将job转成taskExecutionContext) @param @param
...
@@ -179,6 +153,9 @@ public class ProcessService {
...
@@ -179,6 +153,9 @@ public class ProcessService {
DmpProjectConfigInfoDto
projectConfigInfoDto
=
dtos
.
get
(
0
);
DmpProjectConfigInfoDto
projectConfigInfoDto
=
dtos
.
get
(
0
);
//测试用替换配置代码
//projectConfigInfoDto.getDmpPublicConfigInfoDto().setAzkabanExectorShellPath("E:/test");
JobType
jobType
=
null
;
JobType
jobType
=
null
;
String
script
=
""
;
String
script
=
""
;
String
taskAppId
=
""
;
String
taskAppId
=
""
;
...
@@ -217,13 +194,13 @@ public class ProcessService {
...
@@ -217,13 +194,13 @@ public class ProcessService {
ShellParameters
shellParameters
=
new
ShellParameters
();
ShellParameters
shellParameters
=
new
ShellParameters
();
shellParameters
.
setScript
(
script
);
shellParameters
.
setScript
(
script
);
shellParameters
.
setTaskAppId
(
taskAppId
);
shellParameters
.
setTaskAppId
(
taskAppId
);
taskExecutionContext
=
shellParameters
.
getTaskExecutionContext
(
);
taskExecutionContext
=
new
TaskExecutionContext
(
shellParameters
,
projectConfigInfoDto
);
break
;
break
;
case
SQL:
case
SQL:
SqlParameters
sqlParameters
=
new
SqlParameters
(
script
,
projectConfigInfoDto
,
dmpSyncingDatasourceDao
,
freeMarkerConfigurer
);
SqlParameters
sqlParameters
=
new
SqlParameters
(
script
,
projectConfigInfoDto
,
dmpSyncingDatasourceDao
,
freeMarkerConfigurer
);
sqlParameters
.
setTaskAppId
(
taskAppId
);
sqlParameters
.
setTaskAppId
(
taskAppId
);
taskExecutionContext
=
sqlParameters
.
getTaskExecutionContext
(
);
taskExecutionContext
=
new
TaskExecutionContext
(
sqlParameters
,
projectConfigInfoDto
);
break
;
break
;
case
SYNC:
case
SYNC:
...
...
src/main/resources/mapperconf/DmpDevelopTaskMapper.xml
View file @
03a1c4e4
...
@@ -36,20 +36,23 @@
...
@@ -36,20 +36,23 @@
<resultMap
id=
"BaseDtoResultMap"
type=
"com.jz.dmp.cmdexectool.controller.bean.DmpDevelopTaskDto"
extends=
"BaseResultMap"
>
<resultMap
id=
"BaseDtoResultMap"
type=
"com.jz.dmp.cmdexectool.controller.bean.DmpDevelopTaskDto"
extends=
"BaseResultMap"
>
<!-- /*$BaseDtoResultMapContent$*/ -->
<!-- /*$BaseDtoResultMapContent$*/ -->
<result
column=
"name"
property=
"name"
jdbcType=
"VARCHAR"
/>
<result
column=
"project_id"
property=
"projectId"
jdbcType=
"INTEGER"
/>
</resultMap>
</resultMap>
<sql
id=
"Base_Column_List"
>
<sql
id=
"Base_Column_List"
>
ID, TREE_ID, datasource_id, TASK_TYPE,
TYPE,
task.ID, task.TREE_ID, task.datasource_id, task.TASK_TYPE, task.
TYPE,
SCHEDULE_TYPE, IS_SUBMIT, TASK_DESC, SCRIPT,
CHK_RESULT,
task.SCHEDULE_TYPE, task.IS_SUBMIT, task.TASK_DESC, task.SCRIPT, task.
CHK_RESULT,
SYNC_RESULT, CHK_TIME, SYNC_TIME, FLOW_HEADER,
FLOW_JSON,
task.SYNC_RESULT, task.CHK_TIME, task.SYNC_TIME, task.FLOW_HEADER, task.
FLOW_JSON,
VERSION, publish_version, IS_GZIPED, SOURCE_DB_ID,
SOURCE_DB_NAME,
task.VERSION, task.publish_version, task.IS_GZIPED, task.SOURCE_DB_ID, task.
SOURCE_DB_NAME,
SOURCE_TABLE_NAME, TARGET_DB_NAME, TARGET_TABLE_NAME, CREATE_USER_ID,
CREATE_TIME,
task.SOURCE_TABLE_NAME, task.TARGET_DB_NAME, task.TARGET_TABLE_NAME, task.CREATE_USER_ID, task.
CREATE_TIME,
UPDATE_USER_ID, UPDATE_TIME,
DATA_STATUS
task.UPDATE_USER_ID, task.UPDATE_TIME, task.
DATA_STATUS
</sql>
</sql>
<sql
id=
"BaseDto_Column_List"
>
<sql
id=
"BaseDto_Column_List"
>
<include
refid=
"Base_Column_List"
/>
<include
refid=
"Base_Column_List"
/>
<!-- /*$BaseDtoColumnListContent$*/ -->
<!-- /*$BaseDtoColumnListContent$*/ -->
, tree.project_id, tree.name
</sql>
</sql>
<!-- 根据主键查询任务开发 -->
<!-- 根据主键查询任务开发 -->
...
@@ -637,103 +640,103 @@
...
@@ -637,103 +640,103 @@
<select
id=
"findList"
resultMap=
"BaseDtoResultMap"
>
<select
id=
"findList"
resultMap=
"BaseDtoResultMap"
>
SELECT
SELECT
<include
refid=
"BaseDto_Column_List"
/>
<include
refid=
"BaseDto_Column_List"
/>
FROM dmp_develop_task
FROM dmp_develop_task
task LEFT JOIN dmp_navigation_tree tree ON task.tree_id=tree.id
<where>
<where>
<if
test=
"id != null"
>
<if
test=
"id != null"
>
AND ID = #{id,jdbcType=INTEGER}
AND
task.
ID = #{id,jdbcType=INTEGER}
</if>
</if>
<if
test=
"treeId != null"
>
<if
test=
"treeId != null"
>
AND TREE_ID = #{treeId,jdbcType=INTEGER}
AND
task.
TREE_ID = #{treeId,jdbcType=INTEGER}
</if>
</if>
<if
test=
"datasourceId != null"
>
<if
test=
"datasourceId != null"
>
AND datasource_id = #{datasourceId,jdbcType=INTEGER}
AND
task.
datasource_id = #{datasourceId,jdbcType=INTEGER}
</if>
</if>
<if
test=
"taskType != null"
>
<if
test=
"taskType != null"
>
AND TASK_TYPE = #{taskType,jdbcType=CHAR}
AND
task.
TASK_TYPE = #{taskType,jdbcType=CHAR}
</if>
</if>
<if
test=
"type != null"
>
<if
test=
"type != null"
>
AND TYPE = #{type,jdbcType=CHAR}
AND
task.
TYPE = #{type,jdbcType=CHAR}
</if>
</if>
<if
test=
"scheduleType != null"
>
<if
test=
"scheduleType != null"
>
AND SCHEDULE_TYPE = #{scheduleType,jdbcType=CHAR}
AND
task.
SCHEDULE_TYPE = #{scheduleType,jdbcType=CHAR}
</if>
</if>
<if
test=
"isSubmit != null"
>
<if
test=
"isSubmit != null"
>
AND IS_SUBMIT = #{isSubmit,jdbcType=CHAR}
AND
task.
IS_SUBMIT = #{isSubmit,jdbcType=CHAR}
</if>
</if>
<if
test=
"taskDesc != null"
>
<if
test=
"taskDesc != null"
>
AND TASK_DESC = #{taskDesc,jdbcType=VARCHAR}
AND
task.
TASK_DESC = #{taskDesc,jdbcType=VARCHAR}
</if>
</if>
<if
test=
"script != null"
>
<if
test=
"script != null"
>
AND SCRIPT = #{script, jdbcType=BLOB, typeHandler=com.jz.dmp.cmdexectool.common.persistence.CBTHandler}
AND
task.
SCRIPT = #{script, jdbcType=BLOB, typeHandler=com.jz.dmp.cmdexectool.common.persistence.CBTHandler}
</if>
</if>
<if
test=
"chkResult != null"
>
<if
test=
"chkResult != null"
>
AND CHK_RESULT = #{chkResult,jdbcType=VARCHAR}
AND
task.
CHK_RESULT = #{chkResult,jdbcType=VARCHAR}
</if>
</if>
<if
test=
"syncResult != null"
>
<if
test=
"syncResult != null"
>
AND SYNC_RESULT = #{syncResult,jdbcType=VARCHAR}
AND
task.
SYNC_RESULT = #{syncResult,jdbcType=VARCHAR}
</if>
</if>
<if
test=
"chkTimeStart != null"
>
<if
test=
"chkTimeStart != null"
>
AND CHK_TIME >= #{chkTimeStart,jdbcType=TIMESTAMP}
AND
task.
CHK_TIME >= #{chkTimeStart,jdbcType=TIMESTAMP}
</if>
</if>
<if
test=
"chkTimeEnd != null"
>
<if
test=
"chkTimeEnd != null"
>
AND CHK_TIME
<![CDATA[ <= ]]>
#{chkTimeEnd,jdbcType=TIMESTAMP}
AND
task.
CHK_TIME
<![CDATA[ <= ]]>
#{chkTimeEnd,jdbcType=TIMESTAMP}
</if>
</if>
<if
test=
"syncTimeStart != null"
>
<if
test=
"syncTimeStart != null"
>
AND SYNC_TIME >= #{syncTimeStart,jdbcType=TIMESTAMP}
AND
task.
SYNC_TIME >= #{syncTimeStart,jdbcType=TIMESTAMP}
</if>
</if>
<if
test=
"syncTimeEnd != null"
>
<if
test=
"syncTimeEnd != null"
>
AND SYNC_TIME
<![CDATA[ <= ]]>
#{syncTimeEnd,jdbcType=TIMESTAMP}
AND
task.
SYNC_TIME
<![CDATA[ <= ]]>
#{syncTimeEnd,jdbcType=TIMESTAMP}
</if>
</if>
<if
test=
"flowHeader != null"
>
<if
test=
"flowHeader != null"
>
AND FLOW_HEADER = #{flowHeader,jdbcType=VARCHAR}
AND
task.
FLOW_HEADER = #{flowHeader,jdbcType=VARCHAR}
</if>
</if>
<if
test=
"flowJson != null"
>
<if
test=
"flowJson != null"
>
AND FLOW_JSON = #{flowJson, jdbcType=BLOB, typeHandler=com.jz.dmp.cmdexectool.common.persistence.CBTHandler}
AND
task.
FLOW_JSON = #{flowJson, jdbcType=BLOB, typeHandler=com.jz.dmp.cmdexectool.common.persistence.CBTHandler}
</if>
</if>
<if
test=
"version != null"
>
<if
test=
"version != null"
>
AND VERSION = #{version,jdbcType=VARCHAR}
AND
task.
VERSION = #{version,jdbcType=VARCHAR}
</if>
</if>
<if
test=
"publishVersion != null"
>
<if
test=
"publishVersion != null"
>
AND publish_version = #{publishVersion,jdbcType=VARCHAR}
AND
task.
publish_version = #{publishVersion,jdbcType=VARCHAR}
</if>
</if>
<if
test=
"isGziped != null"
>
<if
test=
"isGziped != null"
>
AND IS_GZIPED = #{isGziped,jdbcType=INTEGER}
AND
task.
IS_GZIPED = #{isGziped,jdbcType=INTEGER}
</if>
</if>
<if
test=
"sourceDbId != null"
>
<if
test=
"sourceDbId != null"
>
AND SOURCE_DB_ID = #{sourceDbId,jdbcType=VARCHAR}
AND
task.
SOURCE_DB_ID = #{sourceDbId,jdbcType=VARCHAR}
</if>
</if>
<if
test=
"sourceDbName != null"
>
<if
test=
"sourceDbName != null"
>
AND SOURCE_DB_NAME = #{sourceDbName,jdbcType=VARCHAR}
AND
task.
SOURCE_DB_NAME = #{sourceDbName,jdbcType=VARCHAR}
</if>
</if>
<if
test=
"sourceTableName != null"
>
<if
test=
"sourceTableName != null"
>
AND SOURCE_TABLE_NAME = #{sourceTableName,jdbcType=VARCHAR}
AND
task.
SOURCE_TABLE_NAME = #{sourceTableName,jdbcType=VARCHAR}
</if>
</if>
<if
test=
"targetDbName != null"
>
<if
test=
"targetDbName != null"
>
AND TARGET_DB_NAME = #{targetDbName,jdbcType=VARCHAR}
AND
task.
TARGET_DB_NAME = #{targetDbName,jdbcType=VARCHAR}
</if>
</if>
<if
test=
"targetTableName != null"
>
<if
test=
"targetTableName != null"
>
AND TARGET_TABLE_NAME = #{targetTableName,jdbcType=VARCHAR}
AND
task.
TARGET_TABLE_NAME = #{targetTableName,jdbcType=VARCHAR}
</if>
</if>
<if
test=
"createUserId != null"
>
<if
test=
"createUserId != null"
>
AND CREATE_USER_ID = #{createUserId,jdbcType=CHAR}
AND
task.
CREATE_USER_ID = #{createUserId,jdbcType=CHAR}
</if>
</if>
<if
test=
"createTimeStart != null"
>
<if
test=
"createTimeStart != null"
>
AND CREATE_TIME >= #{createTimeStart,jdbcType=TIMESTAMP}
AND
task.
CREATE_TIME >= #{createTimeStart,jdbcType=TIMESTAMP}
</if>
</if>
<if
test=
"createTimeEnd != null"
>
<if
test=
"createTimeEnd != null"
>
AND CREATE_TIME
<![CDATA[ <= ]]>
#{createTimeEnd,jdbcType=TIMESTAMP}
AND
task.
CREATE_TIME
<![CDATA[ <= ]]>
#{createTimeEnd,jdbcType=TIMESTAMP}
</if>
</if>
<if
test=
"updateUserId != null"
>
<if
test=
"updateUserId != null"
>
AND UPDATE_USER_ID = #{updateUserId,jdbcType=CHAR}
AND
task.
UPDATE_USER_ID = #{updateUserId,jdbcType=CHAR}
</if>
</if>
<if
test=
"updateTimeStart != null"
>
<if
test=
"updateTimeStart != null"
>
AND UPDATE_TIME >= #{updateTimeStart,jdbcType=TIMESTAMP}
AND
task.
UPDATE_TIME >= #{updateTimeStart,jdbcType=TIMESTAMP}
</if>
</if>
<if
test=
"updateTimeEnd != null"
>
<if
test=
"updateTimeEnd != null"
>
AND UPDATE_TIME
<![CDATA[ <= ]]>
#{updateTimeEnd,jdbcType=TIMESTAMP}
AND
task.
UPDATE_TIME
<![CDATA[ <= ]]>
#{updateTimeEnd,jdbcType=TIMESTAMP}
</if>
</if>
<if
test=
"dataStatus != null"
>
<if
test=
"dataStatus != null"
>
AND DATA_STATUS = #{dataStatus,jdbcType=CHAR}
AND
task.
DATA_STATUS = #{dataStatus,jdbcType=CHAR}
</if>
</if>
</where>
</where>
</select>
</select>
...
@@ -742,9 +745,9 @@
...
@@ -742,9 +745,9 @@
<select
id=
"findById"
resultMap=
"BaseDtoResultMap"
>
<select
id=
"findById"
resultMap=
"BaseDtoResultMap"
>
select
select
<include
refid=
"BaseDto_Column_List"
/>
<include
refid=
"BaseDto_Column_List"
/>
from dmp_develop_task
from dmp_develop_task
task LEFT JOIN dmp_navigation_tree tree ON task.tree_id=tree.id
where ID = #{id,jdbcType=INTEGER}
where
task.
ID = #{id,jdbcType=INTEGER}
AND data_status='1'
AND
task.
data_status='1'
</select>
</select>
<!-- 根据主键批量删除任务开发 -->
<!-- 根据主键批量删除任务开发 -->
...
...
src/main/resources/mapperconf/DmpProjectConfigInfoMapper.xml
View file @
03a1c4e4
...
@@ -52,7 +52,7 @@
...
@@ -52,7 +52,7 @@
<resultMap
id=
"BaseDtoResultMap"
type=
"com.jz.dmp.cmdexectool.controller.bean.DmpProjectConfigInfoDto"
extends=
"BaseResultMap"
>
<resultMap
id=
"BaseDtoResultMap"
type=
"com.jz.dmp.cmdexectool.controller.bean.DmpProjectConfigInfoDto"
extends=
"BaseResultMap"
>
<!-- /*$BaseDtoResultMapContent$*/ -->
<!-- /*$BaseDtoResultMapContent$*/ -->
<association
property=
"dmpPublicConfigInfoDto"
javaType=
"com.jz.dmp.
modules.controller.projconfig
.bean.DmpPublicConfigInfoDto"
<association
property=
"dmpPublicConfigInfoDto"
javaType=
"com.jz.dmp.
cmdexectool.controller
.bean.DmpPublicConfigInfoDto"
column=
"project_config_id"
select=
"selectOne"
>
column=
"project_config_id"
select=
"selectOne"
>
</association>
</association>
</resultMap>
</resultMap>
...
...
src/main/resources/mapperconf/DmpSyncingDatasourceMapper.xml
View file @
03a1c4e4
...
@@ -26,14 +26,21 @@
...
@@ -26,14 +26,21 @@
<result
property=
"updateUserId"
column=
"UPDATE_USER_ID"
jdbcType=
"VARCHAR"
/>
<result
property=
"updateUserId"
column=
"UPDATE_USER_ID"
jdbcType=
"VARCHAR"
/>
<result
property=
"updateTime"
column=
"UPDATE_TIME"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"updateTime"
column=
"UPDATE_TIME"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"projectId"
column=
"PROJECT_ID"
jdbcType=
"INTEGER"
/>
<result
property=
"projectId"
column=
"PROJECT_ID"
jdbcType=
"INTEGER"
/>
<result
property=
"driverClassName"
column=
"DRIVER_CLASS_NAME"
jdbcType=
"VARCHAR"
/>
</resultMap>
</resultMap>
<!--查询单个-->
<!--查询单个-->
<select
id=
"queryById"
resultMap=
"DmpSyncingDatasourceMap"
>
<select
id=
"queryById"
resultMap=
"DmpSyncingDatasourceMap"
>
<!--
select
select
ID, DATASOURCE_TYPE, DATASOURCE_NAME, DATASOURCE_DESC, JDBC_URL, DB_NAME, USER_NAME, PASSWORD, ENDPOINT, BUCKET, ACCESS_ID, ACCESS_KEY, PROTOCOL, HOST, PORT, DEFAULT_FS, TABLE_SCHEMA, DATA_STATUS, CREATE_USER_ID, CREATE_TIME, UPDATE_USER_ID, UPDATE_TIME, PROJECT_ID
ID, DATASOURCE_TYPE, DATASOURCE_NAME, DATASOURCE_DESC, JDBC_URL, DB_NAME, USER_NAME, PASSWORD, ENDPOINT, BUCKET, ACCESS_ID, ACCESS_KEY, PROTOCOL, HOST, PORT, DEFAULT_FS, TABLE_SCHEMA, DATA_STATUS, CREATE_USER_ID, CREATE_TIME, UPDATE_USER_ID, UPDATE_TIME, PROJECT_ID
from dmp_syncing_datasource
from dmp_syncing_datasource
where ID = #{id}
where ID = #{id}
-->
select
d.ID, d.DATASOURCE_TYPE, d.DATASOURCE_NAME, d.DATASOURCE_DESC, d.JDBC_URL, d.DB_NAME, d.USER_NAME, d.PASSWORD, d.ENDPOINT, d.BUCKET, d.ACCESS_ID, d.ACCESS_KEY, d.PROTOCOL, d.HOST, d.PORT, d.DEFAULT_FS, d.TABLE_SCHEMA, d.DATA_STATUS, d.CREATE_USER_ID, d.CREATE_TIME, d.UPDATE_USER_ID, d.UPDATE_TIME, d.PROJECT_ID, dtype.DRIVER_CLASS_NAME
from dmp_syncing_datasource d left join dmp_syncing_datasource_type dtype on d.DATASOURCE_TYPE=dtype.ID
where d.ID = #{id}
</select>
</select>
</mapper>
</mapper>
\ No newline at end of file
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