weixin4j-server:新增企业号消息服务相关类

This commit is contained in:
jinyu
2015-08-02 00:03:47 +08:00
parent 97dc88d7c7
commit 8ed7ba3f49
17 changed files with 487 additions and 44 deletions
@@ -171,7 +171,7 @@ public class OUserInfo implements Serializable {
/**
* 服务商套件中的对应应用id
*/
private String appid;
private int appid;
/**
* 授权方应用敏感权限组,目前仅有get_location,表示是否有权限设置应用获取地理位置的开关
*/
@@ -191,11 +191,11 @@ public class OUserInfo implements Serializable {
this.authType = null;
}
public String getAppid() {
public int getAppid() {
return appid;
}
public void setAppid(String appid) {
public void setAppid(int appid) {
this.appid = appid;
}
@@ -1,26 +0,0 @@
package com.foxinmy.weixin4j.qy.suite;
/**
* 应用套件回调事件
*
* @className SuiteEventType
* @author jy
* @date 2015年6月21日
* @since JDK 1.7
* @see <a
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AC%AC%E4%B8%89%E6%96%B9%E5%9B%9E%E8%B0%83%E5%8D%8F%E8%AE%AE">第三方回调协议</a>
*/
public enum SuiteEventType {
/**
* 推送ticket
*/
suite_ticket,
/**
* 变更授权
*/
change_auth,
/**
* 取消授权
*/
cancel_auth;
}
@@ -42,24 +42,19 @@ public class SuiteTicketHolder {
* @return
*/
public String getCacheKey() {
return getCacheKey0(suiteId);
}
private String getCacheKey0(String suiteId) {
return String.format("qy_suite_ticket_%s", suiteId);
}
/**
* 缓存ticket
*
* @param suiteTicket
* @param ticket
* @throws WeixinException
*/
public void cachingTicket(WeixinSuiteMessage suiteTicket)
throws WeixinException {
Token token = new Token(suiteTicket.getSuiteTicket());
public void cachingTicket(String ticket) throws WeixinException {
Token token = new Token(ticket);
token.setExpiresIn(-1);
tokenStorager.caching(getCacheKey0(suiteTicket.getSuiteId()), token);
tokenStorager.caching(getCacheKey(), token);
}
public String getSuiteId() {
@@ -1,76 +0,0 @@
package com.foxinmy.weixin4j.qy.suite;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
/**
* 套件消息
*
* @className WeixinSuiteMessage
* @author jy
* @date 2015年6月23日
* @since JDK 1.7
* @see
*/
@XmlRootElement(name = "xml")
@XmlAccessorType(XmlAccessType.FIELD)
public class WeixinSuiteMessage implements Serializable {
private static final long serialVersionUID = 6457919241019021514L;
/**
* 应用套件的SuiteId
*/
@XmlElement(name = "SuiteId")
private String suiteId;
/**
* 事件类型
*/
@XmlElement(name = "InfoType")
private SuiteEventType eventType;
/**
* 时间戳
*/
@XmlElement(name = "TimeStamp")
private long timeStamp;
/**
* Ticket内容
*/
@XmlElement(name = "SuiteTicket")
private String SuiteTicket;
/**
* 授权方企业号的corpid
*/
@XmlElement(name = "AuthCorpId")
private String authCorpId;
public String getSuiteId() {
return suiteId;
}
public SuiteEventType getEventType() {
return eventType;
}
public long getTimeStamp() {
return timeStamp;
}
public String getSuiteTicket() {
return SuiteTicket;
}
public String getAuthCorpId() {
return authCorpId;
}
@Override
public String toString() {
return "WeixinSuiteMessage [suiteId=" + suiteId + ", eventType="
+ eventType + ", timeStamp=" + timeStamp + ", SuiteTicket="
+ SuiteTicket + ", authCorpId=" + authCorpId + "]";
}
}