From 7ecb0ee3aebb5e097ad75ef379b7b5a221f07bab Mon Sep 17 00:00:00 2001 From: mrpan <1049058427@qq.com> Date: Wed, 17 Nov 2021 16:21:19 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BC=81=E4=B8=9A=E7=BE=A4?= =?UTF-8?q?=E5=8F=91=E6=B6=88=E6=81=AF=E4=BB=BB=E5=8A=A1=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=20&&=20=E5=A2=9E=E5=8A=A0=E4=B8=BB=E9=83=A8=E9=97=A8=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cp/bean/external/WxCpMsgTemplate.java | 28 ++++++++++++------- .../cp/bean/message/WxCpXmlMessage.java | 8 +++++- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/WxCpMsgTemplate.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/WxCpMsgTemplate.java index 295eecb636..845aefcc77 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/WxCpMsgTemplate.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/WxCpMsgTemplate.java @@ -5,10 +5,7 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import me.chanjar.weixin.cp.bean.external.msg.Image; -import me.chanjar.weixin.cp.bean.external.msg.Link; -import me.chanjar.weixin.cp.bean.external.msg.MiniProgram; -import me.chanjar.weixin.cp.bean.external.msg.Text; +import me.chanjar.weixin.cp.bean.external.msg.*; import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder; import java.io.Serializable; @@ -19,7 +16,7 @@ *

* Created by songfan on 2020/7/14. * - * @author songfan + * @author songfan & Mr.Pan */ @Data @Builder @@ -28,21 +25,32 @@ public class WxCpMsgTemplate implements Serializable { private static final long serialVersionUID = 3172331565173474358L; + /** + * 群发任务的类型,默认为single,表示发送给客户,group表示发送给客户群 + */ @SerializedName("chat_type") private String chatType; + /** + * 客户的外部联系人id列表,仅在chat_type为single时有效,不可与sender同时为空,最多可传入1万个客户 + */ @SerializedName("external_userid") private List externalUserid; + /** + * 发送企业群发消息的成员userid,当类型为发送给客户群时必填 + */ private String sender; + /** + * 消息文本内容,最多4000个字节 + */ private Text text; - private Image image; - - private Link link; - - private MiniProgram miniprogram; + /** + * 附件,最多支持添加9个附件 + */ + private List attachments; public static WxCpMsgTemplate fromJson(String json) { return WxCpGsonBuilder.create().fromJson(json, WxCpMsgTemplate.class); diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/message/WxCpXmlMessage.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/message/WxCpXmlMessage.java index b791fffb54..c22595b43b 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/message/WxCpXmlMessage.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/message/WxCpXmlMessage.java @@ -220,6 +220,12 @@ public class WxCpXmlMessage implements Serializable { @XStreamConverter(value = LongArrayConverter.class) private Long[] departments; + /** + * 主部门 + */ + @XStreamAlias("MainDepartment") + private Long mainDepartment; + /** * 手机号码. */ @@ -533,7 +539,7 @@ public static class SendPicsInfo implements Serializable { @Data public static class Item implements Serializable { private static final long serialVersionUID = -6549728838848064881L; - + @XStreamAlias("PicMd5Sum") @XStreamConverter(value = XStreamCDataConverter.class) private String picMd5Sum;