优化相关功能
This commit is contained in:
parent
58e4c4397d
commit
545188be69
|
|
@ -421,4 +421,15 @@ public class CommonService {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public String getLastPrjLeafId(String path) {
|
||||
String[] split = path.split(MYSQL_FILE_PATH_SPLIT);
|
||||
for (int i = split.length - 1; i >= 0; i--) {
|
||||
if (split[i].length() < 19) {
|
||||
return split[i];
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -316,7 +316,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
|||
.set(EdFileInfo::getFileNote, updateFileInfoDTO.getFileNote()));
|
||||
String newName = updateFileInfoDTO.getFileName() + "." + fileInfo.getFileType() + "." + fileInfo.getFileCode();
|
||||
fileSystemService.renameFile(srcFilePath, newName);
|
||||
UserThreadLocal.setSuccessInfo(fileInfo.getParentId(), updateFileInfoDTO.getId(), "更新文件信息成功,新文件名为 {}", newFileName);
|
||||
UserThreadLocal.setSuccessInfo(commonService.getLastPrjLeafId(fileInfo.getFilePath()), updateFileInfoDTO.getId(), "更新文件信息成功,新文件名为 {}.{}", newFileName, fileInfo.getFileType());
|
||||
return ElectromagneticResultUtil.success(true);
|
||||
} catch (Exception e) {
|
||||
String info = StrFormatter.format("更新文件信息失败,新文件名 {}, 原因 {}", newFileName, e.getMessage());
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.electromagnetic.industry.software.common.util;
|
|||
|
||||
|
||||
import cn.hutool.core.text.StrFormatter;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.electromagnetic.industry.software.common.pojo.UserLoginInfo;
|
||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||
|
||||
|
|
@ -52,6 +53,8 @@ public class UserThreadLocal {
|
|||
}
|
||||
|
||||
public static void setSuccessInfo(String parentId, String dataId, String strPattern, Object... argArray) {
|
||||
parentId = StrUtil.isEmpty(parentId) ? "" : parentId;
|
||||
dataId = StrUtil.isEmpty(dataId) ? "" : dataId;
|
||||
String successMsg = StrFormatter.format(strPattern, argArray);
|
||||
userThread.get().setSuccessInfo(parentId, successMsg, dataId);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue