Commit deb7e862 authored by mcb's avatar mcb

校验状态详情--查看

parent e34416ca
......@@ -634,6 +634,7 @@ public class AzkabanApiUtils2 {
//登录
String sessionId = login();
//String sessionId = "2c2e0af8-e5d4-46be-af55-f708f4447630";
String executeFlowUrl = azkabanServerUrl + "/manager?token=" + sessionId;
Map<String, Object> paramMap = new HashMap<String, Object>();
......
......@@ -119,4 +119,23 @@ public class OfflineSynchController {
JsonResult<List<CheckTaskStatusPageDto>> list = offlineSynchService.queryCheckTaskStatusListPage(checkTaskStatusPageReq);
return list;
}
/**
* 校验状态详情--查看 规则执行结果
*
* @return
*/
@ApiOperation(value = "校验状态详情--查看", notes = "校验状态详情--查看")
@PostMapping(value = "/checkJyStatusInfo")
public PageInfoResponse<CheckJyRlueStatusDto> getCheckStatusInfo(@RequestBody @Validated CheckJyRlueStatusReq checkJyRlueStatusReq) throws Exception {
PageInfoResponse<CheckJyRlueStatusDto> pageInfo = new PageInfoResponse<CheckJyRlueStatusDto>();
try {
pageInfo = offlineSynchService.selectCheckJyStatusInfo(checkJyRlueStatusReq);
} catch (Exception e) {
pageInfo.setMessage("查询失败");
pageInfo.setCode(ResultCode.INTERNAL_SERVER_ERROR);
e.printStackTrace();
}
return pageInfo;
}
}
package com.jz.dmp.modules.controller.DataIntegration.bean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
/**
* @ClassName: CheckJyRlueStatusDto
* @Description: 校验状态详情 --查看(规则执行结果表)
* @Author:Bellamy
* @Date 2020/12/21
* @Version 1.0
*/
@ApiModel(value = "校验状态详情--查看返回参数对象", description = "校验状态详情--查看")
public class CheckJyRlueStatusDto {
/**
* 结果ID
*/
@ApiModelProperty(value = "结果ID")
private Long ruleCheckResultId;
/**
* 执行实例ID
*/
@ApiModelProperty(value = "执行实例ID")
private Long executionId;
/**
* 规则ID
*/
@ApiModelProperty(value = "规则ID")
private Long taskRuleId;
/**
* 校验结果
*/
@ApiModelProperty(value = "校验结果:1 成功, 0失败")
private String vResult;
/**
* 校验描述
*/
@ApiModelProperty(value = "校验描述")
private String resultDesc;
/**
* 源校验值
*/
@ApiModelProperty(value = "源校验值")
private BigDecimal scrChkValue;
/**
* 目标校验值
*/
@ApiModelProperty(value = "目标校验值")
private BigDecimal tgtChkValue;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
private String createTime;
/**
* 创建人
*/
@ApiModelProperty(value = "创建人")
private String createBy;
/**
* 最后更新人
*/
@ApiModelProperty(value = "最后更新人")
private String updateBy;
/**
* 更新时间
*/
@ApiModelProperty(value = "更新时间")
private String updateTime;
/**
* 规则名称
*/
@ApiModelProperty(value = "规则名称")
private String ruleName;
public Long getRuleCheckResultId() {
return ruleCheckResultId;
}
public void setRuleCheckResultId(Long ruleCheckResultId) {
this.ruleCheckResultId = ruleCheckResultId;
}
public Long getExecutionId() {
return executionId;
}
public void setExecutionId(Long executionId) {
this.executionId = executionId;
}
public Long getTaskRuleId() {
return taskRuleId;
}
public void setTaskRuleId(Long taskRuleId) {
this.taskRuleId = taskRuleId;
}
public String getvResult() {
return vResult;
}
public void setvResult(String vResult) {
this.vResult = vResult;
}
public String getResultDesc() {
return resultDesc;
}
public void setResultDesc(String resultDesc) {
this.resultDesc = resultDesc;
}
public BigDecimal getScrChkValue() {
return scrChkValue;
}
public void setScrChkValue(BigDecimal scrChkValue) {
this.scrChkValue = scrChkValue;
}
public BigDecimal getTgtChkValue() {
return tgtChkValue;
}
public void setTgtChkValue(BigDecimal tgtChkValue) {
this.tgtChkValue = tgtChkValue;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
public String getUpdateTime() {
return updateTime;
}
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
}
public String getRuleName() {
return ruleName;
}
public void setRuleName(String ruleName) {
this.ruleName = ruleName;
}
}
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: CheckJyRlueStatusReq
* @Description: 校验状态详情 --查看
* @Author:Bellamy
* @Date 2020/12/21
* @Version 1.0
*/
@ApiModel(value = "校验状态详情--查看请求参数对象", description = "校验状态详情 --查看")
public class CheckJyRlueStatusReq extends BasePageBean {
/*
* 项目ID
* */
@NotNull(message = "执行ID不能为空")
@NotEmpty(message = "执行ID不能空")
@ApiModelProperty(value = "执行ID")
private String executionId;
public String getExecutionId() {
return executionId;
}
public void setExecutionId(String executionId) {
this.executionId = executionId;
}
}
......@@ -29,5 +29,5 @@ public interface DmpProjectDao extends CrudDao<DmpProject> {
public List<DmpProjectSystemInfo> getProjectSystemInfo(Long projectId);
DmpProjectSystemInfo queryProjectSystemInfo(@Param("projectId") Long projectId);
DmpProjectSystemInfo queryProjectSystemInfo(Long projectId);
}
package com.jz.dmp.modules.dao;
import com.jz.dmp.modules.controller.DataIntegration.bean.CheckJyRlueStatusDto;
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;
......@@ -24,5 +25,7 @@ public interface OfflineSynchDao {
DmpAgentDatasourceInfo querySourceDbInfoBySourceId(@Param("sourceDbId") Integer sourceDbId) throws Exception;
Map<String,Object> selectNavigationTreeByTaskId(String taskId) throws Exception;
Map<String, Object> selectNavigationTreeByTaskId(String taskId) throws Exception;
List<CheckJyRlueStatusDto> selectCheckJyStatusInfo(@Param("executionId") String executionId) throws Exception;
}
\ No newline at end of file
......@@ -14,11 +14,11 @@ public class DmpProjectSystemInfo implements Serializable {
/**
* ID
*/
private Integer id;
private Long id;
/**
* 项目ID
*/
private Integer projectId;
private Long projectId;
/**
* 是否启用KERBEROS
*/
......@@ -180,7 +180,7 @@ public class DmpProjectSystemInfo implements Serializable {
/**
* 上传配置的SFTP端口
*/
private Integer shellSftpPort;
private Long shellSftpPort;
/**
* hive元数据地址
*/
......@@ -196,11 +196,11 @@ public class DmpProjectSystemInfo implements Serializable {
/**
* spark_executor_cores
*/
private Integer sparkDefaultExecutorCores;
private Long sparkDefaultExecutorCores;
/**
* spark_total_executor_cores
*/
private Integer sparkDefaultTotalExecutorCores;
private Long sparkDefaultTotalExecutorCores;
/**
* 统计每天离线同步数据量(表级)
*/
......@@ -215,19 +215,19 @@ public class DmpProjectSystemInfo implements Serializable {
private String azkabanExectorShellExportData;
public Integer getId() {
public Long getId() {
return id;
}
public void setId(Integer id) {
public void setId(Long id) {
this.id = id;
}
public Integer getProjectId() {
public Long getProjectId() {
return projectId;
}
public void setProjectId(Integer projectId) {
public void setProjectId(Long projectId) {
this.projectId = projectId;
}
......@@ -559,11 +559,11 @@ public class DmpProjectSystemInfo implements Serializable {
this.kafkaInfluxPassword = kafkaInfluxPassword;
}
public Integer getShellSftpPort() {
public Long getShellSftpPort() {
return shellSftpPort;
}
public void setShellSftpPort(Integer shellSftpPort) {
public void setShellSftpPort(Long shellSftpPort) {
this.shellSftpPort = shellSftpPort;
}
......@@ -591,19 +591,19 @@ public class DmpProjectSystemInfo implements Serializable {
this.sparkDefaultExecutorMemory = sparkDefaultExecutorMemory;
}
public Integer getSparkDefaultExecutorCores() {
public Long getSparkDefaultExecutorCores() {
return sparkDefaultExecutorCores;
}
public void setSparkDefaultExecutorCores(Integer sparkDefaultExecutorCores) {
public void setSparkDefaultExecutorCores(Long sparkDefaultExecutorCores) {
this.sparkDefaultExecutorCores = sparkDefaultExecutorCores;
}
public Integer getSparkDefaultTotalExecutorCores() {
public Long getSparkDefaultTotalExecutorCores() {
return sparkDefaultTotalExecutorCores;
}
public void setSparkDefaultTotalExecutorCores(Integer sparkDefaultTotalExecutorCores) {
public void setSparkDefaultTotalExecutorCores(Long sparkDefaultTotalExecutorCores) {
this.sparkDefaultTotalExecutorCores = sparkDefaultTotalExecutorCores;
}
......
......@@ -2,10 +2,7 @@ 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;
import com.jz.dmp.modules.controller.DataIntegration.bean.*;
import java.util.List;
import java.util.Map;
......@@ -30,4 +27,6 @@ public interface OfflineSynchService {
JsonResult delTaskByTaskId(String taskId) throws Exception;
JsonResult<List<CheckTaskStatusPageDto>> queryCheckTaskStatusListPage(CheckTaskStatusPageReq checkTaskStatusPageReq) throws Exception;
PageInfoResponse<CheckJyRlueStatusDto> selectCheckJyStatusInfo(CheckJyRlueStatusReq checkJyRlueStatusReq) throws Exception;
}
......@@ -24,14 +24,13 @@ import com.jz.dmp.modules.service.OfflineSynchService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* @Description:离线同步服务层
......@@ -215,14 +214,15 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
dmpDevelopTaskDao.deleteNavigationTreeByTreeId(map.get("treeId").toString());
return new JsonResult(ResultCode.SUCCESS);
}
/**
* 任务状态查看,异步调用azkaban服务
*/
@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();
Long projectId = Long.valueOf(checkTaskStatusPageReq.getProjectId()); //项目id
String treeName = checkTaskStatusPageReq.getTreeName(); //任务树名称
DmpProjectSystemInfo publishToProjectSystemInfo = dmpProjectDao.queryProjectSystemInfo(projectId);
//调用azkaban服务
......@@ -230,25 +230,37 @@ public class OfflineSynchServiceImpl implements OfflineSynchService {
AzkabanApiUtils2 azkabanApiUtils = new AzkabanApiUtils2(azkabanApiUrl);
list = azkabanApiUtils.getSyncingFlowExecution(projectId, treeName, checkTaskStatusPageReq.getPageNum(), checkTaskStatusPageReq.getPageSize());
SimpleDateFormat dtf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
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);
dto.setCostTime(endTime - startTime); //耗时
dto.setExecId(str.getExecId()); //任务执行id
dto.setStatus(str.getStatus());
dto.setSubmitUser(str.getSubmitUser());
dto.setEndTime(dtf.format(new Date(endTime))); //结束时间
dto.setStartTime(dtf.format(new Date(startTime))); //开始时间
returnList.add(dto);
}
}
return new JsonResult(ResultCode.SUCCESS, list);
return new JsonResult(ResultCode.SUCCESS, returnList);
}
@Override
public PageInfoResponse<CheckJyRlueStatusDto> selectCheckJyStatusInfo(CheckJyRlueStatusReq checkJyRlueStatusReq) throws Exception {
PageInfoResponse<CheckJyRlueStatusDto> pageInfoResponse = new PageInfoResponse<>();
PageHelper.startPage(checkJyRlueStatusReq.getPageNum(), checkJyRlueStatusReq.getPageSize());
List<CheckJyRlueStatusDto> list = offlineSynchDao.selectCheckJyStatusInfo(checkJyRlueStatusReq.getExecutionId());
PageInfo<CheckJyRlueStatusDto> pageInfo = new PageInfo<>(list);
pageInfoResponse.setCode(ResultCode.SUCCESS);
pageInfoResponse.setMessage("查询成功");
pageInfoResponse.setData(pageInfo);
return pageInfoResponse;
}
}
......@@ -457,7 +457,7 @@
WHERE data_status = '1' and PROJECT_ID = #{projectId}
</select>
<select id="queryProjectSystemInfo" parameterType="java.lang.Integer" resultType="dmpProjectSystemInfo">
<select id="queryProjectSystemInfo" parameterType="java.lang.Long" resultType="dmpProjectSystemInfo">
SELECT
ID,
PROJECT_ID,
......
......@@ -145,4 +145,28 @@
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}
</select>
<!-- 根据执行实例id查询规则执行结果表 -->
<select id="selectCheckJyStatusInfo" parameterType="map" resultType="com.jz.dmp.modules.controller.DataIntegration.bean.CheckJyRlueStatusDto">
SELECT
checkResult.rule_check_result_id as ruleCheckResultId,
checkResult.execution_id as executionId,
checkResult.task_rule_id as taskRuleId,
checkResult.v_result as vResult,
checkResult.result_desc as resultDesc,
checkResult.scr_chk_value as scrChkValue,
checkResult.tgt_chk_value as tgtChkValue,
checkResult.create_by createBy,
checkResult.update_by as updateBy,
DATE_FORMAT(checkResult.update_time,'%Y-%m-%d %H:%i:%s') AS updateTime,
DATE_FORMAT(checkResult.create_time,'%Y-%m-%d %H:%i:%s') AS createTime,
rule.rule_name AS ruleName
FROM dv_rule_check_result_t checkResult
LEFT JOIN dv_task_rule_t taskRule ON checkResult.task_rule_id=taskRule.task_rule_id
LEFT JOIN dv_rule_t rule ON rule.rule_id =taskRule.rule_id
where 1=1
<if test="executionId != null" >
AND checkResult.execution_id = #{executionId,jdbcType=BIGINT}
</if>
</select>
</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