From afda52dc1b193f51cb13b165271b3c7fd9c4f27a Mon Sep 17 00:00:00 2001 From: xlinliu Date: Thu, 22 Feb 2024 19:23:49 +0800 Subject: [PATCH] =?UTF-8?q?=E9=82=AE=E4=BB=B6=E6=A0=87=E9=A2=98=E4=BC=98?= =?UTF-8?q?=E5=8C=96=EF=BC=8CYYYY-MM-DD-1=E8=A7=A3=E6=9E=90=E4=B8=BArun=5F?= =?UTF-8?q?date?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sendemail/email/generate/AbstractEmailGenerator.scala | 8 +++++++- .../generator/MultiEmailContentGenerator.scala | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/dss-appconn/appconns/dss-sendemail-appconn/sendemail-appconn-core/src/main/scala/com/webank/wedatasphere/dss/appconn/sendemail/email/generate/AbstractEmailGenerator.scala b/dss-appconn/appconns/dss-sendemail-appconn/sendemail-appconn-core/src/main/scala/com/webank/wedatasphere/dss/appconn/sendemail/email/generate/AbstractEmailGenerator.scala index a39ac1b07e..efc9ed61a9 100644 --- a/dss-appconn/appconns/dss-sendemail-appconn/sendemail-appconn-core/src/main/scala/com/webank/wedatasphere/dss/appconn/sendemail/email/generate/AbstractEmailGenerator.scala +++ b/dss-appconn/appconns/dss-sendemail-appconn/sendemail-appconn-core/src/main/scala/com/webank/wedatasphere/dss/appconn/sendemail/email/generate/AbstractEmailGenerator.scala @@ -21,6 +21,7 @@ import com.webank.wedatasphere.dss.appconn.sendemail.email.{Email, EmailGenerato import com.webank.wedatasphere.dss.standard.app.development.listener.core.ExecutionRequestRefContext import com.webank.wedatasphere.dss.standard.app.development.listener.ref.RefExecutionRequestRef import org.apache.linkis.common.utils.{Logging, VariableUtils} +import java.util trait AbstractEmailGenerator extends EmailGenerator with Logging{ @@ -46,7 +47,12 @@ trait AbstractEmailGenerator extends EmailGenerator with Logging{ case (k, v) => logger.info(s"K is $k, V is $v") } val subject = if (runtimeMap.get("subject") != null) { - VariableUtils.replace(runtimeMap.get("subject").toString) + val subjectStr = runtimeMap.get("subject").toString + .replaceAll("YYYY-MM-DD-1", "\\${run_date}NO_TIMESTAMP") + .replaceAll("YYYY-MM-DD", "\\${run_today}NO_TIMESTAMP") + val tmp: util.HashMap[String, Any] = new util.HashMap[String, Any]() + tmp.put(VariableUtils.RUN_DATE, requestRef.getRunDate) + VariableUtils.replace(subjectStr, tmp) } else{ "This is an email" } diff --git a/dss-appconn/appconns/dss-sendemail-appconn/sendemail-appconn-core/src/main/scala/com/webank/wedatasphere/dss/appconn/sendemail/emailcontent/generator/MultiEmailContentGenerator.scala b/dss-appconn/appconns/dss-sendemail-appconn/sendemail-appconn-core/src/main/scala/com/webank/wedatasphere/dss/appconn/sendemail/emailcontent/generator/MultiEmailContentGenerator.scala index 2d1ea7fd38..40c4f1cf60 100644 --- a/dss-appconn/appconns/dss-sendemail-appconn/sendemail-appconn-core/src/main/scala/com/webank/wedatasphere/dss/appconn/sendemail/emailcontent/generator/MultiEmailContentGenerator.scala +++ b/dss-appconn/appconns/dss-sendemail-appconn/sendemail-appconn-core/src/main/scala/com/webank/wedatasphere/dss/appconn/sendemail/emailcontent/generator/MultiEmailContentGenerator.scala @@ -28,6 +28,7 @@ class MultiEmailContentGenerator extends AbstractEmailContentGenerator with Logg case multiContentEmail: MultiContentEmail => formatSubjectOfOldVersion(email) formatSubject(multiContentEmail) + logger.info("email subject is "+email.getSubject) if (multiContentEmail.getEmailType.equals("html")) { setHtmlContent(multiContentEmail) } else {