forked from github/dataease
Merge remote-tracking branch 'origin/main' into main
This commit is contained in:
commit
9bf1c52824
@ -139,10 +139,12 @@ public class DataSetGroupService {
|
||||
}
|
||||
|
||||
public void getParent(List<DatasetGroup> list, DatasetGroup datasetGroup) {
|
||||
if (StringUtils.isNotEmpty(datasetGroup.getPid())) {
|
||||
DatasetGroup d = datasetGroupMapper.selectByPrimaryKey(datasetGroup.getPid());
|
||||
list.add(d);
|
||||
getParent(list, d);
|
||||
if (ObjectUtils.isNotEmpty(datasetGroup)) {
|
||||
if (StringUtils.isNotEmpty(datasetGroup.getPid())) {
|
||||
DatasetGroup d = datasetGroupMapper.selectByPrimaryKey(datasetGroup.getPid());
|
||||
list.add(d);
|
||||
getParent(list, d);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -44,6 +44,7 @@ import java.io.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.MessageFormat;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -204,6 +205,7 @@ public class DataSetTableService {
|
||||
}
|
||||
|
||||
public Map<String, Object> getPreviewData(DataSetTableRequest dataSetTableRequest, Integer page, Integer pageSize) throws Exception {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
DatasetTableField datasetTableField = DatasetTableField.builder().build();
|
||||
datasetTableField.setTableId(dataSetTableRequest.getId());
|
||||
datasetTableField.setChecked(Boolean.TRUE);
|
||||
@ -265,33 +267,38 @@ public class DataSetTableService {
|
||||
} else if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "excel")) {
|
||||
List<DatasetTableTaskLog> datasetTableTaskLogs = dataSetTableTaskLogService.getByTableId(datasetTable.getId());
|
||||
if (CollectionUtils.isEmpty(datasetTableTaskLogs)) {
|
||||
throw new Exception("no records");
|
||||
}
|
||||
if (datasetTableTaskLogs.get(0).getStatus().equalsIgnoreCase(JobStatus.Underway.name())) {
|
||||
throw new Exception(Translator.get("i18n_processing_data"));
|
||||
}
|
||||
if (datasetTableTaskLogs.get(0).getStatus().equalsIgnoreCase(JobStatus.Error.name())) {
|
||||
throw new Exception("Failed to extract data: " + datasetTableTaskLogs.get(0).getInfo());
|
||||
}
|
||||
Datasource ds = (Datasource) CommonBeanFactory.getBean("DorisDatasource");
|
||||
JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class);
|
||||
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
||||
datasourceRequest.setDatasource(ds);
|
||||
String table = DorisTableUtils.dorisName(dataSetTableRequest.getId());
|
||||
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
|
||||
datasourceRequest.setQuery(qp.createQuerySQLWithPage(table, fields, page, pageSize, realSize));
|
||||
try {
|
||||
data.addAll(jdbcProvider.getData(datasourceRequest));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
map.put("status", "warnning");
|
||||
map.put("msg", Translator.get("i18n_processing_data"));
|
||||
dataSetPreviewPage.setTotal(0);
|
||||
}else if (datasetTableTaskLogs.get(0).getStatus().equalsIgnoreCase(JobStatus.Underway.name())) {
|
||||
map.put("status", "warnning");
|
||||
map.put("msg", Translator.get("i18n_processing_data"));
|
||||
dataSetPreviewPage.setTotal(0);
|
||||
}else if (datasetTableTaskLogs.get(0).getStatus().equalsIgnoreCase(JobStatus.Error.name())) {
|
||||
map.put("status", "error");
|
||||
map.put("msg", "Failed to extract data: " + datasetTableTaskLogs.get(0).getInfo());
|
||||
dataSetPreviewPage.setTotal(0);
|
||||
}else {
|
||||
Datasource ds = (Datasource) CommonBeanFactory.getBean("DorisDatasource");
|
||||
JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class);
|
||||
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
||||
datasourceRequest.setDatasource(ds);
|
||||
String table = DorisTableUtils.dorisName(dataSetTableRequest.getId());
|
||||
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
|
||||
datasourceRequest.setQuery(qp.createQuerySQLWithPage(table, fields, page, pageSize, realSize));
|
||||
try {
|
||||
data.addAll(jdbcProvider.getData(datasourceRequest));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
datasourceRequest.setQuery(qp.createQueryCountSQL(table));
|
||||
dataSetPreviewPage.setTotal(Integer.valueOf(jdbcProvider.getData(datasourceRequest).get(0)[0]));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
datasourceRequest.setQuery(qp.createQueryCountSQL(table));
|
||||
dataSetPreviewPage.setTotal(Integer.valueOf(jdbcProvider.getData(datasourceRequest).get(0)[0]));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "custom")) {
|
||||
Datasource ds = (Datasource) CommonBeanFactory.getBean("DorisDatasource");
|
||||
JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class);
|
||||
@ -317,15 +324,17 @@ public class DataSetTableService {
|
||||
List<Map<String, Object>> jsonArray = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(data)) {
|
||||
jsonArray = data.stream().map(ele -> {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
Map<String, Object> tmpMap = new HashMap<>();
|
||||
for (int i = 0; i < ele.length; i++) {
|
||||
map.put(fieldArray[i], ele[i]);
|
||||
tmpMap.put(fieldArray[i], ele[i]);
|
||||
}
|
||||
return map;
|
||||
return tmpMap;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
if(!map.containsKey("status")){
|
||||
map.put("status", "success");
|
||||
}
|
||||
map.put("fields", fields);
|
||||
map.put("data", jsonArray);
|
||||
map.put("page", dataSetPreviewPage);
|
||||
@ -819,8 +828,15 @@ public class DataSetTableService {
|
||||
} else if (cellTypeEnum.equals(CellType.NUMERIC)) {
|
||||
double d = cell.getNumericCellValue();
|
||||
try {
|
||||
String value = String.valueOf(d);
|
||||
return value.endsWith(".0") ? value.substring(0, value.length() -2):value;
|
||||
Double value = new Double(d);
|
||||
double eps = 1e-10;
|
||||
if(value - Math.floor(value) < eps){
|
||||
return value.longValue() + "";
|
||||
}else {
|
||||
NumberFormat nf = NumberFormat.getInstance();
|
||||
nf.setGroupingUsed(false);
|
||||
return nf.format(value);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
BigDecimal b = new BigDecimal(d);
|
||||
return b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue() + "";
|
||||
|
@ -639,7 +639,7 @@ public class ExtractDataService {
|
||||
|
||||
private static String handleExcelIntColumn = " \t\tif(tmp != null && tmp.endsWith(\".0\")){\n" +
|
||||
" try {\n" +
|
||||
" Integer.valueOf(tmp.substring(0, tmp.length()-2));\n" +
|
||||
" Long.valueOf(tmp.substring(0, tmp.length()-2));\n" +
|
||||
" get(Fields.Out, filed).setValue(r, tmp.substring(0, tmp.length()-2));\n" +
|
||||
" get(Fields.Out, filed).getValueMeta().setType(2);\n" +
|
||||
" }catch (Exception e){}\n" +
|
||||
|
@ -17,6 +17,7 @@ import io.dataease.controller.sys.base.ConditionEntity;
|
||||
import io.dataease.dto.panel.PanelShareDto;
|
||||
import io.dataease.dto.panel.PanelSharePo;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -111,7 +112,7 @@ public class ShareService {
|
||||
|
||||
//List构建Tree
|
||||
private List<PanelShareDto> convertTree(List<PanelShareDto> datas){
|
||||
Map<String, List<PanelShareDto>> map = datas.stream().collect(Collectors.groupingBy(PanelShareDto::getCreator));
|
||||
Map<String, List<PanelShareDto>> map = datas.stream().filter(panelShareDto -> StringUtils.isNotEmpty(panelShareDto.getCreator())).collect(Collectors.groupingBy(PanelShareDto::getCreator));
|
||||
return map.entrySet().stream().map(entry -> {
|
||||
PanelShareDto panelShareDto = new PanelShareDto();
|
||||
panelShareDto.setName(entry.getKey());
|
||||
|
@ -25,8 +25,8 @@ export default {
|
||||
@import "~@/styles/variables.scss";
|
||||
|
||||
.app-main {
|
||||
/*107 = navbar 50 + topbar 57 */
|
||||
min-height: calc(100vh - 107px);
|
||||
/* topbar 56 */
|
||||
min-height: calc(100vh - 56px);
|
||||
width: 100%;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
|
@ -50,7 +50,7 @@ export default {
|
||||
return variables
|
||||
},
|
||||
isCollapse() {
|
||||
return !this.sidebar.opened
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<div class="top-nav" :style="{'background-color': '#f1f3f8'}">
|
||||
<div class="log">
|
||||
<img v-if="!logoUrl" src="@/assets/DataEase-color.png" width="160" alt="" style="padding-top: 8px;">
|
||||
<img v-else :src="logoUrl" width="160" alt="" style="padding-top: 8px;">
|
||||
<img v-if="!logoUrl" src="@/assets/DataEase-color.png" width="140" alt="" style="padding-top: 10px;">
|
||||
<img v-else :src="logoUrl" width="140" alt="" style="padding-top: 10px;">
|
||||
</div>
|
||||
<el-menu
|
||||
:active-text-color="variables.topMenuActiveText"
|
||||
|
@ -48,7 +48,7 @@ export default {
|
||||
},
|
||||
classObj() {
|
||||
return {
|
||||
hideSidebar: !this.sidebar.opened,
|
||||
// hideSidebar: !this.sidebar.opened,
|
||||
openSidebar: this.sidebar.opened,
|
||||
withoutAnimation: this.sidebar.withoutAnimation,
|
||||
mobile: this.device === 'mobile'
|
||||
@ -98,7 +98,7 @@ export default {
|
||||
}
|
||||
|
||||
.hideSidebar .fixed-header {
|
||||
width: calc(100% - 54px)
|
||||
width: calc(100% - 56px)
|
||||
}
|
||||
|
||||
.mobile .fixed-header {
|
||||
|
@ -23,7 +23,7 @@
|
||||
top: $topBarHeight;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: 1001;
|
||||
z-index: 999;
|
||||
overflow: hidden;
|
||||
border-right: 1px solid rgba(0, 0, 0, 0.12);
|
||||
|
||||
@ -68,7 +68,7 @@
|
||||
border: none;
|
||||
height: 100%;
|
||||
width: 100% !important;
|
||||
|
||||
|
||||
.is-active {
|
||||
background-color: $menuHover;
|
||||
}
|
||||
|
@ -62,6 +62,12 @@ export default {
|
||||
this.fields = response.data.fields
|
||||
this.data = response.data.data
|
||||
const datas = this.data
|
||||
if(response.data.status === 'warnning'){
|
||||
this.$warning(response.data.msg, 3000);
|
||||
}
|
||||
if(response.data.status === 'error'){
|
||||
this.$error(response.data.msg, 3000);
|
||||
}
|
||||
this.$refs.plxTable.reloadData(datas)
|
||||
})
|
||||
}
|
||||
|
@ -108,6 +108,20 @@ export default {
|
||||
this.fields = response.data.fields
|
||||
this.data = response.data.data
|
||||
this.page = response.data.page
|
||||
if(response.data.status === 'warnning'){
|
||||
this.$warning(response.data.msg, 3000)
|
||||
}
|
||||
if(response.data.status === 'error') {
|
||||
this.$error(response.data.msg, 3000)
|
||||
}
|
||||
}).catch(response => {
|
||||
this.fields = []
|
||||
this.data = []
|
||||
this.page = {
|
||||
page: 1,
|
||||
pageSize: 100,
|
||||
show: 0
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
@ -1,80 +1,74 @@
|
||||
<template>
|
||||
<layout-content>
|
||||
|
||||
<div>
|
||||
<el-card class="box-card about-card">
|
||||
<div slot="header" class="clearfix license-header">
|
||||
<img src="@/assets/DataEase-white.png" alt="" width="300">
|
||||
<div style="width: 100%;display: flex;justify-content: center;">
|
||||
<el-card class="box-card about-card">
|
||||
<div slot="header" class="clearfix license-header">
|
||||
<img src="@/assets/DataEase-white.png" alt="" width="300">
|
||||
</div>
|
||||
<div class="license-content">
|
||||
<div v-if="license.status === 'Fail'">{{ $t('about.invalid_license') }}</div>
|
||||
<div v-if="license.status !== 'Fail'">
|
||||
<table>
|
||||
<tr>
|
||||
<th>{{ $t('about.auth_to') }}</th>
|
||||
<td>{{ license.corporation }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ $t('about.expiration_time') }}</th>
|
||||
<td>
|
||||
<label v-if="license.status === 'expired'" style="color: red">{{ license.expired }} {{ $t('about.expirationed') }}</label>
|
||||
<label v-if="license.status === 'valid'">{{ license.expired }}</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ $t('about.auth_num') }}</th>
|
||||
<td>{{ license.count }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ $t('about.version') }}</th>
|
||||
<td>
|
||||
<span v-if="license.edition">
|
||||
<span v-if="license.edition === 'Standard'">{{ $t('about.standard') }}</span>
|
||||
<span v-if="license.edition === 'Enterprise'">{{ $t('about.enterprise') }}</span>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ $t('about.version_num') }}</th>
|
||||
<td>
|
||||
<span>{{ build }}</span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="license-content">
|
||||
<div v-if="license.status === 'Fail'">{{ $t('about.invalid_license') }}</div>
|
||||
<div v-if="license.status !== 'Fail'">
|
||||
<table>
|
||||
<tr>
|
||||
<th>{{ $t('about.auth_to') }}</th>
|
||||
<td>{{ license.corporation }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ $t('about.expiration_time') }}</th>
|
||||
<td>
|
||||
<label v-if="license.status === 'expired'" style="color: red">{{ license.expired }} {{ $t('about.expirationed') }}</label>
|
||||
<label v-if="license.status === 'valid'">{{ license.expired }}</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ $t('about.auth_num') }}</th>
|
||||
<td>{{ license.count }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ $t('about.version') }}</th>
|
||||
<td>
|
||||
<span v-if="license.edition">
|
||||
<span v-if="license.edition === 'Standard'">{{ $t('about.standard') }}</span>
|
||||
<span v-if="license.edition === 'Enterprise'">{{ $t('about.enterprise') }}</span>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ $t('about.version_num') }}</th>
|
||||
<td>
|
||||
<span>{{ build }}</span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="md-padding" />
|
||||
<div v-if="user.isAdmin" layout="row" layout-align="space-between center" class="lic_rooter">
|
||||
<el-upload
|
||||
action=""
|
||||
:multiple="false"
|
||||
:show-file-list="false"
|
||||
:file-list="fileList"
|
||||
accept=".key"
|
||||
name="file"
|
||||
:before-upload="beforeUpload"
|
||||
>
|
||||
<a class="md-primary pointer">{{ $t('about.update_license') }}</a>
|
||||
<div class="md-padding" />
|
||||
<div v-if="user.isAdmin" layout="row" layout-align="space-between center" class="lic_rooter">
|
||||
<el-upload
|
||||
action=""
|
||||
:multiple="false"
|
||||
:show-file-list="false"
|
||||
:file-list="fileList"
|
||||
accept=".key"
|
||||
name="file"
|
||||
:before-upload="beforeUpload"
|
||||
>
|
||||
<a class="md-primary pointer">{{ $t('about.update_license') }}</a>
|
||||
|
||||
</el-upload>
|
||||
</el-upload>
|
||||
|
||||
<a class="md-primary pointer" @click="support">{{ $t('about.suport') }}</a>
|
||||
<a class="md-primary pointer" @click="support">{{ $t('about.suport') }}</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</layout-content>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import LayoutContent from '@/components/business/LayoutContent'
|
||||
import { validate, buildVersion, updateInfo } from '@/api/system/about'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import { mapGetters } from 'vuex'
|
||||
export default {
|
||||
|
||||
components: { LayoutContent },
|
||||
data() {
|
||||
return {
|
||||
license: {},
|
||||
@ -164,8 +158,6 @@ export default {
|
||||
background: inherit;
|
||||
margin-top: 5%;
|
||||
flex-direction: row;
|
||||
margin-left: 20%;
|
||||
margin-right: 20%;
|
||||
width: 640px;
|
||||
height: 400px;
|
||||
position: relative;
|
||||
|
Loading…
Reference in New Issue
Block a user