Commit da644070 authored by mcb's avatar mcb

no message

parent 2e1988ce
package com.jz.dmp.modules.controller.dataOperation;
import com.jz.common.constant.JsonResult;
import com.jz.common.constant.ResultCode;
import com.jz.common.page.PageInfoResponse;
import com.jz.dmp.modules.controller.dataOperation.bean.DataDevTaskListDto;
import com.jz.dmp.modules.controller.dataOperation.bean.DataDevTaskListReq;
import com.jz.dmp.modules.service.DmpDevelopTaskService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
/**
* 数据运维-数据开发实例
*
* @author Bellamy
* @since 2021-01-13 10:56:18
*/
@RestController
@RequestMapping("/dataDevExamples")
@Api(tags = "数据运维-数据开发实例")
public class DmpDevExamplesController {
@Autowired
private DmpDevelopTaskService dmpDevelopTaskService;
/**
* 列表分页查询
*
* @return
* @author Bellamy
* @since 2021-01-05
*/
@ApiOperation(value = "列表分页查询", notes = "列表分页查询")
@PostMapping(value = "/listPage")
public PageInfoResponse<DataDevTaskListDto> getDevTaskListPage(@RequestBody @Validated DataDevTaskListReq req, HttpServletRequest httpRequest) throws Exception {
PageInfoResponse<DataDevTaskListDto> pageInfo = new PageInfoResponse<DataDevTaskListDto>();
if (StringUtils.isEmpty(req.getProjectId())) {
pageInfo.setMessage("项目id不能为空!");
pageInfo.setCode(ResultCode.PARAMS_ERROR);
return pageInfo;
}
try {
pageInfo = dmpDevelopTaskService.queryDevTaskListPage(req);
} catch (Exception e) {
pageInfo.setMessage("查询失败");
pageInfo.setCode(ResultCode.INTERNAL_SERVER_ERROR);
e.printStackTrace();
}
return pageInfo;
}
}
package com.jz.dmp.modules.controller.dataOperation;
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.RealTimeSyncListDto;
......@@ -8,14 +9,12 @@ import com.jz.dmp.modules.controller.dataOperation.bean.DataDevTaskListDto;
import com.jz.dmp.modules.controller.dataOperation.bean.DataDevTaskListReq;
import com.jz.dmp.modules.service.DmpDevelopTaskService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
......@@ -58,4 +57,21 @@ public class DmpDevTaskController {
}
return pageInfo;
}
/**
* 执行任务
*
* @return
* @author Bellamy
*/
@ApiOperation(value = "执行", notes = "执行")
@GetMapping(value = "/runTask")
@ApiImplicitParam(name = "taskId", value = "任务id")
public JsonResult runTaskByTaskId(@RequestParam(value = "taskId") String taskId) throws Exception {
if (StringUtils.isEmpty(taskId)) {
return new JsonResult(ResultCode.PARAMS_ERROR,"任务id不能为空!");
}
JsonResult list = dmpDevelopTaskService.runTaskByTaskId(taskId);
return list;
}
}
......@@ -25,4 +25,12 @@ public interface DmpDevelopTaskService {
* @since 2021-01-13
*/
PageInfoResponse<DataDevTaskListDto> queryDevTaskListPage(DataDevTaskListReq req) throws Exception;
/**
* 数据运维-执行任务
*
* @return
* @author Bellamy
*/
JsonResult runTaskByTaskId(String taskId) throws Exception;
}
\ No newline at end of file
......@@ -18,6 +18,7 @@ import com.jz.dmp.modules.dao.DmpSyncingDatasourceTypeDao;
import com.jz.dmp.modules.model.*;
import com.jz.dmp.modules.service.DmpDevelopTaskService;
import com.jz.dmp.modules.service.DmpSyncingDatasourceService;
import com.jz.dmp.modules.service.OfflineSynchService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -57,6 +58,9 @@ public class DmpDevelopTaskServiceImpl implements DmpDevelopTaskService {
@Autowired
private DmpSyncingDatasourceService dmpSyncingDatasourceService;
@Autowired
private OfflineSynchService offlineSynchService;
/**
* 添加保存dmp数据(包含校验数据)
*
......@@ -733,9 +737,9 @@ public class DmpDevelopTaskServiceImpl implements DmpDevelopTaskService {
Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$");
if (pattern.matcher(req.getTreeIdOrName().trim()).matches()) {
req.setTreeId(req.getTreeIdOrName()); //id
req.setTreeIdOrName(null);
} else {
req.setTreeIdOrName(req.getTreeIdOrName().trim());//节点名称
req.setTreeId(null);
}
}
......@@ -748,4 +752,15 @@ public class DmpDevelopTaskServiceImpl implements DmpDevelopTaskService {
pageInfoResponse.setData(pageInfo);
return pageInfoResponse;
}
/**
* 数据运维-执行任务
*
* @return
* @author Bellamy
*/
@Override
public JsonResult runTaskByTaskId(String taskId) throws Exception {
return offlineSynchService.taskRunNowByTaskId(taskId);
}
}
\ No newline at end of file
......@@ -161,10 +161,10 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
/**
* 发布流程
*/
private boolean publish(Map<String, Object> map) {
private boolean 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(); //流程名称
String treeName = map.get("treeName").toString(); //任务流程名称
String azkabanExectorXmlExec = map.get("azkabanExectorXmlExec").toString(); //执行数据同步任务命令
String azkabanLocalTaskFilePath = map.get("azkabanLocalTaskFilePath").toString(); //文件路径
String azkabanMonitorUrl = map.get("azkabanMonitorUrl").toString();//AZKABAN WEB服务地址
......
......@@ -119,41 +119,23 @@
<!--数据运维-数据开发任务列表分页查询-->
<select id="queryDevTaskListPage" resultType="com.jz.dmp.modules.controller.dataOperation.bean.DataDevTaskListDto"
parameterType="com.jz.dmp.modules.controller.dataOperation.bean.DataDevTaskListReq">
select
a.*,
b.real_name as userName
from(
select
t1.id as taskId,
t1.name as taskName,
t1.type,
t1.create_user_id as createUserId,
date_format(t1.create_time,'%Y-%m-%d %H:%i:%s') as createTime,
date_format(t1.update_time,'%Y-%m-%d %H:%i:%s') as updateTime
from
dmp_navigation_tree t1
left join dmp_develop_task t2 on t2.TREE_ID=t1.ID
where 1=1
and t1.project_id = #{projectId}
union all
select
t1.id as taskId,
t1.name as taskName,
t1.type,
t1.create_user_id as createUserId,
t1.create_time as createTime,
t1.update_time as updateTime
date_format(t1.update_time,'%Y-%m-%d %H:%i:%s') as updateTime,
t3.real_name as userName
from
dmp_navigation_tree t1
left join dmp_develop_task t2 on t2.TREE_ID=t1.ID
where 1=1
left join dmp_member t3 on t1.create_user_id=t3.user_id
where 1=1 and t1.type='01'
and t1.project_id = #{projectId}
) a
left join dmp_member b on a.createUserId=b.user_id
where 1=1
<if test="treeId != null and treeId != ''"> and a.taskId =#{treeId} </if>
<if test="treeIdOrName != null and treeIdOrName != ''"> and a.taskName like concat('%',#{treeIdOrName},'%') </if>
<if test="taskType != null and taskType!= ''"> and a.type=#{taskType} </if>
<if test="treeId != null and treeId != ''"> and t1.id =#{treeId} </if>
<if test="treeIdOrName != null and treeIdOrName != ''"> and t1.name like concat('%',#{treeIdOrName},'%') </if>
<if test="taskType != null and taskType!= ''"> and t1.type=#{taskType} </if>
</select>
</mapper>
\ No newline at end of file
......@@ -142,9 +142,9 @@
t3.AZKABAN_LOCAL_TASK_FILE_PATH as azkabanLocalTaskFilePath,
t3.AZKABAN_MONITOR_URL as azkabanMonitorUrl
from dmp_develop_task t1
left join dmp_navigation_tree t2 on t1.TREE_ID=t2.ID
inner join dmp_navigation_tree t2 on t1.TREE_ID=t2.ID
left join dmp_project_system_info t3 on t2.PROJECT_ID=t3.PROJECT_ID and t3.data_status = '1'
where 1=1 and t1.id = #{taskId}
where 1=1 and t2.id = #{taskId}
</select>
<!-- 根据执行实例id查询规则执行结果表 -->
......
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