新增待办信息
This commit is contained in:
@@ -2,6 +2,7 @@ package com.jeesite.modules.app.utils;
|
||||
|
||||
import java.nio.file.*;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Objects;
|
||||
|
||||
public class MyFileUtils {
|
||||
|
||||
@@ -47,6 +48,38 @@ public class MyFileUtils {
|
||||
}
|
||||
|
||||
|
||||
public static String getFileName(String fileName){
|
||||
if (Objects.isNull(fileName) || fileName.trim().isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
String pureFileName = fileName;
|
||||
int lastSeparatorIndex = fileName.lastIndexOf(System.getProperty("file.separator"));
|
||||
if (lastSeparatorIndex != -1) {
|
||||
pureFileName = fileName.substring(lastSeparatorIndex + 1);
|
||||
}
|
||||
int lastDotIndex = pureFileName.lastIndexOf('.');
|
||||
if (lastDotIndex <= 0) {
|
||||
return pureFileName;
|
||||
}
|
||||
return pureFileName.substring(0, lastDotIndex);
|
||||
}
|
||||
|
||||
public static String getFileName(String fileName,String ext){
|
||||
String baseName = Objects.isNull(fileName) ? "" : fileName.trim();
|
||||
if (Objects.isNull(ext) || ext.trim().isEmpty()) {
|
||||
return baseName;
|
||||
}
|
||||
String standardExt = ext.trim();
|
||||
if (standardExt.startsWith(".")) {
|
||||
standardExt = standardExt.substring(1);
|
||||
}
|
||||
if (standardExt.isEmpty()) {
|
||||
return baseName;
|
||||
}
|
||||
return baseName + "." + standardExt;
|
||||
}
|
||||
|
||||
|
||||
public static String getIcon(String ext) {
|
||||
switch (ext) {
|
||||
case "doc", "docx":
|
||||
|
||||
Reference in New Issue
Block a user