Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
byit-myth-job
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
liyuan
byit-myth-job
Commits
df90eee3
Commit
df90eee3
authored
Mar 02, 2020
by
guominglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
查看运行日志的api
parent
8cddc6d5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
80 additions
and
7 deletions
+80
-7
ApiFlowServiceImpl.java
...c/main/java/com/byit/service/impl/ApiFlowServiceImpl.java
+46
-6
FlowMapper.java
...-admin-core/src/main/java/com/byit/mapper/FlowMapper.java
+8
-0
RunRecordingMapper.java
...ore/src/main/java/com/byit/mapper/RunRecordingMapper.java
+3
-0
FlowMapper.xml
.../myth-admin-core/src/main/resources/mapper/FlowMapper.xml
+8
-1
RunRecordingMapper.xml
...min-core/src/main/resources/mapper/RunRecordingMapper.xml
+15
-0
No files found.
byit-myth-admin/src/main/java/com/byit/service/impl/ApiFlowServiceImpl.java
View file @
df90eee3
...
@@ -25,6 +25,7 @@ import org.springframework.transaction.annotation.Transactional;
...
@@ -25,6 +25,7 @@ import org.springframework.transaction.annotation.Transactional;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.*
;
/**
/**
...
@@ -595,19 +596,58 @@ public class ApiFlowServiceImpl implements ApiFlowService {
...
@@ -595,19 +596,58 @@ public class ApiFlowServiceImpl implements ApiFlowService {
public
List
<
RunRecordingVo
>
loadScheduleResult
(
String
param
){
public
List
<
RunRecordingVo
>
loadScheduleResult
(
String
param
){
ValidationUtil
.
dataNotBank
(
param
,
"请求参数不允许为空!"
);
ValidationUtil
.
dataNotBank
(
param
,
"请求参数不允许为空!"
);
JSONObject
jsonObject
=
JSON
.
parseObject
(
param
);
JSONObject
jsonObject
=
JSON
.
parseObject
(
param
);
Long
startTime
=
jsonObject
.
getLo
ng
(
"startTime"
);
String
startTime
=
jsonObject
.
getStri
ng
(
"startTime"
);
ValidationUtil
.
dataNotNull
(
startTime
,
"开始时间不允许为空!"
);
ValidationUtil
.
dataNotNull
(
startTime
,
"开始时间不允许为空!"
);
Long
endTime
=
jsonObject
.
getLong
(
"endTime"
);
String
endTime
=
jsonObject
.
getString
(
"endTime"
);
ValidationUtil
.
dataNotNull
(
endTime
,
"结束时间不允许为空!"
);
ValidationUtil
.
dataNotNull
(
endTime
,
"结束时间不允许为空!"
);
//TODO 最长不能超过60天
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
Date
startDate
=
null
;
Date
endDate
=
null
;
try
{
startDate
=
sdf
.
parse
(
startTime
);
endDate
=
sdf
.
parse
(
endTime
);
//TODO 最长不能超过60天
ValidationUtil
.
isTrueValidation
(
endDate
.
getTime
()
-
startDate
.
getTime
()
>
60
*
24
*
60
*
60
*
1000
,
"查询时间最长为60天!"
);
}
catch
(
ParseException
e
)
{
log
.
error
(
"时间格式不正确, startTime {} endTime {}"
,
startTime
,
endTime
);
ValidationUtil
.
isTrueValidation
(
true
,
"时间格式不符合标准! 例:20200101"
);
}
//获取工作空间名称
//获取工作空间名称
String
workspaceName
=
jsonObject
.
getString
(
"workspaceName"
);
String
workspaceName
=
jsonObject
.
getString
(
"workspaceName"
);
ValidationUtil
.
dataNotBank
(
workspaceName
,
"工作空间名称不允许为空!"
);
//获取工作流名称
String
flowName
=
jsonObject
.
getString
(
"flowName"
);
String
flowName
=
jsonObject
.
getString
(
"flowName"
);
ValidationUtil
.
dataNotBank
(
flowName
,
"工作流名称不允许为空!"
);
List
<
Integer
>
flowIds
=
new
ArrayList
<>();
if
(
StringUtils
.
isNotBlank
(
workspaceName
)){
Workspace
workspace
=
workspaceMapper
.
getByName
(
workspaceName
);
ValidationUtil
.
dataNotNull
(
workspace
,
workspaceName
+
"工作空间不存在"
);
if
(
StringUtils
.
isNotBlank
(
flowName
)){
Flow
flow
=
flowMapper
.
getByWorkSpaceAndName
(
workspace
.
getWorkspaceId
(),
flowName
);
ValidationUtil
.
dataNotNull
(
flow
,
flowName
+
"工作流不存在"
);
flowIds
.
add
(
flow
.
getFlowId
());
}
else
{
List
<
Flow
>
flowList
=
flowMapper
.
findByWorkspace
(
workspace
.
getWorkspaceId
());
if
(
flowList
!=
null
&&
flowList
.
size
()
>
0
){
flowList
.
forEach
(
flow
->
flowIds
.
add
(
flow
.
getFlowId
()));
}
}
}
List
<
RunRecording
>
runRecordList
=
runRecordingMapper
.
findByStartAndEndTime
(
startDate
.
getTime
(),
endDate
.
getTime
(),
flowIds
);
if
(
runRecordList
!=
null
&&
runRecordList
.
size
()
>
0
){
List
<
RunRecordingVo
>
runRecordingVoList
=
new
ArrayList
<>();
runRecordList
.
forEach
(
runRecording
->
{
RunRecordingVo
runRecordingVo
=
new
RunRecordingVo
();
BeanUtils
.
copyProperties
(
runRecording
,
runRecordingVo
);
List
<
JobTaskRunLog
>
jobTaskRunLogList
=
jobTaskRunLogMapper
.
findByRunIdAndFlowName
(
runRecording
.
getRunId
(),
runRecording
.
getFlowName
());
runRecordingVo
.
setJobTaskRunLogList
(
jobTaskRunLogList
);
runRecordingVoList
.
add
(
runRecordingVo
);
});
return
runRecordingVoList
;
}
return
null
;
return
null
;
}
}
...
...
byit-myth-core/myth-admin-core/src/main/java/com/byit/mapper/FlowMapper.java
View file @
df90eee3
...
@@ -35,4 +35,11 @@ public interface FlowMapper {
...
@@ -35,4 +35,11 @@ public interface FlowMapper {
* @return
* @return
*/
*/
Flow
getByWorkSpaceAndName
(
@Param
(
"workspaceId"
)
Integer
workspaceId
,
@Param
(
"flowName"
)
String
flowName
);
Flow
getByWorkSpaceAndName
(
@Param
(
"workspaceId"
)
Integer
workspaceId
,
@Param
(
"flowName"
)
String
flowName
);
/**
* 根据workspace查找所属的工作流
* @param workspaceId
* @return
*/
List
<
Flow
>
findByWorkspace
(
Integer
workspaceId
);
}
}
\ No newline at end of file
byit-myth-core/myth-admin-core/src/main/java/com/byit/mapper/RunRecordingMapper.java
View file @
df90eee3
...
@@ -117,4 +117,6 @@ public interface RunRecordingMapper {
...
@@ -117,4 +117,6 @@ public interface RunRecordingMapper {
* @return
* @return
*/
*/
List
<
RunRecording
>
findUnFinishByRunId
(
String
runId
);
List
<
RunRecording
>
findUnFinishByRunId
(
String
runId
);
List
<
RunRecording
>
findByStartAndEndTime
(
@Param
(
"startDate"
)
long
startDate
,
@Param
(
"endDate"
)
long
endDate
,
@Param
(
"flowIds"
)
List
<
Integer
>
flowIds
);
}
}
\ No newline at end of file
byit-myth-core/myth-admin-core/src/main/resources/mapper/FlowMapper.xml
View file @
df90eee3
...
@@ -67,7 +67,14 @@
...
@@ -67,7 +67,14 @@
where flow_id = #{id,jdbcType=INTEGER}
where flow_id = #{id,jdbcType=INTEGER}
</select>
</select>
<delete
id=
"deleteById"
parameterType=
"java.lang.Integer"
>
<select
id=
"findByWorkspace"
resultType=
"com.byit.model.Flow"
>
select
<include
refid=
"Base_Column_List"
/>
from flow
where false = #{workspaceId,jdbcType=INTEGER}
</select>
<delete
id=
"deleteById"
parameterType=
"java.lang.Integer"
>
<!-- generated @mbg.generated date: 2019-12-31 -->
<!-- generated @mbg.generated date: 2019-12-31 -->
delete from flow
delete from flow
where flow_id = #{flowId,jdbcType=INTEGER}
where flow_id = #{flowId,jdbcType=INTEGER}
...
...
byit-myth-core/myth-admin-core/src/main/resources/mapper/RunRecordingMapper.xml
View file @
df90eee3
...
@@ -81,6 +81,21 @@
...
@@ -81,6 +81,21 @@
where run_id = #{runId,jdbcType=VARCHAR}
where run_id = #{runId,jdbcType=VARCHAR}
and flow_status != '4'
and flow_status != '4'
</select>
</select>
<select
id=
"findByStartAndEndTime"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from run_recording
where start_time
>
= ${startDate}
and end_time
<
= ${endDate}
<if
test=
"flowIds != null"
>
and flow_id in (
<foreach
collection=
"flowIds"
item=
"flowId"
separator=
","
>
flowId
</foreach>
)
</if>
</select>
<delete
id=
"deleteById"
parameterType=
"java.lang.Integer"
>
<delete
id=
"deleteById"
parameterType=
"java.lang.Integer"
>
<!-- generated @mbg.generated date: 2019-12-25 -->
<!-- generated @mbg.generated date: 2019-12-25 -->
...
...
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