forked from github/dataease
Merge pull request #11555 from dataease/pr@dev-v2@feat_relation
feat(组织管理中心): 新增血缘关系分析
This commit is contained in:
commit
715573c256
@ -5,6 +5,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import io.dataease.api.dataset.union.DatasetGroupInfoDTO;
|
||||
import io.dataease.api.dataset.union.UnionDTO;
|
||||
import io.dataease.api.dataset.vo.DataSetBarVO;
|
||||
import io.dataease.api.permissions.relation.api.RelationApi;
|
||||
import io.dataease.commons.constants.OptConstants;
|
||||
import io.dataease.dataset.dao.auto.entity.CoreDatasetGroup;
|
||||
import io.dataease.dataset.dao.auto.entity.CoreDatasetTable;
|
||||
@ -35,6 +36,7 @@ import jakarta.annotation.Resource;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@ -43,6 +45,8 @@ import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static io.dataease.result.ResultCode.DV_RESOURCE_UNCHECKED;
|
||||
|
||||
/**
|
||||
* @Author Junjun
|
||||
*/
|
||||
@ -75,6 +79,9 @@ public class DatasetGroupManage {
|
||||
@Resource
|
||||
private CoreOptRecentManage coreOptRecentManage;
|
||||
|
||||
@Autowired(required = false)
|
||||
private RelationApi relationManage;
|
||||
|
||||
private static final String leafType = "dataset";
|
||||
|
||||
private Lock lock = new ReentrantLock();
|
||||
@ -176,6 +183,21 @@ public class DatasetGroupManage {
|
||||
return datasetGroupInfoDTO;
|
||||
}
|
||||
|
||||
public boolean perDelete(Long id) {
|
||||
if (LicenseUtil.licenseValid()) {
|
||||
try {
|
||||
relationManage.checkAuth();
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
Long count = relationManage.getDatasetResource(id);
|
||||
if (count > 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@XpackInteract(value = "authResourceTree", before = false)
|
||||
public void delete(Long id) {
|
||||
CoreDatasetGroup coreDatasetGroup = coreDatasetGroupMapper.selectById(id);
|
||||
|
@ -49,6 +49,11 @@ public class DatasetTreeServer implements DatasetTreeApi {
|
||||
return datasetGroupManage.move(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean perDelete(Long id) {
|
||||
return datasetGroupManage.perDelete(id);
|
||||
}
|
||||
|
||||
@DeLog(id = "#p0", ot = LogOT.DELETE, st = LogST.DATASET)
|
||||
@Override
|
||||
public void delete(Long id) {
|
||||
|
@ -13,6 +13,7 @@ import io.dataease.api.ds.vo.ApiDefinition;
|
||||
import io.dataease.api.ds.vo.CoreDatasourceTaskLogDTO;
|
||||
import io.dataease.api.ds.vo.ExcelFileData;
|
||||
import io.dataease.api.ds.vo.ExcelSheetData;
|
||||
import io.dataease.api.permissions.relation.api.RelationApi;
|
||||
import io.dataease.commons.constants.TaskStatus;
|
||||
import io.dataease.constant.LogOT;
|
||||
import io.dataease.constant.LogST;
|
||||
@ -69,6 +70,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
import static io.dataease.datasource.server.DatasourceTaskServer.ScheduleType.MANUAL;
|
||||
import static io.dataease.datasource.server.DatasourceTaskServer.ScheduleType.RIGHTNOW;
|
||||
import static io.dataease.result.ResultCode.DS_RESOURCE_UNCHECKED;
|
||||
|
||||
|
||||
@RestController
|
||||
@ -106,6 +108,8 @@ public class DatasourceServer implements DatasourceApi {
|
||||
|
||||
@Autowired(required = false)
|
||||
private PluginManageApi pluginManage;
|
||||
@Autowired(required = false)
|
||||
private RelationApi relationManage;
|
||||
|
||||
@Override
|
||||
public List<DatasourceDTO> query(String keyWord) {
|
||||
@ -627,6 +631,22 @@ public class DatasourceServer implements DatasourceApi {
|
||||
return datasourceDTO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean perDelete(Long id) {
|
||||
if (LicenseUtil.licenseValid()) {
|
||||
try {
|
||||
relationManage.checkAuth();
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
Long count = relationManage.getDsResource(id);
|
||||
if (count > 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@DeLog(id = "#p0", ot = LogOT.DELETE, st = LogST.DATASOURCE)
|
||||
@Override
|
||||
|
@ -94,4 +94,6 @@ public class SQLConstants {
|
||||
public static final String QUARTER = "QUARTER(%s)";
|
||||
|
||||
public static final String EMPTY_SIGN = "_empty_$";
|
||||
|
||||
public static final String CONCAT = "CONCAT(%s, %s)";
|
||||
}
|
||||
|
@ -60,6 +60,10 @@ public interface DatasetTreeApi {
|
||||
@PostMapping("move")
|
||||
DatasetNodeDTO move(@RequestBody DatasetGroupInfoDTO dto) throws Exception;
|
||||
|
||||
@DePermit({"#p0+':manage'"})
|
||||
@PostMapping("perDelete/{id}")
|
||||
boolean perDelete(@PathVariable("id") Long id);
|
||||
|
||||
@Operation(summary = "删除数据集")
|
||||
@DePermit({"#p0+':manage'"})
|
||||
@PostMapping("delete/{id}")
|
||||
|
@ -66,6 +66,10 @@ public interface DatasourceApi {
|
||||
@GetMapping("/validate/{datasourceId}")
|
||||
DatasourceDTO validate(@PathVariable("datasourceId") Long datasourceId) throws DEException;
|
||||
|
||||
@DePermit({"#p0+':manage'"})
|
||||
@PostMapping("/perDelete/{datasourceId}")
|
||||
boolean perDelete(@PathVariable("datasourceId") Long datasourceId);
|
||||
|
||||
@DePermit({"#p0+':manage'"})
|
||||
@GetMapping("/delete/{datasourceId}")
|
||||
void delete(@PathVariable("datasourceId") Long datasourceId) throws DEException;
|
||||
|
@ -0,0 +1,14 @@
|
||||
package io.dataease.api.permissions.relation.api;
|
||||
|
||||
import io.dataease.exception.DEException;
|
||||
|
||||
/**
|
||||
* @Author Junjun
|
||||
*/
|
||||
public interface RelationApi {
|
||||
Long getDsResource(Long id);
|
||||
|
||||
Long getDatasetResource(Long id);
|
||||
|
||||
void checkAuth() throws DEException;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package io.dataease.api.permissions.relation.dto;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author Junjun
|
||||
*/
|
||||
@Data
|
||||
public class RelationDTO {
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
private String name;
|
||||
private String auths;
|
||||
private String type;
|
||||
private String creator;
|
||||
private Long updateTime;
|
||||
private List<RelationDTO> subRelation;
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package io.dataease.api.permissions.relation.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Author Junjun
|
||||
*/
|
||||
@Data
|
||||
public class RelationListDTO implements Serializable {
|
||||
private Long dsId;
|
||||
private String dsName;
|
||||
private String dsCreator;
|
||||
private Long dsUpdateTime;
|
||||
|
||||
private Long datasetId;
|
||||
private String datasetName;
|
||||
private String datasetCreator;
|
||||
private Long datasetUpdateTime;
|
||||
|
||||
private Long dashboardId;
|
||||
private String dashboardName;
|
||||
private String dashboardCreator;
|
||||
private Long dashboardUpdateTime;
|
||||
|
||||
private Long dvId;
|
||||
private String dvName;
|
||||
private String dvCreator;
|
||||
private Long dvUpdateTime;
|
||||
}
|
@ -27,6 +27,9 @@ public enum ResultCode {
|
||||
RESULE_DATA_NONE(50001, "数据未找到"),
|
||||
DATA_IS_WRONG(50002, "数据有误"),
|
||||
DATA_ALREADY_EXISTED(50003, "数据已存在"),
|
||||
DS_RESOURCE_UNCHECKED(50004, "%s个数据集正在使用此数据源,无法删除"),
|
||||
|
||||
DV_RESOURCE_UNCHECKED(50004, "%s个仪表板或数据大屏正在使用此数据集,无法删除"),
|
||||
|
||||
/* 接口错误:60001-69999 */
|
||||
INTERFACE_INNER_INVOKE_ERROR(60001, "内部系统接口调用异常"),
|
||||
|
Loading…
Reference in New Issue
Block a user