Commit c5502c2f by huangfusuper

取消显示日志的详细信息,改为显示远程路径

parent 56be6a67
...@@ -56,6 +56,7 @@ myth-job: ...@@ -56,6 +56,7 @@ myth-job:
fdfs: fdfs:
so-timeout: 1500 so-timeout: 1500
http-port: 88
connect-timeout: 600 connect-timeout: 600
pool: pool:
jmx-enabled: false jmx-enabled: false
......
...@@ -60,6 +60,7 @@ myth-job: ...@@ -60,6 +60,7 @@ myth-job:
fdfs: fdfs:
so-timeout: 1500 so-timeout: 1500
connect-timeout: 600 connect-timeout: 600
http-port: 88
pool: pool:
jmx-enabled: false jmx-enabled: false
tracker-list: tracker-list:
......
...@@ -56,6 +56,7 @@ myth-job: ...@@ -56,6 +56,7 @@ myth-job:
fdfs: fdfs:
so-timeout: 1500 so-timeout: 1500
connect-timeout: 600 connect-timeout: 600
http-port: 8888
pool: pool:
jmx-enabled: false jmx-enabled: false
tracker-list: tracker-list:
......
...@@ -57,6 +57,7 @@ myth-job: ...@@ -57,6 +57,7 @@ myth-job:
fdfs: fdfs:
so-timeout: 1500 so-timeout: 1500
connect-timeout: 600 connect-timeout: 600
http-port: 8888
pool: pool:
jmx-enabled: false jmx-enabled: false
tracker-list: tracker-list:
......
...@@ -2,7 +2,6 @@ package com.byit.service.mapservice.impl; ...@@ -2,7 +2,6 @@ package com.byit.service.mapservice.impl;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.byit.filesystem.FileSystem;
import com.byit.model.EmailAlarm; import com.byit.model.EmailAlarm;
import com.byit.model.JobTaskRunLogWithBLOBs; import com.byit.model.JobTaskRunLogWithBLOBs;
import com.byit.model.RunRecording; import com.byit.model.RunRecording;
...@@ -13,10 +12,9 @@ import com.byit.service.mapservice.RunRecordingAndEmailService; ...@@ -13,10 +12,9 @@ import com.byit.service.mapservice.RunRecordingAndEmailService;
import com.byit.util.TimeFormatUtil; import com.byit.util.TimeFormatUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.List; import java.util.List;
/** /**
...@@ -35,19 +33,19 @@ public class RunRecordingAndEmailServiceImpl implements RunRecordingAndEmailServ ...@@ -35,19 +33,19 @@ public class RunRecordingAndEmailServiceImpl implements RunRecordingAndEmailServ
*/ */
private final JobTaskRunLogService jobTaskRunLogService; private final JobTaskRunLogService jobTaskRunLogService;
/** /**
* 文件系统
*/
private final FileSystem fileSystem;
/**
* 运行实例操作 * 运行实例操作
*/ */
private final RunRecordingService runRecordingService; private final RunRecordingService runRecordingService;
@Value("${fdfs.tracker-list}")
private List<String> trackerIps;
@Value("${fdfs.http-port}")
private String trackerIpsPort;
public RunRecordingAndEmailServiceImpl(EmailAlarmService emailAlarmService, JobTaskRunLogService jobTaskRunLogService, public RunRecordingAndEmailServiceImpl(EmailAlarmService emailAlarmService, JobTaskRunLogService jobTaskRunLogService,
FileSystem fileSystem, RunRecordingService runRecordingService) { RunRecordingService runRecordingService) {
this.emailAlarmService = emailAlarmService; this.emailAlarmService = emailAlarmService;
this.jobTaskRunLogService = jobTaskRunLogService; this.jobTaskRunLogService = jobTaskRunLogService;
this.fileSystem = fileSystem;
this.runRecordingService = runRecordingService; this.runRecordingService = runRecordingService;
} }
...@@ -91,7 +89,7 @@ public class RunRecordingAndEmailServiceImpl implements RunRecordingAndEmailServ ...@@ -91,7 +89,7 @@ public class RunRecordingAndEmailServiceImpl implements RunRecordingAndEmailServ
.append("<th width = '10%'>结束时间</th>") .append("<th width = '10%'>结束时间</th>")
.append("<th width = '10%'>耗费时间</th>") .append("<th width = '10%'>耗费时间</th>")
.append("<th width = '10%'>运行结果</th>") .append("<th width = '10%'>运行结果</th>")
.append("<th width = '50%'>运行日志</th>") .append("<th width = '50%'>日志远程路径</th>")
.append("</thead>") .append("</thead>")
.append("<tbody>"); .append("<tbody>");
...@@ -103,19 +101,18 @@ public class RunRecordingAndEmailServiceImpl implements RunRecordingAndEmailServ ...@@ -103,19 +101,18 @@ public class RunRecordingAndEmailServiceImpl implements RunRecordingAndEmailServ
* String logFilePath = FILE_SYSTEM_PRE+fileSystemIp+":"+fileSystemPort+"/"+jobTaskRunLog.getLogRemotelyPath(); * String logFilePath = FILE_SYSTEM_PRE+fileSystemIp+":"+fileSystemPort+"/"+jobTaskRunLog.getLogRemotelyPath();
* String logFileUrl = String.format(iframeHtml,logFilePath); * String logFileUrl = String.format(iframeHtml,logFilePath);
*/ */
String logStr = null; String logStr = "无远程路径";
try {
if(StringUtils.isNotBlank(jobTaskRunLog.getLogRemotelyPath())){ if(StringUtils.isNotBlank(jobTaskRunLog.getLogRemotelyPath())){
logStr = new String(fileSystem.downloaderFile(jobTaskRunLog.getLogRemotelyPath()), StandardCharsets.UTF_8); logStr = jobTaskRunLog.getLogRemotelyPath();
}else if(StringUtils.isNotBlank(jobTaskRunLog.getRunMsg())) { if (CollectionUtil.isNotEmpty(trackerIps)) {
logStr = jobTaskRunLog.getRunMsg(); for (String ipPort : trackerIps) {
} else if (StringUtils.isNotBlank(jobTaskRunLog.getTriggerMsg())){ String ip = ipPort.split(":")[0];
logStr = jobTaskRunLog.getTriggerMsg(); String baseUrl = "http://"+ip+":"+trackerIpsPort+"/";
} else { logStr = baseUrl + logStr+"\n";
logStr = "未知异常,出现此错误属于系统错误,请联系myth-job-admin开发团队!"; log.debug("--------log远程路径为:{}------",logStr);
} }
} catch (IOException e) { }
e.printStackTrace();
} }
stringBuilder.append("<tr align='center'>") stringBuilder.append("<tr align='center'>")
.append(String.format("<td>%s</td>", jobTaskRunLog.getNodeName())) .append(String.format("<td>%s</td>", jobTaskRunLog.getNodeName()))
...@@ -127,7 +124,7 @@ public class RunRecordingAndEmailServiceImpl implements RunRecordingAndEmailServ ...@@ -127,7 +124,7 @@ public class RunRecordingAndEmailServiceImpl implements RunRecordingAndEmailServ
: "4".equals(jobTaskRunLog.getRunCode()) ? "补批失败" : "失败")) : "4".equals(jobTaskRunLog.getRunCode()) ? "补批失败" : "失败"))
.append("<td>") .append("<td>")
.append("<div style='display:inline-block;width:100%;word-break:break-all;height: auto;overflow: auto;text-align: left;'>") .append("<div style='display:inline-block;width:100%;word-break:break-all;height: auto;overflow: auto;text-align: left;'>")
.append(String.format("%s", logStr==null?jobTaskRunLog.getRunMsg():logStr)) .append(String.format("%s", logStr))
.append("</div>") .append("</div>")
.append("</td></tr>"); .append("</td></tr>");
......
...@@ -7,6 +7,7 @@ import com.byit.service.RunRecordingService; ...@@ -7,6 +7,7 @@ import com.byit.service.RunRecordingService;
import com.byit.service.mapservice.RunRecordingAndEmailService; import com.byit.service.mapservice.RunRecordingAndEmailService;
import com.byit.thread.BaseThreadRunHelper; import com.byit.thread.BaseThreadRunHelper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.sql.DataSource; import javax.sql.DataSource;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment