Commit e34416ca authored by mcb's avatar mcb

任务状态查看

parent a6f92fb6
......@@ -247,6 +247,11 @@
<artifactId>commons-fileupload</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.3</version><!--$NO-MVN-MAN-VER$-->
</dependency>
</dependencies>
<build>
......
......@@ -17,24 +17,26 @@ public enum ResultCode {
/** 参数错误 */
PARAMS_ERROR("403", "参数错误 "),
OPERATION_DATA_NO_EXIST("410","操作数据不存在"),
PARAMS_ERROR_TOKEN("446", "token无效"),
/** 不支持当前请求方? */
METHOD_NOT_ALLOWED("405", "不支持当前请求方? "),
/** 不支持当前请求方? */
METHOD_NOT_ALLOWED("405", "不支持当前请求方? "),
/** 不支持或已经废弃 */
NOT_SUPPORTED("410", "不支持或已经废弃"),
/** 不支持当前媒体类? */
UNSUPPORTED_MEDIA_TYPE("415", "不支持当前媒体类?"),
/** 不支持当前媒体类? */
UNSUPPORTED_MEDIA_TYPE("415", "不支持当前媒体类?"),
/** AuthCode错误 */
INVALID_AUTHCODE("444", "无权限访?"),
INVALID_AUTHCODE("444", "无权限访?"),
/** 太频繁的调用 */
TOO_FREQUENT("445", "太频繁的调用"),
/** 未知的错? */
/** 未知的错? */
UNKNOWN_ERROR("499", "未知错误"),
/** 内部服务出错 */
......
......@@ -4,6 +4,7 @@ package com.jz.common.utils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import com.jz.common.utils.web.HttpClientUtils;
import com.jz.common.utils.web.SessionUtils;
import com.jz.dmp.modules.controller.DataIntegration.bean.flow.FlowExecution;
import com.jz.dmp.modules.controller.DataIntegration.bean.flow.FlowPro;
......@@ -627,54 +628,54 @@ public class AzkabanApiUtils2 {
* @return List<FlowExecution> 返回类型
* @throws
*/
// public List<FlowExecution> getSyncingFlowExecution(Long projectId, String flow, Integer start, Integer length) {
//
// List<FlowExecution> list = new ArrayList<FlowExecution>();
//
// //登录
// String sessionId = login();
//
// String executeFlowUrl = azkabanServerUrl + "/manager?token=" + sessionId;
// Map<String, Object> paramMap = new HashMap<String, Object>();
// paramMap.put("session.id", sessionId);
// paramMap.put("ajax", "fetchFlowExecutions");
// paramMap.put("project", "jz_localflow_"+projectId);
// paramMap.put("flow", flow);
// paramMap.put("start", start);
// paramMap.put("length", length);
//
// JSONObject getForObject = null;
// try {
// //postForObject = bulidRestTemplate().postForObject(executeFlowUrl, linkedMultiValueMap, Map.class);
// //String getForObjectStr = bulidRestTemplate().getForObject(executeFlowUrl, String.class, paramMap);
// String getForObjectStr = HttpClientUtils.getJsonForParam(executeFlowUrl, paramMap);
// getForObject = JSON.parseObject(getForObjectStr);
// } catch (Exception e) {
// LOGGER.error(executeFlowUrl + "----" + paramMap + "----获取同步状态结果接口异常");
// e.printStackTrace();
// throw new RuntimeException("获取同步状态结果接口异常");
// }
//
// if (getForObject==null) {
// return list;
// }
//
// if (getForObject.containsKey("error")){
// throw new RuntimeException(getForObject.get("error").toString());
// }
// String status = (String) getForObject.get("status");
// if ("error".equals(status)) {
// String message = (String) getForObject.get("message");
// throw new RuntimeException(message);
// }
//
// String executions = getForObject.getString("executions");
//
// LOGGER.info("获取同步状态结果成功:"+executions);
//
// list = JSONObject.parseArray(executions, FlowExecution.class);
//
// return list;
// }
public List<FlowExecution> getSyncingFlowExecution(Long projectId, String flow, Integer start, Integer length) {
List<FlowExecution> list = new ArrayList<FlowExecution>();
//登录
String sessionId = login();
String executeFlowUrl = azkabanServerUrl + "/manager?token=" + sessionId;
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("session.id", sessionId);
paramMap.put("ajax", "fetchFlowExecutions");
paramMap.put("project", "jz_localflow_"+projectId);
paramMap.put("flow", flow);
paramMap.put("start", start);
paramMap.put("length", length);
JSONObject getForObject = null;
try {
//postForObject = bulidRestTemplate().postForObject(executeFlowUrl, linkedMultiValueMap, Map.class);
//String getForObjectStr = bulidRestTemplate().getForObject(executeFlowUrl, String.class, paramMap);
String getForObjectStr = HttpClientUtils.getJsonForParam(executeFlowUrl, paramMap);
getForObject = JSON.parseObject(getForObjectStr);
} catch (Exception e) {
LOGGER.error(executeFlowUrl + "----" + paramMap + "----获取同步状态结果接口异常");
e.printStackTrace();
throw new RuntimeException("获取同步状态结果接口异常");
}
if (getForObject==null) {
return list;
}
if (getForObject.containsKey("error")){
throw new RuntimeException(getForObject.get("error").toString());
}
String status = (String) getForObject.get("status");
if ("error".equals(status)) {
String message = (String) getForObject.get("message");
throw new RuntimeException(message);
}
String executions = getForObject.getString("executions");
LOGGER.info("获取同步状态结果成功:"+executions);
list = JSONObject.parseArray(executions, FlowExecution.class);
return list;
}
}
This diff is collapsed.
......@@ -3,9 +3,7 @@ package com.jz.dmp.modules.controller.DataIntegration;
import com.jz.common.constant.JsonResult;
import com.jz.common.constant.ResultCode;
import com.jz.common.page.PageInfoResponse;
import com.jz.dmp.modules.controller.DataIntegration.bean.SourceDbNameListDto;
import com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageDto;
import com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageReq;
import com.jz.dmp.modules.controller.DataIntegration.bean.*;
import com.jz.dmp.modules.service.OfflineSynchService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
......@@ -73,8 +71,8 @@ public class OfflineSynchController {
@ApiOperation(value = "根据源数据库id,获取源数据表-下拉框", notes = "根据源数据库id,获取源数据表")
@GetMapping(value = "/sourceTableList")
@ApiImplicitParam(name = "sourceDbId", value = "源数据库id")
public JsonResult getSourceTableList(@RequestParam Integer sourceDbId,@RequestParam(value = "targetName", required = false) String targetName) throws Exception {
JsonResult list = offlineSynchService.querygSourceTableList(sourceDbId,targetName);
public JsonResult getSourceTableList(@RequestParam Integer sourceDbId, @RequestParam(value = "targetName", required = false) String targetName) throws Exception {
JsonResult list = offlineSynchService.querygSourceTableList(sourceDbId, targetName);
return list;
}
......@@ -87,10 +85,38 @@ public class OfflineSynchController {
@GetMapping(value = "/taskRunNowByTaskId")
@ApiImplicitParam(name = "taskId", value = "任务id")
public JsonResult getTaskRunNowByTaskId(@RequestParam(value = "taskId") String taskId) throws Exception {
if(StringUtils.isEmpty(taskId)){
if (StringUtils.isEmpty(taskId)) {
return new JsonResult(ResultCode.PARAMS_ERROR);
}
JsonResult list = offlineSynchService.taskRunNowByTaskId(taskId);
return list;
}
/**
* 根据taskId删除任务
*
* @return
*/
@ApiOperation(value = "删除任务", notes = "删除任务")
@GetMapping(value = "/delTaskByTaskId")
@ApiImplicitParam(name = "taskId", value = "任务id")
public JsonResult delTaskByTaskId(@RequestParam(value = "taskId") String taskId) throws Exception {
if (StringUtils.isEmpty(taskId)) {
return new JsonResult(ResultCode.PARAMS_ERROR);
}
JsonResult list = offlineSynchService.delTaskByTaskId(taskId);
return list;
}
/**
* 状态查看列表分页查询
*
* @return
*/
@ApiOperation(value = "状态查看", notes = "状态查看列表分页查询")
@PostMapping(value = "/checkTaskStatus")
public JsonResult<List<CheckTaskStatusPageDto>> getCheckTaskStatusListPage(@RequestBody @Validated CheckTaskStatusPageReq checkTaskStatusPageReq) throws Exception {
JsonResult<List<CheckTaskStatusPageDto>> list = offlineSynchService.queryCheckTaskStatusListPage(checkTaskStatusPageReq);
return list;
}
}
package com.jz.dmp.modules.controller.DataIntegration.bean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @ClassName: CheckTaskStatusPageDto
* @Description: 状态查看列表返回参数对象
* @Author :Bellamy
* @Date 2020/12/22
* @Version 1.0
*/
@ApiModel(value = "任务状态查看列表返回参数对象", description = "状态查看列表返回参数对象")
public class CheckTaskStatusPageDto {
/*
* 任务执行id
* */
@ApiModelProperty(value = "任务执行id")
private long execId;
/*
* 创建人
* */
@ApiModelProperty(value = "创建人")
private String submitUser;
/*
* 开始时间
* */
@ApiModelProperty(value = "开始时间")
private String startTime;
/*
* 结束时间
* */
@ApiModelProperty(value = "结束时间")
private String endTime;
/*
* 耗时
* */
@ApiModelProperty(value = "耗时")
private long costTime;
/*
*同步状态
* */
@ApiModelProperty(value = "同步状态:FAILED失败,success成功")
private String status;
public long getExecId() {
return execId;
}
public void setExecId(long execId) {
this.execId = execId;
}
public String getSubmitUser() {
return submitUser;
}
public void setSubmitUser(String submitUser) {
this.submitUser = submitUser;
}
public String getStartTime() {
return startTime;
}
public void setStartTime(String startTime) {
this.startTime = startTime;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
public long getCostTime() {
return costTime;
}
public void setCostTime(long costTime) {
this.costTime = costTime;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
}
package com.jz.dmp.modules.controller.DataIntegration.bean;
import com.jz.common.page.BasePageBean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
/**
* @ClassName: CheckTaskStatusPageReq
* @Description: 状态查看请求参数对象
* @Author:Bellamy
* @Date 2020/12/21
* @Version 1.0
*/
@ApiModel(value = "状态查看列表分页查询请求参数对象", description = "状态查看请求参数对象")
public class CheckTaskStatusPageReq extends BasePageBean {
/*
* 项目ID
* */
@NotNull(message = "项目ID不能为空")
@NotEmpty(message = "项目ID不能空")
@ApiModelProperty(value = "项目ID")
private String projectId;
/*
* 任务id
* */
@ApiModelProperty(value = "任务id")
@NotNull(message = "任务id不能为空")
@NotEmpty(message = "任务id不能为空")
private String taskId;
/*
* 任务树名称
* */
@ApiModelProperty(value = "任务树名称")
@NotEmpty(message = "任务树名称不能为空")
private String treeName;
public String getProjectId() {
return projectId;
}
public void setProjectId(String projectId) {
this.projectId = projectId;
}
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public String getTreeName() {
return treeName;
}
public void setTreeName(String treeName) {
this.treeName = treeName;
}
}
......@@ -25,6 +25,12 @@ public class TaskListPageDto {
@ApiModelProperty(value = "treeId")
String treeId;
/*
* 任务树名称
* */
@ApiModelProperty(value = "任务树名称")
String treeName;
/*
* 同步时间
* */
......@@ -190,4 +196,12 @@ public class TaskListPageDto {
public void setTargetTableName(String targetTableName) {
this.targetTableName = targetTableName;
}
public String getTreeName() {
return treeName;
}
public void setTreeName(String treeName) {
this.treeName = treeName;
}
}
package com.jz.dmp.modules.controller.DataIntegration.bean.flow;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @ClassName: FlowExecution
* @Description: TODO(封装同步状态结果)
......@@ -7,22 +10,41 @@ package com.jz.dmp.modules.controller.DataIntegration.bean.flow;
* @date 2020年12月11日
*
*/
@ApiModel(value = "任务状态查看列表返回参数对象", description = "状态查看列表返回参数对象")
public class FlowExecution {
private long submitTime;
/*
* 创建人
* */
@ApiModelProperty(value = "创建人")
private String submitUser;
/*
* 开始时间
* */
@ApiModelProperty(value = "开始时间")
private long startTime;
/*
* 结束时间
* */
@ApiModelProperty(value = "结束时间")
private long endTime;
private String flowId;
/*
* 项目id
* */
@ApiModelProperty(value = "项目id")
private long projectId;
/*
* 任务执行id
* */
@ApiModelProperty(value = "任务执行id")
private long execId;
/*
*同步状态
* */
@ApiModelProperty(value = "同步状态")
private String status;
public long getSubmitTime() {
......
package com.jz.dmp.modules.controller;
import com.jz.dmp.modules.service.DmpDevelopTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 任务开发(DmpDevelopTask)表控制层
*
* @author Bellamy
* @since 2020-12-22 16:37:56
*/
@RestController
@RequestMapping("/dmpDevelopTask")
public class DmpDevelopTaskController {
/**
* 服务对象
*/
@Autowired
private DmpDevelopTaskService dmpDevelopTaskService;
}
\ No newline at end of file
package com.jz.dmp.modules.dao;
import java.util.Map;
public interface DmpDevelopTaskDao {
Map getDmpTaskAndTreeInfo(String taskId) throws Exception;
int deleteTaskByTaskId(String taskId) throws Exception;
int deleteNavigationTreeByTreeId(String treeId) throws Exception;
}
......@@ -29,5 +29,5 @@ public interface DmpProjectDao extends CrudDao<DmpProject> {
public List<DmpProjectSystemInfo> getProjectSystemInfo(Long projectId);
DmpProjectSystemInfo queryProjectSystemInfo(@Param("projectId") Integer projectId);
DmpProjectSystemInfo queryProjectSystemInfo(@Param("projectId") Long projectId);
}
package com.jz.dmp.modules.model;
import java.io.Serializable;
import java.util.Date;
/**
* 任务开发(DmpDevelopTask)实体类
*
* @author Bellamy
* @since 2020-12-22 16:37:54
*/
public class DmpDevelopTask implements Serializable {
private static final long serialVersionUID = 492051123327188782L;
/**
* ID
*/
private Integer id;
/**
* 数据源ID
*/
private Integer datasourceId;
/**
* 任务类型
*/
private String taskType;
/**
* 类型
*/
private String type;
/**
* 调度类型
*/
private String scheduleType;
/**
* 是否已提交
*/
private String isSubmit;
/**
* 描述
*/
private String taskDesc;
/**
* 脚本
*/
private Object script;
/**
* 数据状态
*/
private String dataStatus;
/**
* 创建用户ID
*/
private String createUserId;
/**
* 数据创建时间
*/
private Date createTime;
/**
* 创建用户ID
*/
private String updateUserId;
/**
* 数据更新时间
*/
private Date updateTime;
/**
* tree ID
*/
private Integer treeId;
/**
* 校验状态:SUCCEED 成功, FAIL 失败
*/
private String chkResult;
/**
* 同步状态:SUCCEED 成功,FAIL 失败
*/
private String syncResult;
/**
* 最终校验时间
*/
private Date chkTime;
/**
* 最终同步时间
*/
private Date syncTime;
private String flowHeader;
private Object flowJson;
private String version;
private Integer isGziped;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getDatasourceId() {
return datasourceId;
}
public void setDatasourceId(Integer datasourceId) {
this.datasourceId = datasourceId;
}
public String getTaskType() {
return taskType;
}
public void setTaskType(String taskType) {
this.taskType = taskType;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getScheduleType() {
return scheduleType;
}
public void setScheduleType(String scheduleType) {
this.scheduleType = scheduleType;
}
public String getIsSubmit() {
return isSubmit;
}
public void setIsSubmit(String isSubmit) {
this.isSubmit = isSubmit;
}
public String getTaskDesc() {
return taskDesc;
}
public void setTaskDesc(String taskDesc) {
this.taskDesc = taskDesc;
}
public Object getScript() {
return script;
}
public void setScript(Object script) {
this.script = script;
}
public String getDataStatus() {
return dataStatus;
}
public void setDataStatus(String dataStatus) {
this.dataStatus = dataStatus;
}
public String getCreateUserId() {
return createUserId;
}
public void setCreateUserId(String createUserId) {
this.createUserId = createUserId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getUpdateUserId() {
return updateUserId;
}
public void setUpdateUserId(String updateUserId) {
this.updateUserId = updateUserId;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getTreeId() {
return treeId;
}
public void setTreeId(Integer treeId) {
this.treeId = treeId;
}
public String getChkResult() {
return chkResult;
}
public void setChkResult(String chkResult) {
this.chkResult = chkResult;
}
public String getSyncResult() {
return syncResult;
}
public void setSyncResult(String syncResult) {
this.syncResult = syncResult;
}
public Date getChkTime() {
return chkTime;
}
public void setChkTime(Date chkTime) {
this.chkTime = chkTime;
}
public Date getSyncTime() {
return syncTime;
}
public void setSyncTime(Date syncTime) {
this.syncTime = syncTime;
}
public String getFlowHeader() {
return flowHeader;
}
public void setFlowHeader(String flowHeader) {
this.flowHeader = flowHeader;
}
public Object getFlowJson() {
return flowJson;
}
public void setFlowJson(Object flowJson) {
this.flowJson = flowJson;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public Integer getIsGziped() {
return isGziped;
}
public void setIsGziped(Integer isGziped) {
this.isGziped = isGziped;
}
}
\ No newline at end of file
package com.jz.dmp.modules.service;
/**
* 任务开发(DmpDevelopTask)表服务接口
*
* @author Bellamy
* @since 2020-12-22 16:37:56
*/
public interface DmpDevelopTaskService {
}
\ No newline at end of file
......@@ -2,6 +2,8 @@ package com.jz.dmp.modules.service;
import com.jz.common.constant.JsonResult;
import com.jz.common.page.PageInfoResponse;
import com.jz.dmp.modules.controller.DataIntegration.bean.CheckTaskStatusPageDto;
import com.jz.dmp.modules.controller.DataIntegration.bean.CheckTaskStatusPageReq;
import com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageDto;
import com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageReq;
......@@ -24,4 +26,8 @@ public interface OfflineSynchService {
JsonResult querygSourceTableList(Integer sourceDbId, String targetName) throws Exception;
JsonResult taskRunNowByTaskId(String taskId) throws Exception;
JsonResult delTaskByTaskId(String taskId) throws Exception;
JsonResult<List<CheckTaskStatusPageDto>> queryCheckTaskStatusListPage(CheckTaskStatusPageReq checkTaskStatusPageReq) throws Exception;
}
package com.jz.dmp.modules.service.impl;
import com.jz.dmp.modules.dao.DmpDevelopTaskDao;
import com.jz.dmp.modules.service.DmpDevelopTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 任务开发(DmpDevelopTask)表服务实现类
*
* @author Bellamy
* @since 2020-12-22 16:37:56
*/
@Service("dmpDevelopTaskService")
public class DmpDevelopTaskServiceImpl implements DmpDevelopTaskService {
@Autowired
private DmpDevelopTaskDao dmpDevelopTaskDao;
}
\ No newline at end of file
......@@ -12,9 +12,9 @@ import com.jz.common.utils.FileUtils;
import com.jz.common.utils.JsonMapper;
import com.jz.common.utils.ZipUtils;
import com.jz.dmp.agent.DmpAgentResult;
import com.jz.dmp.modules.controller.DataIntegration.bean.SourceDbNameListDto;
import com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageDto;
import com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageReq;
import com.jz.dmp.modules.controller.DataIntegration.bean.*;
import com.jz.dmp.modules.controller.DataIntegration.bean.flow.FlowExecution;
import com.jz.dmp.modules.dao.DmpDevelopTaskDao;
import com.jz.dmp.modules.dao.DmpProjectDao;
import com.jz.dmp.modules.dao.OfflineSynchDao;
import com.jz.dmp.modules.model.DmpAgentDatasourceInfo;
......@@ -53,6 +53,9 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
@Autowired
private DmpProjectDao dmpProjectDao;
@Autowired
private DmpDevelopTaskDao dmpDevelopTaskDao;
@Autowired
private DmpDsAgentService dmpDsAgentServiceImp;
......@@ -74,6 +77,9 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
return pageInfoResponse;
}
/**
* 获取源数据库名称——下拉框
*/
@Override
public JsonResult<List<SourceDbNameListDto>> querygSourceDbList(Integer projectId) throws Exception {
Map map = new HashMap();
......@@ -83,6 +89,9 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
return new JsonResult(ResultCode.SUCCESS, list);
}
/**
* 根据源数据库id,获取源数据表——下拉框
*/
@Override
public JsonResult querygSourceTableList(Integer sourceDbId, String targetName) throws Exception {
//通过源数据库id ,查询数据源配置
......@@ -110,18 +119,25 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
*/
@Override
public JsonResult taskRunNowByTaskId(String taskId) throws Exception {
boolean flag = false;
//根据任务id,查询DMP资源导航树和DW系统配置信息
Map<String,Object> map = offlineSynchDao.selectNavigationTreeByTaskId(taskId);
Map<String, Object> map = offlineSynchDao.selectNavigationTreeByTaskId(taskId);
if (map.size() > 0 && map != null) {
this.publish(map);
flag = this.publish(map);
if (flag) {
return new JsonResult(ResultCode.SUCCESS, flag);
} else {
return new JsonResult(ResultCode.SYS_ERROR, flag);
}
} else {
return new JsonResult(ResultCode.SYS_ERROR, flag);
}
return null;
}
/**
* 发布流程
*/
private boolean publish(Map<String,Object> map) {
private boolean publish(Map<String, Object> map) {
String taskId = map.get("taskId").toString(); //任务id
String projectId = map.get("projectId").toString(); //项目id
String treeName = map.get("treeName").toString(); //流程名称
......@@ -182,4 +198,57 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
return azkabanApiUtils.loginCreateProjectuploadZipAndExecute("jz_localflow_" + projectId, "local_sync_project", localTaskZipAbsolutePath, treeName);
}
/**
* 删除任务
*/
@Override
public JsonResult delTaskByTaskId(String taskId) throws Exception {
//通过taskId,查询任务和资源是否存在
Map map = dmpDevelopTaskDao.getDmpTaskAndTreeInfo(taskId);
if (map.size() == 0 || map == null) {
return new JsonResult(ResultCode.OPERATION_DATA_NO_EXIST);
}
if (StringUtils.isEmpty(map.get("treeId").toString())) {
return new JsonResult(ResultCode.OPERATION_DATA_NO_EXIST);
}
dmpDevelopTaskDao.deleteTaskByTaskId(taskId);
dmpDevelopTaskDao.deleteNavigationTreeByTreeId(map.get("treeId").toString());
return new JsonResult(ResultCode.SUCCESS);
}
@Override
public JsonResult<List<CheckTaskStatusPageDto>> queryCheckTaskStatusListPage(CheckTaskStatusPageReq checkTaskStatusPageReq) throws Exception {
List<FlowExecution> list = new ArrayList<>();
Long projectId = Long.valueOf(checkTaskStatusPageReq.getProjectId());
String treeName = checkTaskStatusPageReq.getTreeName();
DmpProjectSystemInfo publishToProjectSystemInfo = dmpProjectDao.queryProjectSystemInfo(projectId);
//调用azkaban服务
String azkabanApiUrl = publishToProjectSystemInfo.getAzkabanMonitorUrl();
AzkabanApiUtils2 azkabanApiUtils = new AzkabanApiUtils2(azkabanApiUrl);
list = azkabanApiUtils.getSyncingFlowExecution(projectId, treeName, checkTaskStatusPageReq.getPageNum(), checkTaskStatusPageReq.getPageSize());
List<CheckTaskStatusPageDto> returnList = new ArrayList<>();
if (list.size() > 0 && list != null) {
for (FlowExecution str : list) {
CheckTaskStatusPageDto dto = new CheckTaskStatusPageDto();
long endTime = str.getEndTime();
long execId = str.getExecId();
long startTime = str.getStartTime();
String status = str.getStatus();
String submitUser = str.getSubmitUser();
long costTime = endTime - startTime;
dto.setCostTime(costTime);
dto.setExecId(execId);
dto.setStatus(status);
dto.setSubmitUser(submitUser);
returnList.add(dto);
}
}
return new JsonResult(ResultCode.SUCCESS, list);
}
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.jz.dmp.modules.dao.DmpDevelopTaskDao" >
<select id="getDmpTaskAndTreeInfo" parameterType="string" resultType="map">
select
t1.ID as taskId,
t1.TREE_ID as treeId
from dmp_develop_task t1
left join dmp_navigation_tree t2 on t1.TREE_ID=t2.ID
where 1=1 and t1.id = #{taskId}
</select>
<!--根据主键删除任务-->
<delete id="deleteTaskByTaskId" parameterType="string">
delete from dmp_develop_task where id = #{taskId}
</delete>
<!--根据主键删除资源树-->
<delete id="deleteNavigationTreeByTreeId" parameterType="string">
delete from dmp_navigation_tree where id = #{treeId}
</delete>
</mapper>
\ No newline at end of file
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