Skip to content

Commit

Permalink
邮件标题优化,YYYY-MM-DD-1解析为run_date
Browse files Browse the repository at this point in the history
  • Loading branch information
xlinliu committed Feb 22, 2024
1 parent cc3631f commit afda52d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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{

Expand All @@ -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"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit afda52d

Please sign in to comment.