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
0f3e8b43
Commit
0f3e8b43
authored
Mar 09, 2021
by
mcb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
数据运维修改
parent
5e17a283
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
43 additions
and
52 deletions
+43
-52
AzkabanApiUtils2.java
src/main/java/com/jz/common/utils/AzkabanApiUtils2.java
+18
-0
ExecutionFlowsMapper.java
...ain/java/com/jz/dmp/azkaban/dao/ExecutionFlowsMapper.java
+0
-14
DmpDevExamplesController.java
...es/controller/dataOperation/DmpDevExamplesController.java
+8
-3
DmpDevelopTaskService.java
...ava/com/jz/dmp/modules/service/DmpDevelopTaskService.java
+1
-1
DmpDevelopTaskServiceImpl.java
...z/dmp/modules/service/impl/DmpDevelopTaskServiceImpl.java
+9
-11
ExecutionFlowsMapper.xml
src/main/resources/azkabanmapper/ExecutionFlowsMapper.xml
+7
-23
No files found.
src/main/java/com/jz/common/utils/AzkabanApiUtils2.java
View file @
0f3e8b43
...
...
@@ -776,5 +776,23 @@ public class AzkabanApiUtils2 {
String
result
=
HttpClientUtils
.
getJsonForParam
(
executeFlowUrl
,
new
HashMap
<>());
return
result
;
}
/**
* 获取 业务流程 执行实例日志
* @author Bellamy
* @since 2021-03-08
* @return
*/
public
String
getInstanceLog
(
String
execId
)
{
String
sessionId
=
login
();
String
executeFlowUrl
=
azkabanServerUrl
+
"/executor?ajax=fetchExecFlowLogs&"
;
Map
params
=
new
HashMap
();
params
.
put
(
"session.id"
,
sessionId
);
params
.
put
(
"execid"
,
execId
);
params
.
put
(
"offset"
,
0
);
params
.
put
(
"length"
,
50000
);
String
result
=
HttpClientUtils
.
getJsonForParam
(
executeFlowUrl
,
params
);
return
result
;
}
}
src/main/java/com/jz/dmp/azkaban/dao/ExecutionFlowsMapper.java
View file @
0f3e8b43
package
com
.
jz
.
dmp
.
azkaban
.
dao
;
import
com.jz.dmp.azkaban.entity.ProjectFlows
;
import
com.jz.dmp.modules.controller.azkaban.bean.ProjectFlowsDto
;
import
com.jz.dmp.modules.controller.bean.IndexProjAzkabanStatuDto
;
import
com.jz.dmp.modules.controller.dataOperation.bean.DataDevExamplesListDto
;
import
com.jz.dmp.modules.controller.dataOperation.bean.DataDevExamplesListReq
;
import
com.jz.dmp.modules.controller.dataOperation.bean.DataDevTaskListReq
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
...
...
@@ -29,15 +24,6 @@ public interface ExecutionFlowsMapper {
*/
List
<
DataDevExamplesListDto
>
queryDevExamplesListPage
(
Map
saveParams
)
throws
Exception
;
/**
* 获取执行实例的日志详情
*
* @return
* @author Bellamy
* @since 2021-02-03
*/
List
<
Map
>
queryExamplesLogByExecId
(
String
execId
)
throws
Exception
;
Map
<
String
,
Object
>
queryTaskInstanceStatus
(
@Param
(
"taskName"
)
String
[]
taskName
)
throws
Exception
;
/**
...
...
src/main/java/com/jz/dmp/modules/controller/dataOperation/DmpDevExamplesController.java
View file @
0f3e8b43
...
...
@@ -7,6 +7,7 @@ import com.jz.dmp.modules.controller.dataOperation.bean.*;
import
com.jz.dmp.modules.service.DmpDevelopTaskService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -64,14 +65,18 @@ public class DmpDevExamplesController {
*/
@ApiOperation
(
value
=
"执行实例日志详情"
,
notes
=
"执行实例日志详情"
)
@GetMapping
(
value
=
"/log"
)
@ApiImplicitParam
(
name
=
"execId"
,
value
=
"执行实例ID"
,
required
=
true
)
public
JsonResult
getExamplesLog
(
@RequestParam
String
execId
)
{
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"execId"
,
value
=
"执行实例ID"
,
required
=
true
),
@ApiImplicitParam
(
name
=
"projectId"
,
value
=
"projectId"
,
required
=
true
)})
public
JsonResult
getExamplesLog
(
@RequestParam
String
execId
,
@RequestParam
String
projectId
)
{
if
(
StringUtils
.
isEmpty
(
execId
))
{
return
JsonResult
.
error
(
ResultCode
.
PARAMS_ERROR
,
"执行实例ID不能为空!"
);
}
if
(
StringUtils
.
isEmpty
(
projectId
))
{
return
JsonResult
.
error
(
ResultCode
.
PARAMS_ERROR
,
"projectId不能为空!"
);
}
JsonResult
result
=
new
JsonResult
();
try
{
result
=
dmpDevelopTaskService
.
queryExamplesLogByExecId
(
execId
);
result
=
dmpDevelopTaskService
.
queryExamplesLogByExecId
(
execId
,
projectId
);
}
catch
(
Exception
e
)
{
result
.
setCode
(
ResultCode
.
INTERNAL_SERVER_ERROR
);
result
.
setMessage
(
"查询失败!"
);
...
...
src/main/java/com/jz/dmp/modules/service/DmpDevelopTaskService.java
View file @
0f3e8b43
...
...
@@ -178,7 +178,7 @@ public interface DmpDevelopTaskService {
* @author Bellamy
* @since 2021-02-03
*/
JsonResult
queryExamplesLogByExecId
(
String
execId
)
throws
Exception
;
JsonResult
queryExamplesLogByExecId
(
String
execId
,
String
projectId
)
throws
Exception
;
/**
* 运维大屏--获取任务状态
...
...
src/main/java/com/jz/dmp/modules/service/impl/DmpDevelopTaskServiceImpl.java
View file @
0f3e8b43
...
...
@@ -1664,19 +1664,17 @@ public class DmpDevelopTaskServiceImpl extends BaseService implements DmpDevelop
* @since 2021-02-03
*/
@Override
public
JsonResult
queryExamplesLogByExecId
(
String
execId
)
throws
Exception
{
List
<
Map
>
list
=
executionFlowsMapper
.
queryExamplesLogByExecId
(
execId
);
if
(
list
.
size
()
>
0
&&
list
!=
null
)
{
list
.
forEach
(
map
->
{
try
{
map
.
put
(
"log"
,
new
String
(
String
.
valueOf
(
map
.
get
(
"log"
)).
getBytes
(
"ISO-8859-1"
),
"UTF-8"
));
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
}
public
JsonResult
queryExamplesLogByExecId
(
String
execId
,
String
projectId
)
throws
Exception
{
DmpProjectSystemInfo
publishToProjectSystemInfo
=
dmpProjectDao
.
queryProjectSystemInfo
(
Long
.
valueOf
(
projectId
));
});
//调用azkaban服务
String
azkabanApiUrl
=
publishToProjectSystemInfo
.
getAzkabanMonitorUrl
();
AzkabanApiUtils2
azkabanApiUtils
=
new
AzkabanApiUtils2
(
azkabanApiUrl
,
redisTemplate
);
Map
result
=
(
Map
)
JSONObject
.
parse
(
azkabanApiUtils
.
getInstanceLog
(
execId
));
if
(
result
.
containsKey
(
"data"
))
{
return
JsonResult
.
ok
(
result
);
}
return
JsonResult
.
ok
(
list
);
return
JsonResult
.
error
(
ResultCode
.
OPERATION_DATA_NO_EXIST
,
String
.
valueOf
(
result
.
get
(
"error"
))
);
}
/**
...
...
src/main/resources/azkabanmapper/ExecutionFlowsMapper.xml
View file @
0f3e8b43
...
...
@@ -190,23 +190,6 @@
<if
test=
"endTime != null and endTime != ''"
>
and #{endTime} >= from_unixtime(submit_time/1000,'%Y-%m-%d %H:%i:%s')
</if>
</select>
<!-- <resultMap type="java.util.HashMap" id="taskExamplesLog">
<result property="execId" column="exec_id" jdbcType="INTEGER"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="log" column="log" jdbcType="BLOB" typeHandler="com.jz.common.persistence.CBTHandler"/>
<result property="uploadTime" column="upload_time" jdbcType="INTEGER"/>
</resultMap>-->
<!--获取执行实例的日志详情-->
<select
id=
"queryExamplesLogByExecId"
parameterType=
"string"
resultType=
"java.util.Map"
>
select
exec_id as execId,
name,
log,
from_unixtime(upload_time/1000, '%Y-%m-%d %H:%i:%s') as uploadTime
from execution_logs
where 1=1 and exec_id=#{execId}
</select>
<!--统计实例状态数-->
<select
id=
"queryTaskInstanceStatus"
resultType=
"java.util.Map"
>
select
...
...
@@ -227,13 +210,14 @@
<!--查询业务流程任务,最后一个执行实例的状态-->
<select
id=
"queryLastStatus"
resultType=
"java.util.Map"
>
SELECT
exec_id AS execId,
project_id as projectId,
flow_id AS taskName,
max(from_unixtime( submit_time / 1000, '%Y-%m-%d %H:%i:%s' )) AS startTime,
(case when
status='30' then '运行中' when status='50' then '成功' when
status='70' then '失败' end) status
t.
exec_id AS execId,
t.
project_id as projectId,
t.
flow_id AS taskName,
max(from_unixtime(
t.
submit_time / 1000, '%Y-%m-%d %H:%i:%s' )) AS startTime,
(case when
t.status='30' then '运行中' when t.status='50' then '成功' when t.
status='70' then '失败' end) status
FROM
execution_flows
execution_flows t
inner join projects t1 on t.project_id=t1.id and active=1
WHERE 1 = 1
<if
test=
"status != null and status !='' "
>
and status=#{status}
</if>
<if
test=
"taskName != null and taskName !='' "
>
...
...
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