Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
njgzx
dataease
Commits
3e6caadf
提交
3e6caadf
authored
5月 24, 2021
作者:
xiajunjie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(backend):tree delete fix
上级
d922fe11
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
41 行增加
和
14 行删除
+41
-14
ExtDataSetGroupMapper.java
...va/io/dataease/base/mapper/ext/ExtDataSetGroupMapper.java
+3
-0
ExtDataSetGroupMapper.xml
...ava/io/dataease/base/mapper/ext/ExtDataSetGroupMapper.xml
+3
-1
ChartGroupService.java
...ain/java/io/dataease/service/chart/ChartGroupService.java
+15
-3
DataSetGroupService.java
...java/io/dataease/service/dataset/DataSetGroupService.java
+12
-6
DataSetTableService.java
...java/io/dataease/service/dataset/DataSetTableService.java
+8
-4
没有找到文件。
backend/src/main/java/io/dataease/base/mapper/ext/ExtDataSetGroupMapper.java
浏览文件 @
3e6caadf
...
@@ -4,7 +4,10 @@ import io.dataease.controller.request.dataset.DataSetGroupRequest;
...
@@ -4,7 +4,10 @@ import io.dataease.controller.request.dataset.DataSetGroupRequest;
import
io.dataease.dto.dataset.DataSetGroupDTO
;
import
io.dataease.dto.dataset.DataSetGroupDTO
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
public
interface
ExtDataSetGroupMapper
{
public
interface
ExtDataSetGroupMapper
{
List
<
DataSetGroupDTO
>
search
(
DataSetGroupRequest
ChartGroup
);
List
<
DataSetGroupDTO
>
search
(
DataSetGroupRequest
ChartGroup
);
Map
<
String
,
String
>
searchIds
(
String
id
,
String
type
);
}
}
backend/src/main/java/io/dataease/base/mapper/ext/ExtDataSetGroupMapper.xml
浏览文件 @
3e6caadf
...
@@ -41,7 +41,9 @@
...
@@ -41,7 +41,9 @@
<if
test=
"sort != null"
>
<if
test=
"sort != null"
>
order by ${sort}
order by ${sort}
</if>
</if>
</select>
<select
id=
"searchIds"
resultType=
"java.util.Map"
>
select GET_V_AUTH_MODEL_WITH_CHILDREN(#{id},#{type}) ids
</select>
</select>
</mapper>
</mapper>
backend/src/main/java/io/dataease/service/chart/ChartGroupService.java
浏览文件 @
3e6caadf
...
@@ -3,6 +3,7 @@ package io.dataease.service.chart;
...
@@ -3,6 +3,7 @@ package io.dataease.service.chart;
import
io.dataease.base.domain.*
;
import
io.dataease.base.domain.*
;
import
io.dataease.base.mapper.ChartGroupMapper
;
import
io.dataease.base.mapper.ChartGroupMapper
;
import
io.dataease.base.mapper.ext.ExtChartGroupMapper
;
import
io.dataease.base.mapper.ext.ExtChartGroupMapper
;
import
io.dataease.base.mapper.ext.ExtDataSetGroupMapper
;
import
io.dataease.commons.utils.AuthUtils
;
import
io.dataease.commons.utils.AuthUtils
;
import
io.dataease.commons.utils.BeanUtils
;
import
io.dataease.commons.utils.BeanUtils
;
import
io.dataease.commons.utils.TreeUtils
;
import
io.dataease.commons.utils.TreeUtils
;
...
@@ -11,12 +12,14 @@ import io.dataease.controller.request.dataset.DataSetTableRequest;
...
@@ -11,12 +12,14 @@ import io.dataease.controller.request.dataset.DataSetTableRequest;
import
io.dataease.dto.chart.ChartGroupDTO
;
import
io.dataease.dto.chart.ChartGroupDTO
;
import
io.dataease.i18n.Translator
;
import
io.dataease.i18n.Translator
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.UUID
;
import
java.util.UUID
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -27,9 +30,10 @@ public class ChartGroupService {
...
@@ -27,9 +30,10 @@ public class ChartGroupService {
private
ChartGroupMapper
chartGroupMapper
;
private
ChartGroupMapper
chartGroupMapper
;
@Resource
@Resource
private
ChartViewService
chartViewService
;
private
ChartViewService
chartViewService
;
@Resource
@Resource
private
ExtChartGroupMapper
extChartGroupMapper
;
private
ExtChartGroupMapper
extChartGroupMapper
;
@Resource
private
ExtDataSetGroupMapper
extDataSetGroupMapper
;
public
ChartGroupDTO
save
(
ChartGroup
chartGroup
)
{
public
ChartGroupDTO
save
(
ChartGroup
chartGroup
)
{
checkName
(
chartGroup
);
checkName
(
chartGroup
);
...
@@ -51,9 +55,14 @@ public class ChartGroupService {
...
@@ -51,9 +55,14 @@ public class ChartGroupService {
ChartGroup
cg
=
chartGroupMapper
.
selectByPrimaryKey
(
id
);
ChartGroup
cg
=
chartGroupMapper
.
selectByPrimaryKey
(
id
);
ChartGroupRequest
ChartGroup
=
new
ChartGroupRequest
();
ChartGroupRequest
ChartGroup
=
new
ChartGroupRequest
();
BeanUtils
.
copyBean
(
ChartGroup
,
cg
);
BeanUtils
.
copyBean
(
ChartGroup
,
cg
);
List
<
ChartGroupDTO
>
tree
=
tree
(
ChartGroup
);
Map
<
String
,
String
>
stringStringMap
=
extDataSetGroupMapper
.
searchIds
(
id
,
"chart"
);
String
[]
split
=
stringStringMap
.
get
(
"ids"
).
split
(
","
);
List
<
String
>
ids
=
new
ArrayList
<>();
List
<
String
>
ids
=
new
ArrayList
<>();
getAllId
(
tree
,
ids
);
for
(
String
dsId
:
split
)
{
if
(
StringUtils
.
isNotEmpty
(
dsId
))
{
ids
.
add
(
dsId
);
}
}
ChartGroupExample
ChartGroupExample
=
new
ChartGroupExample
();
ChartGroupExample
ChartGroupExample
=
new
ChartGroupExample
();
ChartGroupExample
.
createCriteria
().
andIdIn
(
ids
);
ChartGroupExample
.
createCriteria
().
andIdIn
(
ids
);
chartGroupMapper
.
deleteByExample
(
ChartGroupExample
);
chartGroupMapper
.
deleteByExample
(
ChartGroupExample
);
...
@@ -104,6 +113,9 @@ public class ChartGroupService {
...
@@ -104,6 +113,9 @@ public class ChartGroupService {
if
(
StringUtils
.
isNotEmpty
(
chartGroup
.
getId
()))
{
if
(
StringUtils
.
isNotEmpty
(
chartGroup
.
getId
()))
{
criteria
.
andIdNotEqualTo
(
chartGroup
.
getId
());
criteria
.
andIdNotEqualTo
(
chartGroup
.
getId
());
}
}
if
(
ObjectUtils
.
isNotEmpty
(
chartGroup
.
getLevel
()))
{
criteria
.
andLevelEqualTo
(
chartGroup
.
getLevel
());
}
List
<
ChartGroup
>
list
=
chartGroupMapper
.
selectByExample
(
chartGroupExample
);
List
<
ChartGroup
>
list
=
chartGroupMapper
.
selectByExample
(
chartGroupExample
);
if
(
list
.
size
()
>
0
)
{
if
(
list
.
size
()
>
0
)
{
throw
new
RuntimeException
(
Translator
.
get
(
"i18n_name_cant_repeat_same_group"
));
throw
new
RuntimeException
(
Translator
.
get
(
"i18n_name_cant_repeat_same_group"
));
...
...
backend/src/main/java/io/dataease/service/dataset/DataSetGroupService.java
浏览文件 @
3e6caadf
...
@@ -14,15 +14,13 @@ import io.dataease.dto.dataset.DataSetGroupDTO;
...
@@ -14,15 +14,13 @@ import io.dataease.dto.dataset.DataSetGroupDTO;
import
io.dataease.dto.dataset.DataSetTableDTO
;
import
io.dataease.dto.dataset.DataSetTableDTO
;
import
io.dataease.i18n.Translator
;
import
io.dataease.i18n.Translator
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.UUID
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
...
@@ -59,9 +57,14 @@ public class DataSetGroupService {
...
@@ -59,9 +57,14 @@ public class DataSetGroupService {
DatasetGroup
dg
=
datasetGroupMapper
.
selectByPrimaryKey
(
id
);
DatasetGroup
dg
=
datasetGroupMapper
.
selectByPrimaryKey
(
id
);
DataSetGroupRequest
datasetGroup
=
new
DataSetGroupRequest
();
DataSetGroupRequest
datasetGroup
=
new
DataSetGroupRequest
();
BeanUtils
.
copyBean
(
datasetGroup
,
dg
);
BeanUtils
.
copyBean
(
datasetGroup
,
dg
);
List
<
DataSetGroupDTO
>
tree
=
tree
(
datasetGroup
);
Map
<
String
,
String
>
stringStringMap
=
extDataSetGroupMapper
.
searchIds
(
id
,
"dataset"
);
String
[]
split
=
stringStringMap
.
get
(
"ids"
).
split
(
","
);
List
<
String
>
ids
=
new
ArrayList
<>();
List
<
String
>
ids
=
new
ArrayList
<>();
getAllId
(
tree
,
ids
);
for
(
String
dsId
:
split
)
{
if
(
StringUtils
.
isNotEmpty
(
dsId
))
{
ids
.
add
(
dsId
);
}
}
DatasetGroupExample
datasetGroupExample
=
new
DatasetGroupExample
();
DatasetGroupExample
datasetGroupExample
=
new
DatasetGroupExample
();
datasetGroupExample
.
createCriteria
().
andIdIn
(
ids
);
datasetGroupExample
.
createCriteria
().
andIdIn
(
ids
);
datasetGroupMapper
.
deleteByExample
(
datasetGroupExample
);
datasetGroupMapper
.
deleteByExample
(
datasetGroupExample
);
...
@@ -117,6 +120,9 @@ public class DataSetGroupService {
...
@@ -117,6 +120,9 @@ public class DataSetGroupService {
if
(
StringUtils
.
isNotEmpty
(
datasetGroup
.
getId
()))
{
if
(
StringUtils
.
isNotEmpty
(
datasetGroup
.
getId
()))
{
criteria
.
andIdNotEqualTo
(
datasetGroup
.
getId
());
criteria
.
andIdNotEqualTo
(
datasetGroup
.
getId
());
}
}
if
(
ObjectUtils
.
isNotEmpty
(
datasetGroup
.
getLevel
()))
{
criteria
.
andLevelEqualTo
(
datasetGroup
.
getLevel
());
}
List
<
DatasetGroup
>
list
=
datasetGroupMapper
.
selectByExample
(
datasetGroupExample
);
List
<
DatasetGroup
>
list
=
datasetGroupMapper
.
selectByExample
(
datasetGroupExample
);
if
(
list
.
size
()
>
0
)
{
if
(
list
.
size
()
>
0
)
{
throw
new
RuntimeException
(
Translator
.
get
(
"i18n_name_cant_repeat_same_group"
));
throw
new
RuntimeException
(
Translator
.
get
(
"i18n_name_cant_repeat_same_group"
));
...
...
backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java
浏览文件 @
3e6caadf
...
@@ -128,7 +128,11 @@ public class DataSetTableService {
...
@@ -128,7 +128,11 @@ public class DataSetTableService {
dataSetTableFieldsService
.
deleteByTableId
(
id
);
dataSetTableFieldsService
.
deleteByTableId
(
id
);
// 删除同步任务
// 删除同步任务
dataSetTableTaskService
.
deleteByTableId
(
id
);
dataSetTableTaskService
.
deleteByTableId
(
id
);
deleteDorisTable
(
id
);
try
{
deleteDorisTable
(
id
);
}
catch
(
Exception
e
)
{
}
}
}
private
void
deleteDorisTable
(
String
datasetId
)
throws
Exception
{
private
void
deleteDorisTable
(
String
datasetId
)
throws
Exception
{
...
@@ -260,13 +264,13 @@ public class DataSetTableService {
...
@@ -260,13 +264,13 @@ public class DataSetTableService {
}
}
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
datasetTable
.
getType
(),
"excel"
))
{
}
else
if
(
StringUtils
.
equalsIgnoreCase
(
datasetTable
.
getType
(),
"excel"
))
{
List
<
DatasetTableTaskLog
>
datasetTableTaskLogs
=
dataSetTableTaskLogService
.
getByTableId
(
datasetTable
.
getId
());
List
<
DatasetTableTaskLog
>
datasetTableTaskLogs
=
dataSetTableTaskLogService
.
getByTableId
(
datasetTable
.
getId
());
if
(
CollectionUtils
.
isEmpty
(
datasetTableTaskLogs
))
{
if
(
CollectionUtils
.
isEmpty
(
datasetTableTaskLogs
))
{
throw
new
Exception
(
"no records"
);
throw
new
Exception
(
"no records"
);
}
}
if
(
datasetTableTaskLogs
.
get
(
0
).
getStatus
().
equalsIgnoreCase
(
JobStatus
.
Underway
.
name
()))
{
if
(
datasetTableTaskLogs
.
get
(
0
).
getStatus
().
equalsIgnoreCase
(
JobStatus
.
Underway
.
name
()))
{
throw
new
Exception
(
Translator
.
get
(
"i18n_processing_data"
));
throw
new
Exception
(
Translator
.
get
(
"i18n_processing_data"
));
}
}
if
(
datasetTableTaskLogs
.
get
(
0
).
getStatus
().
equalsIgnoreCase
(
JobStatus
.
Error
.
name
()))
{
if
(
datasetTableTaskLogs
.
get
(
0
).
getStatus
().
equalsIgnoreCase
(
JobStatus
.
Error
.
name
()))
{
throw
new
Exception
(
"Failed to extract data: "
+
datasetTableTaskLogs
.
get
(
0
).
getInfo
());
throw
new
Exception
(
"Failed to extract data: "
+
datasetTableTaskLogs
.
get
(
0
).
getInfo
());
}
}
Datasource
ds
=
(
Datasource
)
CommonBeanFactory
.
getBean
(
"DorisDatasource"
);
Datasource
ds
=
(
Datasource
)
CommonBeanFactory
.
getBean
(
"DorisDatasource"
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论