提交 6baf1953 authored 作者: taojinlong's avatar taojinlong

Merge branch 'v1.1' of github.com:dataease/dataease into v1.1

......@@ -37,6 +37,12 @@
<if test="createTime != null">
and chart_group.create_time = #{createTime,jdbcType=BIGINT}
</if>
<if test="ids != null and ids.size() > 0">
and id in
<foreach collection="ids" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
</where>
<if test="sort != null">
order by ${sort}
......
......@@ -39,6 +39,9 @@
<if test="sceneId != null">
and scene_id = #{sceneId,jdbcType=VARCHAR}
</if>
<if test="name != null">
and name like CONCAT('%', #{name},'%')
</if>
</where>
<if test="sort != null">
order by ${sort}
......
......@@ -37,6 +37,12 @@
<if test="createTime != null">
and dataset_group.create_time = #{createTime,jdbcType=BIGINT}
</if>
<if test="ids != null and ids.size() > 0">
and id in
<foreach collection="ids" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
</where>
<if test="sort != null">
order by ${sort}
......
......@@ -45,6 +45,9 @@
<if test="sceneId != null">
and scene_id = #{sceneId,jdbcType=VARCHAR}
</if>
<if test="name != null">
and name like CONCAT('%', #{name},'%')
</if>
<if test="mode != null">
and mode = #{mode,jdbcType=INTEGER}
</if>
......
......@@ -4,7 +4,9 @@ import io.dataease.base.domain.ChartViewWithBLOBs;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.controller.request.chart.ChartExtRequest;
import io.dataease.controller.request.chart.ChartViewRequest;
import io.dataease.controller.request.dataset.DataSetTableRequest;
import io.dataease.dto.chart.ChartViewDTO;
import io.dataease.dto.dataset.DataSetTableDTO;
import io.dataease.service.chart.ChartViewService;
import org.springframework.web.bind.annotation.*;
......@@ -63,7 +65,7 @@ public class ChartViewController {
}
@GetMapping("searchAdviceSceneId/{panelId}")
public String searchAdviceSceneId(@PathVariable String panelId){
public String searchAdviceSceneId(@PathVariable String panelId) {
return chartViewService.searchAdviceSceneId(panelId);
}
......@@ -71,10 +73,16 @@ public class ChartViewController {
public ChartViewDTO getOneWithPermission(@PathVariable String id, @RequestBody ChartExtRequest requestList) throws Exception {
//如果能获取用户 则添加对应的权限
ChartViewDTO dto = chartViewService.getData(id, requestList);
if(dto!=null && AuthUtils.getUser()!=null){
if (dto != null && AuthUtils.getUser() != null) {
ChartViewDTO permissionDto = chartViewService.getOneWithPermission(dto.getId());
dto.setPrivileges(permissionDto.getPrivileges());
}
return dto;
}
@PostMapping("search")
public List<ChartViewDTO> search(@RequestBody ChartViewRequest chartViewRequest) {
return chartViewService.search(chartViewRequest);
}
}
......@@ -108,4 +108,9 @@ public class DataSetTableController {
public Boolean checkDorisTableIsExists(@PathVariable String id) throws Exception {
return dataSetTableService.checkDorisTableIsExists(id);
}
@PostMapping("search")
public List<DataSetTableDTO> search(@RequestBody DataSetTableRequest dataSetTableRequest) {
return dataSetTableService.search(dataSetTableRequest);
}
}
......@@ -3,9 +3,12 @@ package io.dataease.controller.request.chart;
import io.dataease.base.domain.ChartGroup;
import lombok.Data;
import java.util.Set;
@Data
public class ChartGroupRequest extends ChartGroup {
private String sort;
private String userId;
private Set<String> ids;
}
......@@ -3,6 +3,9 @@ package io.dataease.controller.request.dataset;
import io.dataease.base.domain.DatasetGroup;
import lombok.Data;
import java.util.List;
import java.util.Set;
/**
* @Author gin
* @Date 2021/2/22 1:30 下午
......@@ -12,4 +15,6 @@ public class DataSetGroupRequest extends DatasetGroup {
private String sort;
private String userId;
private Set<String> ids;
}
......@@ -41,4 +41,6 @@ public class DorisConstants extends SQLConstants {
public static final String BRACKETS = "(%s)";
public static final String ROUND = "ROUND(%s,%s)";
public static final String VARCHAR = "VARCHAR";
}
......@@ -421,6 +421,8 @@ public class DorisQueryProvider extends QueryProvider {
if (field.getDeType() == 1 && field.getDeExtractType() != 1) {
String cast = String.format(DorisConstants.CAST, originName, DorisConstants.DEFAULT_INT_FORMAT) + "/1000";
whereName = String.format(DorisConstants.FROM_UNIXTIME, cast, DorisConstants.DEFAULT_DATE_FORMAT);
} else if (field.getDeType() == 0) {
whereName = String.format(DorisConstants.CAST, originName, DorisConstants.VARCHAR);
} else {
whereName = originName;
}
......@@ -462,6 +464,8 @@ public class DorisQueryProvider extends QueryProvider {
if (field.getDeType() == 1 && field.getDeExtractType() != 1) {
String cast = String.format(DorisConstants.CAST, originName, DorisConstants.DEFAULT_INT_FORMAT) + "/1000";
whereName = String.format(DorisConstants.FROM_UNIXTIME, cast, DorisConstants.DEFAULT_DATE_FORMAT);
} else if (field.getDeType() == 0) {
whereName = String.format(DorisConstants.CAST, originName, DorisConstants.VARCHAR);
} else {
whereName = originName;
}
......@@ -534,6 +538,8 @@ public class DorisQueryProvider extends QueryProvider {
String from_unixtime = String.format(DorisConstants.FROM_UNIXTIME, cast, DorisConstants.DEFAULT_DATE_FORMAT);
fieldName = String.format(DorisConstants.DATE_FORMAT, from_unixtime, format);
}
} else if (x.getDeType() == 0) {
fieldName = String.format(DorisConstants.CAST, originField, DorisConstants.VARCHAR);
} else {
fieldName = originField;
}
......
......@@ -15,11 +15,15 @@ import io.dataease.controller.request.chart.ChartExtFilterRequest;
import io.dataease.controller.request.chart.ChartExtRequest;
import io.dataease.controller.request.chart.ChartGroupRequest;
import io.dataease.controller.request.chart.ChartViewRequest;
import io.dataease.controller.request.dataset.DataSetGroupRequest;
import io.dataease.controller.request.dataset.DataSetTableRequest;
import io.dataease.datasource.provider.DatasourceProvider;
import io.dataease.datasource.provider.ProviderFactory;
import io.dataease.datasource.request.DatasourceRequest;
import io.dataease.datasource.service.DatasourceService;
import io.dataease.dto.chart.*;
import io.dataease.dto.dataset.DataSetGroupDTO;
import io.dataease.dto.dataset.DataSetTableDTO;
import io.dataease.dto.dataset.DataSetTableUnionDTO;
import io.dataease.dto.dataset.DataTableInfoDTO;
import io.dataease.i18n.Translator;
......@@ -110,6 +114,53 @@ public class ChartViewService {
return group;
}
public List<ChartViewDTO> search(ChartViewRequest chartViewRequest) {
String userId = String.valueOf(AuthUtils.getUser().getUserId());
chartViewRequest.setUserId(userId);
chartViewRequest.setSort("name asc");
List<ChartViewDTO> ds = extChartViewMapper.search(chartViewRequest);
if (CollectionUtils.isEmpty(ds)) {
return ds;
}
TreeSet<String> ids = new TreeSet<>();
ds.forEach(ele -> {
ele.setIsLeaf(true);
ele.setPid(ele.getSceneId());
ids.add(ele.getPid());
});
List<ChartViewDTO> group = new ArrayList<>();
ChartGroupRequest chartGroupRequest = new ChartGroupRequest();
chartGroupRequest.setUserId(userId);
chartGroupRequest.setIds(ids);
List<ChartGroupDTO> search = extChartGroupMapper.search(chartGroupRequest);
while (CollectionUtils.isNotEmpty(search)) {
ids.clear();
search.forEach(ele -> {
ChartViewDTO dto = new ChartViewDTO();
BeanUtils.copyBean(dto, ele);
dto.setIsLeaf(false);
dto.setType("group");
group.add(dto);
ids.add(ele.getPid());
});
chartGroupRequest.setIds(ids);
search = extChartGroupMapper.search(chartGroupRequest);
}
List<ChartViewDTO> res = new ArrayList<>();
Map<String, ChartViewDTO> map = new TreeMap<>();
group.forEach(ele -> map.put(ele.getId(), ele));
Iterator<Map.Entry<String, ChartViewDTO>> iterator = map.entrySet().iterator();
while (iterator.hasNext()) {
res.add(iterator.next().getValue());
}
res.sort(Comparator.comparing(ChartViewDTO::getName));
res.addAll(ds);
return res;
}
public ChartViewWithBLOBs get(String id) {
return chartViewMapper.selectByPrimaryKey(id);
}
......@@ -188,7 +239,7 @@ public class ChartViewService {
// 获取数据集
DatasetTable table = dataSetTableService.get(view.getTableId());
if (ObjectUtils.isEmpty(table)) {
throw new RuntimeException(Translator.get("i18n_dataset_delete"));
throw new RuntimeException(Translator.get("i18n_dataset_delete_or_no_permission"));
}
// 判断连接方式,直连或者定时抽取 table.mode
DatasourceRequest datasourceRequest = new DatasourceRequest();
......
......@@ -12,6 +12,7 @@ import io.dataease.commons.constants.JobStatus;
import io.dataease.commons.constants.ScheduleType;
import io.dataease.commons.constants.TaskStatus;
import io.dataease.commons.utils.*;
import io.dataease.controller.request.chart.ChartGroupRequest;
import io.dataease.controller.request.dataset.DataSetGroupRequest;
import io.dataease.controller.request.dataset.DataSetTableRequest;
import io.dataease.controller.request.dataset.DataSetTaskRequest;
......@@ -232,6 +233,53 @@ public class DataSetTableService {
return group;
}
public List<DataSetTableDTO> search(DataSetTableRequest dataSetTableRequest) {
String userId = String.valueOf(AuthUtils.getUser().getUserId());
dataSetTableRequest.setUserId(userId);
dataSetTableRequest.setSort("name asc");
List<DataSetTableDTO> ds = extDataSetTableMapper.search(dataSetTableRequest);
if (CollectionUtils.isEmpty(ds)) {
return ds;
}
TreeSet<String> ids = new TreeSet<>();
ds.forEach(ele -> {
ele.setIsLeaf(true);
ele.setPid(ele.getSceneId());
ids.add(ele.getPid());
});
List<DataSetTableDTO> group = new ArrayList<>();
DataSetGroupRequest dataSetGroupRequest = new DataSetGroupRequest();
dataSetGroupRequest.setUserId(userId);
dataSetGroupRequest.setIds(ids);
List<DataSetGroupDTO> search = extDataSetGroupMapper.search(dataSetGroupRequest);
while (CollectionUtils.isNotEmpty(search)) {
ids.clear();
search.forEach(ele -> {
DataSetTableDTO dto = new DataSetTableDTO();
BeanUtils.copyBean(dto, ele);
dto.setIsLeaf(false);
dto.setType("group");
group.add(dto);
ids.add(ele.getPid());
});
dataSetGroupRequest.setIds(ids);
search = extDataSetGroupMapper.search(dataSetGroupRequest);
}
List<DataSetTableDTO> res = new ArrayList<>();
Map<String, DataSetTableDTO> map = new TreeMap<>();
group.forEach(ele -> map.put(ele.getId(), ele));
Iterator<Map.Entry<String, DataSetTableDTO>> iterator = map.entrySet().iterator();
while (iterator.hasNext()) {
res.add(iterator.next().getValue());
}
res.sort(Comparator.comparing(DatasetTable::getName));
res.addAll(ds);
return res;
}
public DatasetTable get(String id) {
return datasetTableMapper.selectByPrimaryKey(id);
}
......@@ -1416,7 +1464,7 @@ public class DataSetTableService {
public static boolean checkIsRepeat(String[] array) {
HashSet<String> hashSet = new HashSet<String>();
for (int i = 0; i < array.length; i++) {
if(StringUtils.isEmpty(array[i])){
if (StringUtils.isEmpty(array[i])) {
throw new RuntimeException(Translator.get("i18n_excel_empty_column"));
}
hashSet.add(array[i]);
......
......@@ -103,11 +103,12 @@ export function batchEdit(data) {
})
}
export function post(url, data, showLoading = true) {
export function post(url, data, showLoading = true, timeout = 10000) {
return request({
url: url,
method: 'post',
loading: showLoading,
timeout: timeout,
data
})
}
......
......@@ -4,12 +4,14 @@ export function save(data) {
return request({
url: '/template/save',
data: data,
timeout: 60000,
method: 'post'
})
}
export function templateDelete(id) {
return request({
url: '/template/delete/' + id,
timeout: 60000,
method: 'delete'
})
}
......@@ -17,6 +19,7 @@ export function templateDelete(id) {
export function showTemplateList(data) {
return request({
url: '/template/templateList',
timeout: 60000,
data: data,
method: 'post'
})
......@@ -25,6 +28,7 @@ export function showTemplateList(data) {
export function findOne(id) {
return request({
url: '/template/findOne/' + id,
timeout: 60000,
method: 'get'
})
}
......@@ -32,6 +36,7 @@ export function findOne(id) {
export function find(data) {
return request({
url: '/template/find',
timeout: 60000,
data: data,
method: 'post'
})
......
......@@ -38,7 +38,7 @@
<br>
不同图表类型下的 {a},{b},{c},{d} 含义不一样。 其中变量{a}, {b}, {c}, {d}在不同图表类型下代表数据含义为:
<br><br>
折线(区域)图、柱状(条形)图、仪表盘、雷达图 : {a}(系列名称),{b}(类目值),{c}(数值), {d}(无)
折线(区域)图、柱状(条形)图、仪表盘、雷达图 : {a}(系列名称),{b}(类目值),{c}(数值)
<!-- <br>-->
<!-- 散点图(气泡)图 : {a}(系列名称),{b}(数据名称),{c}(数值数组), {d}(无)-->
<!-- <br>-->
......
......@@ -269,4 +269,8 @@ export default {
.table-class>>>.body--wrapper{
background: rgba(1,1,1,0);
}
.table-class>>>.elx-cell{
max-height: none!important;
line-height: normal!important;
}
</style>
......@@ -535,7 +535,8 @@ export default {
type: 'success',
showClose: true
})
this.treeNode(this.groupForm)
// this.treeNode(this.groupForm)
this.refreshNodeBy(group.pid)
})
} else {
// this.$message({
......@@ -588,7 +589,8 @@ export default {
message: this.$t('chart.delete_success'),
showClose: true
})
this.treeNode(this.groupForm)
// this.treeNode(this.groupForm)
this.refreshNodeBy(data.pid)
})
}).catch(() => {
})
......@@ -886,14 +888,18 @@ export default {
searchTree(val) {
const queryCondition = {
withExtend: 'parent',
modelType: 'chart',
// withExtend: 'parent',
// modelType: 'chart',
name: val
}
authModel(queryCondition).then(res => {
// this.highlights(res.data)
// authModel(queryCondition).then(res => {
// // this.highlights(res.data)
// this.tData = this.buildTree(res.data)
// // console.log(this.tData)
// })
post('/chart/view/search', queryCondition).then(res => {
this.tData = this.buildTree(res.data)
// console.log(this.tData)
})
},
......@@ -905,8 +911,8 @@ export default {
const roots = []
arrs.forEach(el => {
// 判断根节点 ###
el.type = el.modelInnerType
el.isLeaf = el.leaf
// el.type = el.modelInnerType
// el.isLeaf = el.leaf
if (el[this.treeProps.parentId] === null || el[this.treeProps.parentId] === 0 || el[this.treeProps.parentId] === '0') {
roots.push(el)
return
......
......@@ -72,7 +72,7 @@ export default {
if (this.table.id) {
this.dataLoading = true
this.table.row = 100
post('/dataset/table/getPreviewData/1/100', this.table, false).then(response => {
post('/dataset/table/getPreviewData/1/100', this.table, false, 30000).then(response => {
this.fields = response.data.fields
this.data = response.data.data
const datas = this.data
......
......@@ -130,7 +130,7 @@ export default {
initPreviewData(page) {
if (this.table.id) {
this.table.row = this.tableViewRowForm.row
post('/dataset/table/getPreviewData/' + page.page + '/' + page.pageSize, this.table).then(response => {
post('/dataset/table/getPreviewData/' + page.page + '/' + page.pageSize, this.table, true, 30000).then(response => {
this.fields = response.data.fields
this.data = response.data.data
this.page = response.data.page
......
......@@ -341,7 +341,7 @@
</template>
<script>
import { loadTable, getScene, addGroup, delGroup, addTable, delTable, post , isKettleRunning} from '@/api/dataset/dataset'
import { loadTable, getScene, addGroup, delGroup, addTable, delTable, post, isKettleRunning } from '@/api/dataset/dataset'
import { authModel } from '@/api/system/sysAuth'
import GroupMoveSelector from './GroupMoveSelector'
import DsMoveSelector from './DsMoveSelector'
......@@ -427,9 +427,6 @@ export default {
// return this.$store.state.dataset.sceneData
// }
},
created() {
this.kettleState()
},
watch: {
search(val) {
// if (val && val !== '') {
......@@ -451,6 +448,9 @@ export default {
this.refreshNodeBy(this.saveStatus.sceneId)
}
},
created() {
this.kettleState()
},
mounted() {
this.treeNode(this.groupForm)
this.refresh()
......@@ -856,14 +856,18 @@ export default {
searchTree(val) {
const queryCondition = {
withExtend: 'parent',
modelType: 'dataset',
// withExtend: 'parent',
// modelType: 'dataset',
name: val
}
authModel(queryCondition).then(res => {
// this.highlights(res.data)
// authModel(queryCondition).then(res => {
// // this.highlights(res.data)
// this.tData = this.buildTree(res.data)
// // console.log(this.tData)
// })
post('/dataset/table/search', queryCondition).then(res => {
this.tData = this.buildTree(res.data)
// console.log(this.tData)
})
},
......@@ -875,8 +879,8 @@ export default {
const roots = []
arrs.forEach(el => {
// 判断根节点 ###
el.type = el.modelInnerType
el.isLeaf = el.leaf
// el.type = el.modelInnerType
// el.isLeaf = el.leaf
if (el[this.treeProps.parentId] === null || el[this.treeProps.parentId] === 0 || el[this.treeProps.parentId] === '0') {
roots.push(el)
return
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论