commit
0cf052d737
@ -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 EnterpriseWeChatRobotAccount {
|
||||||
|
/**
|
||||||
|
* 自定义群机器人中的 webhook
|
||||||
|
*/
|
||||||
|
private String webhook;
|
||||||
|
|
||||||
|
}
|
@ -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;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,310 @@
|
|||||||
|
package com.java3y.austin.handler.domain.feishu;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 3y
|
||||||
|
* 飞书机器人 请求参数
|
||||||
|
*/
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class FeiShuRobotParam {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* msgType
|
||||||
|
*/
|
||||||
|
@JSONField(name = "msg_type")
|
||||||
|
private String msgType;
|
||||||
|
/**
|
||||||
|
* content
|
||||||
|
*/
|
||||||
|
@JSONField(name = "content")
|
||||||
|
private ContentDTO content;
|
||||||
|
/**
|
||||||
|
* card
|
||||||
|
*/
|
||||||
|
@JSONField(name = "card")
|
||||||
|
private CardDTO card;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ContentDTO
|
||||||
|
*/
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public static class ContentDTO {
|
||||||
|
/**
|
||||||
|
* text
|
||||||
|
*/
|
||||||
|
@JSONField(name = "text")
|
||||||
|
private String text;
|
||||||
|
/**
|
||||||
|
* post
|
||||||
|
*/
|
||||||
|
@JSONField(name = "post")
|
||||||
|
private PostDTO post;
|
||||||
|
/**
|
||||||
|
* shareChatId
|
||||||
|
*/
|
||||||
|
@JSONField(name = "share_chat_id")
|
||||||
|
private String shareChatId;
|
||||||
|
/**
|
||||||
|
* imageKey
|
||||||
|
*/
|
||||||
|
@JSONField(name = "image_key")
|
||||||
|
private String imageKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PostDTO
|
||||||
|
*/
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public static class PostDTO {
|
||||||
|
/**
|
||||||
|
* zhCn
|
||||||
|
*/
|
||||||
|
@JSONField(name = "zh_cn")
|
||||||
|
private ZhCnDTO zhCn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ZhCnDTO
|
||||||
|
*/
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public static class ZhCnDTO {
|
||||||
|
/**
|
||||||
|
* title
|
||||||
|
*/
|
||||||
|
@JSONField(name = "title")
|
||||||
|
private String title;
|
||||||
|
/**
|
||||||
|
* content
|
||||||
|
*/
|
||||||
|
@JSONField(name = "content")
|
||||||
|
private List<List<ContentDTO.PostDTO.ZhCnDTO.PostContentDTO>> content;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ContentDTO
|
||||||
|
*/
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public static class PostContentDTO {
|
||||||
|
/**
|
||||||
|
* tag
|
||||||
|
*/
|
||||||
|
@JSONField(name = "tag")
|
||||||
|
private String tag;
|
||||||
|
/**
|
||||||
|
* text
|
||||||
|
*/
|
||||||
|
@JSONField(name = "text")
|
||||||
|
private String text;
|
||||||
|
/**
|
||||||
|
* href
|
||||||
|
*/
|
||||||
|
@JSONField(name = "href")
|
||||||
|
private String href;
|
||||||
|
/**
|
||||||
|
* userId
|
||||||
|
*/
|
||||||
|
@JSONField(name = "user_id")
|
||||||
|
private String userId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CardDTO
|
||||||
|
*/
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public static class CardDTO {
|
||||||
|
/**
|
||||||
|
* config
|
||||||
|
*/
|
||||||
|
@JSONField(name = "config")
|
||||||
|
private ConfigDTO config;
|
||||||
|
/**
|
||||||
|
* elements
|
||||||
|
*/
|
||||||
|
@JSONField(name = "elements")
|
||||||
|
private List<ElementsDTO> elements;
|
||||||
|
/**
|
||||||
|
* header
|
||||||
|
*/
|
||||||
|
@JSONField(name = "header")
|
||||||
|
private HeaderDTO header;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ConfigDTO
|
||||||
|
*/
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public static class ConfigDTO {
|
||||||
|
/**
|
||||||
|
* wideScreenMode
|
||||||
|
*/
|
||||||
|
@JSONField(name = "wide_screen_mode")
|
||||||
|
private Boolean wideScreenMode;
|
||||||
|
/**
|
||||||
|
* enableForward
|
||||||
|
*/
|
||||||
|
@JSONField(name = "enable_forward")
|
||||||
|
private Boolean enableForward;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HeaderDTO
|
||||||
|
*/
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public static class HeaderDTO {
|
||||||
|
/**
|
||||||
|
* title
|
||||||
|
*/
|
||||||
|
@JSONField(name = "title")
|
||||||
|
private TitleDTO title;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TitleDTO
|
||||||
|
*/
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public static class TitleDTO {
|
||||||
|
/**
|
||||||
|
* content
|
||||||
|
*/
|
||||||
|
@JSONField(name = "content")
|
||||||
|
private String content;
|
||||||
|
/**
|
||||||
|
* tag
|
||||||
|
*/
|
||||||
|
@JSONField(name = "tag")
|
||||||
|
private String tag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ElementsDTO
|
||||||
|
*/
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public static class ElementsDTO {
|
||||||
|
/**
|
||||||
|
* tag
|
||||||
|
*/
|
||||||
|
@JSONField(name = "tag")
|
||||||
|
private String tag;
|
||||||
|
/**
|
||||||
|
* text
|
||||||
|
*/
|
||||||
|
@JSONField(name = "text")
|
||||||
|
private TextDTO text;
|
||||||
|
/**
|
||||||
|
* actions
|
||||||
|
*/
|
||||||
|
@JSONField(name = "actions")
|
||||||
|
private List<ActionsDTO> actions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TextDTO
|
||||||
|
*/
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public static class TextDTO {
|
||||||
|
/**
|
||||||
|
* content
|
||||||
|
*/
|
||||||
|
@JSONField(name = "content")
|
||||||
|
private String content;
|
||||||
|
/**
|
||||||
|
* tag
|
||||||
|
*/
|
||||||
|
@JSONField(name = "tag")
|
||||||
|
private String tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ActionsDTO
|
||||||
|
*/
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public static class ActionsDTO {
|
||||||
|
/**
|
||||||
|
* tag
|
||||||
|
*/
|
||||||
|
@JSONField(name = "tag")
|
||||||
|
private String tag;
|
||||||
|
/**
|
||||||
|
* text
|
||||||
|
*/
|
||||||
|
@JSONField(name = "text")
|
||||||
|
private TextDTO text;
|
||||||
|
/**
|
||||||
|
* url
|
||||||
|
*/
|
||||||
|
@JSONField(name = "url")
|
||||||
|
private String url;
|
||||||
|
/**
|
||||||
|
* type
|
||||||
|
*/
|
||||||
|
@JSONField(name = "type")
|
||||||
|
private String type;
|
||||||
|
/**
|
||||||
|
* value
|
||||||
|
*/
|
||||||
|
@JSONField(name = "value")
|
||||||
|
private ValueDTO value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TextDTO
|
||||||
|
*/
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
public static class TextDTO {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ValueDTO
|
||||||
|
*/
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public static class ValueDTO {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package com.java3y.austin.handler.domain.feishu;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 3y
|
||||||
|
* 飞书机器人 返回值
|
||||||
|
*/
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class FeiShuRobotResult {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* extra
|
||||||
|
*/
|
||||||
|
@JSONField(name = "Extra")
|
||||||
|
private Object extra;
|
||||||
|
/**
|
||||||
|
* statusCode
|
||||||
|
*/
|
||||||
|
@JSONField(name = "StatusCode")
|
||||||
|
private Integer statusCode;
|
||||||
|
/**
|
||||||
|
* statusMessage
|
||||||
|
*/
|
||||||
|
@JSONField(name = "StatusMessage")
|
||||||
|
private String statusMessage;
|
||||||
|
/**
|
||||||
|
* code
|
||||||
|
*/
|
||||||
|
@JSONField(name = "code")
|
||||||
|
private Integer code;
|
||||||
|
/**
|
||||||
|
* msg
|
||||||
|
*/
|
||||||
|
@JSONField(name = "msg")
|
||||||
|
private String msg;
|
||||||
|
/**
|
||||||
|
* data
|
||||||
|
*/
|
||||||
|
@JSONField(name = "data")
|
||||||
|
private DataDTO data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DataDTO
|
||||||
|
*/
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
public static class DataDTO {
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,437 @@
|
|||||||
|
package com.java3y.austin.handler.domain.wechat.robot;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 钉钉自定义机器人 入参
|
||||||
|
*
|
||||||
|
* https://open.dingtalk.com/document/group/custom-robot-access
|
||||||
|
*
|
||||||
|
* @author 3y
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class EnterpriseWeChatRobotParam {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* msgtype
|
||||||
|
*/
|
||||||
|
@JSONField(name = "msgtype")
|
||||||
|
private String msgType;
|
||||||
|
/**
|
||||||
|
* text
|
||||||
|
*/
|
||||||
|
@JSONField(name = "text")
|
||||||
|
private TextDTO text;
|
||||||
|
/**
|
||||||
|
* markdown
|
||||||
|
*/
|
||||||
|
@JSONField(name = "markdown")
|
||||||
|
private MarkdownDTO markdown;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* markdown
|
||||||
|
*/
|
||||||
|
@JSONField(name = "image")
|
||||||
|
private ImageDTO image;
|
||||||
|
/**
|
||||||
|
* news
|
||||||
|
*/
|
||||||
|
@JSONField(name = "news")
|
||||||
|
private NewsDTO news;
|
||||||
|
/**
|
||||||
|
* file
|
||||||
|
*/
|
||||||
|
@JSONField(name = "file")
|
||||||
|
private FileDTO file;
|
||||||
|
/**
|
||||||
|
* templateCard
|
||||||
|
*/
|
||||||
|
@JSONField(name = "template_card")
|
||||||
|
private TemplateCardDTO templateCard;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TextDTO
|
||||||
|
*/
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class TextDTO {
|
||||||
|
/**
|
||||||
|
* content
|
||||||
|
*/
|
||||||
|
@JSONField(name = "content")
|
||||||
|
private String content;
|
||||||
|
/**
|
||||||
|
* mentionedList
|
||||||
|
*/
|
||||||
|
@JSONField(name = "mentioned_list")
|
||||||
|
private List<String> mentionedList;
|
||||||
|
/**
|
||||||
|
* mentionedMobileList
|
||||||
|
*/
|
||||||
|
@JSONField(name = "mentioned_mobile_list")
|
||||||
|
private List<String> mentionedMobileList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MarkdownDTO
|
||||||
|
*/
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class MarkdownDTO {
|
||||||
|
/**
|
||||||
|
* content
|
||||||
|
*/
|
||||||
|
@JSONField(name = "content")
|
||||||
|
private String content;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* ImageDTO
|
||||||
|
*/
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class ImageDTO {
|
||||||
|
/**
|
||||||
|
* base64
|
||||||
|
*/
|
||||||
|
@JSONField(name = "base64")
|
||||||
|
private String base64;
|
||||||
|
|
||||||
|
@JSONField(name = "md5")
|
||||||
|
private String md5;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NewsDTO
|
||||||
|
*/
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class NewsDTO {
|
||||||
|
/**
|
||||||
|
* articles
|
||||||
|
*/
|
||||||
|
@JSONField(name = "articles")
|
||||||
|
private List<ArticlesDTO> articles;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ArticlesDTO
|
||||||
|
*/
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class ArticlesDTO {
|
||||||
|
/**
|
||||||
|
* title
|
||||||
|
*/
|
||||||
|
@JSONField(name = "title")
|
||||||
|
private String title;
|
||||||
|
/**
|
||||||
|
* description
|
||||||
|
*/
|
||||||
|
@JSONField(name = "description")
|
||||||
|
private String description;
|
||||||
|
/**
|
||||||
|
* url
|
||||||
|
*/
|
||||||
|
@JSONField(name = "url")
|
||||||
|
private String url;
|
||||||
|
/**
|
||||||
|
* picurl
|
||||||
|
*/
|
||||||
|
@JSONField(name = "picurl")
|
||||||
|
private String picurl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FileDTO
|
||||||
|
*/
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class FileDTO {
|
||||||
|
/**
|
||||||
|
* mediaId
|
||||||
|
*/
|
||||||
|
@JSONField(name = "media_id")
|
||||||
|
private String mediaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TemplateCardDTO
|
||||||
|
*/
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class TemplateCardDTO {
|
||||||
|
/**
|
||||||
|
* cardType
|
||||||
|
*/
|
||||||
|
@JSONField(name = "card_type")
|
||||||
|
private String cardType;
|
||||||
|
/**
|
||||||
|
* source
|
||||||
|
*/
|
||||||
|
@JSONField(name = "source")
|
||||||
|
private SourceDTO source;
|
||||||
|
/**
|
||||||
|
* mainTitle
|
||||||
|
*/
|
||||||
|
@JSONField(name = "main_title")
|
||||||
|
private MainTitleDTO mainTitle;
|
||||||
|
/**
|
||||||
|
* emphasisContent
|
||||||
|
*/
|
||||||
|
@JSONField(name = "emphasis_content")
|
||||||
|
private EmphasisContentDTO emphasisContent;
|
||||||
|
/**
|
||||||
|
* quoteArea
|
||||||
|
*/
|
||||||
|
@JSONField(name = "quote_area")
|
||||||
|
private QuoteAreaDTO quoteArea;
|
||||||
|
/**
|
||||||
|
* subTitleText
|
||||||
|
*/
|
||||||
|
@JSONField(name = "sub_title_text")
|
||||||
|
private String subTitleText;
|
||||||
|
/**
|
||||||
|
* horizontalContentList
|
||||||
|
*/
|
||||||
|
@JSONField(name = "horizontal_content_list")
|
||||||
|
private List<HorizontalContentListDTO> horizontalContentList;
|
||||||
|
/**
|
||||||
|
* jumpList
|
||||||
|
*/
|
||||||
|
@JSONField(name = "jump_list")
|
||||||
|
private List<JumpListDTO> jumpList;
|
||||||
|
/**
|
||||||
|
* cardAction
|
||||||
|
*/
|
||||||
|
@JSONField(name = "card_action")
|
||||||
|
private CardActionDTO cardAction;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SourceDTO
|
||||||
|
*/
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class SourceDTO {
|
||||||
|
/**
|
||||||
|
* iconUrl
|
||||||
|
*/
|
||||||
|
@JSONField(name = "icon_url")
|
||||||
|
private String iconUrl;
|
||||||
|
/**
|
||||||
|
* desc
|
||||||
|
*/
|
||||||
|
@JSONField(name = "desc")
|
||||||
|
private String desc;
|
||||||
|
/**
|
||||||
|
* descColor
|
||||||
|
*/
|
||||||
|
@JSONField(name = "desc_color")
|
||||||
|
private Integer descColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MainTitleDTO
|
||||||
|
*/
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class MainTitleDTO {
|
||||||
|
/**
|
||||||
|
* title
|
||||||
|
*/
|
||||||
|
@JSONField(name = "title")
|
||||||
|
private String title;
|
||||||
|
/**
|
||||||
|
* desc
|
||||||
|
*/
|
||||||
|
@JSONField(name = "desc")
|
||||||
|
private String desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EmphasisContentDTO
|
||||||
|
*/
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class EmphasisContentDTO {
|
||||||
|
/**
|
||||||
|
* title
|
||||||
|
*/
|
||||||
|
@JSONField(name = "title")
|
||||||
|
private String title;
|
||||||
|
/**
|
||||||
|
* desc
|
||||||
|
*/
|
||||||
|
@JSONField(name = "desc")
|
||||||
|
private String desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* QuoteAreaDTO
|
||||||
|
*/
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class QuoteAreaDTO {
|
||||||
|
/**
|
||||||
|
* type
|
||||||
|
*/
|
||||||
|
@JSONField(name = "type")
|
||||||
|
private Integer type;
|
||||||
|
/**
|
||||||
|
* url
|
||||||
|
*/
|
||||||
|
@JSONField(name = "url")
|
||||||
|
private String url;
|
||||||
|
/**
|
||||||
|
* appid
|
||||||
|
*/
|
||||||
|
@JSONField(name = "appid")
|
||||||
|
private String appid;
|
||||||
|
/**
|
||||||
|
* pagepath
|
||||||
|
*/
|
||||||
|
@JSONField(name = "pagepath")
|
||||||
|
private String pagepath;
|
||||||
|
/**
|
||||||
|
* title
|
||||||
|
*/
|
||||||
|
@JSONField(name = "title")
|
||||||
|
private String title;
|
||||||
|
/**
|
||||||
|
* quoteText
|
||||||
|
*/
|
||||||
|
@JSONField(name = "quote_text")
|
||||||
|
private String quoteText;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CardActionDTO
|
||||||
|
*/
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class CardActionDTO {
|
||||||
|
/**
|
||||||
|
* type
|
||||||
|
*/
|
||||||
|
@JSONField(name = "type")
|
||||||
|
private Integer type;
|
||||||
|
/**
|
||||||
|
* url
|
||||||
|
*/
|
||||||
|
@JSONField(name = "url")
|
||||||
|
private String url;
|
||||||
|
/**
|
||||||
|
* appid
|
||||||
|
*/
|
||||||
|
@JSONField(name = "appid")
|
||||||
|
private String appid;
|
||||||
|
/**
|
||||||
|
* pagepath
|
||||||
|
*/
|
||||||
|
@JSONField(name = "pagepath")
|
||||||
|
private String pagepath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HorizontalContentListDTO
|
||||||
|
*/
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class HorizontalContentListDTO {
|
||||||
|
/**
|
||||||
|
* keyname
|
||||||
|
*/
|
||||||
|
@JSONField(name = "keyname")
|
||||||
|
private String keyname;
|
||||||
|
/**
|
||||||
|
* value
|
||||||
|
*/
|
||||||
|
@JSONField(name = "value")
|
||||||
|
private String value;
|
||||||
|
/**
|
||||||
|
* type
|
||||||
|
*/
|
||||||
|
@JSONField(name = "type")
|
||||||
|
private Integer type;
|
||||||
|
/**
|
||||||
|
* url
|
||||||
|
*/
|
||||||
|
@JSONField(name = "url")
|
||||||
|
private String url;
|
||||||
|
/**
|
||||||
|
* mediaId
|
||||||
|
*/
|
||||||
|
@JSONField(name = "media_id")
|
||||||
|
private String mediaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JumpListDTO
|
||||||
|
*/
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
public static class JumpListDTO {
|
||||||
|
/**
|
||||||
|
* type
|
||||||
|
*/
|
||||||
|
@JSONField(name = "type")
|
||||||
|
private Integer type;
|
||||||
|
/**
|
||||||
|
* url
|
||||||
|
*/
|
||||||
|
@JSONField(name = "url")
|
||||||
|
private String url;
|
||||||
|
/**
|
||||||
|
* title
|
||||||
|
*/
|
||||||
|
@JSONField(name = "title")
|
||||||
|
private String title;
|
||||||
|
/**
|
||||||
|
* appid
|
||||||
|
*/
|
||||||
|
@JSONField(name = "appid")
|
||||||
|
private String appid;
|
||||||
|
/**
|
||||||
|
* pagepath
|
||||||
|
*/
|
||||||
|
@JSONField(name = "pagepath")
|
||||||
|
private String pagepath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,106 @@
|
|||||||
|
package com.java3y.austin.handler.handler.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.codec.Base64;
|
||||||
|
import cn.hutool.core.io.file.FileReader;
|
||||||
|
import cn.hutool.crypto.digest.DigestUtil;
|
||||||
|
import cn.hutool.crypto.digest.MD5;
|
||||||
|
import cn.hutool.http.ContentType;
|
||||||
|
import cn.hutool.http.Header;
|
||||||
|
import cn.hutool.http.HttpRequest;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.google.common.base.Throwables;
|
||||||
|
import com.java3y.austin.common.constant.SendAccountConstant;
|
||||||
|
import com.java3y.austin.common.domain.TaskInfo;
|
||||||
|
import com.java3y.austin.common.dto.account.EnterpriseWeChatRobotAccount;
|
||||||
|
import com.java3y.austin.common.dto.model.EnterpriseWeChatRobotContentModel;
|
||||||
|
import com.java3y.austin.common.enums.ChannelType;
|
||||||
|
import com.java3y.austin.common.enums.SendMessageType;
|
||||||
|
import com.java3y.austin.handler.domain.wechat.robot.EnterpriseWeChatRobotParam;
|
||||||
|
import com.java3y.austin.handler.handler.BaseHandler;
|
||||||
|
import com.java3y.austin.handler.handler.Handler;
|
||||||
|
import com.java3y.austin.support.domain.MessageTemplate;
|
||||||
|
import com.java3y.austin.support.utils.AccountUtils;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业微信群机器人 消息处理器
|
||||||
|
*
|
||||||
|
* @author 3y
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class EnterpriseWeChatRobotHandler extends BaseHandler implements Handler {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AccountUtils accountUtils;
|
||||||
|
|
||||||
|
public EnterpriseWeChatRobotHandler() {
|
||||||
|
channelCode = ChannelType.ENTERPRISE_WE_CHAT_ROBOT.getCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handler(TaskInfo taskInfo) {
|
||||||
|
try {
|
||||||
|
EnterpriseWeChatRobotAccount account = accountUtils.getAccount(taskInfo.getSendAccount(), SendAccountConstant.ENTERPRISE_WECHAT_ROBOT_ACCOUNT_KEY, SendAccountConstant.ENTERPRISE_WECHAT_ROBOT_PREFIX, EnterpriseWeChatRobotAccount.class);
|
||||||
|
EnterpriseWeChatRobotParam enterpriseWeChatRobotParam = assembleParam(taskInfo);
|
||||||
|
String result = HttpRequest.post(account.getWebhook()).header(Header.CONTENT_TYPE.getValue(), ContentType.JSON.getValue())
|
||||||
|
.body(JSON.toJSONString(enterpriseWeChatRobotParam))
|
||||||
|
.timeout(2000)
|
||||||
|
.execute().body();
|
||||||
|
JSONObject jsonObject = JSON.parseObject(result);
|
||||||
|
if (jsonObject.getInteger("errcode") != 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
log.error("EnterpriseWeChatRobotHandler#handler fail! result:{},params:{}", JSON.toJSONString(jsonObject), JSON.toJSONString(taskInfo));
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("EnterpriseWeChatRobotHandler#handler fail!e:{},params:{}", Throwables.getStackTraceAsString(e), JSON.toJSONString(taskInfo));
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private EnterpriseWeChatRobotParam assembleParam(TaskInfo taskInfo) {
|
||||||
|
EnterpriseWeChatRobotContentModel contentModel = (EnterpriseWeChatRobotContentModel) taskInfo.getContentModel();
|
||||||
|
EnterpriseWeChatRobotParam param = EnterpriseWeChatRobotParam.builder()
|
||||||
|
.msgType(SendMessageType.getEnterpriseWeChatRobotTypeByCode(contentModel.getSendType())).build();
|
||||||
|
|
||||||
|
if (SendMessageType.TEXT.getCode().equals(contentModel.getSendType())) {
|
||||||
|
param.setText(EnterpriseWeChatRobotParam.TextDTO.builder().content(contentModel.getContent()).build());
|
||||||
|
}
|
||||||
|
if (SendMessageType.MARKDOWN.getCode().equals(contentModel.getSendType())) {
|
||||||
|
param.setMarkdown(EnterpriseWeChatRobotParam.MarkdownDTO.builder().content(contentModel.getContent()).build());
|
||||||
|
}
|
||||||
|
if (SendMessageType.IMAGE.getCode().equals(contentModel.getSendType())) {
|
||||||
|
FileReader fileReader = new FileReader(contentModel.getImagePath());
|
||||||
|
byte[] bytes = fileReader.readBytes();
|
||||||
|
param.setImage(EnterpriseWeChatRobotParam.ImageDTO.builder().base64(Base64.encode(bytes))
|
||||||
|
.md5(DigestUtil.md5Hex(bytes)).build());
|
||||||
|
}
|
||||||
|
if (SendMessageType.FILE.getCode().equals(contentModel.getSendType())) {
|
||||||
|
param.setFile(EnterpriseWeChatRobotParam.FileDTO.builder().mediaId(contentModel.getMediaId()).build());
|
||||||
|
}
|
||||||
|
if (SendMessageType.NEWS.getCode().equals(contentModel.getSendType())) {
|
||||||
|
List<EnterpriseWeChatRobotParam.NewsDTO.ArticlesDTO> articlesDTOS = JSON.parseArray(contentModel.getArticles(), EnterpriseWeChatRobotParam.NewsDTO.ArticlesDTO.class);
|
||||||
|
param.setNews(EnterpriseWeChatRobotParam.NewsDTO.builder().articles(articlesDTOS).build());
|
||||||
|
}
|
||||||
|
if (SendMessageType.TEMPLATE_CARD.getCode().equals(contentModel.getSendType())) {
|
||||||
|
//
|
||||||
|
}
|
||||||
|
return param;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void recall(MessageTemplate messageTemplate) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,106 @@
|
|||||||
|
package com.java3y.austin.handler.handler.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.codec.Base64;
|
||||||
|
import cn.hutool.core.io.file.FileReader;
|
||||||
|
import cn.hutool.crypto.digest.DigestUtil;
|
||||||
|
import cn.hutool.http.ContentType;
|
||||||
|
import cn.hutool.http.Header;
|
||||||
|
import cn.hutool.http.HttpRequest;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.google.common.base.Throwables;
|
||||||
|
import com.java3y.austin.common.constant.SendAccountConstant;
|
||||||
|
import com.java3y.austin.common.domain.TaskInfo;
|
||||||
|
import com.java3y.austin.common.dto.account.EnterpriseWeChatRobotAccount;
|
||||||
|
import com.java3y.austin.common.dto.account.FeiShuRobotAccount;
|
||||||
|
import com.java3y.austin.common.dto.model.EnterpriseWeChatRobotContentModel;
|
||||||
|
import com.java3y.austin.common.dto.model.FeiShuRobotContentModel;
|
||||||
|
import com.java3y.austin.common.enums.ChannelType;
|
||||||
|
import com.java3y.austin.common.enums.SendMessageType;
|
||||||
|
import com.java3y.austin.handler.domain.feishu.FeiShuRobotParam;
|
||||||
|
import com.java3y.austin.handler.domain.feishu.FeiShuRobotResult;
|
||||||
|
import com.java3y.austin.handler.domain.wechat.robot.EnterpriseWeChatRobotParam;
|
||||||
|
import com.java3y.austin.handler.handler.BaseHandler;
|
||||||
|
import com.java3y.austin.handler.handler.Handler;
|
||||||
|
import com.java3y.austin.support.domain.MessageTemplate;
|
||||||
|
import com.java3y.austin.support.utils.AccountUtils;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业微信群机器人 消息处理器
|
||||||
|
*
|
||||||
|
* @author 3y
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class FeiShuRobotHandler extends BaseHandler implements Handler {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AccountUtils accountUtils;
|
||||||
|
|
||||||
|
public FeiShuRobotHandler() {
|
||||||
|
channelCode = ChannelType.FEI_SHU_ROBOT.getCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handler(TaskInfo taskInfo) {
|
||||||
|
try {
|
||||||
|
FeiShuRobotAccount account = accountUtils.getAccount(taskInfo.getSendAccount(), SendAccountConstant.FEI_SHU_ROBOT_ACCOUNT_KEY, SendAccountConstant.FEI_SHU_ROBOT_PREFIX, FeiShuRobotAccount.class);
|
||||||
|
FeiShuRobotParam feiShuRobotParam = assembleParam(taskInfo);
|
||||||
|
String result = HttpRequest.post(account.getWebhook())
|
||||||
|
.header(Header.CONTENT_TYPE.getValue(), ContentType.JSON.getValue())
|
||||||
|
.body(JSON.toJSONString(feiShuRobotParam))
|
||||||
|
.timeout(2000)
|
||||||
|
.execute().body();
|
||||||
|
FeiShuRobotResult feiShuRobotResult = JSON.parseObject(result, FeiShuRobotResult.class);
|
||||||
|
if (feiShuRobotResult.getStatusCode() == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
log.error("FeiShuRobotHandler#handler fail! result:{},params:{}", JSON.toJSONString(feiShuRobotResult), JSON.toJSONString(taskInfo));
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("FeiShuRobotHandler#handler fail!e:{},params:{}", Throwables.getStackTraceAsString(e), JSON.toJSONString(taskInfo));
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private FeiShuRobotParam assembleParam(TaskInfo taskInfo) {
|
||||||
|
FeiShuRobotContentModel contentModel = (FeiShuRobotContentModel) taskInfo.getContentModel();
|
||||||
|
|
||||||
|
FeiShuRobotParam param = FeiShuRobotParam.builder()
|
||||||
|
.msgType(SendMessageType.geFeiShuRobotTypeByCode(contentModel.getSendType())).build();
|
||||||
|
|
||||||
|
if (SendMessageType.TEXT.getCode().equals(contentModel.getSendType())) {
|
||||||
|
param.setContent(FeiShuRobotParam.ContentDTO.builder().text(contentModel.getContent()).build());
|
||||||
|
}
|
||||||
|
if (SendMessageType.RICH_TEXT.getCode().equals(contentModel.getSendType())) {
|
||||||
|
List<FeiShuRobotParam.ContentDTO.PostDTO.ZhCnDTO.PostContentDTO> postContentDTOS = JSON.parseArray(contentModel.getPostContent(), FeiShuRobotParam.ContentDTO.PostDTO.ZhCnDTO.PostContentDTO.class);
|
||||||
|
List<List<FeiShuRobotParam.ContentDTO.PostDTO.ZhCnDTO.PostContentDTO>> postContentList = new ArrayList<>();
|
||||||
|
postContentList.add(postContentDTOS);
|
||||||
|
FeiShuRobotParam.ContentDTO.PostDTO postDTO = FeiShuRobotParam.ContentDTO.PostDTO.builder()
|
||||||
|
.zhCn(FeiShuRobotParam.ContentDTO.PostDTO.ZhCnDTO.builder().title(contentModel.getTitle()).content(postContentList).build())
|
||||||
|
.build();
|
||||||
|
param.setContent(FeiShuRobotParam.ContentDTO.builder().post(postDTO).build());
|
||||||
|
}
|
||||||
|
if (SendMessageType.SHARE_CHAT.getCode().equals(contentModel.getSendType())) {
|
||||||
|
param.setContent(FeiShuRobotParam.ContentDTO.builder().shareChatId(contentModel.getMediaId()).build());
|
||||||
|
}
|
||||||
|
if (SendMessageType.IMAGE.getCode().equals(contentModel.getSendType())) {
|
||||||
|
param.setContent(FeiShuRobotParam.ContentDTO.builder().imageKey(contentModel.getMediaId()).build());
|
||||||
|
}
|
||||||
|
if (SendMessageType.ACTION_CARD.getCode().equals(contentModel.getSendType())) {
|
||||||
|
//
|
||||||
|
}
|
||||||
|
return param;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void recall(MessageTemplate messageTemplate) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in new issue