提交 9bf1c528 authored 作者: wangjiahao's avatar wangjiahao

Merge remote-tracking branch 'origin/main' into main

...@@ -139,10 +139,12 @@ public class DataSetGroupService { ...@@ -139,10 +139,12 @@ public class DataSetGroupService {
} }
public void getParent(List<DatasetGroup> list, DatasetGroup datasetGroup) { public void getParent(List<DatasetGroup> list, DatasetGroup datasetGroup) {
if (StringUtils.isNotEmpty(datasetGroup.getPid())) { if (ObjectUtils.isNotEmpty(datasetGroup)) {
DatasetGroup d = datasetGroupMapper.selectByPrimaryKey(datasetGroup.getPid()); if (StringUtils.isNotEmpty(datasetGroup.getPid())) {
list.add(d); DatasetGroup d = datasetGroupMapper.selectByPrimaryKey(datasetGroup.getPid());
getParent(list, d); list.add(d);
getParent(list, d);
}
} }
} }
} }
...@@ -44,6 +44,7 @@ import java.io.*; ...@@ -44,6 +44,7 @@ import java.io.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.text.NumberFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -204,6 +205,7 @@ public class DataSetTableService { ...@@ -204,6 +205,7 @@ public class DataSetTableService {
} }
public Map<String, Object> getPreviewData(DataSetTableRequest dataSetTableRequest, Integer page, Integer pageSize) throws Exception { 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 datasetTableField = DatasetTableField.builder().build();
datasetTableField.setTableId(dataSetTableRequest.getId()); datasetTableField.setTableId(dataSetTableRequest.getId());
datasetTableField.setChecked(Boolean.TRUE); datasetTableField.setChecked(Boolean.TRUE);
...@@ -265,33 +267,38 @@ public class DataSetTableService { ...@@ -265,33 +267,38 @@ 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"); map.put("status", "warnning");
} map.put("msg", Translator.get("i18n_processing_data"));
if (datasetTableTaskLogs.get(0).getStatus().equalsIgnoreCase(JobStatus.Underway.name())) { dataSetPreviewPage.setTotal(0);
throw new Exception(Translator.get("i18n_processing_data")); }else if (datasetTableTaskLogs.get(0).getStatus().equalsIgnoreCase(JobStatus.Underway.name())) {
} map.put("status", "warnning");
if (datasetTableTaskLogs.get(0).getStatus().equalsIgnoreCase(JobStatus.Error.name())) { map.put("msg", Translator.get("i18n_processing_data"));
throw new Exception("Failed to extract data: " + datasetTableTaskLogs.get(0).getInfo()); dataSetPreviewPage.setTotal(0);
} }else if (datasetTableTaskLogs.get(0).getStatus().equalsIgnoreCase(JobStatus.Error.name())) {
Datasource ds = (Datasource) CommonBeanFactory.getBean("DorisDatasource"); map.put("status", "error");
JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class); map.put("msg", "Failed to extract data: " + datasetTableTaskLogs.get(0).getInfo());
DatasourceRequest datasourceRequest = new DatasourceRequest(); dataSetPreviewPage.setTotal(0);
datasourceRequest.setDatasource(ds); }else {
String table = DorisTableUtils.dorisName(dataSetTableRequest.getId()); Datasource ds = (Datasource) CommonBeanFactory.getBean("DorisDatasource");
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType()); JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class);
datasourceRequest.setQuery(qp.createQuerySQLWithPage(table, fields, page, pageSize, realSize)); DatasourceRequest datasourceRequest = new DatasourceRequest();
try { datasourceRequest.setDatasource(ds);
data.addAll(jdbcProvider.getData(datasourceRequest)); String table = DorisTableUtils.dorisName(dataSetTableRequest.getId());
} catch (Exception e) { QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
e.printStackTrace(); 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")) { } else if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "custom")) {
Datasource ds = (Datasource) CommonBeanFactory.getBean("DorisDatasource"); Datasource ds = (Datasource) CommonBeanFactory.getBean("DorisDatasource");
JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class); JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class);
...@@ -317,15 +324,17 @@ public class DataSetTableService { ...@@ -317,15 +324,17 @@ public class DataSetTableService {
List<Map<String, Object>> jsonArray = new ArrayList<>(); List<Map<String, Object>> jsonArray = new ArrayList<>();
if (CollectionUtils.isNotEmpty(data)) { if (CollectionUtils.isNotEmpty(data)) {
jsonArray = data.stream().map(ele -> { 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++) { 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()); }).collect(Collectors.toList());
} }
Map<String, Object> map = new HashMap<>(); if(!map.containsKey("status")){
map.put("status", "success");
}
map.put("fields", fields); map.put("fields", fields);
map.put("data", jsonArray); map.put("data", jsonArray);
map.put("page", dataSetPreviewPage); map.put("page", dataSetPreviewPage);
...@@ -819,8 +828,15 @@ public class DataSetTableService { ...@@ -819,8 +828,15 @@ public class DataSetTableService {
} else if (cellTypeEnum.equals(CellType.NUMERIC)) { } else if (cellTypeEnum.equals(CellType.NUMERIC)) {
double d = cell.getNumericCellValue(); double d = cell.getNumericCellValue();
try { try {
String value = String.valueOf(d); Double value = new Double(d);
return value.endsWith(".0") ? value.substring(0, value.length() -2):value; 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) { } catch (Exception e) {
BigDecimal b = new BigDecimal(d); BigDecimal b = new BigDecimal(d);
return b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue() + ""; return b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue() + "";
......
...@@ -639,7 +639,7 @@ public class ExtractDataService { ...@@ -639,7 +639,7 @@ public class ExtractDataService {
private static String handleExcelIntColumn = " \t\tif(tmp != null && tmp.endsWith(\".0\")){\n" + private static String handleExcelIntColumn = " \t\tif(tmp != null && tmp.endsWith(\".0\")){\n" +
" try {\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).setValue(r, tmp.substring(0, tmp.length()-2));\n" +
" get(Fields.Out, filed).getValueMeta().setType(2);\n" + " get(Fields.Out, filed).getValueMeta().setType(2);\n" +
" }catch (Exception e){}\n" + " }catch (Exception e){}\n" +
......
...@@ -17,6 +17,7 @@ import io.dataease.controller.sys.base.ConditionEntity; ...@@ -17,6 +17,7 @@ import io.dataease.controller.sys.base.ConditionEntity;
import io.dataease.dto.panel.PanelShareDto; import io.dataease.dto.panel.PanelShareDto;
import io.dataease.dto.panel.PanelSharePo; import io.dataease.dto.panel.PanelSharePo;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -111,7 +112,7 @@ public class ShareService { ...@@ -111,7 +112,7 @@ public class ShareService {
//List构建Tree //List构建Tree
private List<PanelShareDto> convertTree(List<PanelShareDto> datas){ 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 -> { return map.entrySet().stream().map(entry -> {
PanelShareDto panelShareDto = new PanelShareDto(); PanelShareDto panelShareDto = new PanelShareDto();
panelShareDto.setName(entry.getKey()); panelShareDto.setName(entry.getKey());
......
...@@ -25,8 +25,8 @@ export default { ...@@ -25,8 +25,8 @@ export default {
@import "~@/styles/variables.scss"; @import "~@/styles/variables.scss";
.app-main { .app-main {
/*107 = navbar 50 + topbar 57 */ /* topbar 56 */
min-height: calc(100vh - 107px); min-height: calc(100vh - 56px);
width: 100%; width: 100%;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
......
...@@ -50,7 +50,7 @@ export default { ...@@ -50,7 +50,7 @@ export default {
return variables return variables
}, },
isCollapse() { isCollapse() {
return !this.sidebar.opened return false
} }
} }
} }
......
<template> <template>
<div class="top-nav" :style="{'background-color': '#f1f3f8'}"> <div class="top-nav" :style="{'background-color': '#f1f3f8'}">
<div class="log"> <div class="log">
<img v-if="!logoUrl" src="@/assets/DataEase-color.png" 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="160" alt="" style="padding-top: 8px;"> <img v-else :src="logoUrl" width="140" alt="" style="padding-top: 10px;">
</div> </div>
<el-menu <el-menu
:active-text-color="variables.topMenuActiveText" :active-text-color="variables.topMenuActiveText"
......
...@@ -48,7 +48,7 @@ export default { ...@@ -48,7 +48,7 @@ export default {
}, },
classObj() { classObj() {
return { return {
hideSidebar: !this.sidebar.opened, // hideSidebar: !this.sidebar.opened,
openSidebar: this.sidebar.opened, openSidebar: this.sidebar.opened,
withoutAnimation: this.sidebar.withoutAnimation, withoutAnimation: this.sidebar.withoutAnimation,
mobile: this.device === 'mobile' mobile: this.device === 'mobile'
...@@ -98,7 +98,7 @@ export default { ...@@ -98,7 +98,7 @@ export default {
} }
.hideSidebar .fixed-header { .hideSidebar .fixed-header {
width: calc(100% - 54px) width: calc(100% - 56px)
} }
.mobile .fixed-header { .mobile .fixed-header {
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
top: $topBarHeight; top: $topBarHeight;
bottom: 0; bottom: 0;
left: 0; left: 0;
z-index: 1001; z-index: 999;
overflow: hidden; overflow: hidden;
border-right: 1px solid rgba(0, 0, 0, 0.12); border-right: 1px solid rgba(0, 0, 0, 0.12);
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
border: none; border: none;
height: 100%; height: 100%;
width: 100% !important; width: 100% !important;
.is-active { .is-active {
background-color: $menuHover; background-color: $menuHover;
} }
......
...@@ -62,6 +62,12 @@ export default { ...@@ -62,6 +62,12 @@ export default {
this.fields = response.data.fields this.fields = response.data.fields
this.data = response.data.data this.data = response.data.data
const datas = this.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) this.$refs.plxTable.reloadData(datas)
}) })
} }
......
...@@ -108,6 +108,20 @@ export default { ...@@ -108,6 +108,20 @@ export default {
this.fields = response.data.fields this.fields = response.data.fields
this.data = response.data.data this.data = response.data.data
this.page = response.data.page 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
}
}) })
} }
}, },
......
<template> <template>
<layout-content> <div style="width: 100%;display: flex;justify-content: center;">
<el-card class="box-card about-card">
<div> <div slot="header" class="clearfix license-header">
<el-card class="box-card about-card"> <img src="@/assets/DataEase-white.png" alt="" width="300">
<div slot="header" class="clearfix license-header"> </div>
<img src="@/assets/DataEase-white.png" alt="" width="300"> <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>
<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 class="md-padding" />
<div v-if="user.isAdmin" layout="row" layout-align="space-between center" class="lic_rooter"> <div v-if="user.isAdmin" layout="row" layout-align="space-between center" class="lic_rooter">
<el-upload <el-upload
action="" action=""
:multiple="false" :multiple="false"
:show-file-list="false" :show-file-list="false"
:file-list="fileList" :file-list="fileList"
accept=".key" accept=".key"
name="file" name="file"
:before-upload="beforeUpload" :before-upload="beforeUpload"
> >
<a class="md-primary pointer">{{ $t('about.update_license') }}</a> <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> </div>
</el-card> </div>
</div> </el-card>
</layout-content> </div>
</template> </template>
<script> <script>
import LayoutContent from '@/components/business/LayoutContent'
import { validate, buildVersion, updateInfo } from '@/api/system/about' import { validate, buildVersion, updateInfo } from '@/api/system/about'
import { getToken } from '@/utils/auth' import { getToken } from '@/utils/auth'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
export default { export default {
components: { LayoutContent },
data() { data() {
return { return {
license: {}, license: {},
...@@ -164,8 +158,6 @@ export default { ...@@ -164,8 +158,6 @@ export default {
background: inherit; background: inherit;
margin-top: 5%; margin-top: 5%;
flex-direction: row; flex-direction: row;
margin-left: 20%;
margin-right: 20%;
width: 640px; width: 640px;
height: 400px; height: 400px;
position: relative; position: relative;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论