初始化项目
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
package com.jeesite.modules.apps.Module;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class FileList implements Serializable {
|
||||
|
||||
private String filePath;
|
||||
private String fileName;
|
||||
private String fileType;
|
||||
private String fileIcon;
|
||||
private String fileSize;
|
||||
|
||||
public FileList() {
|
||||
}
|
||||
|
||||
public FileList(String filePath, String fileName, String fileType, String fileSize) {
|
||||
this.filePath = filePath;
|
||||
this.fileName = fileName;
|
||||
this.fileType = fileType;
|
||||
this.fileIcon = getIcon(fileType);
|
||||
this.fileSize = fileSize;
|
||||
}
|
||||
|
||||
private String getIcon(String type) {
|
||||
|
||||
switch (type) {
|
||||
case "gz":
|
||||
return "icons/file-gz.png";
|
||||
case "py":
|
||||
return "icons/file-py.png";
|
||||
case "pdf":
|
||||
return "icons/file-pdf.png";
|
||||
case "sql":
|
||||
return "icons/file-sql.png";
|
||||
case "zip":
|
||||
return "icons/file-zip.png";
|
||||
case "ppt", "pptx":
|
||||
return "icons/file-pptx.png";
|
||||
case "xls", "xlsx":
|
||||
return "icons/file-xlsx.png";
|
||||
case "wps", "doc", "docx":
|
||||
return "icons/file-wps.png";
|
||||
default:
|
||||
return "icons/file.png";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -48,7 +48,7 @@ import java.io.Serial;
|
||||
@Column(name = "user_name", attrName = "userName", label = "接收姓名", isQuery = false),
|
||||
@Column(name = "create_user", attrName = "createUser", label = "创建用户", isQuery = false, isUpdate = false, isUpdateForce = true),
|
||||
@Column(name = "login_user", attrName = "loginUser", label = "接收用户"),
|
||||
}, orderBy = "a.id DESC"
|
||||
}, orderBy = "a.create_time DESC"
|
||||
)
|
||||
@Data
|
||||
public class MyNoticeTodo extends DataEntity<MyNoticeTodo> implements Serializable {
|
||||
|
||||
@@ -1,10 +1,17 @@
|
||||
package com.jeesite.modules.biz.web;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.jeesite.common.io.FileUtils;
|
||||
import com.jeesite.modules.apps.Module.FileList;
|
||||
import com.jeesite.modules.apps.Module.TabItem;
|
||||
import com.jeesite.modules.apps.dict.NotifyType;
|
||||
import com.jeesite.modules.file.entity.FileUpload;
|
||||
import com.jeesite.modules.file.utils.FileUploadUtils;
|
||||
import com.jeesite.modules.sys.entity.User;
|
||||
import com.jeesite.modules.sys.utils.UserUtils;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
@@ -91,6 +98,9 @@ public class MyNoticeTodoController extends BaseController {
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(@Validated MyNoticeTodo myNoticeTodo) {
|
||||
User user = UserUtils.getUser();
|
||||
myNoticeTodo.setAvatar(user.getAvatar());
|
||||
myNoticeTodo.setCreateUser(user.getLoginCode());
|
||||
myNoticeTodoService.save(myNoticeTodo);
|
||||
return renderResult(Global.TRUE, text("保存消息成功!"));
|
||||
}
|
||||
@@ -148,6 +158,34 @@ public class MyNoticeTodoController extends BaseController {
|
||||
return renderResult(Global.TRUE, text("删除消息成功!"));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "listAll")
|
||||
@ResponseBody
|
||||
public List<MyNoticeTodo> listAll(MyNoticeTodo myNoticeTodo) {
|
||||
return myNoticeTodoService.findList(myNoticeTodo);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "fileList")
|
||||
@ResponseBody
|
||||
public List<FileList> fileList(MyNoticeTodo myNoticeTodo) {
|
||||
List<FileList> fileLists = new ArrayList<>();
|
||||
List<FileUpload> fileUploadList = FileUploadUtils.findFileUpload(myNoticeTodo.getId(), "myNoticeTodo_file");
|
||||
for (FileUpload fileUpload : fileUploadList) {
|
||||
fileLists.add(new FileList(fileUpload.getFileUrl(), fileUpload.getFileName(), fileUpload.getFileEntity().getFileExtension(), fileUpload.getFileEntity().getFileSizeFormat()));
|
||||
}
|
||||
return fileLists;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "downloadFile")
|
||||
@ResponseBody
|
||||
public void downloadFile(HttpServletRequest request, HttpServletResponse response, FileList fileList) {
|
||||
try {
|
||||
File file = new File("/ogsapp/files/" + fileList.getFilePath());
|
||||
FileUtils.downFile(file, request, response, fileList.getFileName());
|
||||
} catch (Exception e) {
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "tabListData")
|
||||
@ResponseBody
|
||||
|
||||
Reference in New Issue
Block a user