完善CSV导出文件下载功能

This commit is contained in:
datagear 2019-06-28 19:27:47 +08:00
parent 5107a8de31
commit a8c8f87c33
10 changed files with 249 additions and 136 deletions

View File

@ -187,6 +187,7 @@ public class IOUtil
* @param out
* @param file
* @param zipEntryName
* 文件的ZIP条目名可以为{@code null}或者空字符串
* @throws IOException
*/
public static void writeFileToZipOutputStream(ZipOutputStream out, File file, String zipEntryName)
@ -196,13 +197,26 @@ public class IOUtil
return;
boolean isDirectory = file.isDirectory();
boolean isZipEntryNameEmpty = (zipEntryName == null || zipEntryName.isEmpty());
if (isDirectory && !zipEntryName.endsWith("/"))
zipEntryName = zipEntryName + "/";
if (isDirectory)
{
if (isZipEntryNameEmpty)
zipEntryName = "";
else if (!zipEntryName.endsWith("/"))
zipEntryName = zipEntryName + "/";
}
else if (isZipEntryNameEmpty)
{
zipEntryName = file.getName();
isZipEntryNameEmpty = false;
}
ZipEntry zipEntry = new ZipEntry(zipEntryName);
out.putNextEntry(zipEntry);
if (!isZipEntryNameEmpty)
{
ZipEntry zipEntry = new ZipEntry(zipEntryName);
out.putNextEntry(zipEntry);
}
if (!isDirectory)
{
@ -219,7 +233,8 @@ public class IOUtil
}
}
out.closeEntry();
if (!isZipEntryNameEmpty)
out.closeEntry();
if (isDirectory)
{

View File

@ -193,11 +193,23 @@ public abstract class CometdDataExchangeListener implements DataExchangeListener
message = getI18nMessage(code, e1.getSqlType());
}
else
message = getI18nMessage(code);
{
message = getI18nMessage(code, getRootCauseMessage(e));
}
return message;
}
protected String getRootCauseMessage(Throwable t)
{
Throwable cause = null;
while ((cause = t.getCause()) != null)
t = cause;
return t.getMessage();
}
/**
* 构建数据交换异常I18N消息码
*

View File

@ -56,8 +56,10 @@ public class CometdSubTextDataExportListener extends CometdSubDataExchangeListen
@Override
protected DataExchangeMessage buildExceptionMessage(DataExchangeException e)
{
int successCount = this._successCount.intValue();
return new SubExceptionWithCount(getSubDataExchangeId(), resolveDataExchangeExceptionI18n(e), evalDuration(),
ExceptionResolve.ABORT, this._successCount.intValue(), 1);
ExceptionResolve.ABORT, successCount, (successCount > 0 ? 1 : 0));
}
@Override

View File

@ -18,6 +18,7 @@ import java.io.Writer;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
@ -25,6 +26,7 @@ import java.util.Set;
import java.util.concurrent.Future;
import java.util.regex.Pattern;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@ -282,7 +284,7 @@ public class DataExchangeController extends AbstractSchemaConnController
return fileInfos;
}
@RequestMapping(value = "/{schemaId}/import/csv/doImport")
@RequestMapping(value = "/{schemaId}/import/csv/doImport", produces = CONTENT_TYPE_JSON)
@ResponseBody
public ResponseEntity<OperationMessage> doImportCsv(HttpServletRequest request, HttpServletResponse response,
@PathVariable("schemaId") String schemaId, @RequestParam("dataExchangeId") String dataExchangeId,
@ -364,8 +366,7 @@ public class DataExchangeController extends AbstractSchemaConnController
public String viewLog(HttpServletRequest request, HttpServletResponse response,
org.springframework.ui.Model springModel, @PathVariable("schemaId") String schemaId,
@RequestParam("dataExchangeId") String dataExchangeId,
@RequestParam("subDataExchangeId") String subDataExchangeId,
@RequestParam("subDataExchangeDisplayName") String subDataExchangeDisplayName) throws Throwable
@RequestParam("subDataExchangeId") String subDataExchangeId) throws Throwable
{
new VoidSchemaConnExecutor(request, response, springModel, schemaId, true)
{
@ -378,7 +379,6 @@ public class DataExchangeController extends AbstractSchemaConnController
springModel.addAttribute("dataExchangeId", dataExchangeId);
springModel.addAttribute("subDataExchangeId", subDataExchangeId);
springModel.addAttribute("subDataExchangeDisplayName", subDataExchangeDisplayName);
return "/dataexchange/view_log";
}
@ -466,7 +466,7 @@ public class DataExchangeController extends AbstractSchemaConnController
return "/dataexchange/export_csv";
}
@RequestMapping(value = "/{schemaId}/export/csv/doExport")
@RequestMapping(value = "/{schemaId}/export/csv/doExport", produces = CONTENT_TYPE_JSON)
@ResponseBody
public ResponseEntity<OperationMessage> doExportCsv(HttpServletRequest request, HttpServletResponse response,
@PathVariable("schemaId") String schemaId, @RequestParam("dataExchangeId") String dataExchangeId,
@ -491,9 +491,6 @@ public class DataExchangeController extends AbstractSchemaConnController
List<ResourceFactory<Writer>> writerFactories = toWriterResourceFactories(directory,
exportForm.getFileEncoding(), fileNames);
List<String> exportFileNames = new ArrayList<String>(fileNames.length);
Collections.addAll(exportFileNames, fileNames);
Schema schema = getSchemaNotNull(request, response, schemaId);
ConnectionFactory connectionFactory = new DataSourceConnectionFactory(new SchemaDataSource(schema));
@ -532,7 +529,74 @@ public class DataExchangeController extends AbstractSchemaConnController
dataExchangeId, batchDataExchange, subDataExchangeIds);
storeBatchDataExchangeFutureInfo(request, futureInfo);
return buildOperationMessageSuccessEmptyResponseEntity();
ResponseEntity<OperationMessage> responseEntity = buildOperationMessageSuccessEmptyResponseEntity();
Map<String, String> subDataExchangeFileNameMap = buildSubDataExchangeFileNameMap(subDataExchangeIds, fileNames);
responseEntity.getBody().setData(subDataExchangeFileNameMap);
return responseEntity;
}
@RequestMapping(value = "/{schemaId}/export/download")
@ResponseBody
public void exptDownload(HttpServletRequest request, HttpServletResponse response,
@PathVariable("schemaId") String schemaId, @RequestParam("dataExchangeId") String dataExchangeId,
@RequestParam("fileName") String fileName) throws Exception
{
response.setCharacterEncoding(RESPONSE_ENCODING);
response.setHeader("Content-Disposition",
"attachment; filename=" + new String(fileName.getBytes(RESPONSE_ENCODING), "iso-8859-1") + "");
File directory = getTempDataExchangeDirectory(dataExchangeId, true);
File file = new File(directory, fileName);
OutputStream out = null;
try
{
out = response.getOutputStream();
IOUtil.write(file, out);
}
finally
{
IOUtil.close(out);
}
}
@RequestMapping(value = "/{schemaId}/export/downloadAll")
@ResponseBody
public void exptDownloadAll(HttpServletRequest request, HttpServletResponse response,
@PathVariable("schemaId") String schemaId, @RequestParam("dataExchangeId") String dataExchangeId)
throws Exception
{
String fileName = "export_csv.zip";
response.setCharacterEncoding(RESPONSE_ENCODING);
response.setHeader("Content-Disposition",
"attachment; filename=" + new String(fileName.getBytes(RESPONSE_ENCODING), "iso-8859-1") + "");
File directory = getTempDataExchangeDirectory(dataExchangeId, true);
ZipOutputStream out = null;
try
{
out = new ZipOutputStream(response.getOutputStream());
IOUtil.writeFileToZipOutputStream(out, directory, null);
}
finally
{
IOUtil.close(out);
}
}
protected Map<String, String> buildSubDataExchangeFileNameMap(String[] subDataExchangeIds, String[] fileNames)
{
Map<String, String> map = new HashMap<String, String>();
for (int i = 0; i < subDataExchangeIds.length; i++)
map.put(subDataExchangeIds[i], fileNames[i]);
return map;
}
protected List<Query> toQueries(String[] queries)
@ -816,6 +880,12 @@ public class DataExchangeController extends AbstractSchemaConnController
return logFile;
}
protected File getExportFileZip(String dataExchangeId)
{
File file = new File(this.tempDataExchangeRootDirectory, dataExchangeId + ".zip");
return file;
}
/**
* 获取指定数据交换操作ID对应的cometd通道ID
*

View File

@ -58,6 +58,8 @@ restore=\u6062\u590D
restoreAll=\u6062\u590D\u5168\u90E8
execute=\u6267\u884C
rowNumber=\u884C\u53F7
download=\u4E0B\u8F7D
downloadAll=\u4E0B\u8F7D\u5168\u90E8
dataTables.noData=\u6CA1\u6709\u6570\u636E
dataTables.zeroRecords=\u6CA1\u6709\u7ED3\u679C
@ -432,9 +434,8 @@ dataExchange.exchangeStatus.SubExceptionWithCount.IGNORE=\u5FFD\u7565\uFF08{0}/{
dataExchange.exchangeStatus.SubExceptionWithCount.ROLLBACK=\u56DE\u6EDA\uFF08{0}/{1}\uFF0C{2}\uFF09
dataExchange.exchangeStatus.SubExchangingWithCount=\u8FDB\u884C\u4E2D\uFF08{0}/{1}\uFF09
dataExchange.exchangeStatus.SubSuccessWithCount=\u5B8C\u6210\uFF08{0}/{1}\uFF0C{2}\uFF09
dataExchange.viewLog=\u67E5\u770B\u8BE6\u7EC6\u65E5\u5FD7\uFF1A{0}
dataExchange.viewLog=\u67E5\u770B\u8BE6\u7EC6\u65E5\u5FD7
dataExchange.cancelDeniedWithReason=\u53EA\u6709\u7B49\u5F85\u4E2D\u7684\u624D\u53EF\u4EE5\u53D6\u6D88
dataexchange.viewDataExchangeLog=\u67E5\u770B\u6570\u636E\u4EA4\u6362\u65E5\u5FD7\uFF1A{0}
dataExchange.error.ColumnNotFoundException=\u8868\u201C{0}\u201D\u4E2D\u6CA1\u6709\u201C{1}\u201D\u5217
dataExchange.error.TableMismatchException=\u8868\u201C{0}\u201D\u4E2D\u6CA1\u6709\u4EFB\u4F55\u5339\u914D\u7684\u5217
dataExchange.error.TableNotFoundException=\u8868\u201C{0}\u201D\u4E0D\u5B58\u5728

View File

@ -43,7 +43,7 @@ Schema schema 数据库不允许为null
</div>
<h3><@spring.message code='dataExport.selectAndExportData' /></h3>
<div>
<div class="form-item form-item-table-head form-item-add edit-state-aware">
<div class="form-item form-item-table-head form-item-add page-status-aware-show edit-status-show">
<div class="form-item-value">
<div id="${pageId}-add-group">
<button type="button" class="table-add-item-button edit-state-aware ui-corner-left"><@spring.message code='add' /></button>
@ -53,7 +53,7 @@ Schema schema 数据库不允许为null
</div>
</div>
</div>
<div class="form-item form-item-table-head form-item-progress export-state-aware">
<div class="form-item form-item-table-head form-item-progress page-status-aware-show exchange-status-show finish-status-show">
<div class="form-item-value">
<label><@spring.message code='dataExport.exportProgress' /></label>
<div id="${pageId}-progress"></div>
@ -62,11 +62,12 @@ Schema schema 数据库不允许为null
</div>
<div class="form-item form-item-table">
<div class="table-operation-wrapper">
<button type="button" class="table-delete-item-button edit-state-aware"><@spring.message code='delete' /></button>
<button type="button" class="table-cancel-export-button export-state-aware"><@spring.message code='cancel' /></button>
<button type="button" class="table-delete-item-button page-status-aware-show edit-status-show"><@spring.message code='delete' /></button>
<button type="button" class="table-cancel-export-button page-status-aware-show exchange-status-show"><@spring.message code='cancel' /></button>
<button type="button" class="table-download-all-button page-status-aware-show finish-status-show"><@spring.message code='downloadAll' /></button>
</div>
<div class="file-encoding-wrapper">
<span class="file-encoding-label">
<span class="file-encoding-label page-status-aware-enable edit-status-enable">
<@spring.message code='dataExport.exportFileEncoding' />
</span>
<select name="fileEncoding">
@ -82,7 +83,7 @@ Schema schema 数据库不允许为null
</div>
</div>
</form>
<div class="restart-wrapper">
<div class="restart-wrapper page-status-aware-show finish-status-show">
<button type="button" class="restart-button"><@spring.message code='restart' /></button>
</div>
<div id="${pageId}-exchange-exception-tooltip" title="import tooltip" style="width:0; height:0;"></div>
@ -126,7 +127,9 @@ Schema schema 数据库不允许为null
finish: "<@spring.message code='export' />"
}
});
po.element("#${pageId}-form .wizard .actions ul li:eq(2)").addClass("page-status-aware-enable edit-status-enable");
$.initButtons(po.element());
po.element("#${pageId}-binaryFormat").buttonset();
po.element("#${pageId}-nullForIllegalColumnValue").buttonset();
@ -185,26 +188,25 @@ Schema schema 数据库不允许为null
});
};
po.toggleEditAndExportStatus = function(exportStatus)
po.updateSubDataExchangeStatusForCometdMessageSuper = po.updateSubDataExchangeStatusForCometdMessage;
po.updateSubDataExchangeStatusForCometdMessage = function(subDataExchangeId, status, message)
{
var exportActionEle = po.element("#${pageId}-form .wizard .actions ul li:eq(2)");
var type = (message ? message.type : "");
if(exportStatus)
if("SubSuccessWithCount" == type)
{
po.element(".edit-state-aware").hide();
po.element(".export-state-aware").show();
exportActionEle.addClass("ui-state-disabled");
po.element("select[name='fileEncoding']").selectmenu("disable");
po.element(".file-encoding-label").addClass("ui-state-disabled");
}
else
{
po.element(".edit-state-aware").show();
po.element(".export-state-aware").hide();
exportActionEle.removeClass("ui-state-disabled");
po.element("select[name='fileEncoding']").selectmenu("enable");
po.element(".file-encoding-label").removeClass("ui-state-disabled");
if(!message.failCount || message.failCount == 0)
{
var spanIndex = status.indexOf("<span");
if(spanIndex > 0)
status = status.substring(0, spanIndex);
}
status += "<span class='exchange-result-icon exchange-download-icon' title='"+$.escapeHtml("<@spring.message code='download' />")+"' subDataExchangeId='"+$.escapeHtml(message.subDataExchangeId)+"' >"
+"<span class='ui-icon ui-icon-circle-arrow-s'></span></span>";
}
po.updateSubDataExchangeStatusForCometdMessageSuper(subDataExchangeId, status, message);
};
po.expectedResizeDataTableElements = [po.table()[0]];
@ -271,6 +273,18 @@ Schema schema 数据库不允许为null
po.cancelSelectedSubDataExchange();
});
po.element(".table-download-all-button").click(function()
{
po.open("${contextPath}/dataexchange/" + po.schemaId +"/export/downloadAll",
{
target : "_file",
data :
{
dataExchangeId : po.dataExchangeId
}
});
});
po.table().on("click", ".input-in-table", function(event)
{
//阻止行选中
@ -284,21 +298,34 @@ Schema schema 数据库不允许为null
var $this = $(this);
if(!$this.hasClass("ui-state-error"))
return;
var subDataExchangeId = $this.attr("subDataExchangeId");
var rowData = po.getSubDataExchangeRowData(subDataExchangeId);
var query = $.escapeHtml((rowData ? rowData.query : ""));
po.viewSubDataExchangeDetailLog(subDataExchangeId, displayName);
if($this.hasClass("exchange-error-icon"))
{
var subDataExchangeId = $this.attr("subDataExchangeId");
po.viewSubDataExchangeDetailLog(subDataExchangeId);
}
else if($this.hasClass("exchange-download-icon"))
{
var subDataExchangeId = $this.attr("subDataExchangeId");
var fileName = (po.subDataExchangeFileNameMap ? po.subDataExchangeFileNameMap[subDataExchangeId] : null);
if(fileName)
{
po.open("${contextPath}/dataexchange/" + po.schemaId +"/export/download",
{
target : "_file",
data :
{
dataExchangeId : po.dataExchangeId,
fileName : fileName
}
});
}
}
});
po.element(".restart-button").click(function()
{
po.toggleEditAndExportStatus(false);
po.setDataExchangeProgress(0);
po.toggleRestartStatus(false);
po.updateDataExchangePageStatus("edit");
});
po.element("#${pageId}-form").submit(function()
@ -311,7 +338,8 @@ Schema schema 数据库不允许为null
url : "${contextPath}/dataexchange/" + po.schemaId +"/export/csv/doExport",
success: function(data)
{
po.toggleEditAndExportStatus(true);
po.subDataExchangeFileNameMap = data.data;
po.updateDataExchangePageStatus("exchange");
}
});
},
@ -323,9 +351,7 @@ Schema schema 数据库不允许为null
return false;
});
po.toggleEditAndExportStatus(false);
po.setDataExchangeProgress(0);
po.toggleRestartStatus(false);
po.updateDataExchangePageStatus("edit");
})
(${pageId});
</script>

View File

@ -67,14 +67,14 @@ Schema schema 数据库不允许为null
</div>
<h3><@spring.message code='dataImport.uploadAndImportData' /></h3>
<div>
<div class="form-item form-item-table-head form-item-upload upload-state-aware">
<div class="form-item form-item-table-head form-item-upload page-status-aware-show edit-status-show">
<div class="form-item-value">
<label><@spring.message code='dataImport.uploadCsvDataFile' /></label>
<div class="fileinput-button ui-widget ui-button ui-corner-all"><@spring.message code='upload' /><input type="file"></div>
<div class="file-info"></div>
</div>
</div>
<div class="form-item form-item-table-head form-item-progress import-state-aware">
<div class="form-item form-item-table-head form-item-progress page-status-aware-show exchange-status-show finish-status-show">
<div class="form-item-value">
<label><@spring.message code='dataImport.importProgress' /></label>
<div id="${pageId}-progress"></div>
@ -83,11 +83,11 @@ Schema schema 数据库不允许为null
</div>
<div class="form-item form-item-table">
<div class="table-operation-wrapper">
<button type="button" class="table-delete-item-button upload-state-aware"><@spring.message code='delete' /></button>
<button type="button" class="table-cancel-import-button import-state-aware"><@spring.message code='cancel' /></button>
<button type="button" class="table-delete-item-button page-status-aware-show edit-status-show"><@spring.message code='delete' /></button>
<button type="button" class="table-cancel-import-button page-status-aware-show exchange-status-show"><@spring.message code='cancel' /></button>
</div>
<div class="file-encoding-wrapper">
<span class="file-encoding-label">
<span class="file-encoding-label page-status-aware-enable edit-status-enable">
<@spring.message code='dataImport.importFileEncoding' />
</span>
<select name="fileEncoding">
@ -103,7 +103,7 @@ Schema schema 数据库不允许为null
</div>
</div>
</form>
<div class="restart-wrapper">
<div class="restart-wrapper page-status-aware-show finish-status-show">
<button type="button" class="restart-button"><@spring.message code='restart' /></button>
</div>
<div id="${pageId}-exchange-exception-tooltip" title="import tooltip" style="width:0; height:0;"></div>
@ -136,28 +136,6 @@ Schema schema 数据库不允许为null
po.addRowData(fileInfos);
};
po.toggleUploadAndImportStatus = function(importStatus)
{
var importActionEle = po.element("#${pageId}-form .wizard .actions ul li:eq(2)");
if(importStatus)
{
po.element(".upload-state-aware").hide();
po.element(".import-state-aware").show();
importActionEle.addClass("ui-state-disabled");
po.element("select[name='fileEncoding']").selectmenu("disable");
po.element(".file-encoding-label").addClass("ui-state-disabled");
}
else
{
po.element(".upload-state-aware").show();
po.element(".import-state-aware").hide();
importActionEle.removeClass("ui-state-disabled");
po.element("select[name='fileEncoding']").selectmenu("enable");
po.element(".file-encoding-label").removeClass("ui-state-disabled");
}
};
po.element(".form-content").steps(
{
headerTag: "h3",
@ -178,7 +156,9 @@ Schema schema 数据库不允许为null
finish: "<@spring.message code='import' />"
}
});
po.element("#${pageId}-form .wizard .actions ul li:eq(2)").addClass("page-status-aware-enable edit-status-enable");
$.initButtons(po.element());
po.element("#${pageId}-binaryFormat").buttonset();
po.element("#${pageId}-ignoreInexistentColumn").buttonset();
@ -228,9 +208,7 @@ Schema schema 数据库不允许为null
po.element(".restart-button").click(function()
{
po.toggleUploadAndImportStatus(false);
po.setDataExchangeProgress(0);
po.toggleRestartStatus(false);
po.updateDataExchangePageStatus("edit");
});
po.expectedResizeDataTableElements = [po.table()[0]];
@ -296,14 +274,11 @@ Schema schema 数据库不允许为null
var $this = $(this);
if(!$this.hasClass("ui-state-error"))
return;
var subDataExchangeId = $this.attr("subDataExchangeId");
var rowData = po.getSubDataExchangeRowData(subDataExchangeId);
var displayName = $.escapeHtml((rowData ? rowData.displayName : ""));
po.viewSubDataExchangeDetailLog(subDataExchangeId, displayName);
if($this.hasClass("exchange-error-icon"))
{
var subDataExchangeId = $this.attr("subDataExchangeId");
po.viewSubDataExchangeDetailLog(subDataExchangeId);
}
});
po.element("#${pageId}-form").submit(function()
@ -316,7 +291,7 @@ Schema schema 数据库不允许为null
url : "${contextPath}/dataexchange/" + po.schemaId +"/import/csv/doImport",
success: function(data)
{
po.toggleUploadAndImportStatus(true);
po.updateDataExchangePageStatus("exchange");
}
});
},
@ -328,9 +303,7 @@ Schema schema 数据库不允许为null
return false;
});
po.toggleUploadAndImportStatus(false);
po.setDataExchangeProgress(0);
po.toggleRestartStatus(false);
po.updateDataExchangePageStatus("edit");
})
(${pageId});
</script>

View File

@ -171,24 +171,46 @@ po.subDataExchangeStatusColumnIndex 子数据交换表格中状态列索引
po.getSubDataExchangeExceptionTipEle().tooltip("close");
};
po.viewSubDataExchangeDetailLog = function(subDataExchangeId, subDataExchangeDisplayName)
po.viewSubDataExchangeDetailLog = function(subDataExchangeId)
{
<#assign messageArgs=['"+subDataExchangeDisplayName+"'] />
po.open("${contextPath}/dataexchange/" + po.schemaId +"/viewLog",
{
title : "<@spring.messageArgs code='dataExchange.viewLog' args=messageArgs />",
title : "<@spring.message code='dataExchange.viewLog' />",
data :
{
schemaId : po.schemaId,
dataExchangeId : po.dataExchangeId,
subDataExchangeId : subDataExchangeId,
subDataExchangeDisplayName : subDataExchangeDisplayName
subDataExchangeId : subDataExchangeId
},
height : $(window).height() * 0.75
});
};
//更新页面状态statusedit、exchange、finish
po.updateDataExchangePageStatus = function(status)
{
if(status == po.currentDataExchangePageStatus)
return false;
po.element(".page-status-aware-show:not(."+status+"-status-show)").hide();
po.element(".page-status-aware-enable:not(."+status+"-status-enable)").addClass("ui-state-disabled");
po.element(".page-status-aware-show."+status+"-status-show").show();
po.element(".page-status-aware-enable."+status+"-status-enable").removeClass("ui-state-disabled");
if("edit" == status)
{
po.element("select[name='fileEncoding']").selectmenu("enable");
po.setDataExchangeProgress(0);
}
else
po.element("select[name='fileEncoding']").selectmenu("disable");
po.currentDataExchangePageStatus = status;
return true;
};
po.handleDataExchangeCometdMessage = function(message)
{
message = message.data;
@ -200,6 +222,8 @@ po.subDataExchangeStatusColumnIndex 子数据交换表格中状态列索引
po.subDataExchangeCount = dataTable.rows().indexes().length;
po.subDataExchangeFinishCount=0;
po.subDataExchangeExceptionMessages = {};
po.updateDataExchangePageStatus("exchange");
}
else if("Exception" == type)
{
@ -208,21 +232,21 @@ po.subDataExchangeStatusColumnIndex 子数据交换表格中状态列索引
}
else if("SubSubmitSuccess" == type)
{
po.updateSubDataExchangeStatus(message.subDataExchangeId,
"<@spring.message code='dataExchange.exchangeStatus.SubSubmitSuccess' />");
po.updateSubDataExchangeStatusForCometdMessage(message.subDataExchangeId,
"<@spring.message code='dataExchange.exchangeStatus.SubSubmitSuccess' />", message);
}
else if("SubSubmitFail" == type)
{
po.updateSubDataExchangeStatus(message.subDataExchangeId,
"<@spring.message code='dataExchange.exchangeStatus.SubSubmitFail' />");
po.updateSubDataExchangeStatusForCometdMessage(message.subDataExchangeId,
"<@spring.message code='dataExchange.exchangeStatus.SubSubmitFail' />", message);
}
else if("SubCancelSuccess" == type)
{
po.subDataExchangeFinishCount += 1;
po.setDataExchangeProgress(parseInt(po.subDataExchangeFinishCount/po.subDataExchangeCount * 100));
po.updateSubDataExchangeStatus(message.subDataExchangeId,
"<@spring.message code='dataExchange.exchangeStatus.SubCancelSuccess' />");
po.updateSubDataExchangeStatusForCometdMessage(message.subDataExchangeId,
"<@spring.message code='dataExchange.exchangeStatus.SubCancelSuccess' />", message);
}
else if("SubExchangingWithCount" == type)
{
@ -231,7 +255,7 @@ po.subDataExchangeStatusColumnIndex 子数据交换表格中状态列索引
<#assign messageArgs=['"+message.successCount+"', '"+message.failCount+"'] />
status = "<@spring.messageArgs code='dataExchange.exchangeStatus.SubExchangingWithCount' args=messageArgs />";
po.updateSubDataExchangeStatus(message.subDataExchangeId, status);
po.updateSubDataExchangeStatusForCometdMessage(message.subDataExchangeId, status, message);
}
else if("SubExceptionWithCount" == type)
{
@ -253,13 +277,13 @@ po.subDataExchangeStatusColumnIndex 子数据交换表格中状态列索引
else if(exceptionResolve == "ROLLBACK")
status = "<@spring.messageArgs code='dataExchange.exchangeStatus.SubExceptionWithCount.ROLLBACK' args=messageArgs />";
status += "<span class='exchange-result-icon ui-state-error' onmouseover='${pageId}.showSubExceptionTip(event, this)'"
status += "<span class='exchange-result-icon exchange-error-icon ui-state-error' onmouseover='${pageId}.showSubExceptionTip(event, this)'"
+" onmouseout='${pageId}.hideSubExceptionTip(event, this)' subDataExchangeId='"+$.escapeHtml(message.subDataExchangeId)+"' >"
+"<span class='ui-icon ui-icon-info'></span></span>";
po.subDataExchangeExceptionMessages[message.subDataExchangeId] = message.content;
po.updateSubDataExchangeStatus(message.subDataExchangeId, status);
po.updateSubDataExchangeStatusForCometdMessage(message.subDataExchangeId, status, message);
}
else if("SubSuccessWithCount" == type)
{
@ -272,20 +296,19 @@ po.subDataExchangeStatusColumnIndex 子数据交换表格中状态列索引
if(!message.failCount || message.failCount == 0)
{
status = "<@spring.messageArgs code='dataExchange.exchangeStatus.SubSuccessWithCount' args=messageArgs />";
status += "<span class='exchange-result-icon'>"
+"<span class='ui-icon ui-icon-circle-check'></span></span>";
status += "<span class='exchange-result-icon exchange-success-icon'><span class='ui-icon ui-icon-circle-check'></span></span>";
}
else
{
status = "<@spring.messageArgs code='dataExchange.exchangeStatus.SubExceptionWithCount.IGNORE' args=messageArgs />";
status += "<span class='exchange-result-icon ui-state-error' onmouseover='${pageId}.showSubExceptionTip(event, this)'"
status += "<span class='exchange-result-icon exchange-error-icon ui-state-error' onmouseover='${pageId}.showSubExceptionTip(event, this)'"
+" onmouseout='${pageId}.hideSubExceptionTip(event, this)' subDataExchangeId='"+$.escapeHtml(message.subDataExchangeId)+"' >"
+"<span class='ui-icon ui-icon-info'></span></span>";
po.subDataExchangeExceptionMessages[message.subDataExchangeId] = message.ignoreException;
}
po.updateSubDataExchangeStatus(message.subDataExchangeId, status);
po.updateSubDataExchangeStatusForCometdMessage(message.subDataExchangeId, status, message);
}
else if("SubFinish" == type)
{
@ -295,22 +318,13 @@ po.subDataExchangeStatusColumnIndex 子数据交换表格中状态列索引
else if("Finish" == type)
{
po.setDataExchangeProgress(100, message.duration);
po.toggleRestartStatus(true);
po.updateDataExchangePageStatus("finish");
}
};
po.toggleRestartStatus = function(enable)
po.updateSubDataExchangeStatusForCometdMessage = function(subDataExchangeId, status, message)
{
if(enable)
{
po.element(".restart-wrapper").show();
po.element(".restart-button").removeClass("ui-state-disabled");
}
else
{
po.element(".restart-wrapper").hide();
po.element(".restart-button").addClass("ui-state-disabled");
}
po.updateSubDataExchangeStatus(subDataExchangeId, status);
};
})
(${pageId});

View File

@ -8,8 +8,7 @@ Schema schema 数据库不允许为null
<#include "../include/html_head.ftl">
<title>
<#include "../include/html_title_app_name.ftl">
<#assign messageArgs=[subDataExchangeDisplayName?html] />
<@spring.messageArgs code='dataexchange.viewDataExchangeLog' args=messageArgs />
<@spring.message code='dataExchange.viewLog' />
<@spring.message code='bracketLeft' />
${schema.title?html}
<@spring.message code='bracketRight' />

View File

@ -1710,7 +1710,8 @@ table.dataTable tbody tr .column-check .row-data-state .ui-icon{
border: none;
background: none;
}
.page-dataexchange .dataTable .exchange-result-icon.ui-state-error{
.page-dataexchange .dataTable .exchange-result-icon.exchange-error-icon,
.page-dataexchange .dataTable .exchange-result-icon.exchange-download-icon{
cursor: pointer;
}
.page-dataexchange-log{