Commit 149f9398 by huangfusuper

调整文件系统的程序位置,修正邮件日志的显示系统

parent b899a492
...@@ -30,4 +30,7 @@ logging: ...@@ -30,4 +30,7 @@ logging:
file: file:
system: system:
ip: 10.0.120.2 ip: 10.0.120.2
port: 88 port: 88
\ No newline at end of file
myth-job:
filestystem: FASTDFS
\ No newline at end of file
...@@ -3,6 +3,7 @@ package com.byit.thread; ...@@ -3,6 +3,7 @@ package com.byit.thread;
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.enums.RunRecordingEnum; import com.byit.enums.RunRecordingEnum;
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;
...@@ -11,15 +12,17 @@ import com.byit.service.JobTaskRunLogService; ...@@ -11,15 +12,17 @@ import com.byit.service.JobTaskRunLogService;
import com.byit.service.RunRecordingService; import com.byit.service.RunRecordingService;
import com.byit.util.TimeFormatUtil; import com.byit.util.TimeFormatUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.csource.common.MyException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; 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;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
...@@ -59,20 +62,23 @@ public class RunRecordingScanHelper { ...@@ -59,20 +62,23 @@ public class RunRecordingScanHelper {
private static final String FILE_SYSTEM_PRE="http://"; private static final String FILE_SYSTEM_PRE="http://";
private DataSource dataSource; private DataSource dataSource;
private final EmailAlarmService emailAlarmService; private final EmailAlarmService emailAlarmService;
private final JobTaskRunLogService jobTaskRunLogService; private final JobTaskRunLogService jobTaskRunLogService;
private final RunRecordingService runRecordingService; private final RunRecordingService runRecordingService;
private final FileSystem fileSystem;
private volatile boolean runRecordingThreadStop = false; private volatile boolean runRecordingThreadStop = false;
private Thread runRecordingThread; private Thread runRecordingThread;
@Autowired @Autowired
public RunRecordingScanHelper(EmailAlarmService emailAlarmService, JobTaskRunLogService jobTaskRunLogService, RunRecordingService runRecordingService) { public RunRecordingScanHelper(EmailAlarmService emailAlarmService, JobTaskRunLogService jobTaskRunLogService, RunRecordingService runRecordingService, FileSystem fileSystem) {
this.emailAlarmService = emailAlarmService; this.emailAlarmService = emailAlarmService;
this.jobTaskRunLogService = jobTaskRunLogService; this.jobTaskRunLogService = jobTaskRunLogService;
this.runRecordingService = runRecordingService; this.runRecordingService = runRecordingService;
this.fileSystem = fileSystem;
} }
public void start() { public void start() {
...@@ -258,6 +264,14 @@ public class RunRecordingScanHelper { ...@@ -258,6 +264,14 @@ public class RunRecordingScanHelper {
* 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;
try {
if(null != jobTaskRunLog.getLogRemotelyPath()){
logStr = new String(fileSystem.downloaderFile(jobTaskRunLog.getLogRemotelyPath()), StandardCharsets.UTF_8);
}
} catch (IOException | MyException 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()))
.append(String.format("<td>%s</td>", DateUtil.format(jobTaskRunLog.getStartTime(), DATE_FORMAT))) .append(String.format("<td>%s</td>", DateUtil.format(jobTaskRunLog.getStartTime(), DATE_FORMAT)))
...@@ -268,7 +282,7 @@ public class RunRecordingScanHelper { ...@@ -268,7 +282,7 @@ public class RunRecordingScanHelper {
: "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", jobTaskRunLog.getRunMsg())) .append(String.format("%s", logStr==null?jobTaskRunLog.getRunMsg():logStr))
.append("</div>") .append("</div>")
.append("</td></tr>"); .append("</td></tr>");
......
...@@ -13,6 +13,10 @@ ...@@ -13,6 +13,10 @@
<artifactId>myth-core-common</artifactId> <artifactId>myth-core-common</artifactId>
<dependencies> <dependencies>
<dependency>
<groupId>net.oschina.zcx7878</groupId>
<artifactId>fastdfs-client-java</artifactId>
</dependency>
<!-- slf4j --> <!-- slf4j -->
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
......
package com.byit.executor.filesystem; package com.byit.filesystem;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import org.csource.common.MyException; import org.csource.common.MyException;
import org.csource.common.NameValuePair; import org.csource.common.NameValuePair;
import org.csource.fastdfs.*; import org.csource.fastdfs.ClientGlobal;
import org.csource.fastdfs.StorageClient1;
import org.csource.fastdfs.TrackerClient;
import org.csource.fastdfs.TrackerServer;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
......
package com.byit.executor.filesystem; package com.byit.filesystem;
import org.csource.common.MyException; import org.csource.common.MyException;
...@@ -19,7 +19,7 @@ public interface FileSystem { ...@@ -19,7 +19,7 @@ public interface FileSystem {
* @throws IOException * @throws IOException
* @throws MyException * @throws MyException
*/ */
String uploadFile(byte[] fileBuffer, String fileExtName, Map<String,String> mateDaTA) throws IOException, MyException; String uploadFile(byte[] fileBuffer, String fileExtName, Map<String, String> mateDaTA) throws IOException, MyException;
/** /**
* 文件下载接口 * 文件下载接口
......
...@@ -47,10 +47,10 @@ ...@@ -47,10 +47,10 @@
<artifactId>guava</artifactId> <artifactId>guava</artifactId>
</dependency> </dependency>
<dependency> <!--<dependency>
<groupId>net.oschina.zcx7878</groupId> <groupId>net.oschina.zcx7878</groupId>
<artifactId>fastdfs-client-java</artifactId> <artifactId>fastdfs-client-java</artifactId>
</dependency> </dependency>-->
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
......
package com.test; package com.test;
import com.byit.executor.filesystem.FastDfsFileSystem;
import com.byit.filesystem.FastDfsFileSystem;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.csource.common.MyException; import org.csource.common.MyException;
......
...@@ -2,9 +2,9 @@ package com.byit.service; ...@@ -2,9 +2,9 @@ package com.byit.service;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.byit.executor.api.ScriptExecutorService; import com.byit.executor.api.ScriptExecutorService;
import com.byit.executor.filesystem.FileSystem;
import com.byit.executor.jobExecutor.process.MythJobProcess; import com.byit.executor.jobExecutor.process.MythJobProcess;
import com.byit.executor.jobExecutor.process.ProcessFailureException; import com.byit.executor.jobExecutor.process.ProcessFailureException;
import com.byit.filesystem.FileSystem;
import com.byit.job.dto.DispatchResponseDto; import com.byit.job.dto.DispatchResponseDto;
import com.byit.job.dto.JobRunResultDto; import com.byit.job.dto.JobRunResultDto;
import com.byit.job.dto.ScriptDto; import com.byit.job.dto.ScriptDto;
......
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