修复日志下载bug

This commit is contained in:
mxd 2020-04-05 13:11:56 +08:00
parent 5e7b6afd0b
commit 08819163aa
2 changed files with 3 additions and 2 deletions

View File

@ -3,6 +3,7 @@ package org.spiderflow.controller;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.spiderflow.Grammerable; import org.spiderflow.Grammerable;
@ -164,7 +165,7 @@ public class SpiderFlowController {
@RequestMapping("/log/download") @RequestMapping("/log/download")
public ResponseEntity<FileSystemResource> download(String id, String taskId) { public ResponseEntity<FileSystemResource> download(String id, String taskId) {
if (StringUtils.isBlank(taskId)) { if (StringUtils.isBlank(taskId) || NumberUtils.toInt(taskId,0) == 0) {
Integer maxId = spiderFlowService.getFlowMaxTaskId(id); Integer maxId = spiderFlowService.getFlowMaxTaskId(id);
taskId = maxId == null ? "" : maxId.toString(); taskId = maxId == null ? "" : maxId.toString();
} }

View File

@ -243,7 +243,7 @@
viewer.setOptions('reversed',true); viewer.setOptions('reversed',true);
viewer.init(); viewer.init();
}).on('click','.btn-download',function(){ }).on('click','.btn-download',function(){
window.open('spider/log/download?id=' + logId + "&taskId=" + taskId); window.open('spider/log/download?id=' + logId + "&taskId=" + (taskId || ''));
}); });
}); });
</script> </script>