Merge branch 'main' of http://192.168.65.198:3000/toolchaintechnologycenter/spdm-backend
This commit is contained in:
@@ -84,7 +84,7 @@ public class SystemFileIDataFileServiceImpl implements IDataFileService {
|
||||
if (req.getType() == 0) {
|
||||
// 相对路径
|
||||
// 检查父文件夹权限
|
||||
String path = Tools.getRootPath(rootPath, ThreadLocalContext.getCompany());
|
||||
String path = Tools.getRootPath(rootPath, String.valueOf(ThreadLocalContext.getTenantId()));
|
||||
if (parentPath != null && parentPath.length() > 0)
|
||||
path = path + File.separator + parentPath;
|
||||
|
||||
@@ -92,7 +92,7 @@ public class SystemFileIDataFileServiceImpl implements IDataFileService {
|
||||
if (!parentDir.exists() || !parentDir.isDirectory()) {
|
||||
return SdmResponse.failed("文件夹不存在");
|
||||
} else {
|
||||
byte perm = getFileUserVisitPermission(parentPath, "", null, ThreadLocalContext.getCompany());
|
||||
byte perm = getFileUserVisitPermission(parentPath, "", null, String.valueOf(ThreadLocalContext.getTenantId()));
|
||||
if ((perm & PermConstants.WRITE_PERM) == 0) {
|
||||
return SdmResponse.failed(ResultCode.NO_PERMISSION);
|
||||
}
|
||||
@@ -354,11 +354,11 @@ public class SystemFileIDataFileServiceImpl implements IDataFileService {
|
||||
}
|
||||
if (req.getType() == 0) {
|
||||
// 0相对路径
|
||||
byte permission = getFileUserVisitPermission(parentPath, dirName, null, ThreadLocalContext.getCompany());
|
||||
byte permission = getFileUserVisitPermission(parentPath, dirName, null, String.valueOf(ThreadLocalContext.getTenantId()));
|
||||
if ((permission & PermConstants.DEL_PERM) == 0) {
|
||||
return SdmResponse.failed(ResultCode.NO_PERMISSION);
|
||||
}
|
||||
String companyRootPath = Tools.getRootPath(rootPath, ThreadLocalContext.getCompany());
|
||||
String companyRootPath = Tools.getRootPath(rootPath, String.valueOf(ThreadLocalContext.getTenantId()));
|
||||
String path = companyRootPath;
|
||||
if (parentPath != null && parentPath.length() > 0)
|
||||
path = path + File.separator + parentPath;
|
||||
@@ -515,12 +515,12 @@ public class SystemFileIDataFileServiceImpl implements IDataFileService {
|
||||
}
|
||||
if (req.getType() == 0) {
|
||||
ComprehensivePermission comprehensivePermission = getFileUserVisitComprehensivePermission(parentPath, dirName,
|
||||
ThreadLocalContext.getJobNumber(), ThreadLocalContext.getCompany(), (byte) 0, false, null);
|
||||
ThreadLocalContext.getJobNumber(), String.valueOf(ThreadLocalContext.getTenantId()), (byte) 0, false, null);
|
||||
byte permission = getFilePermission(comprehensivePermission);
|
||||
if ((permission & PermConstants.DEL_PERM) == 0) {
|
||||
return SdmResponse.failed(ResultCode.NO_PERMISSION);
|
||||
}
|
||||
String companyRootPath = Tools.getRootPath(rootPath, ThreadLocalContext.getCompany());
|
||||
String companyRootPath = Tools.getRootPath(rootPath, String.valueOf(ThreadLocalContext.getTenantId()));
|
||||
String filePath = companyRootPath + File.separator + parentPath + File.separator + dirName;
|
||||
File file = new File(filePath);
|
||||
if (!file.exists()) {
|
||||
@@ -618,9 +618,9 @@ public class SystemFileIDataFileServiceImpl implements IDataFileService {
|
||||
}
|
||||
String searchDir = req.getSearchDir();
|
||||
if (searchDir.length() > 0 && !searchDir.startsWith("/") && !searchDir.startsWith("\\")) {
|
||||
searchDir = "'" + Tools.getRootPath(rootPath, ThreadLocalContext.getCompany()) + File.separator + searchDir + "'";
|
||||
searchDir = "'" + Tools.getRootPath(rootPath, String.valueOf(ThreadLocalContext.getTenantId())) + File.separator + searchDir + "'";
|
||||
} else {
|
||||
searchDir = "'" + Tools.getRootPath(rootPath, ThreadLocalContext.getCompany()) + searchDir + "'";
|
||||
searchDir = "'" + Tools.getRootPath(rootPath, String.valueOf(ThreadLocalContext.getTenantId())) + searchDir + "'";
|
||||
}
|
||||
String findCmd = "find -L " + searchDir + " " + findType + " " + matchCondi + " -exec ls -ld {} \\;";
|
||||
log.info(findCmd);
|
||||
@@ -658,7 +658,7 @@ public class SystemFileIDataFileServiceImpl implements IDataFileService {
|
||||
* @return
|
||||
*/
|
||||
public FileBaseInfo getFileBaseInfo(String filePath) {
|
||||
String absPath = Tools.getRootPath(rootPath, ThreadLocalContext.getCompany()) + File.separator + filePath;
|
||||
String absPath = Tools.getRootPath(rootPath, String.valueOf(ThreadLocalContext.getTenantId())) + File.separator + filePath;
|
||||
File file = new File(absPath);
|
||||
if (!file.exists())
|
||||
return null;
|
||||
@@ -746,7 +746,7 @@ public class SystemFileIDataFileServiceImpl implements IDataFileService {
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, "非法文件路径!");
|
||||
}
|
||||
Map<String, DataNode> map = new HashMap<>();
|
||||
byte permission = getFileUserVisitPermission(strParentPath, strFileName, map, ThreadLocalContext.getCompany());
|
||||
byte permission = getFileUserVisitPermission(strParentPath, strFileName, map, String.valueOf(ThreadLocalContext.getTenantId()));
|
||||
if ((permission & PermConstants.READ_PERM) == 0) {
|
||||
return SdmResponse.failed(ResultCode.NO_PERMISSION);
|
||||
} else {
|
||||
@@ -766,7 +766,7 @@ public class SystemFileIDataFileServiceImpl implements IDataFileService {
|
||||
String fileName = fileBaseInfo.getFileName();
|
||||
ComprehensivePermission comprehensivePermission =
|
||||
getFileUserVisitComprehensivePermission(parentPath, fileName, loginJobNumber,
|
||||
ThreadLocalContext.getCompany(), (byte) 0, false, map);
|
||||
String.valueOf(ThreadLocalContext.getTenantId()), (byte) 0, false, map);
|
||||
fileBaseInfo.setStatus(comprehensivePermission.getFileStatus());
|
||||
fileBaseInfo.setDataType(comprehensivePermission.getFileType());
|
||||
perm = getFilePermission(comprehensivePermission);
|
||||
@@ -784,7 +784,7 @@ public class SystemFileIDataFileServiceImpl implements IDataFileService {
|
||||
* @return
|
||||
*/
|
||||
public List<FileBaseInfo> getDirectoryContents(String parentPath, String fileName, int isFilter) {
|
||||
String companyRootPath = Tools.getRootPath(rootPath, ThreadLocalContext.getCompany());
|
||||
String companyRootPath = Tools.getRootPath(rootPath, String.valueOf(ThreadLocalContext.getTenantId()));
|
||||
String path = companyRootPath;
|
||||
if (parentPath != null && parentPath.length() > 0)
|
||||
path = path + File.separator + parentPath;
|
||||
@@ -847,7 +847,7 @@ public class SystemFileIDataFileServiceImpl implements IDataFileService {
|
||||
public SdmResponse queryFilePermValue(QueryFilePermValueReq req) {
|
||||
String strParentPath = req.getParentPath();
|
||||
String strFileName = req.getFileName();
|
||||
byte perm = getFileUserVisitPermission(strParentPath, strFileName, null, ThreadLocalContext.getCompany());
|
||||
byte perm = getFileUserVisitPermission(strParentPath, strFileName, null, String.valueOf(ThreadLocalContext.getTenantId()));
|
||||
return SdmResponse.success(perm);
|
||||
}
|
||||
|
||||
@@ -867,7 +867,7 @@ public class SystemFileIDataFileServiceImpl implements IDataFileService {
|
||||
* @return
|
||||
*/
|
||||
public List<PermissionInfo> getFileRecordUserPermission(String parentPath, String fileName) {
|
||||
String absParentPath = Tools.getRootPath(rootPath, ThreadLocalContext.getCompany());
|
||||
String absParentPath = Tools.getRootPath(rootPath, String.valueOf(ThreadLocalContext.getTenantId()));
|
||||
;
|
||||
if (parentPath != null && parentPath.length() != 0)
|
||||
absParentPath = absParentPath + File.separator + parentPath;
|
||||
@@ -972,11 +972,11 @@ public class SystemFileIDataFileServiceImpl implements IDataFileService {
|
||||
if (req.getType() == 0) {
|
||||
String newName = req.getNewName();
|
||||
|
||||
byte permission = getFileUserVisitPermission(parentPath, oldName, null, ThreadLocalContext.getCompany());
|
||||
byte permission = getFileUserVisitPermission(parentPath, oldName, null, String.valueOf(ThreadLocalContext.getTenantId()));
|
||||
if ((permission & PermConstants.WRITE_PERM) == 0) {
|
||||
return SdmResponse.failed(ResultCode.NO_PERMISSION);
|
||||
}
|
||||
String companyRootPath = Tools.getRootPath(rootPath, ThreadLocalContext.getCompany());
|
||||
String companyRootPath = Tools.getRootPath(rootPath, String.valueOf(ThreadLocalContext.getTenantId()));
|
||||
String oldPath = companyRootPath + File.separator + parentPath + File.separator + oldName;
|
||||
String newPath = companyRootPath + File.separator + parentPath + File.separator + newName;
|
||||
File oldFile = new File(oldPath);
|
||||
@@ -1026,7 +1026,7 @@ public class SystemFileIDataFileServiceImpl implements IDataFileService {
|
||||
String userId = req.getJobNumber();
|
||||
String userName = req.getUserName();
|
||||
String effectiveTime = req.getEffectiveTime();
|
||||
String companyRootPath = Tools.getRootPath(rootPath, ThreadLocalContext.getCompany());
|
||||
String companyRootPath = Tools.getRootPath(rootPath, String.valueOf(ThreadLocalContext.getTenantId()));
|
||||
String absParentPath = companyRootPath;
|
||||
if (parentPath != null && parentPath.length() != 0)
|
||||
absParentPath = absParentPath + File.separator + parentPath;
|
||||
@@ -1185,7 +1185,7 @@ public class SystemFileIDataFileServiceImpl implements IDataFileService {
|
||||
if (StringUtils.isNotBlank(targetPath) && targetPath.contains("..")) {
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, "非法文件路径!");
|
||||
}
|
||||
String companyRootPath = Tools.getRootPath(rootPath, ThreadLocalContext.getCompany());
|
||||
String companyRootPath = Tools.getRootPath(rootPath, String.valueOf(ThreadLocalContext.getTenantId()));
|
||||
if (req.getType() == 0) {
|
||||
sourceFilePath = companyRootPath + "/" + sourceFilePath;
|
||||
targetPath = companyRootPath + "/" + targetPath;
|
||||
@@ -1222,7 +1222,7 @@ public class SystemFileIDataFileServiceImpl implements IDataFileService {
|
||||
}
|
||||
oldPath = filePath;
|
||||
} else {
|
||||
oldPath = Tools.getRootPath(rootPath, ThreadLocalContext.getCompany()) + File.separator + filePath;
|
||||
oldPath = Tools.getRootPath(rootPath, String.valueOf(ThreadLocalContext.getTenantId())) + File.separator + filePath;
|
||||
}
|
||||
File oldFile = new File(oldPath);
|
||||
String newPath = oldFile.getParent() + File.separator + newName;
|
||||
@@ -1285,7 +1285,7 @@ public class SystemFileIDataFileServiceImpl implements IDataFileService {
|
||||
}
|
||||
File file;
|
||||
if (req.getType() == 0) {
|
||||
String path = Tools.getRootPath(rootPath, ThreadLocalContext.getCompany()) + File.separator + req.getPath();
|
||||
String path = Tools.getRootPath(rootPath, String.valueOf(ThreadLocalContext.getTenantId())) + File.separator + req.getPath();
|
||||
file = new File(path);
|
||||
if (!file.exists()) {
|
||||
log.error("文件不存在" + path);
|
||||
@@ -1384,9 +1384,9 @@ public class SystemFileIDataFileServiceImpl implements IDataFileService {
|
||||
return SdmResponse.failed(ResultCode.NO_PERMISSION, "没有上传权限");
|
||||
}
|
||||
} else {
|
||||
savePath = Tools.getRootPath(rootPath, ThreadLocalContext.getCompany()) + File.separator + req.getPath();
|
||||
savePath = Tools.getRootPath(rootPath, String.valueOf(ThreadLocalContext.getTenantId())) + File.separator + req.getPath();
|
||||
}
|
||||
byte perm = getFileUserVisitPermission(savePath, "", null, ThreadLocalContext.getCompany());
|
||||
byte perm = getFileUserVisitPermission(savePath, "", null, String.valueOf(ThreadLocalContext.getTenantId()));
|
||||
if ((perm & PermConstants.UPLOAD_PERM) == 0) {
|
||||
return SdmResponse.failed(ResultCode.NO_PERMISSION, "没有操作权限");
|
||||
}
|
||||
@@ -1479,7 +1479,7 @@ public class SystemFileIDataFileServiceImpl implements IDataFileService {
|
||||
if (StringUtils.isNotBlank(targetPath) && targetPath.contains("..")) {
|
||||
return SdmResponse.failed(ResultCode.VALIDATE_FAILED, "非法文件路径!");
|
||||
}
|
||||
String companyRootPath = Tools.getRootPath(rootPath, ThreadLocalContext.getCompany());
|
||||
String companyRootPath = Tools.getRootPath(rootPath, String.valueOf(ThreadLocalContext.getTenantId()));
|
||||
if (req.getType() == 0) {
|
||||
sourceFilePath = companyRootPath + "/" + sourceFilePath;
|
||||
targetPath = companyRootPath + "/" + targetPath;
|
||||
|
||||
@@ -34,7 +34,7 @@ public class ZipFilesThread implements Runnable {
|
||||
public void run() {
|
||||
ZipOutputStream zipOutputStream = null;
|
||||
String result = "SUCCESS";
|
||||
String company = ThreadLocalContext.getCompany();
|
||||
String company = String.valueOf(ThreadLocalContext.getTenantId());
|
||||
try {
|
||||
zipOutputStream = new ZipOutputStream(new FileOutputStream(zipFile));
|
||||
for (String path : paths) {
|
||||
|
||||
Reference in New Issue
Block a user