Commit f621ee75 authored by sml's avatar sml

代码提交

parent 1e9b432d
......@@ -460,7 +460,7 @@ public class AzkabanApiUtils2 {
* @param projectDesc 项目描述
* @param uploadZipPath 上传zip包的全路径
*/
public boolean loginCreateProjectuploadZipAndExecute(String projectName, String projectDesc, String uploadZipPath, String flowName) {
public Integer loginCreateProjectuploadZipAndExecute(String projectName, String projectDesc, String uploadZipPath, String flowName) {
//登录
String sessionId = login();
......@@ -469,12 +469,12 @@ public class AzkabanApiUtils2 {
Map<String, Object> map = uploadZip(sessionId, projectName, uploadZipPath);
if (map.containsKey("error")) {
return false;
return null;
}
//立即执行
executeFlow(sessionId, projectName, flowName);
Integer execId = executeFlow(sessionId, projectName, flowName);
return true;
return execId;
}
/**
......
......@@ -170,18 +170,18 @@ public class DmpDevelopTaskController {
@RequestMapping(method = RequestMethod.GET, value = "/taskAzkabanRun")
@ApiOperation(value = "任务立即运行接口", notes = "任务立即运行接口")
@ApiImplicitParam(name = "treeId", value = "任务树主键")
public BaseResponse taskAzkabanRun(@RequestParam(value = "treeId", required = true) Long treeId, HttpServletRequest httpRequest){
BaseResponse baseResponse = new BaseResponse();
public BaseBeanResponse<Integer> taskAzkabanRun(@RequestParam(value = "treeId", required = true) Long treeId, HttpServletRequest httpRequest){
BaseBeanResponse<Integer> baseBeanResponse = new BaseBeanResponse<Integer>();
try {
baseResponse = dmpDevelopTaskService.taskAzkabanRun(treeId, httpRequest);
baseBeanResponse = dmpDevelopTaskService.taskAzkabanRun(treeId, httpRequest);
} catch (Exception e) {
baseResponse.setMessage("任务运行失败");
baseResponse.setCode(StatuConstant.FAILURE_CODE);
baseBeanResponse.setMessage("任务运行失败");
baseBeanResponse.setCode(StatuConstant.FAILURE_CODE);
e.printStackTrace();
}
return baseResponse;
return baseBeanResponse;
}
/**任务立即运行停止
......
......@@ -118,12 +118,12 @@ public interface DmpDevelopTaskService {
* @param @param httpRequest
* @param @return
* @param @throws Exception 参数
* @return BaseResponse 返回类型
* @return BaseBeanResponse 返回类型
* @throws
* @Title: taskAzkabanRun
* @Description: TODO(运行任务)
*/
public BaseResponse taskAzkabanRun(Long treeId, HttpServletRequest httpRequest) throws Exception;
public BaseBeanResponse<Integer> taskAzkabanRun(Long treeId, HttpServletRequest httpRequest) throws Exception;
/**
* @param @param treeId
......
......@@ -1445,29 +1445,30 @@ public class DmpDevelopTaskServiceImpl extends BaseService implements DmpDevelop
* 运行任务
*/
@Override
public BaseResponse taskAzkabanRun(Long treeId, HttpServletRequest httpRequest) throws Exception {
public BaseBeanResponse<Integer> taskAzkabanRun(Long treeId, HttpServletRequest httpRequest) throws Exception {
BaseResponse baseResponse = new BaseResponse();
BaseBeanResponse<Integer> baseBeanResponse = new BaseBeanResponse<Integer>();
DmpDevelopTask developTask = dmpDevelopTaskDao.get(treeId);
//先发布任务
boolean flag = publishAndExecute(developTask);
Integer execId = publishAndExecute(developTask);
if (flag) {
baseResponse.setCode(StatuConstant.SUCCESS_CODE);
baseResponse.setMessage("立即运行成功");
if (execId!=null) {
baseBeanResponse.setCode(StatuConstant.SUCCESS_CODE);
baseBeanResponse.setMessage("立即运行成功");
baseBeanResponse.setData(execId);
} else {
baseResponse.setCode(StatuConstant.FAILURE_CODE);
baseResponse.setMessage("立即运行失败");
baseBeanResponse.setCode(StatuConstant.FAILURE_CODE);
baseBeanResponse.setMessage("立即运行失败");
}
return baseResponse;
return baseBeanResponse;
}
/**
* 发布流程
*/
private boolean publishAndExecute(DmpDevelopTask dmpDevelopTask) throws Exception {
private Integer publishAndExecute(DmpDevelopTask dmpDevelopTask) throws Exception {
Integer taskId = dmpDevelopTask.getId(); //任务id
Integer projectId = dmpDevelopTask.getProjectId(); //项目id
String treeName = dmpDevelopTask.getName(); //任务流程名称
......
......@@ -171,7 +171,11 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
//根据任务id,查询DMP资源导航树和DW系统配置信息
Map<String, Object> map = offlineSynchDao.selectNavigationTreeByTaskId(taskId);
if (map.size() > 0 && map != null) {
flag = this.publish(map);
Integer execId = this.publish(map);
if (execId!=null) {
flag = true;
}
if (flag) {
return new JsonResult(ResultCode.SUCCESS, flag);
} else {
......@@ -185,7 +189,7 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
/**
* 发布流程
*/
private boolean publish(Map<String, Object> map) throws Exception {
private Integer publish(Map<String, Object> map) throws Exception {
String taskId = map.get("taskId").toString(); //任务id
String projectId = map.get("projectId").toString(); //项目id
String treeName = map.get("treeName").toString(); //任务流程名称
......
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