任务管理列表增加最近一次执行状态

This commit is contained in:
weiye 2020-02-18 11:07:28 +08:00
parent 8909ec35f0
commit 31eff91077
6 changed files with 29 additions and 27 deletions

View File

@ -1,21 +0,0 @@
package com.wugui.datax.admin.dto;
import lombok.Data;
import java.io.Serializable;
/**
* 用于启动任务接收的实体
*
* @author zhouhongfa@gz-yibo.com
* @ClassName RunJobDto
* @Version 1.0
* @since 2019/6/27 16:12
*/
@Data
public class RunJobDto implements Serializable {
private String jobJson;
private Long jobConfigId;
}

View File

@ -91,4 +91,7 @@ public class JobInfo {
@ApiModelProperty("分区信息")
private String partitionInfo;
@ApiModelProperty("最近一次执行状态")
private int lastHandleCode;
}

View File

@ -48,5 +48,6 @@ public interface JobInfoMapper {
public int incrementTimeUpdate(@Param("id") int id, @Param("incStartTime") Date incStartTime);
public int updateLastHandleCode(@Param("id") int id,@Param("lastHandleCode")int lastHandleCode);
}

View File

@ -77,7 +77,8 @@ public class AdminBizImpl implements AdminBiz {
// trigger success, to trigger child job
String callbackMsg = null;
if (IJobHandler.SUCCESS.getCode() == handleCallbackParam.getExecuteResult().getCode()) {
int resultCode = handleCallbackParam.getExecuteResult().getCode();
if (IJobHandler.SUCCESS.getCode() == resultCode) {
JobInfo jobInfo = jobInfoMapper.loadById(log.getJobId());
jobInfoMapper.incrementTimeUpdate(log.getJobId(),log.getTriggerTime());
if (jobInfo != null && jobInfo.getChildJobId() != null && jobInfo.getChildJobId().trim().length() > 0) {
@ -123,9 +124,10 @@ public class AdminBizImpl implements AdminBiz {
// success, save log
log.setHandleTime(new Date());
log.setHandleCode(handleCallbackParam.getExecuteResult().getCode());
log.setHandleCode(resultCode);
log.setHandleMsg(handleMsg.toString());
jobLogMapper.updateHandleInfo(log);
jobInfoMapper.updateLastHandleCode(log.getJobId(), resultCode);
return ReturnT.SUCCESS;
}

View File

@ -40,6 +40,7 @@
<result column="inc_start_time" property="incStartTime" />
<result column="partition_info" property="partitionInfo" />
<result column="last_handle_code" property="lastHandleCode" />
</resultMap>
<sql id="Base_Column_List">
@ -69,7 +70,8 @@
t.replace_param,
t.jvm_param,
t.inc_start_time,
t.partition_info
t.partition_info,
t.last_handle_code
</sql>
<select id="pageList" parameterType="java.util.HashMap" resultMap="JobInfo">
@ -145,7 +147,8 @@
replace_param,
jvm_param,
inc_start_time,
partition_info
partition_info,
last_handle_code
) VALUES (
#{jobGroup},
#{jobCron},
@ -172,7 +175,8 @@
#{replaceParam},
#{jvmParam},
#{incStartTime},
#{partitionInfo}
#{partitionInfo},
#{lastHandleCode}
);
<!--<selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id">
SELECT LAST_INSERT_ID()
@ -213,7 +217,8 @@
replace_param=#{replaceParam},
jvm_param=#{jvmParam},
inc_start_time=#{incStartTime},
partition_info=#{partitionInfo}
partition_info=#{partitionInfo},
last_handle_code=#{lastHandleCode}
WHERE id = #{id}
</update>
@ -260,4 +265,10 @@
WHERE id = #{id}
</update>
<update id="updateLastHandleCode" parameterType="java.util.HashMap">
UPDATE job_info
SET
last_handle_code = #{lastHandleCode}
WHERE id = #{id}
</update>
</mapper>

View File

@ -299,3 +299,9 @@ ADD COLUMN `partition_info` VARCHAR(100) NULL DEFAULT NULL COMMENT '分区信息
ALTER TABLE `datax_web`.`job_template`
ADD COLUMN `partition_info` VARCHAR(100) NULL DEFAULT NULL COMMENT '分区信息' AFTER `inc_start_time`;
/**
*/
ALTER TABLE `datax_web`.`job_info`
ADD COLUMN `last_handle_code` INT(11) NULL DEFAULT '0' COMMENT '最近一次执行状态' AFTER `partition_info`;