新增库文件相关功能的适配。
This commit is contained in:
parent
fc56722ce5
commit
aea1427eaa
|
|
@ -1,47 +1,145 @@
|
||||||
package com.electromagnetic.industry.software.manage.config;
|
package com.electromagnetic.industry.software.manage.config;
|
||||||
|
|
||||||
import cn.hutool.core.io.FileUtil;
|
import com.electromagnetic.industry.software.common.enums.DataOwnEnum;
|
||||||
import com.electromagnetic.industry.software.common.util.EleCommonUtil;
|
import com.electromagnetic.industry.software.common.util.EleCommonUtil;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.core.env.Environment;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Getter
|
|
||||||
public class ElePropertyConfig {
|
public class ElePropertyConfig {
|
||||||
|
|
||||||
@Resource
|
@Value("${data.ele.tmp.path}")
|
||||||
private Environment environment;
|
private String eleTmpPath;
|
||||||
|
|
||||||
private String downloadDataDir = "";
|
@Value("${data.sys.prj.path}")
|
||||||
private String uploadDataDir = "";
|
private String sysPrjPath;
|
||||||
private String tmpDir = "";
|
|
||||||
private String eleDataPath;
|
|
||||||
private String userDataPath;
|
|
||||||
|
|
||||||
private String prjDir;
|
@Value("${data.sys.upload.path}")
|
||||||
|
private String sysUploadPath;
|
||||||
|
|
||||||
@Value("${data.tmp.days:7}")
|
@Value("${data.sys.download.path}")
|
||||||
|
private String sysDownloadPath;
|
||||||
|
|
||||||
|
@Value("${data.user.prj.path}")
|
||||||
|
private String userPrjPath;
|
||||||
|
|
||||||
|
@Value("${data.user.upload.path}")
|
||||||
|
private String userUploadPath;
|
||||||
|
|
||||||
|
@Value("${data.user.download.path}")
|
||||||
|
private String userDownloadPath;
|
||||||
|
|
||||||
|
@Value("${data.repo.prj.path}")
|
||||||
|
private String repoPrjPath;
|
||||||
|
|
||||||
|
@Value("${data.repo.upload.path}")
|
||||||
|
private String repoUploadPath;
|
||||||
|
|
||||||
|
@Value("${data.repo.download.path}")
|
||||||
|
private String repoDownloadPath;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Value("${tmp.file.store.days}")
|
||||||
private int tmpFileStoreDays;
|
private int tmpFileStoreDays;
|
||||||
|
|
||||||
|
@Getter
|
||||||
@Value("${backup.remote.host}")
|
@Value("${backup.remote.host}")
|
||||||
private String remoteHost = "";
|
private String remoteHost = "";
|
||||||
|
|
||||||
|
@Getter
|
||||||
@Value("${backup.remote.port}")
|
@Value("${backup.remote.port}")
|
||||||
private int remotePort;
|
private int remotePort;
|
||||||
|
|
||||||
@PostConstruct
|
@Value("${winPrefix}")
|
||||||
public void init() {
|
private String winPrefix = "";
|
||||||
uploadDataDir = EleCommonUtil.isWinOs() ? environment.getProperty("data.upload.windows.tmp.path") : environment.getProperty("data.upload.linux.tmp.path");
|
|
||||||
downloadDataDir = EleCommonUtil.isWinOs() ? environment.getProperty("data.download.windows.tmp.path") : environment.getProperty("data.download.linux.tmp.path");
|
public String getEleTmpPath() {
|
||||||
tmpDir = EleCommonUtil.isWinOs() ? environment.getProperty("data.windows.tmp.path") : environment.getProperty("data.linux.tmp.path");
|
if (EleCommonUtil.isWinOs()) {
|
||||||
eleDataPath = EleCommonUtil.isWinOs() ? environment.getProperty("data.windows.path") : environment.getProperty("data.linux.path");
|
return winPrefix + eleTmpPath;
|
||||||
userDataPath = EleCommonUtil.isWinOs() ? environment.getProperty("data.windows.user.path") : environment.getProperty("data.linux.user.path");
|
}
|
||||||
String tmp = EleCommonUtil.isWinOs() ? environment.getProperty("data.windows.path") : environment.getProperty("data.linux.path");
|
return eleTmpPath;
|
||||||
prjDir = FileUtil.getParent(tmp, 1);
|
}
|
||||||
|
|
||||||
|
public String getSysPrjPath() {
|
||||||
|
if (EleCommonUtil.isWinOs()) {
|
||||||
|
return winPrefix + sysPrjPath;
|
||||||
|
}
|
||||||
|
return sysPrjPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSysUploadPath() {
|
||||||
|
if (EleCommonUtil.isWinOs()) {
|
||||||
|
return winPrefix + sysUploadPath;
|
||||||
|
}
|
||||||
|
return sysUploadPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSysDownloadPath() {
|
||||||
|
if (EleCommonUtil.isWinOs()) {
|
||||||
|
return winPrefix + sysDownloadPath;
|
||||||
|
}
|
||||||
|
return sysDownloadPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserPrjPath() {
|
||||||
|
if (EleCommonUtil.isWinOs()) {
|
||||||
|
return winPrefix + userPrjPath;
|
||||||
|
}
|
||||||
|
return userPrjPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserUploadPath() {
|
||||||
|
if (EleCommonUtil.isWinOs()) {
|
||||||
|
return winPrefix + userUploadPath;
|
||||||
|
}
|
||||||
|
return userUploadPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserDownloadPath() {
|
||||||
|
if (EleCommonUtil.isWinOs()) {
|
||||||
|
return winPrefix + userDownloadPath;
|
||||||
|
}
|
||||||
|
return userDownloadPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRepoPrjPath() {
|
||||||
|
if (EleCommonUtil.isWinOs()) {
|
||||||
|
return winPrefix + repoPrjPath;
|
||||||
|
}
|
||||||
|
return repoPrjPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRepoUploadPath() {
|
||||||
|
if (EleCommonUtil.isWinOs()) {
|
||||||
|
return winPrefix + repoUploadPath;
|
||||||
|
}
|
||||||
|
return repoUploadPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRepoDownloadPath() {
|
||||||
|
if (EleCommonUtil.isWinOs()) {
|
||||||
|
return winPrefix + repoDownloadPath;
|
||||||
|
}
|
||||||
|
return repoDownloadPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUploadDataDir(int dataOwnCode) {
|
||||||
|
if (DataOwnEnum.isSysCode(dataOwnCode)) {
|
||||||
|
return getSysUploadPath();
|
||||||
|
} else if (DataOwnEnum.isUserCode(dataOwnCode)) {
|
||||||
|
return getUserUploadPath();
|
||||||
|
}
|
||||||
|
return getRepoUploadPath();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDownloadDataDir(int dataOwnCode) {
|
||||||
|
if (DataOwnEnum.isSysCode(dataOwnCode)) {
|
||||||
|
return getSysDownloadPath();
|
||||||
|
} else if (DataOwnEnum.isUserCode(dataOwnCode)) {
|
||||||
|
return getUserDownloadPath();
|
||||||
|
}
|
||||||
|
return getRepoDownloadPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -128,13 +128,13 @@ public class EdFileInfoController {
|
||||||
@UserOperation(value = "批量上传数据库", modelName = UserOperationModuleEnum.SYS_PRJ_DATABASE)
|
@UserOperation(value = "批量上传数据库", modelName = UserOperationModuleEnum.SYS_PRJ_DATABASE)
|
||||||
@RequestMapping(value = "/batchImport", method = RequestMethod.POST)
|
@RequestMapping(value = "/batchImport", method = RequestMethod.POST)
|
||||||
public ElectromagneticResult<?> batchImport(FileChunkDTO fileChunkDTO) {
|
public ElectromagneticResult<?> batchImport(FileChunkDTO fileChunkDTO) {
|
||||||
return edFileInfoService.batchImport(fileChunkDTO);
|
return edFileInfoService.batchImport(fileChunkDTO, DataOwnEnum.SYS_FILE.code);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UserOperation(value = "批量上传数据库")
|
@UserOperation(value = "批量上传数据库")
|
||||||
@RequestMapping(value = "/batchImport", method = RequestMethod.GET)
|
@RequestMapping(value = "/batchImport", method = RequestMethod.GET)
|
||||||
public ElectromagneticResult<?> checkChunkExist(FileChunkDTO fileChunkDTO) {
|
public ElectromagneticResult<?> checkChunkExist(FileChunkDTO fileChunkDTO) {
|
||||||
return edFileInfoService.checkChunkExist(fileChunkDTO);
|
return edFileInfoService.checkChunkExist(fileChunkDTO, DataOwnEnum.SYS_FILE.code);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UserOperation(value = "查询发布管理", modelName = UserOperationModuleEnum.SYS_PRJ_DATABASE)
|
@UserOperation(value = "查询发布管理", modelName = UserOperationModuleEnum.SYS_PRJ_DATABASE)
|
||||||
|
|
|
||||||
|
|
@ -39,21 +39,21 @@ public class RepoEdFileInfoController {
|
||||||
@UserOperation(value = "创建文件夹", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
@UserOperation(value = "创建文件夹", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
||||||
@RequestMapping("createFolder")
|
@RequestMapping("createFolder")
|
||||||
public ElectromagneticResult<?> createFolder(@RequestBody CreateFolderDTO createFolderDTO) {
|
public ElectromagneticResult<?> createFolder(@RequestBody CreateFolderDTO createFolderDTO) {
|
||||||
return edFileInfoService.createFolder(createFolderDTO, DataOwnEnum.SYS_FILE.code);
|
return edFileInfoService.createFolder(createFolderDTO, DataOwnEnum.REPO_FILE.code);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UserOperation(value = "作废", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
@UserOperation(value = "作废", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
||||||
@RequiredPermission(value = FilePermission.DELETE)
|
@RequiredPermission(value = FilePermission.DELETE)
|
||||||
@RequestMapping("delete")
|
@RequestMapping("delete")
|
||||||
public ElectromagneticResult<?> delete(@RequestParam String id) {
|
public ElectromagneticResult<?> delete(@RequestParam String id) {
|
||||||
return edFileInfoService.delete(id, DataOwnEnum.SYS_FILE.code);
|
return edFileInfoService.delete(id, DataOwnEnum.REPO_FILE.code);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UserOperation(value = "查询文件", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
@UserOperation(value = "查询文件", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
||||||
@RequiredPermission(value = FilePermission.VIEW)
|
@RequiredPermission(value = FilePermission.VIEW)
|
||||||
@RequestMapping("info")
|
@RequestMapping("info")
|
||||||
public ElectromagneticResult<?> info(@RequestBody FileInfoQueryDTO fileInfoQueryDTO) {
|
public ElectromagneticResult<?> info(@RequestBody FileInfoQueryDTO fileInfoQueryDTO) {
|
||||||
return edFileInfoService.queryEdFileInfo(fileInfoQueryDTO, DataOwnEnum.SYS_FILE.code);
|
return edFileInfoService.queryEdFileInfo(fileInfoQueryDTO, DataOwnEnum.REPO_FILE.code);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UserOperation(value = "上传文件", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
@UserOperation(value = "上传文件", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
||||||
|
|
@ -62,21 +62,21 @@ public class RepoEdFileInfoController {
|
||||||
public ElectromagneticResult<?> upload(@RequestParam("parentId") String parentId,
|
public ElectromagneticResult<?> upload(@RequestParam("parentId") String parentId,
|
||||||
@RequestParam("file") MultipartFile file,
|
@RequestParam("file") MultipartFile file,
|
||||||
@RequestParam("strategy") Integer strategy) {
|
@RequestParam("strategy") Integer strategy) {
|
||||||
return edFileInfoService.upload(parentId, file, strategy, DataOwnEnum.SYS_FILE.code);
|
return edFileInfoService.upload(parentId, file, strategy, DataOwnEnum.REPO_FILE.code);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UserOperation(value = "下载文件", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
@UserOperation(value = "下载文件", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
||||||
@RequiredPermission(value = FilePermission.DOWNLOAD)
|
@RequiredPermission(value = FilePermission.DOWNLOAD)
|
||||||
@RequestMapping("download")
|
@RequestMapping("download")
|
||||||
public ResponseEntity<InputStreamResource> download(@RequestParam String id, HttpServletResponse response) {
|
public ResponseEntity<InputStreamResource> download(@RequestParam String id, HttpServletResponse response) {
|
||||||
return edFileInfoService.download(id, response, DataOwnEnum.SYS_FILE.code);
|
return edFileInfoService.download(id, response, DataOwnEnum.REPO_FILE.code);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UserOperation(value = "更新文件信息", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
@UserOperation(value = "更新文件信息", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
||||||
@RequiredPermission(value = FilePermission.EDIT)
|
@RequiredPermission(value = FilePermission.EDIT)
|
||||||
@RequestMapping("updateFileInfo")
|
@RequestMapping("updateFileInfo")
|
||||||
public ElectromagneticResult<?> updateFileInfo(@RequestBody UpdateFileInfoDTO updateFileInfoDTO) {
|
public ElectromagneticResult<?> updateFileInfo(@RequestBody UpdateFileInfoDTO updateFileInfoDTO) {
|
||||||
return edFileInfoService.updateFileInfo(updateFileInfoDTO, DataOwnEnum.SYS_FILE.code);
|
return edFileInfoService.updateFileInfo(updateFileInfoDTO, DataOwnEnum.REPO_FILE.code);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UserOperation(value = "移动文件", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
@UserOperation(value = "移动文件", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
||||||
|
|
@ -85,7 +85,7 @@ public class RepoEdFileInfoController {
|
||||||
public ElectromagneticResult<?> moveFile(@RequestParam("id") String id,
|
public ElectromagneticResult<?> moveFile(@RequestParam("id") String id,
|
||||||
@RequestParam("targetFolderId") String targetFolderId,
|
@RequestParam("targetFolderId") String targetFolderId,
|
||||||
@RequestParam("strategy") Integer strategy) {
|
@RequestParam("strategy") Integer strategy) {
|
||||||
return edFileInfoService.moveFile(id, targetFolderId, strategy, DataOwnEnum.SYS_FILE.code);
|
return edFileInfoService.moveFile(id, targetFolderId, strategy, DataOwnEnum.REPO_FILE.code);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UserOperation(value = "复制文件", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
@UserOperation(value = "复制文件", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
||||||
|
|
@ -94,7 +94,7 @@ public class RepoEdFileInfoController {
|
||||||
public ElectromagneticResult<?> copyFile(@RequestParam("id") String id,
|
public ElectromagneticResult<?> copyFile(@RequestParam("id") String id,
|
||||||
@RequestParam("targetFolderId") String targetFolderId,
|
@RequestParam("targetFolderId") String targetFolderId,
|
||||||
@RequestParam("strategy") Integer strategy) {
|
@RequestParam("strategy") Integer strategy) {
|
||||||
return edFileInfoService.copyFile(id, targetFolderId, strategy, DataOwnEnum.SYS_FILE.code);
|
return edFileInfoService.copyFile(id, targetFolderId, strategy, DataOwnEnum.REPO_FILE.code);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UserOperation(value = "查看文件历史版本信息", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
@UserOperation(value = "查看文件历史版本信息", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
||||||
|
|
@ -114,7 +114,7 @@ public class RepoEdFileInfoController {
|
||||||
@UserOperation(value = "导出数据库", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
@UserOperation(value = "导出数据库", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
||||||
@RequestMapping("batchExport")
|
@RequestMapping("batchExport")
|
||||||
public ResponseEntity<InputStreamResource> batchExport(@RequestParam String fileIds, HttpServletResponse response) throws IOException {
|
public ResponseEntity<InputStreamResource> batchExport(@RequestParam String fileIds, HttpServletResponse response) throws IOException {
|
||||||
return edFileInfoService.batchExport(fileIds, response, DataOwnEnum.SYS_FILE.code);
|
return edFileInfoService.batchExport(fileIds, response, DataOwnEnum.REPO_FILE.code);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UserOperation(value = "批量上传数据库", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
@UserOperation(value = "批量上传数据库", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
||||||
|
|
@ -128,19 +128,19 @@ public class RepoEdFileInfoController {
|
||||||
@UserOperation(value = "批量上传数据库", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
@UserOperation(value = "批量上传数据库", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
||||||
@RequestMapping(value = "/batchImport", method = RequestMethod.POST)
|
@RequestMapping(value = "/batchImport", method = RequestMethod.POST)
|
||||||
public ElectromagneticResult<?> batchImport(FileChunkDTO fileChunkDTO) {
|
public ElectromagneticResult<?> batchImport(FileChunkDTO fileChunkDTO) {
|
||||||
return edFileInfoService.batchImport(fileChunkDTO);
|
return edFileInfoService.batchImport(fileChunkDTO, DataOwnEnum.REPO_FILE.code);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UserOperation(value = "批量上传数据库")
|
@UserOperation(value = "批量上传数据库")
|
||||||
@RequestMapping(value = "/batchImport", method = RequestMethod.GET)
|
@RequestMapping(value = "/batchImport", method = RequestMethod.GET)
|
||||||
public ElectromagneticResult<?> checkChunkExist(FileChunkDTO fileChunkDTO) {
|
public ElectromagneticResult<?> checkChunkExist(FileChunkDTO fileChunkDTO) {
|
||||||
return edFileInfoService.checkChunkExist(fileChunkDTO);
|
return edFileInfoService.checkChunkExist(fileChunkDTO, DataOwnEnum.REPO_FILE.code);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UserOperation(value = "查询发布管理", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
@UserOperation(value = "查询发布管理", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
||||||
@RequestMapping(value = "/uploadRecord", method = RequestMethod.GET)
|
@RequestMapping(value = "/uploadRecord", method = RequestMethod.GET)
|
||||||
public ElectromagneticResult<?> uploadRecord(@RequestParam int pageNum, @RequestParam int pageSize) {
|
public ElectromagneticResult<?> uploadRecord(@RequestParam int pageNum, @RequestParam int pageSize) {
|
||||||
return edFileInfoService.uploadRecord(pageNum, pageSize, DataOwnEnum.SYS_FILE.code);
|
return edFileInfoService.uploadRecord(pageNum, pageSize, DataOwnEnum.REPO_FILE.code);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UserOperation(value = "查询文件详细信息", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
@UserOperation(value = "查询文件详细信息", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
||||||
|
|
@ -154,14 +154,14 @@ public class RepoEdFileInfoController {
|
||||||
@RequiredPermission(value = FilePermission.VIEW)
|
@RequiredPermission(value = FilePermission.VIEW)
|
||||||
@RequestMapping(value = "/queryChildFolder", method = RequestMethod.GET)
|
@RequestMapping(value = "/queryChildFolder", method = RequestMethod.GET)
|
||||||
public ElectromagneticResult<?> queryChildFolder(@RequestParam String parentId) {
|
public ElectromagneticResult<?> queryChildFolder(@RequestParam String parentId) {
|
||||||
return edFileInfoService.queryChildFolder(parentId, DataOwnEnum.SYS_FILE.code);
|
return edFileInfoService.queryChildFolder(parentId, DataOwnEnum.REPO_FILE.code);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UserOperation(value = "预览文件", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
@UserOperation(value = "预览文件", modelName = UserOperationModuleEnum.REPO_PRJ_DATABASE)
|
||||||
@RequiredPermission(value = FilePermission.DOWNLOAD)
|
@RequiredPermission(value = FilePermission.DOWNLOAD)
|
||||||
@RequestMapping(value = "preview", method = RequestMethod.GET)
|
@RequestMapping(value = "preview", method = RequestMethod.GET)
|
||||||
public ResponseEntity<InputStreamResource> preview(@RequestParam String id, HttpServletResponse response) {
|
public ResponseEntity<InputStreamResource> preview(@RequestParam String id, HttpServletResponse response) {
|
||||||
return edFileInfoService.preview(id, response, DataOwnEnum.SYS_FILE.code);
|
return edFileInfoService.preview(id, response, DataOwnEnum.REPO_FILE.code);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -86,13 +86,13 @@ public class UserEdFileInfoController {
|
||||||
@UserOperation(value = "批量上传数据库", modelName = UserOperationModuleEnum.USER_PRJ)
|
@UserOperation(value = "批量上传数据库", modelName = UserOperationModuleEnum.USER_PRJ)
|
||||||
@RequestMapping(value = "/batchImport", method = RequestMethod.POST)
|
@RequestMapping(value = "/batchImport", method = RequestMethod.POST)
|
||||||
public ElectromagneticResult<?> batchImport(FileChunkDTO fileChunkDTO) {
|
public ElectromagneticResult<?> batchImport(FileChunkDTO fileChunkDTO) {
|
||||||
return edFileInfoService.batchImport(fileChunkDTO);
|
return edFileInfoService.batchImport(fileChunkDTO, DataOwnEnum.USER_FILE.code);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UserOperation(value = "批量上传数据库")
|
@UserOperation(value = "批量上传数据库")
|
||||||
@RequestMapping(value = "/batchImport", method = RequestMethod.GET)
|
@RequestMapping(value = "/batchImport", method = RequestMethod.GET)
|
||||||
public ElectromagneticResult<?> checkChunkExist(FileChunkDTO fileChunkDTO) {
|
public ElectromagneticResult<?> checkChunkExist(FileChunkDTO fileChunkDTO) {
|
||||||
return edFileInfoService.checkChunkExist(fileChunkDTO);
|
return edFileInfoService.checkChunkExist(fileChunkDTO, DataOwnEnum.USER_FILE.code);
|
||||||
}
|
}
|
||||||
|
|
||||||
@UserOperation(value = "更新文件信息", modelName = UserOperationModuleEnum.USER_PRJ)
|
@UserOperation(value = "更新文件信息", modelName = UserOperationModuleEnum.USER_PRJ)
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ public interface EdFileInfoService {
|
||||||
* @param fileChunkDTO
|
* @param fileChunkDTO
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ElectromagneticResult<?> checkChunkExist(FileChunkDTO fileChunkDTO);
|
ElectromagneticResult<?> checkChunkExist(FileChunkDTO fileChunkDTO, int dataOwnCode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量导入
|
* 批量导入
|
||||||
|
|
@ -87,7 +87,7 @@ public interface EdFileInfoService {
|
||||||
* @param fileChunkDTO
|
* @param fileChunkDTO
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ElectromagneticResult<?> batchImport(FileChunkDTO fileChunkDTO);
|
ElectromagneticResult<?> batchImport(FileChunkDTO fileChunkDTO, int dataOwnCode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 合并分片
|
* 合并分片
|
||||||
|
|
|
||||||
|
|
@ -60,10 +60,12 @@ public class CommonService {
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
PATH_MAP.put(DataOwnEnum.SYS_FILE.code, elePropertyConfig.getPrjDir());
|
PATH_MAP.put(DataOwnEnum.SYS_FILE.code, elePropertyConfig.getSysPrjPath());
|
||||||
PATH_MAP.put(DataOwnEnum.SYS_PRJ.code, elePropertyConfig.getPrjDir());
|
PATH_MAP.put(DataOwnEnum.SYS_PRJ.code, elePropertyConfig.getSysPrjPath());
|
||||||
PATH_MAP.put(DataOwnEnum.USER_PRJ.code, elePropertyConfig.getUserDataPath());
|
PATH_MAP.put(DataOwnEnum.USER_PRJ.code, elePropertyConfig.getUserPrjPath());
|
||||||
PATH_MAP.put(DataOwnEnum.USER_FILE.code, elePropertyConfig.getUserDataPath());
|
PATH_MAP.put(DataOwnEnum.USER_FILE.code, elePropertyConfig.getUserPrjPath());
|
||||||
|
PATH_MAP.put(DataOwnEnum.REPO_FILE.code, elePropertyConfig.getRepoPrjPath());
|
||||||
|
PATH_MAP.put(DataOwnEnum.REPO_PRJ.code, elePropertyConfig.getRepoPrjPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String createTree(List<EdFileInfo> edFileInfos, Object object) {
|
private static String createTree(List<EdFileInfo> edFileInfos, Object object) {
|
||||||
|
|
|
||||||
|
|
@ -376,9 +376,9 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ElectromagneticResult<?> checkChunkExist(FileChunkDTO fileChunkDTO) {
|
public ElectromagneticResult<?> checkChunkExist(FileChunkDTO fileChunkDTO, int dataOwnCode) {
|
||||||
String currentUserId = UserThreadLocal.getUserId();
|
String currentUserId = UserThreadLocal.getUserId();
|
||||||
String userUploadFolder = elePropertyConfig.getUploadDataDir() + File.separator + currentUserId;
|
String userUploadFolder = elePropertyConfig.getUploadDataDir(dataOwnCode) + File.separator + currentUserId;
|
||||||
String identifier = fileChunkDTO.getIdentifier();
|
String identifier = fileChunkDTO.getIdentifier();
|
||||||
List<Integer> uploadedChunks = getUploadedChunks(identifier, userUploadFolder);
|
List<Integer> uploadedChunks = getUploadedChunks(identifier, userUploadFolder);
|
||||||
return ElectromagneticResultUtil.success(new FileChunkResultDTO(false, new HashSet<>(uploadedChunks)));
|
return ElectromagneticResultUtil.success(new FileChunkResultDTO(false, new HashSet<>(uploadedChunks)));
|
||||||
|
|
@ -404,11 +404,11 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ElectromagneticResult<?> batchImport(FileChunkDTO fileChunkDTO) {
|
public ElectromagneticResult<?> batchImport(FileChunkDTO fileChunkDTO, int dataOwnCode) {
|
||||||
String currentUserId = UserThreadLocal.getUserId();
|
String currentUserId = UserThreadLocal.getUserId();
|
||||||
String identifier = fileChunkDTO.getIdentifier();
|
String identifier = fileChunkDTO.getIdentifier();
|
||||||
// 首先检查该分片有没被上传,如果有则禁止上传
|
// 首先检查该分片有没被上传,如果有则禁止上传
|
||||||
String destPath = elePropertyConfig.getUploadDataDir() + File.separator + currentUserId + File.separator + identifier + File.separator + fileChunkDTO.getChunkNumber() + UPLOAD_FILE_CHUNK_SUFFIX;
|
String destPath = elePropertyConfig.getUploadDataDir(dataOwnCode) + File.separator + currentUserId + File.separator + identifier + File.separator + fileChunkDTO.getChunkNumber() + UPLOAD_FILE_CHUNK_SUFFIX;
|
||||||
boolean exist = FileUtil.exist(destPath);
|
boolean exist = FileUtil.exist(destPath);
|
||||||
if (exist) {
|
if (exist) {
|
||||||
return ElectromagneticResultUtil.fail("-1", "文件已经存在,请勿重复上传");
|
return ElectromagneticResultUtil.fail("-1", "文件已经存在,请勿重复上传");
|
||||||
|
|
@ -438,7 +438,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public ElectromagneticResult<?> mergeChunks(String identifier, String fileName, Integer totalChunks, int dataOwnCode) {
|
public ElectromagneticResult<?> mergeChunks(String identifier, String fileName, Integer totalChunks, int dataOwnCode) {
|
||||||
String currentUserId = UserThreadLocal.getUserId();
|
String currentUserId = UserThreadLocal.getUserId();
|
||||||
String destColibPath = doSysFileMerge(identifier, fileName, totalChunks);
|
String destColibPath = doSysFileMerge(identifier, fileName, totalChunks, dataOwnCode);
|
||||||
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";
|
||||||
|
|
@ -454,7 +454,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
throw new BizException(info);
|
throw new BizException(info);
|
||||||
}
|
}
|
||||||
String uuid = IdUtil.fastSimpleUUID();
|
String uuid = IdUtil.fastSimpleUUID();
|
||||||
String tmpDir = elePropertyConfig.getUploadDataDir() + currentUserId + File.separator + uuid + File.separator;
|
String tmpDir = elePropertyConfig.getUploadDataDir(dataOwnCode) + currentUserId + File.separator + uuid + File.separator;
|
||||||
ZipUtil.unzip(zipDirPath, tmpDir);
|
ZipUtil.unzip(zipDirPath, tmpDir);
|
||||||
update2Database(tmpDir, dataOwnCode);
|
update2Database(tmpDir, dataOwnCode);
|
||||||
fileSystemService.deleteFile(zipDirPath, destColibPath);
|
fileSystemService.deleteFile(zipDirPath, destColibPath);
|
||||||
|
|
@ -658,7 +658,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<InputStreamResource> batchExport(String dataIdArr, HttpServletResponse response, int dataOwnCode) throws IOException {
|
public ResponseEntity<InputStreamResource> batchExport(String dataIdArr, HttpServletResponse response, int dataOwnCode) throws IOException {
|
||||||
String userDownloadDataDir = elePropertyConfig.getDownloadDataDir() + File.separator + UserThreadLocal.getUserId();
|
String userDownloadDataDir = elePropertyConfig.getDownloadDataDir(dataOwnCode) + File.separator + UserThreadLocal.getUserId();
|
||||||
String[] ids = dataIdArr.split(",");
|
String[] ids = dataIdArr.split(",");
|
||||||
if (dataOwnCode == DataOwnEnum.SYS_FILE.code) {
|
if (dataOwnCode == DataOwnEnum.SYS_FILE.code) {
|
||||||
Map<String, Boolean> map = permissionService.filterExportIds(ids);
|
Map<String, Boolean> map = permissionService.filterExportIds(ids);
|
||||||
|
|
@ -676,7 +676,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
List<EdFileInfo> prjFolders = this.baseMapper.selectList(Wrappers.lambdaQuery(EdFileInfo.class)
|
List<EdFileInfo> prjFolders = this.baseMapper.selectList(Wrappers.lambdaQuery(EdFileInfo.class)
|
||||||
.likeRight(EdFileInfo::getFilePath, prjId + MYSQL_FILE_PATH_SPLIT)
|
.likeRight(EdFileInfo::getFilePath, prjId + MYSQL_FILE_PATH_SPLIT)
|
||||||
.eq(EdFileInfo::getDataType, EleDataTypeEnum.FOLDER.code)
|
.eq(EdFileInfo::getDataType, EleDataTypeEnum.FOLDER.code)
|
||||||
.eq(EdFileInfo::getDataOwn, dataOwnCode == DataOwnEnum.SYS_FILE.code ? DataOwnEnum.SYS_PRJ.code : DataOwnEnum.USER_PRJ.code)
|
.eq(EdFileInfo::getDataOwn, DataOwnEnum.getPrjCodeByFileCode(dataOwnCode))
|
||||||
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code));
|
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code));
|
||||||
EdFileInfo prjFileInfo = this.baseMapper.selectById(prjId);
|
EdFileInfo prjFileInfo = this.baseMapper.selectById(prjId);
|
||||||
Map<String, EdFileInfo> prjFoldersMap = prjFolders.stream().collect(Collectors.toMap(EdFileInfo::getId, e -> e));
|
Map<String, EdFileInfo> prjFoldersMap = prjFolders.stream().collect(Collectors.toMap(EdFileInfo::getId, e -> e));
|
||||||
|
|
@ -693,7 +693,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
fileSystemService.createDirectory(destFolderPath);
|
fileSystemService.createDirectory(destFolderPath);
|
||||||
}
|
}
|
||||||
for (EdFileInfo edFileInfo : files) {
|
for (EdFileInfo edFileInfo : files) {
|
||||||
String filePath = commonService.getFileSysPath(edFileInfo.getFilePath(), dataOwnCode == DataOwnEnum.SYS_FILE.code ? DataOwnEnum.SYS_PRJ.code : DataOwnEnum.USER_PRJ.code); // file
|
String filePath = commonService.getFileSysPath(edFileInfo.getFilePath(), DataOwnEnum.getPrjCodeByFileCode(dataOwnCode)); // file
|
||||||
String destPath = userDownloadDataDir + File.separator + prjName + File.separator + commonService.getDbPath(edFileInfo.getFilePath());
|
String destPath = userDownloadDataDir + File.separator + prjName + File.separator + commonService.getDbPath(edFileInfo.getFilePath());
|
||||||
fileSystemService.copyFile(filePath, destPath);
|
fileSystemService.copyFile(filePath, destPath);
|
||||||
}
|
}
|
||||||
|
|
@ -1215,10 +1215,10 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String doSysFileMerge(String identifier, String fileName, Integer totalChunks) {
|
private String doSysFileMerge(String identifier, String fileName, Integer totalChunks, int dataOwnCode) {
|
||||||
String currentUserId = UserThreadLocal.getUserId();
|
String currentUserId = UserThreadLocal.getUserId();
|
||||||
for (int i = 1; i <= totalChunks; i++) {
|
for (int i = 1; i <= totalChunks; i++) {
|
||||||
String tmpPath = elePropertyConfig.getUploadDataDir() + File.separator + currentUserId + File.separator + identifier + File.separator + i + UPLOAD_FILE_CHUNK_SUFFIX;
|
String tmpPath = elePropertyConfig.getUploadDataDir(dataOwnCode) + File.separator + currentUserId + File.separator + identifier + File.separator + i + UPLOAD_FILE_CHUNK_SUFFIX;
|
||||||
if (!FileUtil.exist(new File(tmpPath))) {
|
if (!FileUtil.exist(new File(tmpPath))) {
|
||||||
String info = StrFormatter.format("第{}个分片没有上传完成,请上传完成后再合并。", i);
|
String info = StrFormatter.format("第{}个分片没有上传完成,请上传完成后再合并。", i);
|
||||||
log.error(info);
|
log.error(info);
|
||||||
|
|
@ -1226,8 +1226,8 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 合并分片
|
// 合并分片
|
||||||
String destColibPath = elePropertyConfig.getUploadDataDir() + File.separator + currentUserId + File.separator + fileName;
|
String destColibPath = elePropertyConfig.getUploadDataDir(dataOwnCode) + File.separator + currentUserId + File.separator + fileName;
|
||||||
String path = elePropertyConfig.getUploadDataDir() + File.separator + currentUserId + File.separator + identifier;
|
String path = elePropertyConfig.getUploadDataDir(dataOwnCode) + File.separator + currentUserId + File.separator + identifier;
|
||||||
BufferedOutputStream outputStream = FileUtil.getOutputStream(destColibPath);
|
BufferedOutputStream outputStream = FileUtil.getOutputStream(destColibPath);
|
||||||
for (int i = 1; i <= totalChunks; i++) {
|
for (int i = 1; i <= totalChunks; i++) {
|
||||||
try (BufferedInputStream inputStream = FileUtil.getInputStream(path + File.separator + i + UPLOAD_FILE_CHUNK_SUFFIX)) {
|
try (BufferedInputStream inputStream = FileUtil.getInputStream(path + File.separator + i + UPLOAD_FILE_CHUNK_SUFFIX)) {
|
||||||
|
|
@ -1294,12 +1294,12 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
EdFileInfo fileInfo = this.baseMapper.selectById(id);
|
EdFileInfo fileInfo = this.baseMapper.selectById(id);
|
||||||
Assert.isTrue(Objects.nonNull(fileInfo), "文件不存在");
|
Assert.isTrue(Objects.nonNull(fileInfo), "文件不存在");
|
||||||
String fileSysPath = commonService.getFileSysPath(fileInfo.getFilePath(), dataOwnCode);
|
String fileSysPath = commonService.getFileSysPath(fileInfo.getFilePath(), dataOwnCode);
|
||||||
String fileSaveTmpPath = elePropertyConfig.getTmpDir() + File.separator + IdUtil.fastSimpleUUID() + "." + fileInfo.getFileType();
|
String fileSaveTmpPath = elePropertyConfig.getEleTmpPath() + File.separator + IdUtil.fastSimpleUUID() + "." + fileInfo.getFileType();
|
||||||
FileUtil.copy(fileSysPath, fileSaveTmpPath, true);
|
FileUtil.copy(fileSysPath, fileSaveTmpPath, true);
|
||||||
EleCommonUtil.decryptFile(fileSaveTmpPath, SecureUtil.aes(FILE_SEC_PASSWD.getBytes()));
|
EleCommonUtil.decryptFile(fileSaveTmpPath, SecureUtil.aes(FILE_SEC_PASSWD.getBytes()));
|
||||||
|
|
||||||
if (Arrays.asList("doc", "docx").contains(fileInfo.getFileType())) {
|
if (Arrays.asList("doc", "docx").contains(fileInfo.getFileType())) {
|
||||||
String pdfTmpPath = elePropertyConfig.getTmpDir() + File.separator + fileInfo.getFileName() + "_" + IdUtil.fastSimpleUUID() + ".pdf";
|
String pdfTmpPath = elePropertyConfig.getEleTmpPath() + File.separator + fileInfo.getFileName() + "_" + IdUtil.fastSimpleUUID() + ".pdf";
|
||||||
OfficeFileUtil.doc2pdf(fileSaveTmpPath, pdfTmpPath);
|
OfficeFileUtil.doc2pdf(fileSaveTmpPath, pdfTmpPath);
|
||||||
fileSaveTmpPath = pdfTmpPath;
|
fileSaveTmpPath = pdfTmpPath;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -262,8 +262,6 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public ElectromagneticResult<?> folderResort(List<FolderResortDTO> folderResortDTOList) {
|
public ElectromagneticResult<?> folderResort(List<FolderResortDTO> folderResortDTOList) {
|
||||||
Date now = new Date();
|
|
||||||
String currentUserId = UserThreadLocal.getUserId();
|
|
||||||
try {
|
try {
|
||||||
for (FolderResortDTO folderResortDTO : folderResortDTOList) {
|
for (FolderResortDTO folderResortDTO : folderResortDTOList) {
|
||||||
LambdaUpdateWrapper<EdFileInfo> updateWrapper = Wrappers.lambdaUpdate(EdFileInfo.class)
|
LambdaUpdateWrapper<EdFileInfo> updateWrapper = Wrappers.lambdaUpdate(EdFileInfo.class)
|
||||||
|
|
@ -387,7 +385,6 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
|
||||||
String newFolderId = String.valueOf(maxFolderId + 1);
|
String newFolderId = String.valueOf(maxFolderId + 1);
|
||||||
String nowTimeStr = EleCommonUtil.getNowTimeStr();
|
String nowTimeStr = EleCommonUtil.getNowTimeStr();
|
||||||
String fileCode = commonService.createFileCode(targetParentFile.getId(), EleDataTypeEnum.FOLDER.desc, FILE_START_VERSION, nowTimeStr);
|
String fileCode = commonService.createFileCode(targetParentFile.getId(), EleDataTypeEnum.FOLDER.desc, FILE_START_VERSION, nowTimeStr);
|
||||||
Date now = new Date();
|
|
||||||
targetFile.setId(newFolderId)
|
targetFile.setId(newFolderId)
|
||||||
.setFileId(newFolderId)
|
.setFileId(newFolderId)
|
||||||
.setFileName(sourceFile.getFileName())
|
.setFileName(sourceFile.getFileName())
|
||||||
|
|
|
||||||
|
|
@ -193,7 +193,7 @@ public class FileRecycleServiceImpl implements FileRecycleService {
|
||||||
|
|
||||||
// 移动到tmp目录,七天后删除
|
// 移动到tmp目录,七天后删除
|
||||||
for (String fileSysPath : fileSysPaths) {
|
for (String fileSysPath : fileSysPaths) {
|
||||||
fileSystemService.moveFile(fileSysPath, elePropertyConfig.getTmpDir() + File.separator + new File(fileSysPath).getName());
|
fileSystemService.moveFile(fileSysPath, elePropertyConfig.getEleTmpPath() + File.separator + new File(fileSysPath).getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新MySQL数据库
|
// 更新MySQL数据库
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@ public class BackupTask {
|
||||||
public void deleteTmpFile() {
|
public void deleteTmpFile() {
|
||||||
DateTime backDaysTime = DateUtil.offsetDay(new Date(), -elePropertyConfig.getTmpFileStoreDays());
|
DateTime backDaysTime = DateUtil.offsetDay(new Date(), -elePropertyConfig.getTmpFileStoreDays());
|
||||||
FileFilter filter = file -> file.lastModified() < backDaysTime.getTime();
|
FileFilter filter = file -> file.lastModified() < backDaysTime.getTime();
|
||||||
List<File> files = FileUtil.loopFiles(elePropertyConfig.getTmpDir(), filter);
|
List<File> files = FileUtil.loopFiles(elePropertyConfig.getEleTmpPath(), filter);
|
||||||
for (File file : files) {
|
for (File file : files) {
|
||||||
fileSystemService.deleteFile(file.getAbsolutePath());
|
fileSystemService.deleteFile(file.getAbsolutePath());
|
||||||
UserAccessLog userAccessLog = new UserAccessLog()
|
UserAccessLog userAccessLog = new UserAccessLog()
|
||||||
|
|
|
||||||
|
|
@ -13,24 +13,22 @@ spring.servlet.multipart.max-request-size=500MB
|
||||||
pagehelper.helperDialect=mysql
|
pagehelper.helperDialect=mysql
|
||||||
pagehelper.reasonable=false
|
pagehelper.reasonable=false
|
||||||
server.port=12396
|
server.port=12396
|
||||||
#windows文件存储目录,用于测试
|
|
||||||
data.windows.path=D:/tmp/szsd/data/eleData/dev/project/
|
winPrefix: D:/tmp
|
||||||
data.upload.windows.tmp.path=D:/tmp/szsd/data/eleData/dev/upload/
|
data.ele.tmp.path=/szsd/data/eleData/dev/tmp
|
||||||
data.download.windows.tmp.path=D:/tmp/szsd/data/eleData/dev/download/
|
# sys path
|
||||||
data.windows.tmp.path=D:/tmp/szsd/data/eleData/dev/tmp
|
data.sys.prj.path=/szsd/data/eleData/dev/sys_project/
|
||||||
data.windows.user.path=D:/tmp/szsd/data/eleData/dev/user_project/
|
data.sys.upload.path=/szsd/data/eleData/dev/sys_upload/
|
||||||
data.upload.windows.user.tmp.path=D:/tmp/szsd/data/eleData/dev/user_upload/
|
data.sys.download.path=/szsd/data/eleData/dev/sys_download/
|
||||||
data.download.windows.user.tmp.path=D:/tmp/szsd/data/eleData/dev/usr_download/
|
|
||||||
data.windows.usere.tmp.path=D:/tmp/szsd/data/eleData/dev/user_tmp
|
|
||||||
data.linux.path=/szsd/data/eleData/dev/project/
|
|
||||||
data.upload.linux.tmp.path=/szsd/data/eleData/dev/upload/
|
|
||||||
data.download.linux.tmp.path=/szsd/data/eleData/dev/download/
|
|
||||||
data.linux.tmp.path=/szsd/data/eleData/dev/tmp
|
|
||||||
# user path
|
# user path
|
||||||
data.linux.user.path=/szsd/data/eleData/dev/user_project/
|
data.user.prj.path=/szsd/data/eleData/dev/user_project/
|
||||||
data.upload.linux.user.tmp.path=/szsd/data/eleData/dev/user_upload/
|
data.user.upload.path=/szsd/data/eleData/dev/user_upload/
|
||||||
data.download.linux.user.tmp.path=/szsd/data/eleData/dev/usr_download/
|
data.user.download.path=/szsd/data/eleData/dev/user_download/
|
||||||
data.linux.user.tmp.path=/szsd/data/eleData/dev/user_tmp
|
# repo path
|
||||||
|
data.repo.prj.path=/szsd/data/eleData/dev/repo_project/
|
||||||
|
data.repo.upload.path=/szsd/data/eleData/dev/repo_upload/
|
||||||
|
data.repo.download.path=/szsd/data/eleData/dev/repo_download/
|
||||||
|
|
||||||
prj.folder.max.length=6
|
prj.folder.max.length=6
|
||||||
spring.jackson.time-zone=GMT+8
|
spring.jackson.time-zone=GMT+8
|
||||||
tmp.file.store.days=7
|
tmp.file.store.days=7
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,9 @@ package com.electromagnetic.industry.software.common.enums;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum DataOwnEnum {
|
public enum DataOwnEnum {
|
||||||
|
|
||||||
|
|
@ -24,4 +27,27 @@ public enum DataOwnEnum {
|
||||||
return code == SYS_FILE.code || code == USER_FILE.code || code == REPO_FILE.code;
|
return code == SYS_FILE.code || code == USER_FILE.code || code == REPO_FILE.code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final Map<Integer, Integer> FILE_PRJ_MAP = new HashMap<>();
|
||||||
|
|
||||||
|
static {
|
||||||
|
FILE_PRJ_MAP.put(DataOwnEnum.SYS_FILE.code, DataOwnEnum.SYS_PRJ.code);
|
||||||
|
FILE_PRJ_MAP.put(DataOwnEnum.USER_FILE.code, DataOwnEnum.USER_PRJ.code);
|
||||||
|
FILE_PRJ_MAP.put(DataOwnEnum.REPO_FILE.code, DataOwnEnum.REPO_PRJ.code);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getPrjCodeByFileCode(int fileCode) {
|
||||||
|
return FILE_PRJ_MAP.get(fileCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isSysCode(int code) {
|
||||||
|
return code == SYS_FILE.code || code == SYS_PRJ.code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isUserCode(int code) {
|
||||||
|
return code == USER_FILE.code || code == USER_PRJ.code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isRepoCode(int code) {
|
||||||
|
return code == REPO_FILE.code || code == REPO_PRJ.code;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue