邮箱日志功能
This commit is contained in:
parent
54ad304514
commit
de10aa6ab2
@ -1,20 +1,59 @@
|
|||||||
package cn.iocoder.yudao.module.system.controller.admin.mail;
|
package cn.iocoder.yudao.module.system.controller.admin.mail;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.log.*;
|
||||||
|
import cn.iocoder.yudao.module.system.convert.mail.MailLogConvert;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailLogDO;
|
||||||
|
import cn.iocoder.yudao.module.system.service.mail.MailLogService;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 前端控制器
|
* 邮箱日志功能
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author wangjingyi
|
* @author wangjingyi
|
||||||
* @since 2022-03-21
|
* @since 2022-03-21
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/system-mail-log")
|
@RequestMapping("/system/mail-log")
|
||||||
public class MailLogController {
|
public class MailLogController {
|
||||||
|
@Autowired
|
||||||
|
private MailLogService mailLogService;
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@ApiOperation("获得邮箱日志分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:mail-log:query')")
|
||||||
|
public CommonResult<PageResult<MailLogRespVO>> getMailLogPage(@Valid MailLogPageReqVO pageVO) {
|
||||||
|
PageResult<MailLogDO> pageResult = mailLogService.getMailLogPage(pageVO);
|
||||||
|
return success(MailLogConvert.INSTANCE.convertPage(pageResult));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@ApiOperation("导出邮箱日志Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:mail-log:export')")
|
||||||
|
public void exportMailLogExcel(@Valid MailLogExportReqVO exportReqVO ,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
List<MailLogDO> list = mailLogService.getMailLogList(exportReqVO);
|
||||||
|
// 导出 Excel
|
||||||
|
List<MailLogExcelVO> datas = MailLogConvert.INSTANCE.convertList(list);
|
||||||
|
ExcelUtils.write(response, "邮箱日志.xls", "数据", MailLogExcelVO.class, datas);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,42 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.log;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
public class MailLogBaseVO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "邮箱" , required = false , example = "yudaoyuanma@123.com")
|
||||||
|
private String from;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "模版编号" , required = false , example = "templeId")
|
||||||
|
private String templeId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "模版code" , required = false , example = "templeCode")
|
||||||
|
private String templeCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "标题" , required = false , example = "芋道源码")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "内容" , required = false , example = "遇到源码")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "收件人" , required = false , example = "yudaoyuanma@456.com")
|
||||||
|
private String to;
|
||||||
|
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
@ApiModelProperty(value = "发送时间" , required = false , example = "2022-03-26 03:45:20")
|
||||||
|
private Timestamp sendTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "发送状态" , required = false , example = "1")
|
||||||
|
private Boolean sendStatus;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "发送结果" , required = false , example = "yudaoyuanma@123.com")
|
||||||
|
private String sendResult;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.log;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
public class MailLogExcelVO {
|
||||||
|
|
||||||
|
@ExcelProperty(value = "邮箱" )
|
||||||
|
private String from;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "模版编号" )
|
||||||
|
private String templeCode;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "标题")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "内容")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "收件人" )
|
||||||
|
private String to;
|
||||||
|
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
@ExcelProperty(value = "发送时间" )
|
||||||
|
private Timestamp sendTime;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "发送状态")
|
||||||
|
private Boolean sendStatus;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "发送结果")
|
||||||
|
private String sendResult;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,4 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.log;
|
||||||
|
|
||||||
|
public class MailLogExportReqVO extends MailLogPageReqVO{
|
||||||
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.log;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
@Data
|
||||||
|
public class MailLogPageReqVO extends PageParam {
|
||||||
|
@ApiModelProperty(value = "邮箱" , required = false , example = "yudaoyuanma@123.com")
|
||||||
|
private String from;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "模版编号" , required = false , example = "templeId")
|
||||||
|
private String templeId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "模版code" , required = false , example = "templeCode")
|
||||||
|
private String templeCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "标题" , required = false , example = "芋道源码")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "内容" , required = false , example = "遇到源码")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "收件人" , required = false , example = "yudaoyuanma@456.com")
|
||||||
|
private String to;
|
||||||
|
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
@ApiModelProperty(value = "发送时间" , required = false , example = "2022-03-26 03:45:20")
|
||||||
|
private Timestamp sendTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "发送状态" , required = false , example = "1")
|
||||||
|
private Boolean sendStatus;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "发送结果" , required = false , example = "yudaoyuanma@123.com")
|
||||||
|
private String sendResult;
|
||||||
|
}
|
@ -0,0 +1,4 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.log;
|
||||||
|
|
||||||
|
public class MailLogRespVO extends MailLogBaseVO {
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.convert.mail;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.log.MailLogExcelVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.log.MailLogRespVO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailLogDO;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface MailLogConvert {
|
||||||
|
MailLogConvert INSTANCE = Mappers.getMapper(MailLogConvert.class);
|
||||||
|
|
||||||
|
PageResult<MailLogRespVO> convertPage(PageResult<MailLogDO> pageResult);
|
||||||
|
|
||||||
|
List<MailLogExcelVO> convertList(List<MailLogDO> list);
|
||||||
|
}
|
@ -36,6 +36,9 @@ public class MailLogDO extends BaseDO implements Serializable {
|
|||||||
@TableField("from")
|
@TableField("from")
|
||||||
private String from;
|
private String from;
|
||||||
|
|
||||||
|
@TableField("temple_id")
|
||||||
|
private String templeId;
|
||||||
|
|
||||||
@TableField("temple_code")
|
@TableField("temple_code")
|
||||||
private String templeCode;
|
private String templeCode;
|
||||||
|
|
||||||
@ -52,7 +55,7 @@ public class MailLogDO extends BaseDO implements Serializable {
|
|||||||
private Timestamp sendTime;
|
private Timestamp sendTime;
|
||||||
|
|
||||||
@TableField("sendStatus")
|
@TableField("sendStatus")
|
||||||
private String sendStatus;
|
private Boolean sendStatus;
|
||||||
|
|
||||||
@TableField("sendResult")
|
@TableField("sendResult")
|
||||||
private String sendResult;
|
private String sendResult;
|
||||||
|
@ -1,16 +1,41 @@
|
|||||||
package cn.iocoder.yudao.module.system.dal.mysql.mail;
|
package cn.iocoder.yudao.module.system.dal.mysql.mail;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.log.MailLogExportReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.log.MailLogPageReqVO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailLogDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailLogDO;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
|
|
||||||
/**
|
import java.util.List;
|
||||||
* <p>
|
|
||||||
* Mapper 接口
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author wangjingyi
|
|
||||||
* @since 2022-03-21
|
|
||||||
*/
|
|
||||||
public interface MailLogMapper extends BaseMapper<MailLogDO> {
|
|
||||||
|
|
||||||
|
public interface MailLogMapper extends BaseMapperX<MailLogDO> {
|
||||||
|
|
||||||
|
default PageResult<MailLogDO> selectPage(MailLogPageReqVO pageVO){
|
||||||
|
return selectPage(pageVO , new QueryWrapperX<MailLogDO>()
|
||||||
|
.eqIfPresent("from", pageVO.getFrom())
|
||||||
|
.eqIfPresent("templeCode", pageVO.getTempleCode())
|
||||||
|
.likeIfPresent("title" , pageVO.getTitle())
|
||||||
|
.likeIfPresent("content" , pageVO.getContent())
|
||||||
|
.eqIfPresent("to", pageVO.getTo())
|
||||||
|
.eqIfPresent("sendTime" , pageVO.getSendTime())
|
||||||
|
.eqIfPresent("sendStatus" , pageVO.getSendStatus())
|
||||||
|
.eqIfPresent("sendResult" , pageVO.getSendResult())
|
||||||
|
.orderByDesc("sendTime")
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
default List<MailLogDO> selectList(MailLogExportReqVO exportReqVO){
|
||||||
|
return selectList(new QueryWrapperX<MailLogDO>()
|
||||||
|
.eqIfPresent("from", exportReqVO.getFrom())
|
||||||
|
.eqIfPresent("templeCode", exportReqVO.getTempleCode())
|
||||||
|
.likeIfPresent("title" , exportReqVO.getTitle())
|
||||||
|
.likeIfPresent("content" , exportReqVO.getContent())
|
||||||
|
.eqIfPresent("to", exportReqVO.getTo())
|
||||||
|
.eqIfPresent("sendTime" , exportReqVO.getSendTime())
|
||||||
|
.eqIfPresent("sendStatus" , exportReqVO.getSendStatus())
|
||||||
|
.eqIfPresent("sendResult" , exportReqVO.getSendResult())
|
||||||
|
.orderByDesc("sendTime")
|
||||||
|
);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,13 @@
|
|||||||
package cn.iocoder.yudao.module.system.service.mail;
|
package cn.iocoder.yudao.module.system.service.mail;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.log.MailLogExportReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.log.MailLogPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailLogDO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 服务类
|
* 服务类
|
||||||
@ -11,4 +18,7 @@ package cn.iocoder.yudao.module.system.service.mail;
|
|||||||
*/
|
*/
|
||||||
public interface MailLogService {
|
public interface MailLogService {
|
||||||
|
|
||||||
|
PageResult<MailLogDO> getMailLogPage(MailLogPageReqVO pageVO);
|
||||||
|
|
||||||
|
List<MailLogDO> getMailLogList(MailLogExportReqVO exportReqVO);
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,20 @@
|
|||||||
package cn.iocoder.yudao.module.system.service.mail.impl;
|
package cn.iocoder.yudao.module.system.service.mail.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.log.MailLogExportReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.log.MailLogPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailLogDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.mysql.mail.MailLogMapper;
|
||||||
import cn.iocoder.yudao.module.system.service.mail.MailLogService;
|
import cn.iocoder.yudao.module.system.service.mail.MailLogService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 服务实现类
|
* 邮箱日志实现类
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author wangjingyi
|
* @author wangjingyi
|
||||||
@ -14,5 +22,16 @@ import org.springframework.stereotype.Service;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class MailLogServiceImpl implements MailLogService {
|
public class MailLogServiceImpl implements MailLogService {
|
||||||
|
@Autowired
|
||||||
|
MailLogMapper mailLogMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<MailLogDO> getMailLogPage(MailLogPageReqVO pageVO) {
|
||||||
|
return mailLogMapper.selectPage(pageVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MailLogDO> getMailLogList(MailLogExportReqVO exportReqVO) {
|
||||||
|
return mailLogMapper.selectList(exportReqVO);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user