新增待办信息

This commit is contained in:
2025-12-22 22:04:01 +08:00
parent e4f0dab2a8
commit dac75e453c
38 changed files with 52 additions and 147 deletions

View File

@@ -530,14 +530,12 @@ public class MailReceiveUtils {
String originalFileName = part.getFileName();
String fileNameForLog = originalFileName == null ? "未知文件名" : decodeMimeText(originalFileName);
logger.info("开始下载附件[" + fileNameForLog + "],开始时间:" + new Date(attachDownloadStartTime));
// 2. 修复:文件名解码(解决乱码)
if (originalFileName != null) {
originalFileName = decodeMimeText(originalFileName);
} else {
originalFileName = "unknown_" + System.currentTimeMillis();
}
// 3. 修复附件FileType优先从文件扩展名识别解决ContentType错误
String fileExt = getFileExtension(originalFileName);
String fileType = MIME_TYPE_MAP.getContentType(originalFileName);
@@ -584,12 +582,10 @@ public class MailReceiveUtils {
long costTime = attachDownloadEndTime - attachDownloadStartTime;
logger.info("完成下载附件[" + originalFileName + "],结束时间:" + new Date(attachDownloadEndTime) +
",耗时:" + costTime + "ms文件路径" + finalFile.getAbsolutePath());
// 6. 封装附件信息修复FileType增加下载时间字段
attachment.setStoragePath(finalFile.getAbsolutePath());
attachment.setFileSize(finalFile.length());
attachment.setCreateTime(new Date());
attachment.setTid(System.currentTimeMillis());
attachment.setMailId(System.currentTimeMillis());
attachment.setMessageId(messageId);
attachment.setFileName(originalFileName);
@@ -602,6 +598,7 @@ public class MailReceiveUtils {
attachment.setDownloadStartTime(new Date(attachDownloadStartTime)); // 附件下载开始时间
attachment.setDownloadEndTime(new Date(attachDownloadEndTime)); // 附件下载结束时间
attachment.setDownloadCostTime(costTime); // 附件下载耗时(毫秒)
attachment.setSvgIcon(MyFileUtils.getIcon(fileExt));
return attachment;
}

View File

@@ -95,18 +95,20 @@ public class MyFileUtils {
public static String getIcon(String ext) {
switch (ext) {
case "wps":
return "icons/file-wps.png";
case "doc", "docx":
return "icons/file-word-line.svg";
return "icons/file-docx.png";
case "xls", "xlsx":
return "icons/file-excel-line.svg";
return "icons/file-xlsx.png";
case "ppt", "pptx":
return "icons/file-ppt-line.svg";
return "icons/file-pptx.png";
case "pdf":
return "icons/file-pdf-line.svg";
return "icons/file-pdf.png";
case "zip", "gz":
return "icons/folder-zip-line.svg";
return "icons/file-zip.png";
default:
return "icons/file-text-line.svg";
return "icons/file.png";
}
}
}

View File

@@ -24,7 +24,7 @@ import java.io.Serial;
@EqualsAndHashCode(callSuper = true)
@Table(name = "biz_mail_attachments", alias = "a", label = "邮件附件表信息", columns = {
@Column(name = "create_time", attrName = "createTime", label = "记录时间", isUpdate = false, isUpdateForce = true),
@Column(name = "id", attrName = "tid", label = "附件标识", isPK = true),
@Column(name = "id", attrName = "id", label = "附件标识", isPK = true),
@Column(name = "mail_id", attrName = "mailId", label = "收件标识"),
@Column(name = "message_id", attrName = "messageId", label = "消息标识"),
@Column(name = "file_name", attrName = "fileName", label = "附件名称", queryType = QueryType.LIKE),
@@ -39,6 +39,7 @@ import java.io.Serial;
@Column(name = "download_start_time", attrName = "downloadStartTime", label = "下载开始时间"),
@Column(name = "download_end_time", attrName = "downloadEndTime", label = "下载结束时间"),
@Column(name = "download_cost_time", attrName = "downloadCostTime", label = "下载耗时"),
@Column(name = "svg_icon", attrName = "svgIcon", label = "文件夹标识"),
}, orderBy = "a.create_time DESC"
)
@Data
@@ -47,7 +48,6 @@ public class BizMailAttachments extends DataEntity<BizMailAttachments> implement
@Serial
private static final long serialVersionUID = 1L;
private Date createTime; // 记录时间
private Long tid; // 附件标识
private Long mailId; // 收件标识
private String messageId; // 消息标识
private String fileName; // 附件名称
@@ -64,9 +64,11 @@ public class BizMailAttachments extends DataEntity<BizMailAttachments> implement
private Date downloadEndTime; // 附件下载结束时间
private Long downloadCostTime; // 附件下载耗时(毫秒)
private String svgIcon; //文件图标
@ExcelFields({
@ExcelField(title = "记录时间", attrName = "createTime", align = Align.CENTER, sort = 10, dataFormat = "yyyy-MM-dd hh:mm"),
@ExcelField(title = "附件标识", attrName = "tid", align = Align.CENTER, sort = 20),
@ExcelField(title = "附件标识", attrName = "id", align = Align.CENTER, sort = 20),
@ExcelField(title = "收件标识", attrName = "mailId", align = Align.CENTER, sort = 30),
@ExcelField(title = "消息标识", attrName = "messageId", align = Align.CENTER, sort = 40),
@ExcelField(title = "附件名称", attrName = "fileName", align = Align.CENTER, sort = 50),

View File

@@ -4,6 +4,7 @@ import java.io.File;
import java.util.List;
import com.jeesite.modules.app.utils.FileDownloadUtils;
import com.jeesite.modules.app.utils.MyFileUtils;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
@@ -141,6 +142,8 @@ public class BizMailAttachmentsController extends BaseController {
@RequestMapping(value = "delete")
@ResponseBody
public String delete(BizMailAttachments bizMailAttachments) {
BizMailAttachments attachments = bizMailAttachmentsService.get(bizMailAttachments);
MyFileUtils.rmFile(attachments.getStoragePath());
bizMailAttachmentsService.delete(bizMailAttachments);
return renderResult(Global.TRUE, text("删除邮件附件表成功!"));
}