Merge remote-tracking branch 'origin/dev' into dev
commit
d52a5c29f3
|
@ -11,12 +11,10 @@ import net.srt.framework.common.utils.Result;
|
||||||
import net.srt.query.QualityTaskQuery;
|
import net.srt.query.QualityTaskQuery;
|
||||||
import net.srt.service.QualityTaskService;
|
import net.srt.service.QualityTaskService;
|
||||||
import net.srt.vo.QualityTaskVo;
|
import net.srt.vo.QualityTaskVo;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
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
|
||||||
|
@ -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.query.QualityTaskQuery;
|
||||||
import net.srt.vo.QualityTaskVo;
|
import net.srt.vo.QualityTaskVo;
|
||||||
|
|
||||||
|
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.QualityTaskVo;
|
||||||
*/
|
*/
|
||||||
public interface QualityTaskService extends BaseService<QualityTaskEntity> {
|
public interface QualityTaskService extends BaseService<QualityTaskEntity> {
|
||||||
PageResult<QualityTaskVo> pagea(QualityTaskQuery query);
|
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.service.QualityTaskService;
|
||||||
import net.srt.vo.QualityTaskVo;
|
import net.srt.vo.QualityTaskVo;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import srt.cloud.framework.dbswitch.common.util.StringUtil;
|
import srt.cloud.framework.dbswitch.common.util.StringUtil;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @BelongsProject: srt_cloud
|
* @BelongsProject: srt_cloud
|
||||||
* @BelongsPackage: net.srt.service.impl
|
* @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());
|
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) {
|
private LambdaQueryWrapper<QualityTaskEntity> getWrapper(QualityTaskQuery query) {
|
||||||
LambdaQueryWrapper<QualityTaskEntity> wrapper= Wrappers.lambdaQuery();
|
LambdaQueryWrapper<QualityTaskEntity> wrapper= Wrappers.lambdaQuery();
|
||||||
wrapper.like(StringUtil.isNotBlank(query.getName()),QualityTaskEntity::getName,query.getName())
|
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;
|
||||||
|
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,13 +1,14 @@
|
||||||
package net.srt.disposition.controller;
|
package net.srt.disposition.controller;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import net.srt.api.module.data.integrate.dto.DataDatabaseDto;
|
||||||
|
import net.srt.disposition.dto.DataProductionTreeDto;
|
||||||
|
import net.srt.disposition.dto.DispositionDto;
|
||||||
import net.srt.disposition.service.DataProductionService;
|
import net.srt.disposition.service.DataProductionService;
|
||||||
import net.srt.disposition.vo.DataProductionTreeVo;
|
import net.srt.disposition.vo.DataProductionTreeVo;
|
||||||
import net.srt.disposition.vo.DispositionVo;
|
import net.srt.disposition.vo.DispositionVo;
|
||||||
import net.srt.framework.common.utils.Result;
|
import net.srt.framework.common.utils.Result;
|
||||||
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 java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -23,4 +24,10 @@ public class DataProductionTreeController {
|
||||||
List<DataProductionTreeVo> dispositionVos=dataProductionService.dataTreeList();
|
List<DataProductionTreeVo> dispositionVos=dataProductionService.dataTreeList();
|
||||||
return Result.ok(dispositionVos);
|
return Result.ok(dispositionVos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
public Result add(@RequestBody DataProductionTreeDto dataProductionTreeDto){
|
||||||
|
dataProductionService.add(dataProductionTreeDto);
|
||||||
|
return Result.ok();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,22 @@
|
||||||
package net.srt.disposition.convert;
|
package net.srt.disposition.convert;
|
||||||
|
|
||||||
|
import net.srt.disposition.dto.DataProductionTreeDto;
|
||||||
import net.srt.disposition.dto.DispositionDto;
|
import net.srt.disposition.dto.DispositionDto;
|
||||||
|
import net.srt.disposition.entity.DataProductionTreeEntity;
|
||||||
import net.srt.disposition.entity.DispositionEntity;
|
import net.srt.disposition.entity.DispositionEntity;
|
||||||
|
import net.srt.disposition.vo.DataProductionTreeVo;
|
||||||
import net.srt.disposition.vo.DispositionVo;
|
import net.srt.disposition.vo.DispositionVo;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface DataProductionTreeConvert {
|
public interface DataProductionTreeConvert {
|
||||||
DataProductionTreeConvert INSTANCE = Mappers.getMapper(DataProductionTreeConvert.class);
|
DataProductionTreeConvert INSTANCE = Mappers.getMapper(DataProductionTreeConvert.class);
|
||||||
DispositionVo convert(DispositionEntity entity);
|
DataProductionTreeVo convert(DataProductionTreeEntity entity);
|
||||||
|
|
||||||
DispositionEntity convert(DispositionDto vo);
|
List<DataProductionTreeVo> convert(List<DataProductionTreeEntity> dataProductionTreeEntities);
|
||||||
|
|
||||||
|
DataProductionTreeEntity convert(DataProductionTreeDto dataProductionTreeDto);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,20 @@
|
||||||
package net.srt.disposition.entity;
|
package net.srt.disposition.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import net.srt.framework.mybatis.entity.BaseEntity;
|
import net.srt.framework.mybatis.entity.BaseEntity;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@TableName("data_production_tree")
|
@TableName("data_production_tree")
|
||||||
public class DataProductionTreeEntity extends BaseEntity {
|
public class DataProductionTreeEntity {
|
||||||
private Long parentId;
|
@TableId("id")
|
||||||
|
private Integer id;
|
||||||
|
private Integer parentId;
|
||||||
private Integer ifLeaf;
|
private Integer ifLeaf;
|
||||||
private Long taskId;
|
private Long taskId;
|
||||||
private String taskType;
|
private String taskType;
|
||||||
|
@ -22,4 +29,8 @@ public class DataProductionTreeEntity extends BaseEntity {
|
||||||
private Boolean builtin;
|
private Boolean builtin;
|
||||||
private String description;
|
private String description;
|
||||||
private Long projectId;
|
private Long projectId;
|
||||||
|
private Integer creator;
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||||
|
private Date createTime;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
package net.srt.disposition.service;
|
package net.srt.disposition.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import net.srt.api.module.data.integrate.dto.DataDatabaseDto;
|
||||||
|
import net.srt.disposition.dto.DataProductionTreeDto;
|
||||||
|
import net.srt.disposition.dto.DispositionDto;
|
||||||
import net.srt.disposition.entity.DataProductionTreeEntity;
|
import net.srt.disposition.entity.DataProductionTreeEntity;
|
||||||
import net.srt.disposition.vo.DataProductionTreeVo;
|
import net.srt.disposition.vo.DataProductionTreeVo;
|
||||||
|
|
||||||
|
@ -9,4 +12,6 @@ import java.util.List;
|
||||||
public interface DataProductionService extends IService<DataProductionTreeEntity> {
|
public interface DataProductionService extends IService<DataProductionTreeEntity> {
|
||||||
List<DataProductionTreeVo> dataTreeList();
|
List<DataProductionTreeVo> dataTreeList();
|
||||||
|
|
||||||
|
void add(DataProductionTreeDto dataProductionTreeDto);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,10 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import net.srt.Fink.entity.FinkEntity;
|
import net.srt.Fink.entity.FinkEntity;
|
||||||
|
import net.srt.api.module.data.integrate.dto.DataDatabaseDto;
|
||||||
|
import net.srt.disposition.convert.DataProductionTreeConvert;
|
||||||
|
import net.srt.disposition.dto.DataProductionTreeDto;
|
||||||
|
import net.srt.disposition.dto.DispositionDto;
|
||||||
import net.srt.disposition.entity.DataProductionTreeEntity;
|
import net.srt.disposition.entity.DataProductionTreeEntity;
|
||||||
import net.srt.disposition.mapper.DataProductionMapper;
|
import net.srt.disposition.mapper.DataProductionMapper;
|
||||||
import net.srt.disposition.service.DataProductionService;
|
import net.srt.disposition.service.DataProductionService;
|
||||||
|
@ -20,19 +24,36 @@ import java.util.List;
|
||||||
public class DataProductionServiceImpl extends BaseServiceImpl<DataProductionMapper, DataProductionTreeEntity> implements DataProductionService {
|
public class DataProductionServiceImpl extends BaseServiceImpl<DataProductionMapper, DataProductionTreeEntity> implements DataProductionService {
|
||||||
@Override
|
@Override
|
||||||
public List<DataProductionTreeVo> dataTreeList() {
|
public List<DataProductionTreeVo> dataTreeList() {
|
||||||
|
ArrayList<DataProductionTreeVo> dataProductionTreeVoArrayList = new ArrayList<>();
|
||||||
List<DataProductionTreeEntity> dataProductionTreeEntities = baseMapper.selectList(null);
|
List<DataProductionTreeEntity> dataProductionTreeEntities = baseMapper.selectList(null);
|
||||||
for (DataProductionTreeEntity dataProductionTreeEntity : dataProductionTreeEntities) {
|
for (DataProductionTreeEntity dataProductionTreeEntity : dataProductionTreeEntities) {
|
||||||
List<DataProductionTreeVo> dataProductionTreeVos=findDataProductTreeVoList(dataProductionTreeEntity);
|
List<DataProductionTreeVo> dataProductionTreeVos=findDataProductTreeVoList(dataProductionTreeEntity);
|
||||||
|
DataProductionTreeVo convert = DataProductionTreeConvert.INSTANCE.convert(dataProductionTreeEntity);
|
||||||
|
convert.setDataProductionTreeVos(dataProductionTreeVos);
|
||||||
|
dataProductionTreeVoArrayList.add(convert);
|
||||||
}
|
}
|
||||||
return null;
|
return dataProductionTreeVoArrayList;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<DataProductionTreeVo> findDataProductTreeVoList(DataProductionTreeEntity dataProductionTreeEntity) {
|
private List<DataProductionTreeVo> findDataProductTreeVoList(DataProductionTreeEntity dataProductionTreeEntity) {
|
||||||
List<DataProductionTreeVo> dataProductionTreeVos=new ArrayList<>();
|
|
||||||
QueryWrapper<DataProductionTreeEntity> dataProductionTreeEntityQueryWrapper = new QueryWrapper<>();
|
QueryWrapper<DataProductionTreeEntity> dataProductionTreeEntityQueryWrapper = new QueryWrapper<>();
|
||||||
dataProductionTreeEntityQueryWrapper.eq("parent_id",dataProductionTreeEntity.getId());
|
dataProductionTreeEntityQueryWrapper.eq("parent_id",dataProductionTreeEntity.getId());
|
||||||
List<DataProductionTreeEntity> dataProductionTreeEntities = baseMapper.selectList(dataProductionTreeEntityQueryWrapper);
|
List<DataProductionTreeEntity> dataProductionTreeEntities = baseMapper.selectList(dataProductionTreeEntityQueryWrapper);
|
||||||
|
List<DataProductionTreeVo> convert = DataProductionTreeConvert.INSTANCE.convert(dataProductionTreeEntities);
|
||||||
return null;
|
return convert;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void add(DataProductionTreeDto dataProductionTreeDto) {
|
||||||
|
DataProductionTreeEntity convert = DataProductionTreeConvert.INSTANCE.convert(dataProductionTreeDto);
|
||||||
|
if (convert.getParentPath()!=null && !convert.getParentPath().equals("")){
|
||||||
|
String path=convert.getParentPath()+"/"+convert.getName();
|
||||||
|
convert.setPath(path);
|
||||||
|
baseMapper.insert(convert);
|
||||||
|
}
|
||||||
|
convert.setLabel(convert.getName());
|
||||||
|
convert.setPath(convert.getName());
|
||||||
|
baseMapper.insert(convert);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,8 @@ import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class DataProductionTreeVo {
|
public class DataProductionTreeVo {
|
||||||
private Long id;
|
private Integer id;
|
||||||
private Long parentId;
|
private Integer parentId;
|
||||||
private Integer ifLeaf;
|
private Integer ifLeaf;
|
||||||
private Long taskId;
|
private Long taskId;
|
||||||
private String taskType;
|
private String taskType;
|
||||||
|
|
Loading…
Reference in New Issue