精简WeixinAccount类及其配置文件

This commit is contained in:
jinyu
2015-07-29 10:58:41 +08:00
parent 0cca9d6d02
commit 954ee2175c
23 changed files with 256 additions and 268 deletions
@@ -34,7 +34,7 @@ public class Button implements Serializable {
*
* @see com.foxinmy.weixin4j.type.ButtonType
*/
private String type;
private ButtonType type;
/**
* 菜单KEY值,根据type的类型而定,用于消息接口推送,不超过128字节.
* <p>
@@ -43,7 +43,9 @@ public class Button implements Serializable {
* <p>
* 使用API设置的自定义菜单:</br>
* click、scancode_push、scancode_waitmsg、pic_sysphoto、pic_photo_or_album
* 、</br> pic_weixin、location_select:保存为keyview:保存为url;media_id、view_limited:保存为media_id
* 、</br>
* pic_weixin、location_select:保存为keyview:保存为url;media_id、view_limited
* :保存为media_id
* </p>
* </p>
*/
@@ -64,13 +66,13 @@ public class Button implements Serializable {
* 菜单显示的名称
* @param content
* 当buttonType为view时content设置为url,否则为key.
* @param buttonType
* @param type
* 按钮类型
*/
public Button(String name, String content, ButtonType buttonType) {
public Button(String name, String content, ButtonType type) {
this.name = name;
this.content = content;
this.type = buttonType.name();
this.type = type;
}
public String getName() {
@@ -81,16 +83,11 @@ public class Button implements Serializable {
this.name = name;
}
public String getType() {
public ButtonType getType() {
return type;
}
@JSONField(serialize = false, deserialize = false)
public ButtonType getFormatType() {
return ButtonType.valueOf(type);
}
public void setType(String type) {
public void setType(ButtonType type) {
this.type = type;
}
@@ -2,6 +2,9 @@ package com.foxinmy.weixin4j.model;
import java.io.Serializable;
import com.alibaba.fastjson.annotation.JSONCreator;
import com.alibaba.fastjson.annotation.JSONField;
/**
* 微信账号信息
*
@@ -12,6 +15,7 @@ import java.io.Serializable;
* @see
*/
public class WeixinAccount implements Serializable {
private static final long serialVersionUID = -6001008896414323534L;
/**
@@ -22,17 +26,10 @@ public class WeixinAccount implements Serializable {
* 调用接口的密钥
*/
private String secret;
private String token;
/**
* 安全模式下的加密密钥
*/
private String encodingAesKey;
public WeixinAccount() {
}
public WeixinAccount(String id, String secret) {
@JSONCreator
public WeixinAccount(@JSONField(name = "id") String id,
@JSONField(name = "secret") String secret) {
this.id = id;
this.secret = secret;
}
@@ -45,33 +42,8 @@ public class WeixinAccount implements Serializable {
return secret;
}
public void setId(String id) {
this.id = id;
}
public void setSecret(String secret) {
this.secret = secret;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public String getEncodingAesKey() {
return encodingAesKey;
}
public void setEncodingAesKey(String encodingAesKey) {
this.encodingAesKey = encodingAesKey;
}
@Override
public String toString() {
return "id=" + id + ", secret=" + secret + ", token=" + token
+ ", encodingAesKey=" + encodingAesKey;
return "id=" + id + ", secret=" + secret;
}
}
@@ -53,42 +53,28 @@ public class WeixinPayAccount extends WeixinAccount {
* @param appSecret
* 调用接口的凭证
* @param paySignKey
* 支付密钥字符串
* 支付密钥字符串(必填)
* @param mchId
* 微信支付分配的商户号
* 微信支付分配的商户号(V3版本必填)
* @param partnerId 财付通的商户号(V2版本必填)
* @param partnerKey 财付通商户权限密钥Key(V2版本必填)
* @param subMchId 微信支付分配的子商户号,受理模式下必填(商户平台版)
* @param deviceInfo 微信支付分配的设备号(商户平台版)
*/
@JSONCreator
public WeixinPayAccount(@JSONField(name = "appId") String appId,
@JSONField(name = "appSecret") String appSecret,
@JSONField(name = "paySignKey") String paySignKey,
@JSONField(name = "mchId") String mchId) {
super(appId, appSecret);
this.paySignKey = paySignKey;
this.mchId = mchId;
}
/**
* V2版本字段
*
* @param appId
* 公众号唯一的身份ID
* @param appSecret
* 调用接口的凭证
* @param paySignKey
* 支付密钥字符串
* @param partnerId
* 财付通账号的ID
* @param partnerKey
* 财付通账号的key
*/
@JSONCreator
public WeixinPayAccount(@JSONField(name = "appId") String appId,
@JSONField(name = "appSecret") String appSecret,
public WeixinPayAccount(@JSONField(name = "id") String appId,
@JSONField(name = "secret") String appSecret,
@JSONField(name = "paySignKey") String paySignKey,
@JSONField(name = "mchId") String mchId,
@JSONField(name = "subMchId") String subMchId,
@JSONField(name = "deviceInfo") String deviceInfo,
@JSONField(name = "partnerId") String partnerId,
@JSONField(name = "partnerKey") String partnerKey) {
super(appId, appSecret);
this.paySignKey = paySignKey;
this.mchId = mchId;
this.subMchId = subMchId;
this.deviceInfo = deviceInfo;
this.partnerId = partnerId;
this.partnerKey = partnerKey;
}
@@ -126,9 +112,10 @@ public class WeixinPayAccount extends WeixinAccount {
@Override
public String toString() {
return "WeixinPayAccount [paySignKey=" + paySignKey + ", partnerId="
+ partnerId + ", partnerKey=" + partnerKey + ", mchId=" + mchId
+ ", subMchId=" + subMchId + ", deviceInfo=" + deviceInfo
+ ", version=" + version + "]";
return "WeixinPayAccount [" + super.toString() + ", paySignKey="
+ paySignKey + ", partnerId=" + partnerId + ", partnerKey="
+ partnerKey + ", mchId=" + mchId + ", subMchId=" + subMchId
+ ", deviceInfo=" + deviceInfo + ", version=" + getVersion()
+ "]";
}
}
@@ -67,7 +67,7 @@ public class Video implements NotifyTuple {
}
/**
* 企业号
* 企业号 & 公众号群发
*
* @param mediaId
* @param title