数据质量检测操作
parent
5095d6caf1
commit
220d3a984c
|
@ -11,12 +11,10 @@ import net.srt.framework.common.utils.Result;
|
|||
import net.srt.query.QualityTaskQuery;
|
||||
import net.srt.service.QualityTaskService;
|
||||
import net.srt.vo.QualityTaskVo;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @BelongsProject: srt_cloud
|
||||
|
@ -44,4 +42,12 @@ public class QualityTaskController {
|
|||
}
|
||||
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
public Result<String> delete(@RequestBody List<Long> idList){
|
||||
qualityTaskService.delete(idList);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package net.srt.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.common.utils.Result;
|
||||
import net.srt.query.QualityTableQuery;
|
||||
import net.srt.service.QualityTaskTableService;
|
||||
import net.srt.vo.QualityTaskTableVo;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* @BelongsProject: srt_cloud
|
||||
* @BelongsPackage: net.srt.controller
|
||||
* @Author: jpz
|
||||
* @CreateTime: 2023/12/22 19:34
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/quality-task-table")
|
||||
@Tag(name = "数据治理-表检测模块")
|
||||
@AllArgsConstructor
|
||||
public class QualityTaskTableController {
|
||||
private final QualityTaskTableService qualityTaskTableService;
|
||||
@GetMapping("page")
|
||||
@Operation(summary = "分页")
|
||||
public Result<PageResult<QualityTaskTableVo>> page(@Valid QualityTableQuery query){
|
||||
PageResult<QualityTaskTableVo> pageResult =qualityTaskTableService.page(query);
|
||||
return Result.ok(pageResult);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package net.srt.convert;
|
||||
|
||||
import net.srt.entity.QualityTaskTableEntity;
|
||||
import net.srt.vo.QualityTaskTableVo;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @BelongsProject: srt_cloud
|
||||
* @BelongsPackage: net.srt.convert
|
||||
* @Author: jpz
|
||||
* @CreateTime: 2023/12/22 20:49
|
||||
*/
|
||||
@Mapper
|
||||
public interface QualityTaskTableConvert {
|
||||
QualityTaskTableConvert INSTANCE = Mappers.getMapper(QualityTaskTableConvert.class);
|
||||
|
||||
List<QualityTaskTableVo> convertList(List<QualityTaskTableEntity> list);
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package net.srt.dao;
|
||||
|
||||
/**
|
||||
* @BelongsProject: srt_cloud
|
||||
* @BelongsPackage: net.srt.dao
|
||||
* @Author: jpz
|
||||
* @CreateTime: 2023/12/22 21:37
|
||||
*/
|
||||
public interface QualityTaskColumnDao {
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package net.srt.dao;
|
||||
|
||||
import net.srt.entity.QualityTaskEntity;
|
||||
import net.srt.entity.QualityTaskTableEntity;
|
||||
import net.srt.framework.mybatis.dao.BaseDao;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @BelongsProject: srt_cloud
|
||||
* @BelongsPackage: net.srt.dao
|
||||
* @Author: jpz
|
||||
* @CreateTime: 2023/12/22 20:18
|
||||
*/
|
||||
@Mapper
|
||||
public interface QualityTaskTableDao extends BaseDao<QualityTaskTableEntity> {
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
package net.srt.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import net.srt.api.module.data.governance.dto.quality.QulaityColumn;
|
||||
import net.srt.framework.mybatis.entity.BaseEntity;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @BelongsProject: srt_cloud
|
||||
* @BelongsPackage: net.srt.entity
|
||||
* @Author: jpz
|
||||
* @CreateTime: 2023/12/22 20:03
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Data
|
||||
@TableName(value = "data_governance_quality_task_table", autoResultMap = true)
|
||||
public class QualityTaskTableEntity extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 质量任务id
|
||||
*/
|
||||
private Long qualityTaskId;
|
||||
|
||||
/**
|
||||
* 被检测的表id
|
||||
*/
|
||||
private Long tableMetadataId;
|
||||
|
||||
/**
|
||||
* 被检测的表
|
||||
*/
|
||||
private String tableName;
|
||||
|
||||
|
||||
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||
private List<QulaityColumn> columnInfo;
|
||||
/**
|
||||
* 检测条数
|
||||
*/
|
||||
private Integer checkCount;
|
||||
|
||||
/**
|
||||
* 检测通过数
|
||||
*/
|
||||
private Integer passCount;
|
||||
|
||||
/**
|
||||
* 未通过数
|
||||
*/
|
||||
private Integer notPassCount;
|
||||
|
||||
/**
|
||||
* 检测时间
|
||||
*/
|
||||
private Date checkTime;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
private Date startTime;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
private Date endTime;
|
||||
|
||||
|
||||
private String errorLog;
|
||||
|
||||
|
||||
/**
|
||||
* 运行状态( 1-等待中 2-运行中 3-正常结束 4-异常结束)
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
private Integer deleted;
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package net.srt.query;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import net.srt.framework.common.query.Query;
|
||||
import net.srt.framework.common.utils.DateUtils;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @BelongsProject: srt_cloud
|
||||
* @BelongsPackage: net.srt.query
|
||||
* @Author: jpz
|
||||
* @CreateTime: 2023/12/22 19:57
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "数据治理-表检测记录查询")
|
||||
public class QualityTableQuery extends Query {
|
||||
private Long qualityTaskId;
|
||||
private String tableName;
|
||||
private Integer status;
|
||||
@DateTimeFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
private Date startTime;
|
||||
|
||||
@DateTimeFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
private Date endTime;
|
||||
}
|
|
@ -6,6 +6,8 @@ import net.srt.framework.mybatis.service.BaseService;
|
|||
import net.srt.query.QualityTaskQuery;
|
||||
import net.srt.vo.QualityTaskVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @BelongsProject: srt_cloud
|
||||
* @BelongsPackage: net.srt.service
|
||||
|
@ -14,4 +16,6 @@ import net.srt.vo.QualityTaskVo;
|
|||
*/
|
||||
public interface QualityTaskService extends BaseService<QualityTaskEntity> {
|
||||
PageResult<QualityTaskVo> pagea(QualityTaskQuery query);
|
||||
|
||||
void delete(List<Long> idList);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package net.srt.service;
|
||||
|
||||
import net.srt.entity.QualityTaskTableEntity;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.mybatis.service.BaseService;
|
||||
import net.srt.query.QualityTableQuery;
|
||||
import net.srt.vo.QualityTaskTableVo;
|
||||
|
||||
/**
|
||||
* @BelongsProject: srt_cloud
|
||||
* @BelongsPackage: net.srt.service
|
||||
* @Author: jpz
|
||||
* @CreateTime: 2023/12/22 20:00
|
||||
*/
|
||||
public interface QualityTaskTableService extends BaseService<QualityTaskTableEntity> {
|
||||
PageResult<QualityTaskTableVo> page(QualityTableQuery query);
|
||||
}
|
|
@ -17,8 +17,11 @@ import net.srt.query.QualityTaskQuery;
|
|||
import net.srt.service.QualityTaskService;
|
||||
import net.srt.vo.QualityTaskVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import srt.cloud.framework.dbswitch.common.util.StringUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @BelongsProject: srt_cloud
|
||||
* @BelongsPackage: net.srt.service.impl
|
||||
|
@ -35,6 +38,12 @@ public class QualityTaskServiceimpl extends BaseServiceImpl<QualityTaskDao, Qual
|
|||
return new PageResult<>(QualityTaskConvert.INSTANCE.covertList(page.getRecords()),page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete(List<Long> idList) {
|
||||
removeByIds(idList);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<QualityTaskEntity> getWrapper(QualityTaskQuery query) {
|
||||
LambdaQueryWrapper<QualityTaskEntity> wrapper= Wrappers.lambdaQuery();
|
||||
wrapper.like(StringUtil.isNotBlank(query.getName()),QualityTaskEntity::getName,query.getName())
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
package net.srt.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import lombok.AllArgsConstructor;
|
||||
import net.srt.api.module.data.governance.dto.quality.QulaityColumn;
|
||||
import net.srt.convert.QualityTaskTableConvert;
|
||||
import net.srt.dao.QualityTaskColumnDao;
|
||||
import net.srt.dao.QualityTaskDao;
|
||||
import net.srt.dao.QualityTaskTableDao;
|
||||
import net.srt.entity.QualityTaskTableEntity;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.mybatis.service.impl.BaseServiceImpl;
|
||||
import net.srt.query.QualityTableQuery;
|
||||
import net.srt.service.QualityTaskTableService;
|
||||
import net.srt.vo.QualityTaskTableVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
import srt.cloud.framework.dbswitch.common.util.SingletonObject;
|
||||
import srt.cloud.framework.dbswitch.common.util.StringUtil;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @BelongsProject: srt_cloud
|
||||
* @BelongsPackage: net.srt.service.impl
|
||||
* @Author: jpz
|
||||
* @CreateTime: 2023/12/22 20:09
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class QualityTaskTableServiceimpl extends BaseServiceImpl<QualityTaskTableDao,QualityTaskTableEntity> implements QualityTaskTableService {
|
||||
|
||||
@Override
|
||||
public PageResult<QualityTaskTableVo> page(QualityTableQuery query) {
|
||||
IPage<QualityTaskTableEntity> page=baseMapper.selectPage(getPage(query),getWrapper(query));
|
||||
List<QualityTaskTableVo> taskTableVos= QualityTaskTableConvert.INSTANCE.convertList(page.getRecords());
|
||||
for (QualityTaskTableVo taskTableVo : taskTableVos) { taskTableVo.setColumnInfo(SingletonObject.OBJECT_MAPPER.readValue(SingletonObject.OBJECT_MAPPER.writeValueAsString(taskTableVo.getColumnInfo()), new TypeReference<List<QulaityColumn>>() {
|
||||
}));
|
||||
|
||||
taskTableVo.setCheckColumns(taskTableVo.getColumnInfo().stream().map(QulaityColumn::getColumnName).collect(Collectors.joining(",")));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<QualityTaskTableEntity> getWrapper(QualityTableQuery query) {
|
||||
LambdaQueryWrapper<QualityTaskTableEntity> wrapper= Wrappers.lambdaQuery();
|
||||
wrapper.like(query.getQualityTaskId()!=null,QualityTaskTableEntity::getQualityTaskId,query.getQualityTaskId())
|
||||
.like(StringUtil.isNotBlank(query.getTableName()),QualityTaskTableEntity::getTableName,query.getTableName())
|
||||
.eq(query.getStatus()!=null,QualityTaskTableEntity::getStatus,query.getStatus())
|
||||
.ge(query.getStartTime()!=null,QualityTaskTableEntity::getStartTime,query.getStartTime())
|
||||
.le(query.getEndTime()!=null,QualityTaskTableEntity::getEndTime,query.getEndTime())
|
||||
.orderByDesc(QualityTaskTableEntity::getId);
|
||||
return wrapper;
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
package net.srt.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import net.srt.api.module.data.governance.dto.quality.QulaityColumn;
|
||||
import net.srt.framework.common.utils.DateUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @BelongsProject: srt_cloud
|
||||
* @BelongsPackage: net.srt.vo
|
||||
* @Author: jpz
|
||||
* @CreateTime: 2023/12/22 19:39
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "数据治理-表检测记录表")
|
||||
public class QualityTaskTableVo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Schema(description = "主键id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "质量任务id")
|
||||
private Long qualityTaskId;
|
||||
|
||||
@Schema(description = "被检测id")
|
||||
private Long tableMetadataId;
|
||||
|
||||
|
||||
@Schema(description = "被检测的表")
|
||||
private String tableName;
|
||||
|
||||
@Schema(description = "被检测字段的id")
|
||||
private List<QulaityColumn> columnInfo;
|
||||
|
||||
@Schema(description = "检测条数")
|
||||
private Integer checkCount;
|
||||
|
||||
@Schema(description = "检测通过条数")
|
||||
private Integer passCount;
|
||||
|
||||
@Schema(description = "未通过条数")
|
||||
private Integer notPassCount;
|
||||
|
||||
@Schema(description = "检测时间")
|
||||
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
private Date checkTime;
|
||||
|
||||
@Schema(description = "开始时间")
|
||||
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
private Date startTime;
|
||||
|
||||
@Schema(description = "结束时间")
|
||||
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
private Date endTime;
|
||||
|
||||
@Schema(description = "错误日志")
|
||||
private String errrorLog;
|
||||
|
||||
@Schema(description = "运行状态( 1-等待中 2-运行中 3-正常结束 4-异常结束)")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "项目id")
|
||||
private Integer projectId;
|
||||
|
||||
@Schema(description = "版本号")
|
||||
private Integer version;
|
||||
|
||||
@Schema(description = "创建者")
|
||||
private Integer creator;
|
||||
|
||||
@Schema(description = "更新者")
|
||||
private Integer updater;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
private Date createTime;
|
||||
|
||||
@Schema(description = "更新时间")
|
||||
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
private Date updateTime;
|
||||
|
||||
@Schema(description = "删除标识(0:正常 1:已删除)")
|
||||
private Integer deleted;
|
||||
|
||||
private String checkColumns;
|
||||
}
|
Loading…
Reference in New Issue