Commit 14910f3f authored by mcb's avatar mcb

commit

parent c87590f0
...@@ -152,4 +152,29 @@ public class DmpDevTaskController { ...@@ -152,4 +152,29 @@ public class DmpDevTaskController {
} }
return result; return result;
} }
/**
* 获取 flowId/任务名称
*
* @return
* @author Bellamy
* @since 2021-03-08
*/
@ApiOperation(value = "设置SLA--获取flowId/任务名称", notes = "获取flowId/任务名称")
@GetMapping(value = "/getTaskFlowId")
@ApiImplicitParam(name = "projectId", value = "projectId", required = true)
public JsonResult getTaskFlowId(@RequestParam String projectId) throws Exception {
if (StringUtils.isEmpty(projectId)) {
return new JsonResult(ResultCode.PARAMS_ERROR, "projectId不能为空!");
}
JsonResult result = new JsonResult();
try {
result = dmpDevelopTaskService.getTaskFlowId(projectId);
} catch (Exception e) {
result.setMessage("failed");
result.setCode(ResultCode.INTERNAL_SERVER_ERROR);
e.printStackTrace();
}
return result;
}
} }
...@@ -122,4 +122,13 @@ public interface DmpNavigationTreeDao { ...@@ -122,4 +122,13 @@ public interface DmpNavigationTreeDao {
* @Date 2021/02/03 * @Date 2021/02/03
*/ */
int deleteByTreeId(Map params) throws Exception; int deleteByTreeId(Map params) throws Exception;
/**
* 获取 flowId/任务名称
*
* @return
* @author Bellamy
* @since 2021-03-08
*/
List<Map> queryTaskFlowId(String projectId) throws Exception;
} }
\ No newline at end of file
...@@ -215,4 +215,13 @@ public interface DmpDevelopTaskService { ...@@ -215,4 +215,13 @@ public interface DmpDevelopTaskService {
* @since 2021-03-08 * @since 2021-03-08
*/ */
JsonResult getSlaInfo(String scheduleId, String projectId) throws Exception; JsonResult getSlaInfo(String scheduleId, String projectId) throws Exception;
/**
* 获取 flowId/任务名称
*
* @return
* @author Bellamy
* @since 2021-03-08
*/
JsonResult getTaskFlowId(String projectId) throws Exception;
} }
\ No newline at end of file
...@@ -822,22 +822,33 @@ public class DmpDevelopTaskServiceImpl extends BaseService implements DmpDevelop ...@@ -822,22 +822,33 @@ public class DmpDevelopTaskServiceImpl extends BaseService implements DmpDevelop
for (Map strFlow : flowList) { for (Map strFlow : flowList) {
String projectId = String.valueOf(strFlow.get("projectId")); String projectId = String.valueOf(strFlow.get("projectId"));
String flowId = String.valueOf(strFlow.get("taskName")); String flowId = String.valueOf(strFlow.get("taskName"));
//获取调度配置
Map responseData = (Map) JSONObject.parse(azkabanApiUtils.getSchedule(projectId, flowId)); Map responseData = (Map) JSONObject.parse(azkabanApiUtils.getSchedule(projectId, flowId));
if (responseData != null && responseData.size() > 0) { if (responseData != null && responseData.size() > 0) {
Map schedule = (Map) responseData.get("schedule"); Map schedule = (Map) responseData.get("schedule");
strFlow.put("scheduleId",schedule.get("scheduleId")); strFlow.put("scheduleId", schedule.get("scheduleId"));
strFlow.put("cronExpression",schedule.get("cronExpression")); strFlow.put("cronExpression", schedule.get("cronExpression")); //调度周期
//获取sla 是否已配置 状态
if (null == schedule.get("scheduleId")) {
strFlow.put("slaStatus", "N");
} else {
JsonResult jsonResult = getSlaInfo(String.valueOf(schedule.get("scheduleId")), "");
Map s = (Map) jsonResult.getData();
if (s.size() > 0 && s != null) {
strFlow.put("slaStatus", "Y");
}
}
} }
} }
if (flowList.size() > 0 && flowList != null) { if (flowList.size() > 0 && flowList != null) {
for (DataDevTaskListDto str : listObj) { for (DataDevTaskListDto str : listObj) {
for (Map strFlow : flowList) { for (Map strFlow : flowList) {
if (str.getTaskName().equals(strFlow.get("taskName"))) { if (str.getTaskName().equals(strFlow.get("taskName"))) {
str.setStatus(String.valueOf(strFlow.get("status"))); str.setStatus(String.valueOf(strFlow.get("status"))); //实例执行最后状态
if(null != strFlow.get("cronExpression")){ if (null != strFlow.get("cronExpression")) { //调度周期
str.setSchedulinCycle(String.valueOf(strFlow.get("cronExpression"))); str.setSchedulinCycle(String.valueOf(strFlow.get("cronExpression")));
} }
if(null != strFlow.get("scheduleId")){ if (null != strFlow.get("scheduleId")) {
str.setScheduleId(String.valueOf(strFlow.get("scheduleId"))); str.setScheduleId(String.valueOf(strFlow.get("scheduleId")));
} }
} }
...@@ -1754,4 +1765,17 @@ public class DmpDevelopTaskServiceImpl extends BaseService implements DmpDevelop ...@@ -1754,4 +1765,17 @@ public class DmpDevelopTaskServiceImpl extends BaseService implements DmpDevelop
return JsonResult.ok(JSONObject.parse(azkabanApiUtils.getSlaInfo(scheduleId))); return JsonResult.ok(JSONObject.parse(azkabanApiUtils.getSlaInfo(scheduleId)));
} }
/**
* 获取 flowId/任务名称
*
* @return
* @author Bellamy
* @since 2021-03-08
*/
@Override
public JsonResult getTaskFlowId(String projectId) throws Exception {
List<Map> list = dmpNavigationTreeDao.queryTaskFlowId(projectId);
return JsonResult.ok(list);
}
} }
\ No newline at end of file
...@@ -308,4 +308,15 @@ ...@@ -308,4 +308,15 @@
and t1.parent_id = #{parentId} and t1.parent_id = #{parentId}
</select> </select>
<select id="queryTaskFlowId" resultType="java.util.Map">
SELECT
id,
name
FROM
dmp_navigation_tree
WHERE
1 = 1 AND DATA_STATUS = '1' AND IS_LEVEL = '1' AND type != '02'
and project_id = #{projectId}
</select>
</mapper> </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