新增预警页面
This commit is contained in:
@@ -3,15 +3,6 @@ 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;
|
||||
@@ -35,7 +26,7 @@ import java.io.Serial;
|
||||
@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 = "message_id", attrName = "messageId", label = "消息标识"),
|
||||
@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),
|
||||
|
||||
@@ -46,6 +46,12 @@ import java.io.Serial;
|
||||
@Column(name = "has_attachment", attrName = "hasAttachment", label = "是否有附件"),
|
||||
@Column(name = "mailbox", attrName = "mailbox", label = "mailbox", isQuery = false),
|
||||
@Column(name = "ustatus", attrName = "ustatus", label = "状态"),
|
||||
}, joinTable = {
|
||||
@JoinTable(type = Type.LEFT_JOIN, entity = BizMailAccount.class, attrName = "this", alias = "b",
|
||||
on = "a.account_id = b.id",
|
||||
columns = {
|
||||
@Column(name = "account_name", attrName = "accountName", label = "配置名称"),
|
||||
}),
|
||||
}, orderBy = "a.id DESC"
|
||||
)
|
||||
@Data
|
||||
@@ -69,11 +75,12 @@ public class BizMailReceived extends DataEntity<BizMailReceived> implements Seri
|
||||
private String mailbox; // mailbox
|
||||
private String ustatus; // 状态
|
||||
|
||||
private String accountName;
|
||||
|
||||
@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 = "id", align = Align.CENTER, sort = 20),
|
||||
@ExcelField(title = "配置名称", attrName = "accountName", 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),
|
||||
|
||||
@@ -47,6 +47,12 @@ import java.io.Serial;
|
||||
@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),
|
||||
}, joinTable = {
|
||||
@JoinTable(type = Type.LEFT_JOIN, entity = BizMailAccount.class, attrName = "this", alias = "b",
|
||||
on = "a.account_id = b.id",
|
||||
columns = {
|
||||
@Column(name = "account_name", attrName = "accountName", label = "配置名称"),
|
||||
}),
|
||||
}, orderBy = "a.create_time DESC"
|
||||
)
|
||||
@Data
|
||||
@@ -72,11 +78,12 @@ public class BizMailSent extends DataEntity<BizMailSent> implements Serializable
|
||||
private String fflowTaskId; // 流程任务主键
|
||||
private Integer fflowState; // 流程任务状态
|
||||
|
||||
private String accountName;
|
||||
|
||||
@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 = "accountName", 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),
|
||||
@@ -95,6 +102,7 @@ public class BizMailSent extends DataEntity<BizMailSent> implements Serializable
|
||||
public BizMailSent(String id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public Date getCreateTime_gte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.GTE);
|
||||
}
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
package com.jeesite.modules.biz.web;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import com.jeesite.modules.app.utils.FileDownloadUtils;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
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 org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.collect.ListUtils;
|
||||
@@ -26,6 +27,7 @@ import com.jeesite.modules.biz.service.BizMailAttachmentsService;
|
||||
|
||||
/**
|
||||
* 邮件附件表Controller
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2025-12-14
|
||||
*/
|
||||
@@ -33,114 +35,130 @@ import com.jeesite.modules.biz.service.BizMailAttachmentsService;
|
||||
@RequestMapping(value = "${adminPath}/biz/mailAttachments")
|
||||
public class BizMailAttachmentsController extends BaseController {
|
||||
|
||||
private final BizMailAttachmentsService bizMailAttachmentsService;
|
||||
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;
|
||||
}
|
||||
public BizMailAttachmentsController(BizMailAttachmentsService bizMailAttachmentsService) {
|
||||
this.bizMailAttachmentsService = bizMailAttachmentsService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@RequiresPermissions("biz:mailAttachments:view")
|
||||
@RequestMapping(value = "form")
|
||||
public String form(BizMailAttachments bizMailAttachments, Model model) {
|
||||
model.addAttribute("bizMailAttachments", bizMailAttachments);
|
||||
return "modules/biz/bizMailAttachmentsForm";
|
||||
}
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@ModelAttribute
|
||||
public BizMailAttachments get(Long tid, boolean isNewRecord) {
|
||||
return bizMailAttachmentsService.get(tid, isNewRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
@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 = {"list", ""})
|
||||
public String list(BizMailAttachments bizMailAttachments, Model model) {
|
||||
model.addAttribute("bizMailAttachments", bizMailAttachments);
|
||||
return "modules/biz/bizMailAttachmentsList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*/
|
||||
@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 = "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 = "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);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@RequiresPermissions("biz:mailAttachments:view")
|
||||
@RequestMapping(value = "form")
|
||||
public String form(BizMailAttachments bizMailAttachments, Model model) {
|
||||
model.addAttribute("bizMailAttachments", bizMailAttachments);
|
||||
return "modules/biz/bizMailAttachmentsForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*/
|
||||
@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("删除邮件附件表成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
@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("删除邮件附件表成功!"));
|
||||
}
|
||||
|
||||
@RequestMapping(value = "listAll")
|
||||
@ResponseBody
|
||||
public List<BizMailAttachments> listAll(BizMailAttachments bizMailAttachments) {
|
||||
return bizMailAttachmentsService.findList(bizMailAttachments);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "downloadFile")
|
||||
public void downloadFile(BizMailAttachments bizMailAttachments, HttpServletResponse response) {
|
||||
try {
|
||||
BizMailAttachments attachments = bizMailAttachmentsService.get(bizMailAttachments);
|
||||
FileDownloadUtils.downloadFile(attachments.getStoragePath(), attachments.getFileName(), response);
|
||||
} catch (Exception e) {
|
||||
System.out.print(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.jeesite.modules.biz.web;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
@@ -26,6 +27,7 @@ import com.jeesite.modules.biz.service.BizMailReceivedService;
|
||||
|
||||
/**
|
||||
* 收件Controller
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2025-12-14
|
||||
*/
|
||||
@@ -33,114 +35,114 @@ import com.jeesite.modules.biz.service.BizMailReceivedService;
|
||||
@RequestMapping(value = "${adminPath}/biz/mailReceived")
|
||||
public class BizMailReceivedController extends BaseController {
|
||||
|
||||
private final BizMailReceivedService bizMailReceivedService;
|
||||
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;
|
||||
}
|
||||
public BizMailReceivedController(BizMailReceivedService bizMailReceivedService) {
|
||||
this.bizMailReceivedService = bizMailReceivedService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@RequiresPermissions("biz:mailReceived:view")
|
||||
@RequestMapping(value = "form")
|
||||
public String form(BizMailReceived bizMailReceived, Model model) {
|
||||
model.addAttribute("bizMailReceived", bizMailReceived);
|
||||
return "modules/biz/bizMailReceivedForm";
|
||||
}
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@ModelAttribute
|
||||
public BizMailReceived get(String id, boolean isNewRecord) {
|
||||
return bizMailReceivedService.get(id, isNewRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
@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 = {"list", ""})
|
||||
public String list(BizMailReceived bizMailReceived, Model model) {
|
||||
model.addAttribute("bizMailReceived", bizMailReceived);
|
||||
return "modules/biz/bizMailReceivedList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*/
|
||||
@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 = "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 = "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);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@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("删除收件成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*/
|
||||
@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("删除收件成功!"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,14 @@
|
||||
package com.jeesite.modules.biz.web;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.jeesite.modules.app.utils.MailSendUtils;
|
||||
import com.jeesite.modules.app.utils.vDate;
|
||||
import com.jeesite.modules.biz.entity.BizMailAccount;
|
||||
import com.jeesite.modules.biz.service.BizMailAccountService;
|
||||
import com.jeesite.modules.file.entity.FileUpload;
|
||||
import com.jeesite.modules.file.utils.FileUploadUtils;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
@@ -26,6 +34,7 @@ import com.jeesite.modules.biz.service.BizMailSentService;
|
||||
|
||||
/**
|
||||
* 发件Controller
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2025-12-14
|
||||
*/
|
||||
@@ -33,114 +42,132 @@ import com.jeesite.modules.biz.service.BizMailSentService;
|
||||
@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;
|
||||
}
|
||||
@Resource
|
||||
private BizMailAccountService accountService;
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@RequiresPermissions("biz:mailSent:view")
|
||||
@RequestMapping(value = "form")
|
||||
public String form(BizMailSent bizMailSent, Model model) {
|
||||
model.addAttribute("bizMailSent", bizMailSent);
|
||||
return "modules/biz/bizMailSentForm";
|
||||
}
|
||||
private final BizMailSentService bizMailSentService;
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
@RequiresPermissions("biz:mailSent:edit")
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(@Validated BizMailSent bizMailSent) {
|
||||
bizMailSentService.save(bizMailSent);
|
||||
return renderResult(Global.TRUE, text("保存发件成功!"));
|
||||
}
|
||||
public BizMailSentController(BizMailSentService bizMailSentService) {
|
||||
this.bizMailSentService = bizMailSentService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*/
|
||||
@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);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@ModelAttribute
|
||||
public BizMailSent get(String id, boolean isNewRecord) {
|
||||
return bizMailSentService.get(id, isNewRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载模板
|
||||
*/
|
||||
@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);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@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) {
|
||||
BizMailAccount account = accountService.get(bizMailSent.getAccountId());
|
||||
bizMailSent.setFromAddress(account.getFromAddress());
|
||||
bizMailSent.setUpdateTime(vDate.getUpdateTime(bizMailSent.getIsNewRecord()));
|
||||
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("删除发件成功!"));
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "sent")
|
||||
@ResponseBody
|
||||
public String sent(BizMailSent bizMailSent) {
|
||||
BizMailAccount account = accountService.get(bizMailSent.getAccountId());
|
||||
List<FileUpload> fileUploads = FileUploadUtils.findFileUpload(bizMailSent.getId(), "bizMailSent_file");
|
||||
BizMailSent sent = MailSendUtils.sendHtmlMail(account, bizMailSent, fileUploads);
|
||||
bizMailSentService.save(sent);
|
||||
return renderResult(Global.TRUE, text("邮件发件成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*/
|
||||
@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