0707 ljc afl模块文件操作以及入库操作以及时序表操作等接口开发,包含分片代码以及文件工具类代码
This commit is contained in:
parent
00e8ddf30b
commit
0262356e2d
@ -741,6 +741,11 @@ public class SftpUploadUtil {
|
|||||||
List<String> copiedFiles = new ArrayList<>();
|
List<String> copiedFiles = new ArrayList<>();
|
||||||
|
|
||||||
for (String sourceFilePath : sourceFilePaths) {
|
for (String sourceFilePath : sourceFilePaths) {
|
||||||
|
String chmodDir = sourceFilePath.substring(0, sourceFilePath.indexOf("default"));
|
||||||
|
log.info("分配权限路径,{}",chmodDir);
|
||||||
|
// 切换目录并列出内容用于调试
|
||||||
|
sudoChmodORwx(session,chmodDir,password);
|
||||||
|
|
||||||
// 获取源文件名
|
// 获取源文件名
|
||||||
String sourceFileName = sourceFilePath.substring(sourceFilePath.lastIndexOf('/') + 1);
|
String sourceFileName = sourceFilePath.substring(sourceFilePath.lastIndexOf('/') + 1);
|
||||||
|
|
||||||
@ -865,6 +870,11 @@ public class SftpUploadUtil {
|
|||||||
|
|
||||||
channelSftp = (ChannelSftp) channel;
|
channelSftp = (ChannelSftp) channel;
|
||||||
|
|
||||||
|
String chmodDir = remoteDir.substring(0, remoteDir.indexOf("default"));
|
||||||
|
log.info("分配权限路径,{}",chmodDir);
|
||||||
|
// 切换目录并列出内容用于调试
|
||||||
|
sudoChmodORwx(session,chmodDir,password);
|
||||||
|
|
||||||
// 切换到目标目录
|
// 切换到目标目录
|
||||||
channelSftp.cd(remoteDir);
|
channelSftp.cd(remoteDir);
|
||||||
|
|
||||||
@ -966,6 +976,11 @@ public class SftpUploadUtil {
|
|||||||
|
|
||||||
channelSftp = (ChannelSftp) channel;
|
channelSftp = (ChannelSftp) channel;
|
||||||
|
|
||||||
|
String chmodDir = remoteDir.substring(0, remoteDir.indexOf("default"));
|
||||||
|
log.info("分配权限路径,{}",chmodDir);
|
||||||
|
// 切换目录并列出内容用于调试
|
||||||
|
sudoChmodORwx(session,chmodDir,password);
|
||||||
|
|
||||||
// 切换到目标目录
|
// 切换到目标目录
|
||||||
channelSftp.cd(remoteDir);
|
channelSftp.cd(remoteDir);
|
||||||
|
|
||||||
@ -1069,6 +1084,11 @@ public class SftpUploadUtil {
|
|||||||
session.connect();
|
session.connect();
|
||||||
System.out.println("SFTP Session 连接成功.");
|
System.out.println("SFTP Session 连接成功.");
|
||||||
|
|
||||||
|
String chmodDir = remoteDir.substring(0, remoteDir.indexOf("default"));
|
||||||
|
log.info("分配权限路径,{}",chmodDir);
|
||||||
|
// 切换目录并列出内容用于调试
|
||||||
|
sudoChmodORwx(session,chmodDir,password);
|
||||||
|
|
||||||
// 开始执行 find 命令
|
// 开始执行 find 命令
|
||||||
ChannelExec execChannel = (ChannelExec) session.openChannel("exec");
|
ChannelExec execChannel = (ChannelExec) session.openChannel("exec");
|
||||||
|
|
||||||
@ -1196,6 +1216,11 @@ public class SftpUploadUtil {
|
|||||||
|
|
||||||
// 遍历远程文件路径并下载
|
// 遍历远程文件路径并下载
|
||||||
for (String remoteFile : remoteFilePaths) {
|
for (String remoteFile : remoteFilePaths) {
|
||||||
|
String chmodDir = remoteFile.substring(0, remoteFile.indexOf("default"));
|
||||||
|
log.info("分配权限路径,{}",chmodDir);
|
||||||
|
// 切换目录并列出内容用于调试
|
||||||
|
sudoChmodORwx(session,chmodDir,password);
|
||||||
|
|
||||||
String fileName = new File(remoteFile).getName();
|
String fileName = new File(remoteFile).getName();
|
||||||
String localFilePath = localDir + fileName;
|
String localFilePath = localDir + fileName;
|
||||||
|
|
||||||
@ -1318,6 +1343,10 @@ public class SftpUploadUtil {
|
|||||||
System.out.println("SFTP Channel 打开成功.");
|
System.out.println("SFTP Channel 打开成功.");
|
||||||
|
|
||||||
channelSftp = (ChannelSftp) channel;
|
channelSftp = (ChannelSftp) channel;
|
||||||
|
String chmodDir = remoteFilePath.substring(0, remoteFilePath.indexOf("default"));
|
||||||
|
log.info("分配权限路径,{}",chmodDir);
|
||||||
|
// 切换目录并列出内容用于调试
|
||||||
|
sudoChmodORwx(session,chmodDir,password);
|
||||||
|
|
||||||
String remoteDir = remoteFilePath.substring(0, remoteFilePath.lastIndexOf('/'));
|
String remoteDir = remoteFilePath.substring(0, remoteFilePath.lastIndexOf('/'));
|
||||||
String fileName = remoteFilePath.substring(remoteFilePath.lastIndexOf('/') + 1);
|
String fileName = remoteFilePath.substring(remoteFilePath.lastIndexOf('/') + 1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user