forked from github/dataease
Merge pull request #11232 from dataease/pr@dev-v2@fixDS
Pr@dev v2@fix ds
This commit is contained in:
commit
e700067500
@ -89,67 +89,67 @@ public class ChartDataServer implements ChartDataApi {
|
||||
public void innerExportDetails(ChartExcelRequest request, HttpServletResponse response) throws Exception {
|
||||
HttpServletRequest httpServletRequest = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
||||
String linkToken = httpServletRequest.getHeader(AuthConstant.LINK_TOKEN_KEY);
|
||||
if (StringUtils.isEmpty(linkToken) || !request.isDataEaseBi()) {
|
||||
exportCenterManage.addTask(request.getViewId(), "chart", request);
|
||||
return;
|
||||
}
|
||||
OutputStream outputStream = response.getOutputStream();
|
||||
try {
|
||||
findExcelData(request);
|
||||
if ((StringUtils.isNotEmpty(linkToken) && !request.isDataEaseBi()) || (request.isDataEaseBi() && StringUtils.isEmpty(linkToken))) {
|
||||
OutputStream outputStream = response.getOutputStream();
|
||||
try {
|
||||
findExcelData(request);
|
||||
Workbook wb = new SXSSFWorkbook();
|
||||
|
||||
Workbook wb = new SXSSFWorkbook();
|
||||
//给单元格设置样式
|
||||
CellStyle cellStyle = wb.createCellStyle();
|
||||
Font font = wb.createFont();
|
||||
//设置字体大小
|
||||
font.setFontHeightInPoints((short) 12);
|
||||
//设置字体加粗
|
||||
font.setBold(true);
|
||||
//给字体设置样式
|
||||
cellStyle.setFont(font);
|
||||
//设置单元格背景颜色
|
||||
cellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
|
||||
//设置单元格填充样式(使用纯色背景颜色填充)
|
||||
cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
||||
|
||||
//给单元格设置样式
|
||||
CellStyle cellStyle = wb.createCellStyle();
|
||||
Font font = wb.createFont();
|
||||
//设置字体大小
|
||||
font.setFontHeightInPoints((short) 12);
|
||||
//设置字体加粗
|
||||
font.setBold(true);
|
||||
//给字体设置样式
|
||||
cellStyle.setFont(font);
|
||||
//设置单元格背景颜色
|
||||
cellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
|
||||
//设置单元格填充样式(使用纯色背景颜色填充)
|
||||
cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
||||
|
||||
if (CollectionUtils.isEmpty(request.getMultiInfo())) {
|
||||
List<Object[]> details = request.getDetails();
|
||||
Integer[] excelTypes = request.getExcelTypes();
|
||||
details.add(0, request.getHeader());
|
||||
ViewDetailField[] detailFields = request.getDetailFields();
|
||||
Object[] header = request.getHeader();
|
||||
|
||||
//明细sheet
|
||||
Sheet detailsSheet = wb.createSheet("数据");
|
||||
|
||||
setExcelData(detailsSheet, cellStyle, header, details, detailFields, excelTypes);
|
||||
} else {
|
||||
//多个sheet
|
||||
for (int i = 0; i < request.getMultiInfo().size(); i++) {
|
||||
ChartExcelRequestInner requestInner = request.getMultiInfo().get(i);
|
||||
|
||||
List<Object[]> details = requestInner.getDetails();
|
||||
Integer[] excelTypes = requestInner.getExcelTypes();
|
||||
details.add(0, requestInner.getHeader());
|
||||
ViewDetailField[] detailFields = requestInner.getDetailFields();
|
||||
Object[] header = requestInner.getHeader();
|
||||
if (CollectionUtils.isEmpty(request.getMultiInfo())) {
|
||||
List<Object[]> details = request.getDetails();
|
||||
Integer[] excelTypes = request.getExcelTypes();
|
||||
details.add(0, request.getHeader());
|
||||
ViewDetailField[] detailFields = request.getDetailFields();
|
||||
Object[] header = request.getHeader();
|
||||
|
||||
//明细sheet
|
||||
Sheet detailsSheet = wb.createSheet("数据 " + (i + 1));
|
||||
Sheet detailsSheet = wb.createSheet("数据");
|
||||
|
||||
setExcelData(detailsSheet, cellStyle, header, details, detailFields, excelTypes);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//多个sheet
|
||||
for (int i = 0; i < request.getMultiInfo().size(); i++) {
|
||||
ChartExcelRequestInner requestInner = request.getMultiInfo().get(i);
|
||||
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
//文件名称
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + request.getViewName() + ".xlsx");
|
||||
wb.write(outputStream);
|
||||
outputStream.flush();
|
||||
outputStream.close();
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(e);
|
||||
List<Object[]> details = requestInner.getDetails();
|
||||
Integer[] excelTypes = requestInner.getExcelTypes();
|
||||
details.add(0, requestInner.getHeader());
|
||||
ViewDetailField[] detailFields = requestInner.getDetailFields();
|
||||
Object[] header = requestInner.getHeader();
|
||||
|
||||
//明细sheet
|
||||
Sheet detailsSheet = wb.createSheet("数据 " + (i + 1));
|
||||
|
||||
setExcelData(detailsSheet, cellStyle, header, details, detailFields, excelTypes);
|
||||
}
|
||||
}
|
||||
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
//文件名称
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + request.getViewName() + ".xlsx");
|
||||
wb.write(outputStream);
|
||||
outputStream.flush();
|
||||
outputStream.close();
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(e);
|
||||
}
|
||||
}else {
|
||||
exportCenterManage.addTask(request.getViewId(), "chart", request);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref, h, onUnmounted } from 'vue'
|
||||
import { ref, h, onUnmounted, computed } from 'vue'
|
||||
import { EmptyBackground } from '@/components/empty-background'
|
||||
import { ElButton, ElMessage, ElMessageBox, ElTabPane, ElTabs } from 'element-plus-secondary'
|
||||
import { RefreshLeft } from '@element-plus/icons-vue'
|
||||
@ -15,6 +15,8 @@ import { useI18n } from '@/hooks/web/useI18n'
|
||||
import { useEmitt } from '@/hooks/web/useEmitt'
|
||||
import Icon from '@/components/icon-custom/src/Icon.vue'
|
||||
import { useCache } from '@/hooks/web/useCache'
|
||||
import { useLinkStoreWithOut } from '@/store/modules/link'
|
||||
import { useAppStoreWithOut } from '@/store/modules/app'
|
||||
|
||||
const { t } = useI18n()
|
||||
const tableData = ref([])
|
||||
@ -150,22 +152,27 @@ const init = params => {
|
||||
}
|
||||
}, 5000)
|
||||
}
|
||||
const linkStore = useLinkStoreWithOut()
|
||||
const appStore = useAppStoreWithOut()
|
||||
const isDataEaseBi = computed(() => appStore.getIsDataEaseBi)
|
||||
|
||||
const taskExportTopicCall = task => {
|
||||
if (JSON.parse(task).exportStatus === 'SUCCESS') {
|
||||
openMessageLoading(
|
||||
JSON.parse(task).exportFromName + ' 导出成功,前往',
|
||||
'success',
|
||||
callbackExportSuc
|
||||
)
|
||||
return
|
||||
}
|
||||
if (JSON.parse(task).exportStatus === 'FAILED') {
|
||||
openMessageLoading(
|
||||
JSON.parse(task).exportFromName + ' 导出失败,前往',
|
||||
'error',
|
||||
callbackExportError
|
||||
)
|
||||
if (!linkStore.getLinkToken && !isDataEaseBi.value && !appStore.getIsIframe) {
|
||||
if (JSON.parse(task).exportStatus === 'SUCCESS') {
|
||||
openMessageLoading(
|
||||
JSON.parse(task).exportFromName + ' 导出成功,前往',
|
||||
'success',
|
||||
callbackExportSuc
|
||||
)
|
||||
return
|
||||
}
|
||||
if (JSON.parse(task).exportStatus === 'FAILED') {
|
||||
openMessageLoading(
|
||||
JSON.parse(task).exportFromName + ' 导出失败,前往',
|
||||
'error',
|
||||
callbackExportError
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -276,7 +276,11 @@ public abstract class Provider {
|
||||
session.setPassword(configuration.getSshPassword());
|
||||
}
|
||||
session.setConfig("StrictHostKeyChecking", "no");
|
||||
session.connect();
|
||||
try {
|
||||
session.connect(1000 * 5);
|
||||
} catch (Exception e) {
|
||||
DEException.throwException("SSH 连接失败:" + e.getMessage());
|
||||
}
|
||||
session.setPortForwardingL(configuration.getLPort(), configuration.getHost(), configuration.getPort());
|
||||
|
||||
return session;
|
||||
|
Loading…
Reference in New Issue
Block a user