数据质量质量任务检测
parent
220d3a984c
commit
3cb0927e71
|
@ -0,0 +1,40 @@
|
||||||
|
package net.srt.controller;
|
||||||
|
|
||||||
|
import cn.hutool.db.Page;
|
||||||
|
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.QualityTaskColumnQuery;
|
||||||
|
import net.srt.service.QualityTaskColumnService;
|
||||||
|
import net.srt.vo.QualityTaskColumnVo;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @BelongsProject: srt_cloud
|
||||||
|
* @BelongsPackage: net.srt.controller
|
||||||
|
* @Author: jpz
|
||||||
|
* @CreateTime: 2023/12/23 11:19
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/quality-task-column")
|
||||||
|
@Tag(name = "数据治理-列检测模块")
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class QualityTaskColumnController {
|
||||||
|
private final QualityTaskColumnService qualityTaskColumnService;
|
||||||
|
@GetMapping("/page")
|
||||||
|
public Result<PageResult<QualityTaskColumnVo>> page(@Valid QualityTaskColumnQuery query){
|
||||||
|
PageResult<QualityTaskColumnVo> page = qualityTaskColumnService.page(query);
|
||||||
|
return Result.ok(page);
|
||||||
|
}
|
||||||
|
@DeleteMapping
|
||||||
|
@Operation(summary = "删除")
|
||||||
|
public Result<String> delete(@RequestBody List<Long> idlist){
|
||||||
|
qualityTaskColumnService.delete(idlist);
|
||||||
|
return Result.ok();
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,16 +3,17 @@ package net.srt.controller;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import net.srt.convert.QualityTaskTableConvert;
|
||||||
|
import net.srt.entity.QualityTaskTableEntity;
|
||||||
import net.srt.framework.common.page.PageResult;
|
import net.srt.framework.common.page.PageResult;
|
||||||
import net.srt.framework.common.utils.Result;
|
import net.srt.framework.common.utils.Result;
|
||||||
import net.srt.query.QualityTableQuery;
|
import net.srt.query.QualityTableQuery;
|
||||||
import net.srt.service.QualityTaskTableService;
|
import net.srt.service.QualityTaskTableService;
|
||||||
import net.srt.vo.QualityTaskTableVo;
|
import net.srt.vo.QualityTaskTableVo;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @BelongsProject: srt_cloud
|
* @BelongsProject: srt_cloud
|
||||||
|
@ -32,4 +33,16 @@ public class QualityTaskTableController {
|
||||||
PageResult<QualityTaskTableVo> pageResult =qualityTaskTableService.page(query);
|
PageResult<QualityTaskTableVo> pageResult =qualityTaskTableService.page(query);
|
||||||
return Result.ok(pageResult);
|
return Result.ok(pageResult);
|
||||||
}
|
}
|
||||||
|
@GetMapping("{id}")
|
||||||
|
@Operation(summary = "信息")
|
||||||
|
public Result<QualityTaskTableVo> get(@PathVariable("id") Long id){
|
||||||
|
QualityTaskTableEntity entity=qualityTaskTableService.getById(id);
|
||||||
|
return Result.ok(QualityTaskTableConvert.INSTANCE.convert(entity));
|
||||||
|
}
|
||||||
|
@DeleteMapping
|
||||||
|
@Operation(summary = "删除")
|
||||||
|
private Result<String> delete(@RequestBody List<Long> idlist){
|
||||||
|
qualityTaskTableService.delete(idlist);
|
||||||
|
return Result.ok();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
package net.srt.convert;
|
||||||
|
|
||||||
|
import net.srt.entity.QualityQueryEntity;
|
||||||
|
import net.srt.entity.QualityTaskColumnEntity;
|
||||||
|
import net.srt.vo.QualityRuleVo;
|
||||||
|
import net.srt.vo.QualityTaskColumnVo;
|
||||||
|
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/23 11:59
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface QualityTaskColumnConvert {
|
||||||
|
|
||||||
|
|
||||||
|
QualityTaskColumnConvert INSTANCE = Mappers.getMapper(QualityTaskColumnConvert.class);
|
||||||
|
|
||||||
|
|
||||||
|
List<QualityTaskColumnVo> convertList(List<QualityTaskColumnEntity> list);
|
||||||
|
|
||||||
|
QualityTaskColumnEntity conver(QualityTaskColumnVo vo);
|
||||||
|
}
|
|
@ -18,4 +18,6 @@ public interface QualityTaskTableConvert {
|
||||||
QualityTaskTableConvert INSTANCE = Mappers.getMapper(QualityTaskTableConvert.class);
|
QualityTaskTableConvert INSTANCE = Mappers.getMapper(QualityTaskTableConvert.class);
|
||||||
|
|
||||||
List<QualityTaskTableVo> convertList(List<QualityTaskTableEntity> list);
|
List<QualityTaskTableVo> convertList(List<QualityTaskTableEntity> list);
|
||||||
|
|
||||||
|
QualityTaskTableVo convert(QualityTaskTableEntity entity);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,17 @@
|
||||||
package net.srt.dao;
|
package net.srt.dao;
|
||||||
|
|
||||||
|
import net.srt.entity.QualityTaskColumnEntity;
|
||||||
|
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
|
* @BelongsProject: srt_cloud
|
||||||
* @BelongsPackage: net.srt.dao
|
* @BelongsPackage: net.srt.dao
|
||||||
* @Author: jpz
|
* @Author: jpz
|
||||||
* @CreateTime: 2023/12/22 21:37
|
* @CreateTime: 2023/12/22 21:37
|
||||||
*/
|
*/
|
||||||
public interface QualityTaskColumnDao {
|
@Mapper
|
||||||
|
public interface QualityTaskColumnDao extends BaseDao<QualityTaskColumnEntity> {
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
package net.srt.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import net.srt.framework.mybatis.entity.BaseEntity;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @BelongsProject: srt_cloud
|
||||||
|
* @BelongsPackage: net.srt.entity
|
||||||
|
* @Author: jpz
|
||||||
|
* @CreateTime: 2023/12/23 11:32
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper=false)
|
||||||
|
@Data
|
||||||
|
@TableName("data_governance_quality_task_column")
|
||||||
|
public class QualityTaskColumnEntity extends BaseEntity {
|
||||||
|
/**
|
||||||
|
* 质量任务id
|
||||||
|
*/
|
||||||
|
private Long qualityTaskId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表检测记录id
|
||||||
|
*/
|
||||||
|
private Long qualityTaskTableId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 被检测的数据行
|
||||||
|
*/
|
||||||
|
private String checkRow;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 未通过详情
|
||||||
|
*/
|
||||||
|
private String notPassInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测时间
|
||||||
|
*/
|
||||||
|
private Date checkTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 0-不通过 1-通过
|
||||||
|
*/
|
||||||
|
private Integer checkResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id
|
||||||
|
*/
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
private Integer deleted;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
package net.srt.query;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import net.srt.framework.common.query.Query;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @BelongsProject: srt_cloud
|
||||||
|
* @BelongsPackage: net.srt.query
|
||||||
|
* @Author: jpz
|
||||||
|
* @CreateTime: 2023/12/23 11:28
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper =false)
|
||||||
|
@Schema(description = "数据治理-字段检测记录查询")
|
||||||
|
public class QualityTaskColumnQuery extends Query {
|
||||||
|
private Long qualityTaskTableId;
|
||||||
|
private Integer checkResult;
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package net.srt.service;
|
||||||
|
|
||||||
|
import net.srt.entity.QualityTaskColumnEntity;
|
||||||
|
import net.srt.framework.common.page.PageResult;
|
||||||
|
import net.srt.framework.mybatis.service.BaseService;
|
||||||
|
import net.srt.query.QualityTaskColumnQuery;
|
||||||
|
import net.srt.vo.QualityTaskColumnVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @BelongsProject: srt_cloud
|
||||||
|
* @BelongsPackage: net.srt.service
|
||||||
|
* @Author: jpz
|
||||||
|
* @CreateTime: 2023/12/23 11:23
|
||||||
|
*/
|
||||||
|
public interface QualityTaskColumnService extends BaseService<QualityTaskColumnEntity> {
|
||||||
|
PageResult<QualityTaskColumnVo> page(QualityTaskColumnQuery query);
|
||||||
|
|
||||||
|
void delete(List<Long> idlist);
|
||||||
|
}
|
|
@ -6,6 +6,8 @@ import net.srt.framework.mybatis.service.BaseService;
|
||||||
import net.srt.query.QualityTableQuery;
|
import net.srt.query.QualityTableQuery;
|
||||||
import net.srt.vo.QualityTaskTableVo;
|
import net.srt.vo.QualityTaskTableVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @BelongsProject: srt_cloud
|
* @BelongsProject: srt_cloud
|
||||||
* @BelongsPackage: net.srt.service
|
* @BelongsPackage: net.srt.service
|
||||||
|
@ -14,4 +16,6 @@ import net.srt.vo.QualityTaskTableVo;
|
||||||
*/
|
*/
|
||||||
public interface QualityTaskTableService extends BaseService<QualityTaskTableEntity> {
|
public interface QualityTaskTableService extends BaseService<QualityTaskTableEntity> {
|
||||||
PageResult<QualityTaskTableVo> page(QualityTableQuery query);
|
PageResult<QualityTaskTableVo> page(QualityTableQuery query);
|
||||||
|
|
||||||
|
void delete(List<Long> idlist);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
package net.srt.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import net.srt.convert.QualityTaskColumnConvert;
|
||||||
|
import net.srt.dao.QualityTaskColumnDao;
|
||||||
|
import net.srt.entity.QualityTaskColumnEntity;
|
||||||
|
import net.srt.framework.common.page.PageResult;
|
||||||
|
import net.srt.framework.mybatis.service.impl.BaseServiceImpl;
|
||||||
|
import net.srt.query.QualityTaskColumnQuery;
|
||||||
|
import net.srt.service.QualityTaskColumnService;
|
||||||
|
import net.srt.vo.QualityTaskColumnVo;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @BelongsProject: srt_cloud
|
||||||
|
* @BelongsPackage: net.srt.service.impl
|
||||||
|
* @Author: jpz
|
||||||
|
* @CreateTime: 2023/12/23 11:37
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class QualityTaskColumnServiceimpl extends BaseServiceImpl<QualityTaskColumnDao, QualityTaskColumnEntity> implements QualityTaskColumnService {
|
||||||
|
|
||||||
|
private final QualityTaskColumnDao taskColumnDao;
|
||||||
|
@Override
|
||||||
|
public PageResult<QualityTaskColumnVo> page(QualityTaskColumnQuery query) {
|
||||||
|
IPage<QualityTaskColumnEntity> page=baseMapper.selectPage(getPage(query),getWrapper(query));
|
||||||
|
//return new PageResult<>(QualityTaskColumnConvert.INSTANCE.convertList(page.getRecords()),page.getTotal());
|
||||||
|
List<QualityTaskColumnVo> qualityTaskColumnVos = QualityTaskColumnConvert.INSTANCE.convertList(page.getRecords());
|
||||||
|
return new PageResult<>(qualityTaskColumnVos,page.getTotal());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void delete(List<Long> idlist) {
|
||||||
|
for (Long id : idlist) {
|
||||||
|
removeById(id);
|
||||||
|
LambdaQueryWrapper<QualityTaskColumnEntity> wrapper= Wrappers.lambdaQuery();
|
||||||
|
wrapper.eq(QualityTaskColumnEntity::getQualityTaskId,id);
|
||||||
|
taskColumnDao.delete(wrapper);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private LambdaQueryWrapper<QualityTaskColumnEntity> getWrapper(QualityTaskColumnQuery query) {
|
||||||
|
LambdaQueryWrapper<QualityTaskColumnEntity> wrapper= Wrappers.lambdaQuery();
|
||||||
|
wrapper.like(query.getQualityTaskTableId()!=null ,QualityTaskColumnEntity::getQualityTaskTableId,query.getQualityTaskTableId())
|
||||||
|
.eq(query.getCheckResult()!=null,QualityTaskColumnEntity::getCheckResult,query.getCheckResult())
|
||||||
|
.orderByDesc(QualityTaskColumnEntity::getId);
|
||||||
|
|
||||||
|
return wrapper;
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
import net.srt.api.module.data.governance.dto.quality.QulaityColumn;
|
import net.srt.api.module.data.governance.dto.quality.QulaityColumn;
|
||||||
import net.srt.convert.QualityTaskTableConvert;
|
import net.srt.convert.QualityTaskTableConvert;
|
||||||
import net.srt.dao.QualityTaskColumnDao;
|
import net.srt.dao.QualityTaskColumnDao;
|
||||||
|
@ -33,7 +34,8 @@ import java.util.stream.Collectors;
|
||||||
@Service
|
@Service
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class QualityTaskTableServiceimpl extends BaseServiceImpl<QualityTaskTableDao,QualityTaskTableEntity> implements QualityTaskTableService {
|
public class QualityTaskTableServiceimpl extends BaseServiceImpl<QualityTaskTableDao,QualityTaskTableEntity> implements QualityTaskTableService {
|
||||||
|
private final QualityTaskColumnDao taskColumnDao;
|
||||||
|
@SneakyThrows
|
||||||
@Override
|
@Override
|
||||||
public PageResult<QualityTaskTableVo> page(QualityTableQuery query) {
|
public PageResult<QualityTaskTableVo> page(QualityTableQuery query) {
|
||||||
IPage<QualityTaskTableEntity> page=baseMapper.selectPage(getPage(query),getWrapper(query));
|
IPage<QualityTaskTableEntity> page=baseMapper.selectPage(getPage(query),getWrapper(query));
|
||||||
|
@ -44,7 +46,18 @@ public class QualityTaskTableServiceimpl extends BaseServiceImpl<QualityTaskTabl
|
||||||
taskTableVo.setCheckColumns(taskTableVo.getColumnInfo().stream().map(QulaityColumn::getColumnName).collect(Collectors.joining(",")));
|
taskTableVo.setCheckColumns(taskTableVo.getColumnInfo().stream().map(QulaityColumn::getColumnName).collect(Collectors.joining(",")));
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return new PageResult<>(taskTableVos,page.getTotal());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delete(List<Long> idlist) {
|
||||||
|
for (Long id : idlist) {
|
||||||
|
removeById(id);
|
||||||
|
LambdaQueryWrapper<QualityTaskTableEntity> task=Wrappers.lambdaQuery();
|
||||||
|
task.eq(QualityTaskTableEntity::getQualityTaskId,id);
|
||||||
|
baseMapper.delete(task);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private LambdaQueryWrapper<QualityTaskTableEntity> getWrapper(QualityTableQuery query) {
|
private LambdaQueryWrapper<QualityTaskTableEntity> getWrapper(QualityTableQuery query) {
|
||||||
|
|
|
@ -0,0 +1,65 @@
|
||||||
|
package net.srt.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import net.srt.framework.common.utils.DateUtils;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @BelongsProject: srt_cloud
|
||||||
|
* @BelongsPackage: net.srt.vo
|
||||||
|
* @Author: jpz
|
||||||
|
* @CreateTime: 2023/12/23 11:22
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Schema(description = "数据治理-字段检测记录")
|
||||||
|
public class QualityTaskColumnVo implements Serializable {
|
||||||
|
@Schema(description = "主键id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "质量任务id")
|
||||||
|
private Long qualityTaskId;
|
||||||
|
|
||||||
|
@Schema(description = "表检测记录id")
|
||||||
|
private Long qualityTaskTableId;
|
||||||
|
|
||||||
|
@Schema(description = "被检测的数据行")
|
||||||
|
private String checkRow;
|
||||||
|
|
||||||
|
@Schema(description = "未通过详情")
|
||||||
|
private String notPassInfo;
|
||||||
|
|
||||||
|
@Schema(description = "检测时间")
|
||||||
|
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||||
|
private Date checkTime;
|
||||||
|
|
||||||
|
@Schema(description = "0-不通过 1-通过")
|
||||||
|
private Integer checkResult;
|
||||||
|
|
||||||
|
@Schema(description = "项目id")
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
@Schema(description = "版本号")
|
||||||
|
private Integer version;
|
||||||
|
|
||||||
|
@Schema(description = "删除标识 0:正常 1:已删除")
|
||||||
|
private Integer deleted;
|
||||||
|
|
||||||
|
@Schema(description = "创建者")
|
||||||
|
private Long creator;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
@Schema(description = "更新者")
|
||||||
|
private Long updater;
|
||||||
|
|
||||||
|
@Schema(description = "更新时间")
|
||||||
|
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue