| | |
| | | import com.ruoyi.common.utils.DateUtils;
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | | import com.ruoyi.common.utils.uuid.IdUtils;
|
| | | import org.apache.commons.io.FilenameUtils;
|
| | |
|
| | | /**
|
| | | * 文件处理工具类
|
| | |
| | |
|
| | | /**
|
| | | * 获取名称
|
| | | * |
| | | * 例如: /profile/upload/2022/04/16/ruoyi.png, 返回: ruoyi.png
|
| | | * @param fileName 路径名称
|
| | | * @return 没有文件路径的名称
|
| | | */
|
| | |
| | | int index = Math.max(lastUnixPos, lastWindowsPos);
|
| | | return fileName.substring(index + 1);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取名称
|
| | | * 例如: /profile/upload/2022/04/16/ruoyi.png, 返回: ruoyi
|
| | | * @param fileName 路径名称
|
| | | * @return 没有文件路径的名称
|
| | | */
|
| | | public static String getNameNotSuffix(String fileName) {
|
| | | if (fileName == null) {
|
| | | return null;
|
| | | }
|
| | | String baseName = FilenameUtils.getBaseName(fileName);
|
| | | return baseName;
|
| | | }
|
| | |
|
| | | }
|