|
|
@ -2060,9 +2060,11 @@ public class ErfExpApplyServiceImpl extends ServiceImpl<ErfExpApplyMapper, ErfEx |
|
|
log.warn("计划员ID {} 不存在,跳过下达邮件通知", plannerId); |
|
|
log.warn("计划员ID {} 不存在,跳过下达邮件通知", plannerId); |
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
|
String plannerEmail = planner.getEmail(); |
|
|
|
|
|
if (plannerEmail == null || plannerEmail.trim().isEmpty()) { |
|
|
|
|
|
log.warn("计划员 {} 未配置邮箱,跳过下达邮件通知", planner.getUsername()); |
|
|
|
|
|
|
|
|
Set<String> plannerEmails = new LinkedHashSet<>(); |
|
|
|
|
|
appendEmailRecipients(plannerEmails, planner.getEmail()); |
|
|
|
|
|
appendEmailRecipients(plannerEmails, planner.getEmail2()); |
|
|
|
|
|
if (plannerEmails.isEmpty()) { |
|
|
|
|
|
log.warn("计划员 {} 未配置邮箱(email/email2),跳过下达邮件通知", planner.getUsername()); |
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -2074,10 +2076,11 @@ public class ErfExpApplyServiceImpl extends ServiceImpl<ErfExpApplyMapper, ErfEx |
|
|
+ LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) |
|
|
+ LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) |
|
|
+ "</p></body></html>"; |
|
|
+ "</p></body></html>"; |
|
|
|
|
|
|
|
|
MailUtil.sendMail(subject, body, new String[]{plannerEmail}, mailSendData); |
|
|
|
|
|
successEmails.add(plannerEmail); |
|
|
|
|
|
|
|
|
String[] recipients = plannerEmails.toArray(new String[0]); |
|
|
|
|
|
MailUtil.sendMail(subject, body, recipients, mailSendData); |
|
|
|
|
|
successEmails.addAll(plannerEmails); |
|
|
log.info("已向计划员 {} ({}) 发送下达通知邮件,试验单: {}", |
|
|
log.info("已向计划员 {} ({}) 发送下达通知邮件,试验单: {}", |
|
|
planner.getUsername(), plannerEmail, entity.getApplyNo()); |
|
|
|
|
|
|
|
|
planner.getUsername(), String.join(";", plannerEmails), entity.getApplyNo()); |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
log.error("向计划员ID {} 发送邮件失败: {}", plannerId, e.getMessage()); |
|
|
log.error("向计划员ID {} 发送邮件失败: {}", plannerId, e.getMessage()); |
|
|
} |
|
|
} |
|
|
@ -2097,6 +2100,29 @@ public class ErfExpApplyServiceImpl extends ServiceImpl<ErfExpApplyMapper, ErfEx |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 解析并追加邮箱地址,支持英文逗号、中文逗号、分号、顿号和空白分隔 |
|
|
|
|
|
*/ |
|
|
|
|
|
private void appendEmailRecipients(Set<String> recipientSet, String rawEmails) { |
|
|
|
|
|
if (recipientSet == null || rawEmails == null) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
String normalizedRaw = rawEmails.trim(); |
|
|
|
|
|
if (normalizedRaw.isEmpty()) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
String[] emailArray = normalizedRaw.split("[,,;;、\\s]+"); |
|
|
|
|
|
for (String email : emailArray) { |
|
|
|
|
|
if (email == null) { |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
String normalizedEmail = email.trim(); |
|
|
|
|
|
if (!normalizedEmail.isEmpty()) { |
|
|
|
|
|
recipientSet.add(normalizedEmail); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 经理层审批全部通过后(进入计划员排产节点时)通知试验负责人:其负责的试验申请单已审批通过 |
|
|
* 经理层审批全部通过后(进入计划员排产节点时)通知试验负责人:其负责的试验申请单已审批通过 |
|
|
*/ |
|
|
*/ |
|
|
|