Commit 972746f2 by huangfusuper

改变fdfs ip的注入配置

parent c5502c2f
...@@ -10,6 +10,7 @@ import com.byit.service.JobTaskRunLogService; ...@@ -10,6 +10,7 @@ import com.byit.service.JobTaskRunLogService;
import com.byit.service.RunRecordingService; import com.byit.service.RunRecordingService;
import com.byit.service.mapservice.RunRecordingAndEmailService; import com.byit.service.mapservice.RunRecordingAndEmailService;
import com.byit.util.TimeFormatUtil; import com.byit.util.TimeFormatUtil;
import com.github.tobato.fastdfs.conn.TrackerConnectionManager;
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.beans.factory.annotation.Value;
...@@ -37,16 +38,16 @@ public class RunRecordingAndEmailServiceImpl implements RunRecordingAndEmailServ ...@@ -37,16 +38,16 @@ public class RunRecordingAndEmailServiceImpl implements RunRecordingAndEmailServ
*/ */
private final RunRecordingService runRecordingService; private final RunRecordingService runRecordingService;
@Value("${fdfs.tracker-list}") private final TrackerConnectionManager trackerConnectionManager;
private List<String> trackerIps;
@Value("${fdfs.http-port}") @Value("${fdfs.http-port}")
private String trackerIpsPort; private String trackerIpsPort;
public RunRecordingAndEmailServiceImpl(EmailAlarmService emailAlarmService, JobTaskRunLogService jobTaskRunLogService, public RunRecordingAndEmailServiceImpl(EmailAlarmService emailAlarmService, JobTaskRunLogService jobTaskRunLogService,
RunRecordingService runRecordingService) { RunRecordingService runRecordingService, TrackerConnectionManager trackerConnectionManager) {
this.emailAlarmService = emailAlarmService; this.emailAlarmService = emailAlarmService;
this.jobTaskRunLogService = jobTaskRunLogService; this.jobTaskRunLogService = jobTaskRunLogService;
this.runRecordingService = runRecordingService; this.runRecordingService = runRecordingService;
this.trackerConnectionManager = trackerConnectionManager;
} }
@Override @Override
...@@ -104,8 +105,9 @@ public class RunRecordingAndEmailServiceImpl implements RunRecordingAndEmailServ ...@@ -104,8 +105,9 @@ public class RunRecordingAndEmailServiceImpl implements RunRecordingAndEmailServ
String logStr = "无远程路径"; String logStr = "无远程路径";
if(StringUtils.isNotBlank(jobTaskRunLog.getLogRemotelyPath())){ if(StringUtils.isNotBlank(jobTaskRunLog.getLogRemotelyPath())){
logStr = jobTaskRunLog.getLogRemotelyPath(); logStr = jobTaskRunLog.getLogRemotelyPath();
if (CollectionUtil.isNotEmpty(trackerIps)) { List<String> trackerList = trackerConnectionManager.getTrackerList();
for (String ipPort : trackerIps) { if (CollectionUtil.isNotEmpty(trackerList)) {
for (String ipPort : trackerList) {
String ip = ipPort.split(":")[0]; String ip = ipPort.split(":")[0];
String baseUrl = "http://"+ip+":"+trackerIpsPort+"/"; String baseUrl = "http://"+ip+":"+trackerIpsPort+"/";
logStr = baseUrl + logStr+"\n"; logStr = baseUrl + logStr+"\n";
......
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