org.redkalex.weixin.WeiXinQYMessage Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of redkale-plugins Show documentation
Show all versions of redkale-plugins Show documentation
Redkale-Plugins -- java framework
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.redkalex.weixin;
import org.redkale.convert.json.JsonFactory;
import java.util.*;
import java.util.function.*;
/**
* 微信企业号Service
*
* 详情见: https://redkale.org
* @author zhangjx
*/
public class WeiXinQYMessage {
private String agentid = "1";
private String msgtype = "text";
private Map text;
private String touser = "@all";
private String toparty;
private String totag;
private String safe;
private Supplier contentSupplier;
public WeiXinQYMessage() {
}
public WeiXinQYMessage(String agentid, String text) {
this.agentid = agentid;
setTextMessage(text);
}
public WeiXinQYMessage(String agentid, Supplier contentSupplier) {
this.agentid = agentid;
this.contentSupplier = contentSupplier;
}
public final void setTextMessage(String content) {
if (content == null || content.isEmpty()) return;
if (text == null) text = new HashMap<>();
text.put("content", content);
}
public void supplyContent() {
if (contentSupplier != null) setTextMessage(contentSupplier.get());
}
public String getAgentid() {
return agentid;
}
public void setAgentid(String agentid) {
this.agentid = agentid;
}
public String getMsgtype() {
return msgtype;
}
public void setMsgtype(String msgtype) {
this.msgtype = msgtype;
}
public Map getText() {
return text;
}
public void setText(Map text) {
this.text = text;
}
public String getTouser() {
return touser;
}
public void setTouser(String touser) {
this.touser = touser;
}
public String getToparty() {
return toparty;
}
public void setToparty(String toparty) {
this.toparty = toparty;
}
public String getTotag() {
return totag;
}
public void setTotag(String totag) {
this.totag = totag;
}
public String getSafe() {
return safe;
}
public void setSafe(String safe) {
this.safe = safe;
}
@Override
public String toString() {
return JsonFactory.root().getConvert().convertTo(this);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy