邮件发送

This commit is contained in:
459816669@qq.com 2021-03-14 15:04:44 +08:00
parent bee255e064
commit a6fb60a9e8
39 changed files with 8326 additions and 39 deletions

View File

@ -27,11 +27,11 @@ public class DemoDialogController
/**
* 弹层组件
*/
@GetMapping("/layer")
/* @GetMapping("/layer")
public String layer()
{
return prefix + "/layer";
}
}*/
/**
* 表单
@ -72,9 +72,19 @@ public class DemoDialogController
/**
* 表格回传父窗体
*/
@GetMapping("/parent")
@GetMapping("/layer")
public String layer1()
{
return "/system/email/mail_compose";
}
/**
* 表格回传父窗体
*/
/* @GetMapping("/parent")
public String parent()
{
return prefix + "/table/parent";
}
return prefix + "system/email/mail_compose";
}*/
}

View File

@ -7,19 +7,14 @@ import java.util.List;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelReader;
import com.alibaba.excel.read.metadata.ReadSheet;
import com.alibaba.fastjson.JSON;
import com.google.common.collect.Lists;
import com.snow.common.annotation.RepeatSubmit;
import com.snow.common.constant.SequenceContants;
import com.snow.common.constant.SequenceConstants;
import com.snow.common.utils.poi.EasyExcelUtil;
import com.snow.flowable.domain.CompleteTaskDTO;
import com.snow.flowable.domain.FinishTaskDTO;
import com.snow.flowable.domain.leave.SysOaLeaveForm;
import com.snow.flowable.domain.purchaseOrder.PurchaseOrderForm;
import com.snow.flowable.domain.purchaseOrder.PurchaseOrderMainTask;
import com.snow.flowable.service.FlowableService;
import com.snow.flowable.service.FlowableTaskService;
import com.snow.framework.excel.FinanceAlipayFlowListener;
import com.snow.framework.excel.PurchaseOrderListener;
import com.snow.framework.util.ShiroUtils;
import com.snow.system.domain.*;
@ -144,7 +139,7 @@ public class PurchaseOrderController extends BaseController
@GetMapping("/add")
public String add(ModelMap mmap)
{
String newSequenceNo = sequenceService.getNewSequenceNo(SequenceContants.OA_PURCHASE_SEQUENCE);
String newSequenceNo = sequenceService.getNewSequenceNo(SequenceConstants.OA_PURCHASE_SEQUENCE);
mmap.put("orderNo", newSequenceNo);
return prefix + "/add";
}

View File

@ -0,0 +1,349 @@
package com.snow.web.controller.system;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.snow.common.annotation.Log;
import com.snow.common.annotation.RepeatSubmit;
import com.snow.common.constant.SequenceConstants;
import com.snow.common.core.controller.BaseController;
import com.snow.common.core.domain.AjaxResult;
import com.snow.common.core.page.TableDataInfo;
import com.snow.common.core.text.Convert;
import com.snow.common.enums.BusinessType;
import com.snow.common.enums.SysEmailSearchType;
import com.snow.common.utils.poi.ExcelUtil;
import com.snow.framework.util.ShiroUtils;
import com.snow.framework.web.domain.common.SysSendEmailDTO;
import com.snow.framework.web.service.MailService;
import com.snow.system.domain.SysOaEmail;
import com.snow.system.domain.SysOaEmailDataVO;
import com.snow.system.domain.SysUser;
import com.snow.system.service.ISysOaEmailService;
import com.snow.system.service.ISysSequenceService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* 邮件Controller
*
* @author 没用的阿吉
* @date 2021-03-12
*/
@Controller
@RequestMapping("/system/email")
public class SysOaEmailController extends BaseController
{
private String prefix = "system/email";
@Autowired
private ISysOaEmailService sysOaEmailService;
@Autowired
private MailService mailService;
@Autowired
private ISysSequenceService sequenceService;
@Value("${spring.mail.username}")
private String from;
@RequiresPermissions("system:email:view")
@GetMapping()
public String email(ModelMap mmap)
{
return prefix + "/mailCompose";
}
/**
* 查询邮件列表
*/
@RequiresPermissions("system:email:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(SysOaEmail sysOaEmail)
{
startPage();
SysUser sysUser = ShiroUtils.getSysUser();
Integer mailSearchType = sysOaEmail.getMailSearchType();
switch (mailSearchType){
case 6:
//目前支持单个发
sysOaEmail.setEmailTo(String.valueOf(sysUser.getUserId()));
sysOaEmail.setIsSuccess(0);
break;
case 7:
sysOaEmail.setEmailFrom(String.valueOf(sysUser.getUserId()));
break;
//重要
case 3:
sysOaEmail.setEmailTo(String.valueOf(sysUser.getUserId()));
sysOaEmail.setEmailFrom(String.valueOf(sysUser.getUserId()));
sysOaEmail.setEmailStatus(3L);
List<SysOaEmail> sysOaEmailList = sysOaEmailService.selectImportantEmailList(sysOaEmail);
return getDataTable(sysOaEmailList);
//草稿
case 1:
sysOaEmail.setEmailFrom(String.valueOf(sysUser.getUserId()));
sysOaEmail.setEmailStatus(1L);
break;
//垃圾
case 4:
sysOaEmail.setEmailTo(String.valueOf(sysUser.getUserId()));
sysOaEmail.setEmailStatus(4L);
break;
default:
}
List<SysOaEmail> list = sysOaEmailService.selectSysOaEmailList(sysOaEmail);
return getDataTable(list);
}
/**
* 导出邮件列表
*/
@RequiresPermissions("system:email:export")
@Log(title = "邮件", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(SysOaEmail sysOaEmail)
{
List<SysOaEmail> list = sysOaEmailService.selectSysOaEmailList(sysOaEmail);
ExcelUtil<SysOaEmail> util = new ExcelUtil<SysOaEmail>(SysOaEmail.class);
return util.exportExcel(list, "email");
}
/**
* 修改邮件
*/
@GetMapping("/edit/{id}")
public String edit(@PathVariable("id") Long id, ModelMap mmap)
{
SysOaEmail sysOaEmail = sysOaEmailService.selectSysOaEmailById(id);
mmap.put("sysOaEmail", sysOaEmail);
return prefix + "/edit";
}
/**
* 修改保存邮件
*/
@RequiresPermissions("system:email:edit")
@Log(title = "邮件", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(SysOaEmail sysOaEmail)
{
return toAjax(sysOaEmailService.updateSysOaEmail(sysOaEmail));
}
/**
* 垃圾箱邮件
*/
@RequiresPermissions("system:email:remarkTrash")
@Log(title = "邮件", businessType = BusinessType.OTHER)
@PostMapping( "/remarkTrash")
@ResponseBody
public AjaxResult remarkTrash(String ids)
{
SysUser sysUser = ShiroUtils.getSysUser();
ArrayList<String> idList = Lists.newArrayList(Convert.toStrArray(ids));
idList.forEach(t->{
SysOaEmail sysOaEmail=new SysOaEmail();
sysOaEmail.setId(Long.parseLong(t));
sysOaEmail.setEmailStatus(SysEmailSearchType.TRASH.getCode().longValue());
sysOaEmail.setUpdateBy(String.valueOf(sysUser.getUserId()));
sysOaEmailService.updateSysOaEmail(sysOaEmail);
});
return AjaxResult.success();
}
/**
* 标记邮件为已读
*/
@RequiresPermissions("system:email:remarkRead")
@Log(title = "邮件", businessType = BusinessType.OTHER)
@PostMapping( "/remarkRead")
@ResponseBody
@RepeatSubmit
public AjaxResult remarkRead(String ids)
{
SysUser sysUser = ShiroUtils.getSysUser();
ArrayList<String> idList = Lists.newArrayList(Convert.toStrArray(ids));
idList.forEach(t->{
SysOaEmail sysOaEmail=new SysOaEmail();
sysOaEmail.setId(Long.parseLong(t));
sysOaEmail.setIsRead(1L);
sysOaEmail.setUpdateBy(String.valueOf(sysUser.getUserId()));
sysOaEmailService.updateSysOaEmail(sysOaEmail);
});
return AjaxResult.success();
}
/**
* 标记为重要
* @param ids
* @return
*/
@RequiresPermissions("system:email:remarkImportant")
@Log(title = "邮件", businessType = BusinessType.OTHER)
@PostMapping( "/remarkImportant")
@ResponseBody
public AjaxResult remarkImportant(String ids)
{
SysUser sysUser = ShiroUtils.getSysUser();
ArrayList<String> idList = Lists.newArrayList(Convert.toStrArray(ids));
idList.forEach(t->{
SysOaEmail sysOaEmail=new SysOaEmail();
sysOaEmail.setId(Long.parseLong(t));
sysOaEmail.setEmailStatus(SysEmailSearchType.IMPORTANT.getCode().longValue());
sysOaEmail.setUpdateBy(String.valueOf(sysUser.getUserId()));
sysOaEmailService.updateSysOaEmail(sysOaEmail);
});
return AjaxResult.success();
}
/**
* 标记为
* @param ids
* @return
*/
@RequiresPermissions("system:email:markDelete")
@Log(title = "邮件", businessType = BusinessType.OTHER)
@PostMapping( "/markDelete")
@ResponseBody
public AjaxResult markDelete(String ids)
{
int i = sysOaEmailService.deleteSysOaEmailByIds(ids);
return AjaxResult.success(i);
}
/**
* 发送邮件
* @param sysOaEmail
* @return
*/
@RequiresPermissions("system:email:sendSysEmail")
@Log(title = "邮件", businessType = BusinessType.OTHER)
@PostMapping( "/sendSysEmail")
@ResponseBody
@RepeatSubmit
@Transactional(rollbackFor = Exception.class)
public AjaxResult sendSysEmail(SysOaEmail sysOaEmail){
String newSequenceNo = sequenceService.getNewSequenceNo(SequenceConstants.OA_EMAIL_SEQUENCE);
SysUser sysUser = ShiroUtils.getSysUser();
sysOaEmail.setBelongUserId(String.valueOf(sysUser.getUserId()));
//发送人id
sysOaEmail.setEmailFrom(String.valueOf(sysUser.getUserId()));
sysOaEmail.setCreateBy(String.valueOf(sysUser.getUserId()));
sysOaEmail.setUpdateBy(String.valueOf(sysUser.getUserId()));
sysOaEmail.setEmailType(0L);
sysOaEmail.setEmailNo(newSequenceNo);
sysOaEmail.setSendTime(new Date());
int i = sysOaEmailService.insertSysOaEmail(sysOaEmail);
//只有发送状态下才能发送
if(sysOaEmail.getEmailStatus().intValue()==SysEmailSearchType.COMMON.getCode()){
SysSendEmailDTO build = SysSendEmailDTO.builder().from(from)
.subject(sysOaEmail.getEmailSubject())
.content(sysOaEmail.getEmailContent())
.receiverSet(Sets.newHashSet(sysOaEmail.getEmailTo()))
.sentDate(new Date())
.build();
mailService.sendHtmlMail(build);
}
return AjaxResult.success(i);
}
/**
* 跳转邮件列表
*/
@GetMapping("/mailbox/{mailType}")
public String mailbox(@PathVariable("mailType") Long mailType,ModelMap mmap)
{
mmap.put("mailType",mailType);
return prefix + "/mailbox";
}
/**
* 邮件详情
*/
@GetMapping("/mailDetail/{id}")
public String mailDetail(@PathVariable("id") Long id,ModelMap mmap)
{
//标记为已读
SysUser sysUser = ShiroUtils.getSysUser();
SysOaEmail readSysOaEmail=new SysOaEmail();
readSysOaEmail.setId(id);
readSysOaEmail.setIsRead(1L);
readSysOaEmail.setUpdateBy(String.valueOf(sysUser.getUserId()));
sysOaEmailService.updateSysOaEmail(readSysOaEmail);
SysOaEmail sysOaEmail = sysOaEmailService.selectSysOaEmailById(id);
mmap.put("sysOaEmail", sysOaEmail);
return prefix + "/mailDetail";
}
/**
* 获取邮件读取情况
* @return
*/
@GetMapping("/getSysOaEmailData")
@ResponseBody
public AjaxResult getSysOaEmailData()
{
SysUser sysUser = ShiroUtils.getSysUser();
SysOaEmail sysOaEmail=new SysOaEmail();
sysOaEmail.setEmailTo(String.valueOf(sysUser.getUserId()));
sysOaEmail.setIsDelete(0L);
List<SysOaEmail> list = sysOaEmailService.selectSysOaEmailList(sysOaEmail);
SysOaEmailDataVO.SysOaEmailDataVOBuilder builder = SysOaEmailDataVO.builder();
if(CollectionUtils.isNotEmpty(list)){
long inboxTotal = list.stream().filter(t -> t.getEmailTo().equals(String.valueOf(sysUser.getUserId()))).count();
builder.inboxTotal(inboxTotal);
long sendMailTotal = list.stream().filter(t -> t.getEmailFrom().equals(String.valueOf(sysUser.getUserId()))).count();
builder.sendMailTotal(sendMailTotal);
//是否已读针对的是收件
long readTotal = list.stream().filter(t -> (t.getEmailTo().equals(String.valueOf(sysUser.getUserId()))&&t.getIsRead()==0)).count();
builder.readTotal(readTotal);
//重要标记收件或者发件
long importantTotal = list.stream().filter(t -> (
t.getEmailTo().equals(String.valueOf(sysUser.getUserId()))||
t.getEmailFrom().equals(String.valueOf(sysUser.getUserId())))&&t.getEmailStatus().intValue()==SysEmailSearchType.IMPORTANT.getCode()).
count();
builder.importantTotal(importantTotal);
//垃圾标记针对收件
long trashTotal = list.stream().filter(t -> (
t.getEmailTo().equals(String.valueOf(sysUser.getUserId())))&&t.getEmailStatus().intValue()==SysEmailSearchType.TRASH.getCode()).
count();
builder.trashTotal(trashTotal);
//草稿标记针对我发件
long draftsTotal= list.stream().filter(t -> (
t.getEmailFrom().equals(String.valueOf(sysUser.getUserId())))&&t.getEmailStatus().intValue()==SysEmailSearchType.DRAFTS.getCode()).
count();
builder.draftsTotal(draftsTotal);
}
return AjaxResult.success(builder.build());
}
}

View File

@ -4,7 +4,7 @@ import cn.hutool.core.date.BetweenFormater;
import cn.hutool.core.date.DateUtil;
import com.snow.common.annotation.Log;
import com.snow.common.annotation.RepeatSubmit;
import com.snow.common.constant.SequenceContants;
import com.snow.common.constant.SequenceConstants;
import com.snow.common.core.controller.BaseController;
import com.snow.common.core.domain.AjaxResult;
import com.snow.common.core.page.TableDataInfo;
@ -135,7 +135,7 @@ public class SysOaLeaveController extends BaseController
return AjaxResult.error("请假结束时间必须大于开始时间");
}
//生成请假单
String leaveNo = sequenceService.getNewSequenceNo(SequenceContants.OA_LEAVE_SEQUENCE);
String leaveNo = sequenceService.getNewSequenceNo(SequenceConstants.OA_LEAVE_SEQUENCE);
sysOaLeave.setCreateBy(String.valueOf(sysUser.getUserId()));
sysOaLeave.setLeaveNo(leaveNo);
int i = sysOaLeaveService.insertSysOaLeave(sysOaLeave);

View File

@ -2,7 +2,7 @@ package com.snow.web.controller.system;
import com.snow.common.annotation.Log;
import com.snow.common.annotation.RepeatSubmit;
import com.snow.common.constant.SequenceContants;
import com.snow.common.constant.SequenceConstants;
import com.snow.common.core.controller.BaseController;
import com.snow.common.core.domain.AjaxResult;
import com.snow.common.core.page.TableDataInfo;
@ -103,7 +103,7 @@ public class SysOaResignController extends BaseController
@GetMapping("/add")
public String add(ModelMap mmap)
{
String newSequenceNo = sequenceService.getNewSequenceNo(SequenceContants.OA_RESIGN_SEQUENCE);
String newSequenceNo = sequenceService.getNewSequenceNo(SequenceConstants.OA_RESIGN_SEQUENCE);
mmap.put("resignNo", newSequenceNo);
return prefix + "/add";
}

View File

@ -0,0 +1,59 @@
/* iCheck plugin Square skin, green
----------------------------------- */
.icheckbox_square-green,
.iradio_square-green {
display: inline-block;
*display: inline;
vertical-align: middle;
margin: 0;
padding: 0;
width: 22px;
height: 22px;
background: url(green.png) no-repeat;
border: none;
cursor: pointer;
}
.icheckbox_square-green {
background-position: 0 0;
}
.icheckbox_square-green.hover {
background-position: -24px 0;
}
.icheckbox_square-green.checked {
background-position: -48px 0;
}
.icheckbox_square-green.disabled {
background-position: -72px 0;
cursor: default;
}
.icheckbox_square-green.checked.disabled {
background-position: -96px 0;
}
.iradio_square-green {
background-position: -120px 0;
}
.iradio_square-green.hover {
background-position: -144px 0;
}
.iradio_square-green.checked {
background-position: -168px 0;
}
.iradio_square-green.disabled {
background-position: -192px 0;
cursor: default;
}
.iradio_square-green.checked.disabled {
background-position: -216px 0;
}
/* HiDPI support */
@media (-o-min-device-pixel-ratio: 5/4), (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi) {
.icheckbox_square-green,
.iradio_square-green {
background-image: url(green@2x.png);
-webkit-background-size: 240px 24px;
background-size: 240px 24px;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,298 @@
/*
*
* INSPINIA - Responsive Admin Theme
* version 2.7.1
*
*/
$(document).ready(function () {
// Add body-small class if window less than 768px
if ($(this).width() < 769) {
$('body').addClass('body-small')
} else {
$('body').removeClass('body-small')
}
// MetisMenu
$('#side-menu').metisMenu();
// Collapse ibox function
$('.collapse-link').on('click', function () {
var ibox = $(this).closest('div.ibox');
var button = $(this).find('i');
var content = ibox.children('.ibox-content');
content.slideToggle(200);
button.toggleClass('fa-chevron-up').toggleClass('fa-chevron-down');
ibox.toggleClass('').toggleClass('border-bottom');
setTimeout(function () {
ibox.resize();
ibox.find('[id^=map-]').resize();
}, 50);
});
// Close ibox function
$('.close-link').on('click', function () {
var content = $(this).closest('div.ibox');
content.remove();
});
// Fullscreen ibox function
$('.fullscreen-link').on('click', function () {
var ibox = $(this).closest('div.ibox');
var button = $(this).find('i');
$('body').toggleClass('fullscreen-ibox-mode');
button.toggleClass('fa-expand').toggleClass('fa-compress');
ibox.toggleClass('fullscreen');
setTimeout(function () {
$(window).trigger('resize');
}, 100);
});
// Close menu in canvas mode
$('.close-canvas-menu').on('click', function () {
$("body").toggleClass("mini-navbar");
SmoothlyMenu();
});
// Run menu of canvas
$('body.canvas-menu .sidebar-collapse').slimScroll({
height: '100%',
railOpacity: 0.9
});
// Open close right sidebar
$('.right-sidebar-toggle').on('click', function () {
$('#right-sidebar').toggleClass('sidebar-open');
});
// Initialize slimscroll for right sidebar
$('.sidebar-container').slimScroll({
height: '100%',
railOpacity: 0.4,
wheelStep: 10
});
// Open close small chat
$('.open-small-chat').on('click', function () {
$(this).children().toggleClass('fa-comments').toggleClass('fa-remove');
$('.small-chat-box').toggleClass('active');
});
// Initialize slimscroll for small chat
$('.small-chat-box .content').slimScroll({
height: '234px',
railOpacity: 0.4
});
// Small todo handler
$('.check-link').on('click', function () {
var button = $(this).find('i');
var label = $(this).next('span');
button.toggleClass('fa-check-square').toggleClass('fa-square-o');
label.toggleClass('todo-completed');
return false;
});
// Append config box / Only for demo purpose
// Uncomment on server mode to enable XHR calls
//$.get("skin-config.html", function (data) {
// if (!$('body').hasClass('no-skin-config'))
// $('body').append(data);
//});
// Minimalize menu
$('.navbar-minimalize').on('click', function (event) {
event.preventDefault();
$("body").toggleClass("mini-navbar");
SmoothlyMenu();
});
// Tooltips demo
$('.tooltip-demo').tooltip({
selector: "[data-toggle=tooltip]",
container: "body"
});
// Full height of sidebar
function fix_height() {
var heightWithoutNavbar = $("body > #wrapper").height() - 61;
$(".sidebar-panel").css("min-height", heightWithoutNavbar + "px");
var navbarheight = $('nav.navbar-default').height();
var wrapperHeight = $('#page-wrapper').height();
if (navbarheight > wrapperHeight) {
$('#page-wrapper').css("min-height", navbarheight + "px");
}
if (navbarheight < wrapperHeight) {
$('#page-wrapper').css("min-height", $(window).height() + "px");
}
if ($('body').hasClass('fixed-nav')) {
if (navbarheight > wrapperHeight) {
$('#page-wrapper').css("min-height", navbarheight + "px");
} else {
$('#page-wrapper').css("min-height", $(window).height() - 60 + "px");
}
}
}
fix_height();
// Fixed Sidebar
$(window).bind("load", function () {
if ($("body").hasClass('fixed-sidebar')) {
$('.sidebar-collapse').slimScroll({
height: '100%',
railOpacity: 0.9
});
}
});
// Move right sidebar top after scroll
$(window).scroll(function () {
if ($(window).scrollTop() > 0 && !$('body').hasClass('fixed-nav')) {
$('#right-sidebar').addClass('sidebar-top');
} else {
$('#right-sidebar').removeClass('sidebar-top');
}
});
$(window).bind("load resize scroll", function () {
if (!$("body").hasClass('body-small')) {
fix_height();
}
});
$("[data-toggle=popover]")
.popover();
// Add slimscroll to element
$('.full-height-scroll').slimscroll({
height: '100%'
})
});
// Minimalize menu when screen is less than 768px
$(window).bind("resize", function () {
if ($(this).width() < 769) {
$('body').addClass('body-small')
} else {
$('body').removeClass('body-small')
}
});
// Local Storage functions
// Set proper body class and plugins based on user configuration
$(document).ready(function () {
if (localStorageSupport()) {
var collapse = localStorage.getItem("collapse_menu");
var fixedsidebar = localStorage.getItem("fixedsidebar");
var fixednavbar = localStorage.getItem("fixednavbar");
var boxedlayout = localStorage.getItem("boxedlayout");
var fixedfooter = localStorage.getItem("fixedfooter");
var body = $('body');
if (fixedsidebar == 'on') {
body.addClass('fixed-sidebar');
$('.sidebar-collapse').slimScroll({
height: '100%',
railOpacity: 0.9
});
}
if (collapse == 'on') {
if (body.hasClass('fixed-sidebar')) {
if (!body.hasClass('body-small')) {
body.addClass('mini-navbar');
}
} else {
if (!body.hasClass('body-small')) {
body.addClass('mini-navbar');
}
}
}
if (fixednavbar == 'on') {
$(".navbar-static-top").removeClass('navbar-static-top').addClass('navbar-fixed-top');
body.addClass('fixed-nav');
}
if (boxedlayout == 'on') {
body.addClass('boxed-layout');
}
if (fixedfooter == 'on') {
$(".footer").addClass('fixed');
}
}
});
// check if browser support HTML5 local storage
function localStorageSupport() {
return (('localStorage' in window) && window['localStorage'] !== null)
}
// For demo purpose - animation css script
function animationHover(element, animation) {
element = $(element);
element.hover(
function () {
element.addClass('animated ' + animation);
},
function () {
//wait for animation to finish before removing classes
window.setTimeout(function () {
element.removeClass('animated ' + animation);
}, 2000);
});
}
function SmoothlyMenu() {
if (!$('body').hasClass('mini-navbar') || $('body').hasClass('body-small')) {
// Hide menu in order to smoothly turn on when maximize menu
$('#side-menu').hide();
// For smoothly turn on menu
setTimeout(
function () {
$('#side-menu').fadeIn(400);
}, 200);
} else if ($('body').hasClass('fixed-sidebar')) {
$('#side-menu').hide();
setTimeout(
function () {
$('#side-menu').fadeIn(400);
}, 100);
} else {
// Remove all inline style from jquery fadeIn function to reset menu state
$('#side-menu').removeAttr('style');
}
}
// Dragable panels
function WinMove() {
var element = "[class*=col]";
var handle = ".ibox-title";
var connect = "[class*=col]";
$(element).sortable(
{
handle: handle,
connectWith: connect,
tolerance: 'pointer',
forcePlaceholderSize: true,
opacity: 0.8
})
.disableSelection();
}

View File

@ -0,0 +1,11 @@
/*! iCheck v1.0.2 by Damir Sultanov, http://git.io/arlzeA, MIT Licensed */
(function(f){function A(a,b,d){var c=a[0],g=/er/.test(d)?_indeterminate:/bl/.test(d)?n:k,e=d==_update?{checked:c[k],disabled:c[n],indeterminate:"true"==a.attr(_indeterminate)||"false"==a.attr(_determinate)}:c[g];if(/^(ch|di|in)/.test(d)&&!e)x(a,g);else if(/^(un|en|de)/.test(d)&&e)q(a,g);else if(d==_update)for(var f in e)e[f]?x(a,f,!0):q(a,f,!0);else if(!b||"toggle"==d){if(!b)a[_callback]("ifClicked");e?c[_type]!==r&&q(a,g):x(a,g)}}function x(a,b,d){var c=a[0],g=a.parent(),e=b==k,u=b==_indeterminate,
v=b==n,s=u?_determinate:e?y:"enabled",F=l(a,s+t(c[_type])),B=l(a,b+t(c[_type]));if(!0!==c[b]){if(!d&&b==k&&c[_type]==r&&c.name){var w=a.closest("form"),p='input[name="'+c.name+'"]',p=w.length?w.find(p):f(p);p.each(function(){this!==c&&f(this).data(m)&&q(f(this),b)})}u?(c[b]=!0,c[k]&&q(a,k,"force")):(d||(c[b]=!0),e&&c[_indeterminate]&&q(a,_indeterminate,!1));D(a,e,b,d)}c[n]&&l(a,_cursor,!0)&&g.find("."+C).css(_cursor,"default");g[_add](B||l(a,b)||"");g.attr("role")&&!u&&g.attr("aria-"+(v?n:k),"true");
g[_remove](F||l(a,s)||"")}function q(a,b,d){var c=a[0],g=a.parent(),e=b==k,f=b==_indeterminate,m=b==n,s=f?_determinate:e?y:"enabled",q=l(a,s+t(c[_type])),r=l(a,b+t(c[_type]));if(!1!==c[b]){if(f||!d||"force"==d)c[b]=!1;D(a,e,s,d)}!c[n]&&l(a,_cursor,!0)&&g.find("."+C).css(_cursor,"pointer");g[_remove](r||l(a,b)||"");g.attr("role")&&!f&&g.attr("aria-"+(m?n:k),"false");g[_add](q||l(a,s)||"")}function E(a,b){if(a.data(m)){a.parent().html(a.attr("style",a.data(m).s||""));if(b)a[_callback](b);a.off(".i").unwrap();
f(_label+'[for="'+a[0].id+'"]').add(a.closest(_label)).off(".i")}}function l(a,b,f){if(a.data(m))return a.data(m).o[b+(f?"":"Class")]}function t(a){return a.charAt(0).toUpperCase()+a.slice(1)}function D(a,b,f,c){if(!c){if(b)a[_callback]("ifToggled");a[_callback]("ifChanged")[_callback]("if"+t(f))}}var m="iCheck",C=m+"-helper",r="radio",k="checked",y="un"+k,n="disabled";_determinate="determinate";_indeterminate="in"+_determinate;_update="update";_type="type";_click="click";_touch="touchbegin.i touchend.i";
_add="addClass";_remove="removeClass";_callback="trigger";_label="label";_cursor="cursor";_mobile=/ipad|iphone|ipod|android|blackberry|windows phone|opera mini|silk/i.test(navigator.userAgent);f.fn[m]=function(a,b){var d='input[type="checkbox"], input[type="'+r+'"]',c=f(),g=function(a){a.each(function(){var a=f(this);c=a.is(d)?c.add(a):c.add(a.find(d))})};if(/^(check|uncheck|toggle|indeterminate|determinate|disable|enable|update|destroy)$/i.test(a))return a=a.toLowerCase(),g(this),c.each(function(){var c=
f(this);"destroy"==a?E(c,"ifDestroyed"):A(c,!0,a);f.isFunction(b)&&b()});if("object"!=typeof a&&a)return this;var e=f.extend({checkedClass:k,disabledClass:n,indeterminateClass:_indeterminate,labelHover:!0},a),l=e.handle,v=e.hoverClass||"hover",s=e.focusClass||"focus",t=e.activeClass||"active",B=!!e.labelHover,w=e.labelHoverClass||"hover",p=(""+e.increaseArea).replace("%","")|0;if("checkbox"==l||l==r)d='input[type="'+l+'"]';-50>p&&(p=-50);g(this);return c.each(function(){var a=f(this);E(a);var c=this,
b=c.id,g=-p+"%",d=100+2*p+"%",d={position:"absolute",top:g,left:g,display:"block",width:d,height:d,margin:0,padding:0,background:"#fff",border:0,opacity:0},g=_mobile?{position:"absolute",visibility:"hidden"}:p?d:{position:"absolute",opacity:0},l="checkbox"==c[_type]?e.checkboxClass||"icheckbox":e.radioClass||"i"+r,z=f(_label+'[for="'+b+'"]').add(a.closest(_label)),u=!!e.aria,y=m+"-"+Math.random().toString(36).substr(2,6),h='<div class="'+l+'" '+(u?'role="'+c[_type]+'" ':"");u&&z.each(function(){h+=
'aria-labelledby="';this.id?h+=this.id:(this.id=y,h+=y);h+='"'});h=a.wrap(h+"/>")[_callback]("ifCreated").parent().append(e.insert);d=f('<ins class="'+C+'"/>').css(d).appendTo(h);a.data(m,{o:e,s:a.attr("style")}).css(g);e.inheritClass&&h[_add](c.className||"");e.inheritID&&b&&h.attr("id",m+"-"+b);"static"==h.css("position")&&h.css("position","relative");A(a,!0,_update);if(z.length)z.on(_click+".i mouseover.i mouseout.i "+_touch,function(b){var d=b[_type],e=f(this);if(!c[n]){if(d==_click){if(f(b.target).is("a"))return;
A(a,!1,!0)}else B&&(/ut|nd/.test(d)?(h[_remove](v),e[_remove](w)):(h[_add](v),e[_add](w)));if(_mobile)b.stopPropagation();else return!1}});a.on(_click+".i focus.i blur.i keyup.i keydown.i keypress.i",function(b){var d=b[_type];b=b.keyCode;if(d==_click)return!1;if("keydown"==d&&32==b)return c[_type]==r&&c[k]||(c[k]?q(a,k):x(a,k)),!1;if("keyup"==d&&c[_type]==r)!c[k]&&x(a,k);else if(/us|ur/.test(d))h["blur"==d?_remove:_add](s)});d.on(_click+" mousedown mouseup mouseover mouseout "+_touch,function(b){var d=
b[_type],e=/wn|up/.test(d)?t:v;if(!c[n]){if(d==_click)A(a,!1,!0);else{if(/wn|er|in/.test(d))h[_add](e);else h[_remove](e+" "+t);if(z.length&&B&&e==v)z[/ut|nd/.test(d)?_remove:_add](w)}if(_mobile)b.stopPropagation();else return!1}})})}})(window.jQuery||window.Zepto);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -251,3 +251,41 @@
</div>
</div>
</div>
<div th:fragment="emailNavPage">
<div class="col-lg-3">
<div class="ibox float-e-margins">
<div class="ibox-content mailbox-content">
<div class="file-manager">
<a class="btn btn-block btn-primary compose-mail" href="/system/email">写邮件</a>
<div class="space-25"></div>
<h3>文件夹</h3>
<ul class="folder-list m-b-md" style="padding: 0">
<li><a th:href="@{/system/email/mailbox/6}"> <i class="fa fa-inbox "></i>收件箱<span class="label label-warning pull-right" id="readTotal"></span> </a></li>
<li><a th:href="@{/system/email/mailbox/7}"> <i class="fa fa-inbox "></i>发件箱</a></li>
<li><a th:href="@{/system/email/mailbox/3}"> <i class="fa fa-certificate"></i> 重要邮件</a></li>
<li><a th:href="@{/system/email/mailbox/1}"> <i class="fa fa-file-text-o"></i> 草稿箱 <span class="label label-info pull-right" id="draftsTotal">2</span></a></li>
<li><a th:href="@{/system/email/mailbox/4}"> <i class="fa fa-trash-o"></i> 垃圾箱</a></li>
</ul>
<h3>分类</h3>
<ul class="category-list" style="padding: 0">
<li><a href="#"> <i class="fa fa-circle text-navy"></i> 工作 </a></li>
<li><a href="#"> <i class="fa fa-circle text-danger"></i> 文档</a></li>
<li><a href="#"> <i class="fa fa-circle text-primary"></i> 社交</a></li>
<li><a href="#"> <i class="fa fa-circle text-info"></i> 活动</a></li>
<li><a href="#"> <i class="fa fa-circle text-warning"></i> 抄送</a></li>
</ul>
<h3>邮件标签</h3>
<ul class="category-list" style="padding: 0">
<div class="i-checks"><label> <input type="radio" value="1" checked="" name="emailLabel"> <i></i> Work </label></div>
<div class="i-checks"><label> <input type="radio" value="2" name="emailLabel"> <i></i> Documents </label></div>
<div class="i-checks"><label> <input type="radio" value="3" name="emailLabel"> <i></i>Social </label></div>
<div class="i-checks"><label> <input type="radio" value="4" name="emailLabel"> <i></i> Advertising </label></div>
</ul>
<div class="clearfix"></div>
</div>
</div>
</div>
</div>
</div>

View File

@ -34,9 +34,10 @@
<div class="m-b"></div>
<ul class="m-b-lg">
<li><i class="fa fa-arrow-circle-o-right m-r-lg"></i> flowable设计器集成(内置请假审批流程,采购审批流程,离职审批会签流程)</li>
<li><i class="fa fa-arrow-circle-o-right m-r-lg"></i> 钉钉与系统基础数据同步</li>
<li><i class="fa fa-arrow-circle-o-right m-r-lg"></i> flowable集成</li>
<li><i class="fa fa-arrow-circle-o-right m-r-lg"></i> 智能化数据大屏</li>
<li><i class="fa fa-arrow-circle-o-right m-r-lg"></i> 邮件、钉钉模板配置,邮件在线发送</li>
</ul>
<strong th:if="${@config.getKey('sys.account.registerUser')}">还没有账号? <a th:href="@{/register}">立即注册&raquo;</a></strong>
</div>
@ -65,7 +66,7 @@
</div>
<div class="signup-footer">
<div class="pull-left">
&copy; 2020 All Rights Reserved. QJD <br>
&copy; 2021 All Rights Reserved. Ding-Flow <br>
</div>
</div>
</div>

View File

@ -0,0 +1,91 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改邮件')" />
<th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-email-edit" th:object="${sysOaEmail}">
<input name="id" th:field="*{id}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">邮件编号:</label>
<div class="col-sm-8">
<input name="emailNo" th:field="*{emailNo}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">邮件主题:</label>
<div class="col-sm-8">
<input name="emailSubject" th:field="*{emailSubject}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">邮件内容:</label>
<div class="col-sm-8">
<textarea name="emailContent" class="form-control">[[*{emailContent}]]</textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">收件人:</label>
<div class="col-sm-8">
<input name="emailTo" th:field="*{emailTo}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">发件人:</label>
<div class="col-sm-8">
<input name="emailFrom" th:field="*{emailFrom}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">发送时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="sendTime" th:value="${#dates.format(sysOaEmail.sendTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">邮件状态:</label>
<div class="col-sm-8">
<div class="radio-box" th:each="dict : ${@dict.getType('sys_email_status')}">
<input type="radio" th:id="${'emailStatus_' + dict.dictCode}" name="emailStatus" th:value="${dict.dictValue}" th:field="*{emailStatus}">
<label th:for="${'emailStatus_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">邮件标签:</label>
<div class="col-sm-8">
<div class="radio-box" th:each="dict : ${@dict.getType('sys_email_lable')}">
<input type="radio" th:id="${'emailLabel_' + dict.dictCode}" name="emailLabel" th:value="${dict.dictValue}" th:field="*{emailLabel}">
<label th:for="${'emailLabel_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
var prefix = ctx + "system/email";
$("#form-email-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-email-edit').serialize());
}
}
$("input[name='sendTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
</script>
</body>
</html>

View File

@ -0,0 +1,162 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('邮件列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>邮件编号:</label>
<input type="text" name="emailNo"/>
</li>
<li>
<label>邮件主题:</label>
<input type="text" name="emailSubject"/>
</li>
<li>
<label>收件人:</label>
<input type="text" name="emailTo"/>
</li>
<li>
<label>发件人:</label>
<input type="text" name="emailFrom"/>
</li>
<li class="select-time">
<label>发送时间:</label>
<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginSendTime]"/>
<span>-</span>
<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endSendTime]"/>
</li>
<li>
<label>邮件状态:</label>
<select name="emailStatus" th:with="type=${@dict.getType('sys_email_status')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<label>邮件标签:</label>
<select name="emailLabel" th:with="type=${@dict.getType('sys_email_lable')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<label>是否已读:</label>
<input type="text" name="isRead"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:email:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:email:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:email:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:email:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('system:email:edit')}]];
var removeFlag = [[${@permission.hasPermi('system:email:remove')}]];
var emailStatusDatas = [[${@dict.getType('sys_email_status')}]];
var emailLabelDatas = [[${@dict.getType('sys_email_lable')}]];
var prefix = ctx + "system/email";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "邮件",
columns: [{
checkbox: true
},
{
field: 'id',
title: 'id',
visible: false
},
{
field: 'emailNo',
title: '邮件编号'
},
{
field: 'emailSubject',
title: '邮件主题'
},
{
field: 'emailContent',
title: '邮件内容'
},
{
field: 'emailTo',
title: '收件人'
},
{
field: 'emailFrom',
title: '发件人'
},
{
field: 'sendTime',
title: '发送时间'
},
{
field: 'emailStatus',
title: '邮件状态',
formatter: function(value, row, index) {
return $.table.selectDictLabel(emailStatusDatas, value);
}
},
{
field: 'emailLabel',
title: '邮件标签',
formatter: function(value, row, index) {
return $.table.selectDictLabel(emailLabelDatas, value);
}
},
{
field: 'isRead',
title: '是否已读'
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>

View File

@ -0,0 +1,200 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>INSPINIA | Mailbox</title>
<link th:href="@{/css/bootstrap.min.css}" rel="stylesheet">
<link th:href="@{/css/font-awesome.min.css}" rel="stylesheet"/>
<link th:href="@{/css/iCheck/custom.css}" rel="stylesheet">
<link th:href="@{/css/animate.css}" rel="stylesheet">
<link th:href="@{/css/style.css}" rel="stylesheet">
<th:block th:include="include :: summernote-css" />
</head>
<body>
<div id="wrapper">
<div class="wrapper wrapper-content gray-bg">
<div class="row">
<th:block th:include="include :: emailNavPage" />
<div class="col-lg-9 animated fadeInRight">
<div class="mail-box-header">
<!--<div class="pull-right tooltip-demo">
<a href="mailbox.html" class="btn btn-white btn-sm" data-toggle="tooltip" data-placement="top" title="Move to draft folder"><i class="fa fa-pencil"></i> 草稿</a>
<a href="mailbox.html" class="btn btn-danger btn-sm" data-toggle="tooltip" data-placement="top" title="Discard email"><i class="fa fa-times"></i> 删除</a>
</div>-->
<h2>
Ding-Flow在线邮件
</h2>
</div>
<div class="mail-box">
<div class="mail-body">
<form class="form-horizontal" method="get">
<div class="form-group"><label class="col-sm-2 control-label">收件人:</label>
<div class="col-sm-10">
<input class="form-control" type="hidden" name="emailTo" id="emailTo" required>
<input type="text" class="form-control" onclick="selectUserInfo()" id="emailToName" name="emailToName" readonly="true">
</div>
</div>
<div class="form-group"><label class="col-sm-2 control-label">主题:</label>
<div class="col-sm-10"><input type="text" class="form-control" id="subject" name="subject"></div>
</div>
</form>
</div>
<div class="mail-text h-200">
<input id="emailContent" name="emailContent" type="hidden">
<div class="summernote">
</div>
<div class="clearfix"></div>
</div>
<div class="mail-body text-right tooltip-demo">
<a href="javascript:void(0)" class="btn btn-sm btn-primary" data-toggle="tooltip" onclick="sendEmail(0)" data-placement="top" title="Send"><i class="fa fa-reply"></i> 发送</a>
<a href="javascript:void(0)" class="btn btn-warning btn-sm" data-toggle="tooltip" onclick="sendEmail(1)" data-placement="top" title="存为草稿"><i class="fa fa-file-text-o"></i> 草稿</a>
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
</div>
</div>
<!-- Mainly scripts -->
<script th:src="@{/js/jquery.js}"></script>
<script th:src="@{/js/bootstrap.min.js}"></script>
<script th:src="@{/js/plugins/metisMenu/jquery.metisMenu.js}"></script>
<script th:src="@{/js/plugins/slimscroll/jquery.slimscroll.min.js}"></script>
<!-- Custom and plugin javascript -->
<script th:src="@{/js/inspinia.js}"></script>
<script th:src="@{/js/plugins/pace/pace.min.js}"></script>
<script th:src="@{/ajax/libs/iCheck/icheck.min.js}"></script>
<script th:src="@{/ajax/libs/layer/layer.min.js}"></script>
<script th:src="@{/ajax/libs/layui/layui.js}"></script>
<script th:src="@{/ruoyi/js/common.js}"></script>
<script th:src="@{/ruoyi/js/ry-ui.js}"></script>
<script th:src="@{/ajax/libs/blockUI/jquery.blockUI.js}"></script>
<th:block th:include="include :: summernote-js" />
<script type="text/javascript">
var prefix ="../system/email";
$(document).ready(function () {
$('.i-checks').iCheck({
checkboxClass: 'icheckbox_square-green',
radioClass: 'iradio_square-green',
});
$.get(prefix+"/getSysOaEmailData", function(data) {
if (data.code == web_status.SUCCESS ) {
var sysOaEmailData=data.data;
console.log(JSON.stringify(sysOaEmailData))
$("#readTotal").text(sysOaEmailData.readTotal);
$("#draftsTotal").text(sysOaEmailData.draftsTotal);
} else if (data.code == web_status.WARNING) {
$.modal.alertWarning(data.msg)
} else {
$.modal.alertError(data.msg);
}
});
});
$('.summernote').summernote({
placeholder: '请输入公告内容',
height : 300,
lang : 'zh-CN',
followingToolbar: false,
callbacks: {
onImageUpload: function (files) {
sendFile(files[0], this);
}
}
});
/*选择用户*/
function selectUserInfo() {
var url = "/system/resign/selectUser";
$.modal.open("选择用户",url,"","",doSubmit);
}
function doSubmit(index, layero){
var body = layer.getChildFrame('body', index);
var iframeWin = layero.find('iframe')[0];
iframeWin.contentWindow.submitHandler(index, layero);
$("#emailTo").val(body.find('#id').val());
var userName=body.find('#userName').val();
$("#emailToName").val(userName+"("+body.find('#email').val()+")");
layer.close(index);
}
// 上传文件
function sendFile(file, obj) {
var data = new FormData();
data.append("file", file);
$.ajax({
type: "POST",
url: "common/upload",
data: data,
cache: false,
contentType: false,
processData: false,
dataType: 'json',
success: function(result) {
if (result.code == web_status.SUCCESS) {
$(obj).summernote('editor.insertImage', result.url, result.fileName);
} else {
$.modal.alertError(result.msg);
}
},
error: function(error) {
$.modal.alertWarning("图片上传失败。");
}
});
}
function sendEmail(emailStatus) {
var emailLabel= $("input[name='emailLabel']:checked").val();
if($.common.isEmpty(emailLabel)){
$.modal.msgWarning("请选择邮件标签");
return false;
}
var emailTo=$("#emailTo").val();
if($.common.isEmpty(emailTo)){
$.modal.msgWarning("请输入收件人");
return false;
}
var subject=$("#subject").val();
if($.common.isEmpty(subject)){
$.modal.msgWarning("请输入邮件主题");
return false;
}
var sHTML = $('.summernote').summernote('code');
$("#emailContent").val(sHTML);
if($.common.isEmpty(sHTML)){
$.modal.msgWarning("请输入邮件内容");
return false;
}
$.operate.save(prefix + "/sendSysEmail",{
"emailLabel":emailLabel,
"emailTo": emailTo,
"emailSubject":subject,
"emailStatus":emailStatus,
"emailContent":$("#emailContent").val()
});
}
</script>
</body>
</html>

View File

@ -0,0 +1,112 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>邮件详情</title>
<link th:href="@{/css/bootstrap.min.css}" rel="stylesheet">
<link th:href="@{/css/font-awesome.min.css}" rel="stylesheet"/>
<link th:href="@{/css/iCheck/custom.css}" rel="stylesheet">
<link th:href="@{/css/animate.css}" rel="stylesheet">
<link th:href="@{/css/style.css}" rel="stylesheet">
<link th:href="#{/css/iCheck/custom.css}" rel="stylesheet">
</head>
<body>
<div id="wrapper">
<div class="wrapper wrapper-content gray-bg">
<div class="row">
<th:block th:include="include :: emailNavPage" />
<div class="col-lg-9 animated fadeInRight">
<div class="mail-box-header">
<div class="pull-right tooltip-demo">
<a href="/system/email" class="btn btn-success btn-sm" data-toggle="tooltip" data-placement="top" title="Reply"><i class="fa fa-reply"></i> Reply</a>
<a href="#" class="btn btn-info btn-sm" data-toggle="tooltip" data-placement="top" title="Print email"><i class="fa fa-print"></i> </a>
<button class="btn btn-danger btn-sm" data-toggle="tooltip" data-placement="top" title="移到垃圾箱" onclick="remarkTrash()"><i class="fa fa-trash-o"></i> </button>
</div>
<h2>
Ding-Flow在线邮件
</h2>
<div class="mail-tools tooltip-demo m-t-md">
<input type="hidden" th:value="${sysOaEmail.id}" id="id">
<h3>
<span class="font-normal">主题: </span><span th:text="${sysOaEmail.emailSubject}"></span>
</h3>
<h5>
<span class="pull-right font-normal" th:text="${#dates.format(sysOaEmail.sendTime, 'yyyy-MM-dd hh:mm:ss')}"></span>
<span class="font-normal">From: </span><span th:text="${sysOaEmail.emailFromUser.email}"></span>
</h5>
</div>
</div>
<div class="mail-box">
<div class="mail-body" th:utext="${sysOaEmail.emailContent}">
</div>
<div class="mail-body text-right tooltip-demo">
<a class="btn btn-sm btn-success" href="/system/email"><i class="fa fa-reply"></i> Reply</a>
<!-- <a class="btn btn-sm btn-info" href="/system/email"><i class="fa fa-arrow-right"></i> Forward</a>-->
<!-- <button title="" data-placement="top" data-toggle="tooltip" type="button" data-original-title="Print" class="btn btn-sm btn-white"><i class="fa fa-print"></i> Print</button>-->
<button class="btn btn-danger btn-sm" data-toggle="tooltip" data-placement="top" title="移到垃圾箱" onclick="remarkTrash()"><i class="fa fa-trash-o"></i> </button>
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
</div>
</div>
<script th:src="@{/js/jquery.js}"></script>
<script th:src="@{/js/bootstrap.min.js}"></script>
<script th:src="@{/js/plugins/slimscroll/jquery.slimscroll.min.js}"></script>
<script th:src="@{/js/plugins/pace/pace.min.js}"></script>
<script th:src="@{/ajax/libs/iCheck/icheck.min.js}"></script>
<script th:src="@{/ajax/libs/layer/layer.min.js}"></script>
<script th:src="@{/ajax/libs/layui/layui.js}"></script>
<script th:src="@{/ruoyi/js/common.js}"></script>
<script th:src="@{/ruoyi/js/ry-ui.js}"></script>
<script th:src="@{/ajax/libs/blockUI/jquery.blockUI.js}"></script>
<script th:src="@{/ajax/libs/bootstrap-table/bootstrap-table.min.js?v=20200727}"></script>
<script th:src="@{/ajax/libs/bootstrap-table/locale/bootstrap-table-zh-CN.min.js?v=20200727}"></script>
<script th:src="@{/ajax/libs/bootstrap-table/extensions/mobile/bootstrap-table-mobile.js?v=20200727}"></script>
<script>
var prefix = "/system/email";
$(document).ready(function(){
$('.i-checks').iCheck({
checkboxClass: 'icheckbox_square-green',
radioClass: 'iradio_square-green',
});
$.get(prefix+"/getSysOaEmailData", function(data) {
if (data.code == web_status.SUCCESS ) {
var sysOaEmailData=data.data;
$("#readTotal").text(sysOaEmailData.readTotal);
$("#draftsTotal").text(sysOaEmailData.draftsTotal);
} else if (data.code == web_status.WARNING) {
$.modal.alertWarning(data.msg)
} else {
$.modal.alertError(data.msg);
}
});
});
function remarkTrash(){
$.operate.save(prefix + "/remarkDelete",{
"ids":$("#id").val()
});
}
</script>
</body>
</html>

View File

@ -0,0 +1,212 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>邮件列表</title>
<link th:href="@{/css/bootstrap.min.css}" rel="stylesheet">
<link th:href="@{/css/font-awesome.min.css}" rel="stylesheet"/>
<link th:href="@{/css/iCheck/custom.css}" rel="stylesheet">
<link th:href="@{/css/animate.css}" rel="stylesheet">
<link th:href="@{/css/style.css}" rel="stylesheet">
<link th:href="#{/css/iCheck/custom.css}" rel="stylesheet">
<style type="text/css">
#bootstrap-table {border-left: 0px; border-right:0px}
#bootstrap-table th{border-left: 0px; border-right: 0px}
#bootstrap-table td{border-left: 0px; border-right: 0px}
</style>
</head>
<body>
<div id="wrapper">
<div class="wrapper wrapper-content gray-bg">
<div class="row">
<th:block th:include="include :: emailNavPage" />
<div class="col-lg-9 animated fadeInRight">
<div class="mail-box-header">
<form class="pull-right mail-search select-list" id="formId">
<div class="input-group">
<input type="hidden" name="mailSearchType" th:value="${mailType}" id="mailType" >
<input type="text" class="form-control input-sm" name="emailFrom" placeholder="Search email">
<div class="input-group-btn">
<a onclick="$.table.search()" class="btn btn-sm btn-primary">
Search
</a>
</div>
</div>
</form>
<h2>
Ding-Flow邮件列表
</h2>
<div class="mail-tools tooltip-demo m-t-md">
<button th:if="${mailType eq 4}" class="btn btn-danger btn-sm" data-toggle="tooltip" data-placement="left" title="删除" onclick="markDelete()"><i class="fa fa-remove"></i></button>
<button th:if="${mailType eq 6||mailType eq 3}" class="btn btn-success btn-sm" data-toggle="tooltip" data-placement="top" title="标记为已读" onclick="markRead()"><i class="fa fa-eye"></i> </button>
<button th:if="${mailType eq 6||mailType eq 7}" class="btn btn-warning btn-sm" data-toggle="tooltip" data-placement="top" title="标记为重要邮件" onclick="remarkImportant()"><i class="fa fa-star"></i> </button>
<button th:if="${mailType eq 6||mailType eq 3 ||mailType eq 1}" class="btn btn-danger btn-sm" data-toggle="tooltip" data-placement="top" title="移到垃圾箱" onclick="remarkTrash()"><i class="fa fa-trash-o"></i> </button>
</div>
</div>
<div class="mail-box">
<table id="bootstrap-table" class="table table-hover table-mail table-no-borde">
</table>
</div>
</div>
</div>
</div>
</div>
<!-- Mainly scripts -->
<script th:src="@{/js/jquery.js}"></script>
<script th:src="@{/js/bootstrap.min.js}"></script>
<script th:src="@{/js/plugins/slimscroll/jquery.slimscroll.min.js}"></script>
<script th:src="@{/js/plugins/pace/pace.min.js}"></script>
<script th:src="@{/ajax/libs/iCheck/icheck.min.js}"></script>
<script th:src="@{/ajax/libs/layer/layer.min.js}"></script>
<script th:src="@{/ajax/libs/layui/layui.js}"></script>
<script th:src="@{/ruoyi/js/common.js}"></script>
<script th:src="@{/ruoyi/js/ry-ui.js}"></script>
<script th:src="@{/ajax/libs/blockUI/jquery.blockUI.js}"></script>
<script th:src="@{/ajax/libs/bootstrap-table/bootstrap-table.min.js?v=20200727}"></script>
<script th:src="@{/ajax/libs/bootstrap-table/locale/bootstrap-table-zh-CN.min.js?v=20200727}"></script>
<script th:src="@{/ajax/libs/bootstrap-table/extensions/mobile/bootstrap-table-mobile.js?v=20200727}"></script>
<!--<th:block th:include="include :: footer" />-->
<script>
var prefix = "/system/email";
$(document).ready(function(){
$('.i-checks').iCheck({
checkboxClass: 'icheckbox_square-green',
radioClass: 'iradio_square-green'
});
$.get(prefix+"/getSysOaEmailData", function(data) {
if (data.code == web_status.SUCCESS ) {
var sysOaEmailData=data.data;
$("#readTotal").text(sysOaEmailData.readTotal);
$("#draftsTotal").text(sysOaEmailData.draftsTotal);
} else if (data.code == web_status.WARNING) {
$.modal.alertWarning(data.msg)
} else {
$.modal.alertError(data.msg);
}
});
});
var options = {
url: prefix + "/list",
rememberSelected: true,
modalName: "邮件",
showToggle:false,
showHeader:false,
showSearch:false,
showRefresh:false,
showColumns:false,
queryParams: queryParams,
striped:true,
height:'30px',
columns: [{
field: 'state',
checkbox: true,
formatter: function(value, row, index) {
var isRead= row.isRead;
if(isRead==0){
return { disabled : false}
}else {
return { disabled : true}
}
}
},
{
field: 'id',
title: 'id',
visible: false
},
{
field: 'isRead',
title: '是否已读',
width: 120,
align:'left',
formatter: function(value, row, index) {
if(value==0){
return '<span class="label label-danger pull-right">未读</span>';
}else {
return '<span class="label label-info pull-right">已读</span>';
}
}
},
{
field: 'emailSubject',
title: '邮件主题',
align:'center',
formatter: function(value, row, index) {
console.log(row.id)
return '<a href="/system/email/mailDetail/'+row.id+'">'+value+'</a>';
}
},
{
field: 'sendTime',
title: '发送时间',
width: 220,
align: 'right'
}
]
};
$.table.init(options);
function queryParams(params) {
var search = $.table.queryParams(params);
return search;
}
// 选中数据
function markRead(){
var arrays = $.table.selectColumns("id");
if($.common.isEmpty(arrays)){
$.modal.msgWarning("请至少选择一条记录");
return false;
}
$.operate.save(prefix + "/remarkRead",{
"ids":arrays.join()
});
}
function remarkImportant(){
var arrays = $.table.selectColumns("id");
if($.common.isEmpty(arrays)){
$.modal.msgWarning("请至少选择一条记录");
return false;
}
$.operate.save(prefix + "/remarkImportant",{
"ids":arrays.join()
});
//todo 保存成功后只刷新当前页面
}
function remarkTrash(){
var arrays = $.table.selectColumns("id");
if($.common.isEmpty(arrays)){
$.modal.msgWarning("请至少选择一条记录");
return false;
}
$.operate.save(prefix + "/remarkTrash",{
"ids":arrays.join()
});
}
function markDelete(){
var arrays = $.table.selectColumns("id");
if($.common.isEmpty(arrays)){
$.modal.msgWarning("请至少选择一条记录");
return false;
}
$.operate.save(prefix + "/markDelete",{
"ids":arrays.join()
});
}
</script>
</body>
</html>

View File

@ -10,6 +10,7 @@
<label class="col-sm-3 control-label">父消息节点:</label>
<div class="col-sm-8">
<div class="input-group">
<input id="parentId" name="parentId" type="hidden" th:value="${sysNewsNode?.id}">
<input class="form-control" type="text" onclick="selectNodeTree()" id="treeName" readonly="true" th:value="${sysNewsNode?.newsNodeName}">
<span class="input-group-addon"><i class="fa fa-search"></i></span>
</div>
@ -63,7 +64,8 @@
function doSubmit(index, layero){
var body = layer.getChildFrame('body', index);
$("#treeId").val(body.find('#treeId').val());
console.log(body)
$("#parentId").val(body.find('#treeId').val());
$("#treeName").val(body.find('#treeName').val());
layer.close(index);
}

View File

@ -81,11 +81,6 @@
title: '祖级列表',
align: 'left'
},*/
{
field: 'orderNum',
title: '显示顺序',
align: 'left'
},
{
title: '操作',
align: 'center',

View File

@ -7,12 +7,12 @@
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<div class="col-sm-11 search-collapse">
<form id="role-form">
<div class="select-list">
<ul>
<li>
登录名称:<input type="text" name="loginName"/>
用户名称:<input type="text" name="userName"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
@ -26,6 +26,7 @@
<div class="col-sm-12 select-table table-striped">
<input id="id" name="id" type="hidden" />
<input id="userName" name="userName" type="hidden" />
<input id="email" name="email" type="hidden" />
<table id="bootstrap-table"></table>
</div>
</form>
@ -46,7 +47,7 @@
showColumns: false,
clickToSelect: true,
singleSelect:true,
rememberSelected: true,
rememberSelected: false,
columns: [{
field: 'state',
checkbox: true
@ -78,13 +79,27 @@
var rows = $.table.selectFirstColumns();
var id=$.table.selectNColumns(1);
var userName=$.table.selectNColumns(2);
var email=$.table.selectNColumns(3);
if (rows.length == 0) {
$.modal.alertWarning("请至少选择一条记录");
return;
}
$("#id").val(id);
$("#userName").val(userName);
$("#email").val(email);
}
// 选中数据
function markRead(){
var arrays = $.table.selectColumns("id");
if($.common.isEmpty(arrays)){
$.modal.msgWarning("请至少选择一条记录");
return false;
}
$.operate.save(prefix + "/remarkRead",{
"ids":arrays.join()
});
}
</script>
</body>
</html>

View File

@ -6,7 +6,7 @@ package com.snow.common.constant;
* @Description:
* @date 2020/11/23 16:39
*/
public class SequenceContants {
public class SequenceConstants {
/**
*请假单
*/
@ -22,5 +22,9 @@ public class SequenceContants {
*/
public static final String OA_RESIGN_SEQUENCE="OA_LZ";
/**
* 邮件编码
*/
public static final String OA_EMAIL_SEQUENCE="OA_YJ";
}

View File

@ -0,0 +1,33 @@
package com.snow.common.enums;
/**
* email搜索类型
*/
public enum SysEmailSearchType {
COMMON(0, "common"),
INBOX(6, "inbox"),
SEND_MAIL(7, "send_mail"),
IMPORTANT(3, "important"),
DRAFTS(1, "drafts"),
TRASH(4, "trash");
private final Integer code;
private final String info;
SysEmailSearchType(Integer code, String info)
{
this.code = code;
this.info = info;
}
public Integer getCode()
{
return code;
}
public String getInfo()
{
return info;
}
}

View File

@ -63,12 +63,13 @@ public class SendMessageEventLister extends AbstractEventListener {
new HashSet<>(Arrays.asList(
FlowableEngineEventType.TASK_CREATED,
FlowableEngineEventType.PROCESS_STARTED,
FlowableEngineEventType.PROCESS_COMPLETED,
FlowableEngineEventType.TASK_OWNER_CHANGED
FlowableEngineEventType.PROCESS_COMPLETED
// FlowableEngineEventType.TASK_OWNER_CHANGED
)),
new HashSet<>(Arrays.asList(
FlowDefEnum.SNOW_OA_LEAVE,
FlowDefEnum.PURCHASE_ORDER_PROCESS
FlowDefEnum.PURCHASE_ORDER_PROCESS,
FlowDefEnum.SNOW_OA_RESIGN_PROCESS
)));
}
@ -198,7 +199,7 @@ public class SendMessageEventLister extends AbstractEventListener {
.receiver(getUserInfo(processInstance.getStartUserId()).getEmail())
.paramMap(map)
.build();
mailService.sendSimpleMail(sysSendMessageDTO);
mailService.sendTemplateSimpleMail(sysSendMessageDTO);
});
executor.shutdown();
@ -238,7 +239,7 @@ public class SendMessageEventLister extends AbstractEventListener {
.receiver(t.getEmail())
.paramMap(map)
.build();
mailService.sendSimpleMail(sysSendMessageDTO);
mailService.sendTemplateSimpleMail(sysSendMessageDTO);
})
);
executor.shutdown();
@ -302,7 +303,7 @@ public class SendMessageEventLister extends AbstractEventListener {
.receiver(getUserInfo(hisProcessInstance.getStartUserId()).getEmail())
.paramMap(map)
.build();
mailService.sendSimpleMail(sysSendMessageDTO);
mailService.sendTemplateSimpleMail(sysSendMessageDTO);
});
executor.shutdown();

View File

@ -0,0 +1,64 @@
package com.snow.framework.web.domain.common;
import lombok.*;
import java.io.Serializable;
import java.util.Date;
import java.util.Map;
import java.util.Set;
/**
* @program: snow
* @description
* @author: 没用的阿吉
* @create: 2021-03-12 19:25
**/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
@Builder
public class SysSendEmailDTO implements Serializable {
private static final long serialVersionUID = -3505555356014745742L;
private String templateByCode;
/**
* 发送人
*/
private String from;
/**
* 主题
*/
private String subject;
/**
* 内容
*/
private String content;
/**
* 接收人set集合
*/
private Set receiverSet;
/**
* 抄送人
*/
private Set CCSet;
/**
* 文件path
*/
private String filePath;
/**
* 发送时间
*/
private Date sentDate;
/**
* 参数List
*/
private Map<String,String> paramMap;
}

View File

@ -29,6 +29,10 @@ public class SysSendMessageDTO implements Serializable {
private String templateByCode;
/**
* 发送人
*/
private String from;
/**
* 参数List
*/

View File

@ -2,11 +2,15 @@ package com.snow.framework.web.service;
import com.snow.common.utils.PatternUtils;
import com.snow.common.utils.StringUtils;
import com.snow.framework.web.domain.common.SysSendEmailDTO;
import com.snow.framework.web.domain.common.SysSendMessageDTO;
import com.snow.system.domain.SysMessageTemplate;
import com.snow.system.domain.SysOaEmail;
import com.snow.system.service.ISysMessageTemplateService;
import com.snow.system.service.impl.SysOaEmailServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.FileSystemResource;
import org.springframework.mail.SimpleMailMessage;
@ -39,11 +43,13 @@ public class MailService {
@Value("${spring.mail.username}")
private String from;
@Autowired
private SysOaEmailServiceImpl sysOaEmailService;
/**
* 简单文本邮件
* @param sysSendMessageDTO 对象
*/
public void sendSimpleMail(SysSendMessageDTO sysSendMessageDTO) {
public void sendTemplateSimpleMail(SysSendMessageDTO sysSendMessageDTO) {
SysMessageTemplate sysMessageTemplate= sysMessageTemplateService.getSysMessageTemplateByCode(sysSendMessageDTO.getTemplateByCode());
Set<String> receiverSet = sysSendMessageDTO.getReceiverSet();
Set<String> ccSet = sysSendMessageDTO.getCCSet();
@ -76,9 +82,10 @@ public class MailService {
* HTML 文本邮件
* @param sysSendMessageDTO
*/
public void sendHtmlMail(SysSendMessageDTO sysSendMessageDTO) {
public void sendTemplateHtmlMail(SysSendMessageDTO sysSendMessageDTO) {
SysMessageTemplate sysMessageTemplate= sysMessageTemplateService.getSysMessageTemplateByCode(sysSendMessageDTO.getTemplateByCode());
Set<String> receiverSet = sysSendMessageDTO.getReceiverSet();
Set<String> ccSet = sysSendMessageDTO.getCCSet();
try {
MimeMessage message = mailSender.createMimeMessage();
MimeMessageHelper helper = new MimeMessageHelper(message, true);
@ -89,10 +96,13 @@ public class MailService {
if (CollectionUtils.isNotEmpty(sysSendMessageDTO.getReceiverSet())) {
helper.setTo(receiverSet.toArray(new String[0]));
}
if(CollectionUtils.isNotEmpty(ccSet)){
helper.setCc(ccSet.toArray(new String[0]));
}
helper.setText(PatternUtils.builderTemplateBody(sysSendMessageDTO.getParamMap(),sysMessageTemplate.getTemplateBody()), true);
helper.setFrom(from);
if(null != sysSendMessageDTO.getSentDate()){
message.setSentDate(sysSendMessageDTO.getSentDate());
helper.setSentDate(sysSendMessageDTO.getSentDate());
}
mailSender.send(message);
} catch (MessagingException e) {
@ -106,9 +116,10 @@ public class MailService {
* @param sysSendMessageDTO 接收者邮件
* @throws MessagingException
*/
public void sendAttachmentsMail(SysSendMessageDTO sysSendMessageDTO) {
public void sendTemplateAttachmentsMail(SysSendMessageDTO sysSendMessageDTO) {
SysMessageTemplate sysMessageTemplate= sysMessageTemplateService.getSysMessageTemplateByCode(sysSendMessageDTO.getTemplateByCode());
Set<String> receiverSet = sysSendMessageDTO.getReceiverSet();
Set<String> ccSet = sysSendMessageDTO.getCCSet();
try {
MimeMessage message = mailSender.createMimeMessage();
MimeMessageHelper helper = new MimeMessageHelper(message, true);
@ -121,6 +132,9 @@ public class MailService {
if (CollectionUtils.isNotEmpty(sysSendMessageDTO.getReceiverSet())) {
helper.setTo(receiverSet.toArray(new String[0]));
}
if(CollectionUtils.isNotEmpty(ccSet)){
helper.setCc(ccSet.toArray(new String[0]));
}
if(null != sysSendMessageDTO.getSentDate()){
message.setSentDate(sysSendMessageDTO.getSentDate());
}
@ -134,4 +148,38 @@ public class MailService {
}
}
/**
* 发送邮件
* @param SysSendEmailDTO
*/
public void sendHtmlMail(SysSendEmailDTO SysSendEmailDTO) {
Set<String> receiverSet = SysSendEmailDTO.getReceiverSet();
Set<String> ccSet = SysSendEmailDTO.getCCSet();
try {
MimeMessage message = mailSender.createMimeMessage();
MimeMessageHelper helper = new MimeMessageHelper(message, true);
helper.setFrom(SysSendEmailDTO.getFrom());
helper.setSubject(SysSendEmailDTO.getSubject());
helper.setText(SysSendEmailDTO.getContent());
if (CollectionUtils.isNotEmpty(receiverSet)) {
helper.setTo(receiverSet.toArray(new String[0]));
}
if(CollectionUtils.isNotEmpty(ccSet)){
helper.setCc(ccSet.toArray(new String[0]));
}
if(null != SysSendEmailDTO.getSentDate()){
helper.setSentDate(SysSendEmailDTO.getSentDate());
}
mailSender.send(message);
}catch (Exception e){
SysOaEmail sysOaEmail=new SysOaEmail();
sysOaEmail.setEmailNo(SysSendEmailDTO.getTemplateByCode());
sysOaEmail.setIsSuccess(1);
sysOaEmail.setErrorInfo(e.getMessage());
sysOaEmailService.updateSysOaEmailByEmailNo(sysOaEmail);
log.error("调用sendSimpleMail发送邮件失败:{}",e.getMessage());
}
}
}

View File

@ -0,0 +1,99 @@
package com.snow.system.domain;
import java.util.Date;
import com.snow.common.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.snow.common.core.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 邮件对象 sys_oa_email
*
* @author 没用的阿吉
* @date 2021-03-12
*/
@Data
public class SysOaEmail extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 邮件编号 */
@Excel(name = "邮件编号")
private String emailNo;
/** 邮件主题 */
@Excel(name = "邮件主题")
private String emailSubject;
/** 邮件内容 */
@Excel(name = "邮件内容")
private String emailContent;
/** 收件人 */
@Excel(name = "收件人")
private String emailTo;
/**
* 收件人
*/
private SysUser emailToUser;
/** 发件人 */
@Excel(name = "发件人")
private String emailFrom;
/**
* 发件人邮件
*/
private SysUser emailFromUser;
/** 发送时间 */
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "发送时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date sendTime;
/** 邮件类型0--发1-收) */
private Long emailType;
/** 邮件状态0--普通邮件1-草稿2--已发送3--重要邮件4--已删除) */
@Excel(name = "邮件状态", readConverterExp = "0=--普通邮件1-草稿2--已发送3--重要邮件4--已删除")
private Long emailStatus;
/** 邮件标签 */
@Excel(name = "邮件标签")
private Long emailLabel;
/** 所属人id */
private String belongUserId;
private String belongUserName;
/** 是否已读0--未读1--已读) */
@Excel(name = "是否已读", readConverterExp = "0=--未读1--已读")
private Long isRead;
/** 删除标识0--正常1--删除) */
private Long isDelete;
/** 附件 */
private String fileUrl;
/**
* 是否成功0--成功
*/
private Integer isSuccess;
/**
* 失败信息
*/
private String errorInfo;
/**
* 查询类型
*/
private Integer mailSearchType;
}

View File

@ -0,0 +1,52 @@
package com.snow.system.domain;
import lombok.*;
import java.io.Serializable;
/**
* @program: snow
* @description
* @author: 没用的阿吉
* @create: 2021-03-13 18:55
**/
@Data
@Builder
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class SysOaEmailDataVO implements Serializable {
/**
* 收件数
*/
private Long inboxTotal;
/**
* 发件数
*/
private Long sendMailTotal;
/**
* 重要数 针对收的和发的邮件
*/
private Long importantTotal;
/**
* 草稿数 草稿是对发的邮件存为草稿
*/
private Long draftsTotal;
/**
* 垃圾箱数 垃圾是标记收的邮件标
*/
private Long trashTotal;
/**
* 已读数 收的邮件
*/
private Long readTotal;
}

View File

@ -0,0 +1,75 @@
package com.snow.system.mapper;
import java.util.List;
import com.snow.system.domain.SysOaEmail;
/**
* 邮件Mapper接口
*
* @author 没用的阿吉
* @date 2021-03-12
*/
public interface SysOaEmailMapper
{
/**
* 查询邮件
*
* @param id 邮件ID
* @return 邮件
*/
public SysOaEmail selectSysOaEmailById(Long id);
/**
* 查询邮件列表
*
* @param sysOaEmail 邮件
* @return 邮件集合
*/
public List<SysOaEmail> selectSysOaEmailList(SysOaEmail sysOaEmail);
/**
* 查询重要邮件
* @param sysOaEmail
* @return
*/
public List<SysOaEmail> selectImportantEmailList(SysOaEmail sysOaEmail);
/**
* 新增邮件
*
* @param sysOaEmail 邮件
* @return 结果
*/
public int insertSysOaEmail(SysOaEmail sysOaEmail);
/**
* 修改邮件
*
* @param sysOaEmail 邮件
* @return 结果
*/
public int updateSysOaEmail(SysOaEmail sysOaEmail);
/**
*
* @param sysOaEmail
* @return
*/
public int updateSysOaEmailByEmailNo(SysOaEmail sysOaEmail);
/**
* 删除邮件
*
* @param id 邮件ID
* @return 结果
*/
public int deleteSysOaEmailById(Long id);
/**
* 批量删除邮件
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteSysOaEmailByIds(String[] ids);
}

View File

@ -0,0 +1,77 @@
package com.snow.system.service;
import java.util.List;
import com.snow.system.domain.SysOaEmail;
/**
* 邮件Service接口
*
* @author 没用的阿吉
* @date 2021-03-12
*/
public interface ISysOaEmailService
{
/**
* 查询邮件
*
* @param id 邮件ID
* @return 邮件
*/
public SysOaEmail selectSysOaEmailById(Long id);
/**
* 查询邮件列表
*
* @param sysOaEmail 邮件
* @return 邮件集合
*/
public List<SysOaEmail> selectSysOaEmailList(SysOaEmail sysOaEmail);
/**
* 新增邮件
*
* @param sysOaEmail 邮件
* @return 结果
*/
public int insertSysOaEmail(SysOaEmail sysOaEmail);
/**
* 修改邮件
*
* @param sysOaEmail 邮件
* @return 结果
*/
public int updateSysOaEmail(SysOaEmail sysOaEmail);
/**
* 批量删除邮件
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteSysOaEmailByIds(String ids);
/**
* 删除邮件信息
*
* @param id 邮件ID
* @return 结果
*/
public int deleteSysOaEmailById(Long id);
/**
* 查询重要邮件
* @param sysOaEmail
* @return
*/
public List<SysOaEmail> selectImportantEmailList(SysOaEmail sysOaEmail);
/**
* 修改
* @param sysOaEmail
* @return
*/
public int updateSysOaEmailByEmailNo(SysOaEmail sysOaEmail);
}

View File

@ -0,0 +1,131 @@
package com.snow.system.service.impl;
import java.util.List;
import com.snow.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.snow.system.mapper.SysOaEmailMapper;
import com.snow.system.domain.SysOaEmail;
import com.snow.system.service.ISysOaEmailService;
import com.snow.common.core.text.Convert;
/**
* 邮件Service业务层处理
*
* @author 没用的阿吉
* @date 2021-03-12
*/
@Service
public class SysOaEmailServiceImpl implements ISysOaEmailService
{
@Autowired
private SysOaEmailMapper sysOaEmailMapper;
@Autowired
private SysUserServiceImpl sysUserService;
/**
* 查询邮件
*
* @param id 邮件ID
* @return 邮件
*/
@Override
public SysOaEmail selectSysOaEmailById(Long id)
{
SysOaEmail sysOaEmail=sysOaEmailMapper.selectSysOaEmailById(id);
sysOaEmail.setEmailFromUser(sysUserService.selectUserById(Long.parseLong(sysOaEmail.getEmailFrom())));
sysOaEmail.setEmailToUser(sysUserService.selectUserById(Long.parseLong(sysOaEmail.getEmailTo())));
return sysOaEmail;
}
/**
* 查询邮件列表
*
* @param sysOaEmail 邮件
* @return 邮件
*/
@Override
public List<SysOaEmail> selectSysOaEmailList(SysOaEmail sysOaEmail)
{
List<SysOaEmail> sysOaEmailList=sysOaEmailMapper.selectSysOaEmailList(sysOaEmail);
sysOaEmailList.parallelStream().forEach(t->{
t.setEmailFromUser(sysUserService.selectUserById(Long.parseLong(t.getEmailFrom())));
t.setEmailToUser(sysUserService.selectUserById(Long.parseLong(t.getEmailTo())));
});
return sysOaEmailMapper.selectSysOaEmailList(sysOaEmail);
}
/**
* 新增邮件
*
* @param sysOaEmail 邮件
* @return 结果
*/
@Override
public int insertSysOaEmail(SysOaEmail sysOaEmail)
{
sysOaEmail.setCreateTime(DateUtils.getNowDate());
return sysOaEmailMapper.insertSysOaEmail(sysOaEmail);
}
/**
* 修改邮件
*
* @param sysOaEmail 邮件
* @return 结果
*/
@Override
public int updateSysOaEmail(SysOaEmail sysOaEmail)
{
sysOaEmail.setUpdateTime(DateUtils.getNowDate());
return sysOaEmailMapper.updateSysOaEmail(sysOaEmail);
}
/**
* 删除邮件对象
*
* @param ids 需要删除的数据ID
* @return 结果
*/
@Override
public int deleteSysOaEmailByIds(String ids)
{
return sysOaEmailMapper.deleteSysOaEmailByIds(Convert.toStrArray(ids));
}
/**
* 删除邮件信息
*
* @param id 邮件ID
* @return 结果
*/
@Override
public int deleteSysOaEmailById(Long id)
{
return sysOaEmailMapper.deleteSysOaEmailById(id);
}
/**
* 查询重要
* @param sysOaEmail
* @return
*/
@Override
public List<SysOaEmail> selectImportantEmailList(SysOaEmail sysOaEmail) {
List<SysOaEmail> sysOaEmailList=sysOaEmailMapper.selectImportantEmailList(sysOaEmail);
sysOaEmailList.parallelStream().forEach(t->{
t.setEmailFromUser(sysUserService.selectUserById(Long.parseLong(t.getEmailFrom())));
t.setEmailToUser(sysUserService.selectUserById(Long.parseLong(t.getEmailTo())));
});
return sysOaEmailList;
}
@Override
public int updateSysOaEmailByEmailNo(SysOaEmail sysOaEmail) {
sysOaEmail.setUpdateTime(DateUtils.getNowDate());
return sysOaEmailMapper.updateSysOaEmailByEmailNo(sysOaEmail);
}
}

View File

@ -0,0 +1,172 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.snow.system.mapper.SysOaEmailMapper">
<resultMap type="SysOaEmail" id="SysOaEmailResult">
<result property="id" column="id" />
<result property="emailNo" column="email_no" />
<result property="emailSubject" column="email_subject" />
<result property="emailContent" column="email_content" />
<result property="emailTo" column="email_to" />
<result property="emailFrom" column="email_from" />
<result property="sendTime" column="send_time" />
<result property="emailType" column="email_type" />
<result property="emailStatus" column="email_status" />
<result property="emailLabel" column="email_label" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="belongUserId" column="belong_user_id" />
<result property="isRead" column="is_read" />
<result property="isDelete" column="is_delete" />
<result property="fileUrl" column="file_url" />
<result property="isSuccess" column="is_success" />
<result property="errorInfo" column="error_info" />
</resultMap>
<sql id="selectSysOaEmailVo">
select id, email_no, email_subject, email_content, is_success,email_to, email_from, send_time, email_type, email_status, email_label, create_by, create_time, update_time, update_by, belong_user_id, is_read, is_delete, file_url from sys_oa_email
</sql>
<select id="selectSysOaEmailList" parameterType="SysOaEmail" resultMap="SysOaEmailResult">
<include refid="selectSysOaEmailVo"/>
<where>
<if test="emailNo != null and emailNo != ''"> and email_no = #{emailNo}</if>
<if test="emailSubject != null and emailSubject != ''"> and email_subject = #{emailSubject}</if>
<if test="emailContent != null and emailContent != ''"> and email_content = #{emailContent}</if>
<if test="emailTo != null and emailTo != ''"> and email_to = #{emailTo}</if>
<if test="emailFrom != null and emailFrom != ''"> and email_from = #{emailFrom}</if>
<if test="sendTime != null "> and send_time = #{sendTime}</if>
<if test="emailStatus != null "> and email_status = #{emailStatus}</if>
<if test="emailLabel != null "> and email_label = #{emailLabel}</if>
<if test="isRead != null "> and is_read = #{isRead}</if>
<if test="isSuccess != null "> and is_success = #{isSuccess}</if>
</where>
</select>
<select id="selectImportantEmailList" parameterType="SysOaEmail" resultMap="SysOaEmailResult">
<include refid="selectSysOaEmailVo"/>
where (email_to = #{emailTo} or email_from = #{emailFrom}) and email_status =3
</select>
<select id="selectSysOaEmailById" parameterType="Long" resultMap="SysOaEmailResult">
<include refid="selectSysOaEmailVo"/>
where id = #{id}
</select>
<insert id="insertSysOaEmail" parameterType="SysOaEmail" useGeneratedKeys="true" keyProperty="id">
insert into sys_oa_email
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="emailNo != null">email_no,</if>
<if test="emailSubject != null">email_subject,</if>
<if test="emailContent != null">email_content,</if>
<if test="emailTo != null">email_to,</if>
<if test="emailFrom != null">email_from,</if>
<if test="sendTime != null">send_time,</if>
<if test="emailType != null">email_type,</if>
<if test="emailStatus != null">email_status,</if>
<if test="emailLabel != null">email_label,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="belongUserId != null">belong_user_id,</if>
<if test="isRead != null">is_read,</if>
<if test="isDelete != null">is_delete,</if>
<if test="fileUrl != null">file_url,</if>
<if test="isSuccess != null "> is_success,</if>
<if test="errorInfo != null">error_info,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="emailNo != null">#{emailNo},</if>
<if test="emailSubject != null">#{emailSubject},</if>
<if test="emailContent != null">#{emailContent},</if>
<if test="emailTo != null">#{emailTo},</if>
<if test="emailFrom != null">#{emailFrom},</if>
<if test="sendTime != null">#{sendTime},</if>
<if test="emailType != null">#{emailType},</if>
<if test="emailStatus != null">#{emailStatus},</if>
<if test="emailLabel != null">#{emailLabel},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="belongUserId != null">#{belongUserId},</if>
<if test="isRead != null">#{isRead},</if>
<if test="isDelete != null">#{isDelete},</if>
<if test="fileUrl != null">#{fileUrl},</if>
<if test="isSuccess != null ">#{isSuccess},</if>
<if test="errorInfo != null">#{errorInfo},</if>
</trim>
</insert>
<update id="updateSysOaEmail" parameterType="SysOaEmail">
update sys_oa_email
<trim prefix="SET" suffixOverrides=",">
<if test="emailNo != null">email_no = #{emailNo},</if>
<if test="emailSubject != null">email_subject = #{emailSubject},</if>
<if test="emailContent != null">email_content = #{emailContent},</if>
<if test="emailTo != null">email_to = #{emailTo},</if>
<if test="emailFrom != null">email_from = #{emailFrom},</if>
<if test="sendTime != null">send_time = #{sendTime},</if>
<if test="emailType != null">email_type = #{emailType},</if>
<if test="emailStatus != null">email_status = #{emailStatus},</if>
<if test="emailLabel != null">email_label = #{emailLabel},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="belongUserId != null">belong_user_id = #{belongUserId},</if>
<if test="isRead != null">is_read = #{isRead},</if>
<if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="fileUrl != null">file_url = #{fileUrl},</if>
<if test="isSuccess != null "> is_success = #{isSuccess},</if>
<if test="errorInfo != null">error_info = #{errorInfo},</if>
</trim>
where id = #{id}
</update>
<update id="updateSysOaEmailByEmailNo" parameterType="SysOaEmail">
update sys_oa_email
<trim prefix="SET" suffixOverrides=",">
<if test="emailNo != null">email_no = #{emailNo},</if>
<if test="emailSubject != null">email_subject = #{emailSubject},</if>
<if test="emailContent != null">email_content = #{emailContent},</if>
<if test="emailTo != null">email_to = #{emailTo},</if>
<if test="emailFrom != null">email_from = #{emailFrom},</if>
<if test="sendTime != null">send_time = #{sendTime},</if>
<if test="emailType != null">email_type = #{emailType},</if>
<if test="emailStatus != null">email_status = #{emailStatus},</if>
<if test="emailLabel != null">email_label = #{emailLabel},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="belongUserId != null">belong_user_id = #{belongUserId},</if>
<if test="isRead != null">is_read = #{isRead},</if>
<if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="fileUrl != null">file_url = #{fileUrl},</if>
<if test="isSuccess != null "> is_success = #{isSuccess},</if>
<if test="errorInfo != null">error_info = #{errorInfo},</if>
</trim>
where email_no = #{emailNo}
</update>
<delete id="deleteSysOaEmailById" parameterType="Long">
delete from sys_oa_email where id = #{id}
</delete>
<delete id="deleteSysOaEmailByIds" parameterType="String">
delete from sys_oa_email where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>