Skip to content

Commit 06e0ce2

Browse files
committed
Merge remote-tracking branch 'origin/dev-1.1.4' into dev-1.1.4
2 parents 6da38e2 + 358c6ee commit 06e0ce2

File tree

24 files changed

+113
-102
lines changed

24 files changed

+113
-102
lines changed

db/dss_dml.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ select @node_ui_source_type:=id from dss_workflow_node_ui where `key`='source.ty
203203
select @node_ui_check_object:=id from dss_workflow_node_ui where `key`='check.object';
204204
select @node_ui_max_check_hours:=id from dss_workflow_node_ui where `key`='max.check.hours';
205205
select @node_ui_job_desc:=id from dss_workflow_node_ui where `key`='job.desc';
206-
select @node_ui_bindViewKey:=id from dss_workflow_node_ui where `key`='bindViewKey';
206+
select @node_ui_upStreams:=id from dss_workflow_node_ui where `key`='upStreams';
207207
select @node_ui_executeUser:=id from dss_workflow_node_ui where `key`='executeUser';
208208
select @node_ui_ReuseEngine:=id from dss_workflow_node_ui where `key`='ReuseEngine';
209209

@@ -373,7 +373,7 @@ insert into `dss_workflow_node_ui_to_validate`(`ui_id`,`validate_id`) values (@
373373
insert into `dss_workflow_node_ui_to_validate`(`ui_id`,`validate_id`) values (@node_ui_to,55);
374374
insert into `dss_workflow_node_ui_to_validate`(`ui_id`,`validate_id`) values (@node_ui_itsm,55);
375375
insert into `dss_workflow_node_ui_to_validate`(`ui_id`,`validate_id`) values (@node_ui_subject,55);
376-
insert into `dss_workflow_node_ui_to_validate`(`ui_id`,`validate_id`) values (@node_ui_bindViewKey,55);
376+
insert into `dss_workflow_node_ui_to_validate`(`ui_id`,`validate_id`) values (@node_ui_upStreams,55);
377377
insert into `dss_workflow_node_ui_to_validate`(`ui_id`,`validate_id`) values (39,32);
378378
insert into `dss_workflow_node_ui_to_validate`(`ui_id`,`validate_id`) values (39,41);
379379
insert into `dss_workflow_node_ui_to_validate`(`ui_id`,`validate_id`) values (39,46);
@@ -388,7 +388,7 @@ insert into `dss_workflow_node_ui_to_validate`(`ui_id`,`validate_id`) values (4
388388
insert into `dss_workflow_node_ui_to_validate`(`ui_id`,`validate_id`) values (@node_ui_ReuseEngine,59);
389389
insert into `dss_workflow_node_ui_to_validate`(`ui_id`,`validate_id`) values (@node_ui_spark_driver_memory,60);
390390
insert into `dss_workflow_node_ui_to_validate`(`ui_id`,`validate_id`) values (@node_ui_spark_executor_memory,60);
391-
insert into `dss_workflow_node_ui_to_validate`(`ui_id`,`validata_id`) values (@node_ui_job_desc,61);
391+
insert into `dss_workflow_node_ui_to_validate`(`ui_id`,`validate_id`) values (@node_ui_job_desc,61);
392392

393393

394394
DELETE FROM dss_workspace_appconn_role;

dss-appconn/appconns/dss-sendemail-appconn/sendemail-appconn-core/src/main/java/com/webank/wedatasphere/dss/appconn/sendemail/email/Email.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,6 @@ public interface Email {
4141
String getBcc();
4242
void setBcc(String bcc);
4343

44+
String getEmailType();
45+
void setEmailType(String emailType);
4446
}

dss-appconn/appconns/dss-sendemail-appconn/sendemail-appconn-core/src/main/scala/com/webank/wedatasphere/dss/appconn/sendemail/conf/SendEmailAppConnConfiguration.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ object SendEmailAppConnConfiguration {
2525

2626
val EMAIL_HOOK_CLASSES = CommonVars("wds.dss.appconn.email.hook.classes",
2727
"com.webank.wedatasphere.dss.appconn.sendemail.hook.SendEmailItsmCheckHook," +
28-
"com.webank.wedatasphere.dss.appconn.sendemail.hook.SendEmailContentLimitHook")
28+
"com.webank.wedatasphere.dss.appconn.sendemail.hook.SendEmailVisualisContentLimitHook," +
29+
"com.webank.wedatasphere.dss.appconn.sendemail.hook.SendEmailTableauCheckHook")
2930

3031
val EMAIL_IMAGE_HEIGHT = CommonVars("wds.dss.appconn.email.image.height", 500)
3132
val EMAIL_IMAGE_WIDTH = CommonVars("wds.dss.appconn.email.image.width", 1920)
@@ -44,4 +45,6 @@ object SendEmailAppConnConfiguration {
4445
val EMAIL_SMTP_SSL_ENABLED = CommonVars("wds.dss.appconn.email.smtp.ssl.enable", "true")
4546
val EMAIL_SMTP_TIMEOUT: CommonVars[Integer] = CommonVars("wds.dss.appconn.email.smtp.timeout", 25000)
4647

48+
val EMAIL_ENTITY_CLASSES = CommonVars("wds.dss.appconn.email.hook.entity.classes","com.webank.wedatasphere.dss.appconn.sendemail.hook.entity.newvisualis.NewVisualisEmailInfo," +
49+
"com.webank.wedatasphere.dss.appconn.sendemail.hook.entity.visualis.VisualisEmailInfo")
4750
}

dss-appconn/appconns/dss-sendemail-appconn/sendemail-appconn-core/src/main/scala/com/webank/wedatasphere/dss/appconn/sendemail/cs/EmailCSHelper.scala

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616

1717
package com.webank.wedatasphere.dss.appconn.sendemail.cs
1818

19+
20+
import java.util
21+
22+
import com.google.gson.internal.LinkedTreeMap
1923
import com.webank.wedatasphere.dss.appconn.sendemail.exception.EmailSendFailedException
2024
import com.webank.wedatasphere.dss.standard.app.development.listener.core.ExecutionRequestRefContext
2125
import org.apache.linkis.common.utils.Logging
@@ -25,6 +29,7 @@ import org.apache.linkis.cs.common.entity.enumeration.{ContextScope, ContextType
2529
import org.apache.linkis.cs.common.entity.source.CommonContextKey
2630
import org.apache.linkis.cs.common.utils.CSCommonUtils
2731
import org.apache.linkis.server.JSONUtils
32+
import org.springframework.util.CollectionUtils
2833

2934
import scala.collection.JavaConversions._
3035

@@ -57,4 +62,16 @@ object EmailCSHelper extends Logging{
5762
info(s"Job IDs is ${jobIds.toList}.")
5863
jobIds
5964
}
65+
66+
def getJobTypes(refContext: ExecutionRequestRefContext):util.ArrayList[String] = {
67+
val jobTypes = new util.ArrayList[String]()
68+
getJobIds(refContext).foreach { jobId =>
69+
jobTypes.add(refContext.fetchLinkisJob(jobId).getParams.get("labels").asInstanceOf[LinkedTreeMap[_,_]].get("codeType").toString)
70+
}
71+
if (CollectionUtils.isEmpty(jobTypes)) {
72+
throw new EmailSendFailedException(80003 ,"empty result set is not allowed")
73+
}
74+
info(s"Job Types is $jobTypes.")
75+
jobTypes
76+
}
6077
}

dss-appconn/appconns/dss-sendemail-appconn/sendemail-appconn-core/src/main/scala/com/webank/wedatasphere/dss/appconn/sendemail/email/domain/AbstractEmail.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class AbstractEmail extends Email {
2929
private var to: String = _
3030
private var cc: String = _
3131
private var bcc: String = _
32+
private var emialType: String = _
3233

3334
override def getContent: String = content
3435
override def setContent(content: String): Unit = this.content = content
@@ -52,4 +53,7 @@ class AbstractEmail extends Email {
5253

5354
override def getBcc: String = bcc
5455
override def setBcc(bcc: String): Unit = this.bcc = bcc
56+
57+
override def getEmailType: String = emialType
58+
override def setEmailType(emailType: String): Unit = this.emialType = emailType
5559
}

dss-appconn/appconns/dss-sendemail-appconn/sendemail-appconn-core/src/main/scala/com/webank/wedatasphere/dss/appconn/sendemail/email/domain/MultiContentEmail.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,6 @@ class MultiContentEmail extends AbstractEmail {
3030

3131
def getEmailContents: Array[EmailContent[_]] = emailContents.toIterator.toArray
3232

33+
34+
3335
}

dss-appconn/appconns/dss-sendemail-appconn/sendemail-appconn-core/src/main/scala/com/webank/wedatasphere/dss/appconn/sendemail/email/generate/MultiContentEmailGenerator.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@
1616

1717
package com.webank.wedatasphere.dss.appconn.sendemail.email.generate
1818

19+
import com.google.gson.internal.LinkedTreeMap
1920
import com.webank.wedatasphere.dss.appconn.sendemail.cs.EmailCSHelper
2021
import com.webank.wedatasphere.dss.appconn.sendemail.email.domain.{AbstractEmail, MultiContentEmail}
2122
import com.webank.wedatasphere.dss.appconn.sendemail.emailcontent.domain.PictureEmailContent
2223
import com.webank.wedatasphere.dss.appconn.sendemail.exception.EmailSendFailedException
24+
import com.webank.wedatasphere.dss.common.utils.DSSCommonUtils
2325
import com.webank.wedatasphere.dss.standard.app.development.listener.ref.RefExecutionRequestRef
26+
import org.apache.commons.lang3.StringUtils
2427
import org.apache.linkis.storage.resultset.ResultSetFactory
2528

2629
class MultiContentEmailGenerator extends AbstractEmailGenerator {
@@ -45,6 +48,10 @@ class MultiContentEmailGenerator extends AbstractEmailGenerator {
4548
}
4649
multiContentEmail.addEmailContent(emailContent)
4750
}
51+
if (StringUtils.isBlank(multiContentEmail.getEmailType)) {
52+
val emailType = refContext.fetchLinkisJob(jobId).getParams.get("labels").asInstanceOf[LinkedTreeMap[_,_]].get("codeType").toString
53+
multiContentEmail.setEmailType(emailType)
54+
}
4855
}
4956
case "file" => throw new EmailSendFailedException(80003 ,"file content is not allowed") //addContentEmail(c => new FileEmailContent(new FsPath(c)))
5057
case "text" => throw new EmailSendFailedException(80003 ,"text content is not allowed")//addContentEmail(new TextEmailContent(_))

dss-appconn/appconns/dss-sendemail-appconn/sendemail-appconn-core/src/main/scala/com/webank/wedatasphere/dss/appconn/sendemail/emailcontent/parser/PictureEmailContentParser.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ object PictureEmailContentParser extends AbstractEmailContentParser[PictureEmail
4545
val imageUUID: String = UUID.randomUUID.toString
4646
val width: Int = bufferedImage.getWidth
4747
val height: Int = bufferedImage.getHeight
48-
val imagesCuts = if (height > EMAIL_IMAGE_HEIGHT.getValue) {
48+
// 只支持修改visualis图片大小,后续如果有新增其他类型的邮件需要修改图片大小,需要在if中加上该邮件类型
49+
val imagesCuts = if (email.getEmailType.contains("visualis") && height > EMAIL_IMAGE_HEIGHT.getValue) {
4950
val numOfCut = Math.ceil(height.toDouble / EMAIL_IMAGE_HEIGHT.getValue).toInt
5051
val realHeight = height / numOfCut
5152
(0 until numOfCut).map(i => bufferedImage.getSubimage(0, i * realHeight, width, realHeight)).toArray
@@ -62,7 +63,7 @@ object PictureEmailContentParser extends AbstractEmailContentParser[PictureEmail
6263
var iHeight = image.getHeight
6364
var iWidth = image.getWidth
6465

65-
if (iWidth > EMAIL_IMAGE_WIDTH.getValue) {
66+
if (email.getEmailType.contains("visualis") && iWidth > EMAIL_IMAGE_WIDTH.getValue) {
6667
iHeight = ((EMAIL_IMAGE_WIDTH.getValue.toDouble / iWidth.toDouble) * iHeight.toDouble).toInt
6768
iWidth = EMAIL_IMAGE_WIDTH.getValue
6869
}

dss-apps/dss-apiservice-server/src/main/java/com/webank/wedatasphere/dss/apiservice/core/util/ApiUtils.java

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import com.webank.wedatasphere.dss.apiservice.core.exception.*;
2020
import com.webank.wedatasphere.dss.apiservice.core.vo.MessageVo;
21+
import org.apache.commons.lang3.exception.ExceptionUtils;
2122
import org.apache.linkis.common.exception.WarnException;
2223
import org.apache.linkis.server.Message;
2324
import org.slf4j.Logger;
@@ -39,27 +40,15 @@ public static Message doAndResponse(TryOperation tryOperation, String method, St
3940
try {
4041
Message message = tryOperation.operateAndGetMessage();
4142
return setMethod(message, method);
42-
} catch (ConstraintViolationException e) {
43-
LOG.error("api error, method: " + method, e);
44-
return Message.error(e.getMessage());
4543
} catch (WarnException e) {
4644
LOG.error("api error, method: " + method, e);
4745
return setMethod(Message.warn(e.getMessage()), method);
48-
} catch (AssertException e) {
46+
} catch (AssertException | ApiExecuteException | ApiServiceQueryException e) {
4947
LOG.error("api error, method: " + method, e);
5048
return setMethod(Message.error(e.getMessage()), method);
51-
52-
} catch (ApiExecuteException e) {
53-
LOG.error("api error, method: " + method, e);
54-
return setMethod(Message.error(e.getMessage()), method);
55-
}
56-
catch (ApiServiceQueryException e) {
57-
LOG.error("api error, method: " + method, e);
58-
return setMethod(Message.error(e.getMessage()), method);
59-
}
60-
catch (Exception e) {
49+
} catch (Exception e) {
6150
LOG.error("api error, method: " + method, e);
62-
return Message.error(e.getMessage());
51+
return Message.error(ExceptionUtils.getRootCauseMessage(e));
6352
}
6453
}
6554

dss-commons/dss-contextservice/src/main/java/com/webank/wedatasphere/dss/contextservice/service/impl/ContextServiceImpl.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@
2020
import com.webank.wedatasphere.dss.common.conf.DSSCommonConf;
2121
import com.webank.wedatasphere.dss.common.entity.Resource;
2222
import com.webank.wedatasphere.dss.common.exception.DSSErrorException;
23+
import com.webank.wedatasphere.dss.common.exception.DSSRuntimeException;
2324
import com.webank.wedatasphere.dss.common.exception.ErrorCode;
2425
import com.webank.wedatasphere.dss.common.utils.DSSCommonUtils;
2526
import com.webank.wedatasphere.dss.contextservice.service.ContextService;
27+
import org.apache.commons.lang3.exception.ExceptionUtils;
2628
import org.apache.linkis.common.exception.ErrorException;
2729
import org.apache.linkis.cs.client.ContextClient;
2830
import org.apache.linkis.cs.client.builder.ContextClientFactory;
@@ -76,8 +78,9 @@ public String createContextID(String workspace, String project, String flow, Str
7678
return SerializeHelper.serializeContextID(contextID);
7779
} catch (Exception e) {
7880
logger.error("createContextID error. workspace : {}, project : {}, flow : {}, version : {}, user : {}", workspace, project, flow, version, user, e);
81+
throw new DSSRuntimeException(50032, "Try to ask Linkis for creating a new contextId failed(向Linkis请求创建一个ContextID失败)! Linkis error msg: " +
82+
ExceptionUtils.getRootCauseMessage(e), e);
7983
}
80-
return null;
8184
}
8285

8386
@Override

0 commit comments

Comments
 (0)