🔨 优化配置中心逻辑.
This commit is contained in:
@@ -22,10 +22,10 @@
|
||||
*/
|
||||
package org.dromara.visor.module.asset.handler.host.transfer.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import cn.orionsec.kit.lang.utils.time.Dates;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* sftp 文件备份参数
|
||||
@@ -35,9 +35,6 @@ import lombok.NoArgsConstructor;
|
||||
* @since 2024/4/15 23:13
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SftpFileBackupParams {
|
||||
|
||||
/**
|
||||
@@ -50,4 +47,16 @@ public class SftpFileBackupParams {
|
||||
*/
|
||||
private Long timestamp;
|
||||
|
||||
/**
|
||||
* 当前时间
|
||||
*/
|
||||
private String time;
|
||||
|
||||
public SftpFileBackupParams(String fileName) {
|
||||
this.fileName = fileName;
|
||||
Date date = new Date();
|
||||
this.timestamp = date.getTime();
|
||||
this.time = Dates.format(date, Dates.YMD_HMS2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public class SftpUtils {
|
||||
SftpFile file = executor.getFile(path);
|
||||
if (file != null) {
|
||||
// 文件存在则备份
|
||||
SftpFileBackupParams backupParams = new SftpFileBackupParams(file.getName(), System.currentTimeMillis());
|
||||
SftpFileBackupParams backupParams = new SftpFileBackupParams(file.getName());
|
||||
String target = Strings.format(config.getBackupFileName(), JSON.parseObject(JSON.toJSONString(backupParams)));
|
||||
// 移动
|
||||
executor.move(path, target);
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.dromara.visor.module.infra.entity.vo.SystemSettingAggregateVO;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 系统配置缓存 key
|
||||
* 系统设置缓存 key
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
|
||||
@@ -32,7 +32,7 @@ import org.dromara.visor.module.infra.handler.setting.model.SftpSystemSettingMod
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 系统配置类型枚举
|
||||
* 系统设置类型枚举
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
|
||||
@@ -28,7 +28,7 @@ import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 加密系统配置模型
|
||||
* 加密系统设置模型
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
|
||||
@@ -28,7 +28,7 @@ import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* SFTP 系统配置模型
|
||||
* SFTP 系统设置模型
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
|
||||
Reference in New Issue
Block a user