Browse Source

[Fix] fix dingtalk at user Params (#16379)

dev
zuo 4 months ago committed by GitHub
parent
commit
f9db86559d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactory.java
  2. 4
      dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkParamsConstants.java
  3. 12
      dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkSender.java
  4. 2
      dolphinscheduler-ui/src/locales/en_US/security.ts
  5. 2
      dolphinscheduler-ui/src/locales/zh_CN/security.ts

4
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkAlertChannelFactory.java

@ -87,7 +87,7 @@ public final class DingTalkAlertChannelFactory implements AlertChannelFactory {
.setRequired(false)
.build())
.build();
InputParam atUserIdsParam = InputParam
InputParam atDingtalkIdsParam = InputParam
.newBuilder(DingTalkParamsConstants.NAME_DING_TALK_AT_USERIDS,
DingTalkParamsConstants.DING_TALK_AT_USERIDS)
.addValidate(Validate.newBuilder()
@ -141,7 +141,7 @@ public final class DingTalkAlertChannelFactory implements AlertChannelFactory {
.setType("password")
.build();
return Arrays.asList(webHookParam, keywordParam, secretParam, msgTypeParam, atMobilesParam, atUserIdsParam,
return Arrays.asList(webHookParam, keywordParam, secretParam, msgTypeParam, atMobilesParam, atDingtalkIdsParam,
isAtAll, isEnableProxy, proxyParam, portParam, userParam, passwordParam);
}

4
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkParamsConstants.java

@ -40,8 +40,8 @@ public final class DingTalkParamsConstants {
static final String DING_TALK_AT_MOBILES = "$t('atMobiles')";
static final String NAME_DING_TALK_AT_MOBILES = "AtMobiles";
static final String DING_TALK_AT_USERIDS = "$t('atUserIds')";
static final String NAME_DING_TALK_AT_USERIDS = "AtUserIds";
static final String DING_TALK_AT_USERIDS = "$t('atDingtalkIds')";
static final String NAME_DING_TALK_AT_USERIDS = "AtDingtalkIds";
static final String DING_TALK_AT_ALL = "$t('isAtAll')";
static final String NAME_DING_TALK_AT_ALL = "IsAtAll";

12
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkSender.java

@ -67,7 +67,7 @@ public final class DingTalkSender {
private String msgType;
private final String atMobiles;
private final String atUserIds;
private final String atDingtalkIds;
private final Boolean atAll;
private final Boolean enableProxy;
@ -87,7 +87,7 @@ public final class DingTalkSender {
msgType = config.get(DingTalkParamsConstants.NAME_DING_TALK_MSG_TYPE);
atMobiles = config.get(DingTalkParamsConstants.NAME_DING_TALK_AT_MOBILES);
atUserIds = config.get(DingTalkParamsConstants.NAME_DING_TALK_AT_USERIDS);
atDingtalkIds = config.get(DingTalkParamsConstants.NAME_DING_TALK_AT_USERIDS);
atAll = Boolean.valueOf(config.get(DingTalkParamsConstants.NAME_DING_TALK_AT_ALL));
enableProxy = Boolean.valueOf(config.get(DingTalkParamsConstants.NAME_DING_TALK_PROXY_ENABLE));
@ -271,8 +271,8 @@ public final class DingTalkSender {
builder.append(" ");
});
}
if (org.apache.commons.lang3.StringUtils.isNotBlank(atUserIds)) {
Arrays.stream(atUserIds.split(",")).forEach(value -> {
if (org.apache.commons.lang3.StringUtils.isNotBlank(atDingtalkIds)) {
Arrays.stream(atDingtalkIds.split(",")).forEach(value -> {
builder.append("@");
builder.append(value);
builder.append(" ");
@ -297,12 +297,12 @@ public final class DingTalkSender {
org.apache.commons.lang3.StringUtils.isNotBlank(atMobiles) ? atMobiles.split(",")
: new String[0];
String[] atUserArray =
org.apache.commons.lang3.StringUtils.isNotBlank(atUserIds) ? atUserIds.split(",")
org.apache.commons.lang3.StringUtils.isNotBlank(atDingtalkIds) ? atDingtalkIds.split(",")
: new String[0];
boolean isAtAll = Objects.isNull(atAll) ? false : atAll;
at.put("atMobiles", atMobileArray);
at.put("atUserIds", atUserArray);
at.put("atDingtalkIds", atUserArray);
at.put("isAtAll", isAtAll);
items.put("at", at);

2
dolphinscheduler-ui/src/locales/en_US/security.ts

@ -263,7 +263,7 @@ export default {
AtSomeoneInRoom: 'At Someone In Room',
Destination: 'Destination',
AtMobiles: 'At User Mobiles',
AtUserIds: 'At User Ids',
AtDingtalkIds: 'At User Ids',
MsgType: 'Msg Type',
// eslint-disable-next-line quotes
IsAtAll: "{'@'}All",

2
dolphinscheduler-ui/src/locales/zh_CN/security.ts

@ -262,7 +262,7 @@ export default {
// eslint-disable-next-line quotes
AtMobiles: "被{'@'}人的手机号",
// eslint-disable-next-line quotes
AtUserIds: "被{'@'}人的用户ID",
AtDingtalkIds: "被{'@'}人的用户ID",
MsgType: '消息类型',
// eslint-disable-next-line quotes
IsAtAll: "{'@'}所有人",

Loading…
Cancel
Save