最新一版8.0
commit
fdc6b39872
|
@ -0,0 +1,88 @@
|
|||
package net.srt.api.module.data.governance;
|
||||
|
||||
import net.srt.api.ServerNames;
|
||||
import net.srt.api.module.data.governance.dto.DataGovernanceMetadataCollectDto;
|
||||
import net.srt.api.module.data.governance.dto.DataGovernanceMetadataCollectRecordDto;
|
||||
import net.srt.api.module.data.governance.dto.DataGovernanceMetadataDto;
|
||||
import net.srt.api.module.data.governance.dto.DataGovernanceMetadataPropertyDto;
|
||||
import net.srt.framework.common.utils.Result;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName DataAccessApi
|
||||
* @Author zrx
|
||||
* @Date 2022/10/26 11:39
|
||||
*/
|
||||
@FeignClient(name = ServerNames.DATA_GOVERNANCE_NAME, contextId = "data-governance-metadata-collect")
|
||||
public interface DataMetadataCollectApi {
|
||||
/**
|
||||
* 根据id获取采集任务
|
||||
*/
|
||||
@GetMapping(value = "api/data/governance/metadata-collect/{id}")
|
||||
Result<DataGovernanceMetadataCollectDto> getById(@PathVariable Long id);
|
||||
|
||||
/**
|
||||
* 根据id获取采集任务
|
||||
*/
|
||||
@PostMapping(value = "api/data/governance/metadata-collect-record")
|
||||
DataGovernanceMetadataCollectRecordDto addCollectRecord(@RequestBody DataGovernanceMetadataCollectRecordDto collectRecordDto);
|
||||
|
||||
/**
|
||||
* 根据id获取采集任务
|
||||
*/
|
||||
@PutMapping(value = "api/data/governance/metadata-collect-record")
|
||||
void upCollectRecord(@RequestBody DataGovernanceMetadataCollectRecordDto collectRecordDto);
|
||||
|
||||
/**
|
||||
* 根据父级id和数据源id获取
|
||||
*/
|
||||
@GetMapping(value = "api/data/governance/metadata/datasource")
|
||||
Result<DataGovernanceMetadataDto> getByParentIdAndDatasourceId(@RequestParam Long parnetId, @RequestParam Long datasourceId);
|
||||
|
||||
/**
|
||||
* 根据父级id和数据源id获取
|
||||
*/
|
||||
@GetMapping(value = "api/data/governance/metadata/info")
|
||||
Result<DataGovernanceMetadataDto> getMetadataById(@RequestParam Long metadataId);
|
||||
|
||||
/**
|
||||
* 根据父级id和code以及modelId获取
|
||||
*/
|
||||
@GetMapping(value = "api/data/governance/metadata/child-info")
|
||||
Result<DataGovernanceMetadataDto> getByParentIdAndOtherInfo(@RequestParam Long parnetId, @RequestParam Long datasourceId, @RequestParam String code, @RequestParam Long metamodelId);
|
||||
|
||||
/**
|
||||
* 添加元数据
|
||||
*/
|
||||
@PostMapping(value = "api/data/governance/metadata")
|
||||
DataGovernanceMetadataDto addOrUpdateMetadata(@RequestBody DataGovernanceMetadataDto metadataDto);
|
||||
|
||||
|
||||
/**
|
||||
* 获取元数据属性
|
||||
*/
|
||||
@GetMapping(value = "api/data/governance/metadata-property")
|
||||
Result<DataGovernanceMetadataPropertyDto> getByPropertyIdAndMetadataId(@RequestParam Long propertyId, @RequestParam Long metadataId);
|
||||
|
||||
/**
|
||||
* 添加元数据属性
|
||||
*/
|
||||
@PostMapping(value = "api/data/governance/metadata-prpperty")
|
||||
void addOrUpdateMetadataProperty(@RequestBody DataGovernanceMetadataPropertyDto metadataPropertyDto);
|
||||
|
||||
@GetMapping(value = "api/data/governance/metadata/list")
|
||||
Result<List<DataGovernanceMetadataDto>> listParentIdAndDatasourceId(@RequestParam Long parentId, @RequestParam Long datasourceId, @RequestParam Long metamodelId);
|
||||
|
||||
@DeleteMapping(value = "api/data/governance/metadata")
|
||||
void deleteMetadata(@RequestParam Long id);
|
||||
|
||||
@GetMapping(value = "api/data/governance/by-datasourceId")
|
||||
Result<DataGovernanceMetadataCollectDto> getByDatasourceId(Long id);
|
||||
|
||||
@GetMapping(value = "api/data/governance/metadata/by-datasourceId")
|
||||
Result<DataGovernanceMetadataDto> getMetadataByDatasourceId(Long id);
|
||||
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package net.srt;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
|
|
|
@ -0,0 +1,83 @@
|
|||
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.QualityConfigQuery;
|
||||
import net.srt.service.QualityConfigService;
|
||||
import net.srt.vo.QualityConfigVo;
|
||||
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/24 19:31
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/quality-config")
|
||||
@Tag(name = "数据治理-质量规则配置")
|
||||
@AllArgsConstructor
|
||||
public class QualityConfigController {
|
||||
private final QualityConfigService qualityConfigService;
|
||||
|
||||
@GetMapping("page")
|
||||
@Operation(summary = "分页")
|
||||
public Result<PageResult<QualityConfigVo>> page(@Valid QualityConfigQuery query){
|
||||
PageResult<QualityConfigVo> page= qualityConfigService.page(query);
|
||||
return Result.ok(page);
|
||||
}
|
||||
|
||||
@GetMapping("{id}")
|
||||
@Operation(summary = "信息")
|
||||
public Result<QualityConfigVo> get(@PathVariable("id") Long id){
|
||||
return Result.ok(qualityConfigService.get(id));
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "保存")
|
||||
public Result<String> save(@RequestBody QualityConfigVo vo){
|
||||
qualityConfigService.save(vo);
|
||||
return Result.ok();
|
||||
}
|
||||
@PutMapping
|
||||
@Operation(summary = "修改")
|
||||
public Result<String> update(@RequestBody @Valid QualityConfigVo vo){
|
||||
qualityConfigService.update(vo);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@PutMapping("/online/{id}")
|
||||
@Operation(summary = "启用")
|
||||
public Result<String> online(@PathVariable Long id){
|
||||
qualityConfigService.online(id);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@PutMapping("/offline/{id}")
|
||||
@Operation(summary = "关闭")
|
||||
public Result<String> offline(@PathVariable Long id){
|
||||
qualityConfigService.offline(id);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@PutMapping("/hand-run/{id}")
|
||||
@Operation(summary = "手动执行")
|
||||
public Result<String> handRun(@PathVariable Long id){
|
||||
qualityConfigService.handRun(id);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
public Result<String> delete(@RequestBody List<Long> idList){
|
||||
qualityConfigService.delete(idList);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
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.convert.StandardStopwatchConvert;
|
||||
import net.srt.entity.StandardStopwatchEntity;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.common.utils.Result;
|
||||
import net.srt.query.StandardStopwatchQuery;
|
||||
import net.srt.service.StandardStopwatchService;
|
||||
import net.srt.vo.StandardStopwatchVo;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName : StandardStopwatchController
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-24 10:32
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/standard-code")
|
||||
@Tag(name="数据治理-标准码表数据")
|
||||
@AllArgsConstructor
|
||||
public class StandardStopwatchController {
|
||||
private final StandardStopwatchService standardStopwatchService;
|
||||
|
||||
@GetMapping("page")
|
||||
@Operation(summary = "分页")
|
||||
public Result<PageResult<StandardStopwatchVo>> page(@Valid StandardStopwatchQuery query){
|
||||
PageResult<StandardStopwatchVo> page = standardStopwatchService.page(query);
|
||||
|
||||
return Result.ok(page);
|
||||
}
|
||||
|
||||
@GetMapping("{id}")
|
||||
@Operation(summary = "信息")
|
||||
public Result<StandardStopwatchVo> get(@PathVariable("id") Long id){
|
||||
StandardStopwatchEntity entity = standardStopwatchService.getById(id);
|
||||
|
||||
return Result.ok(StandardStopwatchConvert.INSTANCE.convert(entity));
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "保存")
|
||||
public Result<String> save(@RequestBody StandardStopwatchVo vo){
|
||||
standardStopwatchService.save(vo);
|
||||
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改")
|
||||
public Result<String> update(@RequestBody @Valid StandardStopwatchVo vo){
|
||||
standardStopwatchService.update(vo);
|
||||
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
public Result<String> delete(@RequestBody List<Long> idList){
|
||||
standardStopwatchService.delete(idList);
|
||||
|
||||
return Result.ok();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package net.srt.convert;
|
||||
|
||||
import net.srt.entity.QualityConfigEntity;
|
||||
import net.srt.vo.QualityConfigVo;
|
||||
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/24 19:57
|
||||
*/
|
||||
@Mapper
|
||||
public interface QualityConfigConvert {
|
||||
QualityConfigConvert INSTANCE = Mappers.getMapper(QualityConfigConvert.class);
|
||||
|
||||
QualityConfigVo convert(QualityConfigEntity entity);
|
||||
|
||||
QualityConfigEntity convert(QualityConfigVo vo);
|
||||
|
||||
List<QualityConfigVo> convertList(List<QualityConfigEntity> list);
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package net.srt.convert;
|
||||
|
||||
import net.srt.entity.StandardStopwatchEntity;
|
||||
import net.srt.vo.StandardStopwatchVo;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName : StandardStopwatchConvert
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-24 10:33
|
||||
*/
|
||||
@Mapper
|
||||
public interface StandardStopwatchConvert {
|
||||
StandardStopwatchConvert INSTANCE = Mappers.getMapper(StandardStopwatchConvert.class);
|
||||
|
||||
StandardStopwatchEntity convert(StandardStopwatchVo vo);
|
||||
|
||||
StandardStopwatchVo convert(StandardStopwatchEntity entity);
|
||||
|
||||
List<StandardStopwatchVo> convertList(List<StandardStopwatchEntity> list);
|
||||
}
|
|
@ -4,6 +4,12 @@ import net.srt.entity.MetadataEntity;
|
|||
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/24 14:39
|
||||
*/
|
||||
@Mapper
|
||||
public interface MetadataDao extends BaseDao<MetadataEntity> {
|
||||
}
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package net.srt.dao;
|
||||
|
||||
import net.srt.entity.StandardStopwatchEntity;
|
||||
import net.srt.framework.mybatis.dao.BaseDao;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* @ClassName : StandardStopwatchDao
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-24 10:33
|
||||
*/
|
||||
@Mapper
|
||||
public interface StandardStopwatchDao extends BaseDao<StandardStopwatchEntity> {
|
||||
void updateCodeNumByStandardId(@Param("standardId") Long standardId);
|
||||
}
|
|
@ -5,11 +5,16 @@ import lombok.Data;
|
|||
import lombok.EqualsAndHashCode;
|
||||
import net.srt.framework.mybatis.entity.BaseEntity;
|
||||
|
||||
/**
|
||||
* @BelongsProject: srt_cloud
|
||||
* @BelongsPackage: net.srt.entity
|
||||
* @Author: jpz
|
||||
* @CreateTime: 2023/12/24 14:36
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Data
|
||||
@TableName("data_governance_metadata")
|
||||
public class MetadataEntity extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 父级id(默认0为顶级)
|
||||
*/
|
||||
|
@ -65,4 +70,5 @@ public class MetadataEntity extends BaseEntity {
|
|||
|
||||
|
||||
private Integer orderNo;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
package net.srt.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import net.srt.framework.mybatis.entity.BaseEntity;
|
||||
|
||||
/**
|
||||
* @ClassName : StandardStopwatchEntity
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-24 10:30
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Data
|
||||
@TableName("data_standard_stopwatch")
|
||||
public class StandardStopwatchEntity extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 标准码表id
|
||||
*/
|
||||
private Long standardId;
|
||||
|
||||
/**
|
||||
* 码表数据的id
|
||||
*/
|
||||
private String dataId;
|
||||
|
||||
/**
|
||||
* 码表数据的name
|
||||
*/
|
||||
private String dataName;
|
||||
|
||||
|
||||
private Long projectId;
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
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/24 19:39
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "数据治理-质量规则配置查询")
|
||||
public class QualityConfigQuery extends Query {
|
||||
private Long categoryId;
|
||||
private String name;
|
||||
private Long status;
|
||||
private Long taskType;
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
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;
|
||||
|
||||
/**
|
||||
* @ClassName : StandardStopwatchQuery
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-24 10:29
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "数据治理-标准码表数据查询")
|
||||
public class StandardStopwatchQuery extends Query {
|
||||
private Integer standardId;
|
||||
private String dataId;
|
||||
private String dataName;
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package net.srt.service;
|
||||
|
||||
import net.srt.entity.QualityConfigEntity;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.mybatis.service.BaseService;
|
||||
import net.srt.query.QualityConfigQuery;
|
||||
import net.srt.vo.QualityConfigVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @BelongsProject: srt_cloud
|
||||
* @BelongsPackage: net.srt.service
|
||||
* @Author: jpz
|
||||
* @CreateTime: 2023/12/24 19:33
|
||||
*/
|
||||
public interface QualityConfigService extends BaseService<QualityConfigEntity> {
|
||||
PageResult<QualityConfigVo> page(QualityConfigQuery query);
|
||||
|
||||
QualityConfigVo get(Long id);
|
||||
|
||||
void save(QualityConfigVo vo);
|
||||
|
||||
void update(QualityConfigVo vo);
|
||||
|
||||
void online(Long id);
|
||||
|
||||
void offline(Long id);
|
||||
|
||||
void handRun(Long id);
|
||||
|
||||
|
||||
void delete(List<Long> idList);
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package net.srt.service;
|
||||
|
||||
import net.srt.entity.StandardStopwatchEntity;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.mybatis.service.BaseService;
|
||||
import net.srt.query.StandardStopwatchQuery;
|
||||
import net.srt.vo.StandardStopwatchVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName : StandardStopwatchService
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-24 10:32
|
||||
*/
|
||||
public interface StandardStopwatchService extends BaseService<StandardStopwatchEntity> {
|
||||
PageResult<StandardStopwatchVo> page(StandardStopwatchQuery query);
|
||||
|
||||
void save(StandardStopwatchVo vo);
|
||||
|
||||
void update(StandardStopwatchVo vo);
|
||||
|
||||
void delete(List<Long> idList);
|
||||
}
|
|
@ -0,0 +1,197 @@
|
|||
package net.srt.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.servers.Server;
|
||||
import lombok.AllArgsConstructor;
|
||||
import net.srt.api.module.data.governance.constant.BuiltInMetamodel;
|
||||
import net.srt.convert.MetadataConvert;
|
||||
import net.srt.dao.MetadataDao;
|
||||
import net.srt.dao.MetadataPropertyDao;
|
||||
import net.srt.entity.MetadataEntity;
|
||||
import net.srt.entity.MetadataPropertyEntity;
|
||||
import net.srt.framework.common.utils.BeanUtil;
|
||||
import net.srt.framework.common.utils.BuildTreeUtils;
|
||||
import net.srt.framework.common.utils.Result;
|
||||
import net.srt.framework.common.utils.TreeNodeVo;
|
||||
import net.srt.framework.mybatis.service.impl.BaseServiceImpl;
|
||||
import net.srt.service.MetadataService;
|
||||
import net.srt.vo.MetadataVO;
|
||||
import net.srt.vo.MetamodelPropertyVO;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import srt.cloud.framework.dbswitch.common.util.StringUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Server
|
||||
@AllArgsConstructor
|
||||
public class MetadataServiceImpl extends BaseServiceImpl<MetadataDao, MetadataEntity> implements MetadataService {
|
||||
|
||||
private final MetadataDao metadataDao;
|
||||
private final MetadataPropertyDao metadataPropertyDao;
|
||||
|
||||
@Override
|
||||
public List<TreeNodeVo> listByParentId(Long parentId) {
|
||||
LambdaQueryWrapper<MetadataEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(MetadataEntity::getParentId,parentId)
|
||||
.orderByAsc(MetadataEntity::getOrderNo);
|
||||
dataScopeWithOrgId(wrapper);
|
||||
List<MetadataEntity> metadataEntities = baseMapper.selectList(wrapper);
|
||||
return BeanUtil.copyListProperties(metadataEntities,TreeNodeVo::new, (oldItem, newItem) ->{
|
||||
newItem.setLabel(oldItem.getName());
|
||||
newItem.setValue(oldItem.getId());
|
||||
newItem.setLeaf(BuiltInMetamodel.COLUMN.getId().equals(oldItem.getMetamodelId()));
|
||||
if(newItem.getPath().contains("/")){
|
||||
newItem.setParentPath(newItem.getPath().substring(0,newItem.getPath().lastIndexOf("/")));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TreeNodeVo> listFloder() {
|
||||
LambdaQueryWrapper<MetadataEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(MetadataEntity::getIfLeaf,1)
|
||||
.orderByAsc(MetadataEntity::getOrderNo)
|
||||
.orderByAsc(MetadataEntity::getId);
|
||||
dataScopeWithOrgId(wrapper);
|
||||
List<MetadataEntity> metadatas = baseMapper.selectList(wrapper);
|
||||
List<TreeNodeVo> treeNodeVos = BeanUtil.copyListProperties(metadatas, TreeNodeVo::new, (oldItem, newItem) -> {
|
||||
newItem.setLabel(oldItem.getName());
|
||||
newItem.setValue(oldItem.getId());
|
||||
if (newItem.getPath().contains("/")) {
|
||||
newItem.setParentPath(newItem.getPath().substring(0, newItem.getPath().lastIndexOf("/")));
|
||||
}
|
||||
});
|
||||
return BuildTreeUtils.buildTree(treeNodeVos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TreeNodeVo> listDb() {
|
||||
LambdaQueryWrapper<MetadataEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.in(MetadataEntity::getMetamodelId,BuiltInMetamodel.SCHEMA.getId(),BuiltInMetamodel.TABLE.getId())
|
||||
.or()
|
||||
.isNull(MetadataEntity::getMetamodelId)
|
||||
.orderByAsc(MetadataEntity::getOrderNo);
|
||||
dataScopeWithOrgId(wrapper);
|
||||
List<MetadataEntity> metadatas = baseMapper.selectList(wrapper);
|
||||
List<TreeNodeVo> treeNodeVos = BeanUtil.copyListProperties(metadatas,TreeNodeVo::new, (oldItem, newItem) -> {
|
||||
newItem.setLabel(oldItem.getName());
|
||||
newItem.setValue(oldItem.getId());
|
||||
newItem.setDisabled(!BuiltInMetamodel.TABLE.getId().equals(oldItem.getMetamodelId()));
|
||||
if(newItem.getPath().contains("/")) {
|
||||
newItem.setParentPath(newItem.getPath().substring(0,newItem.getPath().lastIndexOf("/")));
|
||||
}
|
||||
});
|
||||
return BuildTreeUtils.buildTree(treeNodeVos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TreeNodeVo> listByKeyword(String keyword) {
|
||||
if(StringUtil.isBlank(keyword)){
|
||||
return listByParentId(0L);
|
||||
}
|
||||
LambdaQueryWrapper<MetadataEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.like(MetadataEntity::getName,keyword)
|
||||
.or()
|
||||
.like(MetadataEntity::getCode,keyword)
|
||||
.orderByAsc(MetadataEntity::getOrderNo)
|
||||
.orderByAsc(MetadataEntity::getId);
|
||||
dataScopeWithOrgId(wrapper);
|
||||
List<MetadataEntity> metadatas = baseMapper.selectList(wrapper);
|
||||
List<MetadataEntity> resultList = new ArrayList<>();
|
||||
//递归获取父级
|
||||
for (MetadataEntity metadata : metadatas) {
|
||||
recursionAddParent(metadata,resultList);
|
||||
}
|
||||
List<MetadataEntity> result = resultList.stream().sorted(Comparator.comparing(MetadataEntity::getOrderNo)).collect(Collectors.toList());
|
||||
List<TreeNodeVo> treeNodeVos = BeanUtil.copyListProperties(result ,TreeNodeVo::new, (oldItem, newItem) -> {
|
||||
newItem.setLabel(oldItem.getName());
|
||||
newItem.setValue(oldItem.getId());
|
||||
newItem.setLeaf(BuiltInMetamodel.COLUMN.getId().equals(oldItem.getMetamodelId()));
|
||||
if(newItem.getPath().contains("/")) {
|
||||
newItem.setParentPath(newItem.getPath().substring(0,newItem.getPath().lastIndexOf("/")));
|
||||
}
|
||||
});
|
||||
return BuildTreeUtils.buildTree(treeNodeVos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MetadataVO get(Long id) {
|
||||
MetadataEntity metadataEntity = getById(id);
|
||||
MetadataVO metadataVO = MetadataConvert.INSTANCE.convert(metadataEntity);
|
||||
metadataVO.setProperties(metadataPropertyDao.listPropertyById(id,metadataEntity.getMetamodelId()));
|
||||
return metadataVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(MetadataVO vo) {
|
||||
MetadataEntity entity = MetadataConvert.INSTANCE.convert(vo);
|
||||
entity.setProjectId(getProjectId());
|
||||
entity.setPath(recursionPath(entity,null));
|
||||
buildField(entity);
|
||||
MetadataEntity parentMetadata = baseMapper.selectById(vo.getParentId());
|
||||
if(parentMetadata != null) {
|
||||
entity.setDbType(parentMetadata.getDbType());
|
||||
entity.setDatasourceId(parentMetadata.getDatasourceId());
|
||||
entity.setCollectTaskId(parentMetadata.getCollectTaskId());
|
||||
}
|
||||
baseMapper.insert(entity);
|
||||
buildProperties(entity,vo.getProperties());
|
||||
}
|
||||
|
||||
private void recursionAddParent(MetadataEntity metadataEntity, List<MetadataEntity> resultList){
|
||||
if(resultList.stream().noneMatch(item -> metadataEntity.getId().equals(item.getId()))) {
|
||||
resultList.add(metadataEntity);
|
||||
}
|
||||
|
||||
if(metadataEntity.getParentId()!=0){
|
||||
MetadataEntity parent = getById(metadataEntity.getParentId());
|
||||
recursionAddParent(parent,resultList);
|
||||
}
|
||||
}
|
||||
|
||||
private void buildField(MetadataEntity entity){
|
||||
if(entity.getMetamodelId()!=null){
|
||||
entity.setIcon(metadataDao.selectById(entity.getMetamodelId()).getIcon());
|
||||
}
|
||||
if(entity.getIfLeaf() == 1 && entity.getMetamodelId() == null) {
|
||||
entity.setIcon("/src/assets/folder.png");
|
||||
}
|
||||
}
|
||||
|
||||
private String recursionPath(MetadataEntity metadataEntity, String path) {
|
||||
if(StringUtil.isBlank(path)){
|
||||
path = metadataEntity.getName();
|
||||
}
|
||||
if(metadataEntity.getParentId()!=0){
|
||||
MetadataEntity parent = getById(metadataEntity.getParentId());
|
||||
path = parent.getName() + "/" +path;
|
||||
return recursionPath(parent,path);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
private void buildProperties(MetadataEntity entity, List<MetamodelPropertyVO> properties){
|
||||
if(!CollectionUtils.isEmpty(properties)){
|
||||
LambdaQueryWrapper<MetadataPropertyEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(MetadataPropertyEntity::getMetadataId,entity.getId());
|
||||
for (MetamodelPropertyVO property : properties) {
|
||||
MetadataPropertyEntity metadataPropertyEntity = new MetadataPropertyEntity();
|
||||
metadataPropertyEntity.setMetamodelPropertyId(property.getId());
|
||||
metadataPropertyEntity.setMetadataId(entity.getId());
|
||||
metadataPropertyEntity.setProperty(property.getValue());
|
||||
metadataPropertyEntity.setProjectId(entity.getProjectId());
|
||||
if(property.getMetadataPropertyId()!=null){
|
||||
metadataPropertyEntity.setId(property.getMetadataPropertyId());
|
||||
metadataPropertyDao.updateById(metadataPropertyEntity);
|
||||
}else {
|
||||
metadataPropertyDao.insert(metadataPropertyEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,134 @@
|
|||
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.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.sun.org.apache.bcel.internal.generic.LADD;
|
||||
import lombok.AllArgsConstructor;
|
||||
import net.srt.api.module.data.governance.constant.BuiltInQualityRule;
|
||||
import net.srt.api.module.data.governance.dto.quality.QualityConfigParam;
|
||||
import net.srt.api.module.quartz.QuartzDataGovernanceQualityApi;
|
||||
import net.srt.convert.QualityConfigConvert;
|
||||
import net.srt.dao.MetadataDao;
|
||||
import net.srt.dao.QualityConfigDao;
|
||||
import net.srt.entity.MetadataEntity;
|
||||
import net.srt.entity.QualityConfigEntity;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.mybatis.service.impl.BaseServiceImpl;
|
||||
import net.srt.query.QualityConfigQuery;
|
||||
import net.srt.service.QualityConfigService;
|
||||
import net.srt.vo.QualityConfigVo;
|
||||
import org.springframework.security.core.parameters.P;
|
||||
import org.springframework.stereotype.Service;
|
||||
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/24 19:42
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class QualityConfigServiceimpl extends BaseServiceImpl<QualityConfigDao, QualityConfigEntity> implements QualityConfigService {
|
||||
private final QuartzDataGovernanceQualityApi quartzDataGovernanceQualityApi;
|
||||
private final MetadataDao metadataDao;
|
||||
@Override
|
||||
public PageResult<QualityConfigVo> page(QualityConfigQuery query) {
|
||||
IPage<QualityConfigEntity> page=baseMapper.selectPage(getPage(query),getWrapper(query));
|
||||
return new PageResult<>(QualityConfigConvert.INSTANCE.convertList(page.getRecords()),page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public QualityConfigVo get(Long id) {
|
||||
QualityConfigVo qualityConfigvo= QualityConfigConvert.INSTANCE.convert(baseMapper.selectById(id));
|
||||
List<Integer> metadataIds=qualityConfigvo.getMetadataIds();
|
||||
LambdaQueryWrapper<MetadataEntity> metadataWrapper= Wrappers.lambdaQuery();
|
||||
metadataWrapper.in(MetadataEntity::getId,metadataIds);
|
||||
List<MetadataEntity> metadataEntities=metadataDao.selectList(metadataWrapper);
|
||||
if (CollectionUtils.isEmpty(metadataEntities)){
|
||||
qualityConfigvo.setMetadataStrs("检测字段已删除,请检查数据信息");
|
||||
}else {
|
||||
qualityConfigvo.setMetadataStrs(metadataEntities.stream().map(MetadataEntity::getPath).collect(Collectors.joining(";")));
|
||||
}
|
||||
if (BuiltInQualityRule.ASSOCIATION_CONSISTENCY.getId().equals(qualityConfigvo.getRuleId())){
|
||||
QualityConfigParam param = qualityConfigvo.getParam();
|
||||
Integer columnMetaId = param.getColumnMetaId();
|
||||
MetadataEntity entity = metadataDao.selectById(columnMetaId);
|
||||
if (entity!= null){
|
||||
qualityConfigvo.setRelMetadataStr(entity.getPath());
|
||||
}else {
|
||||
qualityConfigvo.setMetadataStrs("关联字段已被删除,请检查元数据信息");
|
||||
}
|
||||
}
|
||||
|
||||
return qualityConfigvo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(QualityConfigVo vo) {
|
||||
QualityConfigEntity entity=QualityConfigConvert.INSTANCE.convert(vo);
|
||||
entity.setProjectId(getProjectId());
|
||||
if (!BuiltInQualityRule.UNIQUENESS.getId().equals(entity.getRuleId())&&!BuiltInQualityRule.LENGTH_CHECK.getId().equals(entity.getRuleId())&& !BuiltInQualityRule.ASSOCIATION_CONSISTENCY.getId().equals(entity.getRuleId())&&!BuiltInQualityRule.TIMELINESS.getId().equals(entity.getRuleId())){
|
||||
entity.setParam(null);
|
||||
}
|
||||
baseMapper.insert(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(QualityConfigVo vo) {
|
||||
if (!BuiltInQualityRule.UNIQUENESS.getId().equals(vo.getRuleId())&&!BuiltInQualityRule.LENGTH_CHECK.getId().equals(vo.getRuleId())&&!BuiltInQualityRule.ASSOCIATION_CONSISTENCY.getId().equals(vo.getRuleId())&&!BuiltInQualityRule.TIMELINESS.getId().equals(vo.getRuleId())){
|
||||
vo.setParam(null);
|
||||
}
|
||||
QualityConfigEntity entity=QualityConfigConvert.INSTANCE.convert(vo);
|
||||
entity.setProjectId(getProjectId());
|
||||
updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void online(Long id) {
|
||||
QualityConfigEntity entity=baseMapper.selectById(id);
|
||||
entity.setStatus(1);
|
||||
quartzDataGovernanceQualityApi.release(id);
|
||||
baseMapper.updateById(entity);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void offline(Long id) {
|
||||
QualityConfigEntity entity=baseMapper.selectById(id);
|
||||
entity.setStatus(0);
|
||||
quartzDataGovernanceQualityApi.cancel(id);
|
||||
baseMapper.updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handRun(Long id) {
|
||||
quartzDataGovernanceQualityApi.handRun(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(List<Long> idList) {
|
||||
for (Long id : idList) {
|
||||
quartzDataGovernanceQualityApi.cancel(id);
|
||||
}
|
||||
removeByIds(idList);
|
||||
}
|
||||
|
||||
|
||||
private LambdaQueryWrapper<QualityConfigEntity> getWrapper(QualityConfigQuery query) {
|
||||
LambdaQueryWrapper<QualityConfigEntity> wrapper= Wrappers.lambdaQuery();
|
||||
wrapper.eq(query.getCategoryId()!=null,QualityConfigEntity::getCategoryId,query.getCategoryId())
|
||||
.like(StringUtil.isNotBlank(query.getName()),QualityConfigEntity::getName,query.getName())
|
||||
.eq(query.getStatus()!=null,QualityConfigEntity::getStatus,query.getStatus())
|
||||
.eq(query.getTaskType()!=null,QualityConfigEntity::getTaskType,query.getTaskType())
|
||||
.orderByDesc(QualityConfigEntity::getId );
|
||||
return wrapper;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
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.StandardStopwatchConvert;
|
||||
import net.srt.dao.StandardStopwatchDao;
|
||||
import net.srt.entity.StandardStopwatchEntity;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.mybatis.service.impl.BaseServiceImpl;
|
||||
import net.srt.query.StandardStopwatchQuery;
|
||||
import net.srt.service.StandardStopwatchService;
|
||||
import net.srt.vo.StandardStopwatchVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
import srt.cloud.framework.dbswitch.common.util.StringUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName : StandardStopwatchServiceImpl
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-24 10:32
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class StandardStopwatchServiceImpl extends BaseServiceImpl<StandardStopwatchDao, StandardStopwatchEntity> implements StandardStopwatchService {
|
||||
private final StandardStopwatchDao standardStopwatchDao;
|
||||
@Override
|
||||
public PageResult<StandardStopwatchVo> page(StandardStopwatchQuery query) {
|
||||
IPage<StandardStopwatchEntity> page = baseMapper.selectPage(getPage(query), getWrapper(query));
|
||||
|
||||
return new PageResult<>(StandardStopwatchConvert.INSTANCE.convertList(page.getRecords()), page.getTotal());
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<StandardStopwatchEntity> getWrapper(StandardStopwatchQuery query) {
|
||||
LambdaQueryWrapper<StandardStopwatchEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.eq(query.getStandardId() != null, StandardStopwatchEntity::getStandardId, query.getStandardId())
|
||||
.eq(StringUtil.isNotBlank(query.getDataId()), StandardStopwatchEntity::getDataId, query.getDataId())
|
||||
.eq(StringUtil.isNotBlank(query.getDataName()), StandardStopwatchEntity::getDataName, query.getDataName());
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(StandardStopwatchVo vo) {
|
||||
StandardStopwatchEntity entity =StandardStopwatchConvert.INSTANCE.convert(vo);
|
||||
entity.setProjectId(getProjectId());
|
||||
baseMapper.insert(entity);
|
||||
standardStopwatchDao.updateCodeNumByStandardId(vo.getStandardId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(StandardStopwatchVo vo) {
|
||||
StandardStopwatchEntity entity = StandardStopwatchConvert.INSTANCE.convert(vo);
|
||||
entity.setProjectId(getProjectId());
|
||||
updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(List<Long> idList) {
|
||||
Long id = idList.get(0);
|
||||
StandardStopwatchEntity standardCodeEntity = baseMapper.selectById(id);
|
||||
removeByIds(idList);
|
||||
standardStopwatchDao.updateCodeNumByStandardId(standardCodeEntity.getStandardId());
|
||||
}
|
||||
}
|
|
@ -9,6 +9,12 @@ import java.io.Serializable;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @BelongsProject: srt_cloud
|
||||
* @BelongsPackage: net.srt.vo
|
||||
* @Author: jpz
|
||||
* @CreateTime: 2023/12/24 15:37
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "数据治理-元数据")
|
||||
public class MetadataVO implements Serializable {
|
||||
|
@ -75,6 +81,4 @@ public class MetadataVO implements Serializable {
|
|||
|
||||
@Schema(description = "元数据属性列表")
|
||||
private List<MetamodelPropertyVO> properties;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
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.QualityConfigParam;
|
||||
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/24 19:35
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "数据治理-质量规则配置")
|
||||
public class QualityConfigVo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "自增id")
|
||||
private Long id;
|
||||
|
||||
private Long categoryId;
|
||||
|
||||
@Schema(description = "名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "规则id")
|
||||
private Integer ruleId;
|
||||
|
||||
@Schema(description = "个性化参数json")
|
||||
private QualityConfigParam param;
|
||||
@Schema(description = "当选择的规则类型为关联一致性的时候,返回此字段(前台用)")
|
||||
private String relMetadataStr;
|
||||
|
||||
@Schema(description = "元数据字段列表")
|
||||
private List<Integer> metadataIds;
|
||||
@Schema(description = "检测的元数据字段信息字符串(前台用)")
|
||||
private String metadataStrs;
|
||||
|
||||
@Schema(description = "状态,1-启用,0-关闭")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "任务类型,1-一次性任务,2-周期任务")
|
||||
private Integer taskType;
|
||||
|
||||
@Schema(description = "cron表达式")
|
||||
private String cron;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String note;
|
||||
|
||||
@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;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
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;
|
||||
|
||||
/**
|
||||
* @ClassName : StandardStopwatchVo
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-24 10:26
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "数据治理-标准码表数据")
|
||||
public class StandardStopwatchVo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "主键id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "标准码表id")
|
||||
private Long standardId;
|
||||
|
||||
@Schema(description = "码表数据的id")
|
||||
private String dataId;
|
||||
|
||||
@Schema(description = "码表数据的name")
|
||||
private String dataName;
|
||||
|
||||
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;
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="net.srt.dao.StandardStopwatchDao">
|
||||
|
||||
|
||||
<update id="updateCodeNumByStandardId">
|
||||
UPDATE data_governance_standard SET code_num=(SELECT COUNT(1)
|
||||
FROM data_governance_standard_code
|
||||
WHERE standard_id=#{standardId} AND deleted=0)
|
||||
WHERE id=#{standardId}
|
||||
</update>
|
||||
</mapper>
|
|
@ -79,6 +79,12 @@
|
|||
<groupId>io.minio</groupId>
|
||||
<artifactId>minio</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.ant</groupId>
|
||||
<artifactId>ant</artifactId>
|
||||
<version>1.9.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -3,18 +3,16 @@ package net.srt.controller;
|
|||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import net.srt.convert.DataServiceAppConvert;
|
||||
import net.srt.entity.DataServiceApppEntity;
|
||||
import net.srt.entity.DataServiceAppEntity;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.common.utils.Result;
|
||||
import net.srt.query.DataServiceAppQuery;
|
||||
import net.srt.service.DataServiceAppService;
|
||||
import net.srt.vo.DataServiceAppVo;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @ClassName : DataServiceAppController
|
||||
|
@ -37,7 +35,50 @@ public class DataServiceAppController {
|
|||
@GetMapping("{id}")
|
||||
@Operation(summary = "信息")
|
||||
public Result<DataServiceAppVo> get(@PathVariable("id") Long id){
|
||||
DataServiceApppEntity dataServiceApppEntity = dataServiceAppService.getById(id);
|
||||
return Result.ok(DataServiceAppConvert.INSTANCE.convert(dataServiceApppEntity));
|
||||
DataServiceAppEntity dataServiceAppEntity = dataServiceAppService.getById(id);
|
||||
return Result.ok(DataServiceAppConvert.INSTANCE.convert(dataServiceAppEntity));
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "保存")
|
||||
public Result<String> save(@RequestBody DataServiceAppVo vo){
|
||||
dataServiceAppService.save1(vo);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改")
|
||||
public Result<String> update(@RequestBody @Valid DataServiceAppVo vo){
|
||||
dataServiceAppService.update1(vo);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
public Result<String> delete(@RequestBody List<Long> idList){
|
||||
dataServiceAppService.delete(idList);
|
||||
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@PostMapping("/auth")
|
||||
@Operation(summary = "添加授权")
|
||||
public Result<String> addAuth(@RequestBody DataServiceAppVo authVO){
|
||||
dataServiceAppService.addAuth(authVO);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@PutMapping("/auth")
|
||||
@Operation(summary = "修改授权")
|
||||
public Result<String> upAuth(@RequestBody DataServiceAppVo authVO){
|
||||
dataServiceAppService.upAuth(authVO);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@DeleteMapping("/cancel-auth/{authId}")
|
||||
@Operation(summary = "取消授权")
|
||||
public Result<String> cancelAuth(@PathVariable Long authId){
|
||||
dataServiceAppService.cancelAuth(authId);
|
||||
return Result.ok();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package net.srt.convert;
|
||||
|
||||
import net.srt.entity.DataServiceApppEntity;
|
||||
import net.srt.entity.DataServiceAppEntity;
|
||||
import net.srt.vo.DataServiceAppVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -17,9 +17,9 @@ import java.util.List;
|
|||
public interface DataServiceAppConvert {
|
||||
DataServiceAppConvert INSTANCE = Mappers.getMapper(DataServiceAppConvert.class);
|
||||
|
||||
DataServiceApppEntity convert(DataServiceAppVo vo);
|
||||
DataServiceAppEntity convert(DataServiceAppVo vo);
|
||||
|
||||
DataServiceAppVo convert(DataServiceApppEntity entity);
|
||||
DataServiceAppVo convert(DataServiceAppEntity entity);
|
||||
|
||||
List<DataServiceAppVo> convertList(List<DataServiceApppEntity> list);
|
||||
List<DataServiceAppVo> convertList(List<DataServiceAppEntity> list);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package net.srt.dao;
|
||||
|
||||
import net.srt.entity.DataServiceApppEntity;
|
||||
import net.srt.entity.DataServiceAppEntity;
|
||||
import net.srt.framework.mybatis.dao.BaseDao;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
@ -12,6 +12,6 @@ import org.apache.ibatis.annotations.Param;
|
|||
* @Date: 2023-12-23 08:59
|
||||
*/
|
||||
@Mapper
|
||||
public interface DataServiceAppDao extends BaseDao<DataServiceApppEntity> {
|
||||
DataServiceApppEntity selectByApplyId(@Param("applyId") Long applyId);
|
||||
public interface DataServiceAppDao extends BaseDao<DataServiceAppEntity> {
|
||||
DataServiceAppEntity selectByApplyId(@Param("applyId") Long applyId);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
//package net.srt.entity;
|
||||
//
|
||||
//import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
//import com.baomidou.mybatisplus.annotation.FieldStrategy;
|
||||
//import com.baomidou.mybatisplus.annotation.TableField;
|
||||
//import com.baomidou.mybatisplus.annotation.TableName;
|
||||
//import lombok.Data;
|
||||
//import lombok.EqualsAndHashCode;
|
||||
//import net.srt.framework.mybatis.entity.BaseEntity;
|
||||
//
|
||||
//import java.util.Date;
|
||||
//
|
||||
///**
|
||||
// * @ClassName : DataServiceApiAuthEnitiy
|
||||
// * @Description :
|
||||
// * @Author : FJJ
|
||||
// * @Date: 2023-12-24 11:30
|
||||
// */
|
||||
//@EqualsAndHashCode(callSuper=false)
|
||||
//@Data
|
||||
//@TableName("data_service_api_auth1")
|
||||
//public class DataServiceApiAuthEnitiy extends BaseEntity {
|
||||
//
|
||||
// /**
|
||||
// * app的id
|
||||
// */
|
||||
// private Long appId;
|
||||
//
|
||||
// /**
|
||||
// * 分组id
|
||||
// */
|
||||
// private Long groupId;
|
||||
//
|
||||
// /**
|
||||
// * api的id
|
||||
// */
|
||||
// private Long apiId;
|
||||
//
|
||||
// /**
|
||||
// * 调用次数 不限次数为-1
|
||||
// */
|
||||
// private Integer requestTimes;
|
||||
//
|
||||
// @TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||
// private Date startTime;
|
||||
// @TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||
// private Date endTime;
|
||||
//
|
||||
// /**
|
||||
// * 已调用次数
|
||||
// */
|
||||
// @TableField(updateStrategy = FieldStrategy.NEVER)
|
||||
// private Integer requestedTimes;
|
||||
// @TableField(updateStrategy = FieldStrategy.NEVER)
|
||||
// private Integer requestedSuccessTimes;
|
||||
// @TableField(updateStrategy = FieldStrategy.NEVER)
|
||||
// private Integer requestedFailedTimes;
|
||||
//
|
||||
// /**
|
||||
// * 所属项目id
|
||||
// */
|
||||
// private Long projectId;
|
||||
//
|
||||
// /**
|
||||
// * 真删
|
||||
// */
|
||||
// @TableField(fill = FieldFill.INSERT)
|
||||
// private Integer deleted;
|
||||
//
|
||||
//}
|
|
@ -1,11 +1,16 @@
|
|||
package net.srt.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.FieldStrategy;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import net.srt.framework.mybatis.entity.BaseEntity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName : DataServiceApppEntity
|
||||
* @Description :
|
||||
|
@ -15,21 +20,30 @@ import net.srt.framework.mybatis.entity.BaseEntity;
|
|||
@EqualsAndHashCode(callSuper = false)
|
||||
@Data
|
||||
@TableName("data_service_app")
|
||||
public class DataServiceApppEntity extends BaseEntity {
|
||||
|
||||
@Schema(description = "名称")
|
||||
public class DataServiceAppEntity extends BaseEntity {
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
@Schema(description = "备注")
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String note;
|
||||
|
||||
@Schema(description = "app_key")
|
||||
/**
|
||||
* app_key
|
||||
*/
|
||||
private String appKey;
|
||||
|
||||
@Schema(description = "app_secret")
|
||||
/**
|
||||
* app_secret
|
||||
*/
|
||||
private String appSecret;
|
||||
|
||||
@Schema(description = "过期描述")
|
||||
/**
|
||||
* 过期描述
|
||||
*/
|
||||
private String expireDesc;
|
||||
|
||||
/**
|
||||
|
@ -39,6 +53,13 @@ public class DataServiceApppEntity extends BaseEntity {
|
|||
|
||||
private Integer ifMarket;
|
||||
|
||||
@Schema(description = "所属项目id")
|
||||
/**
|
||||
* 所属项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,17 +1,31 @@
|
|||
package net.srt.service;
|
||||
|
||||
import net.srt.entity.DataServiceApppEntity;
|
||||
import net.srt.entity.DataServiceAppEntity;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.mybatis.service.BaseService;
|
||||
import net.srt.query.DataServiceAppQuery;
|
||||
import net.srt.vo.DataServiceAppVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName : DataServiceAppService
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-23 08:53
|
||||
*/
|
||||
public interface DataServiceAppService extends BaseService<DataServiceApppEntity> {
|
||||
public interface DataServiceAppService extends BaseService<DataServiceAppEntity> {
|
||||
PageResult<DataServiceAppVo> page(DataServiceAppQuery query);
|
||||
|
||||
void save1(DataServiceAppVo vo);
|
||||
|
||||
void update1(DataServiceAppVo vo);
|
||||
|
||||
void delete(List<Long> idList);
|
||||
|
||||
void addAuth(DataServiceAppVo authVO);
|
||||
|
||||
void upAuth(DataServiceAppVo authVO);
|
||||
|
||||
void cancelAuth(Long authId);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,8 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|||
import lombok.AllArgsConstructor;
|
||||
import net.srt.convert.DataServiceAppConvert;
|
||||
import net.srt.dao.DataServiceAppDao;
|
||||
import net.srt.entity.DataServiceApppEntity;
|
||||
import net.srt.entity.DataServiceAppEntity;
|
||||
import net.srt.framework.common.exception.ServerException;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.mybatis.service.impl.BaseServiceImpl;
|
||||
import net.srt.framework.security.user.SecurityUser;
|
||||
|
@ -27,32 +28,57 @@ import java.util.List;
|
|||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class DataServiceAppServiceImpl extends BaseServiceImpl<DataServiceAppDao, DataServiceApppEntity> implements DataServiceAppService {
|
||||
public class DataServiceAppServiceImpl extends BaseServiceImpl<DataServiceAppDao, DataServiceAppEntity> implements DataServiceAppService {
|
||||
private final DataServiceAppDao dataServiceAppDao;
|
||||
@Override
|
||||
public PageResult<DataServiceAppVo> page(DataServiceAppQuery query) {
|
||||
if (query.getApplyId()!=null){
|
||||
DataServiceApppEntity dataServiceApppEntity=baseMapper.selectByApplyId(query.getApplyId());
|
||||
List<DataServiceApppEntity> list=new ArrayList<>(1);
|
||||
if (dataServiceApppEntity!=null){
|
||||
list.add(dataServiceApppEntity);
|
||||
return new PageResult<>(DataServiceAppConvert.INSTANCE.convertList(list),1);
|
||||
}
|
||||
return new PageResult<>(new ArrayList<>(),0);
|
||||
|
||||
}
|
||||
IPage<DataServiceApppEntity> page=baseMapper.selectPage(getPage(query),getWrapper(query));
|
||||
IPage<DataServiceAppEntity> page=baseMapper.selectPage(getPage(query),null);
|
||||
return new PageResult<>(DataServiceAppConvert.INSTANCE.convertList(page.getRecords()),page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save1(DataServiceAppVo vo) {
|
||||
DataServiceAppEntity app = DataServiceAppConvert.INSTANCE.convert(vo);
|
||||
baseMapper.insert(app);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<DataServiceApppEntity> getWrapper(DataServiceAppQuery query) {
|
||||
LambdaQueryWrapper<DataServiceApppEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.like(StringUtil.isNotBlank(query.getName()), DataServiceApppEntity::getName, query.getName())
|
||||
.eq(DataServiceApppEntity::getIfMarket, query.getIfMarket() != null ? query.getIfMarket() : 0)
|
||||
.eq(query.getIfMarket() != null, DataServiceApppEntity::getCreator, SecurityUser.getUserId())
|
||||
.eq(StringUtil.isNotBlank(query.getAppKey()), DataServiceApppEntity::getAppKey, query.getAppKey())
|
||||
.orderByDesc(DataServiceApppEntity::getCreateTime).orderByDesc(DataServiceApppEntity::getId);
|
||||
dataScopeWithoutOrgId(wrapper);
|
||||
return wrapper;
|
||||
|
||||
|
||||
@Override
|
||||
public void update1(DataServiceAppVo vo) {
|
||||
DataServiceAppEntity app = DataServiceAppConvert.INSTANCE.convert(vo);
|
||||
updateById(app);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(List<Long> idList) {
|
||||
removeByIds(idList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addAuth(DataServiceAppVo authVO) {
|
||||
authVO.setProjectId(getProjectId());
|
||||
dataServiceAppDao.insert(DataServiceAppConvert.INSTANCE.convert(authVO));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void upAuth(DataServiceAppVo authVO) {
|
||||
dataServiceAppDao.updateById(DataServiceAppConvert.INSTANCE.convert(authVO));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelAuth(Long authId) {
|
||||
dataServiceAppDao.deleteById(authId);
|
||||
}
|
||||
|
||||
|
||||
// private LambdaQueryWrapper<DataServiceAppEntity> getWrapper(DataServiceAppQuery query) {
|
||||
// LambdaQueryWrapper<DataServiceAppEntity> wrapper = Wrappers.lambdaQuery();
|
||||
// wrapper.like(StringUtil.isNotBlank(query.getName()), DataServiceAppEntity::getName, query.getName())
|
||||
// .eq(DataServiceAppEntity::getIfMarket, query.getIfMarket() != null ? query.getIfMarket() : 0)
|
||||
// .eq(query.getIfMarket() != null, DataServiceAppEntity::getCreator, SecurityUser.getUserId())
|
||||
// .eq(StringUtil.isNotBlank(query.getAppKey()), DataServiceAppEntity::getAppKey, query.getAppKey())
|
||||
// .orderByDesc(DataServiceAppEntity::getCreateTime).orderByDesc(DataServiceAppEntity::getId);
|
||||
// return wrapper;
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
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;
|
||||
|
||||
/**
|
||||
* @ClassName : DataServiceApiAuthVo
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-24 11:29
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "数据服务-权限关联表")
|
||||
public class DataServiceApiAuthVo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "主键id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "app的id")
|
||||
private Long appId;
|
||||
|
||||
@Schema(description = "分组id")
|
||||
private Long groupId;
|
||||
|
||||
@Schema(description = "api的id")
|
||||
private Long apiId;
|
||||
|
||||
@Schema(description = "调用次数 不限次数为-1")
|
||||
private Integer requestTimes;
|
||||
|
||||
@Schema(description = "已调用次数")
|
||||
private Integer requestedTimes;
|
||||
private Integer requestedSuccessTimes;
|
||||
private Integer requestedFailedTimes;
|
||||
|
||||
@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;
|
||||
|
||||
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
private Date startTime;
|
||||
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
private Date endTime;
|
||||
|
||||
}
|
|
@ -5,7 +5,7 @@
|
|||
<mapper namespace="net.srt.dao.DataServiceAppDao">
|
||||
|
||||
|
||||
<select id="selectByApplyId" resultType="net.srt.entity.DataServiceApppEntity">
|
||||
<select id="selectByApplyId" resultType="net.srt.entity.DataServiceAppEntity">
|
||||
SELECT dsa.* FROM data_service_app dsa INNER JOIN data_market_resource_apply dmra ON dsa.id=dmra.app_id WHERE dmra.id=#{applyId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
package net.srt.quartz.api;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import net.srt.api.module.data.governance.DataMetadataCollectApi;
|
||||
import net.srt.api.module.data.governance.constant.MetadataCollectType;
|
||||
import net.srt.api.module.data.governance.dto.DataGovernanceMetadataCollectDto;
|
||||
import net.srt.api.module.quartz.QuartzDataGovernanceMetadataCollectApi;
|
||||
import net.srt.api.module.quartz.constant.QuartzJobType;
|
||||
import net.srt.framework.common.utils.Result;
|
||||
import net.srt.quartz.entity.ScheduleJobEntity;
|
||||
import net.srt.quartz.enums.JobGroupEnum;
|
||||
import net.srt.quartz.enums.ScheduleConcurrentEnum;
|
||||
import net.srt.quartz.enums.ScheduleStatusEnum;
|
||||
import net.srt.quartz.service.ScheduleJobService;
|
||||
import net.srt.quartz.utils.ScheduleUtils;
|
||||
import org.quartz.Scheduler;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 短信服务API
|
||||
*
|
||||
* @author 阿沐 babamu@126.com
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
public class QuartzDataGovernanceMetadataCollectApiImpl implements QuartzDataGovernanceMetadataCollectApi {
|
||||
|
||||
private final Scheduler scheduler;
|
||||
private final DataMetadataCollectApi dataMetadataCollectApi;
|
||||
private final ScheduleJobService jobService;
|
||||
|
||||
@Override
|
||||
public Result<String> release(Long id) {
|
||||
ScheduleJobEntity jobEntity = buildJobEntity(id);
|
||||
//判断是否存在,不存在,新增,存在,设置主键
|
||||
jobService.buildSystemJob(jobEntity);
|
||||
ScheduleUtils.createScheduleJob(scheduler, jobEntity);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<String> cancel(Long id) {
|
||||
ScheduleJobEntity jobEntity = buildJobEntity(id);
|
||||
jobService.buildSystemJob(jobEntity);
|
||||
ScheduleUtils.deleteScheduleJob(scheduler, jobEntity);
|
||||
//更新任务状态为暂停
|
||||
jobService.pauseSystemJob(jobEntity);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<String> handRun(Long id) {
|
||||
ScheduleJobEntity jobEntity = buildJobEntity(id);
|
||||
jobEntity.setOnce(true);
|
||||
jobEntity.setSaveLog(false);
|
||||
ScheduleUtils.run(scheduler, jobEntity);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
private ScheduleJobEntity buildJobEntity(Long id) {
|
||||
DataGovernanceMetadataCollectDto collectDto = dataMetadataCollectApi.getById(id).getData();
|
||||
return ScheduleJobEntity.builder().typeId(id).projectId(collectDto.getProjectId()).jobType(QuartzJobType.DATA_GOVERNANCE.getValue()).jobName(String.format("[%s]%s", id.toString(), collectDto.getName())).concurrent(ScheduleConcurrentEnum.NO.getValue())
|
||||
.beanName("dataGovernanceMetadataCollectTask").method("run").jobGroup(JobGroupEnum.DATA_GOVERNANCE.getValue()).saveLog(true).cronExpression(collectDto.getCron()).status(ScheduleStatusEnum.NORMAL.getValue())
|
||||
.params(String.valueOf(id)).once(MetadataCollectType.ONCE.getValue().equals(collectDto.getTaskType())).build();
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package net.srt.quartz.api;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import net.srt.api.module.data.governance.DataQualityApi;
|
||||
import net.srt.api.module.data.governance.constant.MetadataCollectType;
|
||||
import net.srt.api.module.data.governance.dto.DataGovernanceQualityConfigDto;
|
||||
import net.srt.api.module.quartz.QuartzDataGovernanceQualityApi;
|
||||
import net.srt.api.module.quartz.constant.QuartzJobType;
|
||||
import net.srt.framework.common.utils.Result;
|
||||
import net.srt.quartz.entity.ScheduleJobEntity;
|
||||
import net.srt.quartz.enums.JobGroupEnum;
|
||||
import net.srt.quartz.enums.ScheduleConcurrentEnum;
|
||||
import net.srt.quartz.enums.ScheduleStatusEnum;
|
||||
import net.srt.quartz.service.ScheduleJobService;
|
||||
import net.srt.quartz.utils.ScheduleUtils;
|
||||
import org.quartz.Scheduler;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 短信服务API
|
||||
*
|
||||
* @author 阿沐 babamu@126.com
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
public class QuartzDataGovernanceQualityApiImpl implements QuartzDataGovernanceQualityApi {
|
||||
|
||||
private final Scheduler scheduler;
|
||||
private final DataQualityApi dataQualityApi;
|
||||
private final ScheduleJobService jobService;
|
||||
|
||||
@Override
|
||||
public Result<String> release(Long id) {
|
||||
ScheduleJobEntity jobEntity = buildJobEntity(id);
|
||||
//判断是否存在,不存在,新增,存在,设置主键
|
||||
jobService.buildSystemJob(jobEntity);
|
||||
ScheduleUtils.createScheduleJob(scheduler, jobEntity);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<String> cancel(Long id) {
|
||||
ScheduleJobEntity jobEntity = buildJobEntity(id);
|
||||
jobService.buildSystemJob(jobEntity);
|
||||
ScheduleUtils.deleteScheduleJob(scheduler, jobEntity);
|
||||
//更新任务状态为暂停
|
||||
jobService.pauseSystemJob(jobEntity);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<String> handRun(Long id) {
|
||||
ScheduleJobEntity jobEntity = buildJobEntity(id);
|
||||
jobEntity.setOnce(true);
|
||||
jobEntity.setSaveLog(false);
|
||||
ScheduleUtils.run(scheduler, jobEntity);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
private ScheduleJobEntity buildJobEntity(Long id) {
|
||||
DataGovernanceQualityConfigDto qualityConfigDto = dataQualityApi.getById(id).getData();
|
||||
return ScheduleJobEntity.builder().typeId(id).projectId(qualityConfigDto.getProjectId()).jobType(QuartzJobType.DATA_QUALITY.getValue()).jobName(String.format("[%s]%s", id.toString(), qualityConfigDto.getName())).concurrent(ScheduleConcurrentEnum.NO.getValue())
|
||||
.beanName("dataQualityTask").method("run").jobGroup(JobGroupEnum.DATA_QUALITY.getValue()).saveLog(true).cronExpression(qualityConfigDto.getCron()).status(ScheduleStatusEnum.NORMAL.getValue())
|
||||
.params(String.valueOf(id)).once(MetadataCollectType.ONCE.getValue().equals(qualityConfigDto.getTaskType())).build();
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
package net.srt.quartz.api;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import net.srt.api.module.data.development.DataProductionScheduleApi;
|
||||
import net.srt.api.module.data.development.dto.DataProductionScheduleDto;
|
||||
import net.srt.api.module.quartz.QuartzDataProductionScheduleApi;
|
||||
import net.srt.api.module.quartz.constant.QuartzJobType;
|
||||
import net.srt.framework.common.utils.Result;
|
||||
import net.srt.quartz.entity.ScheduleJobEntity;
|
||||
import net.srt.quartz.enums.JobGroupEnum;
|
||||
import net.srt.quartz.enums.ScheduleConcurrentEnum;
|
||||
import net.srt.quartz.enums.ScheduleStatusEnum;
|
||||
import net.srt.quartz.service.ScheduleJobService;
|
||||
import net.srt.quartz.utils.ScheduleUtils;
|
||||
import org.quartz.Scheduler;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 短信服务API
|
||||
*
|
||||
* @author 阿沐 babamu@126.com
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
public class QuartzDataProductionScheduleApiImpl implements QuartzDataProductionScheduleApi {
|
||||
|
||||
private final Scheduler scheduler;
|
||||
private final DataProductionScheduleApi scheduleApi;
|
||||
private final ScheduleJobService jobService;
|
||||
|
||||
@Override
|
||||
public Result<String> release(Long id) {
|
||||
ScheduleJobEntity jobEntity = buildJobEntity(id);
|
||||
//判断是否存在,不存在,新增,存在,设置主键
|
||||
jobService.buildSystemJob(jobEntity);
|
||||
ScheduleUtils.createScheduleJob(scheduler, jobEntity);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<String> cancle(Long id) {
|
||||
ScheduleJobEntity jobEntity = buildJobEntity(id);
|
||||
jobService.buildSystemJob(jobEntity);
|
||||
ScheduleUtils.deleteScheduleJob(scheduler, jobEntity);
|
||||
//更新任务状态为暂停
|
||||
jobService.pauseSystemJob(jobEntity);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
|
||||
private ScheduleJobEntity buildJobEntity(Long id) {
|
||||
DataProductionScheduleDto scheduleDto = scheduleApi.getById(id).getData();
|
||||
return ScheduleJobEntity.builder().typeId(id).projectId(scheduleDto.getProjectId()).jobType(QuartzJobType.DATA_PRODUCTION.getValue()).jobName(String.format("[%s]%s", id.toString(), scheduleDto.getName())).concurrent(ScheduleConcurrentEnum.NO.getValue())
|
||||
.beanName("dataProductionScheduleTask").method("run").jobGroup(JobGroupEnum.DATA_PRODUCTION.getValue()).saveLog(true).cronExpression(scheduleDto.getCron()).status(ScheduleStatusEnum.NORMAL.getValue())
|
||||
.params(String.valueOf(id)).once(scheduleDto.getIfCycle() == 0).build();
|
||||
}
|
||||
}
|
|
@ -1,31 +1,10 @@
|
|||
package net.srt.disposition.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
/**
|
||||
* @BelongsProject: srt_cloud
|
||||
* @BelongsPackage: net.srt.disposition.dto
|
||||
* @Author: jpz
|
||||
* @CreateTime: 2023/12/23 9:09
|
||||
*/
|
||||
public class DataProductionTreeDto {
|
||||
private Integer id;
|
||||
private Integer parentId;
|
||||
private Integer ifLeaf;
|
||||
private Long taskId;
|
||||
private String taskType;
|
||||
private String parentPath;
|
||||
private String path;
|
||||
private Integer orderNo;
|
||||
private String label;
|
||||
private Long metamodelId;
|
||||
private String name;
|
||||
private String icon;
|
||||
private String code;
|
||||
private Boolean builtin;
|
||||
private String description;
|
||||
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 creatTime;
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ public class DataProductionServiceImpl extends BaseServiceImpl<DataProductionMap
|
|||
}
|
||||
|
||||
|
||||
private static List<DataProductionTreeVo> getChild(Long id, List<DataProductionTreeVo> nodeVos) {
|
||||
private static List<DataProductionTreeVo> getChild(Integer id, List<DataProductionTreeVo> nodeVos) {
|
||||
// 子菜单
|
||||
List<DataProductionTreeVo> childList = new ArrayList<>(10);
|
||||
for (DataProductionTreeVo node : nodeVos) {
|
||||
|
|
|
@ -11,8 +11,8 @@ import java.util.List;
|
|||
|
||||
@Data
|
||||
public class DataProductionTreeVo {
|
||||
private Integer id;
|
||||
private Integer parentId;
|
||||
private Long id;
|
||||
private Long parentId;
|
||||
private Integer ifLeaf;
|
||||
private Long taskId;
|
||||
private String taskType;
|
||||
|
|
Loading…
Reference in New Issue