|
@@ -1,6 +1,8 @@
|
|
|
package com.ruoyi.common.thread.Trainning;
|
|
|
|
|
|
import com.ruoyi.common.sendEmail.IMailService;
|
|
|
+import com.ruoyi.project.system.domain.SysMessage;
|
|
|
+import com.ruoyi.project.system.service.ISysMessageService;
|
|
|
import com.ruoyi.project.training.spec.domain.TStApprove;
|
|
|
|
|
|
import java.util.Date;
|
|
@@ -14,8 +16,11 @@ public class PlanApproveMailThread implements Runnable {
|
|
|
private String usernameEN;
|
|
|
private TStApprove tApprove;
|
|
|
private String sendType;
|
|
|
+ private SysMessage message;
|
|
|
+ private ISysMessageService sysMessageService;
|
|
|
|
|
|
- public PlanApproveMailThread(String email, String apNo, String username, String usernameEN, IMailService mailService, TStApprove tApprove, String sendType) {
|
|
|
+ public PlanApproveMailThread(String email, String apNo, String username, String usernameEN, IMailService mailService, TStApprove tApprove,
|
|
|
+ ISysMessageService sysMessageService, SysMessage message,String sendType) {
|
|
|
this.email = email;
|
|
|
this.apNo = apNo;
|
|
|
this.username = username;
|
|
@@ -23,13 +28,24 @@ public class PlanApproveMailThread implements Runnable {
|
|
|
this.mailService = mailService;
|
|
|
this.tApprove = tApprove;
|
|
|
this.sendType = sendType;
|
|
|
+ this.sysMessageService = sysMessageService;
|
|
|
+ this.message = message;
|
|
|
}
|
|
|
/*
|
|
|
* 发送邮件
|
|
|
*/
|
|
|
@Override
|
|
|
public void run() {
|
|
|
- addApprove();
|
|
|
+ if (sendType.equals("0")) {
|
|
|
+ //申请
|
|
|
+ addApprove();
|
|
|
+ }else if (sendType.equals("1")){
|
|
|
+ //通过
|
|
|
+ approve1();
|
|
|
+ }else if (sendType.equals("2")){
|
|
|
+
|
|
|
+ }
|
|
|
+ sysMessageService.insertSysMessage(message);
|
|
|
}
|
|
|
|
|
|
/*
|
|
@@ -81,4 +97,102 @@ public class PlanApproveMailThread implements Runnable {
|
|
|
String html = start + prime + end;
|
|
|
mailService.sendHtmlMail(email, "CPMS:您有一个新的待办任务 CPMS:You have a new to-do task (" + apNo + ")", html);
|
|
|
}
|
|
|
+ /*
|
|
|
+ * 发送邮件
|
|
|
+ */
|
|
|
+ public void approve1() {
|
|
|
+ String devType = "";
|
|
|
+ String devTypeEN = "";
|
|
|
+ String approveType = "培养计划审核";
|
|
|
+ String approveTypeEN = "Training plan review";
|
|
|
+ //写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); \">CPMS管理系统 </font><font face=\"微软雅黑\" size=\"3\" style=\"color: rgb(255, 255, 255); \">CPMS System</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</font><br><font style=\"line-height: 22px; \" size=\"4\">" +
|
|
|
+ "Dear usernameEN</font></font></h2>" +
|
|
|
+ "<p>您有一个申请任务已通过审批:<br>" +
|
|
|
+ "You have a new to-do task:<br>" +
|
|
|
+ "任务编号:<b>apNo</b><br>" +
|
|
|
+ "Task Number: <b>apNoEN</b><br>" +
|
|
|
+ "审批类型:<b>approveType</b><br>" +
|
|
|
+ "Application Category: <b>approveTypeEN</b><br>" +
|
|
|
+ "请登录<a href=\"https://cpms.basf-ypc.net.cn/cpms/index.html#/approve/pending\">CPMS管理系统</a>查看。<br>" +
|
|
|
+ "Please log in the <a href=\"https://cpms.basf-ypc.net.cn/cpms/index.html#/approve/pending\">CPMS</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.replaceFirst("devType", devType);
|
|
|
+ String four = three.replaceFirst("apNo", apNo);
|
|
|
+ String five = four.replaceFirst("apNoEN", apNo);
|
|
|
+ String six = five.replaceFirst("devTypeEN", devTypeEN);
|
|
|
+ String seven = six.replaceFirst("approveType", approveType);
|
|
|
+ String eight = seven.replaceFirst("approveTypeEN", approveTypeEN);
|
|
|
+ String result = eight.replaceFirst("date", String.valueOf(new Date()));
|
|
|
+ prime = prime + result;
|
|
|
+ //写html结尾内容
|
|
|
+ String end = "</tbody></table></div></body></html>";
|
|
|
+ //拼接html
|
|
|
+ String html = start + prime + end;
|
|
|
+ mailService.sendHtmlMail(email, "CPMS:您有一个申请任务已通过审批 CPMS:You have a new to-do task (" + apNo + ")", html);
|
|
|
+ }
|
|
|
+ /*
|
|
|
+ * 发送邮件
|
|
|
+ */
|
|
|
+ public void approve2() {
|
|
|
+ String devType = "";
|
|
|
+ String devTypeEN = "";
|
|
|
+ String approveType = "培养计划审核";
|
|
|
+ String approveTypeEN = "Training plan review";
|
|
|
+ //写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); \">CPMS管理系统 </font><font face=\"微软雅黑\" size=\"3\" style=\"color: rgb(255, 255, 255); \">CPMS System</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</font><br><font style=\"line-height: 22px; \" size=\"4\">" +
|
|
|
+ "Dear usernameEN</font></font></h2>" +
|
|
|
+ "<p>您有一个申请任务未通过审批:<br>" +
|
|
|
+ "You have a new to-do task:<br>" +
|
|
|
+ "任务编号:<b>apNo</b><br>" +
|
|
|
+ "Task Number: <b>apNoEN</b><br>" +
|
|
|
+ "审批类型:<b>approveType</b><br>" +
|
|
|
+ "Application Category: <b>approveTypeEN</b><br>" +
|
|
|
+ "请登录<a href=\"https://cpms.basf-ypc.net.cn/cpms/index.html#/approve/pending\">CPMS管理系统</a>查看。<br>" +
|
|
|
+ "Please log in the <a href=\"https://cpms.basf-ypc.net.cn/cpms/index.html#/approve/pending\">CPMS</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.replaceFirst("devType", devType);
|
|
|
+ String four = three.replaceFirst("apNo", apNo);
|
|
|
+ String five = four.replaceFirst("apNoEN", apNo);
|
|
|
+ String six = five.replaceFirst("devTypeEN", devTypeEN);
|
|
|
+ String seven = six.replaceFirst("approveType", approveType);
|
|
|
+ String eight = seven.replaceFirst("approveTypeEN", approveTypeEN);
|
|
|
+ String result = eight.replaceFirst("date", String.valueOf(new Date()));
|
|
|
+ prime = prime + result;
|
|
|
+ //写html结尾内容
|
|
|
+ String end = "</tbody></table></div></body></html>";
|
|
|
+ //拼接html
|
|
|
+ String html = start + prime + end;
|
|
|
+ mailService.sendHtmlMail(email, "CPMS:您有一个申请任务未通过审批 CPMS:You have a new to-do task (" + apNo + ")", html);
|
|
|
+ }
|
|
|
}
|