Browse Source

-修改作业票发邮件
-新增我的待办定时任务发邮件

jiangbiao 2 years ago
parent
commit
a1fdb2e489

+ 9 - 2
master/src/main/java/com/ruoyi/common/utils/DateUtils.java

@@ -1,5 +1,7 @@
 package com.ruoyi.common.utils;
 
+import org.apache.commons.lang3.time.DateFormatUtils;
+
 import java.lang.management.ManagementFactory;
 import java.text.DateFormat;
 import java.text.ParseException;
@@ -7,8 +9,6 @@ import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.regex.Pattern;
 
-import org.apache.commons.lang3.time.DateFormatUtils;
-
 /**
  * 时间工具类
  *
@@ -244,4 +244,11 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
         return day;
     }
 
+    public static int compareToDay(Date date1, Date date2) {
+        DateFormat df = new SimpleDateFormat("yyyyMMdd");
+        int d1 = Integer.parseInt(df.format(date1));
+        int d2 = Integer.parseInt(df.format(date2));
+        return Integer.compare(d1, d2);
+    }
+
 }

+ 74 - 0
master/src/main/java/com/ruoyi/framework/task/TodoTask.java

@@ -0,0 +1,74 @@
+package com.ruoyi.framework.task;
+
+import com.github.stuxuhai.jpinyin.PinyinFormat;
+import com.github.stuxuhai.jpinyin.PinyinHelper;
+import com.ruoyi.common.sendEmail.IMailService;
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.SpringContextUtils;
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.project.system.domain.SysUser;
+import com.ruoyi.project.system.service.ISysUserService;
+import org.activiti.engine.ProcessEngine;
+import org.activiti.engine.ProcessEngines;
+import org.activiti.engine.task.Task;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+@Component
+public class TodoTask extends BaseController {
+
+    @Autowired
+    private ISysUserService sysUserService;
+
+    public void execute() {
+        List<SysUser> sysUsers = sysUserService.selectAllUser();
+        IMailService mailService = (IMailService) SpringContextUtils.getBean("mailService");
+        sysUsers.forEach(item -> {
+            try {
+                ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
+                List<Task> taskList = processEngine.getTaskService()//获取任务service
+                        .createTaskQuery()//创建查询对象
+                        .taskCandidateOrAssigned(item.getUserId().toString())
+                        //                .taskAssignee(getUserId().toString())
+                        .orderByTaskCreateTime().desc().list();//参与者,组任务查询
+                String username = item.getNickName();
+                String loginName = item.getUserName();
+                String usernameEN = PinyinHelper.convertToPinyinString(username, " ", PinyinFormat.WITHOUT_TONE);
+                String email = item.getEmail();
+                if (taskList.size() > 0) {
+                    String start = "<!DOCTYPE html><html><head><meta charset=\"utf-8\"><title></title></head><body><div style=\"background-color:#ECECEC; padding: 35px;\">" +
+                            "<table cellpadding=\"0\" align=\"center\"" +
+                            "style=\"width: 600px; margin: 0px auto; text-align: left; position: relative; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; font-size: 14px; font-family:微软雅黑, 黑体; line-height: 1.5; box-shadow: rgb(153, 153, 153) 0px 0px 5px; border-collapse: collapse; background-position: initial initial; background-repeat: initial initial;background:#fff;\">" +
+                            "<tbody><tr><th valign=\"middle\" style=\"height: 25px; line-height: 25px; padding: 15px 35px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #42a3d3; background-color: #49bcff; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px;\">" +
+                            "<font face=\"微软雅黑\" size=\"5\" style=\"color: rgb(255, 255, 255); \">待办任务 </font><font face=\"微软雅黑\" size=\"3\" style=\"color: rgb(255, 255, 255); \">To-Do Task</font></th></tr>";
+                    //表html中间内容
+                    String center = "<tr><td><div style=\"padding:25px 35px 40px; background-color:#fff;\"><h2 style=\"margin: 5px 0px; \">" +
+                            "<font color=\"#333333\" style=\"line-height: 20px; \"><font style=\"line-height: 22px; \" size=\"4\">" +
+                            "亲爱的 username(loginName)</font><br><font style=\"line-height: 22px; \" size=\"4\">" +
+                            "Dear usernameEN(loginName)</font></font></h2>" +
+                            "<p>您有" + taskList.size() + "条新的待办任务尚未完成:<br>" +
+                            "You have " + taskList.size() + " new to-do tasks that have not been completed :<br>" +
+                            "请登录<a href=\"https://cpms.basf-ypc.net.cn/cpms/index.html#/approve/pending\">我的待办</a>查看。<br>" +
+                            "Please log in the <a href=\"https://cpms.basf-ypc.net.cn/cpms/index.html#/approve/pending\">My To-Do List</a> to handle it.</p>" +
+                            "<p align=\"right\">date</p>" +
+                            "<div style=\"width:700px;margin:0 auto;\">" +
+                            "<div style=\"padding:10px 10px 0;border-top:1px solid #ccc;color:#747474;margin-bottom:20px;line-height:1.3em;font-size:12px;\">" +
+                            "<p>此为系统邮件,请勿回复<br>This e-Mail is an automatic reminder sent by CPMS, please do not reply</p>" +
+                            "</div></div></div></td></tr>";
+                    String one = center.replaceFirst("username", username);
+                    String two = one.replaceFirst("usernameEN", usernameEN);
+                    String three = two.replace("loginName", loginName);
+                    String result = three.replaceFirst("date", DateUtils.getDate());
+                    String end = "</tbody></table></div></body></html>";
+                    //拼接html
+                    String html = start + result + end;
+                    logger.info("html:" + html);
+                    mailService.sendHtmlMail(email, "您有新的待办任务尚未完成 You have new to-do tasks that have not been completed", html);
+                }
+            } catch (Exception ignored) {
+            }
+        });
+    }
+}

+ 53 - 60
master/src/main/java/com/ruoyi/project/listener/invoiceApprove/YhzgTaskCreateListener.java

@@ -1,7 +1,6 @@
 package com.ruoyi.project.listener.invoiceApprove;
 
 import com.alibaba.fastjson.JSON;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.github.stuxuhai.jpinyin.PinyinFormat;
 import com.github.stuxuhai.jpinyin.PinyinHelper;
 import com.ruoyi.common.sendEmail.IMailService;
@@ -33,73 +32,67 @@ public class YhzgTaskCreateListener implements Serializable, TaskListener {
         ITApproveReserveInvoiceService tApproveReserveInvoiceService = (ITApproveReserveInvoiceService) SpringContextUtils.getBean("tApproveReserveInvoiceService");
         ISysUserService sysUserService = (ISysUserService) SpringContextUtils.getBean("sysUserService");
         IMailService mailService = (IMailService) SpringContextUtils.getBean("mailService");
-        TApproveReserveInvoice approveEntity = tApproveReserveInvoiceService.selectTApproveReserveInvoiceById(Long.parseLong(id)) ;
+        TApproveReserveInvoice approveEntity = tApproveReserveInvoiceService.selectTApproveReserveInvoiceById(Long.parseLong(id));
 
         ITInvoiceBookingworkticketService tInvoiceBookingworkticketService = (ITInvoiceBookingworkticketService) SpringContextUtils.getBean("tInvoiceBookingworkticketService");
         TInvoiceBookingworkticket bookingworkticket = tInvoiceBookingworkticketService.getById(approveEntity.getInvoiceId());
         bookingworkticket.setStatus(0L);
         tInvoiceBookingworkticketService.updateTInvoiceBookingworkticket(bookingworkticket);
         logger.info("approveEntity:" + approveEntity);
-        //发送邮件
-        try {
-            String email = sysUserService.selectUserById(Long.parseLong(yhzgusers)).getEmail();
-            String apNo = approveEntity.getApNo();
-            logger.info("apNo:" + apNo);
-            SysUser sysUser = sysUserService.selectUserById(Long.parseLong(yhzgusers));
-            String username = sysUser.getNickName();
-            String loginName = sysUser.getUserName();
-            String usernameEN = PinyinHelper.convertToPinyinString(username, " ", PinyinFormat.WITHOUT_TONE);
-            logger.info("email:" + email);
-            logger.info("username:" + username);
-            //写html开始内容
-            String start = "<!DOCTYPE html><html><head><meta charset=\"utf-8\"><title></title></head><body><div style=\"background-color:#ECECEC; padding: 35px;\">" +
-                    "<table cellpadding=\"0\" align=\"center\"" +
-                    "style=\"width: 600px; margin: 0px auto; text-align: left; position: relative; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; font-size: 14px; font-family:微软雅黑, 黑体; line-height: 1.5; box-shadow: rgb(153, 153, 153) 0px 0px 5px; border-collapse: collapse; background-position: initial initial; background-repeat: initial initial;background:#fff;\">" +
-                    "<tbody><tr><th valign=\"middle\" style=\"height: 25px; line-height: 25px; padding: 15px 35px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #42a3d3; background-color: #49bcff; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px;\">" +
-                    "<font face=\"微软雅黑\" size=\"5\" style=\"color: rgb(255, 255, 255); \">预约开票管理系统 </font><font face=\"微软雅黑\" size=\"3\" style=\"color: rgb(255, 255, 255); \">Reserve Invoice</font></th></tr>";
-            //表html中间内容
-            String prime = "";
-            String center = "<tr><td><div style=\"padding:25px 35px 40px; background-color:#fff;\"><h2 style=\"margin: 5px 0px; \">" +
-                    "<font color=\"#333333\" style=\"line-height: 20px; \"><font style=\"line-height: 22px; \" size=\"4\">" +
-                    "亲爱的 username(loginName)</font><br><font style=\"line-height: 22px; \" size=\"4\">" +
-                    "Dear usernameEN(loginName)</font></font></h2>" +
-                    "<p>您有一个新的待办任务:<br>" +
-                    "You have a new to-do task:<br>" +
-                    "任务名:<b>预约开票审批流程:用户主管签字确认</b><br>" +
-                    "Task Name: <b>Approval process of reservation invoicing: user supervisor signs for confirmation</b><br>" +
-                    "任务编号:<b>apNo</b><br>" +
-                    "Task Number: <b>apNoEN</b><br>" +
-                    "请登录<a href=\"https://cpms.basf-ypc.net.cn/cpms/index.html#/approve/pending\">预约开票申请流程</a>查看。<br>" +
-                    "Please log in the <a href=\"https://cpms.basf-ypc.net.cn/cpms/index.html#/approve/pending\">InvoiceApprove</a> to handle it.</p>" +
-                    "<p align=\"right\">date</p>" +
-                    "<div style=\"width:700px;margin:0 auto;\">" +
-                    "<div style=\"padding:10px 10px 0;border-top:1px solid #ccc;color:#747474;margin-bottom:20px;line-height:1.3em;font-size:12px;\">" +
-                    "<p>此为系统邮件,请勿回复<br>This e-Mail is an automatic reminder sent by CPMS, please do not reply</p>" +
-                    "</div></div></div></td></tr>";
-            String one = center.replaceFirst("username", username);
-            String two = one.replaceFirst("usernameEN", usernameEN);
-            String three = two.replace("loginName", loginName);
-            String four = three.replaceFirst("apNo", apNo);
-            String five = four.replaceFirst("apNoEN", apNo);
-            String result = five.replaceFirst("date", String.valueOf(new Date()));
-            prime = prime + result;
-            //写html结尾内容
-            String end = "</tbody></table></div></body></html>";
-            //拼接html
-            String html = start + prime + end;
-            logger.info("html:" + html);
-            QueryWrapper<TInvoiceBookingworkticket> wrapper = new QueryWrapper<>();
-            wrapper.eq("work_unit", bookingworkticket.getWorkUnit()).eq("to_char(createdate, 'yyyy-mm-dd')", DateUtils.getDate());
-            int count = tInvoiceBookingworkticketService.count(wrapper);
-            logger.info("===============================计数::"+count);
-            if (count < 2) {
-                logger.info("===============================:发邮件");
+        if (DateUtils.compareToDay(bookingworkticket.getWorkStartTime(), bookingworkticket.getCreatedate()) == 0) {
+            logger.info("==============================发邮件============================");
+            //发送邮件
+            try {
+                String email = sysUserService.selectUserById(Long.parseLong(yhzgusers)).getEmail();
+                String apNo = approveEntity.getApNo();
+                logger.info("apNo:" + apNo);
+                SysUser sysUser = sysUserService.selectUserById(Long.parseLong(yhzgusers));
+                String username = sysUser.getNickName();
+                String loginName = sysUser.getUserName();
+                String usernameEN = PinyinHelper.convertToPinyinString(username, " ", PinyinFormat.WITHOUT_TONE);
+                logger.info("email:" + email);
+                logger.info("username:" + username);
+                //写html开始内容
+                String start = "<!DOCTYPE html><html><head><meta charset=\"utf-8\"><title></title></head><body><div style=\"background-color:#ECECEC; padding: 35px;\">" +
+                        "<table cellpadding=\"0\" align=\"center\"" +
+                        "style=\"width: 600px; margin: 0px auto; text-align: left; position: relative; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; font-size: 14px; font-family:微软雅黑, 黑体; line-height: 1.5; box-shadow: rgb(153, 153, 153) 0px 0px 5px; border-collapse: collapse; background-position: initial initial; background-repeat: initial initial;background:#fff;\">" +
+                        "<tbody><tr><th valign=\"middle\" style=\"height: 25px; line-height: 25px; padding: 15px 35px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #42a3d3; background-color: #49bcff; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px;\">" +
+                        "<font face=\"微软雅黑\" size=\"5\" style=\"color: rgb(255, 255, 255); \">预约开票管理系统 </font><font face=\"微软雅黑\" size=\"3\" style=\"color: rgb(255, 255, 255); \">Reserve Invoice</font></th></tr>";
+                //表html中间内容
+                String prime = "";
+                String center = "<tr><td><div style=\"padding:25px 35px 40px; background-color:#fff;\"><h2 style=\"margin: 5px 0px; \">" +
+                        "<font color=\"#333333\" style=\"line-height: 20px; \"><font style=\"line-height: 22px; \" size=\"4\">" +
+                        "亲爱的 username(loginName)</font><br><font style=\"line-height: 22px; \" size=\"4\">" +
+                        "Dear usernameEN(loginName)</font></font></h2>" +
+                        "<p>您有一个新的待办任务:<br>" +
+                        "You have a new to-do task:<br>" +
+                        "任务名:<b>预约开票审批流程:用户主管签字确认</b><br>" +
+                        "Task Name: <b>Approval process of reservation invoicing: user supervisor signs for confirmation</b><br>" +
+                        "任务编号:<b>apNo</b><br>" +
+                        "Task Number: <b>apNoEN</b><br>" +
+                        "请登录<a href=\"https://cpms.basf-ypc.net.cn/cpms/index.html#/approve/pending\">预约开票申请流程</a>查看。<br>" +
+                        "Please log in the <a href=\"https://cpms.basf-ypc.net.cn/cpms/index.html#/approve/pending\">InvoiceApprove</a> to handle it.</p>" +
+                        "<p align=\"right\">date</p>" +
+                        "<div style=\"width:700px;margin:0 auto;\">" +
+                        "<div style=\"padding:10px 10px 0;border-top:1px solid #ccc;color:#747474;margin-bottom:20px;line-height:1.3em;font-size:12px;\">" +
+                        "<p>此为系统邮件,请勿回复<br>This e-Mail is an automatic reminder sent by CPMS, please do not reply</p>" +
+                        "</div></div></div></td></tr>";
+                String one = center.replaceFirst("username", username);
+                String two = one.replaceFirst("usernameEN", usernameEN);
+                String three = two.replace("loginName", loginName);
+                String four = three.replaceFirst("apNo", apNo);
+                String five = four.replaceFirst("apNoEN", apNo);
+                String result = five.replaceFirst("date", String.valueOf(new Date()));
+                prime = prime + result;
+                //写html结尾内容
+                String end = "</tbody></table></div></body></html>";
+                //拼接html
+                String html = start + prime + end;
+                logger.info("html:" + html);
                 mailService.sendHtmlMail(email, "预约开票:您有一个新的待办任务 Reserve Invoice:You have a new to-do task (" + apNo + ")", html);
-            }else {
-                logger.info("===============================:未发邮件");
+            } catch (Exception e) {
+                logger.error("邮件发送失败" + JSON.toJSONString(e));
             }
-        }catch (Exception e) {
-            logger.error("邮件发送失败" + JSON.toJSONString(e));
         }
     }
 

+ 53 - 60
master/src/main/java/com/ruoyi/project/listener/invoiceApprove/ZzzgTaskCreateListener.java

@@ -1,7 +1,6 @@
 package com.ruoyi.project.listener.invoiceApprove;
 
 import com.alibaba.fastjson.JSON;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.github.stuxuhai.jpinyin.PinyinFormat;
 import com.github.stuxuhai.jpinyin.PinyinHelper;
 import com.ruoyi.common.sendEmail.IMailService;
@@ -40,68 +39,62 @@ public class ZzzgTaskCreateListener implements Serializable, TaskListener {
         bookingworkticket.setStatus(2L);
         tInvoiceBookingworkticketService.updateTInvoiceBookingworkticket(bookingworkticket);
         logger.info("approveEntity:" + approveEntity);
-        //发送邮件
-        try {
-            for (String zzzguser : zzzgusers.split(",")) {
-                String email = sysUserService.selectUserById(Long.parseLong(zzzguser)).getEmail();
-                String apNo = approveEntity.getApNo();
-                logger.info("apNo:" + apNo);
-                SysUser sysUser = sysUserService.selectUserById(Long.parseLong(zzzguser));
-                String username = sysUser.getNickName();
-                String loginName = sysUser.getUserName();
-                String usernameEN = PinyinHelper.convertToPinyinString(username, " ", PinyinFormat.WITHOUT_TONE);
-                logger.info("email:" + email);
-                logger.info("username:" + username);
-                //写html开始内容
-                String start = "<!DOCTYPE html><html><head><meta charset=\"utf-8\"><title></title></head><body><div style=\"background-color:#ECECEC; padding: 35px;\">" +
-                        "<table cellpadding=\"0\" align=\"center\"" +
-                        "style=\"width: 600px; margin: 0px auto; text-align: left; position: relative; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; font-size: 14px; font-family:微软雅黑, 黑体; line-height: 1.5; box-shadow: rgb(153, 153, 153) 0px 0px 5px; border-collapse: collapse; background-position: initial initial; background-repeat: initial initial;background:#fff;\">" +
-                        "<tbody><tr><th valign=\"middle\" style=\"height: 25px; line-height: 25px; padding: 15px 35px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #42a3d3; background-color: #49bcff; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px;\">" +
-                        "<font face=\"微软雅黑\" size=\"5\" style=\"color: rgb(255, 255, 255); \">预约开票管理系统 </font><font face=\"微软雅黑\" size=\"3\" style=\"color: rgb(255, 255, 255); \">Reserve Invoice</font></th></tr>";
-                //表html中间内容
-                String prime = "";
-                String center = "<tr><td><div style=\"padding:25px 35px 40px; background-color:#fff;\"><h2 style=\"margin: 5px 0px; \">" +
-                        "<font color=\"#333333\" style=\"line-height: 20px; \"><font style=\"line-height: 22px; \" size=\"4\">" +
-                        "亲爱的 username(loginName)</font><br><font style=\"line-height: 22px; \" size=\"4\">" +
-                        "Dear usernameEN(loginName)</font></font></h2>" +
-                        "<p>您有一个新的待办任务:<br>" +
-                        "You have a new to-do task:<br>" +
-                        "任务名:<b>预约开票审批流程:装置主管签字确认</b><br>" +
-                        "Task Name: <b>Approval process of booking invoicing: the device director signs for confirmation</b><br>" +
-                        "任务编号:<b>apNo</b><br>" +
-                        "Task Number: <b>apNoEN</b><br>" +
-                        "请登录<a href=\"https://cpms.basf-ypc.net.cn/cpms/index.html#/approve/pending\">预约开票申请流程</a>查看。<br>" +
-                        "Please log in the <a href=\"https://cpms.basf-ypc.net.cn/cpms/index.html#/approve/pending\">InvoiceApprove</a> to handle it.</p>" +
-                        "<p align=\"right\">date</p>" +
-                        "<div style=\"width:700px;margin:0 auto;\">" +
-                        "<div style=\"padding:10px 10px 0;border-top:1px solid #ccc;color:#747474;margin-bottom:20px;line-height:1.3em;font-size:12px;\">" +
-                        "<p>此为系统邮件,请勿回复<br>This e-Mail is an automatic reminder sent by CPMS, please do not reply</p>" +
-                        "</div></div></div></td></tr>";
-                String one = center.replaceFirst("username", username);
-                String two = one.replaceFirst("usernameEN", usernameEN);
-                String three = two.replace("loginName", loginName);
-                String four = three.replaceFirst("apNo", apNo);
-                String five = four.replaceFirst("apNoEN", apNo);
-                String result = five.replaceFirst("date", String.valueOf(new Date()));
-                prime = prime + result;
-                //写html结尾内容
-                String end = "</tbody></table></div></body></html>";
-                //拼接html
-                String html = start + prime + end;
-                logger.info("html:" + html);
-                QueryWrapper<TInvoiceBookingworkticket> wrapper = new QueryWrapper<>();
-                wrapper.eq("work_unit", bookingworkticket.getWorkUnit()).eq("to_char(createdate, 'yyyy-mm-dd')", DateUtils.getDate()).eq("status",2);
-                int count = tInvoiceBookingworkticketService.count(wrapper);
-                logger.info("===============================计数::"+count);
-                if (count < 2) {
-                    logger.info("===============================:发邮件");
+        if (DateUtils.compareToDay(bookingworkticket.getWorkStartTime(), bookingworkticket.getCreatedate()) == 0) {
+            logger.info("==============================发邮件============================");
+            //发送邮件
+            try {
+                for (String zzzguser : zzzgusers.split(",")) {
+                    String email = sysUserService.selectUserById(Long.parseLong(zzzguser)).getEmail();
+                    String apNo = approveEntity.getApNo();
+                    logger.info("apNo:" + apNo);
+                    SysUser sysUser = sysUserService.selectUserById(Long.parseLong(zzzguser));
+                    String username = sysUser.getNickName();
+                    String loginName = sysUser.getUserName();
+                    String usernameEN = PinyinHelper.convertToPinyinString(username, " ", PinyinFormat.WITHOUT_TONE);
+                    logger.info("email:" + email);
+                    logger.info("username:" + username);
+                    //写html开始内容
+                    String start = "<!DOCTYPE html><html><head><meta charset=\"utf-8\"><title></title></head><body><div style=\"background-color:#ECECEC; padding: 35px;\">" +
+                            "<table cellpadding=\"0\" align=\"center\"" +
+                            "style=\"width: 600px; margin: 0px auto; text-align: left; position: relative; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; font-size: 14px; font-family:微软雅黑, 黑体; line-height: 1.5; box-shadow: rgb(153, 153, 153) 0px 0px 5px; border-collapse: collapse; background-position: initial initial; background-repeat: initial initial;background:#fff;\">" +
+                            "<tbody><tr><th valign=\"middle\" style=\"height: 25px; line-height: 25px; padding: 15px 35px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #42a3d3; background-color: #49bcff; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px;\">" +
+                            "<font face=\"微软雅黑\" size=\"5\" style=\"color: rgb(255, 255, 255); \">预约开票管理系统 </font><font face=\"微软雅黑\" size=\"3\" style=\"color: rgb(255, 255, 255); \">Reserve Invoice</font></th></tr>";
+                    //表html中间内容
+                    String prime = "";
+                    String center = "<tr><td><div style=\"padding:25px 35px 40px; background-color:#fff;\"><h2 style=\"margin: 5px 0px; \">" +
+                            "<font color=\"#333333\" style=\"line-height: 20px; \"><font style=\"line-height: 22px; \" size=\"4\">" +
+                            "亲爱的 username(loginName)</font><br><font style=\"line-height: 22px; \" size=\"4\">" +
+                            "Dear usernameEN(loginName)</font></font></h2>" +
+                            "<p>您有一个新的待办任务:<br>" +
+                            "You have a new to-do task:<br>" +
+                            "任务名:<b>预约开票审批流程:装置主管签字确认</b><br>" +
+                            "Task Name: <b>Approval process of booking invoicing: the device director signs for confirmation</b><br>" +
+                            "任务编号:<b>apNo</b><br>" +
+                            "Task Number: <b>apNoEN</b><br>" +
+                            "请登录<a href=\"https://cpms.basf-ypc.net.cn/cpms/index.html#/approve/pending\">预约开票申请流程</a>查看。<br>" +
+                            "Please log in the <a href=\"https://cpms.basf-ypc.net.cn/cpms/index.html#/approve/pending\">InvoiceApprove</a> to handle it.</p>" +
+                            "<p align=\"right\">date</p>" +
+                            "<div style=\"width:700px;margin:0 auto;\">" +
+                            "<div style=\"padding:10px 10px 0;border-top:1px solid #ccc;color:#747474;margin-bottom:20px;line-height:1.3em;font-size:12px;\">" +
+                            "<p>此为系统邮件,请勿回复<br>This e-Mail is an automatic reminder sent by CPMS, please do not reply</p>" +
+                            "</div></div></div></td></tr>";
+                    String one = center.replaceFirst("username", username);
+                    String two = one.replaceFirst("usernameEN", usernameEN);
+                    String three = two.replace("loginName", loginName);
+                    String four = three.replaceFirst("apNo", apNo);
+                    String five = four.replaceFirst("apNoEN", apNo);
+                    String result = five.replaceFirst("date", String.valueOf(new Date()));
+                    prime = prime + result;
+                    //写html结尾内容
+                    String end = "</tbody></table></div></body></html>";
+                    //拼接html
+                    String html = start + prime + end;
+                    logger.info("html:" + html);
                     mailService.sendHtmlMail(email, "预约开票:您有一个新的待办任务 Reserve Invoice:You have a new to-do task (" + apNo + ")", html);
-                }else {
-                    logger.info("===============================:未发邮件");
                 }
+            } catch (Exception e) {
+                logger.error("邮件发送失败" + JSON.toJSONString(e));
             }
-        } catch (Exception e) {
-            logger.error("邮件发送失败" + JSON.toJSONString(e));
         }
     }
 

+ 1 - 0
master/src/main/java/com/ruoyi/project/system/mapper/SysUserMapper.java

@@ -35,6 +35,7 @@ public interface SysUserMapper
      * @return 用户信息
      */
     public List<SysUser> selectUserByDept(Long deptId);
+    public List<SysUser> selectAllUser();
     public List<SysUser> selectUserListByRoleAndDept(SysUser sysUser);
 
     /**

+ 1 - 0
master/src/main/java/com/ruoyi/project/system/service/ISysUserService.java

@@ -38,6 +38,7 @@ public interface ISysUserService
      * @return 用户信息
      */
     public List<SysUser> selectUserByDept(Long deptId);
+    public List<SysUser> selectAllUser();
 
     /**
      * 通过用户名查询用户

+ 5 - 0
master/src/main/java/com/ruoyi/project/system/service/impl/SysUserServiceImpl.java

@@ -90,6 +90,11 @@ public class SysUserServiceImpl implements ISysUserService
         return userMapper.selectUserByDept(deptId);
     }
 
+    @Override
+    public List<SysUser> selectAllUser() {
+        return userMapper.selectAllUser();
+    }
+
     /**
      * 通过用户名查询用户
      *

+ 4 - 0
master/src/main/resources/mybatis/system/SysUserMapper.xml

@@ -50,6 +50,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		<result property="status"       column="role_status"    />
 	</resultMap>
 
+	<select id="selectAllUser" resultType="SysUser">
+		select * from sys_user u where u.del_flag = '0'
+	</select>
+
 	<sql id="selectUserVo">
         select u.user_id,u.staffid,u.home_type, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
 			   u.data_scope, u.dept_check_strictly,u.sign_url,