密码设置
This commit is contained in:
parent
e4024a2dae
commit
12b32ae33b
|
|
@ -72,17 +72,10 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
private Environment environment;
|
private Environment environment;
|
||||||
@Resource
|
@Resource
|
||||||
private PermissionService permissionService;
|
private PermissionService permissionService;
|
||||||
@Resource
|
|
||||||
@Lazy
|
|
||||||
private EdFileRelationService edFileRelationService;
|
|
||||||
|
|
||||||
private String downloadDataDir = "";
|
private String downloadDataDir = "";
|
||||||
private String uploadDataDir = "";
|
private String uploadDataDir = "";
|
||||||
|
|
||||||
@Value("${file.security.passwd}")
|
|
||||||
private String password;
|
|
||||||
|
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
String osName = System.getProperty("os.name").toLowerCase();
|
String osName = System.getProperty("os.name").toLowerCase();
|
||||||
|
|
@ -413,7 +406,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
String mainName = FileUtil.mainName(destColibPath);
|
String mainName = FileUtil.mainName(destColibPath);
|
||||||
String parentDir = FileUtil.getParent(destColibPath, 1);
|
String parentDir = FileUtil.getParent(destColibPath, 1);
|
||||||
String zipDirPath = parentDir + File.separator + mainName + ".zip";
|
String zipDirPath = parentDir + File.separator + mainName + ".zip";
|
||||||
AES aes = SecureUtil.aes(password.getBytes());
|
AES aes = SecureUtil.aes(FILE_SEC_PASSWD.getBytes());
|
||||||
try (
|
try (
|
||||||
InputStream inputStream = Files.newInputStream(Paths.get(destColibPath));
|
InputStream inputStream = Files.newInputStream(Paths.get(destColibPath));
|
||||||
OutputStream outputStream = Files.newOutputStream(Paths.get(zipDirPath));
|
OutputStream outputStream = Files.newOutputStream(Paths.get(zipDirPath));
|
||||||
|
|
@ -659,7 +652,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
}
|
}
|
||||||
|
|
||||||
ZipUtil.zip(prjDirPath, exportZipFile);
|
ZipUtil.zip(prjDirPath, exportZipFile);
|
||||||
AES aes = SecureUtil.aes(password.getBytes());
|
AES aes = SecureUtil.aes(FILE_SEC_PASSWD.getBytes());
|
||||||
try (
|
try (
|
||||||
InputStream inputStream = Files.newInputStream(Paths.get(exportZipFile));
|
InputStream inputStream = Files.newInputStream(Paths.get(exportZipFile));
|
||||||
OutputStream outputStream = Files.newOutputStream(Paths.get(exportColibFile));
|
OutputStream outputStream = Files.newOutputStream(Paths.get(exportColibFile));
|
||||||
|
|
@ -749,7 +742,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
this.saveOrUpdate(newEdFileInfo);
|
this.saveOrUpdate(newEdFileInfo);
|
||||||
String fileDestPath = commonService.getFileSysPath(newEdFileInfo.getFilePath());
|
String fileDestPath = commonService.getFileSysPath(newEdFileInfo.getFilePath());
|
||||||
FileUtil.writeFromStream(file.getInputStream(), fileDestPath);
|
FileUtil.writeFromStream(file.getInputStream(), fileDestPath);
|
||||||
EleCommonUtil.encryptFile(fileDestPath, SecureUtil.aes(password.getBytes()));
|
EleCommonUtil.encryptFile(fileDestPath, SecureUtil.aes(FILE_SEC_PASSWD.getBytes()));
|
||||||
fileSystemService.save(FileUtil.getInputStream(fileDestPath), fileDestPath);
|
fileSystemService.save(FileUtil.getInputStream(fileDestPath), fileDestPath);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
||||||
|
|
@ -45,8 +45,6 @@ public class EdFileRelationServiceImpl extends ServiceImpl<EdFileRelationMapper,
|
||||||
private CommonService commonService;
|
private CommonService commonService;
|
||||||
@Resource
|
@Resource
|
||||||
private FileSystemService fileSystemService;
|
private FileSystemService fileSystemService;
|
||||||
@Value("${file.security.passwd}")
|
|
||||||
private String password;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建文件关系
|
* 创建文件关系
|
||||||
|
|
@ -235,7 +233,7 @@ public class EdFileRelationServiceImpl extends ServiceImpl<EdFileRelationMapper,
|
||||||
edFileInfoService.saveOrUpdate(newEdFileInfo);
|
edFileInfoService.saveOrUpdate(newEdFileInfo);
|
||||||
String fileDestPath = commonService.getFileSysPath(newEdFileInfo.getFilePath());
|
String fileDestPath = commonService.getFileSysPath(newEdFileInfo.getFilePath());
|
||||||
FileUtil.writeFromStream(file.getInputStream(), fileDestPath);
|
FileUtil.writeFromStream(file.getInputStream(), fileDestPath);
|
||||||
EleCommonUtil.encryptFile(fileDestPath, SecureUtil.aes(password.getBytes()));
|
EleCommonUtil.encryptFile(fileDestPath, SecureUtil.aes(FILE_SEC_PASSWD.getBytes()));
|
||||||
fileSystemService.save(FileUtil.getInputStream(fileDestPath), fileDestPath);
|
fileSystemService.save(FileUtil.getInputStream(fileDestPath), fileDestPath);
|
||||||
|
|
||||||
// 创建文件关系
|
// 创建文件关系
|
||||||
|
|
|
||||||
|
|
@ -13,4 +13,6 @@ public interface ElectromagneticConstants {
|
||||||
String UPLOAD_FILE_CHUNK_SUFFIX = ".part";
|
String UPLOAD_FILE_CHUNK_SUFFIX = ".part";
|
||||||
|
|
||||||
String NAME_VALID_MSG = "文件名不符合规范,只能包含中文字符、下划线、连字符、加号、数字和英文字符且长度小于32。";
|
String NAME_VALID_MSG = "文件名不符合规范,只能包含中文字符、下划线、连字符、加号、数字和英文字符且长度小于32。";
|
||||||
|
|
||||||
|
String FILE_SEC_PASSWD = "adknfhkj87654knd";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue