diff --git a/CA变更流程通知加入固定人员/AegChange2_mxJPO.java b/CA变更流程通知加入固定人员/AegChange2_mxJPO.java new file mode 100644 index 0000000..e89660c --- /dev/null +++ b/CA变更流程通知加入固定人员/AegChange2_mxJPO.java @@ -0,0 +1,101 @@ +import com.matrixone.apps.domain.util.MqlUtil; +import matrix.db.Context; + +import javax.mail.*; +import javax.mail.internet.InternetAddress; +import javax.mail.internet.MimeMessage; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; +import java.util.logging.Logger; + +public class AegChange2_mxJPO { + + private static final Logger LOGGER = Logger.getLogger(AegChange2_mxJPO.class.getName()); + private static final String SEND_EMAIL = "aegplm@aeg-imc.com"; + private static final String SEND_PASSWORD = "Aeg-1887"; + private static final String SMTP_HOST = "smtp.partner.outlook.cn"; + private static final String SMTP_PORT = "587"; + private static final String EMAIL = "beiqi.xi@aeg-imc.com"; + + public void AegChangeNotify(Context context, String[] args) throws Exception { + String caId = args[0]; + LOGGER.info("caId == > " + caId); + + String getChangeType = "print bus " + caId + " select type dump |"; + String changeType = MqlUtil.mqlCommand(context, getChangeType); + + if("Change Action".equals(changeType)){ + + String getCAInfo = "print bus " + caId + " select name attribute[Synopsis] description attribute[XP_ChangeAction_Ext.DistributionPersonList] attribute[Originator] dump |"; + String caInfo = MqlUtil.mqlCommand(context, getCAInfo); + LOGGER.info("caInfo ==> " + caInfo); + + String[] caInfoItem = caInfo.split("\\|"); + + Map map = new HashMap<>(); + map.put("projectName", caInfoItem[0]); + map.put("taskName", caInfoItem[1]); + map.put("description", caInfoItem[2]); + map.put("DocumentRecipient", caInfoItem[3]); + map.put("taskOwner", caInfoItem[4]); + + send(map); + } + } + + public void send(Map itemMap){ + LOGGER.info("=============> + <================="); + + Properties properties = new Properties(); + properties.put("mail.smtp.auth", "true"); + properties.put("mail.smtp.starttls.enable", "true"); + properties.put("mail.smtp.host", SMTP_HOST); + properties.put("mail.smtp.port", SMTP_PORT); + properties.put("mail.smtp.ssl.protocols", "TLSv1.2"); + + Session session = Session.getInstance(properties, + new javax.mail.Authenticator() { + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(SEND_EMAIL, SEND_PASSWORD); + } + }); + session.setDebug(true); + + Message message = new MimeMessage(session); + try { + message.setFrom(new InternetAddress(SEND_EMAIL)); + message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(EMAIL)); + + String body = "
" + + "
\n" + + "

" + itemMap.get("projectName") + "

\n" + + "
" + + "
\n" + + "
\n" + + "

" + "\u4efb\u52a1\u540d\u79f0: " + itemMap.get("taskName") + "

\n" + + "

" + "\u4efb\u52a1\u63cf\u8ff0: " + itemMap.get("description") + "

\n" + + "

" + "\u4efb\u52a1\u6240\u6709\u8005: " + itemMap.get("taskOwner") + "

\n" + + "

" + "\u6587\u4ef6\u63a5\u6536\u4eba: " + itemMap.get("DocumentRecipient") + "

\n" + + " 查看任务\n" + + "
\n" + + "
\n" + + "
\n" + + "

\u672c\u90ae\u4ef6\u53ca\u6240\u6709\u9644\u4ef6\u4ec5\u4f9b\u6536\u4ef6\u5730\u5740\u4e2d\u7684\u4e2a\u4eba\u6216\u5b9e\u4f53\u4f7f\u7528\uff0c\u8fd9\u4e9b\u5185\u5bb9\u5747\u5c5e\u673a\u5bc6\u4fe1\u606f\u5e76\u6216\u8bbe\u6709\u6743\u9650

\n" + + "
\n" + + "
\n" + + "

\u5982\u679c\u60a8\u4e0d\u662f\u4efb\u4f55\u6307\u5b9a\u7684\u6536\u4ef6\u4eba\u6216\u8bef\u6536\u5230\u672c\u90ae\u4ef6,
\n" + + " (i) \u60a8\u4e0d\u80fd\u9605\u8bfb\u3001\u6cc4\u6f0f\u6216\u590d\u5236\u672c\u90ae\u4ef6;
\n" + + " (ii) \u8bf7\u901a\u8fc7\u7535\u5b50\u90ae\u4ef6\u901a\u77e5\u60a8\u6536\u4ef6\u7684\u53d1\u4ef6\u4eba\u5e76\u5220\u9664\u672c\u90ae\u4ef6\u53ca\u6240\u6709\u9644\u4ef6;
\n" + + " (iii) \u5bf9\u4e8e\u56e0\u4f7f\u7528\u6216\u4f9d\u636e\u672c\u90ae\u4ef6\u800c\u5f15\u8d77\u7684\u4efb\u4f55\u635f\u5931\u6216\u635f\u5bb3,Dassault Systemes \u6982\u4e0d\u8d1f\u8d23\u6216\u627f\u62c5\u8d23\u4efb。

\n" + + "
\n" + + "
"; + message.setSubject("subject"); + message.setContent(body, "text/html;charset=utf-8"); + Transport.send(message); + } catch (MessagingException e) { + throw new RuntimeException(); + } + } +} diff --git a/CA变更流程通知加入固定人员/modify.mql b/CA变更流程通知加入固定人员/modify.mql new file mode 100644 index 0000000..cbc6396 --- /dev/null +++ b/CA变更流程通知加入固定人员/modify.mql @@ -0,0 +1,13 @@ +add bus "eService Trigger Program Parameters" "AEGChangeNotifyFixedPersonnel" "-" + description "AEGChangeNotifyFixedPersonnel" + policy "Business Rule" + "eService Program Argument 1" "${OBJECTID}" + vault "eService Administration" + "eService Program Name" "AegChange2" + "eService Sequence Number" 1 + "eService Method Name" "AegChangeNotify" + current Active; + +modify policy 'Change Action' state 'In Approval' add Trigger Promote Action emxTriggerManager input 'PolicyChangeActionStateInApprovalPromoteAction PolicyChangeActionPromoteDemoteAction AEGChangeNotifyFixedPersonnel'; + +modify policy 'Change Action' state 'In Approval' add Trigger Promote Action emxTriggerManager input 'PolicyChangeActionStateInApprovalPromoteAction PolicyChangeActionPromoteDemoteAction'; \ No newline at end of file diff --git a/CA变更流程通知加入固定人员/开发文档.docx b/CA变更流程通知加入固定人员/开发文档.docx new file mode 100644 index 0000000..f5c6f75 --- /dev/null +++ b/CA变更流程通知加入固定人员/开发文档.docx @@ -0,0 +1 @@ + AEG在CA中,当CA的状态由 "审批中" 提升到 "已完成" 的时候,会触发Trigger,调用AegChange2的代码,将该CA的某一些信息发给固定人员 beiqi.xi@aeg-imc.com [HYPERLINK: mailto:beiqi.xi@aeg-imc.com];