删除不稳定的ToStringUtils自定义类

This commit is contained in:
Binary Wang
2018-08-23 19:31:38 +08:00
parent a81a8b2b69
commit 3f94ec379d
69 changed files with 648 additions and 563 deletions

View File

@@ -1,10 +1,9 @@
package com.github.binarywang.wxpay.bean.entpay;
import com.github.binarywang.wxpay.bean.request.BaseWxPayRequest;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import lombok.*;
import me.chanjar.weixin.common.annotation.Required;
import me.chanjar.weixin.common.util.ToStringUtils;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* <pre>

View File

@@ -1,10 +1,16 @@
package com.github.binarywang.wxpay.bean.entpay;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.github.binarywang.wxpay.bean.request.BaseWxPayRequest;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import lombok.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import me.chanjar.weixin.common.annotation.Required;
import me.chanjar.weixin.common.util.ToStringUtils;
/**
* <pre>
@@ -44,7 +50,7 @@ public class EntPayQueryRequest extends BaseWxPayRequest {
@Override
public String toString() {
return ToStringUtils.toSimpleString(this);
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
}
@Override

View File

@@ -1,10 +1,16 @@
package com.github.binarywang.wxpay.bean.entpay;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.github.binarywang.wxpay.bean.request.BaseWxPayRequest;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import lombok.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import me.chanjar.weixin.common.annotation.Required;
import me.chanjar.weixin.common.util.ToStringUtils;
/**
* <pre>
@@ -188,7 +194,7 @@ public class EntPayRequest extends BaseWxPayRequest {
@Override
public String toString() {
return ToStringUtils.toSimpleString(this);
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
}
@Override

View File

@@ -1,15 +1,18 @@
package com.github.binarywang.wxpay.bean.notify;
import lombok.Data;
import lombok.NoArgsConstructor;
import me.chanjar.weixin.common.util.ToStringUtils;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 支付异步通知代金券详细
* 支付异步通知代金券详细.
* @author aimilin
*/
@Data
@NoArgsConstructor
@@ -30,6 +33,6 @@ public class WxPayOrderNotifyCoupon implements Serializable {
@Override
public String toString() {
return ToStringUtils.toSimpleString(this);
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
}
}

View File

@@ -1,5 +1,11 @@
package com.github.binarywang.wxpay.bean.notify;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.github.binarywang.wxpay.bean.result.BaseWxPayResult;
import com.github.binarywang.wxpay.converter.WxPayOrderNotifyResultConverter;
import com.github.binarywang.wxpay.util.SignUtils;
@@ -8,12 +14,8 @@ import com.thoughtworks.xstream.annotations.XStreamAlias;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import me.chanjar.weixin.common.util.ToStringUtils;
import me.chanjar.weixin.common.util.xml.XStreamInitializer;
import java.util.List;
import java.util.Map;
/**
* 支付结果通用通知 文档见https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_7
*
@@ -306,6 +308,6 @@ public class WxPayOrderNotifyResult extends BaseWxPayResult {
@Override
public String toString() {
return ToStringUtils.toSimpleString(this);
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
}
}

View File

@@ -1,5 +1,14 @@
package com.github.binarywang.wxpay.bean.notify;
import java.io.Serializable;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.github.binarywang.wxpay.bean.result.BaseWxPayResult;
import com.github.binarywang.wxpay.exception.WxPayException;
import com.thoughtworks.xstream.XStream;
@@ -8,16 +17,7 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import me.chanjar.weixin.common.util.ToStringUtils;
import me.chanjar.weixin.common.util.xml.XStreamInitializer;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.digest.DigestUtils;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
import java.io.Serializable;
import java.math.BigInteger;
import java.security.MessageDigest;
/**
* <pre>
@@ -73,7 +73,7 @@ public class WxPayRefundNotifyResult extends BaseWxPayResult implements Serializ
private ReqInfo reqInfo;
/**
* 加密信息字段解密后的内容
* 加密信息字段解密后的内容.
*/
@Data
@NoArgsConstructor
@@ -81,12 +81,12 @@ public class WxPayRefundNotifyResult extends BaseWxPayResult implements Serializ
public static class ReqInfo {
@Override
public String toString() {
return ToStringUtils.toSimpleString(this);
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
}
/**
* <pre>
* 字段名:微信订单号
* 字段名:微信订单号.
* 变量名transaction_id
* 是否必填:是
* 类型String(32)
@@ -99,7 +99,7 @@ public class WxPayRefundNotifyResult extends BaseWxPayResult implements Serializ
/**
* <pre>
* 字段名:商户订单号
* 字段名:商户订单号.
* 变量名out_trade_no
* 是否必填:是
* 类型String(32)
@@ -112,7 +112,7 @@ public class WxPayRefundNotifyResult extends BaseWxPayResult implements Serializ
/**
* <pre>
* 字段名:微信退款单号
* 字段名:微信退款单号.
* 变量名refund_id
* 是否必填:是
* 类型String(28)
@@ -125,7 +125,7 @@ public class WxPayRefundNotifyResult extends BaseWxPayResult implements Serializ
/**
* <pre>
* 字段名:商户退款单号
* 字段名:商户退款单号.
* 变量名out_refund_no
* 是否必填:是
* 类型String(64)
@@ -138,7 +138,7 @@ public class WxPayRefundNotifyResult extends BaseWxPayResult implements Serializ
/**
* <pre>
* 字段名:订单金额
* 字段名:订单金额.
* 变量名total_fee
* 是否必填:是
* 类型Int
@@ -151,7 +151,7 @@ public class WxPayRefundNotifyResult extends BaseWxPayResult implements Serializ
/**
* <pre>
* 字段名:结订单金额
* 字段名:结订单金额.
* 变量名settlement_total_fee
* 是否必填:否
* 类型Int
@@ -164,7 +164,7 @@ public class WxPayRefundNotifyResult extends BaseWxPayResult implements Serializ
/**
* <pre>
* 字段名:申请退款金额
* 字段名:申请退款金额.
* 变量名refund_fee
* 是否必填:是
* 类型Int
@@ -177,7 +177,7 @@ public class WxPayRefundNotifyResult extends BaseWxPayResult implements Serializ
/**
* <pre>
* 字段名:退款金额
* 字段名:退款金额.
* 变量名settlement_refund_fee
* 是否必填:是
* 类型Int
@@ -190,7 +190,7 @@ public class WxPayRefundNotifyResult extends BaseWxPayResult implements Serializ
/**
* <pre>
* 字段名:退款状态
* 字段名:退款状态.
* 变量名refund_status
* 是否必填:是
* 类型String(16)
@@ -203,7 +203,7 @@ public class WxPayRefundNotifyResult extends BaseWxPayResult implements Serializ
/**
* <pre>
* 字段名:退款成功时间
* 字段名:退款成功时间.
* 变量名success_time
* 是否必填:否
* 类型: String(20)
@@ -215,7 +215,7 @@ public class WxPayRefundNotifyResult extends BaseWxPayResult implements Serializ
/**
* <pre>
* 字段名:退款入账账户
* 字段名:退款入账账户.
* 变量名refund_recv_accout
* 是否必填:是
* 类型String(64)
@@ -228,7 +228,7 @@ public class WxPayRefundNotifyResult extends BaseWxPayResult implements Serializ
/**
* <pre>
* 字段名:退款资金来源
* 字段名:退款资金来源.
* 变量名refund_account
* 是否必填:是
* 类型String(30)
@@ -241,7 +241,7 @@ public class WxPayRefundNotifyResult extends BaseWxPayResult implements Serializ
/**
* <pre>
* 字段名:退款发起来源
* 字段名:退款发起来源.
* 变量名refund_request_source
* 是否必填:是
* 类型String(30)

View File

@@ -1,5 +1,12 @@
package com.github.binarywang.wxpay.bean.request;
import java.io.Serializable;
import java.math.BigDecimal;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.github.binarywang.wxpay.config.WxPayConfig;
import com.github.binarywang.wxpay.exception.WxPayException;
import com.github.binarywang.wxpay.util.SignUtils;
@@ -8,12 +15,7 @@ import com.thoughtworks.xstream.annotations.XStreamAlias;
import lombok.Data;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.util.BeanUtils;
import me.chanjar.weixin.common.util.ToStringUtils;
import me.chanjar.weixin.common.util.xml.XStreamInitializer;
import org.apache.commons.lang3.StringUtils;
import java.io.Serializable;
import java.math.BigDecimal;
import static com.github.binarywang.wxpay.constant.WxPayConstants.SignType.ALL_SIGN_TYPES;
@@ -31,7 +33,7 @@ public abstract class BaseWxPayRequest implements Serializable {
/**
* <pre>
* 字段名公众账号ID
* 字段名公众账号ID.
* 变量名appid
* 是否必填:是
* 类型String(32)
@@ -43,7 +45,7 @@ public abstract class BaseWxPayRequest implements Serializable {
protected String appid;
/**
* <pre>
* 字段名:商户号
* 字段名:商户号.
* 变量名mch_id
* 是否必填:是
* 类型String(32)
@@ -55,7 +57,7 @@ public abstract class BaseWxPayRequest implements Serializable {
protected String mchId;
/**
* <pre>
* 字段名服务商模式下的子商户公众账号ID
* 字段名服务商模式下的子商户公众账号ID.
* 变量名sub_appid
* 是否必填:是
* 类型String(32)
@@ -67,7 +69,7 @@ public abstract class BaseWxPayRequest implements Serializable {
protected String subAppId;
/**
* <pre>
* 字段名:服务商模式下的子商户号
* 字段名:服务商模式下的子商户号.
* 变量名sub_mch_id
* 是否必填:是
* 类型String(32)
@@ -79,7 +81,7 @@ public abstract class BaseWxPayRequest implements Serializable {
protected String subMchId;
/**
* <pre>
* 字段名:随机字符串
* 字段名:随机字符串.
* 变量名nonce_str
* 是否必填:是
* 类型String(32)
@@ -91,7 +93,7 @@ public abstract class BaseWxPayRequest implements Serializable {
protected String nonceStr;
/**
* <pre>
* 字段名:签名
* 字段名:签名.
* 变量名sign
* 是否必填:是
* 类型String(32)
@@ -104,7 +106,7 @@ public abstract class BaseWxPayRequest implements Serializable {
/**
* <pre>
* 签名类型
* 签名类型.
* sign_type
* 否
* String(32)
@@ -116,7 +118,7 @@ public abstract class BaseWxPayRequest implements Serializable {
private String signType;
/**
* 将单位为元转换为单位为分
* 将单位为元转换为单位为分.
*
* @param yuan 将要转换的元的数值字符串
*/
@@ -125,7 +127,7 @@ public abstract class BaseWxPayRequest implements Serializable {
}
/**
* 检查请求参数内容,包括必填参数以及特殊约束
* 检查请求参数内容,包括必填参数以及特殊约束.
*/
private void checkFields() throws WxPayException {
//check required fields
@@ -140,12 +142,12 @@ public abstract class BaseWxPayRequest implements Serializable {
}
/**
* 检查约束情况
* 检查约束情况.
*/
protected abstract void checkConstraints() throws WxPayException;
/**
* 如果配置中已经设置,可以不设置值
* 如果配置中已经设置,可以不设置值.
*
* @param appid 微信公众号appid
*/
@@ -154,7 +156,7 @@ public abstract class BaseWxPayRequest implements Serializable {
}
/**
* 如果配置中已经设置,可以不设置值
* 如果配置中已经设置,可以不设置值.
*
* @param mchId 微信商户号
*/
@@ -163,7 +165,7 @@ public abstract class BaseWxPayRequest implements Serializable {
}
/**
* 默认采用时间戳为随机字符串,可以不设置
* 默认采用时间戳为随机字符串,可以不设置.
*
* @param nonceStr 随机字符串
*/
@@ -173,7 +175,7 @@ public abstract class BaseWxPayRequest implements Serializable {
@Override
public String toString() {
return ToStringUtils.toSimpleString(this);
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
}
public String toXML() {
@@ -186,14 +188,14 @@ public abstract class BaseWxPayRequest implements Serializable {
}
/**
* 签名时是否忽略signType
* 签名时是否忽略signType.
*/
protected boolean ignoreSignType() {
return false;
}
/**
* 签名时是否忽略appid
* 签名时是否忽略appid.
*/
protected boolean ignoreAppid() {
return false;
@@ -201,7 +203,7 @@ public abstract class BaseWxPayRequest implements Serializable {
/**
* <pre>
* 检查参数,并设置签名
* 检查参数,并设置签名.
* 1、检查参数注意子类实现需要检查参数的而外功能时请在调用父类的方法前进行相应判断
* 2、补充系统参数如果未传入则从配置里读取
* 3、生成签名并设置进去

View File

@@ -1,5 +1,26 @@
package com.github.binarywang.wxpay.bean.result;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import com.github.binarywang.wxpay.exception.WxPayException;
import com.github.binarywang.wxpay.service.WxPayService;
import com.github.binarywang.wxpay.util.SignUtils;
@@ -9,26 +30,7 @@ import com.google.common.collect.Maps;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import lombok.Data;
import me.chanjar.weixin.common.util.ToStringUtils;
import me.chanjar.weixin.common.util.xml.XStreamInitializer;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
/**
* <pre>
@@ -136,7 +138,7 @@ public abstract class BaseWxPayResult implements Serializable {
@Override
public String toString() {
return ToStringUtils.toSimpleString(this);
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
}
/**

View File

@@ -1,15 +1,19 @@
package com.github.binarywang.wxpay.bean.result;
import java.io.Serializable;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import lombok.Data;
import lombok.NoArgsConstructor;
import me.chanjar.weixin.common.util.ToStringUtils;
import java.io.Serializable;
/**
* 交易时间:2017-04-06 01:00:02 公众账号ID: 商户号: 子商户号:0 设备号:WEB 微信订单号: 商户订单号:2017040519091071873216 用户标识: 交易类型:NATIVE
* 交易状态:REFUND 付款银行:CFT 货币种类:CNY 总金额:0.00 企业红包金额:0.00 微信退款单号: 商户退款单号:20170406010000933 退款金额:0.01 企业红包退款金额:0.00
* 退款类型:ORIGINAL 退款状态:SUCCESS 商品名称: 商户数据包: 手续费:0.00000 费率 :0.60%
*
* @author BinaryWang
*/
@Data
@NoArgsConstructor
@@ -18,103 +22,103 @@ public class WxPayBillBaseResult implements Serializable {
@Override
public String toString() {
return ToStringUtils.toSimpleString(this);
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
}
/**
* 交易时间
* 交易时间.
*/
private String tradeTime;
/**
* 公众账号ID
* 公众账号ID.
*/
private String appId;
/**
* 商户号
* 商户号.
*/
private String mchId;
/**
* 子商户号
* 子商户号.
*/
private String subMchId;
/**
* 设备号
* 设备号.
*/
private String deviceInfo;
/**
* 微信订单号
* 微信订单号.
*/
private String transactionId;
/**
* 商户订单号
* 商户订单号.
*/
private String outTradeNo;
/**
* 用户标识
* 用户标识.
*/
private String openId;
/**
* 交易类型
* 交易类型.
*/
private String tradeType;
/**
* 交易状态
* 交易状态.
*/
private String tradeState;
/**
* 付款银行
* 付款银行.
*/
private String bankType;
/**
* 货币种类
* 货币种类.
*/
private String feeType;
/**
* 总金额
* 总金额.
*/
private String totalFee;
/**
* 企业红包金额
* 企业红包金额.
*/
private String couponFee;
/**
* 微信退款单号
* 微信退款单号.
*/
private String refundId;
/**
* 商户退款单号
* 商户退款单号.
*/
private String outRefundNo;
/**
* 退款金额
* 退款金额.
*/
private String settlementRefundFee;
/**
* 企业红包退款金额
* 企业红包退款金额.
*/
private String couponRefundFee;
/**
* 退款类型
* 退款类型.
*/
private String refundChannel;
/**
* 退款状态
* 退款状态.
*/
private String refundState;
/**
* 商品名称
* 商品名称.
*/
private String body;
/**
* 商户数据包
* 商户数据包.
*/
private String attach;
/**
* 手续费
* 手续费.
*/
private String poundage;
/**
* 费率
* 费率.
*/
private String poundageRate;

View File

@@ -1,12 +1,17 @@
package com.github.binarywang.wxpay.bean.result;
import lombok.Data;
import lombok.NoArgsConstructor;
import me.chanjar.weixin.common.util.ToStringUtils;
import java.io.Serializable;
import java.util.List;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author BinaryWang
*/
@Data
@NoArgsConstructor
public class WxPayBillResult implements Serializable {
@@ -14,31 +19,31 @@ public class WxPayBillResult implements Serializable {
@Override
public String toString() {
return ToStringUtils.toSimpleString(this);
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
}
/**
* 对账返回对象
* 对账返回对象.
*/
private List<WxPayBillBaseResult> wxPayBillBaseResultLst;
/**
* 总交易单数
* 总交易单数.
*/
private String totalRecord;
/**
* 总交易额
* 总交易额.
*/
private String totalFee;
/**
* 总退款金额
* 总退款金额.
*/
private String totalRefundFee;
/**
* 总代金券或立减优惠退款金额
* 总代金券或立减优惠退款金额.
*/
private String totalCouponFee;
/**
* 手续费总金额
* 手续费总金额.
*/
private String totalPoundageFee;