修改已知问题
This commit is contained in:
parent
9b6b837840
commit
ef19d92abf
|
|
@ -110,7 +110,7 @@ public class CommonService {
|
|||
public String getFileSysPath(String dbPath, int dataOwnCode) {
|
||||
ArrayList<String> paths = CollUtil.newArrayList(dbPath.split(MYSQL_FILE_PATH_SPLIT));
|
||||
String path = getDbPath(paths);
|
||||
String prePath = dataOwnCode == DataOwnEnum.USER_PRJ.code ? eleDataPath : userDataPath;
|
||||
String prePath = dataOwnCode == DataOwnEnum.USER_PRJ.code ? userDataPath : eleDataPath;
|
||||
return prePath + File.separator + path;
|
||||
}
|
||||
|
||||
|
|
@ -306,11 +306,10 @@ public class CommonService {
|
|||
if (fileInfo.getDataOwn().equals(DataOwnEnum.SYS_PRJ.code)) { // 删除的是层级目录
|
||||
long count = edFileInfoMapper.selectCount(Wrappers.<EdFileInfo>lambdaQuery()
|
||||
.eq(EdFileInfo::getDataOwn, DataOwnEnum.COMMON.code)
|
||||
.eq(EdFileInfo::getDataOwn, dataOwnCode)
|
||||
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code)
|
||||
.like(EdFileInfo::getFilePath, MYSQL_FILE_PATH_SPLIT + id + MYSQL_FILE_PATH_SPLIT));
|
||||
if (count > 0) {
|
||||
String info = StrFormatter.format("删除文件 {} 失败,目录非空。", fileInfo.getFileName());
|
||||
String info = StrFormatter.format("删除层级 {} 失败,目录非空。", fileInfo.getFileName());
|
||||
log.info(info);
|
||||
return ElectromagneticResultUtil.fail("-1", info);
|
||||
} else {
|
||||
|
|
@ -344,7 +343,7 @@ public class CommonService {
|
|||
.eq(EdFileInfo::getParentId, id)
|
||||
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code));
|
||||
if (count > 0) {
|
||||
String info = StrFormatter.format("删除文件 {} 失败,目录非空。", fileInfo.getFileName());
|
||||
String info = StrFormatter.format("删除文件夹 {} 失败,目录非空。", fileInfo.getFileName());
|
||||
log.info(info);
|
||||
return ElectromagneticResultUtil.fail("-1", info);
|
||||
} else {
|
||||
|
|
@ -361,7 +360,7 @@ public class CommonService {
|
|||
UserThreadLocal.setSuccessInfo(srcFileInfo.getParentId(), id, "删除目录 {} 成功", fileInfo.getFileName());
|
||||
return ElectromagneticResultUtil.success(true);
|
||||
} catch (Exception e) {
|
||||
String info = StrFormatter.format("删除文件 {} 失败,目录非空。", fileInfo.getFileName());
|
||||
String info = StrFormatter.format("删除 {} 失败,原因 {}", fileInfo.getFileName(), e.getMessage());
|
||||
log.error(info, e);
|
||||
throw new BizException(info);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
|||
Assert.isTrue(EleCommonUtil.isFileNameValid(createFolderDTO.getNewFolderName()), NAME_VALID_MSG);
|
||||
String folderId = IdWorker.getSnowFlakeIdString();
|
||||
ElectromagneticResult<?> res = commonService.addFolder(createFolderDTO.getParentId(), createFolderDTO.getNewFolderName(), false, folderId, createFolderDTO.getFileNote(), dataOwnCode);
|
||||
UserThreadLocal.setSuccessInfo(createFolderDTO.getParentId(), res.getData() + "", "创建文件夹成功");
|
||||
UserThreadLocal.setSuccessInfo(createFolderDTO.getParentId(), res.getData() + "", "创建文件夹 {} 成功", createFolderDTO.getNewFolderName());
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@ public class FileSystemServiceImpl implements FileSystemService {
|
|||
|
||||
@Override
|
||||
public void renameFile(String sourcePath, String newName) {
|
||||
sourcePath = sourcePath.replace("//", "/");
|
||||
sourcePath = sourcePath.endsWith("/") ? sourcePath.substring(0, sourcePath.length() - 1) : sourcePath;
|
||||
FileUtil.rename(new File(sourcePath), newName, true);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue