Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jz-dmp-service
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-service
Commits
c7aa4403
Commit
c7aa4403
authored
Mar 14, 2021
by
mcb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit
parent
23fae18b
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
88 additions
and
36 deletions
+88
-36
CommonUtils.java
src/main/java/com/jz/common/utils/CommonUtils.java
+11
-0
DataDevTaskListDto.java
...les/controller/dataOperation/bean/DataDevTaskListDto.java
+12
-0
DmpDevelopTask.java
src/main/java/com/jz/dmp/modules/model/DmpDevelopTask.java
+15
-1
DmpDevelopTaskServiceImpl.java
...z/dmp/modules/service/impl/DmpDevelopTaskServiceImpl.java
+36
-26
OfflineSynchServiceImpl.java
.../jz/dmp/modules/service/impl/OfflineSynchServiceImpl.java
+6
-4
DmpDevelopTaskMapper.xml
src/main/resources/mapper/dmp/DmpDevelopTaskMapper.xml
+1
-0
DmpNavigationTreeMapper.xml
src/main/resources/mapper/dmp/DmpNavigationTreeMapper.xml
+7
-5
No files found.
src/main/java/com/jz/common/utils/CommonUtils.java
View file @
c7aa4403
...
...
@@ -102,4 +102,15 @@ public class CommonUtils {
return
t
;
}
/**
* @Title: getAzkabanName
* @Description: TODO(拼接azkaban用名称)
* @param @return 参数
* @return String 返回类型
* @throws
*/
public
static
String
getAzkabanName
(
String
id
)
{
return
"jz_dmp_"
+
id
;
}
}
src/main/java/com/jz/dmp/modules/controller/dataOperation/bean/DataDevTaskListDto.java
View file @
c7aa4403
...
...
@@ -93,6 +93,10 @@ public class DataDevTaskListDto {
@ApiModelProperty
(
value
=
"sla状态:Y 已配置,N未配置"
)
private
String
slaStatus
;
@ApiModelProperty
(
value
=
"azkabanJobId"
)
private
String
azkabanJobId
;
public
String
getStatus
()
{
return
status
;
}
...
...
@@ -204,4 +208,12 @@ public class DataDevTaskListDto {
public
void
setSlaStatus
(
String
slaStatus
)
{
this
.
slaStatus
=
slaStatus
;
}
public
String
getAzkabanJobId
()
{
return
azkabanJobId
;
}
public
void
setAzkabanJobId
(
String
azkabanJobId
)
{
this
.
azkabanJobId
=
azkabanJobId
;
}
}
src/main/java/com/jz/dmp/modules/model/DmpDevelopTask.java
View file @
c7aa4403
...
...
@@ -3,6 +3,7 @@ package com.jz.dmp.modules.model;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.jz.common.utils.StringUtils
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
...
...
@@ -448,4 +449,17 @@ public class DmpDevelopTask implements Serializable {
return
"jz_dmp_"
+
this
.
id
;
}
/**
* @Title: getAzkabanName
* @Description: TODO(拼接azkaban用名称)
* @param @return 参数
* @return String 返回类型
* @throws
*/
public
String
getAzkabanName
(
String
id
)
{
if
(
StringUtils
.
isNotBlank
(
id
)){
return
"jz_dmp_"
+
id
;
}
return
getAzkabanName
();
}
}
\ No newline at end of file
src/main/java/com/jz/dmp/modules/service/impl/DmpDevelopTaskServiceImpl.java
View file @
c7aa4403
...
...
@@ -843,7 +843,7 @@ public class DmpDevelopTaskServiceImpl extends BaseService implements DmpDevelop
if
(
flowList
.
size
()
>
0
&&
flowList
!=
null
)
{
for
(
DataDevTaskListDto
str
:
listObj
)
{
//业务流程任务
for
(
Map
strFlow
:
flowList
)
{
//最后实例状态
if
(
str
.
getTaskName
(
).
equals
(
strFlow
.
get
(
"taskName"
)))
{
if
(
CommonUtils
.
getAzkabanName
(
str
.
getTaskId
()
).
equals
(
strFlow
.
get
(
"taskName"
)))
{
str
.
setStatus
(
String
.
valueOf
(
strFlow
.
get
(
"status"
)));
//实例执行最后状态
if
(
null
!=
strFlow
.
get
(
"cronExpression"
))
{
//调度周期
str
.
setSchedulinCycle
(
String
.
valueOf
(
strFlow
.
get
(
"cronExpression"
)));
...
...
@@ -1110,7 +1110,10 @@ public class DmpDevelopTaskServiceImpl extends BaseService implements DmpDevelop
if
(
treeList
.
size
()
>
0
&&
treeList
!=
null
)
{
for
(
DataDevTaskListDto
treeDto
:
treeList
)
{
if
(
StringUtils
.
isNotBlank
(
treeDto
.
getTaskName
()))
{
taskName
+=
","
+
treeDto
.
getTaskName
();
//taskName += "," + treeDto.getTaskName();
String
azkabanJobId
=
CommonUtils
.
getAzkabanName
(
treeDto
.
getTaskId
());
taskName
+=
","
+
azkabanJobId
;
treeDto
.
setAzkabanJobId
(
azkabanJobId
);
}
}
//通过任务名称,去查询开发实例
...
...
@@ -1140,9 +1143,10 @@ public class DmpDevelopTaskServiceImpl extends BaseService implements DmpDevelop
if
(
list
.
size
()
>
0
)
{
for
(
DataDevTaskListDto
treeDto
:
treeList
)
{
for
(
DataDevExamplesListDto
dto
:
list
)
{
if
(
treeDto
.
get
TaskName
().
equals
(
dto
.
getTaskName
()))
{
if
(
treeDto
.
get
AzkabanJobId
().
equals
(
dto
.
getTaskName
()))
{
dto
.
setTaskType
(
treeDto
.
getType
());
dto
.
setRunTime
(
dto
.
getRunTime
()
+
"s"
);
BigDecimal
cost
=
new
BigDecimal
(
dto
.
getRunTime
()).
divide
(
new
BigDecimal
(
1000
),
2
,
BigDecimal
.
ROUND_HALF_UP
);
dto
.
setRunTime
(
cost
+
"s"
);
//JsonMapper.fromJsonString(dto.getFlowData(), Map.class);
}
}
...
...
@@ -1457,7 +1461,7 @@ public class DmpDevelopTaskServiceImpl extends BaseService implements DmpDevelop
//先发布任务
Integer
execId
=
publishAndExecute
(
developTask
);
if
(
execId
!=
null
)
{
if
(
execId
!=
null
)
{
baseBeanResponse
.
setCode
(
StatuConstant
.
SUCCESS_CODE
);
baseBeanResponse
.
setMessage
(
"立即运行成功"
);
baseBeanResponse
.
setData
(
execId
);
...
...
@@ -1694,7 +1698,7 @@ public class DmpDevelopTaskServiceImpl extends BaseService implements DmpDevelop
if
(
result
.
containsKey
(
"data"
))
{
return
JsonResult
.
ok
(
result
);
}
return
JsonResult
.
error
(
ResultCode
.
OPERATION_DATA_NO_EXIST
,
String
.
valueOf
(
result
.
get
(
"error"
)));
return
JsonResult
.
error
(
ResultCode
.
OPERATION_DATA_NO_EXIST
,
String
.
valueOf
(
result
.
get
(
"error"
)));
}
/**
...
...
@@ -1723,7 +1727,8 @@ public class DmpDevelopTaskServiceImpl extends BaseService implements DmpDevelop
String
taskName
=
""
;
if
(
list
.
size
()
>
0
&&
list
!=
null
)
{
for
(
DataDevTaskListDto
str
:
list
)
{
taskName
+=
","
+
str
.
getTaskName
();
//taskName += "," + str.getTaskName();
taskName
+=
","
+
CommonUtils
.
getAzkabanName
(
str
.
getTaskId
());
}
}
...
...
@@ -1896,6 +1901,11 @@ public class DmpDevelopTaskServiceImpl extends BaseService implements DmpDevelop
@Override
public
JsonResult
getTaskFlowId
(
String
projectId
)
throws
Exception
{
List
<
Map
>
list
=
dmpNavigationTreeDao
.
queryTaskFlowId
(
projectId
);
if
(
list
.
size
()
>
0
&&
list
!=
null
)
{
for
(
Map
map
:
list
){
map
.
put
(
"name"
,
CommonUtils
.
getAzkabanName
(
String
.
valueOf
(
map
.
get
(
"taskId"
))));
}
}
return
JsonResult
.
ok
(
list
);
}
...
...
src/main/java/com/jz/dmp/modules/service/impl/OfflineSynchServiceImpl.java
View file @
c7aa4403
...
...
@@ -208,7 +208,9 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
String
azkabanLocalTaskFilePath
=
map
.
get
(
"azkabanLocalTaskFilePath"
).
toString
();
//文件路径
String
azkabanMonitorUrl
=
map
.
get
(
"azkabanMonitorUrl"
).
toString
();
//AZKABAN WEB服务地址
String
azkabanJobCommand
=
FlowParseTool
.
generateExecutorToolCommand
(
Integer
.
valueOf
(
taskId
),
treeName
,
true
);
DmpDevelopTask
dmpDevelopTask
=
new
DmpDevelopTask
();
String
azkabanJobName
=
dmpDevelopTask
.
getAzkabanName
(
taskId
);
String
azkabanJobCommand
=
FlowParseTool
.
generateExecutorToolCommand
(
Integer
.
valueOf
(
taskId
),
azkabanJobName
,
true
);
//String azkabanJobCommand = "command=" + azkabanExectorXmlExec + " " + projectId + " ${azkaban.flow.flowid} ${azkaban.job.id} ${azkaban.flow.execid} " + treeName;
...
...
@@ -264,17 +266,17 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
contents
.
add
(
azkabanJobCommand
);
// 生成job文件
String
jobFileAbsolutePath
=
localTaskSourcePath
+
tree
Name
+
".job"
;
String
jobFileAbsolutePath
=
localTaskSourcePath
+
azkabanJob
Name
+
".job"
;
FileUtils
.
write
(
jobFileAbsolutePath
,
contents
);
String
localZipTargetFileName
=
tree
Name
+
".zip"
;
String
localZipTargetFileName
=
azkabanJob
Name
+
".zip"
;
ZipUtils
.
zip
(
localTaskSourcePath
,
localTaskZipPath
,
localZipTargetFileName
);
//上传到azkaban todo
//上次zip包到azkaban
String
localTaskZipAbsolutePath
=
localTaskZipPath
+
"/"
+
localZipTargetFileName
;
AzkabanApiUtils2
azkabanApiUtils
=
new
AzkabanApiUtils2
(
azkabanMonitorUrl
,
redisTemplate
);
return
azkabanApiUtils
.
loginCreateProjectuploadZipAndExecute
(
"jz_workflow_new_"
+
projectId
,
"local_"
+
taskAlias
+
"_project"
,
localTaskZipAbsolutePath
,
tree
Name
);
return
azkabanApiUtils
.
loginCreateProjectuploadZipAndExecute
(
"jz_workflow_new_"
+
projectId
,
"local_"
+
taskAlias
+
"_project"
,
localTaskZipAbsolutePath
,
azkabanJob
Name
);
//return azkabanApiUtils.loginCreateProjectuploadZipAndExecute("jz_localflow_" + projectId, "local_sync_project", localTaskZipAbsolutePath, treeName);
}
...
...
src/main/resources/mapper/dmp/DmpDevelopTaskMapper.xml
View file @
c7aa4403
...
...
@@ -231,6 +231,7 @@
select
t1.id as treeId,
t1.name as taskName,
t2.id as taskId,
(case when t1.type='01' then '离线同步' when t1.type='02' then '实时同步' when t1.type='03' then '数据开发' end) as type
from
dmp_navigation_tree t1
...
...
src/main/resources/mapper/dmp/DmpNavigationTreeMapper.xml
View file @
c7aa4403
...
...
@@ -310,13 +310,15 @@
<select
id=
"queryTaskFlowId"
resultType=
"java.util.Map"
>
SELECT
id,
name
t1.id,
t1.name,
t2.id as taskId
FROM
dmp_navigation_tree
dmp_navigation_tree t1
inner join dmp_develop_task t2 on t1.id=t2.tree_id and t2.data_status='1'
WHERE
1 = 1 AND
DATA_STATUS = '1' AND IS_LEVEL = '1' AND
type != '02'
and project_id = #{projectId}
1 = 1 AND
t1.DATA_STATUS = '1' AND t1.IS_LEVEL = '1' AND t1.
type != '02'
and
t1.
project_id = #{projectId}
</select>
</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