主要去掉了实体类中的字段上@JSONFiled上的deserialize=false属性和不合理的format方法

This commit is contained in:
jinyu 2015-08-07 15:21:02 +08:00
parent 418f63d501
commit 4d5a6b228b
61 changed files with 946 additions and 760 deletions

View File

@ -423,4 +423,8 @@
* 2015-08-06 * 2015-08-06
+ **weixin4j-server**: 调整`LocationEventMessage`类中的经纬度字段类型为double + **weixin4j-server**: 调整`LocationEventMessage`类中的经纬度字段类型为double
* 2015-08-07
+ 主要去掉了实体类中的字段上@JSONFiled上的deserialize=false属性和不合理的format方法

View File

@ -56,7 +56,8 @@ public class Button implements Serializable {
@JSONField(name = "sub_button") @JSONField(name = "sub_button")
private List<Button> subs; private List<Button> subs;
public Button() { protected Button() {
this.subs = new ArrayList<Button>();
} }
/** /**
@ -73,6 +74,7 @@ public class Button implements Serializable {
this.name = name; this.name = name;
this.content = content; this.content = content;
this.type = type; this.type = type;
this.subs = new ArrayList<Button>();
} }
public String getName() { public String getName() {
@ -108,9 +110,6 @@ public class Button implements Serializable {
} }
public Button pushSub(Button btn) { public Button pushSub(Button btn) {
if (this.subs == null) {
this.subs = new ArrayList<Button>();
}
this.subs.add(btn); this.subs.add(btn);
return this; return this;
} }

View File

@ -5,6 +5,7 @@ import java.util.Date;
import java.util.List; import java.util.List;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.util.TypeUtils;
import com.foxinmy.weixin4j.tuple.MpArticle; import com.foxinmy.weixin4j.tuple.MpArticle;
/** /**
@ -33,7 +34,7 @@ public class MediaItem implements Serializable {
* 媒体素材最后更新时间 * 媒体素材最后更新时间
*/ */
@JSONField(name = "update_time") @JSONField(name = "update_time")
private Date updateTime; private String updateTime;
/** /**
* 图文素材列表 * 图文素材列表
*/ */
@ -56,11 +57,16 @@ public class MediaItem implements Serializable {
this.name = name; this.name = name;
} }
public Date getUpdateTime() { public String getUpdateTime() {
return updateTime; return updateTime;
} }
public void setUpdateTime(Date updateTime) { @JSONField(serialize = false)
public Date getForamtUpdateTime() {
return updateTime != null ? TypeUtils.castToDate(updateTime) : null;
}
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime; this.updateTime = updateTime;
} }

View File

@ -25,42 +25,36 @@ public class JsPayNotify extends PayBaseInfo {
/** /**
* 用户的openid * 用户的openid
*/ */
@JSONField(name = "OpenId")
@XmlElement(name = "OpenId") @XmlElement(name = "OpenId")
private String openid; private String openId;
/** /**
* 是否关注公众号 * 是否关注公众号
*/ */
@JSONField(name = "IsSubscribe")
@XmlElement(name = "IsSubscribe") @XmlElement(name = "IsSubscribe")
private int issubscribe; private int isSubscribe;
public JsPayNotify() { public JsPayNotify() {
} }
public String getOpenid() { public String getOpenId() {
return openid; return openId;
} }
public void setOpenid(String openid) { public int getIsSubscribe() {
this.openid = openid; return isSubscribe;
} }
public int getIssubscribe() { @JSONField(serialize = false)
return issubscribe; public boolean getFormatIsSubscribe() {
} return isSubscribe == 1;
public void setIssubscribe(int issubscribe) {
this.issubscribe = issubscribe;
}
@JSONField(serialize = false, deserialize = false)
public boolean getFormatIssubscribe() {
return issubscribe == 1;
} }
@Override @Override
public String toString() { public String toString() {
return "openid=" + openid + ", issubscribe=" + getFormatIssubscribe() return "openId=" + openId + ", isSubscribe=" + getFormatIsSubscribe()
+ ", " + super.toString(); + ", " + super.toString();
} }
} }

View File

@ -28,7 +28,9 @@ public class MicroPayPackage extends PayPackage {
/** /**
* 微信分配的公众账号 必须 * 微信分配的公众账号 必须
*/ */
private String appid; @XmlElement(name = "appid")
@JSONField(name = "appid")
private String appId;
/** /**
* 微信支付分配的商户号 必须 * 微信支付分配的商户号 必须
*/ */
@ -58,10 +60,10 @@ public class MicroPayPackage extends PayPackage {
@JSONField(name = "auth_code") @JSONField(name = "auth_code")
private String authCode; private String authCode;
protected MicroPayPackage(){ protected MicroPayPackage() {
// jaxb required // jaxb required
} }
public MicroPayPackage(WeixinPayAccount weixinAccount, String body, public MicroPayPackage(WeixinPayAccount weixinAccount, String body,
String attach, String outTradeNo, double totalFee, String attach, String outTradeNo, double totalFee,
String spbillCreateIp, String authCode) { String spbillCreateIp, String authCode) {
@ -71,21 +73,21 @@ public class MicroPayPackage extends PayPackage {
authCode); authCode);
} }
public MicroPayPackage(String appid, String mchId, String deviceInfo, public MicroPayPackage(String appId, String mchId, String deviceInfo,
String nonceStr, String body, String attach, String outTradeNo, String nonceStr, String body, String attach, String outTradeNo,
double totalFee, String spbillCreateIp, Date timeStart, double totalFee, String spbillCreateIp, Date timeStart,
Date timeExpire, String goodsTag, String authCode) { Date timeExpire, String goodsTag, String authCode) {
super(body, attach, outTradeNo, totalFee, spbillCreateIp, timeStart, super(body, attach, outTradeNo, totalFee, spbillCreateIp, timeStart,
timeExpire, goodsTag, null); timeExpire, goodsTag, null);
this.appid = appid; this.appId = appId;
this.mchId = mchId; this.mchId = mchId;
this.deviceInfo = deviceInfo; this.deviceInfo = deviceInfo;
this.nonceStr = nonceStr; this.nonceStr = nonceStr;
this.authCode = authCode; this.authCode = authCode;
} }
public String getAppid() { public String getAppId() {
return appid; return appId;
} }
public String getMchId() { public String getMchId() {
@ -118,7 +120,7 @@ public class MicroPayPackage extends PayPackage {
@Override @Override
public String toString() { public String toString() {
return "MicroPayPackage [appid=" + appid + ", mchId=" + mchId return "MicroPayPackage [appId=" + appId + ", mchId=" + mchId
+ ", deviceInfo=" + deviceInfo + ", nonceStr=" + nonceStr + ", deviceInfo=" + deviceInfo + ", nonceStr=" + nonceStr
+ ", sign=" + sign + ", authCode=" + authCode + ", " + ", sign=" + sign + ", authCode=" + authCode + ", "
+ super.toString() + "]"; + super.toString() + "]";

View File

@ -28,26 +28,31 @@ public class PayBaseInfo implements Serializable {
/** /**
* 公众号ID * 公众号ID
*/ */
@JSONField(name = "AppId")
@XmlElement(name = "AppId") @XmlElement(name = "AppId")
private String appId; private String appId;
/** /**
* 时间戳 * 时间戳
*/ */
@JSONField(name = "TimeStamp")
@XmlElement(name = "TimeStamp") @XmlElement(name = "TimeStamp")
private String timeStamp; private String timeStamp;
/** /**
* 随机字符串 * 随机字符串
*/ */
@JSONField(name = "NonceStr")
@XmlElement(name = "NonceStr") @XmlElement(name = "NonceStr")
private String nonceStr; private String nonceStr;
/** /**
* 签名结果 * 签名结果
*/ */
@JSONField(name = "AppSignature")
@XmlElement(name = "AppSignature") @XmlElement(name = "AppSignature")
private String paySign; private String paySign;
/** /**
* 签名方式 * 签名方式
*/ */
@JSONField(name = "SignMethod")
@XmlElement(name = "SignMethod") @XmlElement(name = "SignMethod")
private String signType; private String signType;
@ -87,17 +92,14 @@ public class PayBaseInfo implements Serializable {
return signType; return signType;
} }
@JSONField(serialize = false, deserialize = false) @JSONField(serialize = false)
public SignType getFormatSignType() { public SignType getFormatSignType() {
return SignType.valueOf(signType.toUpperCase()); return signType != null ? SignType.valueOf(signType.toUpperCase())
: null;
} }
public void setSignType(SignType signType) { public void setSignType(SignType signType) {
if (signType != null) { this.signType = signType != null ? signType.name() : null;
this.signType = signType.name();
} else {
this.signType = null;
}
} }
public PayBaseInfo() { public PayBaseInfo() {

View File

@ -13,7 +13,6 @@ import com.foxinmy.weixin4j.type.CouponStatus;
import com.foxinmy.weixin4j.type.CouponStockType; import com.foxinmy.weixin4j.type.CouponStockType;
import com.foxinmy.weixin4j.type.CouponType; import com.foxinmy.weixin4j.type.CouponType;
import com.foxinmy.weixin4j.util.DateUtil; import com.foxinmy.weixin4j.util.DateUtil;
import com.foxinmy.weixin4j.util.StringUtil;
/** /**
* 代金券详细 * 代金券详细
@ -173,10 +172,10 @@ public class CouponDetail extends ApiResult {
@JSONField(name = "is_partial_use") @JSONField(name = "is_partial_use")
private int isPartialUse; private int isPartialUse;
public CouponDetail(){ public CouponDetail() {
} }
public String getCouponStockId() { public String getCouponStockId() {
return couponStockId; return couponStockId;
} }
@ -185,7 +184,7 @@ public class CouponDetail extends ApiResult {
return couponStockType; return couponStockType;
} }
@JSONField(deserialize = false, serialize = false) @JSONField(serialize = false)
public CouponStockType getFormatCouponStockType() { public CouponStockType getFormatCouponStockType() {
for (CouponStockType couponStockType : CouponStockType.values()) { for (CouponStockType couponStockType : CouponStockType.values()) {
if (couponStockType.getVal() == this.couponStockType) { if (couponStockType.getVal() == this.couponStockType) {
@ -208,7 +207,7 @@ public class CouponDetail extends ApiResult {
* *
* @return 元单位 * @return 元单位
*/ */
@JSONField(deserialize = false, serialize = false) @JSONField(serialize = false)
public double getFormatCouponValue() { public double getFormatCouponValue() {
return couponValue / 100d; return couponValue / 100d;
} }
@ -222,7 +221,7 @@ public class CouponDetail extends ApiResult {
* *
* @return 元单位 * @return 元单位
*/ */
@JSONField(deserialize = false, serialize = false) @JSONField(serialize = false)
public double getFormatCouponMininum() { public double getFormatCouponMininum() {
return couponMininum / 100d; return couponMininum / 100d;
} }
@ -235,7 +234,7 @@ public class CouponDetail extends ApiResult {
return couponStatus; return couponStatus;
} }
@JSONField(deserialize = false, serialize = false) @JSONField(serialize = false)
public CouponStatus getFormatCouponStatus() { public CouponStatus getFormatCouponStatus() {
for (CouponStatus couponStatus : CouponStatus.values()) { for (CouponStatus couponStatus : CouponStatus.values()) {
if (couponStatus.getVal() == this.couponStatus) { if (couponStatus.getVal() == this.couponStatus) {
@ -272,7 +271,7 @@ public class CouponDetail extends ApiResult {
* *
* @return 元单位 * @return 元单位
*/ */
@JSONField(deserialize = false, serialize = false) @JSONField(serialize = false)
public double getFormatCouponUseValue() { public double getFormatCouponUseValue() {
return couponUseValue / 100d; return couponUseValue / 100d;
} }
@ -286,7 +285,7 @@ public class CouponDetail extends ApiResult {
* *
* @return 元单位 * @return 元单位
*/ */
@JSONField(deserialize = false, serialize = false) @JSONField(serialize = false)
public double getFormatCouponRemainValue() { public double getFormatCouponRemainValue() {
return couponRemainValue / 100d; return couponRemainValue / 100d;
} }
@ -295,37 +294,38 @@ public class CouponDetail extends ApiResult {
return beginTime; return beginTime;
} }
@JSONField(deserialize = false, serialize = false) @JSONField(serialize = false)
public Date getFormatBeginTime() { public Date getFormatBeginTime() {
return DateUtil.parse2yyyyMMddHHmmss(beginTime); return beginTime != null ? DateUtil.parse2yyyyMMddHHmmss(beginTime)
: null;
} }
public String getEndTime() { public String getEndTime() {
return endTime; return endTime;
} }
@JSONField(deserialize = false, serialize = false) @JSONField(serialize = false)
public Date getFormatEndTime() { public Date getFormatEndTime() {
return DateUtil.parse2yyyyMMddHHmmss(endTime); return endTime != null ? DateUtil.parse2yyyyMMddHHmmss(endTime) : null;
} }
public String getSendTime() { public String getSendTime() {
return sendTime; return sendTime;
} }
@JSONField(deserialize = false, serialize = false) @JSONField(serialize = false)
public Date getFormatSendTime() { public Date getFormatSendTime() {
return DateUtil.parse2yyyyMMddHHmmss(sendTime); return sendTime != null ? DateUtil.parse2yyyyMMddHHmmss(sendTime)
: null;
} }
public String getUseTime() { public String getUseTime() {
return useTime; return useTime;
} }
@JSONField(deserialize = false, serialize = false) @JSONField(serialize = false)
public Date getFormatUseTime() { public Date getFormatUseTime() {
return StringUtil.isNotBlank(useTime) ? DateUtil return useTime != null ? DateUtil.parse2yyyyMMddHHmmss(useTime) : null;
.parse2yyyyMMddHHmmss(useTime) : null;
} }
public String getTradeNo() { public String getTradeNo() {
@ -352,7 +352,7 @@ public class CouponDetail extends ApiResult {
return isPartialUse; return isPartialUse;
} }
@JSONField(deserialize = false, serialize = false) @JSONField(serialize = false)
public boolean getFormatIsPartialUse() { public boolean getFormatIsPartialUse() {
return isPartialUse == 1; return isPartialUse == 1;
} }
@ -374,7 +374,6 @@ public class CouponDetail extends ApiResult {
+ ", consumerMchId=" + consumerMchId + ", consumerMchName=" + ", consumerMchId=" + consumerMchId + ", consumerMchName="
+ consumerMchName + ", consumerMchAppid=" + consumerMchAppid + consumerMchName + ", consumerMchAppid=" + consumerMchAppid
+ ", sendSource=" + sendSource + ", isPartialUse=" + ", sendSource=" + sendSource + ", isPartialUse="
+ getFormatIsPartialUse() + ", " + super.toString() + getFormatIsPartialUse() + ", " + super.toString() + "]";
+ "]";
} }
} }

View File

@ -43,10 +43,10 @@ public class CouponInfo implements Serializable {
@JSONField(name = "coupon_fee") @JSONField(name = "coupon_fee")
private Integer couponFee; private Integer couponFee;
public CouponInfo(){ public CouponInfo() {
} }
public String getCouponBatchId() { public String getCouponBatchId() {
return couponBatchId; return couponBatchId;
} }
@ -64,9 +64,9 @@ public class CouponInfo implements Serializable {
* *
* @return 元单位 * @return 元单位
*/ */
@JSONField(serialize = false, deserialize = false) @JSONField(serialize = false)
public double getFormatCouponFee() { public double getFormatCouponFee() {
return couponFee / 100d; return couponFee != null ? couponFee.doubleValue() / 100d : 0d;
} }
public void setCouponId(String couponId) { public void setCouponId(String couponId) {

View File

@ -71,11 +71,11 @@ public class CouponResult extends ApiResult {
@XmlElement(name = "ret_msg") @XmlElement(name = "ret_msg")
@JSONField(name = "ret_msg") @JSONField(name = "ret_msg")
private String retMsg; private String retMsg;
public CouponResult(){ public CouponResult() {
} }
public String getCouponStockId() { public String getCouponStockId() {
return couponStockId; return couponStockId;
} }
@ -84,37 +84,30 @@ public class CouponResult extends ApiResult {
return responseCount; return responseCount;
} }
public int getSuccessCount() { public int getSuccessCount() {
return successCount; return successCount;
} }
public int getFailedCount() { public int getFailedCount() {
return failedCount; return failedCount;
} }
public String getOpenId() { public String getOpenId() {
return openId; return openId;
} }
public String getRetCode() { public String getRetCode() {
return retCode; return retCode;
} }
public String getCouponId() { public String getCouponId() {
return couponId; return couponId;
} }
public String getRetMsg() { public String getRetMsg() {
return retMsg; return retMsg;
} }
@Override @Override
public String toString() { public String toString() {
return "CouponResult [couponStockId=" + couponStockId return "CouponResult [couponStockId=" + couponStockId

View File

@ -119,10 +119,10 @@ public class CouponStock extends ApiResult {
@JSONField(name = "coupon_budget") @JSONField(name = "coupon_budget")
private Integer couponBudget; private Integer couponBudget;
public CouponStock(){ public CouponStock() {
} }
public String getCouponStockId() { public String getCouponStockId() {
return couponStockId; return couponStockId;
} }
@ -140,7 +140,7 @@ public class CouponStock extends ApiResult {
* *
* @return 元单位 * @return 元单位
*/ */
@JSONField(deserialize = false, serialize = false) @JSONField(serialize = false)
public double getFormatCouponValue() { public double getFormatCouponValue() {
return couponValue / 100d; return couponValue / 100d;
} }
@ -154,7 +154,7 @@ public class CouponStock extends ApiResult {
* *
* @return 元单位 * @return 元单位
*/ */
@JSONField(deserialize = false, serialize = false) @JSONField(serialize = false)
public double getFormatCouponMininumn() { public double getFormatCouponMininumn() {
return couponMininumn != null ? couponMininumn.intValue() / 100d : 0d; return couponMininumn != null ? couponMininumn.intValue() / 100d : 0d;
} }
@ -163,7 +163,7 @@ public class CouponStock extends ApiResult {
return couponType; return couponType;
} }
@JSONField(deserialize = false, serialize = false) @JSONField(serialize = false)
public CouponType getFormatCouponType() { public CouponType getFormatCouponType() {
for (CouponType couponType : CouponType.values()) { for (CouponType couponType : CouponType.values()) {
if (couponType.getVal() == this.couponType) { if (couponType.getVal() == this.couponType) {
@ -177,7 +177,7 @@ public class CouponStock extends ApiResult {
return couponStockStatus; return couponStockStatus;
} }
@JSONField(deserialize = false, serialize = false) @JSONField(serialize = false)
public CouponStockStatus getFormatCouponStockStatus() { public CouponStockStatus getFormatCouponStockStatus() {
for (CouponStockStatus couponStockStatus : CouponStockStatus.values()) { for (CouponStockStatus couponStockStatus : CouponStockStatus.values()) {
if (couponStockStatus.getVal() == this.couponStockStatus) { if (couponStockStatus.getVal() == this.couponStockStatus) {
@ -200,7 +200,7 @@ public class CouponStock extends ApiResult {
* *
* @return 元单位 * @return 元单位
*/ */
@JSONField(deserialize = false, serialize = false) @JSONField(serialize = false)
public double getFormatMaxQuota() { public double getFormatMaxQuota() {
return maxQuota != null ? maxQuota.intValue() / 100d : 0d; return maxQuota != null ? maxQuota.intValue() / 100d : 0d;
} }
@ -214,7 +214,7 @@ public class CouponStock extends ApiResult {
* *
* @return 元单位 * @return 元单位
*/ */
@JSONField(deserialize = false, serialize = false) @JSONField(serialize = false)
public double getFormatLockedNum() { public double getFormatLockedNum() {
return lockedNum != null ? lockedNum.intValue() / 100d : 0d; return lockedNum != null ? lockedNum.intValue() / 100d : 0d;
} }
@ -228,7 +228,7 @@ public class CouponStock extends ApiResult {
* *
* @return 元单位 * @return 元单位
*/ */
@JSONField(deserialize = false, serialize = false) @JSONField(serialize = false)
public double getFormatUsedNum() { public double getFormatUsedNum() {
return usedNum != null ? usedNum.intValue() / 100d : 0d; return usedNum != null ? usedNum.intValue() / 100d : 0d;
} }
@ -242,7 +242,7 @@ public class CouponStock extends ApiResult {
* *
* @return 元单位 * @return 元单位
*/ */
@JSONField(deserialize = false, serialize = false) @JSONField(serialize = false)
public double getFormatSendNum() { public double getFormatSendNum() {
return sendNum != null ? sendNum.intValue() / 100d : 0d; return sendNum != null ? sendNum.intValue() / 100d : 0d;
} }
@ -251,27 +251,29 @@ public class CouponStock extends ApiResult {
return beginTime; return beginTime;
} }
@JSONField(deserialize = false, serialize = false) @JSONField(serialize = false)
public Date getFormatBeginTime() { public Date getFormatBeginTime() {
return DateUtil.parse2yyyyMMddHHmmss(beginTime); return beginTime != null ? DateUtil.parse2yyyyMMddHHmmss(beginTime)
: null;
} }
public String getEndTime() { public String getEndTime() {
return endTime; return endTime;
} }
@JSONField(deserialize = false, serialize = false) @JSONField(serialize = false)
public Date getFormatEndTime() { public Date getFormatEndTime() {
return DateUtil.parse2yyyyMMddHHmmss(endTime); return endTime != null ? DateUtil.parse2yyyyMMddHHmmss(endTime) : null;
} }
public String getCreateTime() { public String getCreateTime() {
return createTime; return createTime;
} }
@JSONField(deserialize = false, serialize = false) @JSONField(serialize = false)
public Date getFormatCreateTime() { public Date getFormatCreateTime() {
return DateUtil.parse2yyyyMMddHHmmss(createTime); return createTime != null ? DateUtil.parse2yyyyMMddHHmmss(createTime)
: null;
} }
public Integer getCouponBudget() { public Integer getCouponBudget() {
@ -283,7 +285,7 @@ public class CouponStock extends ApiResult {
* *
* @return 元单位 * @return 元单位
*/ */
@JSONField(deserialize = false, serialize = false) @JSONField(serialize = false)
public double getFormatCouponBudget() { public double getFormatCouponBudget() {
return couponBudget != null ? couponBudget.intValue() / 100d : 0d; return couponBudget != null ? couponBudget.intValue() / 100d : 0d;
} }

View File

@ -7,7 +7,6 @@ import javax.xml.bind.annotation.XmlRootElement;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import com.foxinmy.weixin4j.http.weixin.XmlResult; import com.foxinmy.weixin4j.http.weixin.XmlResult;
import com.foxinmy.weixin4j.util.StringUtil;
/** /**
* 调用V3.x接口返回的公用字段 * 调用V3.x接口返回的公用字段
@ -88,7 +87,7 @@ public class ApiResult extends XmlResult {
} }
public String getSubMchId() { public String getSubMchId() {
return StringUtil.isNotBlank(subMchId) ? subMchId : null; return subMchId;
} }
public void setSubMchId(String subMchId) { public void setSubMchId(String subMchId) {
@ -127,7 +126,7 @@ public class ApiResult extends XmlResult {
this.recall = recall; this.recall = recall;
} }
@JSONField(deserialize = false, serialize = false) @JSONField(serialize = false)
public boolean getFormatRecall() { public boolean getFormatRecall() {
return recall != null && recall.equalsIgnoreCase("y"); return recall != null && recall.equalsIgnoreCase("y");
} }

View File

@ -34,7 +34,9 @@ public class MPPayment implements Serializable {
/** /**
* 接收红包的用户的openid * 接收红包的用户的openid
*/ */
private String openid; @JSONField(name = "openid")
@XmlElement(name = "openid")
private String openId;
/** /**
* 校验用户姓名选项 * 校验用户姓名选项
* *
@ -71,17 +73,17 @@ public class MPPayment implements Serializable {
/** /**
* 企业付款 * 企业付款
* @param outTradeNo 商户的订单号 * @param outTradeNo 商户的订单号
* @param openid 用户的openid * @param openId 用户的openid
* @param checkNameType 校验用户姓名选项 * @param checkNameType 校验用户姓名选项
* @param desc 描述 * @param desc 描述
* @param amount 金额 * @param amount 金额
* @param clientIp 调用接口IP * @param clientIp 调用接口IP
*/ */
public MPPayment(String outTradeNo, String openid, public MPPayment(String outTradeNo, String openId,
MPPaymentCheckNameType checkNameType, String desc, double amount, MPPaymentCheckNameType checkNameType, String desc, double amount,
String clientIp) { String clientIp) {
this.outTradeNo = outTradeNo; this.outTradeNo = outTradeNo;
this.openid = openid; this.openId = openId;
this.checkNameType = checkNameType; this.checkNameType = checkNameType;
this.desc = desc; this.desc = desc;
this.amount = DateUtil.formaFee2Fen(amount); this.amount = DateUtil.formaFee2Fen(amount);
@ -92,8 +94,8 @@ public class MPPayment implements Serializable {
return outTradeNo; return outTradeNo;
} }
public String getOpenid() { public String getOpenId() {
return openid; return openId;
} }
public MPPaymentCheckNameType getCheckNameType() { public MPPaymentCheckNameType getCheckNameType() {
@ -122,7 +124,7 @@ public class MPPayment implements Serializable {
@Override @Override
public String toString() { public String toString() {
return "MPPayment [outTradeNo=" + outTradeNo + ", openid=" + openid return "MPPayment [outTradeNo=" + outTradeNo + ", openId=" + openId
+ ", checkNameType=" + checkNameType + ", userName=" + userName + ", checkNameType=" + checkNameType + ", userName=" + userName
+ ", desc=" + desc + ", amount=" + amount + ", clientIp=" + ", desc=" + desc + ", amount=" + amount + ", clientIp="
+ clientIp + "]"; + clientIp + "]";

View File

@ -53,8 +53,9 @@ public class MPPaymentRecord extends ApiResult {
/** /**
* 收款用户openid * 收款用户openid
*/ */
@JSONField(name = "openid")
@XmlElement(name = "openid") @XmlElement(name = "openid")
private String openid; private String openId;
/** /**
* 收款用户姓名 * 收款用户姓名
*/ */
@ -80,7 +81,7 @@ public class MPPaymentRecord extends ApiResult {
*/ */
@XmlElement(name = "check_name") @XmlElement(name = "check_name")
@JSONField(name = "check_name") @JSONField(name = "check_name")
private MPPaymentCheckNameType checkNameType; private String checkNameType;
/** /**
* 企业付款描述信息 * 企业付款描述信息
*/ */
@ -123,8 +124,8 @@ public class MPPaymentRecord extends ApiResult {
return failureReason; return failureReason;
} }
public String getOpenid() { public String getOpenId() {
return openid; return openId;
} }
public String getTransferName() { public String getTransferName() {
@ -156,13 +157,20 @@ public class MPPaymentRecord extends ApiResult {
*/ */
@JSONField(serialize = false) @JSONField(serialize = false)
public Date getFormatTransferTime() { public Date getFormatTransferTime() {
return DateUtil.parse2yyyyMMddHHmmss(transferTime); return transferTime != null ? DateUtil
.parse2yyyyMMddHHmmss(transferTime) : null;
} }
public MPPaymentCheckNameType getCheckNameType() { public String getCheckNameType() {
return checkNameType; return checkNameType;
} }
@JSONField(serialize = false)
public MPPaymentCheckNameType getFormatCheckNameType() {
return checkNameType != null ? MPPaymentCheckNameType
.valueOf(checkNameType) : null;
}
public String getDesc() { public String getDesc() {
return desc; return desc;
} }
@ -186,7 +194,7 @@ public class MPPaymentRecord extends ApiResult {
return "MPPaymentRecord [transactionId=" + transactionId return "MPPaymentRecord [transactionId=" + transactionId
+ ", outTradeNo=" + outTradeNo + ", transactionStatus=" + ", outTradeNo=" + outTradeNo + ", transactionStatus="
+ getFormatTransactionStatus() + ", failureReason=" + getFormatTransactionStatus() + ", failureReason="
+ failureReason + ", openid=" + openid + ", transferName=" + failureReason + ", openId=" + openId + ", transferName="
+ transferName + ", paymentAmount=" + getFormatPaymentAmount() + transferName + ", paymentAmount=" + getFormatPaymentAmount()
+ ", transferTime=" + transferTime + ", checkNameType=" + ", transferTime=" + transferTime + ", checkNameType="
+ checkNameType + ", desc=" + desc + ", checkNameResult=" + checkNameType + ", desc=" + desc + ", checkNameResult="

View File

@ -31,7 +31,9 @@ public class MchPayPackage extends PayPackage {
/** /**
* 微信分配的公众账号 必须 * 微信分配的公众账号 必须
*/ */
private String appid; @XmlElement(name = "appid")
@JSONField(name = "appid")
private String appId;
/** /**
* 微信支付分配的商户号 必须 * 微信支付分配的商户号 必须
*/ */
@ -63,7 +65,9 @@ public class MchPayPackage extends PayPackage {
/** /**
* 用户在商户 appid 下的唯一 标识, trade_type JSAPI ,此参数必传 * 用户在商户 appid 下的唯一 标识, trade_type JSAPI ,此参数必传
*/ */
private String openid; @XmlElement(name = "openid")
@JSONField(name = "openid")
private String openId;
/** /**
* 只在 trade_type NATIVE 时需要填写 非必须 * 只在 trade_type NATIVE 时需要填写 非必须
*/ */
@ -91,24 +95,24 @@ public class MchPayPackage extends PayPackage {
notifyUrl, tradeType, openId, null); notifyUrl, tradeType, openId, null);
} }
public MchPayPackage(String appid, String mchId, String deviceInfo, public MchPayPackage(String appId, String mchId, String deviceInfo,
String nonceStr, String body, String attach, String outTradeNo, String nonceStr, String body, String attach, String outTradeNo,
double totalFee, String spbillCreateIp, Date timeStart, double totalFee, String spbillCreateIp, Date timeStart,
Date timeExpire, String goodsTag, String notifyUrl, Date timeExpire, String goodsTag, String notifyUrl,
TradeType tradeType, String openid, String productId) { TradeType tradeType, String openId, String productId) {
super(body, attach, outTradeNo, totalFee, spbillCreateIp, timeStart, super(body, attach, outTradeNo, totalFee, spbillCreateIp, timeStart,
timeExpire, goodsTag, notifyUrl); timeExpire, goodsTag, notifyUrl);
this.appid = appid; this.appId = appId;
this.mchId = mchId; this.mchId = mchId;
this.deviceInfo = deviceInfo; this.deviceInfo = deviceInfo;
this.nonceStr = nonceStr; this.nonceStr = nonceStr;
this.tradeType = tradeType.name(); this.tradeType = tradeType.name();
this.openid = openid; this.openId = openId;
this.productId = productId; this.productId = productId;
} }
public String getAppid() { public String getAppId() {
return appid; return appId;
} }
public String getMchId() { public String getMchId() {
@ -135,8 +139,8 @@ public class MchPayPackage extends PayPackage {
return tradeType; return tradeType;
} }
public String getOpenid() { public String getOpenId() {
return openid; return openId;
} }
public String getProductId() { public String getProductId() {
@ -149,10 +153,10 @@ public class MchPayPackage extends PayPackage {
@Override @Override
public String toString() { public String toString() {
return "MchPayPackage [appid=" + appid + ", mchId=" + mchId return "MchPayPackage [appId=" + appId + ", mchId=" + mchId
+ ", deviceInfo=" + deviceInfo + ", nonceStr=" + nonceStr + ", deviceInfo=" + deviceInfo + ", nonceStr=" + nonceStr
+ ", sign=" + sign + ", tradeType=" + tradeType + ", openid=" + ", sign=" + sign + ", tradeType=" + tradeType + ", openId="
+ openid + ", productId=" + productId + ", " + super.toString() + openId + ", productId=" + productId + ", " + super.toString()
+ "]"; + "]";
} }
} }

View File

@ -30,7 +30,8 @@ public class NativePayResponse extends ApiResult {
@JSONField(serialize = false) @JSONField(serialize = false)
private PrePay prePay; private PrePay prePay;
private String prepay_id; @JSONField(name = "prepay_id")
private String prepayId;
protected NativePayResponse() { protected NativePayResponse() {
// jaxb required // jaxb required
@ -64,24 +65,24 @@ public class NativePayResponse extends ApiResult {
super.setReturnCode(Consts.SUCCESS); super.setReturnCode(Consts.SUCCESS);
this.setResultCode(Consts.SUCCESS); this.setResultCode(Consts.SUCCESS);
this.setMchId(payPackage.getMchId()); this.setMchId(payPackage.getMchId());
this.setAppId(payPackage.getAppid()); this.setAppId(payPackage.getAppId());
this.setNonceStr(RandomUtil.generateString(16)); this.setNonceStr(RandomUtil.generateString(16));
this.prePay = PayUtil.createPrePay(payPackage, paysignKey); this.prePay = PayUtil.createPrePay(payPackage, paysignKey);
this.prepay_id = prePay.getPrepayId(); this.prepayId = prePay.getPrepayId();
} }
public String getPrepay_id() { public String getPrepayId() {
return prepay_id; return prepayId;
} }
public void setPrepay_id(String prepay_id) { public void setPrepayId(String prepayId) {
this.prepay_id = prepay_id; this.prepayId = prepayId;
} }
@Override @Override
public String toString() { public String toString() {
return "NativePayResponseV3 [prePay=" + prePay + ", prepay_id=" return "NativePayResponseV3 [prePay=" + prePay + ", prepayId="
+ prepay_id + ", " + super.toString() + "]"; + prepayId + ", " + super.toString() + "]";
} }
} }

View File

@ -14,7 +14,6 @@ import com.foxinmy.weixin4j.type.CurrencyType;
import com.foxinmy.weixin4j.type.TradeState; import com.foxinmy.weixin4j.type.TradeState;
import com.foxinmy.weixin4j.type.TradeType; import com.foxinmy.weixin4j.type.TradeType;
import com.foxinmy.weixin4j.util.DateUtil; import com.foxinmy.weixin4j.util.DateUtil;
import com.foxinmy.weixin4j.util.StringUtil;
import com.foxinmy.weixin4j.xml.ListsuffixResult; import com.foxinmy.weixin4j.xml.ListsuffixResult;
/** /**
@ -38,7 +37,7 @@ public class Order extends ApiResult {
*/ */
@XmlElement(name = "trade_state") @XmlElement(name = "trade_state")
@JSONField(name = "trade_state") @JSONField(name = "trade_state")
private TradeState tradeState; private String tradeState;
/** /**
* 用户的openid * 用户的openid
*/ */
@ -58,7 +57,7 @@ public class Order extends ApiResult {
*/ */
@XmlElement(name = "trade_type") @XmlElement(name = "trade_type")
@JSONField(name = "trade_type") @JSONField(name = "trade_type")
private TradeType tradeType; private String tradeType;
/** /**
* 银行类型 * 银行类型
*/ */
@ -101,7 +100,7 @@ public class Order extends ApiResult {
*/ */
@XmlElement(name = "fee_type") @XmlElement(name = "fee_type")
@JSONField(name = "fee_type") @JSONField(name = "fee_type")
private CurrencyType feeType; private String feeType;
/** /**
* 微信支付订单号 * 微信支付订单号
*/ */
@ -135,8 +134,9 @@ public class Order extends ApiResult {
// jaxb required // jaxb required
} }
public TradeState getTradeState() { @JSONField(serialize = false)
return tradeState; public TradeState getFormatTradeState() {
return tradeState != null ? TradeState.valueOf(tradeState.toUpperCase()) : null;
} }
public String getOpenId() { public String getOpenId() {
@ -147,13 +147,14 @@ public class Order extends ApiResult {
return isSubscribe; return isSubscribe;
} }
@JSONField(serialize = false, deserialize = false) @JSONField(serialize = false)
public boolean getFormatIsSubscribe() { public boolean getFormatIsSubscribe() {
return isSubscribe != null && isSubscribe.equalsIgnoreCase("y"); return isSubscribe != null && isSubscribe.equalsIgnoreCase("y");
} }
public TradeType getTradeType() { @JSONField(serialize = false)
return tradeType; public TradeType getFormatTradeType() {
return tradeType != null ? TradeType.valueOf(tradeType.toUpperCase()) : null;
} }
public String getBankType() { public String getBankType() {
@ -169,7 +170,7 @@ public class Order extends ApiResult {
* *
* @return 元单位 * @return 元单位
*/ */
@JSONField(serialize = false, deserialize = false) @JSONField(serialize = false)
public double getFormatTotalFee() { public double getFormatTotalFee() {
return totalFee / 100d; return totalFee / 100d;
} }
@ -183,7 +184,7 @@ public class Order extends ApiResult {
* *
* @return 元单位 * @return 元单位
*/ */
@JSONField(serialize = false, deserialize = false) @JSONField(serialize = false)
public double getFormatCouponFee() { public double getFormatCouponFee() {
return couponFee != null ? couponFee / 100d : 0d; return couponFee != null ? couponFee / 100d : 0d;
} }
@ -192,11 +193,6 @@ public class Order extends ApiResult {
return couponCount; return couponCount;
} }
@JSONField(serialize = false, deserialize = false)
public int getFormatCouponCount() {
return couponCount != null ? couponCount.intValue() : 0;
}
public int getCashFee() { public int getCashFee() {
return cashFee; return cashFee;
} }
@ -206,12 +202,25 @@ public class Order extends ApiResult {
* *
* @return 元单位 * @return 元单位
*/ */
@JSONField(serialize = false, deserialize = false) @JSONField(serialize = false)
public double getFormatCashFee() { public double getFormatCashFee() {
return cashFee / 100d; return cashFee / 100d;
} }
public CurrencyType getFeeType() { @JSONField(serialize = false)
public CurrencyType getFormatFeeType() {
return feeType != null ? CurrencyType.valueOf(feeType.toUpperCase()) : null;
}
public String getTradeState() {
return tradeState;
}
public String getTradeType() {
return tradeType;
}
public String getFeeType() {
return feeType; return feeType;
} }
@ -231,12 +240,9 @@ public class Order extends ApiResult {
return timeEnd; return timeEnd;
} }
@JSONField(serialize = false, deserialize = false) @JSONField(serialize = false)
public Date getFormatTimeEnd() { public Date getFormatTimeEnd() {
if (StringUtil.isNotBlank(timeEnd)) { return timeEnd != null ? DateUtil.parse2yyyyMMddHHmmss(timeEnd) : null;
return DateUtil.parse2yyyyMMddHHmmss(timeEnd);
}
return null;
} }
public String getTradeStateDesc() { public String getTradeStateDesc() {
@ -259,10 +265,10 @@ public class Order extends ApiResult {
+ ", transactionId=" + transactionId + ", outTradeNo=" + ", transactionId=" + transactionId + ", outTradeNo="
+ outTradeNo + ", attach=" + attach + ", timeEnd=" + timeEnd + outTradeNo + ", attach=" + attach + ", timeEnd=" + timeEnd
+ ", totalFee=" + getFormatTotalFee() + ", couponFee=" + ", totalFee=" + getFormatTotalFee() + ", couponFee="
+ getFormatCouponFee() + ", couponCount=" + getFormatCouponFee() + ", couponCount=" + couponCount
+ getFormatCouponCount() + ", couponList=" + couponList + ", couponList=" + couponList + ", cashFee="
+ ", cashFee=" + getFormatCashFee() + ", timeEnd=" + getFormatCashFee() + ", timeEnd=" + getFormatTimeEnd()
+ getFormatTimeEnd() + ", tradeStateDesc=" + tradeStateDesc + ", tradeStateDesc=" + tradeStateDesc + ", "
+ ", " + super.toString() + "]"; + super.toString() + "]";
} }
} }

View File

@ -16,7 +16,6 @@ import com.foxinmy.weixin4j.type.RedpacketSendType;
import com.foxinmy.weixin4j.type.RedpacketStatus; import com.foxinmy.weixin4j.type.RedpacketStatus;
import com.foxinmy.weixin4j.type.RedpacketType; import com.foxinmy.weixin4j.type.RedpacketType;
import com.foxinmy.weixin4j.util.DateUtil; import com.foxinmy.weixin4j.util.DateUtil;
import com.foxinmy.weixin4j.util.StringUtil;
/** /**
* 红包记录 * 红包记录
@ -56,19 +55,19 @@ public class RedpacketRecord extends XmlResult {
* 红包状态 * 红包状态
*/ */
@XmlElement(name = "status") @XmlElement(name = "status")
private RedpacketStatus status; private String status;
/** /**
* 发放类型 * 发放类型
*/ */
@XmlElement(name = "send_type") @XmlElement(name = "send_type")
@JSONField(name = "send_type") @JSONField(name = "send_type")
private RedpacketSendType sendType; private String sendType;
/** /**
* 红包类型 * 红包类型
*/ */
@XmlElement(name = "hb_type") @XmlElement(name = "hb_type")
@JSONField(name = "hb_type") @JSONField(name = "hb_type")
private RedpacketType type; private String hbType;
/** /**
* 红包个数 * 红包个数
*/ */
@ -140,16 +139,32 @@ public class RedpacketRecord extends XmlResult {
return repacketId; return repacketId;
} }
public RedpacketStatus getStatus() { @JSONField(serialize = false)
public RedpacketStatus getFormatStatus() {
return status != null ? RedpacketStatus.valueOf(status.toUpperCase())
: null;
}
@JSONField(serialize = false)
public RedpacketSendType getFormatSendType() {
return sendType != null ? RedpacketSendType.valueOf(sendType) : null;
}
@JSONField(serialize = false)
public RedpacketType getFomatHbType() {
return hbType != null ? RedpacketType.valueOf(hbType) : null;
}
public String getStatus() {
return status; return status;
} }
public RedpacketSendType getSendType() { public String getSendType() {
return sendType; return sendType;
} }
public RedpacketType getType() { public String getHbType() {
return type; return hbType;
} }
public int getTotalNum() { public int getTotalNum() {
@ -165,7 +180,7 @@ public class RedpacketRecord extends XmlResult {
* *
* @return 元单位 * @return 元单位
*/ */
@JSONField(serialize = false, deserialize = false) @JSONField(serialize = false)
public double getFormatTotalAmount() { public double getFormatTotalAmount() {
return totalAmount / 100d; return totalAmount / 100d;
} }
@ -178,21 +193,20 @@ public class RedpacketRecord extends XmlResult {
return sendTime; return sendTime;
} }
@JSONField(serialize = false, deserialize = false) @JSONField(serialize = false)
public Date getFormatSendTime() { public Date getFormatSendTime() {
return DateUtil.parse2yyyyMMddHHmmss(sendTime); return sendTime != null ? DateUtil.parse2yyyyMMddHHmmss(sendTime)
: null;
} }
public String getRefundTime() { public String getRefundTime() {
return refundTime; return refundTime;
} }
@JSONField(serialize = false, deserialize = false) @JSONField(serialize = false)
public Date getFormatRefundTime() { public Date getFormatRefundTime() {
if (StringUtil.isNotBlank(refundTime)) { return refundTime != null ? DateUtil.parse2yyyyMMddHHmmss(refundTime)
return DateUtil.parse2yyyyMMddHHmmss(refundTime); : null;
}
return null;
} }
public Integer getRefundAmount() { public Integer getRefundAmount() {
@ -204,12 +218,9 @@ public class RedpacketRecord extends XmlResult {
* *
* @return 元单位 * @return 元单位
*/ */
@JSONField(serialize = false, deserialize = false) @JSONField(serialize = false)
public double getFormatRefundAmount() { public double getFormatRefundAmount() {
if (refundAmount != null) { return refundAmount != null ? refundAmount.intValue() / 100d : 0d;
return refundAmount.intValue() / 100d;
}
return 0d;
} }
public String getWishing() { public String getWishing() {
@ -231,9 +242,9 @@ public class RedpacketRecord extends XmlResult {
@XmlRootElement @XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD) @XmlAccessorType(XmlAccessType.FIELD)
public static class RedpacketReceiver implements Serializable { public static class RedpacketReceiver implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 领取红包的Openid * 领取红包的Openid
*/ */
@ -276,14 +287,15 @@ public class RedpacketRecord extends XmlResult {
* *
* @return 元单位 * @return 元单位
*/ */
@JSONField(serialize = false, deserialize = false) @JSONField(serialize = false)
public double getFormatAmount() { public double getFormatAmount() {
return amount / 100d; return amount / 100d;
} }
@JSONField(serialize = false, deserialize = false) @JSONField(serialize = false)
public Date getFormatReceiveTime() { public Date getFormatReceiveTime() {
return DateUtil.parse2yyyyMMddHHmmss(receiveTime); return receiveTime != null ? DateUtil
.parse2yyyyMMddHHmmss(receiveTime) : null;
} }
@Override @Override
@ -298,10 +310,10 @@ public class RedpacketRecord extends XmlResult {
public String toString() { public String toString() {
return "RedpacketRecord [outTradeNo=" + outTradeNo + ", mchId=" + mchId return "RedpacketRecord [outTradeNo=" + outTradeNo + ", mchId=" + mchId
+ ", repacketId=" + repacketId + ", status=" + status + ", repacketId=" + repacketId + ", status=" + status
+ ", sendType=" + sendType + ", type=" + type + ", totalNum=" + ", sendType=" + sendType + ", hbType=" + hbType
+ totalNum + ", totalAmount=" + getFormatTotalAmount() + ", totalNum=" + totalNum + ", totalAmount="
+ ", reason=" + reason + ", sendTime=" + sendTime + getFormatTotalAmount() + ", reason=" + reason + ", sendTime="
+ ", refundTime=" + refundTime + ", refundAmount=" + sendTime + ", refundTime=" + refundTime + ", refundAmount="
+ getFormatRefundAmount() + ", wishing=" + wishing + getFormatRefundAmount() + ", wishing=" + wishing
+ ", remark=" + remark + ", actName=" + actName + ", remark=" + remark + ", actName=" + actName
+ ", receivers=" + receivers + "]"; + ", receivers=" + receivers + "]";

View File

@ -27,7 +27,7 @@ public class RedpacketSendResult extends XmlResult {
*/ */
@XmlElement(name = "wxappid") @XmlElement(name = "wxappid")
@JSONField(name = "wxappid") @JSONField(name = "wxappid")
private String appid; private String appId;
/** /**
* 微信支付分配的商户号 * 微信支付分配的商户号
*/ */
@ -45,7 +45,7 @@ public class RedpacketSendResult extends XmlResult {
*/ */
@XmlElement(name = "re_openid") @XmlElement(name = "re_openid")
@JSONField(name = "re_openid") @JSONField(name = "re_openid")
private String openid; private String openId;
/** /**
* 付款金额 单位为分 * 付款金额 单位为分
*/ */
@ -56,9 +56,9 @@ public class RedpacketSendResult extends XmlResult {
protected RedpacketSendResult() { protected RedpacketSendResult() {
// jaxb required // jaxb required
} }
public String getAppid() { public String getAppId() {
return appid; return appId;
} }
public String getMchId() { public String getMchId() {
@ -69,8 +69,8 @@ public class RedpacketSendResult extends XmlResult {
return outTradeNo; return outTradeNo;
} }
public String getOpenid() { public String getOpenId() {
return openid; return openId;
} }
public int getTotalAmount() { public int getTotalAmount() {
@ -82,15 +82,15 @@ public class RedpacketSendResult extends XmlResult {
* *
* @return 元单位 * @return 元单位
*/ */
@JSONField(serialize = false, deserialize = false) @JSONField(serialize = false)
public double getFormatTotalAmount() { public double getFormatTotalAmount() {
return totalAmount / 100d; return totalAmount / 100d;
} }
@Override @Override
public String toString() { public String toString() {
return "RedpacketSendResult [appid=" + appid + ", mchId=" + mchId return "RedpacketSendResult [appId=" + appId + ", mchId=" + mchId
+ ", outTradeNo=" + outTradeNo + ", openid=" + openid + ", outTradeNo=" + outTradeNo + ", openId=" + openId
+ ", totalAmount=" + totalAmount + ", " + super.toString() + ", totalAmount=" + totalAmount + ", " + super.toString()
+ "]"; + "]";
} }

View File

@ -12,7 +12,6 @@ import com.foxinmy.weixin4j.payment.coupon.CouponInfo;
import com.foxinmy.weixin4j.type.CurrencyType; import com.foxinmy.weixin4j.type.CurrencyType;
import com.foxinmy.weixin4j.type.RefundChannel; import com.foxinmy.weixin4j.type.RefundChannel;
import com.foxinmy.weixin4j.type.RefundStatus; import com.foxinmy.weixin4j.type.RefundStatus;
import com.foxinmy.weixin4j.util.StringUtil;
import com.foxinmy.weixin4j.xml.ListsuffixResult; import com.foxinmy.weixin4j.xml.ListsuffixResult;
/** /**
@ -61,7 +60,7 @@ public class RefundDetail extends ApiResult {
*/ */
@XmlElement(name = "refund_fee_type") @XmlElement(name = "refund_fee_type")
@JSONField(name = "refund_fee_type") @JSONField(name = "refund_fee_type")
private CurrencyType refundFeeType; private String refundFeeType;
/** /**
* 订单总金额 * 订单总金额
*/ */
@ -75,7 +74,7 @@ public class RefundDetail extends ApiResult {
*/ */
@XmlElement(name = "fee_type") @XmlElement(name = "fee_type")
@JSONField(name = "fee_type") @JSONField(name = "fee_type")
private CurrencyType feeType; private String feeType;
/** /**
* 现金支付金额 * 现金支付金额
*/ */
@ -89,7 +88,7 @@ public class RefundDetail extends ApiResult {
*/ */
@XmlElement(name = "cash_fee_type") @XmlElement(name = "cash_fee_type")
@JSONField(name = "cash_fee_type") @JSONField(name = "cash_fee_type")
private CurrencyType cashFeeType; private String cashFeeType;
/** /**
* 现金退款金额 * 现金退款金额
*/ */
@ -103,7 +102,7 @@ public class RefundDetail extends ApiResult {
*/ */
@XmlElement(name = "cash_refund_fee_type") @XmlElement(name = "cash_refund_fee_type")
@JSONField(name = "cash_refund_fee_type") @JSONField(name = "cash_refund_fee_type")
private CurrencyType cashRefundFeeType; private String cashRefundFeeType;
/** /**
* 退款状态 * 退款状态
*/ */
@ -148,28 +147,32 @@ public class RefundDetail extends ApiResult {
return refundChannel; return refundChannel;
} }
@JSONField(deserialize = false, serialize = false) @JSONField(serialize = false)
public RefundChannel getFormatRefundChannel() { public RefundChannel getFormatRefundChannel() {
if (StringUtil.isNotBlank(refundChannel)) { return refundChannel != null ? RefundChannel.valueOf(refundChannel
return RefundChannel.valueOf(refundChannel.toUpperCase()); .toUpperCase()) : null;
}
return null;
} }
public int getRefundFee() { public int getRefundFee() {
return refundFee; return refundFee;
} }
public CurrencyType getFeeType() { public String getFeeType() {
return feeType; return feeType;
} }
@JSONField(serialize = false)
public CurrencyType getFormatFeeType() {
return feeType != null ? CurrencyType.valueOf(feeType.toUpperCase())
: null;
}
/** /**
* <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font> * <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
* *
* @return 元单位 * @return 元单位
*/ */
@JSONField(deserialize = false, serialize = false) @JSONField(serialize = false)
public double getFormatRefundFee() { public double getFormatRefundFee() {
return refundFee / 100d; return refundFee / 100d;
} }
@ -178,12 +181,10 @@ public class RefundDetail extends ApiResult {
return refundStatus; return refundStatus;
} }
@JSONField(deserialize = false, serialize = false) @JSONField(serialize = false)
public RefundStatus getFormatRefundStatus() { public RefundStatus getFormatRefundStatus() {
if (StringUtil.isNotBlank(refundStatus)) { return refundStatus != null ? RefundStatus.valueOf(refundStatus
return RefundStatus.valueOf(refundStatus); .toUpperCase()) : null;
}
return null;
} }
public Integer getCouponRefundFee() { public Integer getCouponRefundFee() {
@ -195,15 +196,21 @@ public class RefundDetail extends ApiResult {
* *
* @return 元单位 * @return 元单位
*/ */
@JSONField(deserialize = false, serialize = false) @JSONField(serialize = false)
public double getFormatCouponRefundFee() { public double getFormatCouponRefundFee() {
return couponRefundFee != null ? couponRefundFee.intValue() / 100d : 0d; return couponRefundFee != null ? couponRefundFee.intValue() / 100d : 0d;
} }
public CurrencyType getRefundFeeType() { public String getRefundFeeType() {
return refundFeeType; return refundFeeType;
} }
@JSONField(serialize = false)
public CurrencyType getFormatRefundFeeType() {
return refundFeeType != null ? CurrencyType.valueOf(refundFeeType
.toUpperCase()) : null;
}
public int getTotalFee() { public int getTotalFee() {
return totalFee; return totalFee;
} }
@ -213,7 +220,7 @@ public class RefundDetail extends ApiResult {
* *
* @return 元单位 * @return 元单位
*/ */
@JSONField(deserialize = false, serialize = false) @JSONField(serialize = false)
public double getFormatTotalFee() { public double getFormatTotalFee() {
return totalFee / 100d; return totalFee / 100d;
} }
@ -227,15 +234,21 @@ public class RefundDetail extends ApiResult {
* *
* @return 元单位 * @return 元单位
*/ */
@JSONField(deserialize = false, serialize = false) @JSONField(serialize = false)
public double getFormatCashFee() { public double getFormatCashFee() {
return cashFee / 100d; return cashFee / 100d;
} }
public CurrencyType getCashFeeType() { public String getCashFeeType() {
return cashFeeType; return cashFeeType;
} }
@JSONField(serialize = false)
public CurrencyType getFormatCashFeeType() {
return cashFeeType != null ? CurrencyType.valueOf(cashFeeType
.toUpperCase()) : null;
}
public Integer getCashRefundFee() { public Integer getCashRefundFee() {
return cashRefundFee; return cashRefundFee;
} }
@ -245,24 +258,25 @@ public class RefundDetail extends ApiResult {
* *
* @return 元单位 * @return 元单位
*/ */
@JSONField(deserialize = false, serialize = false) @JSONField(serialize = false)
public double getFormatCashRefundFee() { public double getFormatCashRefundFee() {
return cashRefundFee != null ? cashRefundFee.intValue() / 100d : 0d; return cashRefundFee != null ? cashRefundFee.intValue() / 100d : 0d;
} }
public CurrencyType getCashRefundFeeType() { public String getCashRefundFeeType() {
return cashRefundFeeType; return cashRefundFeeType;
} }
@JSONField(serialize = false)
public CurrencyType getFormatCashRefundFeeType() {
return cashRefundFeeType != null ? CurrencyType
.valueOf(cashRefundFeeType.toUpperCase()) : null;
}
public Integer getCouponRefundCount() { public Integer getCouponRefundCount() {
return couponRefundCount; return couponRefundCount;
} }
@JSONField(deserialize = false, serialize = false)
public int getFormatCouponRefundCount() {
return couponRefundCount != null ? couponRefundCount.intValue() : 0;
}
public List<CouponInfo> getCouponList() { public List<CouponInfo> getCouponList() {
return couponList; return couponList;
} }
@ -282,7 +296,7 @@ public class RefundDetail extends ApiResult {
+ getFormatCashRefundFee() + ", cashRefundFeeType=" + getFormatCashRefundFee() + ", cashRefundFeeType="
+ cashRefundFeeType + ", refundStatus=" + refundStatus + cashRefundFeeType + ", refundStatus=" + refundStatus
+ ", couponRefundFee=" + getFormatCouponRefundFee() + ", couponRefundFee=" + getFormatCouponRefundFee()
+ ", couponCount=" + getCouponRefundCount() + ", couponList=" + ", couponRefundCount=" + couponRefundCount + ", couponList="
+ couponList + ", " + super.toString() + "]"; + couponList + ", " + super.toString() + "]";
} }
} }

View File

@ -50,7 +50,7 @@ public class RefundRecord extends ApiResult {
*/ */
@XmlElement(name = "fee_type") @XmlElement(name = "fee_type")
@JSONField(name = "fee_type") @JSONField(name = "fee_type")
private CurrencyType feeType; private String feeType;
/** /**
* 现金支付金额 * 现金支付金额
*/ */
@ -64,7 +64,7 @@ public class RefundRecord extends ApiResult {
*/ */
@XmlElement(name = "cash_fee_type") @XmlElement(name = "cash_fee_type")
@JSONField(name = "cash_fee_type") @JSONField(name = "cash_fee_type")
private CurrencyType cashFeeType; private String cashFeeType;
/** /**
* 退款总金额 * 退款总金额
*/ */
@ -108,7 +108,7 @@ public class RefundRecord extends ApiResult {
* *
* @return 元单位 * @return 元单位
*/ */
@JSONField(serialize = false, deserialize = false) @JSONField(serialize = false)
public double getFormatCashFee() { public double getFormatCashFee() {
return cashFee / 100d; return cashFee / 100d;
} }
@ -117,20 +117,32 @@ public class RefundRecord extends ApiResult {
return cashFee; return cashFee;
} }
public CurrencyType getFeeType() { public String getFeeType() {
return feeType; return feeType;
} }
public CurrencyType getCashFeeType() { public String getCashFeeType() {
return cashFeeType; return cashFeeType;
} }
@JSONField(serialize = false)
public CurrencyType getFormatFeeType() {
return feeType != null ? CurrencyType.valueOf(feeType.toUpperCase())
: null;
}
@JSONField(serialize = false)
public CurrencyType getFormatCashFeeType() {
return cashFeeType != null ? CurrencyType.valueOf(cashFeeType
.toUpperCase()) : null;
}
/** /**
* <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font> * <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
* *
* @return 元单位 * @return 元单位
*/ */
@JSONField(serialize = false, deserialize = false) @JSONField(serialize = false)
public double getFormatCouponRefundFee() { public double getFormatCouponRefundFee() {
return couponRefundFee != null ? couponRefundFee.intValue() / 100d : 0d; return couponRefundFee != null ? couponRefundFee.intValue() / 100d : 0d;
} }
@ -144,7 +156,7 @@ public class RefundRecord extends ApiResult {
* *
* @return 元单位 * @return 元单位
*/ */
@JSONField(serialize = false, deserialize = false) @JSONField(serialize = false)
public double getFormatTotalFee() { public double getFormatTotalFee() {
return totalFee / 100d; return totalFee / 100d;
} }
@ -174,7 +186,7 @@ public class RefundRecord extends ApiResult {
* *
* @return 元单位 * @return 元单位
*/ */
@JSONField(serialize = false, deserialize = false) @JSONField(serialize = false)
public double getFormatRefundFee() { public double getFormatRefundFee() {
return refundFee / 100d; return refundFee / 100d;
} }

View File

@ -76,7 +76,12 @@ public class ArticleDatacubeShare implements Serializable {
this.shareCount = shareCount; this.shareCount = shareCount;
} }
public ShareSourceType getShareScene() { public int getShareScene() {
return shareScene;
}
@JSONField(serialize = false)
public ShareSourceType getFormatShareScene() {
if (shareScene == 1) { if (shareScene == 1) {
return ShareSourceType.FRIENDFORWARD; return ShareSourceType.FRIENDFORWARD;
} else if (shareScene == 2) { } else if (shareScene == 2) {

View File

@ -30,7 +30,8 @@ public class ArticleSummary extends ArticleDatacube1 {
* 例如12003_3 其中12003是msgid即一次群发的消息的id * 例如12003_3 其中12003是msgid即一次群发的消息的id
* 3为index假设该次群发的图文消息共5个文章因为可能为多图文3表示5个中的第3个 * 3为index假设该次群发的图文消息共5个文章因为可能为多图文3表示5个中的第3个
*/ */
private String msgid; @JSONField(name = "msgid")
private String msgId;
/** /**
* 图文消息的标题 * 图文消息的标题
*/ */
@ -52,12 +53,12 @@ public class ArticleSummary extends ArticleDatacube1 {
this.refHour = refHour; this.refHour = refHour;
} }
public String getMsgid() { public String getMsgId() {
return msgid; return msgId;
} }
public void setMsgid(String msgid) { public void setMsgId(String msgId) {
this.msgid = msgid; this.msgId = msgId;
} }
public String getTitle() { public String getTitle() {
@ -71,7 +72,7 @@ public class ArticleSummary extends ArticleDatacube1 {
@Override @Override
public String toString() { public String toString() {
return "ArticleSummary [refDate=" + refDate + ", refHour=" + refHour return "ArticleSummary [refDate=" + refDate + ", refHour=" + refHour
+ ", msgid=" + msgid + ", title=" + title + ", " + ", msgId=" + msgId + ", title=" + title + ", "
+ super.toString() + "]"; + super.toString() + "]";
} }
} }

View File

@ -27,7 +27,8 @@ public class ArticleTotal implements Serializable {
* 这里的msgid实际上是由msgid图文消息id和index消息次序索引组成 例如12003_3 * 这里的msgid实际上是由msgid图文消息id和index消息次序索引组成 例如12003_3
* 其中12003是msgid即一次群发的id消息的 3为index假设该次群发的图文消息共5个文章因为可能为多图文 3表示5个中的第3个 * 其中12003是msgid即一次群发的id消息的 3为index假设该次群发的图文消息共5个文章因为可能为多图文 3表示5个中的第3个
*/ */
private String msgid; @JSONField(name = "msgid")
private String msgId;
/** /**
* 图文消息的标题 * 图文消息的标题
*/ */
@ -45,12 +46,12 @@ public class ArticleTotal implements Serializable {
this.refDate = refDate; this.refDate = refDate;
} }
public String getMsgid() { public String getMsgId() {
return msgid; return msgId;
} }
public void setMsgid(String msgid) { public void setMsgId(String msgId) {
this.msgid = msgid; this.msgId = msgId;
} }
public String getTitle() { public String getTitle() {
@ -71,7 +72,7 @@ public class ArticleTotal implements Serializable {
@Override @Override
public String toString() { public String toString() {
return "ArticleTotal [refDate=" + refDate + ", msgid=" + msgid return "ArticleTotal [refDate=" + refDate + ", msgId=" + msgId
+ ", title=" + title + ", details=" + details + "]"; + ", title=" + title + ", details=" + details + "]";
} }
} }

View File

@ -60,12 +60,17 @@ public class UpstreamMsg implements Serializable {
this.refHour = refHour; this.refHour = refHour;
} }
public int getMsgType() {
return msgType;
}
/** /**
* 1代表文字 2代表图片 3代表语音 4代表视频 6代表第三方应用消息链接消息 * 1代表文字 2代表图片 3代表语音 4代表视频 6代表第三方应用消息链接消息
* *
* @return * @return
*/ */
public String getMsgType() { @JSONField(serialize = false)
public String getFormatMsgType() {
switch (msgType) { switch (msgType) {
case 1: case 1:
return "text"; return "text";

View File

@ -50,7 +50,12 @@ public class UpstreamMsgDist implements Serializable {
this.msgUser = msgUser; this.msgUser = msgUser;
} }
public DatacuteCountIntervalType getCountInterval() { public int getCountInterval() {
return countInterval;
}
@JSONField(serialize = false)
public DatacuteCountIntervalType getFormatCountInterval() {
return DatacuteCountIntervalType.values()[countInterval]; return DatacuteCountIntervalType.values()[countInterval];
} }

View File

@ -52,7 +52,12 @@ public class UserSummary implements Serializable {
this.refDate = refDate; this.refDate = refDate;
} }
public UserSourceType getUserSource() { public int getUserSource() {
return userSource;
}
@JSONField(serialize = false)
public UserSourceType getFormatUserSource() {
if (userSource == 30) { if (userSource == 30) {
return UserSourceType.QRCODE; return UserSourceType.QRCODE;
} else if (userSource == 17) { } else if (userSource == 17) {
@ -98,8 +103,8 @@ public class UserSummary implements Serializable {
@Override @Override
public String toString() { public String toString() {
return "UserSummary [refDate=" + refDate + ", userSource=" return "UserSummary [refDate=" + refDate + ", userSource=" + userSource
+ getUserSource() + ", newUser=" + newUser + ", cancelUser=" + ", newUser=" + newUser + ", cancelUser=" + cancelUser
+ cancelUser + ", cumulateUser=" + cumulateUser + "]"; + ", cumulateUser=" + cumulateUser + "]";
} }
} }

View File

@ -4,6 +4,9 @@ import java.io.Serializable;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import com.alibaba.fastjson.annotation.JSONCreator;
import com.alibaba.fastjson.annotation.JSONField;
/** /**
* 模板消息 * 模板消息
* *
@ -21,11 +24,13 @@ public class TemplateMessage implements Serializable {
/** /**
* 用户的openid * 用户的openid
*/ */
private String touser; @JSONField(name = "touser")
private String toUser;
/** /**
* 模板ID * 模板ID
*/ */
private String template_id; @JSONField(name = "template_id")
private String templateId;
/** /**
* 点击消息跳转的url * 点击消息跳转的url
*/ */
@ -33,21 +38,22 @@ public class TemplateMessage implements Serializable {
/** /**
* 顶部的颜色值 * 顶部的颜色值
*/ */
private String topcolor = "#FF0000"; @JSONField(name = "topcolor")
private String topColor = "#FF0000";
/** /**
* 数据项 * 数据项
*/ */
private Map<String, Item> data; private Map<String, Item> data;
public void pushData(String key, String value) { @JSONCreator
this.data.put(key, new Item(value)); public TemplateMessage(@JSONField(name = "toUser") String toUser,
} @JSONField(name = "templateId") String templateId,
@JSONField(name = "title") String title,
public TemplateMessage(String touser, String template_id, String title, @JSONField(name = "url") String url) {
String url) { this.toUser = toUser;
this.touser = touser; this.templateId = templateId;
this.template_id = template_id;
this.url = url; this.url = url;
this.topColor = "#FF0000";
this.data = new HashMap<String, Item>(); this.data = new HashMap<String, Item>();
pushData("first", title); pushData("first", title);
} }
@ -95,36 +101,24 @@ public class TemplateMessage implements Serializable {
} }
} }
public String getTouser() { public String getToUser() {
return touser; return toUser;
} }
public void setTouser(String touser) { public String getTemplateId() {
this.touser = touser; return templateId;
}
public String getTemplate_id() {
return template_id;
}
public void setTemplate_id(String template_id) {
this.template_id = template_id;
} }
public String getUrl() { public String getUrl() {
return url; return url;
} }
public void setUrl(String url) { public String getTopColor() {
this.url = url; return topColor;
} }
public String getTopcolor() { public void setTopColor(String topColor) {
return topcolor; this.topColor = topColor;
}
public void setTopcolor(String topcolor) {
this.topcolor = topcolor;
} }
public Map<String, Item> getData() { public Map<String, Item> getData() {
@ -135,10 +129,14 @@ public class TemplateMessage implements Serializable {
this.data = data; this.data = data;
} }
public void pushData(String key, String value) {
this.data.put(key, new Item(value));
}
@Override @Override
public String toString() { public String toString() {
return "TemplateMessage [touser=" + touser + ", template_id=" return "TemplateMessage [toUser=" + toUser + ", templateId="
+ template_id + ", url=" + url + ", topcolor=" + topcolor + templateId + ", url=" + url + ", topColor=" + topColor
+ ", data=" + data + "]"; + ", data=" + data + "]";
} }
} }

View File

@ -3,6 +3,7 @@ package com.foxinmy.weixin4j.mp.model;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import com.alibaba.fastjson.annotation.JSONField;
import com.foxinmy.weixin4j.mp.type.CustomRecordOperCode; import com.foxinmy.weixin4j.mp.type.CustomRecordOperCode;
/** /**
@ -24,15 +25,17 @@ public class CustomRecord implements Serializable {
/** /**
* 用户的标识 * 用户的标识
*/ */
private String openid; @JSONField(name = "openid")
private String openId;
/** /**
* 操作ID会话状态 * 操作ID会话状态
*/ */
private CustomRecordOperCode opercode; @JSONField(name = "opercode")
private int operCode;
/** /**
* 操作时间 * 操作时间
*/ */
private Date time; private long time;
/** /**
* 聊天记录 * 聊天记录
*/ */
@ -46,28 +49,38 @@ public class CustomRecord implements Serializable {
this.worker = worker; this.worker = worker;
} }
public String getOpenid() { public String getOpenId() {
return openid; return openId;
} }
public void setOpenid(String openid) { public void setOpenId(String openId) {
this.openid = openid; this.openId = openId;
} }
public CustomRecordOperCode getOpercode() { public int getOperCode() {
return opercode; return operCode;
} }
public void setOpercode(int opercode) { @JSONField(serialize = false)
this.opercode = CustomRecordOperCode.getOper(opercode); public CustomRecordOperCode getFormatOperCode() {
return CustomRecordOperCode.getOper(operCode);
} }
public Date getTime() { public void setOperCode(int operCode) {
return (Date) time.clone(); this.operCode = operCode;
}
public long getTime() {
return time;
}
@JSONField(serialize = false)
public Date getFormatTime() {
return new Date(time * 1000l);
} }
public void setTime(long time) { public void setTime(long time) {
this.time = new Date(time * 1000l); this.time = time;
} }
public String getText() { public String getText() {
@ -82,8 +95,8 @@ public class CustomRecord implements Serializable {
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("[CustomRecord worker=").append(worker); sb.append("[CustomRecord worker=").append(worker);
sb.append(" ,openid=").append(openid); sb.append(" ,openId=").append(openId);
sb.append(" ,opercode=").append(opercode); sb.append(" ,operCode=").append(operCode);
sb.append(" ,time=").append(time); sb.append(" ,time=").append(time);
sb.append(" ,text=").append(text); sb.append(" ,text=").append(text);
sb.append("]"); sb.append("]");

View File

@ -43,7 +43,7 @@ public class KfAccount implements Serializable {
/** /**
* 客服在线状态 1pc在线2手机在线 若pc和手机同时在线则为 1+2=3 * 客服在线状态 1pc在线2手机在线 若pc和手机同时在线则为 1+2=3
*/ */
private KfOnlineStatus status; private int status;
/** /**
* 客服设置的最大自动接入数 * 客服设置的最大自动接入数
*/ */
@ -87,20 +87,25 @@ public class KfAccount implements Serializable {
this.headImg = headImg; this.headImg = headImg;
} }
public KfOnlineStatus getStatus() { public int getStatus() {
return status; return status;
} }
public void setStatus(int status) { @JSONField(serialize = false)
public KfOnlineStatus getFormatStatus() {
if (status == 1) { if (status == 1) {
this.status = KfOnlineStatus.PC; return KfOnlineStatus.PC;
} else if (status == 2) { } else if (status == 2) {
this.status = KfOnlineStatus.MOBILE; return KfOnlineStatus.MOBILE;
} else { } else {
this.status = KfOnlineStatus.BOTH; return KfOnlineStatus.BOTH;
} }
} }
public void setStatus(int status) {
this.status = status;
}
public int getAutoAccept() { public int getAutoAccept() {
return autoAccept; return autoAccept;
} }

View File

@ -93,8 +93,7 @@ public class SemResult extends JsonResult {
@Override @Override
public String toString() { public String toString() {
return "SemResult [query=" + query + ", type=" + type + ", semantic=" return "SemResult [query=" + query + ", type=" + type + ", semantic="
+ semantic + ", result=" + result + ", answer=" + answer + semantic + ", result=" + result + ", answer=" + answer + ", "
+ ", text=" + text + ", getCode()=" + getCode() + super.toString() + "]";
+ ", getDesc()=" + getDesc() + "]";
} }
} }

View File

@ -26,16 +26,18 @@ public class User implements Serializable {
/** /**
* 用户的唯一标识 * 用户的唯一标识
*/ */
private String openid; @JSONField(name = "openid")
private String openId;
/** /**
* 用户昵称 * 用户昵称
*/ */
private String nickname; @JSONField(name = "nickname")
private String nickName;
/** /**
* 用户的性别值为1时是男性值为2时是女性值为0时是未知 * 用户的性别值为1时是男性值为2时是女性值为0时是未知
*/ */
@JSONField(name = "sex") @JSONField(name = "sex")
private Gender gender; private int gender;
/** /**
* 用户个人资料填写的省份 * 用户个人资料填写的省份
*/ */
@ -65,46 +67,52 @@ public class User implements Serializable {
* 关注时间 * 关注时间
*/ */
@JSONField(name = "subscribe_time") @JSONField(name = "subscribe_time")
private Date subscribeTime; private long subscribeTime;
/** /**
* 使用语言 * 使用语言
*/ */
private Lang language; private String language;
/** /**
* 只有在用户将公众号绑定到微信开放平台帐号后才会出现该字段 * 只有在用户将公众号绑定到微信开放平台帐号后才会出现该字段
*/ */
private String unionid; @JSONField(name = "unionid")
private String unionId;
public String getOpenid() { public String getOpenId() {
return openid; return openId;
} }
public void setOpenid(String openid) { public void setOpenid(String openId) {
this.openid = openid; this.openId = openId;
} }
public String getNickname() { public String getNickName() {
return nickname; return nickName;
} }
public void setNickname(String nickname) { public void setNickName(String nickName) {
this.nickname = nickname; this.nickName = nickName;
} }
public Gender getGender() { public int getGender() {
return gender; return gender;
} }
public void setGender(int sex) { @JSONField(serialize = false)
if (sex == 1) { public Gender getFormatGender() {
this.gender = Gender.male; if (gender == 1) {
} else if (sex == 2) { return Gender.male;
this.gender = Gender.female; } else if (gender == 2) {
return Gender.female;
} else { } else {
this.gender = Gender.unknown; return Gender.unknown;
} }
} }
public void setGender(int gender) {
this.gender = gender;
}
public String getProvince() { public String getProvince() {
return province; return province;
} }
@ -154,11 +162,16 @@ public class User implements Serializable {
this.privilege = privilege; this.privilege = privilege;
} }
public Lang getLanguage() { public String getLanguage() {
return language; return language;
} }
public void setLanguage(Lang language) { @JSONField(serialize = false)
public Lang getFormatLanguage() {
return language != null ? Lang.valueOf(language) : null;
}
public void setLanguage(String language) {
this.language = language; this.language = language;
} }
@ -170,20 +183,25 @@ public class User implements Serializable {
this.isSubscribe = isSubscribe; this.isSubscribe = isSubscribe;
} }
public Date getSubscribeTime() { public long getSubscribeTime() {
return (Date) subscribeTime.clone(); return subscribeTime;
}
@JSONField(serialize = false)
public Date getFormatSubscribeTime() {
return new Date(subscribeTime * 1000l);
} }
public void setSubscribeTime(long subscribeTime) { public void setSubscribeTime(long subscribeTime) {
this.subscribeTime = new Date(subscribeTime * 1000l); this.subscribeTime = subscribeTime;
} }
public String getUnionid() { public String getUnionId() {
return unionid; return unionId;
} }
public void setUnionid(String unionid) { public void setUnionId(String unionId) {
this.unionid = unionid; this.unionId = unionId;
} }
@Override @Override
@ -194,26 +212,18 @@ public class User implements Serializable {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj instanceof User) { if (obj instanceof User) {
return openid.equals(((User) obj).getOpenid()); return openId.equals(((User) obj).getOpenId());
} }
return false; return false;
} }
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); return "User [openId=" + openId + ", nickName=" + nickName
sb.append("[User openid=").append(openid); + ", gender=" + gender + ", province=" + province + ", city="
sb.append(", nickname=").append(nickname); + city + ", country=" + country + ", headimgurl=" + headimgurl
sb.append(", gender=").append(gender); + ", privilege=" + privilege + ", isSubscribe=" + isSubscribe
sb.append(", province=").append(province); + ", subscribeTime=" + subscribeTime + ", language=" + language
sb.append(", city=").append(city); + ", unionId=" + unionId + "]";
sb.append(", country=").append(country);
sb.append(", headimgurl=").append(headimgurl);
sb.append(", privilege=").append(privilege);
sb.append(", language=").append(language);
sb.append(", subscribeTime=").append(subscribeTime);
sb.append(", unionid=").append(unionid);
sb.append(", isSubscribe=").append(isSubscribe).append("]");
return sb.toString();
} }
} }

View File

@ -61,7 +61,7 @@ public class ApiResultV2 implements Serializable {
*/ */
@JSONField(name = "sign_type") @JSONField(name = "sign_type")
@XmlElement(name = "sign_type") @XmlElement(name = "sign_type")
private SignType signType; private String signType;
protected ApiResultV2() { protected ApiResultV2() {
// jaxb required // jaxb required
@ -107,11 +107,16 @@ public class ApiResultV2 implements Serializable {
this.sign = sign; this.sign = sign;
} }
public SignType getSignType() { public String getSignType() {
return signType; return signType;
} }
public void setSignType(SignType signType) { @JSONField(serialize = false)
public SignType getFormatSignType() {
return signType != null ? SignType.valueOf(signType) : null;
}
public void setSignType(String signType) {
this.signType = signType; this.signType = signType;
} }

View File

@ -5,6 +5,7 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import com.alibaba.fastjson.annotation.JSONField;
import com.foxinmy.weixin4j.payment.JsPayNotify; import com.foxinmy.weixin4j.payment.JsPayNotify;
/** /**
@ -21,17 +22,18 @@ import com.foxinmy.weixin4j.payment.JsPayNotify;
public class NativePayNotifyV2 extends JsPayNotify { public class NativePayNotifyV2 extends JsPayNotify {
private static final long serialVersionUID = 1868431159301749988L; private static final long serialVersionUID = 1868431159301749988L;
/** /**
* 产品ID 可视为订单ID * 产品ID 可视为订单ID
*/ */
@JSONField(name = "ProductId")
@XmlElement(name = "ProductId") @XmlElement(name = "ProductId")
private String productId; private String productId;
private NativePayNotifyV2(){ private NativePayNotifyV2() {
// jaxb required // jaxb required
} }
public String getProductId() { public String getProductId() {
return productId; return productId;
} }

View File

@ -5,6 +5,7 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import com.alibaba.fastjson.annotation.JSONField;
import com.foxinmy.weixin4j.model.WeixinPayAccount; import com.foxinmy.weixin4j.model.WeixinPayAccount;
/** /**
@ -24,18 +25,20 @@ public class NativePayResponseV2 extends JsPayRequestV2 {
/** /**
* 返回码 * 返回码
*/ */
@JSONField(name = "RetCode")
@XmlElement(name = "RetCode") @XmlElement(name = "RetCode")
private String retCode; private String retCode;
/** /**
* 返回消息 * 返回消息
*/ */
@JSONField(name = "RetErrMsg")
@XmlElement(name = "RetErrMsg") @XmlElement(name = "RetErrMsg")
private String retMsg; private String retMsg;
protected NativePayResponseV2(){ protected NativePayResponseV2() {
// jaxb required // jaxb required
} }
public NativePayResponseV2(WeixinPayAccount weixinAccount, public NativePayResponseV2(WeixinPayAccount weixinAccount,
PayPackageV2 payPackage) { PayPackageV2 payPackage) {
super(weixinAccount, payPackage); super(weixinAccount, payPackage);

View File

@ -103,12 +103,9 @@ public class OrderV2 extends ApiResultV2 {
return tradeState; return tradeState;
} }
@JSONField(serialize = false, deserialize = false) @JSONField(serialize = false)
public TradeState getFormatTradeState() { public TradeState getFormatTradeState() {
if (tradeState == 0) { return tradeState == 0 ? TradeState.SUCCESS : null;
return TradeState.SUCCESS;
}
return null;
} }
public void setTradeState(int tradeState) { public void setTradeState(int tradeState) {
@ -148,7 +145,7 @@ public class OrderV2 extends ApiResultV2 {
* *
* @return 元单位 * @return 元单位
*/ */
@JSONField(serialize = false, deserialize = false) @JSONField(serialize = false)
public double getFormatTotalFee() { public double getFormatTotalFee() {
return totalFee / 100d; return totalFee / 100d;
} }
@ -161,12 +158,9 @@ public class OrderV2 extends ApiResultV2 {
return feeType; return feeType;
} }
@JSONField(serialize = false, deserialize = false) @JSONField(serialize = false)
public CurrencyType getFormatFeeType() { public CurrencyType getFormatFeeType() {
if (feeType == 1) { return feeType == 1 ? CurrencyType.CNY : null;
return CurrencyType.CNY;
}
return null;
} }
public void setFeeType(int feeType) { public void setFeeType(int feeType) {
@ -217,9 +211,9 @@ public class OrderV2 extends ApiResultV2 {
return timeEnd; return timeEnd;
} }
@JSONField(serialize = false, deserialize = false) @JSONField(serialize = false)
public Date getFormatTimeEnd() { public Date getFormatTimeEnd() {
return DateUtil.parse2yyyyMMddHHmmss(timeEnd); return timeEnd != null ? DateUtil.parse2yyyyMMddHHmmss(timeEnd) : null;
} }
public void setTimeEnd(String timeEnd) { public void setTimeEnd(String timeEnd) {
@ -235,7 +229,7 @@ public class OrderV2 extends ApiResultV2 {
* *
* @return 元单位 * @return 元单位
*/ */
@JSONField(serialize = false, deserialize = false) @JSONField(serialize = false)
public double getFormatTransportFee() { public double getFormatTransportFee() {
return transportFee / 100d; return transportFee / 100d;
} }
@ -253,7 +247,7 @@ public class OrderV2 extends ApiResultV2 {
* *
* @return 元单位 * @return 元单位
*/ */
@JSONField(serialize = false, deserialize = false) @JSONField(serialize = false)
public double getFormatProductFee() { public double getFormatProductFee() {
return productFee / 100d; return productFee / 100d;
} }
@ -271,7 +265,7 @@ public class OrderV2 extends ApiResultV2 {
* *
* @return 元单位 * @return 元单位
*/ */
@JSONField(serialize = false, deserialize = false) @JSONField(serialize = false)
public double getFormatDiscount() { public double getFormatDiscount() {
return discount / 100d; return discount / 100d;
} }
@ -289,9 +283,9 @@ public class OrderV2 extends ApiResultV2 {
* *
* @return 元单位 * @return 元单位
*/ */
@JSONField(serialize = false, deserialize = false) @JSONField(serialize = false)
public double getFormatRmbTotalFee() { public double getFormatRmbTotalFee() {
return rmbTotalFee != null ? rmbTotalFee / 100d : 0d; return rmbTotalFee != null ? rmbTotalFee.doubleValue() / 100d : 0d;
} }
public void setRmbTotalFee(int rmbTotalFee) { public void setRmbTotalFee(int rmbTotalFee) {

View File

@ -5,6 +5,7 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import com.alibaba.fastjson.annotation.JSONField;
import com.foxinmy.weixin4j.payment.PayBaseInfo; import com.foxinmy.weixin4j.payment.PayBaseInfo;
/** /**
@ -25,41 +26,49 @@ public class PayFeedback extends PayBaseInfo {
/** /**
* 投诉单号 * 投诉单号
*/ */
@JSONField(name = "FeedBackId")
@XmlElement(name = "FeedBackId") @XmlElement(name = "FeedBackId")
private String feedbackId; private String feedbackId;
/** /**
* 用户ID * 用户ID
*/ */
@JSONField(name = "OpenId")
@XmlElement(name = "OpenId") @XmlElement(name = "OpenId")
private String openId; private String openId;
/** /**
* 订单交易单号 * 订单交易单号
*/ */
@JSONField(name = "TransId")
@XmlElement(name = "TransId") @XmlElement(name = "TransId")
private String transId; private String transId;
/** /**
* 投诉原因 * 投诉原因
*/ */
@JSONField(name = "Reason")
@XmlElement(name = "Reason") @XmlElement(name = "Reason")
private String reason; private String reason;
/** /**
* 用户希望解决方案 * 用户希望解决方案
*/ */
@JSONField(name = "Solution")
@XmlElement(name = "Solution") @XmlElement(name = "Solution")
private String solution; private String solution;
/** /**
* 备注信息+电话 * 备注信息+电话
*/ */
@JSONField(name = "ExtInfo")
@XmlElement(name = "ExtInfo") @XmlElement(name = "ExtInfo")
private String extInfo; private String extInfo;
/** /**
* 用户上传的图片凭证,最多五张 * 用户上传的图片凭证,最多五张
*/ */
@JSONField(name = "PicInfo")
@XmlElement(name = "PicInfo") @XmlElement(name = "PicInfo")
private String picInfo; private String picInfo;
/** /**
* 通知类型 request 用户提交投诉 confirm 用户确认消除 投诉 reject 用户拒绝消除投诉 * 通知类型 request 用户提交投诉 confirm 用户确认消除 投诉 reject 用户拒绝消除投诉
*/ */
@JSONField(name = "MsgType")
@XmlElement(name = "MsgType") @XmlElement(name = "MsgType")
private String status; private String status;

View File

@ -5,6 +5,7 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import com.alibaba.fastjson.annotation.JSONField;
import com.foxinmy.weixin4j.payment.PayBaseInfo; import com.foxinmy.weixin4j.payment.PayBaseInfo;
/** /**
@ -25,16 +26,19 @@ public class PayWarn extends PayBaseInfo {
/** /**
* 错误代号 1001=发货超时 * 错误代号 1001=发货超时
*/ */
@JSONField(name = "ErrorType")
@XmlElement(name = "ErrorType") @XmlElement(name = "ErrorType")
private String errortype; private String errortype;
/** /**
* 错误描述 * 错误描述
*/ */
@JSONField(name = "Description")
@XmlElement(name = "Description") @XmlElement(name = "Description")
private String description; private String description;
/** /**
* 错误详情 * 错误详情
*/ */
@JSONField(name = "AlarmContent")
@XmlElement(name = "AlarmContent") @XmlElement(name = "AlarmContent")
private String alarmcontent; private String alarmcontent;

View File

@ -8,7 +8,6 @@ import javax.xml.bind.annotation.XmlRootElement;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import com.foxinmy.weixin4j.type.RefundChannel; import com.foxinmy.weixin4j.type.RefundChannel;
import com.foxinmy.weixin4j.type.RefundStatus; import com.foxinmy.weixin4j.type.RefundStatus;
import com.foxinmy.weixin4j.util.StringUtil;
/** /**
* V2退款详细 * V2退款详细
@ -84,7 +83,7 @@ public class RefundDetailV2 extends ApiResultV2 {
return refundChannel; return refundChannel;
} }
@JSONField(deserialize = false, serialize = false) @JSONField(serialize = false)
public RefundChannel getFormatRefundChannel() { public RefundChannel getFormatRefundChannel() {
if (refundChannel == 0) { if (refundChannel == 0) {
return RefundChannel.TENPAY; return RefundChannel.TENPAY;
@ -104,7 +103,7 @@ public class RefundDetailV2 extends ApiResultV2 {
* *
* @return 元单位 * @return 元单位
*/ */
@JSONField(deserialize = false, serialize = false) @JSONField(serialize = false)
public double getFormatRefundFee() { public double getFormatRefundFee() {
return refundFee / 100d; return refundFee / 100d;
} }
@ -113,7 +112,7 @@ public class RefundDetailV2 extends ApiResultV2 {
return refundStatus; return refundStatus;
} }
@JSONField(deserialize = false, serialize = false) @JSONField(serialize = false)
public RefundStatus getFormatRefundStatus() { public RefundStatus getFormatRefundStatus() {
String refundStatus_ = String.format(",%d,", refundStatus); String refundStatus_ = String.format(",%d,", refundStatus);
if (",4,10,".contains(refundStatus_)) { if (",4,10,".contains(refundStatus_)) {
@ -132,11 +131,11 @@ public class RefundDetailV2 extends ApiResultV2 {
} }
public String getRecvUserId() { public String getRecvUserId() {
return StringUtil.isNotBlank(recvUserId) ? recvUserId : null; return recvUserId;
} }
public String getReccvUserName() { public String getReccvUserName() {
return StringUtil.isNotBlank(reccvUserName) ? reccvUserName : null; return reccvUserName;
} }
@Override @Override

View File

@ -1,6 +1,6 @@
# \u6d4b\u8bd5\u4e4b\u7528 \u6b63\u5f0f\u73af\u5883\u4e0bcopy\u4e00\u4efd\u5230classpath # \u6d4b\u8bd5\u4e4b\u7528 \u6b63\u5f0f\u73af\u5883\u4e0bcopy\u4e00\u4efd\u5230classpath
# \u516c\u4f17\u53f7\u4fe1\u606f # \u516c\u4f17\u53f7\u4fe1\u606f
account={"id":"wx4ab8f8de58159a57","secret":"1d4eb0f4bf556aaed539f30ed05ca795",\ account={"id":"wxd5d03da81b799b9a","secret":"c787a9fcec16fd712b77679c1fc8084f",\
"mchId":"V3.x\u7248\u672c\u4e0b\u7684\u5fae\u4fe1\u5546\u6237\u53f7 \u670d\u52a1\u53f7\u652f\u4ed8\u65f6\u9700\u8981\u586b\u5165",\ "mchId":"V3.x\u7248\u672c\u4e0b\u7684\u5fae\u4fe1\u5546\u6237\u53f7 \u670d\u52a1\u53f7\u652f\u4ed8\u65f6\u9700\u8981\u586b\u5165",\
"partnerId":"V2\u7248\u672c\u4e0b\u7684\u8d22\u4ed8\u901a\u7684\u5546\u6237\u53f7 \u670d\u52a1\u53f7\u652f\u4ed8\u65f6\u9700\u8981\u586b\u5165",\ "partnerId":"V2\u7248\u672c\u4e0b\u7684\u8d22\u4ed8\u901a\u7684\u5546\u6237\u53f7 \u670d\u52a1\u53f7\u652f\u4ed8\u65f6\u9700\u8981\u586b\u5165",\
"partnerKey":"V2\u7248\u672c\u4e0b\u7684\u8d22\u4ed8\u901a\u5546\u6237\u6743\u9650\u5bc6\u94a5Key \u670d\u52a1\u53f7\u652f\u4ed8\u65f6\u9700\u8981\u586b\u5165",\ "partnerKey":"V2\u7248\u672c\u4e0b\u7684\u8d22\u4ed8\u901a\u5546\u6237\u6743\u9650\u5bc6\u94a5Key \u670d\u52a1\u53f7\u652f\u4ed8\u65f6\u9700\u8981\u586b\u5165",\

View File

@ -59,7 +59,7 @@ public class MenuTest extends TokenTest {
Button b1 = new Button("我要订餐", "ORDERING", ButtonType.click); Button b1 = new Button("我要订餐", "ORDERING", ButtonType.click);
btnList.add(b1); btnList.add(b1);
Button b2 = new Button("查询订单", "http://182.254.188.133:8082/order/list", ButtonType.view); Button b2 = new Button("查询订单", "http://www.lendocean.com/order/list", ButtonType.view);
btnList.add(b2); btnList.add(b2);
Button b3 = new Button("最新资讯", "NEWS", ButtonType.click); Button b3 = new Button("最新资讯", "NEWS", ButtonType.click);
btnList.add(b3); btnList.add(b3);

View File

@ -74,7 +74,7 @@ weixin4j.properties说明
third_oauth_redirect_uri=http://xxx third_oauth_redirect_uri=http://xxx
#企业号第三方应用套件授权后重定向的url(使用OauthApi时需要填写) #企业号第三方应用套件授权后重定向的url(使用OauthApi时需要填写)
suite_redirect_uri=http://xxx suite_oauth_redirect_uri=http://xxx
2.实例化微信企业号接口实现对象,调用具体的API方法 2.实例化微信企业号接口实现对象,调用具体的API方法

View File

@ -155,7 +155,7 @@ public class BatchApi extends QyApi {
* *
* @param jobId * @param jobId
* 任务ID * 任务ID
* @return 效果信息 * @return 执行结果对象
* @see com.foxinmy.weixin4j.qy.model.BatchResult * @see com.foxinmy.weixin4j.qy.model.BatchResult
* @see <a * @see <a
* href="http://qydev.weixin.qq.com/wiki/index.php?title=%E5%BC%82%E6%AD%A5%E4%BB%BB%E5%8A%A1%E6%8E%A5%E5%8F%A3#.E8.8E.B7.E5.8F.96.E5.BC.82.E6.AD.A5.E4.BB.BB.E5.8A.A1.E7.BB.93.E6.9E.9C">获取异步任务执行结果</a> * href="http://qydev.weixin.qq.com/wiki/index.php?title=%E5%BC%82%E6%AD%A5%E4%BB%BB%E5%8A%A1%E6%8E%A5%E5%8F%A3#.E8.8E.B7.E5.8F.96.E5.BC.82.E6.AD.A5.E4.BB.BB.E5.8A.A1.E7.BB.93.E6.9E.9C">获取异步任务执行结果</a>
@ -164,8 +164,8 @@ public class BatchApi extends QyApi {
public BatchResult getBatchResult(String jobId) throws WeixinException { public BatchResult getBatchResult(String jobId) throws WeixinException {
Token token = tokenHolder.getToken(); Token token = tokenHolder.getToken();
String batch_getresult_uri = getRequestUri("batch_getresult_uri"); String batch_getresult_uri = getRequestUri("batch_getresult_uri");
WeixinResponse response = weixinClient.get(String.format(batch_getresult_uri, WeixinResponse response = weixinClient.get(String.format(
token.getAccessToken(), jobId)); batch_getresult_uri, token.getAccessToken(), jobId));
return response.getAsObject(new TypeReference<BatchResult>() { return response.getAsObject(new TypeReference<BatchResult>() {
}); });
} }

View File

@ -70,7 +70,7 @@ public class PartyApi extends QyApi {
} }
String department_update_uri = getRequestUri("department_update_uri"); String department_update_uri = getRequestUri("department_update_uri");
JSONObject obj = (JSONObject) JSON.toJSON(party); JSONObject obj = (JSONObject) JSON.toJSON(party);
if (party.getParentid() < 1) { if (party.getParentId() < 1) {
obj.remove("parentid"); obj.remove("parentid");
} }
if (party.getOrder() < 0) { if (party.getOrder() < 0) {

View File

@ -118,6 +118,8 @@ public class UserApi extends QyApi {
} }
if (avatar != null) { if (avatar != null) {
obj.put("avatar_mediaid", mediaApi.uploadMedia(0, avatar, null)); obj.put("avatar_mediaid", mediaApi.uploadMedia(0, avatar, null));
} else {
obj.put("avatar_mediaid", obj.remove("avatar"));
} }
Token token = tokenHolder.getToken(); Token token = tokenHolder.getToken();
WeixinResponse response = weixinClient.post( WeixinResponse response = weixinClient.post(

View File

@ -2,6 +2,8 @@ package com.foxinmy.weixin4j.qy.message;
import java.io.Serializable; import java.io.Serializable;
import com.alibaba.fastjson.annotation.JSONCreator;
import com.alibaba.fastjson.annotation.JSONField;
import com.foxinmy.weixin4j.qy.type.ChatType; import com.foxinmy.weixin4j.qy.type.ChatType;
import com.foxinmy.weixin4j.tuple.ChatTuple; import com.foxinmy.weixin4j.tuple.ChatTuple;
@ -37,8 +39,11 @@ public class ChatMessage implements Serializable {
*/ */
private ChatTuple chatTuple; private ChatTuple chatTuple;
public ChatMessage(String targetId, ChatType chatType, String senderId, @JSONCreator
ChatTuple chatTuple) { public ChatMessage(@JSONField(name = "targetId") String targetId,
@JSONField(name = "chatType") ChatType chatType,
@JSONField(name = "senderId") String senderId,
@JSONField(name = "chatTuple") ChatTuple chatTuple) {
this.targetId = targetId; this.targetId = targetId;
this.chatType = chatType; this.chatType = chatType;
this.senderId = senderId; this.senderId = senderId;

View File

@ -30,7 +30,8 @@ public class NotifyMessage implements Serializable {
/** /**
* 企业应用的id整型可在应用的设置页面查看 * 企业应用的id整型可在应用的设置页面查看
*/ */
private int agentid; @JSONField(name = "agentid")
private int agentId;
/** /**
* 表示是否是保密消息0表示否1表示是默认0 * 表示是否是保密消息0表示否1表示是默认0
*/ */
@ -50,9 +51,9 @@ public class NotifyMessage implements Serializable {
this(agentid, tuple, IdParameter.get(), false); this(agentid, tuple, IdParameter.get(), false);
} }
public NotifyMessage(int agentid, NotifyTuple tuple, IdParameter target, public NotifyMessage(int agentId, NotifyTuple tuple, IdParameter target,
boolean isSafe) { boolean isSafe) {
this.agentid = agentid; this.agentId = agentId;
this.safe = isSafe ? 1 : 0; this.safe = isSafe ? 1 : 0;
this.tuple = tuple; this.tuple = tuple;
this.target = target; this.target = target;
@ -66,8 +67,8 @@ public class NotifyMessage implements Serializable {
this.safe = isSafe ? 1 : 0; this.safe = isSafe ? 1 : 0;
} }
public int getAgentid() { public int getAgentId() {
return agentid; return agentId;
} }
public NotifyTuple getTuple() { public NotifyTuple getTuple() {
@ -80,7 +81,7 @@ public class NotifyMessage implements Serializable {
@Override @Override
public String toString() { public String toString() {
return "NotifyMessage [agentid=" + agentid + ", safe=" + safe return "NotifyMessage [agentId=" + agentId + ", safe=" + safe
+ ", tuple=" + tuple + ", target=" + target + "]"; + ", tuple=" + tuple + ", target=" + target + "]";
} }
} }

View File

@ -30,17 +30,17 @@ public class AgentInfo extends AgentSetter {
/** /**
* 企业应用可见范围人员其中包括userid和关注状态state * 企业应用可见范围人员其中包括userid和关注状态state
*/ */
@JSONField(serialize = false) @JSONField(deserialize = false)
private List<User> allowUsers; private List<User> allowUsers;
/** /**
* 企业应用可见范围部门 * 企业应用可见范围部门
*/ */
@JSONField(serialize = false) @JSONField(deserialize = false)
private List<Integer> allowPartys; private List<Integer> allowPartys;
/** /**
* 企业应用可见范围标签 * 企业应用可见范围标签
*/ */
@JSONField(serialize = false) @JSONField(deserialize = false)
private List<Integer> allowTags; private List<Integer> allowTags;
/** /**
* 企业应用是否被禁用 * 企业应用是否被禁用
@ -55,18 +55,10 @@ public class AgentInfo extends AgentSetter {
return squareLogoUrl; return squareLogoUrl;
} }
public void setSquareLogoUrl(String squareLogoUrl) {
this.squareLogoUrl = squareLogoUrl;
}
public String getRoundLogoUrl() { public String getRoundLogoUrl() {
return roundLogoUrl; return roundLogoUrl;
} }
public void setRoundLogoUrl(String roundLogoUrl) {
this.roundLogoUrl = roundLogoUrl;
}
public List<User> getAllowUsers() { public List<User> getAllowUsers() {
return allowUsers; return allowUsers;
} }
@ -95,6 +87,16 @@ public class AgentInfo extends AgentSetter {
return close; return close;
} }
// ---------- setter 应该全部去掉
public void setSquareLogoUrl(String squareLogoUrl) {
this.squareLogoUrl = squareLogoUrl;
}
public void setRoundLogoUrl(String roundLogoUrl) {
this.roundLogoUrl = roundLogoUrl;
}
public void setClose(boolean close) { public void setClose(boolean close) {
this.close = close; this.close = close;
} }

View File

@ -6,6 +6,7 @@ import com.alibaba.fastjson.annotation.JSONField;
/** /**
* 企业号应用的概况信息 * 企业号应用的概况信息
*
* @className AgentOverview * @className AgentOverview
* @author jy * @author jy
* @date 2015年4月9日 * @date 2015年4月9日
@ -13,12 +14,13 @@ import com.alibaba.fastjson.annotation.JSONField;
* @see * @see
*/ */
public class AgentOverview implements Serializable { public class AgentOverview implements Serializable {
private static final long serialVersionUID = 5459274811502476460L; private static final long serialVersionUID = 5459274811502476460L;
/** /**
* 企业应用的id * 企业应用的id
*/ */
private int agentid; @JSONField(name = "agentid")
private int agentId;
/** /**
* 企业应用名称 * 企业应用名称
*/ */
@ -33,34 +35,43 @@ public class AgentOverview implements Serializable {
*/ */
@JSONField(name = "round_logo_url") @JSONField(name = "round_logo_url")
private String roundLogoUrl; private String roundLogoUrl;
public int getAgentid() {
return agentid; public int getAgentId() {
} return agentId;
public void setAgentid(int agentid) {
this.agentid = agentid;
} }
public String getName() { public String getName() {
return name; return name;
} }
public void setName(String name) {
this.name = name;
}
public String getSquareLogoUrl() { public String getSquareLogoUrl() {
return squareLogoUrl; return squareLogoUrl;
} }
public void setSquareLogoUrl(String squareLogoUrl) {
this.squareLogoUrl = squareLogoUrl;
}
public String getRoundLogoUrl() { public String getRoundLogoUrl() {
return roundLogoUrl; return roundLogoUrl;
} }
// ---------- setter 应该全部去掉
public void setAgentId(int agentId) {
this.agentId = agentId;
}
public void setName(String name) {
this.name = name;
}
public void setSquareLogoUrl(String squareLogoUrl) {
this.squareLogoUrl = squareLogoUrl;
}
public void setRoundLogoUrl(String roundLogoUrl) { public void setRoundLogoUrl(String roundLogoUrl) {
this.roundLogoUrl = roundLogoUrl; this.roundLogoUrl = roundLogoUrl;
} }
@Override @Override
public String toString() { public String toString() {
return "AgentOverview [agentid=" + agentid + ", name=" + name return "AgentOverview [agentId=" + agentId + ", name=" + name
+ ", squareLogoUrl=" + squareLogoUrl + ", roundLogoUrl=" + ", squareLogoUrl=" + squareLogoUrl + ", roundLogoUrl="
+ roundLogoUrl + "]"; + roundLogoUrl + "]";
} }

View File

@ -21,17 +21,18 @@ public class AgentSetter implements Serializable {
/** /**
* 企业应用的id * 企业应用的id
*/ */
private int agentid; @JSONField(name = "agentid")
private int agentId;
/** /**
* 企业应用是否打开地理位置上报 * 企业应用是否打开地理位置上报
*/ */
@JSONField(name = "report_location_flag") @JSONField(name = "report_location_flag")
private ReportLocationType reportLocationType; private String reportLocationType;
/** /**
* 企业应用头像的mediaid通过多媒体接口上传图片获得mediaid上传后会自动裁剪成方形和圆形两个头像 * 企业应用头像的mediaid通过多媒体接口上传图片获得mediaid上传后会自动裁剪成方形和圆形两个头像
*/ */
@JSONField(name = "logo_mediaid") @JSONField(name = "logo_mediaid")
private String logoMediaid; private String logoMediaId;
/** /**
* 企业应用名称 * 企业应用名称
*/ */
@ -56,32 +57,34 @@ public class AgentSetter implements Serializable {
@JSONField(name = "isreportenter") @JSONField(name = "isreportenter")
private int isReportEnter; private int isReportEnter;
public AgentSetter(int agentid) { public AgentSetter(int agentId) {
this.agentid = agentid; this.agentId = agentId;
} }
public int getAgentid() { public int getAgentId() {
return agentid; return agentId;
} }
public void setAgentid(int agentid) { public String getReportLocationType() {
this.agentid = agentid;
}
public ReportLocationType getReportLocationType() {
return reportLocationType; return reportLocationType;
} }
@JSONField(serialize = false)
public ReportLocationType getFormatReportLocationType() {
return reportLocationType != null ? ReportLocationType
.valueOf(reportLocationType.toUpperCase()) : null;
}
public void setReportLocationType(ReportLocationType reportLocationType) { public void setReportLocationType(ReportLocationType reportLocationType) {
this.reportLocationType = reportLocationType; this.reportLocationType = reportLocationType.name();
} }
public String getLogoMediaid() { public String getLogoMediaId() {
return logoMediaid; return logoMediaId;
} }
public void setLogoMediaid(String logoMediaid) { public void setLogoMediaid(String logoMediaId) {
this.logoMediaid = logoMediaid; this.logoMediaId = logoMediaId;
} }
public String getName() { public String getName() {
@ -124,10 +127,24 @@ public class AgentSetter implements Serializable {
this.isReportEnter = isReportEnter ? 1 : 0; this.isReportEnter = isReportEnter ? 1 : 0;
} }
// ---------- setter 应该全部去掉
public void setAgentId(int agentId) {
this.agentId = agentId;
}
public void setReportLocationType(String reportLocationType) {
this.reportLocationType = reportLocationType;
}
public void setLogoMediaId(String logoMediaId) {
this.logoMediaId = logoMediaId;
}
@Override @Override
public String toString() { public String toString() {
return "agentid=" + agentid + ", reportLocationType=" return "agentId=" + agentId + ", reportLocationType="
+ reportLocationType + ", logoMediaid=" + logoMediaid + reportLocationType + ", logoMediaId=" + logoMediaId
+ ", name=" + name + ", description=" + description + ", name=" + name + ", description=" + description
+ ", redirectDomain=" + redirectDomain + ", isReportUser=" + ", redirectDomain=" + redirectDomain + ", isReportUser="
+ isReportUser + ", isReportEnter=" + isReportEnter; + isReportUser + ", isReportEnter=" + isReportEnter;

View File

@ -1,6 +1,7 @@
package com.foxinmy.weixin4j.qy.model; package com.foxinmy.weixin4j.qy.model;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.annotation.JSONField;
import com.foxinmy.weixin4j.http.weixin.JsonResult; import com.foxinmy.weixin4j.http.weixin.JsonResult;
import com.foxinmy.weixin4j.qy.type.BatchStatus; import com.foxinmy.weixin4j.qy.type.BatchStatus;
import com.foxinmy.weixin4j.qy.type.BatchType; import com.foxinmy.weixin4j.qy.type.BatchType;
@ -32,68 +33,82 @@ public class BatchResult extends JsonResult {
/** /**
* 目前运行百分比当任务完成时为100 * 目前运行百分比当任务完成时为100
*/ */
private int percentage; @JSONField(name = "percentage")
private int percentAge;
/** /**
* 预估剩余时间单位分钟当任务完成时为0 * 预估剩余时间单位分钟当任务完成时为0
*/ */
private int remaintime; @JSONField(name = "remaintime")
private int remainTime;
/** /**
* 详细的处理结果 TODO * 详细的处理结果 TODO
*/ */
private JSONArray result; private JSONArray result;
public BatchStatus getStatus() { public int getStatus() {
return status;
}
@JSONField(serialize = false)
public BatchStatus getFormatStatus() {
return BatchStatus.values()[status - 1]; return BatchStatus.values()[status - 1];
} }
public void setStatus(int status) { public String getType() {
this.status = status; return type;
} }
public BatchType getType() { @JSONField(serialize = false)
return BatchType.valueOf(type.toUpperCase()); public BatchType getFormatType() {
} return type != null ? BatchType.valueOf(type.toUpperCase()) : null;
public void setType(String type) {
this.type = type;
} }
public int getTotal() { public int getTotal() {
return total; return total;
} }
public void setTotal(int total) { public int getPercentAge() {
this.total = total; return percentAge;
} }
public int getPercentage() { public int getRemainTime() {
return percentage; return remainTime;
}
public void setPercentage(int percentage) {
this.percentage = percentage;
}
public int getRemaintime() {
return remaintime;
}
public void setRemaintime(int remaintime) {
this.remaintime = remaintime;
} }
public JSONArray getResult() { public JSONArray getResult() {
return result; return result;
} }
// ---------- setter 应该全部去掉
public void setStatus(int status) {
this.status = status;
}
public void setType(String type) {
this.type = type;
}
public void setTotal(int total) {
this.total = total;
}
public void setPercentAge(int percentAge) {
this.percentAge = percentAge;
}
public void setRemainTime(int remainTime) {
this.remainTime = remainTime;
}
public void setResult(JSONArray result) { public void setResult(JSONArray result) {
this.result = result; this.result = result;
} }
@Override @Override
public String toString() { public String toString() {
return "BatchResult [status=" + getStatus() + ", type=" + getType() + ", total=" return "BatchResult [status=" + status + ", type=" + type + ", total="
+ total + ", percentage=" + percentage + ", remaintime=" + total + ", percentAge=" + percentAge + ", remainTime="
+ remaintime + ", result=" + result + "]"; + remainTime + ", result=" + result + "]";
} }
} }

View File

@ -3,7 +3,6 @@ package com.foxinmy.weixin4j.qy.model;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
import com.alibaba.fastjson.annotation.JSONCreator;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
/** /**
@ -37,19 +36,14 @@ public class ChatInfo implements Serializable {
@JSONField(name = "userlist") @JSONField(name = "userlist")
private List<String> members; private List<String> members;
public ChatInfo(String chatId, String name, String owner) { public ChatInfo() {
this(chatId, name, owner, null);
} }
@JSONCreator public ChatInfo(String chatId, String name, String owner) {
public ChatInfo(@JSONField(name = "chatId") String chatId,
@JSONField(name = "name") String name,
@JSONField(name = "owner") String owner,
@JSONField(name = "userlist") List<String> members) {
this.chatId = chatId; this.chatId = chatId;
this.name = name; this.name = name;
this.owner = owner; this.owner = owner;
this.members = members;
} }
public String getChatId() { public String getChatId() {
@ -72,6 +66,20 @@ public class ChatInfo implements Serializable {
this.members = members; this.members = members;
} }
// ---------- setter 应该全部去掉
public void setChatId(String chatId) {
this.chatId = chatId;
}
public void setName(String name) {
this.name = name;
}
public void setOwner(String owner) {
this.owner = owner;
}
@Override @Override
public String toString() { public String toString() {
return "ChatInfo [chatId=" + chatId + ", name=" + name + ", owner=" return "ChatInfo [chatId=" + chatId + ", name=" + name + ", owner="

View File

@ -2,6 +2,7 @@ package com.foxinmy.weixin4j.qy.model;
import java.io.Serializable; import java.io.Serializable;
import com.alibaba.fastjson.annotation.JSONCreator;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
/** /**
@ -17,7 +18,8 @@ public class ChatMute implements Serializable {
private static final long serialVersionUID = 6734443056426236273L; private static final long serialVersionUID = 6734443056426236273L;
private String userid; @JSONField(name = "userid")
private String userId;
private int status; private int status;
/** /**
@ -25,8 +27,8 @@ public class ChatMute implements Serializable {
* *
* @param userid * @param userid
*/ */
public ChatMute(String userid) { public ChatMute(String userId) {
this.userid = userid; this.userId = userId;
} }
/** /**
@ -37,27 +39,28 @@ public class ChatMute implements Serializable {
* @param status * @param status
* 是否开启免打扰 * 是否开启免打扰
*/ */
public ChatMute(String userid, boolean status) { @JSONCreator
this.userid = userid; public ChatMute(@JSONField(name = "userId") String userId,
@JSONField(name = "status") boolean status) {
this.userId = userId;
this.status = status ? 1 : 0; this.status = status ? 1 : 0;
} }
public String getUserid() { public String getUserId() {
return userid; return userId;
} }
public int getStatus() { public int getStatus() {
return status; return status;
} }
@JSONField(deserialize = false) @JSONField(serialize = false)
public boolean getFormatStatus() { public boolean getFormatStatus() {
return status == 1; return status == 1;
} }
@Override @Override
public String toString() { public String toString() {
return "ChatMute [userid=" + userid + ", status=" + getFormatStatus() return "ChatMute [userId=" + userId + ", status=" + status + "]";
+ "]";
} }
} }

View File

@ -8,19 +8,20 @@ import com.foxinmy.weixin4j.qy.type.CorpType;
/** /**
* 授权方企业号信息 * 授权方企业号信息
* *
* @className Corpinfo * @className CorpInfo
* @author jy * @author jy
* @date 2015年6月12日 * @date 2015年6月12日
* @since JDK 1.7 * @since JDK 1.7
* @see * @see
*/ */
public class Corpinfo implements Serializable { public class CorpInfo implements Serializable {
private static final long serialVersionUID = 1251033124778972419L; private static final long serialVersionUID = 1251033124778972419L;
/** /**
* 授权方企业号id * 授权方企业号id
*/ */
private String corpid; @JSONField(name = "corpid")
private String corpId;
/** /**
* 授权方企业号名称 * 授权方企业号名称
*/ */
@ -40,93 +41,100 @@ public class Corpinfo implements Serializable {
* 授权方企业号类型 * 授权方企业号类型
*/ */
@JSONField(name = "corp_type") @JSONField(name = "corp_type")
private CorpType corpType; private String corpType;
/** /**
* 授权方企业号用户规模 * 授权方企业号用户规模
*/ */
@JSONField(name = "corp_user_max") @JSONField(name = "corp_user_max")
private int userMax; private Integer userMax;
/** /**
* 授权方企业号应用规模 * 授权方企业号应用规模
*/ */
@JSONField(name = "corp_agent_max") @JSONField(name = "corp_agent_max")
private int agentMax; private Integer agentMax;
/** /**
* 授权方企业号二维码 * 授权方企业号二维码
*/ */
@JSONField(name = "corp_wxqrcode") @JSONField(name = "corp_wxqrcode")
private String wxqrcode; private String wxQrCode;
public String getCorpid() { public String getCorpId() {
return corpid; return corpId;
} }
public void setCorpid(String corpid) { public String getCorpType() {
this.corpid = corpid;
}
public CorpType getCorpType() {
return corpType; return corpType;
} }
public void setCorpType(CorpType corpType) { @JSONField(serialize = false)
this.corpType = corpType; public CorpType getFormatCorpType() {
return corpType != null ? CorpType.valueOf(corpType) : null;
} }
public String getCorpName() { public String getCorpName() {
return corpName; return corpName;
} }
public void setCorpName(String corpName) {
this.corpName = corpName;
}
public String getSquareLogoUrl() { public String getSquareLogoUrl() {
return squareLogoUrl; return squareLogoUrl;
} }
public void setSquareLogoUrl(String squareLogoUrl) {
this.squareLogoUrl = squareLogoUrl;
}
public String getRoundLogoUrl() { public String getRoundLogoUrl() {
return roundLogoUrl; return roundLogoUrl;
} }
public Integer getUserMax() {
return userMax;
}
public Integer getAgentMax() {
return agentMax;
}
public String getWxQrCode() {
return wxQrCode;
}
// ---------- setter 应该全部去掉
public void setCorpId(String corpId) {
this.corpId = corpId;
}
public void setCorpName(String corpName) {
this.corpName = corpName;
}
public void setSquareLogoUrl(String squareLogoUrl) {
this.squareLogoUrl = squareLogoUrl;
}
public void setRoundLogoUrl(String roundLogoUrl) { public void setRoundLogoUrl(String roundLogoUrl) {
this.roundLogoUrl = roundLogoUrl; this.roundLogoUrl = roundLogoUrl;
} }
public int getUserMax() { public void setCorpType(String corpType) {
return userMax; this.corpType = corpType;
} }
public void setUserMax(int userMax) { public void setUserMax(Integer userMax) {
this.userMax = userMax; this.userMax = userMax;
} }
public int getAgentMax() { public void setAgentMax(Integer agentMax) {
return agentMax;
}
public void setAgentMax(int agentMax) {
this.agentMax = agentMax; this.agentMax = agentMax;
} }
public String getWxqrcode() { public void setWxQrCode(String wxQrCode) {
return wxqrcode; this.wxQrCode = wxQrCode;
}
public void setWxqrcode(String wxqrcode) {
this.wxqrcode = wxqrcode;
} }
@Override @Override
public String toString() { public String toString() {
return "Corpinfo [corpid=" + corpid + ", corpName=" + corpName return "CorpInfo [corpType=" + corpId + ", corpName=" + corpName
+ ", squareLogoUrl=" + squareLogoUrl + ", roundLogoUrl=" + ", squareLogoUrl=" + squareLogoUrl + ", roundLogoUrl="
+ roundLogoUrl + ", corpType=" + corpType + ", userMax=" + roundLogoUrl + ", corpType=" + corpType + ", userMax="
+ userMax + ", agentMax=" + agentMax + ", wxqrcode=" + wxqrcode + userMax + ", agentMax=" + agentMax + ", wxQrCode=" + wxQrCode
+ "]"; + "]";
} }
} }

View File

@ -2,8 +2,12 @@ package com.foxinmy.weixin4j.qy.model;
import java.io.Serializable; import java.io.Serializable;
import com.alibaba.fastjson.annotation.JSONCreator;
import com.alibaba.fastjson.annotation.JSONField;
/** /**
* name-value * name-value
*
* @className NameValue * @className NameValue
* @author jy * @author jy
* @date 2015年3月29日 * @date 2015年3月29日
@ -16,11 +20,9 @@ public class NameValue implements Serializable {
private String name; private String name;
private String value; private String value;
public NameValue() { @JSONCreator
public NameValue(@JSONField(name = "name") String name,
} @JSONField(name = "value") String value) {
public NameValue(String name, String value) {
this.name = name; this.name = name;
this.value = value; this.value = value;
} }
@ -33,14 +35,6 @@ public class NameValue implements Serializable {
return value; return value;
} }
public void setName(String name) {
this.name = name;
}
public void setValue(String value) {
this.value = value;
}
@Override @Override
public String toString() { public String toString() {
return "NameValue [name=" + name + ", value=" + value + "]"; return "NameValue [name=" + name + ", value=" + value + "]";

View File

@ -37,7 +37,7 @@ public class OUserInfo implements Serializable {
* 授权方企业信息 * 授权方企业信息
*/ */
@JSONField(name = "corp_info") @JSONField(name = "corp_info")
private Corpinfo corpinfo; private CorpInfo corpInfo;
/** /**
* 该管理员在该提供商中能使用的应用列表 * 该管理员在该提供商中能使用的应用列表
*/ */
@ -53,46 +53,48 @@ public class OUserInfo implements Serializable {
return isSysAdmin; return isSysAdmin;
} }
public void setSysAdmin(boolean isSysAdmin) {
this.isSysAdmin = isSysAdmin;
}
public boolean isInnerAdmin() { public boolean isInnerAdmin() {
return isInnerAdmin; return isInnerAdmin;
} }
public void setInnerAdmin(boolean isInnerAdmin) {
this.isInnerAdmin = isInnerAdmin;
}
public User getAdminInfo() { public User getAdminInfo() {
return adminInfo; return adminInfo;
} }
public void setAdminInfo(User adminInfo) { public CorpInfo getCorpInfo() {
this.adminInfo = adminInfo; return corpInfo;
}
public Corpinfo getCorpinfo() {
return corpinfo;
}
public void setCorpinfo(Corpinfo corpinfo) {
this.corpinfo = corpinfo;
} }
public List<AgentItem> getAgentInfo() { public List<AgentItem> getAgentInfo() {
return agentInfo; return agentInfo;
} }
public void setAgentInfo(List<AgentItem> agentInfo) {
this.agentInfo = agentInfo;
}
public AuthInfo getAuthInfo() { public AuthInfo getAuthInfo() {
return authInfo; return authInfo;
} }
// ---------- setter 应该全部去掉
public void setSysAdmin(boolean isSysAdmin) {
this.isSysAdmin = isSysAdmin;
}
public void setInnerAdmin(boolean isInnerAdmin) {
this.isInnerAdmin = isInnerAdmin;
}
public void setAdminInfo(User adminInfo) {
this.adminInfo = adminInfo;
}
public void setCorpInfo(CorpInfo corpInfo) {
this.corpInfo = corpInfo;
}
public void setAgentInfo(List<AgentItem> agentInfo) {
this.agentInfo = agentInfo;
}
public void setAuthInfo(AuthInfo authInfo) { public void setAuthInfo(AuthInfo authInfo) {
this.authInfo = authInfo; this.authInfo = authInfo;
} }
@ -100,8 +102,8 @@ public class OUserInfo implements Serializable {
@Override @Override
public String toString() { public String toString() {
return "OUserInfo [isSysAdmin=" + isSysAdmin + ", isInnerAdmin=" return "OUserInfo [isSysAdmin=" + isSysAdmin + ", isInnerAdmin="
+ isInnerAdmin + ", adminInfo=" + adminInfo + ", corpinfo=" + isInnerAdmin + ", adminInfo=" + adminInfo + ", corpInfo="
+ corpinfo + ", agentInfo=" + agentInfo + ", authInfo=" + corpInfo + ", agentInfo=" + agentInfo + ", authInfo="
+ authInfo + "]"; + authInfo + "]";
} }
@ -126,28 +128,30 @@ public class OUserInfo implements Serializable {
* 授权的通讯录部门 * 授权的通讯录部门
*/ */
@JSONField(name = "department") @JSONField(name = "department")
private List<DepartmentItem> departmentItems; private List<DepartItem> departItems;
public List<AgentItem> getAgentItems() { public List<AgentItem> getAgentItems() {
return agentItems; return agentItems;
} }
public List<DepartItem> getDepartItems() {
return departItems;
}
// ---------- setter 应该全部去掉
public void setAgentItems(List<AgentItem> agentItems) { public void setAgentItems(List<AgentItem> agentItems) {
this.agentItems = agentItems; this.agentItems = agentItems;
} }
public List<DepartmentItem> getDepartmentItems() { public void setDepartItems(List<DepartItem> departItems) {
return departmentItems; this.departItems = departItems;
}
public void setDepartmentItems(List<DepartmentItem> departmentItems) {
this.departmentItems = departmentItems;
} }
@Override @Override
public String toString() { public String toString() {
return "AuthInfo [agentItems=" + agentItems + ", departmentItems=" return "AuthInfo [agentItems=" + agentItems + ", departItems="
+ departmentItems + "]"; + departItems + "]";
} }
} }
@ -167,49 +171,57 @@ public class OUserInfo implements Serializable {
* 管理员对应用的权限 * 管理员对应用的权限
*/ */
@JSONField(name = "auth_type") @JSONField(name = "auth_type")
private AgentAuthType authType; private int authType;
/** /**
* 服务商套件中的对应应用id * 服务商套件中的对应应用id
*/ */
private int appid; @JSONField(name = "appid")
private int appId;
/** /**
* 授权方应用敏感权限组目前仅有get_location表示是否有权限设置应用获取地理位置的开关 * 授权方应用敏感权限组目前仅有get_location表示是否有权限设置应用获取地理位置的开关
*/ */
@JSONField(name = "api_group") @JSONField(name = "api_group")
private List<String> apiGroup; private List<String> apiGroup;
public AgentAuthType getAuthType() { public int getAuthType() {
return authType; return authType;
} }
public void setAuthType(int authType) { @JSONField(serialize = false)
public AgentAuthType getFormatAuthType() {
if (authType == 0) { if (authType == 0) {
this.authType = AgentAuthType.USE; return AgentAuthType.USE;
} else if (authType == 1) { } else if (authType == 1) {
this.authType = AgentAuthType.MANAGE; return AgentAuthType.MANAGE;
} }
this.authType = null; return null;
} }
public int getAppid() { public int getAppId() {
return appid; return appId;
}
public void setAppid(int appid) {
this.appid = appid;
} }
public List<String> getApiGroup() { public List<String> getApiGroup() {
return apiGroup; return apiGroup;
} }
// ---------- setter 应该全部去掉
public void setAuthType(int authType) {
this.authType = authType;
}
public void setAppId(int appId) {
this.appId = appId;
}
public void setApiGroup(List<String> apiGroup) { public void setApiGroup(List<String> apiGroup) {
this.apiGroup = apiGroup; this.apiGroup = apiGroup;
} }
@Override @Override
public String toString() { public String toString() {
return "AgentItem [authType=" + authType + ", appid=" + appid return "AgentItem [authType=" + authType + ", appId=" + appId
+ ", apiGroup=" + apiGroup + ", " + super.toString() + "]"; + ", apiGroup=" + apiGroup + ", " + super.toString() + "]";
} }
} }
@ -217,13 +229,13 @@ public class OUserInfo implements Serializable {
/** /**
* 授权的通讯录部门 * 授权的通讯录部门
* *
* @className DepartmentItem * @className DepartItem
* @author jy * @author jy
* @date 2015年6月22日 * @date 2015年6月22日
* @since JDK 1.7 * @since JDK 1.7
* @see * @see
*/ */
public static class DepartmentItem extends Party { public static class DepartItem extends Party {
private static final long serialVersionUID = 556556672204642407L; private static final long serialVersionUID = 556556672204642407L;
@ -236,14 +248,15 @@ public class OUserInfo implements Serializable {
return writable; return writable;
} }
// ---------- setter 应该全部去掉
public void setWritable(boolean writable) { public void setWritable(boolean writable) {
this.writable = writable; this.writable = writable;
} }
@Override @Override
public String toString() { public String toString() {
return "DepartmentItem [writable=" + writable + ", " return "DepartItem [writable=" + writable + ", " + super.toString()
+ super.toString() + "]"; + "]";
} }
} }
} }

View File

@ -2,6 +2,8 @@ package com.foxinmy.weixin4j.qy.model;
import java.io.Serializable; import java.io.Serializable;
import com.alibaba.fastjson.annotation.JSONField;
/** /**
* 部门对象 * 部门对象
* *
@ -26,62 +28,64 @@ public class Party implements Serializable {
/** /**
* 父亲部门id根部门id为1 * 父亲部门id根部门id为1
*/ */
private int parentid; @JSONField(name = "parentid")
private int parentId;
/** /**
* 在父部门中的次序从1开始数字越大排序越靠后 * 在父部门中的次序从1开始数字越大排序越靠后
*/ */
private int order; private Integer order;
public Party() { public Party() {
} }
public Party(int id, String name) { public Party(String name) {
this(id, name, 0, 0); this.name = name;
} }
public Party(int id, String name, int parentid, int order) { public Party(int id, String name, int parentId) {
this.id = id; this.id = id;
this.name = name; this.name = name;
this.parentid = parentid; this.parentId = parentId;
this.order = order;
} }
public int getId() { public int getId() {
return id; return id;
} }
public void setId(int id) {
this.id = id;
}
public String getName() { public String getName() {
return name; return name;
} }
public int getParentId() {
return parentId;
}
public Integer getOrder() {
return order;
}
// ---------- setter 应该全部去掉
public void setId(int id) {
this.id = id;
}
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
public int getParentid() { public void setParentId(int parentId) {
return parentid; this.parentId = parentId;
} }
public void setParentid(int parentid) { public void setOrder(Integer order) {
this.parentid = parentid;
}
public int getOrder() {
return order;
}
public void setOrder(int order) {
this.order = order; this.order = order;
} }
@Override @Override
public String toString() { public String toString() {
return "Party [id=" + id + ", name=" + name + ", parentid=" + parentid return "Party [id=" + id + ", name=" + name + ", parentId=" + parentId
+ ", order=" + order + "]"; + ", order=" + order + "]";
} }
} }

View File

@ -45,14 +45,16 @@ public class Tag implements Serializable {
return id; return id;
} }
public void setId(int id) {
this.id = id;
}
public String getName() { public String getName() {
return name; return name;
} }
// ---------- setter 应该全部去掉
public void setId(int id) {
this.id = id;
}
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }

View File

@ -1,7 +1,6 @@
package com.foxinmy.weixin4j.qy.model; package com.foxinmy.weixin4j.qy.model;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -25,7 +24,8 @@ public class User implements Serializable {
/** /**
* 必须 员工UserID对应管理端的帐号企业内必须唯一长度为1~64个字符 * 必须 员工UserID对应管理端的帐号企业内必须唯一长度为1~64个字符
*/ */
private String userid; @JSONField(name = "userid")
private String userId;
/** /**
* 必须 成员名称长度为1~64个字符 * 必须 成员名称长度为1~64个字符
*/ */
@ -34,7 +34,7 @@ public class User implements Serializable {
* 非必须 成员所属部门id列表注意每个部门的直属员工上限为1000个 * 非必须 成员所属部门id列表注意每个部门的直属员工上限为1000个
*/ */
@JSONField(name = "department") @JSONField(name = "department")
private List<Integer> partys; private List<Integer> partyIds;
/** /**
* 非必须 职位信息长度为0~64个字符 * 非必须 职位信息长度为0~64个字符
*/ */
@ -46,7 +46,7 @@ public class User implements Serializable {
/** /**
* 非必须 性别gender=0表示男=1表示女默认gender=0 * 非必须 性别gender=0表示男=1表示女默认gender=0
*/ */
private int gender; private Integer gender;
/** /**
* 非必须 办公电话长度为0~64个字符 * 非必须 办公电话长度为0~64个字符
*/ */
@ -58,7 +58,8 @@ public class User implements Serializable {
/** /**
* 非必须 微信号企业内必须唯一 * 非必须 微信号企业内必须唯一
*/ */
private String weixinid; @JSONField(name = "weixinid")
private String weixinId;
/** /**
* 头像url如果要获取小图将url最后的"/0"改成"/64"即可 * 头像url如果要获取小图将url最后的"/0"改成"/64"即可
*/ */
@ -66,7 +67,7 @@ public class User implements Serializable {
/** /**
* 关注状态: 1=已关注2=已冻结4=未关注 * 关注状态: 1=已关注2=已冻结4=未关注
*/ */
private int status; private Integer status;
/** /**
* 启用/禁用成员1表示启用成员0表示禁用成员 * 启用/禁用成员1表示启用成员0表示禁用成员
*/ */
@ -77,148 +78,84 @@ public class User implements Serializable {
private List<NameValue> extattr; private List<NameValue> extattr;
public User() { public User() {
this.extattr = new ArrayList<NameValue>();
} }
public User(String userid, String name) { public User(String userId, String name) {
this(userid, name, null, null, null); this.userId = userId;
}
/**
* mobile/weixinid/email三者不能同时为空
*
* @param userid
* 用户ID
* @param name
* 用户昵称
* @param tel
* 号码
* @param email
* 邮箱
* @param weixinid
* 微信ID
*/
public User(String userid, String name, String tel, String email,
String weixinid) {
this.userid = userid;
this.name = name; this.name = name;
this.tel = tel;
this.email = email;
this.weixinid = weixinid;
this.extattr = new ArrayList<NameValue>();
} }
public String getUserid() { public String getUserId() {
return userid; return userId;
}
public void setUserid(String userid) {
this.userid = userid;
} }
public String getName() { public String getName() {
return name; return name;
} }
public void setName(String name) { public List<Integer> getPartyIds() {
this.name = name; return partyIds;
} }
public List<Integer> getPartys() { public void setPartyIds(Integer... partyIds) {
return partys; this.partyIds = Arrays.asList(partyIds);
}
public void setPartys(List<Integer> partys) {
this.partys = partys;
}
public void setPartys(Integer... partys) {
this.partys = Arrays.asList(partys);
} }
public String getPosition() { public String getPosition() {
return position; return position;
} }
public void setPosition(String position) {
this.position = position;
}
public String getMobile() { public String getMobile() {
return mobile; return mobile;
} }
public void setMobile(String mobile) { public Integer getGender() {
this.mobile = mobile;
}
public int getGender() {
return gender; return gender;
} }
@JSONField(serialize = false) @JSONField(serialize = false)
public Gender getFormatGender() { public Gender getFormatGender() {
if (gender == 0) { if (gender != null) {
return Gender.male; if (gender.intValue() == 0) {
} else if (gender == 1) { return Gender.male;
return Gender.female; } else if (gender.intValue() == 1) {
} else { return Gender.female;
return Gender.unknown; } else {
return Gender.unknown;
}
} }
} return null;
public void setGender(int gender) {
this.gender = gender;
} }
public String getTel() { public String getTel() {
return tel; return tel;
} }
public void setTel(String tel) {
this.tel = tel;
}
public String getEmail() { public String getEmail() {
return email; return email;
} }
public void setEmail(String email) { public String getWeixinId() {
this.email = email; return weixinId;
} }
public String getWeixinid() {
return weixinid;
}
public void setWeixinid(String weixinid) {
this.weixinid = weixinid;
}
@JSONField(serialize = false)
public String getAvatar() { public String getAvatar() {
return avatar; return avatar;
} }
public void setAvatar(String avatar) { @JSONField(serialize = false)
this.avatar = avatar;
}
@JSONField(serialize = false, deserialize = false)
public UserStatus getFormatStatus() { public UserStatus getFormatStatus() {
for (UserStatus userStatus : UserStatus.values()) { if (status != null) {
if (userStatus.getVal() == status) { for (UserStatus userStatus : UserStatus.values()) {
return userStatus; if (userStatus.getVal() == status) {
return userStatus;
}
} }
} }
return null; return null;
} }
public void setStatus(int status) { public Integer getStatus() {
this.status = status;
}
public int getStatus() {
return status; return status;
} }
@ -226,7 +163,11 @@ public class User implements Serializable {
return enable; return enable;
} }
@JSONField(serialize = false, deserialize = false) public void setEnable(boolean enable) {
this.enable = enable ? 1 : 0;
}
@JSONField(serialize = false)
public boolean getFormatEnable() { public boolean getFormatEnable() {
if (enable != null) { if (enable != null) {
return enable.intValue() == 1; return enable.intValue() == 1;
@ -234,10 +175,6 @@ public class User implements Serializable {
return false; return false;
} }
public void setEnable(Integer enable) {
this.enable = enable;
}
public List<NameValue> getExtattr() { public List<NameValue> getExtattr() {
return extattr; return extattr;
} }
@ -251,20 +188,65 @@ public class User implements Serializable {
} }
public void pushExattr(String name, String value) { public void pushExattr(String name, String value) {
pushExattr(new NameValue(name, value)); extattr.add(new NameValue(name, value));
} }
public void pushExattr(NameValue nameValue) { // ---------- setter 应该全部去掉
extattr.add(nameValue);
public void setUserId(String userId) {
this.userId = userId;
}
public void setName(String name) {
this.name = name;
}
public void setPartyIds(List<Integer> partyIds) {
this.partyIds = partyIds;
}
public void setPosition(String position) {
this.position = position;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public void setGender(Integer gender) {
this.gender = gender;
}
public void setTel(String tel) {
this.tel = tel;
}
public void setEmail(String email) {
this.email = email;
}
public void setWeixinId(String weixinId) {
this.weixinId = weixinId;
}
public void setAvatar(String avatar) {
this.avatar = avatar;
}
public void setStatus(Integer status) {
this.status = status;
}
public void setEnable(Integer enable) {
this.enable = enable;
} }
@Override @Override
public String toString() { public String toString() {
return "User [userid=" + userid + ", name=" + name + ", partys=" return "User [userId=" + userId + ", name=" + name + ", partyIds="
+ partys + ", position=" + position + ", mobile=" + mobile + partyIds + ", position=" + position + ", mobile=" + mobile
+ ", gender=" + getFormatGender() + ", tel=" + tel + ", email=" + ", gender=" + gender + ", tel=" + tel + ", email=" + email
+ email + ", weixinid=" + weixinid + ", avatar=" + avatar + ", weixinId=" + weixinId + ", avatar=" + avatar + ", status="
+ ", status=" + getFormatStatus() + ", enable=" + status + ", enable=" + enable + ", extattr=" + extattr + "]";
+ getFormatEnable() + ", extattr=" + extattr + "]";
} }
} }

View File

@ -45,7 +45,7 @@ public class BatchTest extends TokenTest {
@Test @Test
public void replaceparty() throws WeixinException { public void replaceparty() throws WeixinException {
String mediaId = mediaApi.batchUploadParties(Arrays.asList(new Party(5, String mediaId = mediaApi.batchUploadParties(Arrays.asList(new Party(5,
"部门1", 1, 1), new Party(6, "部门2", 1, 1))); "部门1", 1), new Party(6, "部门2", 1)));
String jobId = batchApi.replaceParty(mediaId, new Callback( String jobId = batchApi.replaceParty(mediaId, new Callback(
"http://182.254.188.133:8090", "gp2eGT5mIpngr", "http://182.254.188.133:8090", "gp2eGT5mIpngr",
"BRYfV4zPFUJb3v3MySNBg1ERKE3vyyMRoScu76vFySv")); "BRYfV4zPFUJb3v3MySNBg1ERKE3vyyMRoScu76vFySv"));

View File

@ -30,14 +30,14 @@ public class PartyTest extends TokenTest {
@Test @Test
public void create() throws WeixinException { public void create() throws WeixinException {
Party Party = new Party(1, "苦逼组"); Party Party = new Party(1, "苦逼组", 1);
int id = partyApi.createParty(Party); int id = partyApi.createParty(Party);
Assert.assertTrue(id > 0); Assert.assertTrue(id > 0);
} }
@Test @Test
public void update() throws WeixinException { public void update() throws WeixinException {
Party Party = new Party(2, "苦逼组111"); Party Party = new Party(2, "苦逼组111", 1);
JsonResult result = partyApi.updateParty(Party); JsonResult result = partyApi.updateParty(Party);
Assert.assertEquals("updated", result.getDesc()); Assert.assertEquals("updated", result.getDesc());
} }

View File

@ -35,9 +35,8 @@ public class UserTest extends TokenTest {
@Test @Test
public void create() throws WeixinException { public void create() throws WeixinException {
User user = new User("u001", "jack"); User user = new User("id", "name");
user.setMobile("13500000000"); user.setPartyIds(1);
user.setPartys(1);
user.pushExattr("爱好", "code"); user.pushExattr("爱好", "code");
JsonResult result = userApi.createUser(user); JsonResult result = userApi.createUser(user);
Assert.assertEquals("created", result.getDesc()); Assert.assertEquals("created", result.getDesc());
@ -45,18 +44,16 @@ public class UserTest extends TokenTest {
@Test @Test
public void batchUpload() throws WeixinException { public void batchUpload() throws WeixinException {
User user = new User("u001", "jack"); User user = new User("id", "name");
user.setMobile("13500000000"); user.setPartyIds(1);
user.setPartys(1);
String mediaId = mediaApi.batchUploadUsers(Arrays.asList(user)); String mediaId = mediaApi.batchUploadUsers(Arrays.asList(user));
System.err.println(mediaId); System.err.println(mediaId);
} }
@Test @Test
public void update() throws WeixinException { public void update() throws WeixinException {
User user = new User("u001", "ted"); User user = new User("id", "name");
user.setMobile("13500000000"); user.setPartyIds(1);
user.setPartys(1);
user.pushExattr("爱好", "code"); user.pushExattr("爱好", "code");
JsonResult result = userApi.updateUser(user); JsonResult result = userApi.updateUser(user);
Assert.assertEquals("updated", result.getDesc()); Assert.assertEquals("updated", result.getDesc());