|
|
@ -3,6 +3,7 @@ package com.xydl.cac.task;
|
|
|
|
import com.jcraft.jsch.ChannelSftp;
|
|
|
|
import com.jcraft.jsch.ChannelSftp;
|
|
|
|
import com.xydl.cac.config.BizConfig;
|
|
|
|
import com.xydl.cac.config.BizConfig;
|
|
|
|
import com.xydl.cac.entity.*;
|
|
|
|
import com.xydl.cac.entity.*;
|
|
|
|
|
|
|
|
import com.xydl.cac.entity.constants.Constants;
|
|
|
|
import com.xydl.cac.service.RemoteConfigService;
|
|
|
|
import com.xydl.cac.service.RemoteConfigService;
|
|
|
|
import com.xydl.cac.service.RemoteDownloadService;
|
|
|
|
import com.xydl.cac.service.RemoteDownloadService;
|
|
|
|
import com.xydl.cac.socket.WebSocketServer;
|
|
|
|
import com.xydl.cac.socket.WebSocketServer;
|
|
|
@ -51,7 +52,7 @@ public class AmpliDownloadTask {
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
log.error("AmpliDownloadTask.downloadAll error.", e);
|
|
|
|
log.error("AmpliDownloadTask.downloadAll error.", e);
|
|
|
|
String str = "SFTP下载文件异常: " + e.getMessage();
|
|
|
|
String str = "SFTP下载文件异常: " + e.getMessage();
|
|
|
|
webSocketServer.sendMessage(str , null);
|
|
|
|
webSocketServer.sendMessage(str, null);
|
|
|
|
dingTalkPushUtil.pushText(str);
|
|
|
|
dingTalkPushUtil.pushText(str);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -59,7 +60,7 @@ public class AmpliDownloadTask {
|
|
|
|
|
|
|
|
|
|
|
|
// 下载一个远端服务器
|
|
|
|
// 下载一个远端服务器
|
|
|
|
private void downloadServer(RemoteConfig config) throws Exception {
|
|
|
|
private void downloadServer(RemoteConfig config) throws Exception {
|
|
|
|
if (config.getActive() == null || config.getActive().intValue() == 0) {
|
|
|
|
if (config.getActive() == null || config.getActive().intValue() == Constants.FALSE) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
config.toList();
|
|
|
|
config.toList();
|
|
|
@ -77,7 +78,7 @@ public class AmpliDownloadTask {
|
|
|
|
log.error("AmpliDownloadTask.downloadServer error.", e);
|
|
|
|
log.error("AmpliDownloadTask.downloadServer error.", e);
|
|
|
|
String str = "SFTP下载文件异常: " + config.getName() + " " +
|
|
|
|
String str = "SFTP下载文件异常: " + config.getName() + " " +
|
|
|
|
config.getIp() + " " + e.getMessage();
|
|
|
|
config.getIp() + " " + e.getMessage();
|
|
|
|
webSocketServer.sendMessage(str , null);
|
|
|
|
webSocketServer.sendMessage(str, null);
|
|
|
|
dingTalkPushUtil.pushText(str);
|
|
|
|
dingTalkPushUtil.pushText(str);
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
sftpTool.disconnect();
|
|
|
|
sftpTool.disconnect();
|
|
|
@ -109,7 +110,7 @@ public class AmpliDownloadTask {
|
|
|
|
if (!exist) {
|
|
|
|
if (!exist) {
|
|
|
|
String localFilePath = localPath + "/" + filename;
|
|
|
|
String localFilePath = localPath + "/" + filename;
|
|
|
|
sftpTool.download(filename, bizConfig.getDatapath() + localFilePath);
|
|
|
|
sftpTool.download(filename, bizConfig.getDatapath() + localFilePath);
|
|
|
|
if (config.getTodel() != null && config.getTodel().intValue() == 1) {
|
|
|
|
if (config.getTodel() != null && config.getTodel().intValue() == Constants.TRUE) {
|
|
|
|
sftpTool.delete(filename);
|
|
|
|
sftpTool.delete(filename);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
item.setPath(nginxPath + localFilePath);
|
|
|
|
item.setPath(nginxPath + localFilePath);
|
|
|
|