主要去掉了实体类中的字段上@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
+ **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")
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.content = content;
this.type = type;
this.subs = new ArrayList<Button>();
}
public String getName() {
@ -108,9 +110,6 @@ public class Button implements Serializable {
}
public Button pushSub(Button btn) {
if (this.subs == null) {
this.subs = new ArrayList<Button>();
}
this.subs.add(btn);
return this;
}

View File

@ -5,6 +5,7 @@ import java.util.Date;
import java.util.List;
import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.util.TypeUtils;
import com.foxinmy.weixin4j.tuple.MpArticle;
/**
@ -33,7 +34,7 @@ public class MediaItem implements Serializable {
* 媒体素材最后更新时间
*/
@JSONField(name = "update_time")
private Date updateTime;
private String updateTime;
/**
* 图文素材列表
*/
@ -56,11 +57,16 @@ public class MediaItem implements Serializable {
this.name = name;
}
public Date getUpdateTime() {
public String getUpdateTime() {
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;
}

View File

@ -25,42 +25,36 @@ public class JsPayNotify extends PayBaseInfo {
/**
* 用户的openid
*/
@JSONField(name = "OpenId")
@XmlElement(name = "OpenId")
private String openid;
private String openId;
/**
* 是否关注公众号
*/
@JSONField(name = "IsSubscribe")
@XmlElement(name = "IsSubscribe")
private int issubscribe;
private int isSubscribe;
public JsPayNotify() {
}
public String getOpenid() {
return openid;
public String getOpenId() {
return openId;
}
public void setOpenid(String openid) {
this.openid = openid;
public int getIsSubscribe() {
return isSubscribe;
}
public int getIssubscribe() {
return issubscribe;
}
public void setIssubscribe(int issubscribe) {
this.issubscribe = issubscribe;
}
@JSONField(serialize = false, deserialize = false)
public boolean getFormatIssubscribe() {
return issubscribe == 1;
@JSONField(serialize = false)
public boolean getFormatIsSubscribe() {
return isSubscribe == 1;
}
@Override
public String toString() {
return "openid=" + openid + ", issubscribe=" + getFormatIssubscribe()
return "openId=" + openId + ", isSubscribe=" + getFormatIsSubscribe()
+ ", " + 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")
private String authCode;
protected MicroPayPackage(){
protected MicroPayPackage() {
// jaxb required
}
public MicroPayPackage(WeixinPayAccount weixinAccount, String body,
String attach, String outTradeNo, double totalFee,
String spbillCreateIp, String authCode) {
@ -71,21 +73,21 @@ public class MicroPayPackage extends PayPackage {
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,
double totalFee, String spbillCreateIp, Date timeStart,
Date timeExpire, String goodsTag, String authCode) {
super(body, attach, outTradeNo, totalFee, spbillCreateIp, timeStart,
timeExpire, goodsTag, null);
this.appid = appid;
this.appId = appId;
this.mchId = mchId;
this.deviceInfo = deviceInfo;
this.nonceStr = nonceStr;
this.authCode = authCode;
}
public String getAppid() {
return appid;
public String getAppId() {
return appId;
}
public String getMchId() {
@ -118,7 +120,7 @@ public class MicroPayPackage extends PayPackage {
@Override
public String toString() {
return "MicroPayPackage [appid=" + appid + ", mchId=" + mchId
return "MicroPayPackage [appId=" + appId + ", mchId=" + mchId
+ ", deviceInfo=" + deviceInfo + ", nonceStr=" + nonceStr
+ ", sign=" + sign + ", authCode=" + authCode + ", "
+ super.toString() + "]";

View File

@ -28,26 +28,31 @@ public class PayBaseInfo implements Serializable {
/**
* 公众号ID
*/
@JSONField(name = "AppId")
@XmlElement(name = "AppId")
private String appId;
/**
* 时间戳
*/
@JSONField(name = "TimeStamp")
@XmlElement(name = "TimeStamp")
private String timeStamp;
/**
* 随机字符串
*/
@JSONField(name = "NonceStr")
@XmlElement(name = "NonceStr")
private String nonceStr;
/**
* 签名结果
*/
@JSONField(name = "AppSignature")
@XmlElement(name = "AppSignature")
private String paySign;
/**
* 签名方式
*/
@JSONField(name = "SignMethod")
@XmlElement(name = "SignMethod")
private String signType;
@ -87,17 +92,14 @@ public class PayBaseInfo implements Serializable {
return signType;
}
@JSONField(serialize = false, deserialize = false)
@JSONField(serialize = false)
public SignType getFormatSignType() {
return SignType.valueOf(signType.toUpperCase());
return signType != null ? SignType.valueOf(signType.toUpperCase())
: null;
}
public void setSignType(SignType signType) {
if (signType != null) {
this.signType = signType.name();
} else {
this.signType = null;
}
this.signType = signType != null ? signType.name() : null;
}
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.CouponType;
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")
private int isPartialUse;
public CouponDetail(){
public CouponDetail() {
}
public String getCouponStockId() {
return couponStockId;
}
@ -185,7 +184,7 @@ public class CouponDetail extends ApiResult {
return couponStockType;
}
@JSONField(deserialize = false, serialize = false)
@JSONField(serialize = false)
public CouponStockType getFormatCouponStockType() {
for (CouponStockType couponStockType : CouponStockType.values()) {
if (couponStockType.getVal() == this.couponStockType) {
@ -208,7 +207,7 @@ public class CouponDetail extends ApiResult {
*
* @return 元单位
*/
@JSONField(deserialize = false, serialize = false)
@JSONField(serialize = false)
public double getFormatCouponValue() {
return couponValue / 100d;
}
@ -222,7 +221,7 @@ public class CouponDetail extends ApiResult {
*
* @return 元单位
*/
@JSONField(deserialize = false, serialize = false)
@JSONField(serialize = false)
public double getFormatCouponMininum() {
return couponMininum / 100d;
}
@ -235,7 +234,7 @@ public class CouponDetail extends ApiResult {
return couponStatus;
}
@JSONField(deserialize = false, serialize = false)
@JSONField(serialize = false)
public CouponStatus getFormatCouponStatus() {
for (CouponStatus couponStatus : CouponStatus.values()) {
if (couponStatus.getVal() == this.couponStatus) {
@ -272,7 +271,7 @@ public class CouponDetail extends ApiResult {
*
* @return 元单位
*/
@JSONField(deserialize = false, serialize = false)
@JSONField(serialize = false)
public double getFormatCouponUseValue() {
return couponUseValue / 100d;
}
@ -286,7 +285,7 @@ public class CouponDetail extends ApiResult {
*
* @return 元单位
*/
@JSONField(deserialize = false, serialize = false)
@JSONField(serialize = false)
public double getFormatCouponRemainValue() {
return couponRemainValue / 100d;
}
@ -295,37 +294,38 @@ public class CouponDetail extends ApiResult {
return beginTime;
}
@JSONField(deserialize = false, serialize = false)
@JSONField(serialize = false)
public Date getFormatBeginTime() {
return DateUtil.parse2yyyyMMddHHmmss(beginTime);
return beginTime != null ? DateUtil.parse2yyyyMMddHHmmss(beginTime)
: null;
}
public String getEndTime() {
return endTime;
}
@JSONField(deserialize = false, serialize = false)
@JSONField(serialize = false)
public Date getFormatEndTime() {
return DateUtil.parse2yyyyMMddHHmmss(endTime);
return endTime != null ? DateUtil.parse2yyyyMMddHHmmss(endTime) : null;
}
public String getSendTime() {
return sendTime;
}
@JSONField(deserialize = false, serialize = false)
@JSONField(serialize = false)
public Date getFormatSendTime() {
return DateUtil.parse2yyyyMMddHHmmss(sendTime);
return sendTime != null ? DateUtil.parse2yyyyMMddHHmmss(sendTime)
: null;
}
public String getUseTime() {
return useTime;
}
@JSONField(deserialize = false, serialize = false)
@JSONField(serialize = false)
public Date getFormatUseTime() {
return StringUtil.isNotBlank(useTime) ? DateUtil
.parse2yyyyMMddHHmmss(useTime) : null;
return useTime != null ? DateUtil.parse2yyyyMMddHHmmss(useTime) : null;
}
public String getTradeNo() {
@ -352,7 +352,7 @@ public class CouponDetail extends ApiResult {
return isPartialUse;
}
@JSONField(deserialize = false, serialize = false)
@JSONField(serialize = false)
public boolean getFormatIsPartialUse() {
return isPartialUse == 1;
}
@ -374,7 +374,6 @@ public class CouponDetail extends ApiResult {
+ ", consumerMchId=" + consumerMchId + ", consumerMchName="
+ consumerMchName + ", consumerMchAppid=" + consumerMchAppid
+ ", sendSource=" + sendSource + ", isPartialUse="
+ getFormatIsPartialUse() + ", " + super.toString()
+ "]";
+ getFormatIsPartialUse() + ", " + super.toString() + "]";
}
}

View File

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

View File

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

View File

@ -119,10 +119,10 @@ public class CouponStock extends ApiResult {
@JSONField(name = "coupon_budget")
private Integer couponBudget;
public CouponStock(){
public CouponStock() {
}
public String getCouponStockId() {
return couponStockId;
}
@ -140,7 +140,7 @@ public class CouponStock extends ApiResult {
*
* @return 元单位
*/
@JSONField(deserialize = false, serialize = false)
@JSONField(serialize = false)
public double getFormatCouponValue() {
return couponValue / 100d;
}
@ -154,7 +154,7 @@ public class CouponStock extends ApiResult {
*
* @return 元单位
*/
@JSONField(deserialize = false, serialize = false)
@JSONField(serialize = false)
public double getFormatCouponMininumn() {
return couponMininumn != null ? couponMininumn.intValue() / 100d : 0d;
}
@ -163,7 +163,7 @@ public class CouponStock extends ApiResult {
return couponType;
}
@JSONField(deserialize = false, serialize = false)
@JSONField(serialize = false)
public CouponType getFormatCouponType() {
for (CouponType couponType : CouponType.values()) {
if (couponType.getVal() == this.couponType) {
@ -177,7 +177,7 @@ public class CouponStock extends ApiResult {
return couponStockStatus;
}
@JSONField(deserialize = false, serialize = false)
@JSONField(serialize = false)
public CouponStockStatus getFormatCouponStockStatus() {
for (CouponStockStatus couponStockStatus : CouponStockStatus.values()) {
if (couponStockStatus.getVal() == this.couponStockStatus) {
@ -200,7 +200,7 @@ public class CouponStock extends ApiResult {
*
* @return 元单位
*/
@JSONField(deserialize = false, serialize = false)
@JSONField(serialize = false)
public double getFormatMaxQuota() {
return maxQuota != null ? maxQuota.intValue() / 100d : 0d;
}
@ -214,7 +214,7 @@ public class CouponStock extends ApiResult {
*
* @return 元单位
*/
@JSONField(deserialize = false, serialize = false)
@JSONField(serialize = false)
public double getFormatLockedNum() {
return lockedNum != null ? lockedNum.intValue() / 100d : 0d;
}
@ -228,7 +228,7 @@ public class CouponStock extends ApiResult {
*
* @return 元单位
*/
@JSONField(deserialize = false, serialize = false)
@JSONField(serialize = false)
public double getFormatUsedNum() {
return usedNum != null ? usedNum.intValue() / 100d : 0d;
}
@ -242,7 +242,7 @@ public class CouponStock extends ApiResult {
*
* @return 元单位
*/
@JSONField(deserialize = false, serialize = false)
@JSONField(serialize = false)
public double getFormatSendNum() {
return sendNum != null ? sendNum.intValue() / 100d : 0d;
}
@ -251,27 +251,29 @@ public class CouponStock extends ApiResult {
return beginTime;
}
@JSONField(deserialize = false, serialize = false)
@JSONField(serialize = false)
public Date getFormatBeginTime() {
return DateUtil.parse2yyyyMMddHHmmss(beginTime);
return beginTime != null ? DateUtil.parse2yyyyMMddHHmmss(beginTime)
: null;
}
public String getEndTime() {
return endTime;
}
@JSONField(deserialize = false, serialize = false)
@JSONField(serialize = false)
public Date getFormatEndTime() {
return DateUtil.parse2yyyyMMddHHmmss(endTime);
return endTime != null ? DateUtil.parse2yyyyMMddHHmmss(endTime) : null;
}
public String getCreateTime() {
return createTime;
}
@JSONField(deserialize = false, serialize = false)
@JSONField(serialize = false)
public Date getFormatCreateTime() {
return DateUtil.parse2yyyyMMddHHmmss(createTime);
return createTime != null ? DateUtil.parse2yyyyMMddHHmmss(createTime)
: null;
}
public Integer getCouponBudget() {
@ -283,7 +285,7 @@ public class CouponStock extends ApiResult {
*
* @return 元单位
*/
@JSONField(deserialize = false, serialize = false)
@JSONField(serialize = false)
public double getFormatCouponBudget() {
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.foxinmy.weixin4j.http.weixin.XmlResult;
import com.foxinmy.weixin4j.util.StringUtil;
/**
* 调用V3.x接口返回的公用字段
@ -88,7 +87,7 @@ public class ApiResult extends XmlResult {
}
public String getSubMchId() {
return StringUtil.isNotBlank(subMchId) ? subMchId : null;
return subMchId;
}
public void setSubMchId(String subMchId) {
@ -127,7 +126,7 @@ public class ApiResult extends XmlResult {
this.recall = recall;
}
@JSONField(deserialize = false, serialize = false)
@JSONField(serialize = false)
public boolean getFormatRecall() {
return recall != null && recall.equalsIgnoreCase("y");
}

View File

@ -34,7 +34,9 @@ public class MPPayment implements Serializable {
/**
* 接收红包的用户的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 openid 用户的openid
* @param openId 用户的openid
* @param checkNameType 校验用户姓名选项
* @param desc 描述
* @param amount 金额
* @param clientIp 调用接口IP
*/
public MPPayment(String outTradeNo, String openid,
public MPPayment(String outTradeNo, String openId,
MPPaymentCheckNameType checkNameType, String desc, double amount,
String clientIp) {
this.outTradeNo = outTradeNo;
this.openid = openid;
this.openId = openId;
this.checkNameType = checkNameType;
this.desc = desc;
this.amount = DateUtil.formaFee2Fen(amount);
@ -92,8 +94,8 @@ public class MPPayment implements Serializable {
return outTradeNo;
}
public String getOpenid() {
return openid;
public String getOpenId() {
return openId;
}
public MPPaymentCheckNameType getCheckNameType() {
@ -122,7 +124,7 @@ public class MPPayment implements Serializable {
@Override
public String toString() {
return "MPPayment [outTradeNo=" + outTradeNo + ", openid=" + openid
return "MPPayment [outTradeNo=" + outTradeNo + ", openId=" + openId
+ ", checkNameType=" + checkNameType + ", userName=" + userName
+ ", desc=" + desc + ", amount=" + amount + ", clientIp="
+ clientIp + "]";

View File

@ -53,8 +53,9 @@ public class MPPaymentRecord extends ApiResult {
/**
* 收款用户openid
*/
@JSONField(name = "openid")
@XmlElement(name = "openid")
private String openid;
private String openId;
/**
* 收款用户姓名
*/
@ -80,7 +81,7 @@ public class MPPaymentRecord extends ApiResult {
*/
@XmlElement(name = "check_name")
@JSONField(name = "check_name")
private MPPaymentCheckNameType checkNameType;
private String checkNameType;
/**
* 企业付款描述信息
*/
@ -123,8 +124,8 @@ public class MPPaymentRecord extends ApiResult {
return failureReason;
}
public String getOpenid() {
return openid;
public String getOpenId() {
return openId;
}
public String getTransferName() {
@ -156,13 +157,20 @@ public class MPPaymentRecord extends ApiResult {
*/
@JSONField(serialize = false)
public Date getFormatTransferTime() {
return DateUtil.parse2yyyyMMddHHmmss(transferTime);
return transferTime != null ? DateUtil
.parse2yyyyMMddHHmmss(transferTime) : null;
}
public MPPaymentCheckNameType getCheckNameType() {
public String getCheckNameType() {
return checkNameType;
}
@JSONField(serialize = false)
public MPPaymentCheckNameType getFormatCheckNameType() {
return checkNameType != null ? MPPaymentCheckNameType
.valueOf(checkNameType) : null;
}
public String getDesc() {
return desc;
}
@ -186,7 +194,7 @@ public class MPPaymentRecord extends ApiResult {
return "MPPaymentRecord [transactionId=" + transactionId
+ ", outTradeNo=" + outTradeNo + ", transactionStatus="
+ getFormatTransactionStatus() + ", failureReason="
+ failureReason + ", openid=" + openid + ", transferName="
+ failureReason + ", openId=" + openId + ", transferName="
+ transferName + ", paymentAmount=" + getFormatPaymentAmount()
+ ", transferTime=" + transferTime + ", checkNameType="
+ 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 ,此参数必传
*/
private String openid;
@XmlElement(name = "openid")
@JSONField(name = "openid")
private String openId;
/**
* 只在 trade_type NATIVE 时需要填写 非必须
*/
@ -91,24 +95,24 @@ public class MchPayPackage extends PayPackage {
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,
double totalFee, String spbillCreateIp, Date timeStart,
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,
timeExpire, goodsTag, notifyUrl);
this.appid = appid;
this.appId = appId;
this.mchId = mchId;
this.deviceInfo = deviceInfo;
this.nonceStr = nonceStr;
this.tradeType = tradeType.name();
this.openid = openid;
this.openId = openId;
this.productId = productId;
}
public String getAppid() {
return appid;
public String getAppId() {
return appId;
}
public String getMchId() {
@ -135,8 +139,8 @@ public class MchPayPackage extends PayPackage {
return tradeType;
}
public String getOpenid() {
return openid;
public String getOpenId() {
return openId;
}
public String getProductId() {
@ -149,10 +153,10 @@ public class MchPayPackage extends PayPackage {
@Override
public String toString() {
return "MchPayPackage [appid=" + appid + ", mchId=" + mchId
return "MchPayPackage [appId=" + appId + ", mchId=" + mchId
+ ", deviceInfo=" + deviceInfo + ", nonceStr=" + nonceStr
+ ", sign=" + sign + ", tradeType=" + tradeType + ", openid="
+ openid + ", productId=" + productId + ", " + super.toString()
+ ", sign=" + sign + ", tradeType=" + tradeType + ", openId="
+ openId + ", productId=" + productId + ", " + super.toString()
+ "]";
}
}

View File

@ -30,7 +30,8 @@ public class NativePayResponse extends ApiResult {
@JSONField(serialize = false)
private PrePay prePay;
private String prepay_id;
@JSONField(name = "prepay_id")
private String prepayId;
protected NativePayResponse() {
// jaxb required
@ -64,24 +65,24 @@ public class NativePayResponse extends ApiResult {
super.setReturnCode(Consts.SUCCESS);
this.setResultCode(Consts.SUCCESS);
this.setMchId(payPackage.getMchId());
this.setAppId(payPackage.getAppid());
this.setAppId(payPackage.getAppId());
this.setNonceStr(RandomUtil.generateString(16));
this.prePay = PayUtil.createPrePay(payPackage, paysignKey);
this.prepay_id = prePay.getPrepayId();
this.prepayId = prePay.getPrepayId();
}
public String getPrepay_id() {
return prepay_id;
public String getPrepayId() {
return prepayId;
}
public void setPrepay_id(String prepay_id) {
this.prepay_id = prepay_id;
public void setPrepayId(String prepayId) {
this.prepayId = prepayId;
}
@Override
public String toString() {
return "NativePayResponseV3 [prePay=" + prePay + ", prepay_id="
+ prepay_id + ", " + super.toString() + "]";
return "NativePayResponseV3 [prePay=" + prePay + ", prepayId="
+ 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.TradeType;
import com.foxinmy.weixin4j.util.DateUtil;
import com.foxinmy.weixin4j.util.StringUtil;
import com.foxinmy.weixin4j.xml.ListsuffixResult;
/**
@ -38,7 +37,7 @@ public class Order extends ApiResult {
*/
@XmlElement(name = "trade_state")
@JSONField(name = "trade_state")
private TradeState tradeState;
private String tradeState;
/**
* 用户的openid
*/
@ -58,7 +57,7 @@ public class Order extends ApiResult {
*/
@XmlElement(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")
@JSONField(name = "fee_type")
private CurrencyType feeType;
private String feeType;
/**
* 微信支付订单号
*/
@ -135,8 +134,9 @@ public class Order extends ApiResult {
// jaxb required
}
public TradeState getTradeState() {
return tradeState;
@JSONField(serialize = false)
public TradeState getFormatTradeState() {
return tradeState != null ? TradeState.valueOf(tradeState.toUpperCase()) : null;
}
public String getOpenId() {
@ -147,13 +147,14 @@ public class Order extends ApiResult {
return isSubscribe;
}
@JSONField(serialize = false, deserialize = false)
@JSONField(serialize = false)
public boolean getFormatIsSubscribe() {
return isSubscribe != null && isSubscribe.equalsIgnoreCase("y");
}
public TradeType getTradeType() {
return tradeType;
@JSONField(serialize = false)
public TradeType getFormatTradeType() {
return tradeType != null ? TradeType.valueOf(tradeType.toUpperCase()) : null;
}
public String getBankType() {
@ -169,7 +170,7 @@ public class Order extends ApiResult {
*
* @return 元单位
*/
@JSONField(serialize = false, deserialize = false)
@JSONField(serialize = false)
public double getFormatTotalFee() {
return totalFee / 100d;
}
@ -183,7 +184,7 @@ public class Order extends ApiResult {
*
* @return 元单位
*/
@JSONField(serialize = false, deserialize = false)
@JSONField(serialize = false)
public double getFormatCouponFee() {
return couponFee != null ? couponFee / 100d : 0d;
}
@ -192,11 +193,6 @@ public class Order extends ApiResult {
return couponCount;
}
@JSONField(serialize = false, deserialize = false)
public int getFormatCouponCount() {
return couponCount != null ? couponCount.intValue() : 0;
}
public int getCashFee() {
return cashFee;
}
@ -206,12 +202,25 @@ public class Order extends ApiResult {
*
* @return 元单位
*/
@JSONField(serialize = false, deserialize = false)
@JSONField(serialize = false)
public double getFormatCashFee() {
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;
}
@ -231,12 +240,9 @@ public class Order extends ApiResult {
return timeEnd;
}
@JSONField(serialize = false, deserialize = false)
@JSONField(serialize = false)
public Date getFormatTimeEnd() {
if (StringUtil.isNotBlank(timeEnd)) {
return DateUtil.parse2yyyyMMddHHmmss(timeEnd);
}
return null;
return timeEnd != null ? DateUtil.parse2yyyyMMddHHmmss(timeEnd) : null;
}
public String getTradeStateDesc() {
@ -259,10 +265,10 @@ public class Order extends ApiResult {
+ ", transactionId=" + transactionId + ", outTradeNo="
+ outTradeNo + ", attach=" + attach + ", timeEnd=" + timeEnd
+ ", totalFee=" + getFormatTotalFee() + ", couponFee="
+ getFormatCouponFee() + ", couponCount="
+ getFormatCouponCount() + ", couponList=" + couponList
+ ", cashFee=" + getFormatCashFee() + ", timeEnd="
+ getFormatTimeEnd() + ", tradeStateDesc=" + tradeStateDesc
+ ", " + super.toString() + "]";
+ getFormatCouponFee() + ", couponCount=" + couponCount
+ ", couponList=" + couponList + ", cashFee="
+ getFormatCashFee() + ", timeEnd=" + getFormatTimeEnd()
+ ", tradeStateDesc=" + tradeStateDesc + ", "
+ 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.RedpacketType;
import com.foxinmy.weixin4j.util.DateUtil;
import com.foxinmy.weixin4j.util.StringUtil;
/**
* 红包记录
@ -56,19 +55,19 @@ public class RedpacketRecord extends XmlResult {
* 红包状态
*/
@XmlElement(name = "status")
private RedpacketStatus status;
private String status;
/**
* 发放类型
*/
@XmlElement(name = "send_type")
@JSONField(name = "send_type")
private RedpacketSendType sendType;
private String sendType;
/**
* 红包类型
*/
@XmlElement(name = "hb_type")
@JSONField(name = "hb_type")
private RedpacketType type;
private String hbType;
/**
* 红包个数
*/
@ -140,16 +139,32 @@ public class RedpacketRecord extends XmlResult {
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;
}
public RedpacketSendType getSendType() {
public String getSendType() {
return sendType;
}
public RedpacketType getType() {
return type;
public String getHbType() {
return hbType;
}
public int getTotalNum() {
@ -165,7 +180,7 @@ public class RedpacketRecord extends XmlResult {
*
* @return 元单位
*/
@JSONField(serialize = false, deserialize = false)
@JSONField(serialize = false)
public double getFormatTotalAmount() {
return totalAmount / 100d;
}
@ -178,21 +193,20 @@ public class RedpacketRecord extends XmlResult {
return sendTime;
}
@JSONField(serialize = false, deserialize = false)
@JSONField(serialize = false)
public Date getFormatSendTime() {
return DateUtil.parse2yyyyMMddHHmmss(sendTime);
return sendTime != null ? DateUtil.parse2yyyyMMddHHmmss(sendTime)
: null;
}
public String getRefundTime() {
return refundTime;
}
@JSONField(serialize = false, deserialize = false)
@JSONField(serialize = false)
public Date getFormatRefundTime() {
if (StringUtil.isNotBlank(refundTime)) {
return DateUtil.parse2yyyyMMddHHmmss(refundTime);
}
return null;
return refundTime != null ? DateUtil.parse2yyyyMMddHHmmss(refundTime)
: null;
}
public Integer getRefundAmount() {
@ -204,12 +218,9 @@ public class RedpacketRecord extends XmlResult {
*
* @return 元单位
*/
@JSONField(serialize = false, deserialize = false)
@JSONField(serialize = false)
public double getFormatRefundAmount() {
if (refundAmount != null) {
return refundAmount.intValue() / 100d;
}
return 0d;
return refundAmount != null ? refundAmount.intValue() / 100d : 0d;
}
public String getWishing() {
@ -231,9 +242,9 @@ public class RedpacketRecord extends XmlResult {
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public static class RedpacketReceiver implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 领取红包的Openid
*/
@ -276,14 +287,15 @@ public class RedpacketRecord extends XmlResult {
*
* @return 元单位
*/
@JSONField(serialize = false, deserialize = false)
@JSONField(serialize = false)
public double getFormatAmount() {
return amount / 100d;
}
@JSONField(serialize = false, deserialize = false)
@JSONField(serialize = false)
public Date getFormatReceiveTime() {
return DateUtil.parse2yyyyMMddHHmmss(receiveTime);
return receiveTime != null ? DateUtil
.parse2yyyyMMddHHmmss(receiveTime) : null;
}
@Override
@ -298,10 +310,10 @@ public class RedpacketRecord extends XmlResult {
public String toString() {
return "RedpacketRecord [outTradeNo=" + outTradeNo + ", mchId=" + mchId
+ ", repacketId=" + repacketId + ", status=" + status
+ ", sendType=" + sendType + ", type=" + type + ", totalNum="
+ totalNum + ", totalAmount=" + getFormatTotalAmount()
+ ", reason=" + reason + ", sendTime=" + sendTime
+ ", refundTime=" + refundTime + ", refundAmount="
+ ", sendType=" + sendType + ", hbType=" + hbType
+ ", totalNum=" + totalNum + ", totalAmount="
+ getFormatTotalAmount() + ", reason=" + reason + ", sendTime="
+ sendTime + ", refundTime=" + refundTime + ", refundAmount="
+ getFormatRefundAmount() + ", wishing=" + wishing
+ ", remark=" + remark + ", actName=" + actName
+ ", receivers=" + receivers + "]";

View File

@ -27,7 +27,7 @@ public class RedpacketSendResult extends XmlResult {
*/
@XmlElement(name = "wxappid")
@JSONField(name = "wxappid")
private String appid;
private String appId;
/**
* 微信支付分配的商户号
*/
@ -45,7 +45,7 @@ public class RedpacketSendResult extends XmlResult {
*/
@XmlElement(name = "re_openid")
@JSONField(name = "re_openid")
private String openid;
private String openId;
/**
* 付款金额 单位为分
*/
@ -56,9 +56,9 @@ public class RedpacketSendResult extends XmlResult {
protected RedpacketSendResult() {
// jaxb required
}
public String getAppid() {
return appid;
public String getAppId() {
return appId;
}
public String getMchId() {
@ -69,8 +69,8 @@ public class RedpacketSendResult extends XmlResult {
return outTradeNo;
}
public String getOpenid() {
return openid;
public String getOpenId() {
return openId;
}
public int getTotalAmount() {
@ -82,15 +82,15 @@ public class RedpacketSendResult extends XmlResult {
*
* @return 元单位
*/
@JSONField(serialize = false, deserialize = false)
@JSONField(serialize = false)
public double getFormatTotalAmount() {
return totalAmount / 100d;
}
@Override
public String toString() {
return "RedpacketSendResult [appid=" + appid + ", mchId=" + mchId
+ ", outTradeNo=" + outTradeNo + ", openid=" + openid
return "RedpacketSendResult [appId=" + appId + ", mchId=" + mchId
+ ", outTradeNo=" + outTradeNo + ", openId=" + openId
+ ", 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.RefundChannel;
import com.foxinmy.weixin4j.type.RefundStatus;
import com.foxinmy.weixin4j.util.StringUtil;
import com.foxinmy.weixin4j.xml.ListsuffixResult;
/**
@ -61,7 +60,7 @@ public class RefundDetail extends ApiResult {
*/
@XmlElement(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")
@JSONField(name = "fee_type")
private CurrencyType feeType;
private String feeType;
/**
* 现金支付金额
*/
@ -89,7 +88,7 @@ public class RefundDetail extends ApiResult {
*/
@XmlElement(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")
@JSONField(name = "cash_refund_fee_type")
private CurrencyType cashRefundFeeType;
private String cashRefundFeeType;
/**
* 退款状态
*/
@ -148,28 +147,32 @@ public class RefundDetail extends ApiResult {
return refundChannel;
}
@JSONField(deserialize = false, serialize = false)
@JSONField(serialize = false)
public RefundChannel getFormatRefundChannel() {
if (StringUtil.isNotBlank(refundChannel)) {
return RefundChannel.valueOf(refundChannel.toUpperCase());
}
return null;
return refundChannel != null ? RefundChannel.valueOf(refundChannel
.toUpperCase()) : null;
}
public int getRefundFee() {
return refundFee;
}
public CurrencyType getFeeType() {
public String getFeeType() {
return feeType;
}
@JSONField(serialize = false)
public CurrencyType getFormatFeeType() {
return feeType != null ? CurrencyType.valueOf(feeType.toUpperCase())
: null;
}
/**
* <font color="red">调用接口获取单位为分,get方法转换为元方便使用</font>
*
* @return 元单位
*/
@JSONField(deserialize = false, serialize = false)
@JSONField(serialize = false)
public double getFormatRefundFee() {
return refundFee / 100d;
}
@ -178,12 +181,10 @@ public class RefundDetail extends ApiResult {
return refundStatus;
}
@JSONField(deserialize = false, serialize = false)
@JSONField(serialize = false)
public RefundStatus getFormatRefundStatus() {
if (StringUtil.isNotBlank(refundStatus)) {
return RefundStatus.valueOf(refundStatus);
}
return null;
return refundStatus != null ? RefundStatus.valueOf(refundStatus
.toUpperCase()) : null;
}
public Integer getCouponRefundFee() {
@ -195,15 +196,21 @@ public class RefundDetail extends ApiResult {
*
* @return 元单位
*/
@JSONField(deserialize = false, serialize = false)
@JSONField(serialize = false)
public double getFormatCouponRefundFee() {
return couponRefundFee != null ? couponRefundFee.intValue() / 100d : 0d;
}
public CurrencyType getRefundFeeType() {
public String getRefundFeeType() {
return refundFeeType;
}
@JSONField(serialize = false)
public CurrencyType getFormatRefundFeeType() {
return refundFeeType != null ? CurrencyType.valueOf(refundFeeType
.toUpperCase()) : null;
}
public int getTotalFee() {
return totalFee;
}
@ -213,7 +220,7 @@ public class RefundDetail extends ApiResult {
*
* @return 元单位
*/
@JSONField(deserialize = false, serialize = false)
@JSONField(serialize = false)
public double getFormatTotalFee() {
return totalFee / 100d;
}
@ -227,15 +234,21 @@ public class RefundDetail extends ApiResult {
*
* @return 元单位
*/
@JSONField(deserialize = false, serialize = false)
@JSONField(serialize = false)
public double getFormatCashFee() {
return cashFee / 100d;
}
public CurrencyType getCashFeeType() {
public String getCashFeeType() {
return cashFeeType;
}
@JSONField(serialize = false)
public CurrencyType getFormatCashFeeType() {
return cashFeeType != null ? CurrencyType.valueOf(cashFeeType
.toUpperCase()) : null;
}
public Integer getCashRefundFee() {
return cashRefundFee;
}
@ -245,24 +258,25 @@ public class RefundDetail extends ApiResult {
*
* @return 元单位
*/
@JSONField(deserialize = false, serialize = false)
@JSONField(serialize = false)
public double getFormatCashRefundFee() {
return cashRefundFee != null ? cashRefundFee.intValue() / 100d : 0d;
}
public CurrencyType getCashRefundFeeType() {
public String getCashRefundFeeType() {
return cashRefundFeeType;
}
@JSONField(serialize = false)
public CurrencyType getFormatCashRefundFeeType() {
return cashRefundFeeType != null ? CurrencyType
.valueOf(cashRefundFeeType.toUpperCase()) : null;
}
public Integer getCouponRefundCount() {
return couponRefundCount;
}
@JSONField(deserialize = false, serialize = false)
public int getFormatCouponRefundCount() {
return couponRefundCount != null ? couponRefundCount.intValue() : 0;
}
public List<CouponInfo> getCouponList() {
return couponList;
}
@ -282,7 +296,7 @@ public class RefundDetail extends ApiResult {
+ getFormatCashRefundFee() + ", cashRefundFeeType="
+ cashRefundFeeType + ", refundStatus=" + refundStatus
+ ", couponRefundFee=" + getFormatCouponRefundFee()
+ ", couponCount=" + getCouponRefundCount() + ", couponList="
+ ", couponRefundCount=" + couponRefundCount + ", couponList="
+ couponList + ", " + super.toString() + "]";
}
}

View File

@ -50,7 +50,7 @@ public class RefundRecord extends ApiResult {
*/
@XmlElement(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")
@JSONField(name = "cash_fee_type")
private CurrencyType cashFeeType;
private String cashFeeType;
/**
* 退款总金额
*/
@ -108,7 +108,7 @@ public class RefundRecord extends ApiResult {
*
* @return 元单位
*/
@JSONField(serialize = false, deserialize = false)
@JSONField(serialize = false)
public double getFormatCashFee() {
return cashFee / 100d;
}
@ -117,20 +117,32 @@ public class RefundRecord extends ApiResult {
return cashFee;
}
public CurrencyType getFeeType() {
public String getFeeType() {
return feeType;
}
public CurrencyType getCashFeeType() {
public String getCashFeeType() {
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>
*
* @return 元单位
*/
@JSONField(serialize = false, deserialize = false)
@JSONField(serialize = false)
public double getFormatCouponRefundFee() {
return couponRefundFee != null ? couponRefundFee.intValue() / 100d : 0d;
}
@ -144,7 +156,7 @@ public class RefundRecord extends ApiResult {
*
* @return 元单位
*/
@JSONField(serialize = false, deserialize = false)
@JSONField(serialize = false)
public double getFormatTotalFee() {
return totalFee / 100d;
}
@ -174,7 +186,7 @@ public class RefundRecord extends ApiResult {
*
* @return 元单位
*/
@JSONField(serialize = false, deserialize = false)
@JSONField(serialize = false)
public double getFormatRefundFee() {
return refundFee / 100d;
}

View File

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

View File

@ -30,7 +30,8 @@ public class ArticleSummary extends ArticleDatacube1 {
* 例如12003_3 其中12003是msgid即一次群发的消息的id
* 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;
}
public String getMsgid() {
return msgid;
public String getMsgId() {
return msgId;
}
public void setMsgid(String msgid) {
this.msgid = msgid;
public void setMsgId(String msgId) {
this.msgId = msgId;
}
public String getTitle() {
@ -71,7 +72,7 @@ public class ArticleSummary extends ArticleDatacube1 {
@Override
public String toString() {
return "ArticleSummary [refDate=" + refDate + ", refHour=" + refHour
+ ", msgid=" + msgid + ", title=" + title + ", "
+ ", msgId=" + msgId + ", title=" + title + ", "
+ super.toString() + "]";
}
}

View File

@ -27,7 +27,8 @@ public class ArticleTotal implements Serializable {
* 这里的msgid实际上是由msgid图文消息id和index消息次序索引组成 例如12003_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;
}
public String getMsgid() {
return msgid;
public String getMsgId() {
return msgId;
}
public void setMsgid(String msgid) {
this.msgid = msgid;
public void setMsgId(String msgId) {
this.msgId = msgId;
}
public String getTitle() {
@ -71,7 +72,7 @@ public class ArticleTotal implements Serializable {
@Override
public String toString() {
return "ArticleTotal [refDate=" + refDate + ", msgid=" + msgid
return "ArticleTotal [refDate=" + refDate + ", msgId=" + msgId
+ ", title=" + title + ", details=" + details + "]";
}
}

View File

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

View File

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

View File

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

View File

@ -4,6 +4,9 @@ import java.io.Serializable;
import java.util.HashMap;
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
*/
private String touser;
@JSONField(name = "touser")
private String toUser;
/**
* 模板ID
*/
private String template_id;
@JSONField(name = "template_id")
private String templateId;
/**
* 点击消息跳转的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;
public void pushData(String key, String value) {
this.data.put(key, new Item(value));
}
public TemplateMessage(String touser, String template_id, String title,
String url) {
this.touser = touser;
this.template_id = template_id;
@JSONCreator
public TemplateMessage(@JSONField(name = "toUser") String toUser,
@JSONField(name = "templateId") String templateId,
@JSONField(name = "title") String title,
@JSONField(name = "url") String url) {
this.toUser = toUser;
this.templateId = templateId;
this.url = url;
this.topColor = "#FF0000";
this.data = new HashMap<String, Item>();
pushData("first", title);
}
@ -95,36 +101,24 @@ public class TemplateMessage implements Serializable {
}
}
public String getTouser() {
return touser;
public String getToUser() {
return toUser;
}
public void setTouser(String touser) {
this.touser = touser;
}
public String getTemplate_id() {
return template_id;
}
public void setTemplate_id(String template_id) {
this.template_id = template_id;
public String getTemplateId() {
return templateId;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
public String getTopColor() {
return topColor;
}
public String getTopcolor() {
return topcolor;
}
public void setTopcolor(String topcolor) {
this.topcolor = topcolor;
public void setTopColor(String topColor) {
this.topColor = topColor;
}
public Map<String, Item> getData() {
@ -135,10 +129,14 @@ public class TemplateMessage implements Serializable {
this.data = data;
}
public void pushData(String key, String value) {
this.data.put(key, new Item(value));
}
@Override
public String toString() {
return "TemplateMessage [touser=" + touser + ", template_id="
+ template_id + ", url=" + url + ", topcolor=" + topcolor
return "TemplateMessage [toUser=" + toUser + ", templateId="
+ templateId + ", url=" + url + ", topColor=" + topColor
+ ", data=" + data + "]";
}
}

View File

@ -3,6 +3,7 @@ package com.foxinmy.weixin4j.mp.model;
import java.io.Serializable;
import java.util.Date;
import com.alibaba.fastjson.annotation.JSONField;
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会话状态
*/
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;
}
public String getOpenid() {
return openid;
public String getOpenId() {
return openId;
}
public void setOpenid(String openid) {
this.openid = openid;
public void setOpenId(String openId) {
this.openId = openId;
}
public CustomRecordOperCode getOpercode() {
return opercode;
public int getOperCode() {
return operCode;
}
public void setOpercode(int opercode) {
this.opercode = CustomRecordOperCode.getOper(opercode);
@JSONField(serialize = false)
public CustomRecordOperCode getFormatOperCode() {
return CustomRecordOperCode.getOper(operCode);
}
public Date getTime() {
return (Date) time.clone();
public void setOperCode(int operCode) {
this.operCode = operCode;
}
public long getTime() {
return time;
}
@JSONField(serialize = false)
public Date getFormatTime() {
return new Date(time * 1000l);
}
public void setTime(long time) {
this.time = new Date(time * 1000l);
this.time = time;
}
public String getText() {
@ -82,8 +95,8 @@ public class CustomRecord implements Serializable {
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("[CustomRecord worker=").append(worker);
sb.append(" ,openid=").append(openid);
sb.append(" ,opercode=").append(opercode);
sb.append(" ,openId=").append(openId);
sb.append(" ,operCode=").append(operCode);
sb.append(" ,time=").append(time);
sb.append(" ,text=").append(text);
sb.append("]");

View File

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

View File

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

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时是未知
*/
@JSONField(name = "sex")
private Gender gender;
private int gender;
/**
* 用户个人资料填写的省份
*/
@ -65,46 +67,52 @@ public class User implements Serializable {
* 关注时间
*/
@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() {
return openid;
public String getOpenId() {
return openId;
}
public void setOpenid(String openid) {
this.openid = openid;
public void setOpenid(String openId) {
this.openId = openId;
}
public String getNickname() {
return nickname;
public String getNickName() {
return nickName;
}
public void setNickname(String nickname) {
this.nickname = nickname;
public void setNickName(String nickName) {
this.nickName = nickName;
}
public Gender getGender() {
public int getGender() {
return gender;
}
public void setGender(int sex) {
if (sex == 1) {
this.gender = Gender.male;
} else if (sex == 2) {
this.gender = Gender.female;
@JSONField(serialize = false)
public Gender getFormatGender() {
if (gender == 1) {
return Gender.male;
} else if (gender == 2) {
return Gender.female;
} else {
this.gender = Gender.unknown;
return Gender.unknown;
}
}
public void setGender(int gender) {
this.gender = gender;
}
public String getProvince() {
return province;
}
@ -154,11 +162,16 @@ public class User implements Serializable {
this.privilege = privilege;
}
public Lang getLanguage() {
public String getLanguage() {
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;
}
@ -170,20 +183,25 @@ public class User implements Serializable {
this.isSubscribe = isSubscribe;
}
public Date getSubscribeTime() {
return (Date) subscribeTime.clone();
public long getSubscribeTime() {
return subscribeTime;
}
@JSONField(serialize = false)
public Date getFormatSubscribeTime() {
return new Date(subscribeTime * 1000l);
}
public void setSubscribeTime(long subscribeTime) {
this.subscribeTime = new Date(subscribeTime * 1000l);
this.subscribeTime = subscribeTime;
}
public String getUnionid() {
return unionid;
public String getUnionId() {
return unionId;
}
public void setUnionid(String unionid) {
this.unionid = unionid;
public void setUnionId(String unionId) {
this.unionId = unionId;
}
@Override
@ -194,26 +212,18 @@ public class User implements Serializable {
@Override
public boolean equals(Object obj) {
if (obj instanceof User) {
return openid.equals(((User) obj).getOpenid());
return openId.equals(((User) obj).getOpenId());
}
return false;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("[User openid=").append(openid);
sb.append(", nickname=").append(nickname);
sb.append(", gender=").append(gender);
sb.append(", province=").append(province);
sb.append(", city=").append(city);
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();
return "User [openId=" + openId + ", nickName=" + nickName
+ ", gender=" + gender + ", province=" + province + ", city="
+ city + ", country=" + country + ", headimgurl=" + headimgurl
+ ", privilege=" + privilege + ", isSubscribe=" + isSubscribe
+ ", subscribeTime=" + subscribeTime + ", language=" + language
+ ", unionId=" + unionId + "]";
}
}

View File

@ -61,7 +61,7 @@ public class ApiResultV2 implements Serializable {
*/
@JSONField(name = "sign_type")
@XmlElement(name = "sign_type")
private SignType signType;
private String signType;
protected ApiResultV2() {
// jaxb required
@ -107,11 +107,16 @@ public class ApiResultV2 implements Serializable {
this.sign = sign;
}
public SignType getSignType() {
public String getSignType() {
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;
}

View File

@ -5,6 +5,7 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.alibaba.fastjson.annotation.JSONField;
import com.foxinmy.weixin4j.payment.JsPayNotify;
/**
@ -21,17 +22,18 @@ import com.foxinmy.weixin4j.payment.JsPayNotify;
public class NativePayNotifyV2 extends JsPayNotify {
private static final long serialVersionUID = 1868431159301749988L;
/**
* 产品ID 可视为订单ID
*/
@JSONField(name = "ProductId")
@XmlElement(name = "ProductId")
private String productId;
private NativePayNotifyV2(){
private NativePayNotifyV2() {
// jaxb required
}
public String getProductId() {
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.XmlRootElement;
import com.alibaba.fastjson.annotation.JSONField;
import com.foxinmy.weixin4j.model.WeixinPayAccount;
/**
@ -24,18 +25,20 @@ public class NativePayResponseV2 extends JsPayRequestV2 {
/**
* 返回码
*/
@JSONField(name = "RetCode")
@XmlElement(name = "RetCode")
private String retCode;
/**
* 返回消息
*/
@JSONField(name = "RetErrMsg")
@XmlElement(name = "RetErrMsg")
private String retMsg;
protected NativePayResponseV2(){
protected NativePayResponseV2() {
// jaxb required
}
public NativePayResponseV2(WeixinPayAccount weixinAccount,
PayPackageV2 payPackage) {
super(weixinAccount, payPackage);

View File

@ -103,12 +103,9 @@ public class OrderV2 extends ApiResultV2 {
return tradeState;
}
@JSONField(serialize = false, deserialize = false)
@JSONField(serialize = false)
public TradeState getFormatTradeState() {
if (tradeState == 0) {
return TradeState.SUCCESS;
}
return null;
return tradeState == 0 ? TradeState.SUCCESS : null;
}
public void setTradeState(int tradeState) {
@ -148,7 +145,7 @@ public class OrderV2 extends ApiResultV2 {
*
* @return 元单位
*/
@JSONField(serialize = false, deserialize = false)
@JSONField(serialize = false)
public double getFormatTotalFee() {
return totalFee / 100d;
}
@ -161,12 +158,9 @@ public class OrderV2 extends ApiResultV2 {
return feeType;
}
@JSONField(serialize = false, deserialize = false)
@JSONField(serialize = false)
public CurrencyType getFormatFeeType() {
if (feeType == 1) {
return CurrencyType.CNY;
}
return null;
return feeType == 1 ? CurrencyType.CNY : null;
}
public void setFeeType(int feeType) {
@ -217,9 +211,9 @@ public class OrderV2 extends ApiResultV2 {
return timeEnd;
}
@JSONField(serialize = false, deserialize = false)
@JSONField(serialize = false)
public Date getFormatTimeEnd() {
return DateUtil.parse2yyyyMMddHHmmss(timeEnd);
return timeEnd != null ? DateUtil.parse2yyyyMMddHHmmss(timeEnd) : null;
}
public void setTimeEnd(String timeEnd) {
@ -235,7 +229,7 @@ public class OrderV2 extends ApiResultV2 {
*
* @return 元单位
*/
@JSONField(serialize = false, deserialize = false)
@JSONField(serialize = false)
public double getFormatTransportFee() {
return transportFee / 100d;
}
@ -253,7 +247,7 @@ public class OrderV2 extends ApiResultV2 {
*
* @return 元单位
*/
@JSONField(serialize = false, deserialize = false)
@JSONField(serialize = false)
public double getFormatProductFee() {
return productFee / 100d;
}
@ -271,7 +265,7 @@ public class OrderV2 extends ApiResultV2 {
*
* @return 元单位
*/
@JSONField(serialize = false, deserialize = false)
@JSONField(serialize = false)
public double getFormatDiscount() {
return discount / 100d;
}
@ -289,9 +283,9 @@ public class OrderV2 extends ApiResultV2 {
*
* @return 元单位
*/
@JSONField(serialize = false, deserialize = false)
@JSONField(serialize = false)
public double getFormatRmbTotalFee() {
return rmbTotalFee != null ? rmbTotalFee / 100d : 0d;
return rmbTotalFee != null ? rmbTotalFee.doubleValue() / 100d : 0d;
}
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.XmlRootElement;
import com.alibaba.fastjson.annotation.JSONField;
import com.foxinmy.weixin4j.payment.PayBaseInfo;
/**
@ -25,41 +26,49 @@ public class PayFeedback extends PayBaseInfo {
/**
* 投诉单号
*/
@JSONField(name = "FeedBackId")
@XmlElement(name = "FeedBackId")
private String feedbackId;
/**
* 用户ID
*/
@JSONField(name = "OpenId")
@XmlElement(name = "OpenId")
private String openId;
/**
* 订单交易单号
*/
@JSONField(name = "TransId")
@XmlElement(name = "TransId")
private String transId;
/**
* 投诉原因
*/
@JSONField(name = "Reason")
@XmlElement(name = "Reason")
private String reason;
/**
* 用户希望解决方案
*/
@JSONField(name = "Solution")
@XmlElement(name = "Solution")
private String solution;
/**
* 备注信息+电话
*/
@JSONField(name = "ExtInfo")
@XmlElement(name = "ExtInfo")
private String extInfo;
/**
* 用户上传的图片凭证,最多五张
*/
@JSONField(name = "PicInfo")
@XmlElement(name = "PicInfo")
private String picInfo;
/**
* 通知类型 request 用户提交投诉 confirm 用户确认消除 投诉 reject 用户拒绝消除投诉
*/
@JSONField(name = "MsgType")
@XmlElement(name = "MsgType")
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.XmlRootElement;
import com.alibaba.fastjson.annotation.JSONField;
import com.foxinmy.weixin4j.payment.PayBaseInfo;
/**
@ -25,16 +26,19 @@ public class PayWarn extends PayBaseInfo {
/**
* 错误代号 1001=发货超时
*/
@JSONField(name = "ErrorType")
@XmlElement(name = "ErrorType")
private String errortype;
/**
* 错误描述
*/
@JSONField(name = "Description")
@XmlElement(name = "Description")
private String description;
/**
* 错误详情
*/
@JSONField(name = "AlarmContent")
@XmlElement(name = "AlarmContent")
private String alarmcontent;

View File

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

View File

@ -1,6 +1,6 @@
# \u6d4b\u8bd5\u4e4b\u7528 \u6b63\u5f0f\u73af\u5883\u4e0bcopy\u4e00\u4efd\u5230classpath
# \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",\
"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",\

View File

@ -59,7 +59,7 @@ public class MenuTest extends TokenTest {
Button b1 = new Button("我要订餐", "ORDERING", ButtonType.click);
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);
Button b3 = new Button("最新资讯", "NEWS", ButtonType.click);
btnList.add(b3);

View File

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

View File

@ -155,7 +155,7 @@ public class BatchApi extends QyApi {
*
* @param jobId
* 任务ID
* @return 效果信息
* @return 执行结果对象
* @see com.foxinmy.weixin4j.qy.model.BatchResult
* @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>
@ -164,8 +164,8 @@ public class BatchApi extends QyApi {
public BatchResult getBatchResult(String jobId) throws WeixinException {
Token token = tokenHolder.getToken();
String batch_getresult_uri = getRequestUri("batch_getresult_uri");
WeixinResponse response = weixinClient.get(String.format(batch_getresult_uri,
token.getAccessToken(), jobId));
WeixinResponse response = weixinClient.get(String.format(
batch_getresult_uri, token.getAccessToken(), jobId));
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");
JSONObject obj = (JSONObject) JSON.toJSON(party);
if (party.getParentid() < 1) {
if (party.getParentId() < 1) {
obj.remove("parentid");
}
if (party.getOrder() < 0) {

View File

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

View File

@ -2,6 +2,8 @@ package com.foxinmy.weixin4j.qy.message;
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.tuple.ChatTuple;
@ -37,8 +39,11 @@ public class ChatMessage implements Serializable {
*/
private ChatTuple chatTuple;
public ChatMessage(String targetId, ChatType chatType, String senderId,
ChatTuple chatTuple) {
@JSONCreator
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.chatType = chatType;
this.senderId = senderId;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,7 +3,6 @@ package com.foxinmy.weixin4j.qy.model;
import java.io.Serializable;
import java.util.List;
import com.alibaba.fastjson.annotation.JSONCreator;
import com.alibaba.fastjson.annotation.JSONField;
/**
@ -37,19 +36,14 @@ public class ChatInfo implements Serializable {
@JSONField(name = "userlist")
private List<String> members;
public ChatInfo(String chatId, String name, String owner) {
this(chatId, name, owner, null);
public ChatInfo() {
}
@JSONCreator
public ChatInfo(@JSONField(name = "chatId") String chatId,
@JSONField(name = "name") String name,
@JSONField(name = "owner") String owner,
@JSONField(name = "userlist") List<String> members) {
public ChatInfo(String chatId, String name, String owner) {
this.chatId = chatId;
this.name = name;
this.owner = owner;
this.members = members;
}
public String getChatId() {
@ -72,6 +66,20 @@ public class ChatInfo implements Serializable {
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
public String toString() {
return "ChatInfo [chatId=" + chatId + ", name=" + name + ", owner="

View File

@ -2,6 +2,7 @@ package com.foxinmy.weixin4j.qy.model;
import java.io.Serializable;
import com.alibaba.fastjson.annotation.JSONCreator;
import com.alibaba.fastjson.annotation.JSONField;
/**
@ -17,7 +18,8 @@ public class ChatMute implements Serializable {
private static final long serialVersionUID = 6734443056426236273L;
private String userid;
@JSONField(name = "userid")
private String userId;
private int status;
/**
@ -25,8 +27,8 @@ public class ChatMute implements Serializable {
*
* @param userid
*/
public ChatMute(String userid) {
this.userid = userid;
public ChatMute(String userId) {
this.userId = userId;
}
/**
@ -37,27 +39,28 @@ public class ChatMute implements Serializable {
* @param status
* 是否开启免打扰
*/
public ChatMute(String userid, boolean status) {
this.userid = userid;
@JSONCreator
public ChatMute(@JSONField(name = "userId") String userId,
@JSONField(name = "status") boolean status) {
this.userId = userId;
this.status = status ? 1 : 0;
}
public String getUserid() {
return userid;
public String getUserId() {
return userId;
}
public int getStatus() {
return status;
}
@JSONField(deserialize = false)
@JSONField(serialize = false)
public boolean getFormatStatus() {
return status == 1;
}
@Override
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
* @date 2015年6月12日
* @since JDK 1.7
* @see
*/
public class Corpinfo implements Serializable {
public class CorpInfo implements Serializable {
private static final long serialVersionUID = 1251033124778972419L;
/**
* 授权方企业号id
*/
private String corpid;
@JSONField(name = "corpid")
private String corpId;
/**
* 授权方企业号名称
*/
@ -40,93 +41,100 @@ public class Corpinfo implements Serializable {
* 授权方企业号类型
*/
@JSONField(name = "corp_type")
private CorpType corpType;
private String corpType;
/**
* 授权方企业号用户规模
*/
@JSONField(name = "corp_user_max")
private int userMax;
private Integer userMax;
/**
* 授权方企业号应用规模
*/
@JSONField(name = "corp_agent_max")
private int agentMax;
private Integer agentMax;
/**
* 授权方企业号二维码
*/
@JSONField(name = "corp_wxqrcode")
private String wxqrcode;
private String wxQrCode;
public String getCorpid() {
return corpid;
public String getCorpId() {
return corpId;
}
public void setCorpid(String corpid) {
this.corpid = corpid;
}
public CorpType getCorpType() {
public String getCorpType() {
return corpType;
}
public void setCorpType(CorpType corpType) {
this.corpType = corpType;
@JSONField(serialize = false)
public CorpType getFormatCorpType() {
return corpType != null ? CorpType.valueOf(corpType) : null;
}
public String getCorpName() {
return corpName;
}
public void setCorpName(String corpName) {
this.corpName = corpName;
}
public String getSquareLogoUrl() {
return squareLogoUrl;
}
public void setSquareLogoUrl(String squareLogoUrl) {
this.squareLogoUrl = squareLogoUrl;
}
public String getRoundLogoUrl() {
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) {
this.roundLogoUrl = roundLogoUrl;
}
public int getUserMax() {
return userMax;
public void setCorpType(String corpType) {
this.corpType = corpType;
}
public void setUserMax(int userMax) {
public void setUserMax(Integer userMax) {
this.userMax = userMax;
}
public int getAgentMax() {
return agentMax;
}
public void setAgentMax(int agentMax) {
public void setAgentMax(Integer agentMax) {
this.agentMax = agentMax;
}
public String getWxqrcode() {
return wxqrcode;
}
public void setWxqrcode(String wxqrcode) {
this.wxqrcode = wxqrcode;
public void setWxQrCode(String wxQrCode) {
this.wxQrCode = wxQrCode;
}
@Override
public String toString() {
return "Corpinfo [corpid=" + corpid + ", corpName=" + corpName
return "CorpInfo [corpType=" + corpId + ", corpName=" + corpName
+ ", squareLogoUrl=" + squareLogoUrl + ", roundLogoUrl="
+ 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 com.alibaba.fastjson.annotation.JSONCreator;
import com.alibaba.fastjson.annotation.JSONField;
/**
* name-value
*
* @className NameValue
* @author jy
* @date 2015年3月29日
@ -16,11 +20,9 @@ public class NameValue implements Serializable {
private String name;
private String value;
public NameValue() {
}
public NameValue(String name, String value) {
@JSONCreator
public NameValue(@JSONField(name = "name") String name,
@JSONField(name = "value") String value) {
this.name = name;
this.value = value;
}
@ -33,14 +35,6 @@ public class NameValue implements Serializable {
return value;
}
public void setName(String name) {
this.name = name;
}
public void setValue(String value) {
this.value = value;
}
@Override
public String toString() {
return "NameValue [name=" + name + ", value=" + value + "]";

View File

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

View File

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

View File

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

View File

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

View File

@ -45,7 +45,7 @@ public class BatchTest extends TokenTest {
@Test
public void replaceparty() throws WeixinException {
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(
"http://182.254.188.133:8090", "gp2eGT5mIpngr",
"BRYfV4zPFUJb3v3MySNBg1ERKE3vyyMRoScu76vFySv"));

View File

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

View File

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