Explorar o código

SAI开项申请流程:邮件内容附收件人CPMS用户名

wangggziwen %!s(int64=2) %!d(string=hai) anos
pai
achega
7c75f4138d

+ 10 - 7
master/src/main/java/com/ruoyi/common/thread/sai/SaiApplyMailThread.java

@@ -29,10 +29,11 @@ public class SaiApplyMailThread implements Runnable {
     private TSaiApply tSaiApply;
     private String staffName;
     private String staffNameEN;
+    private String loginName;
 
     public SaiApplyMailThread() {}
 
-    public SaiApplyMailThread(IMailService mailService, ISysMessageService sysMessageService, SysMessage message, String email, Task task, TSaiApply tSaiApply, String staffName) throws PinyinException {
+    public SaiApplyMailThread(IMailService mailService, ISysMessageService sysMessageService, SysMessage message, String email, Task task, TSaiApply tSaiApply, String staffName, String loginName) throws PinyinException {
         this.mailService = mailService;
         this.sysMessageService = sysMessageService;
         this.email = email;
@@ -41,6 +42,7 @@ public class SaiApplyMailThread implements Runnable {
         this.tSaiApply = tSaiApply;
         this.staffName = staffName;
         this.staffNameEN = PinyinHelper.convertToPinyinString(staffName.trim(), " ", PinyinFormat.WITHOUT_TONE);
+        this.loginName =  loginName;
     }
 
     @Override
@@ -62,7 +64,7 @@ public class SaiApplyMailThread implements Runnable {
         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\">" +
                 "亲爱的staffName</font><br><font style=\"line-height: 22px; \" size=\"4\">" +
-                "Dear staffNameEN</font></font></h2>" +
+                "Dear staffNameEN(loginName)</font></font></h2>" +
                 "<p>您有新的SAI开项申请待办任务,详情如下:<br>" +
                 "You have a new to-do task:<br>" +
                 "流程编号:<b>processId</b><br>" +
@@ -78,11 +80,12 @@ public class SaiApplyMailThread implements Runnable {
                 "</div></div></div></td></tr>";
         String one = center.replaceFirst("staffName", staffName);
         String two = one.replaceFirst("staffNameEN", staffNameEN);
-        String three = two.replaceFirst("processId", tSaiApply.getProcessId());
-        String four = three.replaceFirst("taskName", task.getName());
-        String five = four.replaceFirst("taskDescription", tSaiApply.getDescription());
-        String six = five.replaceFirst("taskApplyDate", new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(tSaiApply.getApplyDate()));
-        String result = six.replaceFirst("date", String.valueOf(new Date())).replaceFirst("jumpUrl",jumpUrl).replaceFirst("jumpUrl",jumpUrl);
+        String three = two.replaceFirst("loginName", loginName);
+        String four = three.replaceFirst("processId", tSaiApply.getProcessId());
+        String five = four.replaceFirst("taskName", task.getName());
+        String six = five.replaceFirst("taskDescription", tSaiApply.getDescription());
+        String seven = six.replaceFirst("taskApplyDate", new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(tSaiApply.getApplyDate()));
+        String result = seven.replaceFirst("date", String.valueOf(new Date())).replaceFirst("jumpUrl",jumpUrl).replaceFirst("jumpUrl",jumpUrl);
         prime = prime + result;
         //写html结尾内容
         String end = "</tbody></table></div></body></html>";

+ 3 - 1
master/src/main/java/com/ruoyi/project/production/controller/TSaiApplyController.java

@@ -542,6 +542,7 @@ public class TSaiApplyController extends BaseController
                 if (!split[i].equals("20276")) {    // 张力飞不发邮件
                     SysUser sysUser = userService.selectUserById(Long.parseLong(split[i]));
                     String staffId = sysUser.getStaffId();
+                    String loginName = sysUser.getUserName();
                     TStaffmgr staffmgr = staffmgrService.selectTStaffmgrByStaffId(staffId);
                     String staffName = staffmgr.getName();
                     String email = staffmgr.getMail();
@@ -552,8 +553,9 @@ public class TSaiApplyController extends BaseController
                         message.setMsgTitle("您有一条系统消息");
                         message.setMsgContent("您有一条SAI开项申请消息待查看");
                         // 发送邮件
+//                        email = "lihui@seashoreept.com";
                         SaiApplyMailThread saiApplyMailThread = new SaiApplyMailThread(
-                                mailService, sysMessageService, message, email, nextHandlerTask, form, staffName);
+                                mailService, sysMessageService, message, email, nextHandlerTask, form, staffName, loginName);
                         Thread thread = new Thread(saiApplyMailThread);
                         thread.start();
                     }