新增待办信息
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package com.jeesite.modules.app.utils;
|
package com.jeesite.modules.app.utils;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.nio.file.*;
|
import java.nio.file.*;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -47,8 +48,20 @@ public class MyFileUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void rmFile(String fileName) {
|
||||||
|
try {
|
||||||
|
File file = new File(fileName);
|
||||||
|
if (file.exists()) {
|
||||||
|
Path path = Paths.get(fileName);
|
||||||
|
Files.delete(path);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static String getFileName(String fileName){
|
|
||||||
|
public static String getFileName(String fileName) {
|
||||||
if (Objects.isNull(fileName) || fileName.trim().isEmpty()) {
|
if (Objects.isNull(fileName) || fileName.trim().isEmpty()) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@@ -64,7 +77,7 @@ public class MyFileUtils {
|
|||||||
return pureFileName.substring(0, lastDotIndex);
|
return pureFileName.substring(0, lastDotIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getFileName(String fileName,String ext){
|
public static String getFileName(String fileName, String ext) {
|
||||||
String baseName = Objects.isNull(fileName) ? "" : fileName.trim();
|
String baseName = Objects.isNull(fileName) ? "" : fileName.trim();
|
||||||
if (Objects.isNull(ext) || ext.trim().isEmpty()) {
|
if (Objects.isNull(ext) || ext.trim().isEmpty()) {
|
||||||
return baseName;
|
return baseName;
|
||||||
|
|||||||
@@ -165,6 +165,8 @@ public class BizMyfilesController extends BaseController {
|
|||||||
@RequestMapping(value = "delete")
|
@RequestMapping(value = "delete")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public String delete(BizMyfiles bizMyfiles) {
|
public String delete(BizMyfiles bizMyfiles) {
|
||||||
|
BizMyfiles myfiles = bizMyfilesService.get(bizMyfiles);
|
||||||
|
MyFileUtils.rmFile(myfiles.getFilePath());
|
||||||
bizMyfilesService.delete(bizMyfiles);
|
bizMyfilesService.delete(bizMyfiles);
|
||||||
return renderResult(Global.TRUE, text("删除文件成功!"));
|
return renderResult(Global.TRUE, text("删除文件成功!"));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user