cn.woodwhales.common.webhook.model.request.WeComRequestBody Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of woodwhales-common Show documentation
Show all versions of woodwhales-common Show documentation
https://github.com/woodwhales
package cn.woodwhales.common.webhook.model.request;
import lombok.Data;
import java.util.Objects;
/**
* @author woodwhales on 2021-07-19 18:26
*/
@Data
public class WeComRequestBody extends BaseWebhookRequestBody {
private String msgtype = "markdown";
private MarkdownContent markdown = new MarkdownContent();
public static WeComRequestBody newInstance(String title) {
WeComRequestBody feiShuNoticeRequestBody = new WeComRequestBody();
feiShuNoticeRequestBody.getMap().put("# ", title);
return feiShuNoticeRequestBody;
}
@Override
public void preToJsonSting() {
StringBuilder stringBuilder = new StringBuilder();
if(Objects.nonNull(map) && !map.isEmpty()) {
map.entrySet().stream().forEach(entry ->
stringBuilder.append(entry.getKey())
.append(entry.getValue())
.append(" \n")
);
}
this.markdown.setContent(stringBuilder.toString());
}
@Data
private static class MarkdownContent {
private String content;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy