Skip to content

Commit

Permalink
接入 飞书机器人
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhongFuCheng3y committed Jun 24, 2022
1 parent 7ea71af commit 7399f78
Show file tree
Hide file tree
Showing 8 changed files with 593 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ public class SendAccountConstant {
public static final String ENTERPRISE_WECHAT_ROBOT_ACCOUNT_KEY = "enterpriseWechatAccountRobot";
public static final String ENTERPRISE_WECHAT_ROBOT_PREFIX = "enterprise_wechat_robot_";

/**
* 飞书群机器人 账号
*/
public static final String FEI_SHU_ROBOT_ACCOUNT_KEY = "feiShuAccountRobot";
public static final String FEI_SHU_ROBOT_PREFIX = "fei_shu_robot_";

/**
* 企业微信 应用消息 账号
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.java3y.austin.common.dto.account;


import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
* 飞书 机器人 账号信息
*
* @author 3y
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class FeiShuRobotAccount {
/**
* 自定义群机器人中的 webhook
*/
private String webhook;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.java3y.austin.common.dto.model;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
* @author 3y
* 飞书群 机器人
* <p>
* https://open.feishu.cn/document/ukTMukTMukTM/ucTM5YjL3ETO24yNxkjN#756b882f
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class FeiShuRobotContentModel extends ContentModel {

/**
* 发送类型
*/
private String sendType;

/**
* 发送内容
*/
private String content;

/**
* 发送标题
*/
private String title;

/**
* 媒体Id
*/
private String mediaId;


/**
* 富文本内容:[[{"tag":"text","text":"项目有更新: "},{"tag":"a","text":"请查看","href":"http://www.example.com/"},{"tag":"at","user_id":"ou_18eac8********17ad4f02e8bbbb"}]]
*/
private String postContent;

/**
* 图片路径
*/
private String imagePath;
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ public enum ChannelType {
PUSH(20, "push(通知栏)", PushContentModel.class, "push"),
SMS(30, "sms(短信)", SmsContentModel.class, "sms"),
EMAIL(40, "email(邮件)", EmailContentModel.class, "email"),
OFFICIAL_ACCOUNT(50, "OfficialAccounts(服务号)", OfficialAccountsContentModel.class, "official_accounts"),
OFFICIAL_ACCOUNT(50, "officialAccounts(服务号)", OfficialAccountsContentModel.class, "official_accounts"),
MINI_PROGRAM(60, "miniProgram(小程序)", MiniProgramContentModel.class, "mini_program"),
ENTERPRISE_WE_CHAT(70, "EnterpriseWeChat(企业微信)", EnterpriseWeChatContentModel.class, "enterprise_we_chat"),
ENTERPRISE_WE_CHAT(70, "enterpriseWeChat(企业微信)", EnterpriseWeChatContentModel.class, "enterprise_we_chat"),
DING_DING_ROBOT(80, "dingDingRobot(钉钉机器人)", DingDingRobotContentModel.class, "ding_ding_robot"),
DING_DING_WORK_NOTICE(90, "dingDingWorkNotice(钉钉工作通知)", DingDingWorkContentModel.class, "ding_ding_work_notice"),
ENTERPRISE_WE_CHAT_ROBOT(100, "EnterpriseWeChat(企业微信机器人)", EnterpriseWeChatRobotContentModel.class, "enterprise_we_chat_robot"),
ENTERPRISE_WE_CHAT_ROBOT(100, "enterpriseWeChat(企业微信机器人)", EnterpriseWeChatRobotContentModel.class, "enterprise_we_chat_robot"),
FEI_SHU_ROBOT(110, "feiShuRoot(飞书机器人)", FeiShuRobotContentModel.class, "fei_shu_robot"),
;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,22 @@
@AllArgsConstructor
public enum SendMessageType {

TEXT("10", "文本", "text", "text","text"),
VOICE("20", "语音", null, "voice",null),
VIDEO("30", "视频", null, null,null),
NEWS("40", "图文", "feedCard", null,"news"),
TEXT_CARD("50", "文本卡片", null, null,null),
FILE("60", "文件", null, "file","file"),
MINI_PROGRAM_NOTICE("70", "小程序通知", null, null,null),
MARKDOWN("80", "markdown", "markdown", "markdown","markdown"),
TEMPLATE_CARD("90", "模板卡片", null, null,"template_card"),
IMAGE("100", "图片", null, "image","image"),
LINK("110", "链接消息", "link", "link",null),
ACTION_CARD("120", "跳转卡片消息", "actionCard", "action_card",null),
OA("130", "OA消息", null, "oa",null),
MP_NEWS("140", "图文消息(mpnews)", null, null,null),
TEXT("10", "文本", "text", "text","text","text"),
VOICE("20", "语音", null, "voice",null,null),
VIDEO("30", "视频", null, null,null,null),
NEWS("40", "图文", "feedCard", null,"news",null),
TEXT_CARD("50", "文本卡片", null, null,null,null),
FILE("60", "文件", null, "file","file",null),
MINI_PROGRAM_NOTICE("70", "小程序通知", null, null,null,null),
MARKDOWN("80", "markdown", "markdown", "markdown","markdown",null),
TEMPLATE_CARD("90", "模板卡片", null, null,"template_card",null),
IMAGE("100", "图片", null, "image","image","image"),
LINK("110", "链接消息", "link", "link",null,null),
ACTION_CARD("120", "跳转卡片消息", "actionCard", "action_card",null,"interactive"),
OA("130", "OA消息", null, "oa",null,null),
MP_NEWS("140", "图文消息(mpNews)", null, null,null,null),
RICH_TEXT("150", "富文本", null, null,null,"post"),
SHARE_CHAT("160", "群名片", null, null,null,"share_chat")

;

Expand All @@ -49,6 +51,11 @@ public enum SendMessageType {
*/
private String enterpriseWeChatRobotType;

/**
* 飞书机器人类型值
*/
private String feiShuRobotType;


/**
* 通过code获取钉钉机器人的Type值
Expand Down Expand Up @@ -94,5 +101,18 @@ public static String getEnterpriseWeChatRobotTypeByCode(String code) {
}
return null;
}

/**
* 通过code获取企业微信机器人的Type值
*
* @param code
* @return
*/
public static String geFeiShuRobotTypeByCode(String code) {
for (SendMessageType value : SendMessageType.values()) {
if (value.getCode().equals(code)) {
return value.getFeiShuRobotType();
}
}
return null;
}
}
Loading

0 comments on commit 7399f78

Please sign in to comment.