Commit c2c492d0 by guominglei

修改统计工作流运行情况和修改统计时间BUG

parent 879d465a
...@@ -761,11 +761,18 @@ public class ApiFlowServiceImpl implements ApiFlowService { ...@@ -761,11 +761,18 @@ public class ApiFlowServiceImpl implements ApiFlowService {
} }
//如果工作空间下面有数据 //如果工作空间下面有数据
if (flowIdList.size() > 0){ if (flowIdList.size() > 0){
StatisticData flowStatisticData = runRecordingMapper.findStatusByStartAndEndTime(new Date(startTime), new Date(endTime), flowIdList); StatisticData flowStatisticData = runRecordingMapper.findStatusByStartAndEndTime(startTime, endTime, flowIdList);
if (null == flowStatisticData){ if (null == flowStatisticData){
flowStatisticData = new StatisticData(); flowStatisticData = new StatisticData();
flowStatisticData.setUnstart(flowList.size()); flowStatisticData.setUnstart(flowList.size());
}else {
Integer sum = runRecordingMapper.findFlowNum(startTime, endTime, flowIdList);
if (flowList.size() > sum){
//如果工作流
flowStatisticData.setUnstart(flowList.size() - sum + flowStatisticData.getUnstart());
}
} }
StatisticData nodeStatisticData = jobTaskRunLogMapper.findStatusByStartAndEndTime(new Date(startTime), new Date(endTime), flowIdList); StatisticData nodeStatisticData = jobTaskRunLogMapper.findStatusByStartAndEndTime(new Date(startTime), new Date(endTime), flowIdList);
List<Node> nodeList = nodeMapper.findbyFlowIds(flowIdList); List<Node> nodeList = nodeMapper.findbyFlowIds(flowIdList);
if (null == nodeStatisticData){ if (null == nodeStatisticData){
...@@ -1032,6 +1039,7 @@ public class ApiFlowServiceImpl implements ApiFlowService { ...@@ -1032,6 +1039,7 @@ public class ApiFlowServiceImpl implements ApiFlowService {
BeanUtils.copyProperties(waitingRecord, runRecording); BeanUtils.copyProperties(waitingRecord, runRecording);
runRecording.setFlowStatus("1"); runRecording.setFlowStatus("1");
runRecording.setTriggerTime(System.currentTimeMillis()); runRecording.setTriggerTime(System.currentTimeMillis());
runRecording.setWorkspaceId(flow.getWorkspaceId());
Integer waitId = waitingRecordMapper.insertSelective(waitingRecord); Integer waitId = waitingRecordMapper.insertSelective(waitingRecord);
runRecordingMapper.saveRunRecording(runRecording); runRecordingMapper.saveRunRecording(runRecording);
......
...@@ -185,8 +185,8 @@ public interface RunRecordingMapper { ...@@ -185,8 +185,8 @@ public interface RunRecordingMapper {
* @param flowIdList * @param flowIdList
* @return * @return
*/ */
StatisticData findStatusByStartAndEndTime(@Param("startTime")Date startTime, StatisticData findStatusByStartAndEndTime(@Param("startTime")Long startTime,
@Param("endTime")Date endTime, @Param("endTime")Long endTime,
@Param("flowIdList")List<Integer> flowIdList); @Param("flowIdList")List<Integer> flowIdList);
List<RunRecording> findMaxByFlowId(@Param("flowId")Integer flowId); List<RunRecording> findMaxByFlowId(@Param("flowId")Integer flowId);
...@@ -207,4 +207,8 @@ public interface RunRecordingMapper { ...@@ -207,4 +207,8 @@ public interface RunRecordingMapper {
RunRecording findNewStatus(Integer flowId); RunRecording findNewStatus(Integer flowId);
int updateState(RunRecording runRecording); int updateState(RunRecording runRecording);
Integer findFlowNum(@Param("startTime")Long startTime,
@Param("endTime")Long endTime,
@Param("flowIdList")List<Integer> flowIdList);
} }
\ No newline at end of file
...@@ -151,8 +151,8 @@ ...@@ -151,8 +151,8 @@
sum(case when run_code = '2' or run_code = '4' or run_code = '6' then 1 else 0 end) as fail, sum(case when run_code = '2' or run_code = '4' or run_code = '6' then 1 else 0 end) as fail,
sum(case when run_code = '5' then 1 else 0 end) as 'kill' sum(case when run_code = '5' then 1 else 0 end) as 'kill'
from job_task_run_log from job_task_run_log
where start_time &gt;= #{startTime} where trigger_time &gt;= #{startTime}
and end_time &lt;= #{endTime} and trigger_time &lt;= #{endTime}
<if test="flowIdList != null"> <if test="flowIdList != null">
and flow_id in ( and flow_id in (
<foreach collection="flowIdList" item="flowId" separator=","> <foreach collection="flowIdList" item="flowId" separator=",">
...@@ -186,8 +186,8 @@ ...@@ -186,8 +186,8 @@
select <include refid="Base_Column_List" /> select <include refid="Base_Column_List" />
from job_task_run_log from job_task_run_log
where node_id = #{nodeId} where node_id = #{nodeId}
and start_time &gt;= #{startTime} and trigger_time &gt;= #{startTime}
and end_time &lt;= #{endTime} and trigger_time &lt;= #{endTime}
and schedule_type = '5' and schedule_type = '5'
order by start_time desc order by start_time desc
</select> </select>
...@@ -199,8 +199,8 @@ ...@@ -199,8 +199,8 @@
#{nodeId} #{nodeId}
</foreach> </foreach>
) )
and start_time &gt;= #{startTime} and trigger_time &gt;= #{startTime}
and end_time &lt;= #{endTime} and trigger_time &lt;= #{endTime}
and schedule_type = '5' and schedule_type = '5'
order by start_time desc order by start_time desc
</select> </select>
......
...@@ -208,8 +208,8 @@ ...@@ -208,8 +208,8 @@
sum(case when flow_status='4' and (flow_run_result = '2' or flow_run_result = '4') then 1 else 0 end ) fail, sum(case when flow_status='4' and (flow_run_result = '2' or flow_run_result = '4') then 1 else 0 end ) fail,
sum(case when flow_run_result='5' then 1 else 0 end ) 'kill' sum(case when flow_run_result='5' then 1 else 0 end ) 'kill'
from run_recording from run_recording
where start_time &gt;= #{startTime} where trigger_time &gt;= #{startTime}
and end_time &lt;= #{endTime} and trigger_time &lt;= #{endTime}
<if test="flowIdList != null"> <if test="flowIdList != null">
and flow_id in ( and flow_id in (
<foreach collection="flowIdList" item="flowId" separator=","> <foreach collection="flowIdList" item="flowId" separator=",">
...@@ -249,6 +249,23 @@ ...@@ -249,6 +249,23 @@
where flow_id = #{flowId} where flow_id = #{flowId}
) )
</select> </select>
<select id="findFlowNum" resultType="java.lang.Integer">
select count(1)
from (
select flow_id
from run_recording
where trigger_time &gt;= #{startTime}
and trigger_time &lt;= #{endTime}
<if test="flowIdList != null">
and flow_id in (
<foreach collection="flowIdList" item="flowId" separator=",">
#{flowId}
</foreach>
)
</if>
GROUP BY flow_id
) flow
</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 -->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment