weixin4j-server:新增了许多被动消息类型
This commit is contained in:
parent
c579aeea1b
commit
44a22ef0e1
@ -0,0 +1,52 @@
|
||||
package com.foxinmy.weixin4j.message;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
import com.foxinmy.weixin4j.request.WeixinMessage;
|
||||
import com.foxinmy.weixin4j.type.MessageType;
|
||||
|
||||
/**
|
||||
* 图片消息
|
||||
*
|
||||
* @className ImageMessage
|
||||
* @author jy.hu
|
||||
* @date 2014年4月6日
|
||||
* @since JDK 1.7
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/10/79502792eef98d6e0c6e1739da387346.html#.E5.9B.BE.E7.89.87.E6.B6.88.E6.81.AF">订阅号、服务号的图片消息</a>
|
||||
* @see <a
|
||||
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E6%8E%A5%E6%94%B6%E6%99%AE%E9%80%9A%E6%B6%88%E6%81%AF#image.E6.B6.88.E6.81.AF">企业号的图片消息</a>
|
||||
*/
|
||||
public class ImageMessage extends WeixinMessage {
|
||||
|
||||
private static final long serialVersionUID = 8430800898756567016L;
|
||||
|
||||
public ImageMessage() {
|
||||
super(MessageType.image.name());
|
||||
}
|
||||
|
||||
/**
|
||||
* 图片链接
|
||||
*/
|
||||
@XmlElement(name = "PicUrl")
|
||||
private String picUrl;
|
||||
/**
|
||||
* 图片消息媒体id,可以调用多媒体文件下载接口拉取数据。
|
||||
*/
|
||||
@XmlElement(name = "MediaId")
|
||||
private String mediaId;
|
||||
|
||||
public String getPicUrl() {
|
||||
return picUrl;
|
||||
}
|
||||
|
||||
public String getMediaId() {
|
||||
return mediaId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ImageMessage [picUrl=" + picUrl + ", mediaId=" + mediaId + ", "
|
||||
+ super.toString() + "]";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,59 @@
|
||||
package com.foxinmy.weixin4j.message;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
import com.foxinmy.weixin4j.request.WeixinMessage;
|
||||
import com.foxinmy.weixin4j.type.MessageType;
|
||||
|
||||
/**
|
||||
* 链接消息
|
||||
*
|
||||
* @className LinkMessage
|
||||
* @author jy.hu
|
||||
* @date 2014年4月6日
|
||||
* @since JDK 1.7
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/10/79502792eef98d6e0c6e1739da387346.html#.E9.93.BE.E6.8E.A5.E6.B6.88.E6.81.AF">订阅号、服务号的链接消息</a>
|
||||
*/
|
||||
public class LinkMessage extends WeixinMessage {
|
||||
|
||||
private static final long serialVersionUID = 754952745115497030L;
|
||||
|
||||
public LinkMessage() {
|
||||
super(MessageType.link.name());
|
||||
}
|
||||
|
||||
/**
|
||||
* 消息标题
|
||||
*/
|
||||
@XmlElement(name = "Title")
|
||||
private String title;
|
||||
/**
|
||||
* 消息描述
|
||||
*/
|
||||
@XmlElement(name = "Description")
|
||||
private String description;
|
||||
/**
|
||||
* 消息链接
|
||||
*/
|
||||
@XmlElement(name = "Url")
|
||||
private String url;
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LinkMessage [title=" + title + ", description=" + description
|
||||
+ ", url=" + url + ", " + super.toString() + "]";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
package com.foxinmy.weixin4j.message;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
import com.foxinmy.weixin4j.request.WeixinMessage;
|
||||
import com.foxinmy.weixin4j.type.MessageType;
|
||||
|
||||
/**
|
||||
* 地理位置消息
|
||||
*
|
||||
* @className LocationMessage
|
||||
* @author jy.hu
|
||||
* @date 2014年4月6日
|
||||
* @since JDK 1.7
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/10/79502792eef98d6e0c6e1739da387346.html#.E5.9C.B0.E7.90.86.E4.BD.8D.E7.BD.AE.E6.B6.88.E6.81.AF">订阅号、服务号的地理位置消息</a>
|
||||
* @see <a
|
||||
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E6%8E%A5%E6%94%B6%E6%99%AE%E9%80%9A%E6%B6%88%E6%81%AF#location.E6.B6.88.E6.81.AF">企业号的地理位置消息</a>
|
||||
*/
|
||||
public class LocationMessage extends WeixinMessage {
|
||||
|
||||
private static final long serialVersionUID = 2866021596599237334L;
|
||||
|
||||
public LocationMessage() {
|
||||
super(MessageType.location.name());
|
||||
}
|
||||
|
||||
/**
|
||||
* 地理位置维度
|
||||
*/
|
||||
@XmlElement(name = "Location_X")
|
||||
private double x;
|
||||
/**
|
||||
* 地理位置经度
|
||||
*/
|
||||
@XmlElement(name = "Location_Y")
|
||||
private double y;
|
||||
/**
|
||||
* 地图缩放大小
|
||||
*/
|
||||
@XmlElement(name = "Scale")
|
||||
private double scale;
|
||||
/**
|
||||
* 地理位置信息
|
||||
*/
|
||||
@XmlElement(name = "Label")
|
||||
private String label;
|
||||
|
||||
public double getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public double getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public double getScale() {
|
||||
return scale;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LocationMessage [x=" + x + ", y=" + y + ", scale=" + scale
|
||||
+ ", label=" + label + ", " + super.toString() + "]";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
普通消息
|
||||
-------
|
||||
|
||||
当普通微信用户向公众账号发消息时,微信服务器将POST消息的XML数据包到开发者填写的URL上。
|
||||
|
||||
微信服务器在五秒内收不到响应会断掉连接,并且重新发起请求,总共重试三次
|
||||
|
||||
关于重试的消息排重,推荐使用msgid排重。
|
||||
|
||||
假如服务器无法保证在五秒内处理并回复,可以直接回复空串,微信服务器不会对此作任何处理,并且不会发起重试。
|
||||
@ -0,0 +1,43 @@
|
||||
package com.foxinmy.weixin4j.message;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
import com.foxinmy.weixin4j.request.WeixinMessage;
|
||||
import com.foxinmy.weixin4j.type.MessageType;
|
||||
|
||||
/**
|
||||
* 文本消息
|
||||
*
|
||||
* @className TextMessage
|
||||
* @author jy.hu
|
||||
* @date 2014年4月6日
|
||||
* @since JDK 1.7
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/10/79502792eef98d6e0c6e1739da387346.html#.E6.96.87.E6.9C.AC.E6.B6.88.E6.81.AF">订阅号、服务号的文本消息</a>
|
||||
* @see <a
|
||||
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E6%8E%A5%E6%94%B6%E6%99%AE%E9%80%9A%E6%B6%88%E6%81%AF#text.E6.B6.88.E6.81.AF">企业号的文本消息</a>
|
||||
*/
|
||||
public class TextMessage extends WeixinMessage {
|
||||
|
||||
private static final long serialVersionUID = -7018053906644190260L;
|
||||
|
||||
public TextMessage() {
|
||||
super(MessageType.text.name());
|
||||
}
|
||||
|
||||
/**
|
||||
* 消息内容
|
||||
*/
|
||||
@XmlElement(name = "Content")
|
||||
private String content;
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TextMessage [content=" + content + ", " + super.toString()
|
||||
+ "]";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
package com.foxinmy.weixin4j.message;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
import com.foxinmy.weixin4j.request.WeixinMessage;
|
||||
import com.foxinmy.weixin4j.type.MessageType;
|
||||
|
||||
/**
|
||||
* 视频消息
|
||||
*
|
||||
* @className VideoMessage
|
||||
* @author jy.hu
|
||||
* @date 2014年4月6日
|
||||
* @since JDK 1.7
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/10/79502792eef98d6e0c6e1739da387346.html#.E8.A7.86.E9.A2.91.E6.B6.88.E6.81.AF">订阅号、服务号的视频消息</a>
|
||||
* @see <a
|
||||
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E6%8E%A5%E6%94%B6%E6%99%AE%E9%80%9A%E6%B6%88%E6%81%AF#video.E6.B6.88.E6.81.AF">企业号的视频消息</a>
|
||||
*/
|
||||
public class VideoMessage extends WeixinMessage {
|
||||
|
||||
private static final long serialVersionUID = -1013075358679078381L;
|
||||
|
||||
public VideoMessage() {
|
||||
super(MessageType.video.name());
|
||||
}
|
||||
|
||||
/**
|
||||
* 视频消息媒体id,可以调用多媒体文件下载接口拉取数据。
|
||||
*/
|
||||
@XmlElement(name = "MediaId")
|
||||
private String mediaId;
|
||||
/**
|
||||
* 视频消息缩略图的媒体id,可以调用多媒体文件下载接口拉取数据。
|
||||
*/
|
||||
@XmlElement(name = "ThumbMediaId")
|
||||
private String thumbMediaId;
|
||||
|
||||
public String getMediaId() {
|
||||
return mediaId;
|
||||
}
|
||||
|
||||
public String getThumbMediaId() {
|
||||
return thumbMediaId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VideoMessage [mediaId=" + mediaId + ", thumbMediaId="
|
||||
+ thumbMediaId + ", " + super.toString() + "]";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,65 @@
|
||||
package com.foxinmy.weixin4j.message;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
import com.foxinmy.weixin4j.request.WeixinMessage;
|
||||
import com.foxinmy.weixin4j.type.MessageType;
|
||||
|
||||
/**
|
||||
* 语音消息
|
||||
* <p>
|
||||
* 开通语音识别功能,用户每次发送语音给公众号时,微信会在推送的语音消息XML数据包中,赋值到Recongnition字段.
|
||||
* </p>
|
||||
*
|
||||
* @className VoiceMessage
|
||||
* @author jy.hu
|
||||
* @date 2014年4月6日
|
||||
* @since JDK 1.7
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/10/79502792eef98d6e0c6e1739da387346.html#.E8.AF.AD.E9.9F.B3.E6.B6.88.E6.81.AF">订阅号、服务号的语音消息</a>
|
||||
* @see <a
|
||||
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E6%8E%A5%E6%94%B6%E6%99%AE%E9%80%9A%E6%B6%88%E6%81%AF#voice.E6.B6.88.E6.81.AF">企业号的语音消息</a>
|
||||
*/
|
||||
public class VoiceMessage extends WeixinMessage {
|
||||
|
||||
private static final long serialVersionUID = -7988380977182214003L;
|
||||
|
||||
public VoiceMessage() {
|
||||
super(MessageType.voice.name());
|
||||
}
|
||||
|
||||
/**
|
||||
* 语音消息媒体id,可以调用多媒体文件下载接口拉取数据。
|
||||
*/
|
||||
@XmlElement(name = "MediaId")
|
||||
private String mediaId;
|
||||
/**
|
||||
* 语音格式,如amr,speex等
|
||||
*/
|
||||
@XmlElement(name = "Format")
|
||||
private String format;
|
||||
/**
|
||||
* 语音识别结果,UTF8编码
|
||||
*/
|
||||
@XmlElement(name = "Recognition")
|
||||
private String recognition;
|
||||
|
||||
public String getRecognition() {
|
||||
return recognition;
|
||||
}
|
||||
|
||||
public String getMediaId() {
|
||||
return mediaId;
|
||||
}
|
||||
|
||||
public String getFormat() {
|
||||
return format;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VoiceMessage [mediaId=" + mediaId + ", format=" + format
|
||||
+ ", recognition=" + recognition + ", " + super.toString()
|
||||
+ "]";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,45 @@
|
||||
package com.foxinmy.weixin4j.message.event;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
import com.foxinmy.weixin4j.request.WeixinMessage;
|
||||
import com.foxinmy.weixin4j.type.MessageType;
|
||||
|
||||
/**
|
||||
* 事件消息基类
|
||||
*
|
||||
* @className EventMessage
|
||||
* @author jy.hu
|
||||
* @date 2014年4月6日
|
||||
* @since JDK 1.7
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/9/981d772286d10d153a3dc4286c1ee5b5.html">订阅号、服务号的事件推送</a>
|
||||
* @see <a
|
||||
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E6%8E%A5%E6%94%B6%E4%BA%8B%E4%BB%B6">企业号的事件消息</a>
|
||||
*/
|
||||
public class EventMessage extends WeixinMessage {
|
||||
|
||||
private static final long serialVersionUID = 7703667223814088865L;
|
||||
|
||||
public EventMessage(String eventType) {
|
||||
super(MessageType.event.name());
|
||||
this.eventType = eventType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 事件类型
|
||||
*
|
||||
* @see com.foxinmy.weixin4j.type.EventType
|
||||
*/
|
||||
@XmlElement(name = "Event")
|
||||
private String eventType;
|
||||
|
||||
public String getEventType() {
|
||||
return eventType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "eventType=" + eventType + ", " + super.toString();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
package com.foxinmy.weixin4j.message.event;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
import com.foxinmy.weixin4j.type.EventType;
|
||||
|
||||
/**
|
||||
* 上报地理位置事件
|
||||
*
|
||||
* @className LocationEventMessage
|
||||
* @author jy.hu
|
||||
* @date 2014年4月6日
|
||||
* @since JDK 1.7
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/2/5baf56ce4947d35003b86a9805634b1e.html#.E4.B8.8A.E6.8A.A5.E5.9C.B0.E7.90.86.E4.BD.8D.E7.BD.AE.E4.BA.8B.E4.BB.B6">订阅号、服务号的上报地理位置事件</a>
|
||||
* @see <a
|
||||
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E6%8E%A5%E6%94%B6%E4%BA%8B%E4%BB%B6#.E4.B8.8A.E6.8A.A5.E5.9C.B0.E7.90.86.E4.BD.8D.E7.BD.AE.E4.BA.8B.E4.BB.B6">企业号的上报地理位置事件</a>
|
||||
*/
|
||||
public class LocationEventMessage extends EventMessage {
|
||||
|
||||
private static final long serialVersionUID = -2030716800669824861L;
|
||||
|
||||
public LocationEventMessage() {
|
||||
super(EventType.location.name());
|
||||
}
|
||||
/**
|
||||
* 地理位置纬度
|
||||
*/
|
||||
@XmlElement(name="Latitude")
|
||||
private String latitude;
|
||||
/**
|
||||
* 地理位置经度
|
||||
*/
|
||||
@XmlElement(name="Longitude")
|
||||
private String longitude;
|
||||
/**
|
||||
* 地理位置精度
|
||||
*/
|
||||
@XmlElement(name="Precision")
|
||||
private String precision;
|
||||
|
||||
public String getLatitude() {
|
||||
return latitude;
|
||||
}
|
||||
|
||||
public String getLongitude() {
|
||||
return longitude;
|
||||
}
|
||||
|
||||
public String getPrecision() {
|
||||
return precision;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LocationEventMessage [latitude=" + latitude + ", longitude="
|
||||
+ longitude + ", precision=" + precision + ", "
|
||||
+ super.toString() + "]";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
package com.foxinmy.weixin4j.message.event;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
import com.foxinmy.weixin4j.type.EventType;
|
||||
|
||||
/**
|
||||
* 自定义菜单事件(view|click)
|
||||
*
|
||||
* @className MenuEventMessage
|
||||
* @author jy.hu
|
||||
* @date 2014年4月6日
|
||||
* @since JDK 1.7
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/9/981d772286d10d153a3dc4286c1ee5b5.html#.E7.82.B9.E5.87.BB.E8.8F.9C.E5.8D.95.E6.8B.89.E5.8F.96.E6.B6.88.E6.81.AF.E6.97.B6.E7.9A.84.E4.BA.8B.E4.BB.B6.E6.8E.A8.E9.80.81">订阅号、服务号的菜单事件</a>
|
||||
* @see <a
|
||||
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E6%8E%A5%E6%94%B6%E4%BA%8B%E4%BB%B6#.E4.B8.8A.E6.8A.A5.E8.8F.9C.E5.8D.95.E4.BA.8B.E4.BB.B6">企业号的菜单事件</a>
|
||||
*/
|
||||
public class MenuEventMessage extends EventMessage {
|
||||
|
||||
private static final long serialVersionUID = -1049672447995366063L;
|
||||
|
||||
public MenuEventMessage() {
|
||||
super(EventType.click.name());
|
||||
}
|
||||
|
||||
public MenuEventMessage(EventType eventType) {
|
||||
super(eventType.name());
|
||||
}
|
||||
|
||||
/**
|
||||
* 事件KEY值,与自定义菜单接口中KEY值对应
|
||||
*/
|
||||
@XmlElement(name="EventKey")
|
||||
private String eventKey;
|
||||
|
||||
public String getEventKey() {
|
||||
return eventKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MenuEventMessage [eventKey=" + eventKey + ", "
|
||||
+ super.toString() + "]";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,110 @@
|
||||
package com.foxinmy.weixin4j.message.event;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
import com.foxinmy.weixin4j.type.EventType;
|
||||
|
||||
/**
|
||||
* 弹出地理位置选择器的事件推送
|
||||
*
|
||||
* @className MenuLocationEventMessage
|
||||
* @author jy
|
||||
* @date 2014年9月30日
|
||||
* @since JDK 1.7
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/9/981d772286d10d153a3dc4286c1ee5b5.html#location_select.EF.BC.9A.E5.BC.B9.E5.87.BA.E5.9C.B0.E7.90.86.E4.BD.8D.E7.BD.AE.E9.80.89.E6.8B.A9.E5.99.A8.E7.9A.84.E4.BA.8B.E4.BB.B6.E6.8E.A8.E9.80.81">订阅号、服务号的弹出地理位置选择事件推送</a>
|
||||
* @see <a
|
||||
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E6%8E%A5%E6%94%B6%E4%BA%8B%E4%BB%B6#.E5.BC.B9.E5.87.BA.E5.9C.B0.E7.90.86.E4.BD.8D.E7.BD.AE.E9.80.89.E6.8B.A9.E5.99.A8.E7.9A.84.E4.BA.8B.E4.BB.B6.E6.8E.A8.E9.80.81">企业号的弹出地理位置选择事件推送</a>
|
||||
*/
|
||||
public class MenuLocationEventMessage extends MenuEventMessage {
|
||||
|
||||
private static final long serialVersionUID = 145223888272819563L;
|
||||
|
||||
public MenuLocationEventMessage() {
|
||||
super(EventType.location_select);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送的位置消息
|
||||
*/
|
||||
@XmlElement(name = "SendLocationInfo")
|
||||
private LocationInfo locationInfo;
|
||||
|
||||
public LocationInfo getLocationInfo() {
|
||||
return locationInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 地理位置信息
|
||||
*
|
||||
* @className LocationInfo
|
||||
* @author jy
|
||||
* @date 2015年3月29日
|
||||
* @since JDK 1.7
|
||||
* @see
|
||||
*/
|
||||
public static class LocationInfo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 4904181780216819965L;
|
||||
|
||||
/**
|
||||
* 地理位置维度
|
||||
*/
|
||||
@XmlElement(name = "Location_X")
|
||||
private double x;
|
||||
/**
|
||||
* 地理位置经度
|
||||
*/
|
||||
@XmlElement(name = "Location_Y")
|
||||
private double y;
|
||||
/**
|
||||
* 地图缩放大小
|
||||
*/
|
||||
@XmlElement(name = "Scale")
|
||||
private double scale;
|
||||
/**
|
||||
* 地理位置信息
|
||||
*/
|
||||
@XmlElement(name = "Label")
|
||||
private String label;
|
||||
/**
|
||||
* 朋友圈POI的名字,可能为空
|
||||
*/
|
||||
@XmlElement(name = "Poiname")
|
||||
private String poiname;
|
||||
|
||||
public double getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public double getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public double getScale() {
|
||||
return scale;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public String getPoiname() {
|
||||
return poiname;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LocationInfo [x=" + x + ", y=" + y + ", scale=" + scale
|
||||
+ ", label=" + label + ", poiname=" + poiname + "]";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MenuLocationEventMessage [locationInfo=" + locationInfo + ", "
|
||||
+ super.toString() + "]";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,104 @@
|
||||
package com.foxinmy.weixin4j.message.event;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
* 弹出拍照或者相册发图的事件推送(pic_sysphoto|pic_photo_or_album|pic_weixin)
|
||||
*
|
||||
* @className MenuPhotoEventMessage
|
||||
* @author jy
|
||||
* @date 2014年9月30日
|
||||
* @since JDK 1.7
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/9/981d772286d10d153a3dc4286c1ee5b5.html#pic_sysphoto.EF.BC.9A.E5.BC.B9.E5.87.BA.E7.B3.BB.E7.BB.9F.E6.8B.8D.E7.85.A7.E5.8F.91.E5.9B.BE.E7.9A.84.E4.BA.8B.E4.BB.B6.E6.8E.A8.E9.80.81">订阅号、服务号的系统发图的事件推送</a>
|
||||
* @see <a
|
||||
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E6%8E%A5%E6%94%B6%E4%BA%8B%E4%BB%B6#.E5.BC.B9.E5.87.BA.E7.B3.BB.E7.BB.9F.E6.8B.8D.E7.85.A7.E5.8F.91.E5.9B.BE.E7.9A.84.E4.BA.8B.E4.BB.B6.E6.8E.A8.E9.80.81">企业号的系统发图的事件推送</a>
|
||||
*/
|
||||
public class MenuPhotoEventMessage extends MenuEventMessage {
|
||||
|
||||
private static final long serialVersionUID = 3142350663022709730L;
|
||||
|
||||
/**
|
||||
* 发送的图片信息
|
||||
*/
|
||||
@XmlElement(name = "SendPicsInfo")
|
||||
private PictureInfo pictureInfo;
|
||||
|
||||
public PictureInfo getPictureInfo() {
|
||||
return pictureInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 图片信息
|
||||
*
|
||||
* @className PictureInfo
|
||||
* @author jy
|
||||
* @date 2015年3月29日
|
||||
* @since JDK 1.7
|
||||
* @see
|
||||
*/
|
||||
public static class PictureInfo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -3361375879168233258L;
|
||||
|
||||
/**
|
||||
* 发送的图片数量
|
||||
*/
|
||||
@XmlElement(name = "Count")
|
||||
private int count;
|
||||
/**
|
||||
* 图片列表
|
||||
*/
|
||||
@XmlElement(name = "PicList")
|
||||
private List<PictureItem> items;
|
||||
|
||||
public int getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public List<PictureItem> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PictureInfo [count=" + count + ", items=" + items + "]";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 图片
|
||||
*
|
||||
* @className PictureItem
|
||||
* @author jy
|
||||
* @date 2015年3月29日
|
||||
* @since JDK 1.7
|
||||
* @see
|
||||
*/
|
||||
@XmlRootElement(name = "item")
|
||||
public static class PictureItem implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -7636697449096645590L;
|
||||
|
||||
/**
|
||||
* 图片的MD5值,开发者若需要,可用于验证接收到图片
|
||||
*/
|
||||
@XmlElement(name = "PicMd5Sum")
|
||||
private String md5;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PictureItem [md5=" + md5 + "]";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MenuPhotoEventMessage [pictureInfo=" + pictureInfo + ", "
|
||||
+ super.toString() + "]";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,75 @@
|
||||
package com.foxinmy.weixin4j.message.event;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
/**
|
||||
* 扫码推事件(scancode_push|scancode_waitmsg)
|
||||
*
|
||||
* @className MenuScanEventMessage
|
||||
* @author jy
|
||||
* @date 2014年9月30日
|
||||
* @since JDK 1.7
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/9/981d772286d10d153a3dc4286c1ee5b5.html#scancode_push.EF.BC.9A.E6.89.AB.E7.A0.81.E6.8E.A8.E4.BA.8B.E4.BB.B6.E7.9A.84.E4.BA.8B.E4.BB.B6.E6.8E.A8.E9.80.81">订阅号、服务号的扫码推事件</a>
|
||||
* @see <a
|
||||
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E6%8E%A5%E6%94%B6%E4%BA%8B%E4%BB%B6#.E6.89.AB.E7.A0.81.E6.8E.A8.E4.BA.8B.E4.BB.B6.E7.9A.84.E4.BA.8B.E4.BB.B6.E6.8E.A8.E9.80.81">企业号的的扫码推事件</a>
|
||||
*/
|
||||
public class MenuScanEventMessage extends MenuEventMessage {
|
||||
|
||||
private static final long serialVersionUID = 3142350663022709730L;
|
||||
|
||||
/**
|
||||
* 扫描信息
|
||||
*/
|
||||
@XmlElement(name = "ScanCodeInfo")
|
||||
private ScanInfo scanInfo;
|
||||
|
||||
public ScanInfo getScanInfo() {
|
||||
return scanInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 扫描信息
|
||||
*
|
||||
* @className ScanInfo
|
||||
* @author jy
|
||||
* @date 2015年3月29日
|
||||
* @since JDK 1.7
|
||||
* @see
|
||||
*/
|
||||
public static class ScanInfo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 2237570238164900421L;
|
||||
/**
|
||||
* 扫描类型,一般是qrcode
|
||||
*/
|
||||
@XmlElement(name = "ScanType")
|
||||
private String type;
|
||||
/**
|
||||
* 扫描结果,即二维码对应的字符串信息
|
||||
*/
|
||||
@XmlElement(name = "ScanResult")
|
||||
private String result;
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public String getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ScanInfo [type=" + type + ", result=" + result + "]";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MenuScanEventMessage [scanInfo=" + scanInfo + ", "
|
||||
+ super.toString() + "]";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
菜单事件消息
|
||||
|
||||
用户点击自定义菜单后,微信会把点击事件推送给开发者,请注意,点击菜单弹出子菜单,不会产生上报。请注意,第3个到第8个的所有事件,仅支持微信iPhone5.4.1以上版本,和Android5.4以上版本的微信用户,旧版本微信用户点击后将没有回应,开发者也不能正常接收到事件推送。
|
||||
@ -0,0 +1,41 @@
|
||||
package com.foxinmy.weixin4j.mp.event;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
import com.foxinmy.weixin4j.message.event.EventMessage;
|
||||
import com.foxinmy.weixin4j.type.EventType;
|
||||
|
||||
/**
|
||||
* 客服关闭会话事件
|
||||
*
|
||||
* @className KfCloseEventMessage
|
||||
* @author jy
|
||||
* @date 2015年3月22日
|
||||
* @since JDK 1.7
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html#.E4.BC.9A.E8.AF.9D.E7.8A.B6.E6.80.81.E9.80.9A.E7.9F.A5.E4.BA.8B.E4.BB.B6">会话状态通知事件</a>
|
||||
*/
|
||||
public class KfCloseEventMessage extends EventMessage {
|
||||
|
||||
private static final long serialVersionUID = 3644449346935205541L;
|
||||
|
||||
public KfCloseEventMessage() {
|
||||
super(EventType.kf_close_session.name());
|
||||
}
|
||||
|
||||
/**
|
||||
* 客服账号
|
||||
*/
|
||||
@XmlElement(name = "KfAccount")
|
||||
private String kfAccount;
|
||||
|
||||
public String getKfAccount() {
|
||||
return kfAccount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "KfCloseEventMessage [kfAccount=" + kfAccount + ", ="
|
||||
+ super.toString() + "]";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
package com.foxinmy.weixin4j.mp.event;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
import com.foxinmy.weixin4j.message.event.EventMessage;
|
||||
import com.foxinmy.weixin4j.type.EventType;
|
||||
|
||||
/**
|
||||
* 客服接入会话事件
|
||||
*
|
||||
* @className KfCreateEventMessage
|
||||
* @author jy
|
||||
* @date 2015年3月22日
|
||||
* @since JDK 1.7
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html#.E4.BC.9A.E8.AF.9D.E7.8A.B6.E6.80.81.E9.80.9A.E7.9F.A5.E4.BA.8B.E4.BB.B6">会话状态通知事件</a>
|
||||
*/
|
||||
public class KfCreateEventMessage extends EventMessage {
|
||||
|
||||
private static final long serialVersionUID = -8968189700999202108L;
|
||||
|
||||
public KfCreateEventMessage() {
|
||||
super(EventType.kf_create_session.name());
|
||||
}
|
||||
|
||||
/**
|
||||
* 客服账号
|
||||
*/
|
||||
@XmlElement(name = "KfAccount")
|
||||
private String kfAccount;
|
||||
|
||||
public String getKfAccount() {
|
||||
return kfAccount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "KfCreateEventMessage [kfAccount=" + kfAccount + ", ="
|
||||
+ super.toString() + "]";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
package com.foxinmy.weixin4j.mp.event;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
import com.foxinmy.weixin4j.message.event.EventMessage;
|
||||
import com.foxinmy.weixin4j.type.EventType;
|
||||
|
||||
/**
|
||||
* 客服转接会话事件
|
||||
*
|
||||
* @className KfSwitchEventMessage
|
||||
* @author jy
|
||||
* @date 2015年3月22日
|
||||
* @since JDK 1.7
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html#.E4.BC.9A.E8.AF.9D.E7.8A.B6.E6.80.81.E9.80.9A.E7.9F.A5.E4.BA.8B.E4.BB.B6">会话状态通知事件</a>
|
||||
*/
|
||||
public class KfSwitchEventMessage extends EventMessage {
|
||||
|
||||
private static final long serialVersionUID = 4319501074109623413L;
|
||||
|
||||
public KfSwitchEventMessage() {
|
||||
super(EventType.kf_switch_session.name());
|
||||
}
|
||||
|
||||
/**
|
||||
* 来自的客服账号
|
||||
*/
|
||||
@XmlElement(name = "FromKfAccount")
|
||||
private String fromKfAccount;
|
||||
/**
|
||||
* 转移给客服账号
|
||||
*/
|
||||
@XmlElement(name = "ToKfAccount")
|
||||
private String toKfAccount;
|
||||
|
||||
public String getFromKfAccount() {
|
||||
return fromKfAccount;
|
||||
}
|
||||
|
||||
public String getToKfAccount() {
|
||||
return toKfAccount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "KfSwitchEventMessage [fromKfAccount=" + fromKfAccount
|
||||
+ ", toKfAccount=" + toKfAccount + "]";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,93 @@
|
||||
package com.foxinmy.weixin4j.mp.event;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
import com.foxinmy.weixin4j.message.event.EventMessage;
|
||||
import com.foxinmy.weixin4j.type.EventType;
|
||||
import com.foxinmy.weixin4j.util.MessageUtil;
|
||||
|
||||
/**
|
||||
* 群发消息事件推送
|
||||
*
|
||||
* @className MassEventMessage
|
||||
* @author jy
|
||||
* @date 2014年4月27日
|
||||
* @since JDK 1.7
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/15/5380a4e6f02f2ffdc7981a8ed7a40753.html#.E4.BA.8B.E4.BB.B6.E6.8E.A8.E9.80.81.E7.BE.A4.E5.8F.91.E7.BB.93.E6.9E.9C">群发回调</a>
|
||||
*/
|
||||
public class MassEventMessage extends EventMessage {
|
||||
|
||||
private static final long serialVersionUID = -1660543255873723895L;
|
||||
|
||||
public MassEventMessage() {
|
||||
super(EventType.masssendjobfinish.name());
|
||||
}
|
||||
|
||||
/**
|
||||
* 群发后的状态信息 为“send success”或“send fail”或“err(num)
|
||||
*/
|
||||
@XmlElement(name = "Status")
|
||||
private String status;
|
||||
/**
|
||||
* group_id下粉丝数;或者openid_list中的粉丝数
|
||||
*/
|
||||
@XmlElement(name = "TotalCount")
|
||||
private int totalCount;
|
||||
/**
|
||||
* 过滤(过滤是指特定地区、性别的过滤、用户设置拒收的过滤,用户接收已超4条的过滤)后,准备发送的粉丝数,原则上,FilterCount =
|
||||
* SentCount + ErrorCount
|
||||
*/
|
||||
@XmlElement(name = "FilterCount")
|
||||
private int filterCount;
|
||||
/**
|
||||
* 发送成功的粉丝数
|
||||
*/
|
||||
@XmlElement(name = "SentCount")
|
||||
private int sentCount;
|
||||
/**
|
||||
* 发送失败的粉丝数
|
||||
*/
|
||||
@XmlElement(name = "ErrorCount")
|
||||
private int errorCount;
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送状态描述</br> err(10001,涉嫌广告) err(20001,涉嫌政治) err(20004,涉嫌社会)</br>
|
||||
* err(20002,涉嫌色情) err(20006,涉嫌违法犯罪) err(20008,涉嫌欺诈)</br> err(20013,涉嫌版权)
|
||||
* err(22000,涉嫌互推(互相宣传) err(21000,涉嫌其他)
|
||||
*
|
||||
* @param status
|
||||
* @return 中文描述
|
||||
*/
|
||||
public String getStatusDesc() {
|
||||
return MessageUtil.getMassStatusDesc(status.toLowerCase());
|
||||
}
|
||||
|
||||
public int getTotalCount() {
|
||||
return totalCount;
|
||||
}
|
||||
|
||||
public int getFilterCount() {
|
||||
return filterCount;
|
||||
}
|
||||
|
||||
public int getSentCount() {
|
||||
return sentCount;
|
||||
}
|
||||
|
||||
public int getErrorCount() {
|
||||
return errorCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MassEventMessage [status=" + getStatusDesc() + ", totalCount="
|
||||
+ totalCount + ", filterCount=" + filterCount + ", sentCount="
|
||||
+ sentCount + ", errorCount=" + errorCount + ", "
|
||||
+ super.toString() + "]";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
package com.foxinmy.weixin4j.mp.event;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
import com.foxinmy.weixin4j.message.event.EventMessage;
|
||||
import com.foxinmy.weixin4j.type.EventType;
|
||||
|
||||
/**
|
||||
* 扫描二维码事件
|
||||
*
|
||||
* @className ScanEventMessage
|
||||
* @author jy.hu
|
||||
* @date 2014年4月6日
|
||||
* @since JDK 1.7
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/2/5baf56ce4947d35003b86a9805634b1e.html#.E6.89.AB.E6.8F.8F.E5.B8.A6.E5.8F.82.E6.95.B0.E4.BA.8C.E7.BB.B4.E7.A0.81.E4.BA.8B.E4.BB.B6">扫描二维码事件</a>
|
||||
*/
|
||||
public class ScanEventMessage extends EventMessage {
|
||||
|
||||
private static final long serialVersionUID = 8078674062833071562L;
|
||||
|
||||
public ScanEventMessage() {
|
||||
super(EventType.scan.name());
|
||||
}
|
||||
|
||||
public ScanEventMessage(String eventType) {
|
||||
super(eventType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 事件KEY值,是一个32位无符号整数,即创建二维码时的二维码scene_id
|
||||
*/
|
||||
@XmlElement(name = "EventKey")
|
||||
private String eventKey;
|
||||
/**
|
||||
* 二维码的ticket,可用来换取二维码图片
|
||||
*/
|
||||
@XmlElement(name = "Ticket")
|
||||
private String ticket;
|
||||
|
||||
public String getEventKey() {
|
||||
return eventKey;
|
||||
}
|
||||
|
||||
public String getTicket() {
|
||||
return ticket;
|
||||
}
|
||||
|
||||
public String getParameter() {
|
||||
return eventKey.replace("qrscene_", "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ScanEventMessage [eventKey=" + eventKey + ", ticket=" + ticket
|
||||
+ ", " + super.toString() + "]";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
package com.foxinmy.weixin4j.mp.event;
|
||||
|
||||
import com.foxinmy.weixin4j.type.EventType;
|
||||
|
||||
/**
|
||||
* 关注/取消关注事件</br> <font color="red">包括直接关注与扫描关注</font>
|
||||
*
|
||||
* @className ScribeEventMessage
|
||||
* @author jy.hu
|
||||
* @date 2014年4月6日
|
||||
* @since JDK 1.7
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/2/5baf56ce4947d35003b86a9805634b1e.html#.E5.85.B3.E6.B3.A8.2F.E5.8F.96.E6.B6.88.E5.85.B3.E6.B3.A8.E4.BA.8B.E4.BB.B6">订阅号、服务号的关注/取消关注事件</a>
|
||||
*/
|
||||
public class ScribeEventMessage extends ScanEventMessage {
|
||||
|
||||
private static final long serialVersionUID = -6846321620262204915L;
|
||||
|
||||
public ScribeEventMessage() {
|
||||
super(EventType.subscribe.name());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ScribeEventMessage [" + super.toString() + "]";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
package com.foxinmy.weixin4j.mp.event;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
import com.foxinmy.weixin4j.message.event.EventMessage;
|
||||
import com.foxinmy.weixin4j.type.EventType;
|
||||
|
||||
/**
|
||||
* 模板消息事件推送(公众平台)
|
||||
*
|
||||
* @className TemplatesendjobfinishMessage
|
||||
* @author jy
|
||||
* @date 2014年9月19日
|
||||
* @since JDK 1.7
|
||||
* @see <a
|
||||
* href="http://mp.weixin.qq.com/wiki/17/304c1885ea66dbedf7dc170d84999a9d.html#.E4.BA.8B.E4.BB.B6.E6.8E.A8.E9.80.81">模板消息事件推送</a>
|
||||
*/
|
||||
public class TemplatesendjobfinishMessage extends EventMessage {
|
||||
|
||||
private static final long serialVersionUID = -2903359365988594012L;
|
||||
|
||||
public TemplatesendjobfinishMessage() {
|
||||
super(EventType.templatesendjobfinish.name());
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送状态 如failed: system failed
|
||||
*/
|
||||
@XmlElement(name = "Status")
|
||||
private String status;
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TemplatesendjobfinishMessage [status=" + status + ", "
|
||||
+ super.toString() + "]";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,101 @@
|
||||
package com.foxinmy.weixin4j.qy.event;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
import com.foxinmy.weixin4j.message.event.EventMessage;
|
||||
import com.foxinmy.weixin4j.type.EventType;
|
||||
|
||||
/**
|
||||
* 异步任务事件完成通知
|
||||
*
|
||||
* @className BatchjobresultMessage
|
||||
* @author jy
|
||||
* @date 2015年3月31日
|
||||
* @since JDK 1.7
|
||||
* @see <a
|
||||
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E6%8E%A5%E6%94%B6%E4%BA%8B%E4%BB%B6#.E5.BC.82.E6.AD.A5.E4.BB.BB.E5.8A.A1.E5.AE.8C.E6.88.90.E4.BA.8B.E4.BB.B6.E6.8E.A8.E9.80.81">异步任务事件完成通知</a>
|
||||
*/
|
||||
public class BatchjobresultMessage extends EventMessage {
|
||||
|
||||
private static final long serialVersionUID = 8014540441322209657L;
|
||||
|
||||
public BatchjobresultMessage() {
|
||||
super(EventType.batch_job_result.name());
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务信息
|
||||
*/
|
||||
@XmlElement(name = "BatchJob")
|
||||
private BatchJob batchJob;
|
||||
|
||||
public BatchJob getBatchJob() {
|
||||
return batchJob;
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务信息
|
||||
*
|
||||
* @className BatchJob
|
||||
* @author jy
|
||||
* @date 2015年4月1日
|
||||
* @since JDK 1.7
|
||||
* @see
|
||||
*/
|
||||
public static class BatchJob implements Serializable {
|
||||
private static final long serialVersionUID = -7520032656787156391L;
|
||||
/**
|
||||
* 异步任务id,最大长度为64字符
|
||||
*/
|
||||
@XmlElement(name = "JobId")
|
||||
private String jobId;
|
||||
/**
|
||||
* 操作类型,字符串,目前分别有: 1. sync_user(增量更新成员) 2. replace_user(全量覆盖成员) 3.
|
||||
* invite_user(邀请成员关注) 4. replace_party(全量覆盖部门)
|
||||
*
|
||||
* @see com.foxinmy.weixin4j.qy.type.BatchType
|
||||
*/
|
||||
@XmlElement(name = "JobType")
|
||||
private String jobType;
|
||||
/**
|
||||
* 返回码
|
||||
*/
|
||||
@XmlElement(name = "ErrCode")
|
||||
private String ErrCode;
|
||||
/**
|
||||
* 对返回码的文本描述内容
|
||||
*/
|
||||
@XmlElement(name = "ErrMsg")
|
||||
private String errMsg;
|
||||
|
||||
public String getJobId() {
|
||||
return jobId;
|
||||
}
|
||||
|
||||
public String getJobType() {
|
||||
return jobType;
|
||||
}
|
||||
|
||||
public String getErrCode() {
|
||||
return ErrCode;
|
||||
}
|
||||
|
||||
public String getErrMsg() {
|
||||
return errMsg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[jobId=" + jobId + ", jobType=" + jobType + ", ErrCode="
|
||||
+ ErrCode + ", errMsg=" + errMsg + "]";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BatchjobresultMessage [batchJob=" + batchJob + ", "
|
||||
+ super.toString() + "]";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
package com.foxinmy.weixin4j.qy.event;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
import com.foxinmy.weixin4j.message.event.EventMessage;
|
||||
import com.foxinmy.weixin4j.type.EventType;
|
||||
|
||||
/**
|
||||
* 用户进入应用的事件推送(企业号)本事件只有在应用的回调模式中打开上报开关时上报
|
||||
*
|
||||
* @className EnterAgentEventMessage
|
||||
* @author jy
|
||||
* @date 2014年12月28日
|
||||
* @since JDK 1.7
|
||||
* @see <a href=
|
||||
* "http://qydev.weixin.qq.com/wiki/index.php?title=%E6%8E%A5%E6%94%B6%E4%BA%8B%E4%BB%B6#.E7.94.A8.E6.88.B7.E8.BF.9B.E5.85.A5.E5.BA.94.E7.94.A8.E7.9A.84.E4.BA.8B.E4.BB.B6.E6.8E.A8.E9.80.81"
|
||||
* >用户进入应用的事件推送</a>
|
||||
*/
|
||||
public class EnterAgentEventMessage extends EventMessage {
|
||||
|
||||
private static final long serialVersionUID = 7675732524832500820L;
|
||||
|
||||
public EnterAgentEventMessage() {
|
||||
super(EventType.enter_agent.name());
|
||||
}
|
||||
|
||||
/**
|
||||
* 事件KEY值,与自定义菜单接口中KEY值对应
|
||||
*/
|
||||
@XmlElement(name = "EventKey")
|
||||
private String eventKey;
|
||||
|
||||
public String getEventKey() {
|
||||
return eventKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "EnterAgentEventMessage [eventKey=" + eventKey + ", "
|
||||
+ super.toString() + "]";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.foxinmy.weixin4j.qy.event;
|
||||
|
||||
import com.foxinmy.weixin4j.message.event.EventMessage;
|
||||
import com.foxinmy.weixin4j.type.EventType;
|
||||
|
||||
/**
|
||||
* 关注/取消关注事件</br> <font color="red">包括直接关注与扫描关注</font>
|
||||
*
|
||||
* @className ScribeEventMessage
|
||||
* @author jy.hu
|
||||
* @date 2014年4月6日
|
||||
* @since JDK 1.7
|
||||
* @see <a
|
||||
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E6%8E%A5%E6%94%B6%E4%BA%8B%E4%BB%B6#.E6.88.90.E5.91.98.E5.85.B3.E6.B3.A8.2F.E5.8F.96.E6.B6.88.E5.85.B3.E6.B3.A8.E4.BA.8B.E4.BB.B6">成员关注/取消关注事件</a>
|
||||
*/
|
||||
public class ScribeEventMessage extends EventMessage {
|
||||
|
||||
private static final long serialVersionUID = -6846321620262204915L;
|
||||
|
||||
public ScribeEventMessage() {
|
||||
super(EventType.subscribe.name());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ScribeEventMessage [" + super.toString() + "]";
|
||||
}
|
||||
}
|
||||
@ -6,7 +6,7 @@ import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
* 被动消息(待完善)
|
||||
* 基本被动消息
|
||||
*
|
||||
* @className WeixinMessage
|
||||
* @author jy
|
||||
@ -36,6 +36,22 @@ public class WeixinMessage implements Serializable {
|
||||
*
|
||||
*/
|
||||
private String msgType;
|
||||
/**
|
||||
* 消息ID 可用于排重
|
||||
*/
|
||||
private long msgId;
|
||||
/**
|
||||
* 企业号独有的应用ID
|
||||
*/
|
||||
private String agentId;
|
||||
|
||||
public WeixinMessage() {
|
||||
|
||||
}
|
||||
|
||||
public WeixinMessage(String msgType) {
|
||||
this.msgType = msgType;
|
||||
}
|
||||
|
||||
public String getToUserName() {
|
||||
return toUserName;
|
||||
@ -73,12 +89,66 @@ public class WeixinMessage implements Serializable {
|
||||
this.msgType = msgType;
|
||||
}
|
||||
|
||||
//@Override
|
||||
//public abstract boolean equals(Object obj) ;
|
||||
public long getMsgId() {
|
||||
return msgId;
|
||||
}
|
||||
|
||||
@XmlElement(name = "MsgId")
|
||||
public void setMsgId(long msgId) {
|
||||
this.msgId = msgId;
|
||||
}
|
||||
|
||||
public String getAgentId() {
|
||||
return agentId;
|
||||
}
|
||||
|
||||
@XmlElement(name = "AgentID")
|
||||
public void setAgentId(String agentId) {
|
||||
this.agentId = agentId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((agentId == null) ? 0 : agentId.hashCode());
|
||||
result = prime * result + (int) (createTime ^ (createTime >>> 32));
|
||||
result = prime * result
|
||||
+ ((fromUserName == null) ? 0 : fromUserName.hashCode());
|
||||
result = prime * result + (int) (msgId ^ (msgId >>> 32));
|
||||
result = prime * result + ((msgType == null) ? 0 : msgType.hashCode());
|
||||
result = prime * result
|
||||
+ ((toUserName == null) ? 0 : toUserName.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
WeixinMessage other = (WeixinMessage) obj;
|
||||
if (msgId > 0l && other.getMsgId() > 0l) {
|
||||
return msgId == other.getMsgId();
|
||||
}
|
||||
return fromUserName.equals(other.getFromUserName())
|
||||
&& createTime == other.getCreateTime();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return " toUserName=" + toUserName + ", fromUserName=" + fromUserName
|
||||
+ ", createTime=" + createTime + ", msgType=" + msgType;
|
||||
String toString = " toUserName=" + toUserName + ", fromUserName="
|
||||
+ fromUserName + ", createTime=" + createTime + ", msgType="
|
||||
+ msgType;
|
||||
if (msgId > 0l) {
|
||||
toString += ", msgId=" + msgId;
|
||||
}
|
||||
if (agentId != null) {
|
||||
toString += ", agentId=" + agentId;
|
||||
}
|
||||
return toString;
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,9 +30,9 @@ import com.foxinmy.weixin4j.util.MessageUtil;
|
||||
import com.foxinmy.weixin4j.util.StringUtil;
|
||||
|
||||
/**
|
||||
* 微信被动消息处理类
|
||||
* 微信请求处理类
|
||||
*
|
||||
* @className WeixinMessageHandler
|
||||
* @className WeixinRequestHandler
|
||||
* @author jy
|
||||
* @date 2014年11月16日
|
||||
* @since JDK 1.7
|
||||
|
||||
@ -21,9 +21,9 @@ import com.foxinmy.weixin4j.util.RandomUtil;
|
||||
import com.foxinmy.weixin4j.util.StringUtil;
|
||||
|
||||
/**
|
||||
* 微信消息编码类
|
||||
* 微信回复编码类
|
||||
*
|
||||
* @className WeixinMessageEncoder
|
||||
* @className WeixinResponseEncoder
|
||||
* @author jy
|
||||
* @date 2014年11月13日
|
||||
* @since JDK 1.7
|
||||
|
||||
@ -0,0 +1,129 @@
|
||||
package com.foxinmy.weixin4j.type;
|
||||
|
||||
/**
|
||||
* 事件类型
|
||||
*
|
||||
* @className EventType
|
||||
* @author jy
|
||||
* @date 2014年9月30日
|
||||
* @since JDK 1.7
|
||||
* @see
|
||||
*/
|
||||
public enum EventType {
|
||||
/**
|
||||
* 关注事件
|
||||
*
|
||||
*/
|
||||
subscribe,
|
||||
/**
|
||||
* 取消关注事件
|
||||
*
|
||||
*/
|
||||
unsubscribe,
|
||||
/**
|
||||
* 上报地理位置事件
|
||||
*
|
||||
* @see com.foxinmy.weixin4j.message.event.LocationEventMessage
|
||||
*/
|
||||
location,
|
||||
/**
|
||||
* 菜单扫描事件
|
||||
*
|
||||
* @see com.foxinmy.weixin4j.message.event.menu.MenuScanEventMessage
|
||||
*/
|
||||
scancode_push,
|
||||
/**
|
||||
* 菜单点击关键字事件
|
||||
*
|
||||
* @see com.foxinmy.weixin4j.message.event.menu.MenuEventMessage
|
||||
*/
|
||||
view,
|
||||
/**
|
||||
* 菜单点击链接事件
|
||||
*
|
||||
* @see com.foxinmy.weixin4j.message.event.menu.MenuEventMessage
|
||||
*/
|
||||
click,
|
||||
/**
|
||||
* 菜单扫描并调出等待界面事件
|
||||
*
|
||||
* @see com.foxinmy.weixin4j.message.event.menu.MenuScanEventMessage
|
||||
*/
|
||||
scancode_waitmsg,
|
||||
/**
|
||||
* 菜单弹出拍照事件
|
||||
*
|
||||
* @see com.foxinmy.weixin4j.message.event.menu.MenuPhotoEventMessage
|
||||
*/
|
||||
pic_sysphoto,
|
||||
/**
|
||||
* 菜单弹出发图事件
|
||||
*
|
||||
* @see com.foxinmy.weixin4j.message.event.menu.MenuPhotoEventMessage
|
||||
*/
|
||||
pic_photo_or_album,
|
||||
/**
|
||||
* 菜单弹出发图事件
|
||||
*
|
||||
* @see com.foxinmy.weixin4j.message.event.menu.MenuPhotoEventMessage
|
||||
*/
|
||||
pic_weixin,
|
||||
/**
|
||||
* 菜单发送地理位置事件
|
||||
*
|
||||
* @see com.foxinmy.weixin4j.message.event.menu.MenuLocationEventMessage
|
||||
*/
|
||||
location_select,
|
||||
|
||||
// ------------------------------公众平台特有------------------------------
|
||||
//
|
||||
|
||||
/**
|
||||
* 二维码扫描事件
|
||||
*
|
||||
* @see com.foxinmy.weixin4j.mp.event.ScanEventMessage
|
||||
*/
|
||||
scan,
|
||||
/**
|
||||
* 群发消息事件
|
||||
*
|
||||
* @see com.foxinmy.weixin4j.mp.event.MassEventMessage
|
||||
*/
|
||||
masssendjobfinish,
|
||||
/**
|
||||
* 模板消息事件
|
||||
*
|
||||
* @see com.foxinmy.weixin4j.mp.event.TemplatesendjobfinishMessage
|
||||
*/
|
||||
templatesendjobfinish,
|
||||
/**
|
||||
* 客服接入会话事件
|
||||
*
|
||||
* @see com.foxinmy.weixin4j.mp.event.KfCreateEventMessage
|
||||
*/
|
||||
kf_create_session,
|
||||
/**
|
||||
* 客服关闭会话事件
|
||||
*
|
||||
* @see com.foxinmy.weixin4j.mp.event.KfCloseEventMessage
|
||||
*/
|
||||
kf_close_session,
|
||||
/**
|
||||
* 客服转接会话事件
|
||||
*
|
||||
* @see com.foxinmy.weixin4j.mp.event.KfSwitchEventMessage
|
||||
*/
|
||||
kf_switch_session,
|
||||
/**
|
||||
* 异步任务完成事件
|
||||
*
|
||||
* @see com.foxinmy.weixin4j.qy.event.BatchjobresultMessage
|
||||
*/
|
||||
batch_job_result,
|
||||
/**
|
||||
* 进入企业号应用事件
|
||||
*
|
||||
* @see com.foxinmy.weixin4j.qy.event.EnterAgentEventMessage
|
||||
*/
|
||||
enter_agent;
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
package com.foxinmy.weixin4j.type;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* 消息类型
|
||||
*
|
||||
* @author jy.hu
|
||||
*
|
||||
*/
|
||||
public enum MessageType {
|
||||
/**
|
||||
* 文字消息
|
||||
*
|
||||
* @see com.foxinmy.weixin4j.message.TextMessage
|
||||
*/
|
||||
text,
|
||||
/**
|
||||
* 图片消息
|
||||
*
|
||||
* @see com.foxinmy.weixin4j.message.ImageMessage
|
||||
*/
|
||||
image,
|
||||
/**
|
||||
* 语音消息
|
||||
*
|
||||
* @see com.foxinmy.weixin4j.message.VoiceMessage
|
||||
*/
|
||||
voice,
|
||||
/**
|
||||
* 视频消息
|
||||
*
|
||||
* @see com.foxinmy.weixin4j.message.VideoMessage
|
||||
*/
|
||||
video,
|
||||
/**
|
||||
* 小视频消息
|
||||
*
|
||||
* @see com.foxinmy.weixin4j.message.VideoMessage
|
||||
*/
|
||||
shortvideo,
|
||||
/**
|
||||
* 位置消息
|
||||
*
|
||||
* @see com.foxinmy.weixin4j.message.LocationMessage
|
||||
*/
|
||||
location,
|
||||
/**
|
||||
* 链接消息
|
||||
*
|
||||
* @see com.foxinmy.weixin4j.message.LinkMessage
|
||||
*/
|
||||
link,
|
||||
/**
|
||||
* 事件消息
|
||||
*
|
||||
* @see com.foxinmy.weixin4j.message.event.EventMessage
|
||||
*/
|
||||
event;
|
||||
}
|
||||
@ -1,6 +1,8 @@
|
||||
package com.foxinmy.weixin4j.util;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
@ -153,4 +155,36 @@ public final class MessageUtil {
|
||||
}
|
||||
return xmlContent;
|
||||
}
|
||||
|
||||
private final static Map<String, String> massStatusMap;
|
||||
static {
|
||||
massStatusMap = new HashMap<String, String>();
|
||||
massStatusMap.put("sendsuccess", "发送成功");
|
||||
massStatusMap.put("send_success", "发送成功");
|
||||
massStatusMap.put("success", "发送成功");
|
||||
massStatusMap.put("send success", "发送成功");
|
||||
massStatusMap.put("sendfail", "发送失败");
|
||||
massStatusMap.put("send_fail", "发送失败");
|
||||
massStatusMap.put("fail", "发送失败");
|
||||
massStatusMap.put("send fail", "发送失败");
|
||||
massStatusMap.put("err(10001)", "涉嫌广告");
|
||||
massStatusMap.put("err(20001)", "涉嫌政治");
|
||||
massStatusMap.put("err(20004)", "涉嫌社会");
|
||||
massStatusMap.put("err(20006)", "涉嫌违法犯罪");
|
||||
massStatusMap.put("err(20008)", "涉嫌欺诈");
|
||||
massStatusMap.put("err(20013)", "涉嫌版权");
|
||||
massStatusMap.put("err(22000)", "涉嫌互推(互相宣传)");
|
||||
massStatusMap.put("err(21000)", "涉嫌其他");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取群发状态描述
|
||||
*
|
||||
* @param status
|
||||
* 状态
|
||||
* @return
|
||||
*/
|
||||
public static String getMassStatusDesc(String status) {
|
||||
return massStatusMap.get(status);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user