新增预警页面
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package com.jeesite.modules.biz.dao;
|
||||
|
||||
import com.jeesite.common.dao.CrudDao;
|
||||
import com.jeesite.common.mybatis.annotation.MyBatisDao;
|
||||
import com.jeesite.modules.biz.entity.BizMailAccount;
|
||||
|
||||
/**
|
||||
* 邮件信息DAO接口
|
||||
* @author gaoxq
|
||||
* @version 2025-12-14
|
||||
*/
|
||||
@MyBatisDao(dataSourceName="work")
|
||||
public interface BizMailAccountDao extends CrudDao<BizMailAccount> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.jeesite.modules.biz.dao;
|
||||
|
||||
import com.jeesite.common.dao.CrudDao;
|
||||
import com.jeesite.common.mybatis.annotation.MyBatisDao;
|
||||
import com.jeesite.modules.biz.entity.BizMailAttachments;
|
||||
|
||||
/**
|
||||
* 邮件附件表DAO接口
|
||||
* @author gaoxq
|
||||
* @version 2025-12-14
|
||||
*/
|
||||
@MyBatisDao(dataSourceName="work")
|
||||
public interface BizMailAttachmentsDao extends CrudDao<BizMailAttachments> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.jeesite.modules.biz.dao;
|
||||
|
||||
import com.jeesite.common.dao.CrudDao;
|
||||
import com.jeesite.common.mybatis.annotation.MyBatisDao;
|
||||
import com.jeesite.modules.biz.entity.BizMailReceived;
|
||||
|
||||
/**
|
||||
* 收件DAO接口
|
||||
* @author gaoxq
|
||||
* @version 2025-12-14
|
||||
*/
|
||||
@MyBatisDao(dataSourceName="work")
|
||||
public interface BizMailReceivedDao extends CrudDao<BizMailReceived> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.jeesite.modules.biz.dao;
|
||||
|
||||
import com.jeesite.common.dao.CrudDao;
|
||||
import com.jeesite.common.mybatis.annotation.MyBatisDao;
|
||||
import com.jeesite.modules.biz.entity.BizMailSent;
|
||||
|
||||
/**
|
||||
* 发件DAO接口
|
||||
* @author gaoxq
|
||||
* @version 2025-12-14
|
||||
*/
|
||||
@MyBatisDao(dataSourceName="work")
|
||||
public interface BizMailSentDao extends CrudDao<BizMailSent> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package com.jeesite.modules.biz.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable;
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
import com.jeesite.common.entity.DataEntity;
|
||||
import com.jeesite.common.mybatis.annotation.Column;
|
||||
import com.jeesite.common.mybatis.annotation.Table;
|
||||
import com.jeesite.common.mybatis.mapper.query.QueryType;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Align;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelFields;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 邮件信息Entity
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2025-12-14
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table(name = "biz_mail_account", alias = "a", label = "邮件信息信息", columns = {
|
||||
@Column(name = "create_time", attrName = "createTime", label = "记录时间", isUpdate = false),
|
||||
@Column(name = "id", attrName = "id", label = "主键ID", isPK = true),
|
||||
@Column(name = "account_name", attrName = "accountName", label = "配置名称"),
|
||||
@Column(name = "host", attrName = "host", label = "发送地址"),
|
||||
@Column(name = "smtp_port", attrName = "smtpPort", label = "SMTP端口", isQuery = false),
|
||||
@Column(name = "imap_host", attrName = "imapHost", label = "接收地址"),
|
||||
@Column(name = "imap_port", attrName = "imapPort", label = "IMAP端口", isQuery = false),
|
||||
@Column(name = "username", attrName = "username", label = "用户名称"),
|
||||
@Column(name = "password", attrName = "password", label = "用户密码", isQuery = false),
|
||||
@Column(name = "from_address", attrName = "fromAddress", label = "发件人地址"),
|
||||
@Column(name = "ssl_enable", attrName = "sslEnable", label = "是否启用SSL"),
|
||||
@Column(name = "ustatus", attrName = "ustatus", label = "状态"),
|
||||
@Column(name = "remark", attrName = "remark", label = "备注", isQuery = false),
|
||||
@Column(name = "update_time", attrName = "updateTime", label = "更新时间", isQuery = false),
|
||||
@Column(name = "f_tenant_id", attrName = "ftenantId", label = "租户id", isUpdate = false, isQuery = false),
|
||||
@Column(name = "f_flow_id", attrName = "fflowId", label = "流程id", isUpdate = false, isQuery = false),
|
||||
@Column(name = "f_flow_task_id", attrName = "fflowTaskId", label = "流程任务主键", isUpdate = false, isQuery = false),
|
||||
@Column(name = "f_flow_state", attrName = "fflowState", label = "流程任务状态", isUpdate = false, isQuery = false, isUpdateForce = true),
|
||||
}, orderBy = "a.create_time DESC"
|
||||
)
|
||||
@Data
|
||||
public class BizMailAccount extends DataEntity<BizMailAccount> implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Date createTime; // 记录时间
|
||||
private String accountName;
|
||||
private String host; // 服务地址
|
||||
private Integer smtpPort; // SMTP端口
|
||||
private String imapHost;
|
||||
private Integer imapPort; // IMAP端口
|
||||
private String username; // 用户名称
|
||||
private String password; // 用户密码
|
||||
private String fromAddress; // 发件人地址
|
||||
private String sslEnable; // 是否启用SSL
|
||||
private String ustatus;
|
||||
private String remark; // 备注
|
||||
private Date updateTime; // 更新时间
|
||||
private String ftenantId; // 租户id
|
||||
private String fflowId; // 流程id
|
||||
private String fflowTaskId; // 流程任务主键
|
||||
private Integer fflowState; // 流程任务状态
|
||||
|
||||
@ExcelFields({
|
||||
@ExcelField(title = "记录时间", attrName = "createTime", align = Align.CENTER, sort = 10, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title = "主键标识", attrName = "id", align = Align.CENTER, sort = 20),
|
||||
@ExcelField(title = "SMTP服务", attrName = "host", align = Align.CENTER, sort = 30),
|
||||
@ExcelField(title = "SMTP端口", attrName = "smtpPort", align = Align.CENTER, sort = 40),
|
||||
@ExcelField(title = "IMAP服务", attrName = "imapHost", align = Align.CENTER, sort = 50),
|
||||
@ExcelField(title = "IMAP端口", attrName = "imapPort", align = Align.CENTER, sort = 50),
|
||||
@ExcelField(title = "用户名称", attrName = "username", align = Align.CENTER, sort = 60),
|
||||
@ExcelField(title = "发件地址", attrName = "fromAddress", align = Align.CENTER, sort = 80),
|
||||
@ExcelField(title = "是否启用SSL", attrName = "sslEnable", dictType = "is_open", align = Align.CENTER, sort = 90),
|
||||
@ExcelField(title = "状态", attrName = "ustatus", dictType = "ustatus", align = Align.CENTER, sort = 100),
|
||||
@ExcelField(title = "备注", attrName = "remark", align = Align.CENTER, sort = 110),
|
||||
@ExcelField(title = "更新时间", attrName = "updateTime", align = Align.CENTER, sort = 120, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
})
|
||||
public BizMailAccount() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public BizMailAccount(String id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public Date getCreateTime_gte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.GTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_gte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.GTE, createTime);
|
||||
}
|
||||
|
||||
public Date getCreateTime_lte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.LTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_lte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.LTE, createTime);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package com.jeesite.modules.biz.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable;
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
import com.jeesite.common.entity.DataEntity;
|
||||
import com.jeesite.common.mybatis.annotation.Column;
|
||||
import com.jeesite.common.mybatis.annotation.Table;
|
||||
import com.jeesite.common.mybatis.mapper.query.QueryType;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Align;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelFields;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 邮件附件表Entity
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2025-12-14
|
||||
*/
|
||||
@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 = "mail_id", attrName = "mailId", label = "收件标识"),
|
||||
@Column(name = "message_id", attrName = "messageId", label = "消息标识", isQuery = false),
|
||||
@Column(name = "file_name", attrName = "fileName", label = "附件名称", queryType = QueryType.LIKE),
|
||||
@Column(name = "file_size", attrName = "fileSize", label = "文件大小", isQuery = false),
|
||||
@Column(name = "file_type", attrName = "fileType", label = "文件类型", isQuery = false),
|
||||
@Column(name = "file_ext", attrName = "fileExt", label = "文件扩展名"),
|
||||
@Column(name = "storage_path", attrName = "storagePath", label = "存储路径", isQuery = false),
|
||||
@Column(name = "file_md5", attrName = "fileMd5", label = "文件MD5", isQuery = false),
|
||||
@Column(name = "download_count", attrName = "downloadCount", label = "下载次数", isQuery = false, isUpdateForce = true),
|
||||
@Column(name = "is_compressed", attrName = "isCompressed", label = "是否压缩"),
|
||||
@Column(name = "is_encrypted", attrName = "isEncrypted", label = "是否加密"),
|
||||
@Column(name = "download_start_time", attrName = "downloadStartTime", label = "下载开始时间"),
|
||||
@Column(name = "download_end_time", attrName = "downloadEndTime", label = "下载结束时间"),
|
||||
@Column(name = "download_cost_time", attrName = "downloadCostTime", label = "下载耗时"),
|
||||
}, orderBy = "a.create_time DESC"
|
||||
)
|
||||
@Data
|
||||
public class BizMailAttachments extends DataEntity<BizMailAttachments> implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Date createTime; // 记录时间
|
||||
private Long tid; // 附件标识
|
||||
private Long mailId; // 收件标识
|
||||
private String messageId; // 消息标识
|
||||
private String fileName; // 附件名称
|
||||
private Long fileSize; // 文件大小
|
||||
private String fileType; // 文件类型
|
||||
private String fileExt; // 文件扩展名
|
||||
private String storagePath; // 存储路径
|
||||
private String fileMd5; // 文件MD5
|
||||
private Integer downloadCount; // 下载次数
|
||||
private String isCompressed; // 是否压缩
|
||||
private String isEncrypted; // 是否加密
|
||||
|
||||
private Date downloadStartTime; // 附件下载开始时间
|
||||
private Date downloadEndTime; // 附件下载结束时间
|
||||
private Long downloadCostTime; // 附件下载耗时(毫秒)
|
||||
|
||||
@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 = "mailId", align = Align.CENTER, sort = 30),
|
||||
@ExcelField(title = "消息标识", attrName = "messageId", align = Align.CENTER, sort = 40),
|
||||
@ExcelField(title = "附件名称", attrName = "fileName", align = Align.CENTER, sort = 50),
|
||||
@ExcelField(title = "文件大小", attrName = "fileSize", align = Align.CENTER, sort = 60),
|
||||
@ExcelField(title = "文件类型", attrName = "fileType", align = Align.CENTER, sort = 70),
|
||||
@ExcelField(title = "文件扩展名", attrName = "fileExt", align = Align.CENTER, sort = 80),
|
||||
@ExcelField(title = "存储路径", attrName = "storagePath", align = Align.CENTER, sort = 90),
|
||||
@ExcelField(title = "文件MD5", attrName = "fileMd5", align = Align.CENTER, sort = 100),
|
||||
@ExcelField(title = "下载次数", attrName = "downloadCount", align = Align.CENTER, sort = 110),
|
||||
@ExcelField(title = "是否压缩", attrName = "isCompressed", align = Align.CENTER, sort = 120),
|
||||
@ExcelField(title = "是否加密", attrName = "isEncrypted", align = Align.CENTER, sort = 130),
|
||||
})
|
||||
public BizMailAttachments() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public BizMailAttachments(String id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public Date getCreateTime_gte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.GTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_gte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.GTE, createTime);
|
||||
}
|
||||
|
||||
public Date getCreateTime_lte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.LTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_lte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.LTE, createTime);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
package com.jeesite.modules.biz.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable;
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
import com.jeesite.common.entity.DataEntity;
|
||||
import com.jeesite.common.mybatis.annotation.Column;
|
||||
import com.jeesite.common.mybatis.annotation.Table;
|
||||
import com.jeesite.common.mybatis.mapper.query.QueryType;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Align;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelFields;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 收件Entity
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2025-12-14
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table(name = "biz_mail_received", alias = "a", label = "收件信息", columns = {
|
||||
@Column(name = "create_time", attrName = "createTime", label = "记录时间", isUpdate = false),
|
||||
@Column(name = "id", attrName = "id", label = "主键ID", isPK = true),
|
||||
@Column(name = "message_id", attrName = "messageId", label = "邮件服务器消息ID", isQuery = false),
|
||||
@Column(name = "account_id", attrName = "accountId", label = "邮件账户标识"),
|
||||
@Column(name = "from_address", attrName = "fromAddress", label = "发件人地址", isQuery = false),
|
||||
@Column(name = "from_name", attrName = "fromName", label = "发件人名称", queryType = QueryType.LIKE),
|
||||
@Column(name = "to_addresses", attrName = "toAddresses", label = "收件人地址", isQuery = false),
|
||||
@Column(name = "cc_addresses", attrName = "ccAddresses", label = "抄送地址", isQuery = false),
|
||||
@Column(name = "bcc_addresses", attrName = "bccAddresses", label = "密送地址", isQuery = false),
|
||||
@Column(name = "subject", attrName = "subject", label = "邮件主题", queryType = QueryType.LIKE),
|
||||
@Column(name = "mail_content", attrName = "mailContent", label = "邮件内容", isQuery = false),
|
||||
@Column(name = "received_time", attrName = "receivedTime", label = "接收时间", isQuery = false),
|
||||
@Column(name = "send_time", attrName = "sendTime", label = "发送时间", isQuery = false, isUpdateForce = true),
|
||||
@Column(name = "has_attachment", attrName = "hasAttachment", label = "是否有附件"),
|
||||
@Column(name = "mailbox", attrName = "mailbox", label = "mailbox", isQuery = false),
|
||||
@Column(name = "ustatus", attrName = "ustatus", label = "状态"),
|
||||
}, orderBy = "a.id DESC"
|
||||
)
|
||||
@Data
|
||||
public class BizMailReceived extends DataEntity<BizMailReceived> implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Date createTime; // 记录时间
|
||||
private String messageId; // 邮件服务器消息ID
|
||||
private String accountId; // 邮件账户标识
|
||||
private String fromAddress; // 发件人地址
|
||||
private String fromName; // 发件人名称
|
||||
private String toAddresses; // 收件人地址
|
||||
private String ccAddresses; // 抄送地址
|
||||
private String bccAddresses; // 密送地址
|
||||
private String subject; // 邮件主题
|
||||
private String mailContent; // 邮件内容
|
||||
private Date receivedTime; // 接收时间
|
||||
private Date sendTime; // 发送时间
|
||||
private String hasAttachment; // 是否有附件
|
||||
private String mailbox; // mailbox
|
||||
private String ustatus; // 状态
|
||||
|
||||
@ExcelFields({
|
||||
@ExcelField(title = "记录时间", attrName = "createTime", align = Align.CENTER, sort = 10, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title = "主键ID", attrName = "id", align = Align.CENTER, sort = 20),
|
||||
@ExcelField(title = "邮件服务器消息ID", attrName = "messageId", align = Align.CENTER, sort = 30),
|
||||
@ExcelField(title = "邮件账户标识", attrName = "accountId", align = Align.CENTER, sort = 40),
|
||||
@ExcelField(title = "发件人地址", attrName = "fromAddress", align = Align.CENTER, sort = 50),
|
||||
@ExcelField(title = "发件人名称", attrName = "fromName", align = Align.CENTER, sort = 60),
|
||||
@ExcelField(title = "收件人地址", attrName = "toAddresses", align = Align.CENTER, sort = 70),
|
||||
@ExcelField(title = "抄送地址", attrName = "ccAddresses", align = Align.CENTER, sort = 80),
|
||||
@ExcelField(title = "密送地址", attrName = "bccAddresses", align = Align.CENTER, sort = 90),
|
||||
@ExcelField(title = "邮件主题", attrName = "subject", align = Align.CENTER, sort = 100),
|
||||
@ExcelField(title = "邮件内容", attrName = "mailContent", align = Align.CENTER, sort = 110),
|
||||
@ExcelField(title = "接收时间", attrName = "receivedTime", align = Align.CENTER, sort = 120, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title = "发送时间", attrName = "sendTime", align = Align.CENTER, sort = 130, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title = "是否有附件", attrName = "hasAttachment", align = Align.CENTER, sort = 140),
|
||||
@ExcelField(title = "状态", attrName = "ustatus", align = Align.CENTER, sort = 160),
|
||||
})
|
||||
public BizMailReceived() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public BizMailReceived(String id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public Date getCreateTime_gte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.GTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_gte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.GTE, createTime);
|
||||
}
|
||||
|
||||
public Date getCreateTime_lte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.LTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_lte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.LTE, createTime);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package com.jeesite.modules.biz.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable;
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
import com.jeesite.common.entity.DataEntity;
|
||||
import com.jeesite.common.mybatis.annotation.Column;
|
||||
import com.jeesite.common.mybatis.annotation.Table;
|
||||
import com.jeesite.common.mybatis.mapper.query.QueryType;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Align;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelFields;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 发件Entity
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2025-12-14
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table(name = "biz_mail_sent", alias = "a", label = "发件信息", columns = {
|
||||
@Column(name = "create_time", attrName = "createTime", label = "记录时间", isUpdate = false, isUpdateForce = true),
|
||||
@Column(name = "id", attrName = "id", label = "主键标识", isPK = true),
|
||||
@Column(name = "message_id", attrName = "messageId", label = "件服务器消息标识", isQuery = false),
|
||||
@Column(name = "account_id", attrName = "accountId", label = "邮件账户标识"),
|
||||
@Column(name = "from_address", attrName = "fromAddress", label = "发件人地址", queryType = QueryType.LIKE),
|
||||
@Column(name = "to_addresses", attrName = "toAddresses", label = "收件人地址", isQuery = false),
|
||||
@Column(name = "cc_addresses", attrName = "ccAddresses", label = "抄送人地址", isQuery = false),
|
||||
@Column(name = "subject", attrName = "subject", label = "邮件主题", queryType = QueryType.LIKE),
|
||||
@Column(name = "content", attrName = "content", label = "邮件内容", isQuery = false),
|
||||
@Column(name = "send_time", attrName = "sendTime", label = "发送时间", isQuery = false, isUpdateForce = true),
|
||||
@Column(name = "send_status", attrName = "sendStatus", label = "发送状态"),
|
||||
@Column(name = "error_msg", attrName = "errorMsg", label = "错误信息", isQuery = false),
|
||||
@Column(name = "has_attachment", attrName = "hasAttachment", label = "是否有附件"),
|
||||
@Column(name = "update_time", attrName = "updateTime", label = "更新时间", isQuery = false, isUpdateForce = true),
|
||||
@Column(name = "f_tenant_id", attrName = "ftenantId", label = "租户id", isUpdate = false, isQuery = false),
|
||||
@Column(name = "f_flow_id", attrName = "fflowId", label = "流程id", isUpdate = false, isQuery = false),
|
||||
@Column(name = "f_flow_task_id", attrName = "fflowTaskId", label = "流程任务主键", isUpdate = false, isQuery = false),
|
||||
@Column(name = "f_flow_state", attrName = "fflowState", label = "流程任务状态", isUpdate = false, isQuery = false, isUpdateForce = true),
|
||||
}, orderBy = "a.create_time DESC"
|
||||
)
|
||||
@Data
|
||||
public class BizMailSent extends DataEntity<BizMailSent> implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Date createTime; // 记录时间
|
||||
private String messageId; // 件服务器消息标识
|
||||
private String accountId; // 邮件账户标识
|
||||
private String fromAddress; // 发件人地址
|
||||
private String toAddresses; // 收件人地址
|
||||
private String ccAddresses; // 抄送人地址
|
||||
private String subject; // 邮件主题
|
||||
private String content; // 邮件内容
|
||||
private Date sendTime; // 发送时间
|
||||
private String sendStatus; // 发送状态
|
||||
private String errorMsg; // 错误信息
|
||||
private String hasAttachment; // 是否有附件
|
||||
private Date updateTime; // 更新时间
|
||||
private String ftenantId; // 租户id
|
||||
private String fflowId; // 流程id
|
||||
private String fflowTaskId; // 流程任务主键
|
||||
private Integer fflowState; // 流程任务状态
|
||||
|
||||
@ExcelFields({
|
||||
@ExcelField(title = "记录时间", attrName = "createTime", align = Align.CENTER, sort = 10, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title = "主键标识", attrName = "id", align = Align.CENTER, sort = 20),
|
||||
@ExcelField(title = "件服务器消息标识", attrName = "messageId", align = Align.CENTER, sort = 30),
|
||||
@ExcelField(title = "邮件账户标识", attrName = "accountId", align = Align.CENTER, sort = 40),
|
||||
@ExcelField(title = "发件人地址", attrName = "fromAddress", align = Align.CENTER, sort = 50),
|
||||
@ExcelField(title = "收件人地址", attrName = "toAddresses", align = Align.CENTER, sort = 60),
|
||||
@ExcelField(title = "抄送人地址", attrName = "ccAddresses", align = Align.CENTER, sort = 70),
|
||||
@ExcelField(title = "邮件主题", attrName = "subject", align = Align.CENTER, sort = 80),
|
||||
@ExcelField(title = "邮件内容", attrName = "content", align = Align.CENTER, sort = 90),
|
||||
@ExcelField(title = "发送时间", attrName = "sendTime", align = Align.CENTER, sort = 100, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title = "发送状态", attrName = "sendStatus", align = Align.CENTER, sort = 110),
|
||||
@ExcelField(title = "错误信息", attrName = "errorMsg", align = Align.CENTER, sort = 120),
|
||||
@ExcelField(title = "是否有附件", attrName = "hasAttachment", align = Align.CENTER, sort = 130),
|
||||
@ExcelField(title = "更新时间", attrName = "updateTime", align = Align.CENTER, sort = 140, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
})
|
||||
public BizMailSent() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public BizMailSent(String id) {
|
||||
super(id);
|
||||
}
|
||||
public Date getCreateTime_gte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.GTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_gte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.GTE, createTime);
|
||||
}
|
||||
|
||||
public Date getCreateTime_lte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.LTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_lte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.LTE, createTime);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.jeesite.modules.biz.service;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.service.CrudService;
|
||||
import com.jeesite.modules.biz.entity.BizMailAccount;
|
||||
import com.jeesite.modules.biz.dao.BizMailAccountDao;
|
||||
import com.jeesite.common.service.ServiceException;
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.validator.ValidatorUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelImport;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import jakarta.validation.ConstraintViolation;
|
||||
import jakarta.validation.ConstraintViolationException;
|
||||
|
||||
/**
|
||||
* 邮件信息Service
|
||||
* @author gaoxq
|
||||
* @version 2025-12-14
|
||||
*/
|
||||
@Service
|
||||
public class BizMailAccountService extends CrudService<BizMailAccountDao, BizMailAccount> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param bizMailAccount 主键
|
||||
*/
|
||||
@Override
|
||||
public BizMailAccount get(BizMailAccount bizMailAccount) {
|
||||
return super.get(bizMailAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param bizMailAccount 查询条件
|
||||
* @param bizMailAccount page 分页对象
|
||||
*/
|
||||
@Override
|
||||
public Page<BizMailAccount> findPage(BizMailAccount bizMailAccount) {
|
||||
return super.findPage(bizMailAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
* @param bizMailAccount 查询条件
|
||||
*/
|
||||
@Override
|
||||
public List<BizMailAccount> findList(BizMailAccount bizMailAccount) {
|
||||
return super.findList(bizMailAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param bizMailAccount 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void save(BizMailAccount bizMailAccount) {
|
||||
super.save(bizMailAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
* @param file 导入的数据文件
|
||||
*/
|
||||
@Transactional
|
||||
public String importData(MultipartFile file) {
|
||||
if (file == null){
|
||||
throw new ServiceException(text("请选择导入的数据文件!"));
|
||||
}
|
||||
int successNum = 0; int failureNum = 0;
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
StringBuilder failureMsg = new StringBuilder();
|
||||
try(ExcelImport ei = new ExcelImport(file, 2, 0)){
|
||||
List<BizMailAccount> list = ei.getDataList(BizMailAccount.class);
|
||||
for (BizMailAccount bizMailAccount : list) {
|
||||
try{
|
||||
ValidatorUtils.validateWithException(bizMailAccount);
|
||||
this.save(bizMailAccount);
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、编号 " + bizMailAccount.getId() + " 导入成功");
|
||||
} catch (Exception e) {
|
||||
failureNum++;
|
||||
String msg = "<br/>" + failureNum + "、编号 " + bizMailAccount.getId() + " 导入失败:";
|
||||
if (e instanceof ConstraintViolationException){
|
||||
ConstraintViolationException cve = (ConstraintViolationException)e;
|
||||
for (ConstraintViolation<?> violation : cve.getConstraintViolations()) {
|
||||
msg += Global.getText(violation.getMessage()) + " ("+violation.getPropertyPath()+")";
|
||||
}
|
||||
}else{
|
||||
msg += e.getMessage();
|
||||
}
|
||||
failureMsg.append(msg);
|
||||
logger.error(msg, e);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
failureMsg.append(e.getMessage());
|
||||
return failureMsg.toString();
|
||||
}
|
||||
if (failureNum > 0) {
|
||||
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
||||
throw new ServiceException(failureMsg.toString());
|
||||
}else{
|
||||
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
|
||||
}
|
||||
return successMsg.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param bizMailAccount 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateStatus(BizMailAccount bizMailAccount) {
|
||||
super.updateStatus(bizMailAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param bizMailAccount 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void delete(BizMailAccount bizMailAccount) {
|
||||
super.delete(bizMailAccount);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.jeesite.modules.biz.service;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.service.CrudService;
|
||||
import com.jeesite.modules.biz.entity.BizMailAttachments;
|
||||
import com.jeesite.modules.biz.dao.BizMailAttachmentsDao;
|
||||
import com.jeesite.common.service.ServiceException;
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.validator.ValidatorUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelImport;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import jakarta.validation.ConstraintViolation;
|
||||
import jakarta.validation.ConstraintViolationException;
|
||||
|
||||
/**
|
||||
* 邮件附件表Service
|
||||
* @author gaoxq
|
||||
* @version 2025-12-14
|
||||
*/
|
||||
@Service
|
||||
public class BizMailAttachmentsService extends CrudService<BizMailAttachmentsDao, BizMailAttachments> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param bizMailAttachments 主键
|
||||
*/
|
||||
@Override
|
||||
public BizMailAttachments get(BizMailAttachments bizMailAttachments) {
|
||||
return super.get(bizMailAttachments);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param bizMailAttachments 查询条件
|
||||
* @param bizMailAttachments page 分页对象
|
||||
*/
|
||||
@Override
|
||||
public Page<BizMailAttachments> findPage(BizMailAttachments bizMailAttachments) {
|
||||
return super.findPage(bizMailAttachments);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
* @param bizMailAttachments 查询条件
|
||||
*/
|
||||
@Override
|
||||
public List<BizMailAttachments> findList(BizMailAttachments bizMailAttachments) {
|
||||
return super.findList(bizMailAttachments);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param bizMailAttachments 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void save(BizMailAttachments bizMailAttachments) {
|
||||
super.save(bizMailAttachments);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
* @param file 导入的数据文件
|
||||
*/
|
||||
@Transactional
|
||||
public String importData(MultipartFile file) {
|
||||
if (file == null){
|
||||
throw new ServiceException(text("请选择导入的数据文件!"));
|
||||
}
|
||||
int successNum = 0; int failureNum = 0;
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
StringBuilder failureMsg = new StringBuilder();
|
||||
try(ExcelImport ei = new ExcelImport(file, 2, 0)){
|
||||
List<BizMailAttachments> list = ei.getDataList(BizMailAttachments.class);
|
||||
for (BizMailAttachments bizMailAttachments : list) {
|
||||
try{
|
||||
ValidatorUtils.validateWithException(bizMailAttachments);
|
||||
this.save(bizMailAttachments);
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、编号 " + bizMailAttachments.getId() + " 导入成功");
|
||||
} catch (Exception e) {
|
||||
failureNum++;
|
||||
String msg = "<br/>" + failureNum + "、编号 " + bizMailAttachments.getId() + " 导入失败:";
|
||||
if (e instanceof ConstraintViolationException){
|
||||
ConstraintViolationException cve = (ConstraintViolationException)e;
|
||||
for (ConstraintViolation<?> violation : cve.getConstraintViolations()) {
|
||||
msg += Global.getText(violation.getMessage()) + " ("+violation.getPropertyPath()+")";
|
||||
}
|
||||
}else{
|
||||
msg += e.getMessage();
|
||||
}
|
||||
failureMsg.append(msg);
|
||||
logger.error(msg, e);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
failureMsg.append(e.getMessage());
|
||||
return failureMsg.toString();
|
||||
}
|
||||
if (failureNum > 0) {
|
||||
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
||||
throw new ServiceException(failureMsg.toString());
|
||||
}else{
|
||||
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
|
||||
}
|
||||
return successMsg.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param bizMailAttachments 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateStatus(BizMailAttachments bizMailAttachments) {
|
||||
super.updateStatus(bizMailAttachments);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param bizMailAttachments 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void delete(BizMailAttachments bizMailAttachments) {
|
||||
super.delete(bizMailAttachments);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.jeesite.modules.biz.service;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.service.CrudService;
|
||||
import com.jeesite.modules.biz.entity.BizMailReceived;
|
||||
import com.jeesite.modules.biz.dao.BizMailReceivedDao;
|
||||
import com.jeesite.common.service.ServiceException;
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.validator.ValidatorUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelImport;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import jakarta.validation.ConstraintViolation;
|
||||
import jakarta.validation.ConstraintViolationException;
|
||||
|
||||
/**
|
||||
* 收件Service
|
||||
* @author gaoxq
|
||||
* @version 2025-12-14
|
||||
*/
|
||||
@Service
|
||||
public class BizMailReceivedService extends CrudService<BizMailReceivedDao, BizMailReceived> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param bizMailReceived 主键
|
||||
*/
|
||||
@Override
|
||||
public BizMailReceived get(BizMailReceived bizMailReceived) {
|
||||
return super.get(bizMailReceived);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param bizMailReceived 查询条件
|
||||
* @param bizMailReceived page 分页对象
|
||||
*/
|
||||
@Override
|
||||
public Page<BizMailReceived> findPage(BizMailReceived bizMailReceived) {
|
||||
return super.findPage(bizMailReceived);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
* @param bizMailReceived 查询条件
|
||||
*/
|
||||
@Override
|
||||
public List<BizMailReceived> findList(BizMailReceived bizMailReceived) {
|
||||
return super.findList(bizMailReceived);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param bizMailReceived 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void save(BizMailReceived bizMailReceived) {
|
||||
super.save(bizMailReceived);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
* @param file 导入的数据文件
|
||||
*/
|
||||
@Transactional
|
||||
public String importData(MultipartFile file) {
|
||||
if (file == null){
|
||||
throw new ServiceException(text("请选择导入的数据文件!"));
|
||||
}
|
||||
int successNum = 0; int failureNum = 0;
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
StringBuilder failureMsg = new StringBuilder();
|
||||
try(ExcelImport ei = new ExcelImport(file, 2, 0)){
|
||||
List<BizMailReceived> list = ei.getDataList(BizMailReceived.class);
|
||||
for (BizMailReceived bizMailReceived : list) {
|
||||
try{
|
||||
ValidatorUtils.validateWithException(bizMailReceived);
|
||||
this.save(bizMailReceived);
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、编号 " + bizMailReceived.getId() + " 导入成功");
|
||||
} catch (Exception e) {
|
||||
failureNum++;
|
||||
String msg = "<br/>" + failureNum + "、编号 " + bizMailReceived.getId() + " 导入失败:";
|
||||
if (e instanceof ConstraintViolationException){
|
||||
ConstraintViolationException cve = (ConstraintViolationException)e;
|
||||
for (ConstraintViolation<?> violation : cve.getConstraintViolations()) {
|
||||
msg += Global.getText(violation.getMessage()) + " ("+violation.getPropertyPath()+")";
|
||||
}
|
||||
}else{
|
||||
msg += e.getMessage();
|
||||
}
|
||||
failureMsg.append(msg);
|
||||
logger.error(msg, e);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
failureMsg.append(e.getMessage());
|
||||
return failureMsg.toString();
|
||||
}
|
||||
if (failureNum > 0) {
|
||||
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
||||
throw new ServiceException(failureMsg.toString());
|
||||
}else{
|
||||
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
|
||||
}
|
||||
return successMsg.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param bizMailReceived 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateStatus(BizMailReceived bizMailReceived) {
|
||||
super.updateStatus(bizMailReceived);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param bizMailReceived 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void delete(BizMailReceived bizMailReceived) {
|
||||
super.delete(bizMailReceived);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package com.jeesite.modules.biz.service;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.service.CrudService;
|
||||
import com.jeesite.modules.biz.entity.BizMailSent;
|
||||
import com.jeesite.modules.biz.dao.BizMailSentDao;
|
||||
import com.jeesite.common.service.ServiceException;
|
||||
import com.jeesite.modules.file.utils.FileUploadUtils;
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.validator.ValidatorUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelImport;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import jakarta.validation.ConstraintViolation;
|
||||
import jakarta.validation.ConstraintViolationException;
|
||||
|
||||
/**
|
||||
* 发件Service
|
||||
* @author gaoxq
|
||||
* @version 2025-12-14
|
||||
*/
|
||||
@Service
|
||||
public class BizMailSentService extends CrudService<BizMailSentDao, BizMailSent> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param bizMailSent 主键
|
||||
*/
|
||||
@Override
|
||||
public BizMailSent get(BizMailSent bizMailSent) {
|
||||
return super.get(bizMailSent);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param bizMailSent 查询条件
|
||||
* @param bizMailSent page 分页对象
|
||||
*/
|
||||
@Override
|
||||
public Page<BizMailSent> findPage(BizMailSent bizMailSent) {
|
||||
return super.findPage(bizMailSent);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
* @param bizMailSent 查询条件
|
||||
*/
|
||||
@Override
|
||||
public List<BizMailSent> findList(BizMailSent bizMailSent) {
|
||||
return super.findList(bizMailSent);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param bizMailSent 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void save(BizMailSent bizMailSent) {
|
||||
super.save(bizMailSent);
|
||||
// 保存上传附件
|
||||
FileUploadUtils.saveFileUpload(bizMailSent, bizMailSent.getId(), "bizMailSent_file");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
* @param file 导入的数据文件
|
||||
*/
|
||||
@Transactional
|
||||
public String importData(MultipartFile file) {
|
||||
if (file == null){
|
||||
throw new ServiceException(text("请选择导入的数据文件!"));
|
||||
}
|
||||
int successNum = 0; int failureNum = 0;
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
StringBuilder failureMsg = new StringBuilder();
|
||||
try(ExcelImport ei = new ExcelImport(file, 2, 0)){
|
||||
List<BizMailSent> list = ei.getDataList(BizMailSent.class);
|
||||
for (BizMailSent bizMailSent : list) {
|
||||
try{
|
||||
ValidatorUtils.validateWithException(bizMailSent);
|
||||
this.save(bizMailSent);
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、编号 " + bizMailSent.getId() + " 导入成功");
|
||||
} catch (Exception e) {
|
||||
failureNum++;
|
||||
String msg = "<br/>" + failureNum + "、编号 " + bizMailSent.getId() + " 导入失败:";
|
||||
if (e instanceof ConstraintViolationException){
|
||||
ConstraintViolationException cve = (ConstraintViolationException)e;
|
||||
for (ConstraintViolation<?> violation : cve.getConstraintViolations()) {
|
||||
msg += Global.getText(violation.getMessage()) + " ("+violation.getPropertyPath()+")";
|
||||
}
|
||||
}else{
|
||||
msg += e.getMessage();
|
||||
}
|
||||
failureMsg.append(msg);
|
||||
logger.error(msg, e);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
failureMsg.append(e.getMessage());
|
||||
return failureMsg.toString();
|
||||
}
|
||||
if (failureNum > 0) {
|
||||
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
||||
throw new ServiceException(failureMsg.toString());
|
||||
}else{
|
||||
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
|
||||
}
|
||||
return successMsg.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param bizMailSent 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateStatus(BizMailSent bizMailSent) {
|
||||
super.updateStatus(bizMailSent);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param bizMailSent 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void delete(BizMailSent bizMailSent) {
|
||||
super.delete(bizMailSent);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,191 @@
|
||||
package com.jeesite.modules.biz.web;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import com.jeesite.modules.app.dao.MailReceived;
|
||||
import com.jeesite.modules.app.utils.MailReceiveUtils;
|
||||
import com.jeesite.modules.biz.entity.BizMailAttachments;
|
||||
import com.jeesite.modules.biz.entity.BizMailReceived;
|
||||
import com.jeesite.modules.biz.service.BizMailAttachmentsService;
|
||||
import com.jeesite.modules.biz.service.BizMailReceivedService;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.collect.ListUtils;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.lang.DateUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelExport;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Type;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.biz.entity.BizMailAccount;
|
||||
import com.jeesite.modules.biz.service.BizMailAccountService;
|
||||
|
||||
/**
|
||||
* 邮件信息Controller
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2025-12-14
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/biz/mailAccount")
|
||||
public class BizMailAccountController extends BaseController {
|
||||
|
||||
private final BizMailAccountService bizMailAccountService;
|
||||
|
||||
private static final ExecutorService MAIL_EXECUTOR = Executors.newFixedThreadPool(5);
|
||||
|
||||
@Resource
|
||||
private BizMailReceivedService receivedService;
|
||||
|
||||
@Resource
|
||||
private BizMailAttachmentsService attachmentsService;
|
||||
|
||||
|
||||
private String MAIL_PATH = "/ogsapp/mail";
|
||||
|
||||
public BizMailAccountController(BizMailAccountService bizMailAccountService) {
|
||||
this.bizMailAccountService = bizMailAccountService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@ModelAttribute
|
||||
public BizMailAccount get(String id, boolean isNewRecord) {
|
||||
return bizMailAccountService.get(id, isNewRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@RequiresPermissions("biz:mailAccount:view")
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(BizMailAccount bizMailAccount, Model model) {
|
||||
model.addAttribute("bizMailAccount", bizMailAccount);
|
||||
return "modules/biz/bizMailAccountList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
*/
|
||||
@RequiresPermissions("biz:mailAccount:view")
|
||||
@RequestMapping(value = "listData")
|
||||
@ResponseBody
|
||||
public Page<BizMailAccount> listData(BizMailAccount bizMailAccount, HttpServletRequest request, HttpServletResponse response) {
|
||||
bizMailAccount.setPage(new Page<>(request, response));
|
||||
Page<BizMailAccount> page = bizMailAccountService.findPage(bizMailAccount);
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@RequiresPermissions("biz:mailAccount:view")
|
||||
@RequestMapping(value = "form")
|
||||
public String form(BizMailAccount bizMailAccount, Model model) {
|
||||
model.addAttribute("bizMailAccount", bizMailAccount);
|
||||
return "modules/biz/bizMailAccountForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
@RequiresPermissions("biz:mailAccount:edit")
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(@Validated BizMailAccount bizMailAccount) {
|
||||
bizMailAccountService.save(bizMailAccount);
|
||||
return renderResult(Global.TRUE, text("保存邮件信息成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*/
|
||||
@RequiresPermissions("biz:mailAccount:view")
|
||||
@RequestMapping(value = "exportData")
|
||||
public void exportData(BizMailAccount bizMailAccount, HttpServletResponse response) {
|
||||
List<BizMailAccount> list = bizMailAccountService.findList(bizMailAccount);
|
||||
String fileName = "邮件信息" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
|
||||
try (ExcelExport ee = new ExcelExport("邮件信息", BizMailAccount.class)) {
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载模板
|
||||
*/
|
||||
@RequiresPermissions("biz:mailAccount:view")
|
||||
@RequestMapping(value = "importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
BizMailAccount bizMailAccount = new BizMailAccount();
|
||||
List<BizMailAccount> list = ListUtils.newArrayList(bizMailAccount);
|
||||
String fileName = "邮件信息模板.xlsx";
|
||||
try (ExcelExport ee = new ExcelExport("邮件信息", BizMailAccount.class, Type.IMPORT)) {
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequiresPermissions("biz:mailAccount:edit")
|
||||
@PostMapping(value = "importData")
|
||||
public String importData(MultipartFile file) {
|
||||
try {
|
||||
String message = bizMailAccountService.importData(file);
|
||||
return renderResult(Global.TRUE, "posfull:" + message);
|
||||
} catch (Exception ex) {
|
||||
return renderResult(Global.FALSE, "posfull:" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*/
|
||||
@RequiresPermissions("biz:mailAccount:edit")
|
||||
@RequestMapping(value = "delete")
|
||||
@ResponseBody
|
||||
public String delete(BizMailAccount bizMailAccount) {
|
||||
bizMailAccountService.delete(bizMailAccount);
|
||||
return renderResult(Global.TRUE, text("删除邮件信息成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 邮件接收
|
||||
*/
|
||||
@RequestMapping(value = "received")
|
||||
@ResponseBody
|
||||
public String received(BizMailAccount bizMailAccount) {
|
||||
MAIL_EXECUTOR.submit(() -> {
|
||||
try {
|
||||
List<MailReceived> receivedList = MailReceiveUtils.receiveUnreadMails(bizMailAccount, MAIL_PATH);
|
||||
for (MailReceived mailReceived : receivedList) {
|
||||
BizMailReceived received = mailReceived.getReceived();
|
||||
List<BizMailAttachments> attachments = mailReceived.getAttachments();
|
||||
for (BizMailAttachments mailAttachments : attachments) {
|
||||
attachmentsService.insert(mailAttachments);
|
||||
}
|
||||
receivedService.save(received);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("后台处理邮件失败", e.getMessage());
|
||||
}
|
||||
});
|
||||
return renderResult(Global.TRUE, text("操作接收邮件成功!"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
package com.jeesite.modules.biz.web;
|
||||
|
||||
import java.util.List;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.collect.ListUtils;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.lang.DateUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelExport;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Type;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.biz.entity.BizMailAttachments;
|
||||
import com.jeesite.modules.biz.service.BizMailAttachmentsService;
|
||||
|
||||
/**
|
||||
* 邮件附件表Controller
|
||||
* @author gaoxq
|
||||
* @version 2025-12-14
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/biz/mailAttachments")
|
||||
public class BizMailAttachmentsController extends BaseController {
|
||||
|
||||
private final BizMailAttachmentsService bizMailAttachmentsService;
|
||||
|
||||
public BizMailAttachmentsController(BizMailAttachmentsService bizMailAttachmentsService) {
|
||||
this.bizMailAttachmentsService = bizMailAttachmentsService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@ModelAttribute
|
||||
public BizMailAttachments get(Long tid, boolean isNewRecord) {
|
||||
return bizMailAttachmentsService.get(tid, isNewRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@RequiresPermissions("biz:mailAttachments:view")
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(BizMailAttachments bizMailAttachments, Model model) {
|
||||
model.addAttribute("bizMailAttachments", bizMailAttachments);
|
||||
return "modules/biz/bizMailAttachmentsList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
*/
|
||||
@RequiresPermissions("biz:mailAttachments:view")
|
||||
@RequestMapping(value = "listData")
|
||||
@ResponseBody
|
||||
public Page<BizMailAttachments> listData(BizMailAttachments bizMailAttachments, HttpServletRequest request, HttpServletResponse response) {
|
||||
bizMailAttachments.setPage(new Page<>(request, response));
|
||||
Page<BizMailAttachments> page = bizMailAttachmentsService.findPage(bizMailAttachments);
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@RequiresPermissions("biz:mailAttachments:view")
|
||||
@RequestMapping(value = "form")
|
||||
public String form(BizMailAttachments bizMailAttachments, Model model) {
|
||||
model.addAttribute("bizMailAttachments", bizMailAttachments);
|
||||
return "modules/biz/bizMailAttachmentsForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
@RequiresPermissions("biz:mailAttachments:edit")
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(@Validated BizMailAttachments bizMailAttachments) {
|
||||
bizMailAttachmentsService.save(bizMailAttachments);
|
||||
return renderResult(Global.TRUE, text("保存邮件附件表成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*/
|
||||
@RequiresPermissions("biz:mailAttachments:view")
|
||||
@RequestMapping(value = "exportData")
|
||||
public void exportData(BizMailAttachments bizMailAttachments, HttpServletResponse response) {
|
||||
List<BizMailAttachments> list = bizMailAttachmentsService.findList(bizMailAttachments);
|
||||
String fileName = "邮件附件表" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
|
||||
try(ExcelExport ee = new ExcelExport("邮件附件表", BizMailAttachments.class)){
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载模板
|
||||
*/
|
||||
@RequiresPermissions("biz:mailAttachments:view")
|
||||
@RequestMapping(value = "importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
BizMailAttachments bizMailAttachments = new BizMailAttachments();
|
||||
List<BizMailAttachments> list = ListUtils.newArrayList(bizMailAttachments);
|
||||
String fileName = "邮件附件表模板.xlsx";
|
||||
try(ExcelExport ee = new ExcelExport("邮件附件表", BizMailAttachments.class, Type.IMPORT)){
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequiresPermissions("biz:mailAttachments:edit")
|
||||
@PostMapping(value = "importData")
|
||||
public String importData(MultipartFile file) {
|
||||
try {
|
||||
String message = bizMailAttachmentsService.importData(file);
|
||||
return renderResult(Global.TRUE, "posfull:"+message);
|
||||
} catch (Exception ex) {
|
||||
return renderResult(Global.FALSE, "posfull:"+ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*/
|
||||
@RequiresPermissions("biz:mailAttachments:edit")
|
||||
@RequestMapping(value = "delete")
|
||||
@ResponseBody
|
||||
public String delete(BizMailAttachments bizMailAttachments) {
|
||||
bizMailAttachmentsService.delete(bizMailAttachments);
|
||||
return renderResult(Global.TRUE, text("删除邮件附件表成功!"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
package com.jeesite.modules.biz.web;
|
||||
|
||||
import java.util.List;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.collect.ListUtils;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.lang.DateUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelExport;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Type;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.biz.entity.BizMailReceived;
|
||||
import com.jeesite.modules.biz.service.BizMailReceivedService;
|
||||
|
||||
/**
|
||||
* 收件Controller
|
||||
* @author gaoxq
|
||||
* @version 2025-12-14
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/biz/mailReceived")
|
||||
public class BizMailReceivedController extends BaseController {
|
||||
|
||||
private final BizMailReceivedService bizMailReceivedService;
|
||||
|
||||
public BizMailReceivedController(BizMailReceivedService bizMailReceivedService) {
|
||||
this.bizMailReceivedService = bizMailReceivedService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@ModelAttribute
|
||||
public BizMailReceived get(String id, boolean isNewRecord) {
|
||||
return bizMailReceivedService.get(id, isNewRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@RequiresPermissions("biz:mailReceived:view")
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(BizMailReceived bizMailReceived, Model model) {
|
||||
model.addAttribute("bizMailReceived", bizMailReceived);
|
||||
return "modules/biz/bizMailReceivedList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
*/
|
||||
@RequiresPermissions("biz:mailReceived:view")
|
||||
@RequestMapping(value = "listData")
|
||||
@ResponseBody
|
||||
public Page<BizMailReceived> listData(BizMailReceived bizMailReceived, HttpServletRequest request, HttpServletResponse response) {
|
||||
bizMailReceived.setPage(new Page<>(request, response));
|
||||
Page<BizMailReceived> page = bizMailReceivedService.findPage(bizMailReceived);
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@RequiresPermissions("biz:mailReceived:view")
|
||||
@RequestMapping(value = "form")
|
||||
public String form(BizMailReceived bizMailReceived, Model model) {
|
||||
model.addAttribute("bizMailReceived", bizMailReceived);
|
||||
return "modules/biz/bizMailReceivedForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
@RequiresPermissions("biz:mailReceived:edit")
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(@Validated BizMailReceived bizMailReceived) {
|
||||
bizMailReceivedService.save(bizMailReceived);
|
||||
return renderResult(Global.TRUE, text("保存收件成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*/
|
||||
@RequiresPermissions("biz:mailReceived:view")
|
||||
@RequestMapping(value = "exportData")
|
||||
public void exportData(BizMailReceived bizMailReceived, HttpServletResponse response) {
|
||||
List<BizMailReceived> list = bizMailReceivedService.findList(bizMailReceived);
|
||||
String fileName = "收件" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
|
||||
try(ExcelExport ee = new ExcelExport("收件", BizMailReceived.class)){
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载模板
|
||||
*/
|
||||
@RequiresPermissions("biz:mailReceived:view")
|
||||
@RequestMapping(value = "importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
BizMailReceived bizMailReceived = new BizMailReceived();
|
||||
List<BizMailReceived> list = ListUtils.newArrayList(bizMailReceived);
|
||||
String fileName = "收件模板.xlsx";
|
||||
try(ExcelExport ee = new ExcelExport("收件", BizMailReceived.class, Type.IMPORT)){
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequiresPermissions("biz:mailReceived:edit")
|
||||
@PostMapping(value = "importData")
|
||||
public String importData(MultipartFile file) {
|
||||
try {
|
||||
String message = bizMailReceivedService.importData(file);
|
||||
return renderResult(Global.TRUE, "posfull:"+message);
|
||||
} catch (Exception ex) {
|
||||
return renderResult(Global.FALSE, "posfull:"+ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*/
|
||||
@RequiresPermissions("biz:mailReceived:edit")
|
||||
@RequestMapping(value = "delete")
|
||||
@ResponseBody
|
||||
public String delete(BizMailReceived bizMailReceived) {
|
||||
bizMailReceivedService.delete(bizMailReceived);
|
||||
return renderResult(Global.TRUE, text("删除收件成功!"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
package com.jeesite.modules.biz.web;
|
||||
|
||||
import java.util.List;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.collect.ListUtils;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.lang.DateUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelExport;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Type;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.biz.entity.BizMailSent;
|
||||
import com.jeesite.modules.biz.service.BizMailSentService;
|
||||
|
||||
/**
|
||||
* 发件Controller
|
||||
* @author gaoxq
|
||||
* @version 2025-12-14
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/biz/mailSent")
|
||||
public class BizMailSentController extends BaseController {
|
||||
|
||||
private final BizMailSentService bizMailSentService;
|
||||
|
||||
public BizMailSentController(BizMailSentService bizMailSentService) {
|
||||
this.bizMailSentService = bizMailSentService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@ModelAttribute
|
||||
public BizMailSent get(String id, boolean isNewRecord) {
|
||||
return bizMailSentService.get(id, isNewRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@RequiresPermissions("biz:mailSent:view")
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(BizMailSent bizMailSent, Model model) {
|
||||
model.addAttribute("bizMailSent", bizMailSent);
|
||||
return "modules/biz/bizMailSentList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
*/
|
||||
@RequiresPermissions("biz:mailSent:view")
|
||||
@RequestMapping(value = "listData")
|
||||
@ResponseBody
|
||||
public Page<BizMailSent> listData(BizMailSent bizMailSent, HttpServletRequest request, HttpServletResponse response) {
|
||||
bizMailSent.setPage(new Page<>(request, response));
|
||||
Page<BizMailSent> page = bizMailSentService.findPage(bizMailSent);
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@RequiresPermissions("biz:mailSent:view")
|
||||
@RequestMapping(value = "form")
|
||||
public String form(BizMailSent bizMailSent, Model model) {
|
||||
model.addAttribute("bizMailSent", bizMailSent);
|
||||
return "modules/biz/bizMailSentForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
@RequiresPermissions("biz:mailSent:edit")
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(@Validated BizMailSent bizMailSent) {
|
||||
bizMailSentService.save(bizMailSent);
|
||||
return renderResult(Global.TRUE, text("保存发件成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*/
|
||||
@RequiresPermissions("biz:mailSent:view")
|
||||
@RequestMapping(value = "exportData")
|
||||
public void exportData(BizMailSent bizMailSent, HttpServletResponse response) {
|
||||
List<BizMailSent> list = bizMailSentService.findList(bizMailSent);
|
||||
String fileName = "发件" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
|
||||
try(ExcelExport ee = new ExcelExport("发件", BizMailSent.class)){
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载模板
|
||||
*/
|
||||
@RequiresPermissions("biz:mailSent:view")
|
||||
@RequestMapping(value = "importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
BizMailSent bizMailSent = new BizMailSent();
|
||||
List<BizMailSent> list = ListUtils.newArrayList(bizMailSent);
|
||||
String fileName = "发件模板.xlsx";
|
||||
try(ExcelExport ee = new ExcelExport("发件", BizMailSent.class, Type.IMPORT)){
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequiresPermissions("biz:mailSent:edit")
|
||||
@PostMapping(value = "importData")
|
||||
public String importData(MultipartFile file) {
|
||||
try {
|
||||
String message = bizMailSentService.importData(file);
|
||||
return renderResult(Global.TRUE, "posfull:"+message);
|
||||
} catch (Exception ex) {
|
||||
return renderResult(Global.FALSE, "posfull:"+ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*/
|
||||
@RequiresPermissions("biz:mailSent:edit")
|
||||
@RequestMapping(value = "delete")
|
||||
@ResponseBody
|
||||
public String delete(BizMailSent bizMailSent) {
|
||||
bizMailSentService.delete(bizMailSent);
|
||||
return renderResult(Global.TRUE, text("删除发件成功!"));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user