mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
批量格式化代码
This commit is contained in:
@@ -4,7 +4,6 @@ import com.thoughtworks.xstream.XStream;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamConverter;
|
||||
import com.thoughtworks.xstream.annotations.XStreamOmitField;
|
||||
|
||||
import me.chanjar.weixin.common.util.xml.XStreamCDataConverter;
|
||||
import me.chanjar.weixin.common.util.xml.XStreamInitializer;
|
||||
|
||||
|
||||
@@ -28,22 +28,6 @@ import java.math.BigDecimal;
|
||||
* @author <a href="https://github.com/binarywang">binarywang(Binary Wang)</a>
|
||||
*/
|
||||
public abstract class WxPayBaseRequest {
|
||||
/**
|
||||
* 检查请求参数内容,包括必填参数以及特殊约束
|
||||
*/
|
||||
protected void checkFields() throws WxErrorException {
|
||||
//check required fields
|
||||
BeanUtils.checkRequiredFields(this);
|
||||
|
||||
//check other parameters
|
||||
this.checkConstraints();
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查约束情况
|
||||
*/
|
||||
protected abstract void checkConstraints();
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 公众账号ID
|
||||
@@ -68,7 +52,6 @@ public abstract class WxPayBaseRequest {
|
||||
*/
|
||||
@XStreamAlias("mch_id")
|
||||
protected String mchId;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 服务商模式下的子商户公众账号ID
|
||||
@@ -81,7 +64,6 @@ public abstract class WxPayBaseRequest {
|
||||
*/
|
||||
@XStreamAlias("sub_appid")
|
||||
protected String subAppId;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 服务商模式下的子商户号
|
||||
@@ -128,6 +110,22 @@ public abstract class WxPayBaseRequest {
|
||||
return new BigDecimal(yuan).setScale(2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).intValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查请求参数内容,包括必填参数以及特殊约束
|
||||
*/
|
||||
protected void checkFields() throws WxErrorException {
|
||||
//check required fields
|
||||
BeanUtils.checkRequiredFields(this);
|
||||
|
||||
//check other parameters
|
||||
this.checkConstraints();
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查约束情况
|
||||
*/
|
||||
protected abstract void checkConstraints();
|
||||
|
||||
public String getAppid() {
|
||||
return this.appid;
|
||||
}
|
||||
@@ -209,6 +207,7 @@ public abstract class WxPayBaseRequest {
|
||||
* 2、补充系统参数,如果未传入则从配置里读取
|
||||
* 3、生成签名,并设置进去
|
||||
* </pre>
|
||||
*
|
||||
* @param config 支付配置对象,用于读取相应系统配置信息
|
||||
*/
|
||||
public void checkAndSign(WxPayConfig config) throws WxErrorException {
|
||||
@@ -227,7 +226,7 @@ public abstract class WxPayBaseRequest {
|
||||
}
|
||||
|
||||
if (StringUtils.isBlank(getSubMchId())) {
|
||||
this. setSubMchId(config.getSubMchId());
|
||||
this.setSubMchId(config.getSubMchId());
|
||||
}
|
||||
|
||||
if (StringUtils.isBlank(getNonceStr())) {
|
||||
|
||||
@@ -28,16 +28,6 @@ import java.util.Arrays;
|
||||
public class WxPayRefundRequest extends WxPayBaseRequest {
|
||||
private static final String[] REFUND_ACCOUNT = new String[]{"REFUND_SOURCE_RECHARGE_FUNDS",
|
||||
"REFUND_SOURCE_UNSETTLED_FUNDS"};
|
||||
|
||||
@Override
|
||||
public void checkAndSign(WxPayConfig config) throws WxErrorException {
|
||||
if (StringUtils.isBlank(this.getOpUserId())) {
|
||||
this.setOpUserId(config.getMchId());
|
||||
}
|
||||
|
||||
super.checkAndSign(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 设备号
|
||||
@@ -50,7 +40,6 @@ public class WxPayRefundRequest extends WxPayBaseRequest {
|
||||
*/
|
||||
@XStreamAlias("device_info")
|
||||
private String deviceInfo;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 微信订单号
|
||||
@@ -63,7 +52,6 @@ public class WxPayRefundRequest extends WxPayBaseRequest {
|
||||
*/
|
||||
@XStreamAlias("transaction_id")
|
||||
private String transactionId;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 商户订单号
|
||||
@@ -76,7 +64,6 @@ public class WxPayRefundRequest extends WxPayBaseRequest {
|
||||
*/
|
||||
@XStreamAlias("out_trade_no")
|
||||
private String outTradeNo;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 商户退款单号
|
||||
@@ -90,7 +77,6 @@ public class WxPayRefundRequest extends WxPayBaseRequest {
|
||||
@Required
|
||||
@XStreamAlias("out_refund_no")
|
||||
private String outRefundNo;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 订单金额
|
||||
@@ -104,7 +90,6 @@ public class WxPayRefundRequest extends WxPayBaseRequest {
|
||||
@Required
|
||||
@XStreamAlias("total_fee")
|
||||
private Integer totalFee;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 退款金额
|
||||
@@ -118,7 +103,6 @@ public class WxPayRefundRequest extends WxPayBaseRequest {
|
||||
@Required
|
||||
@XStreamAlias("refund_fee")
|
||||
private Integer refundFee;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 货币种类
|
||||
@@ -131,7 +115,6 @@ public class WxPayRefundRequest extends WxPayBaseRequest {
|
||||
*/
|
||||
@XStreamAlias("refund_fee_type")
|
||||
private String refundFeeType;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 操作员
|
||||
@@ -145,7 +128,6 @@ public class WxPayRefundRequest extends WxPayBaseRequest {
|
||||
//@Required
|
||||
@XStreamAlias("op_user_id")
|
||||
private String opUserId;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 退款资金来源
|
||||
@@ -186,6 +168,15 @@ public class WxPayRefundRequest extends WxPayBaseRequest {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkAndSign(WxPayConfig config) throws WxErrorException {
|
||||
if (StringUtils.isBlank(this.getOpUserId())) {
|
||||
this.setOpUserId(config.getMchId());
|
||||
}
|
||||
|
||||
super.checkAndSign(config);
|
||||
}
|
||||
|
||||
public String getDeviceInfo() {
|
||||
return this.deviceInfo;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,13 @@ public class WxPayShorturlRequest extends WxPayBaseRequest {
|
||||
@XStreamAlias("long_url")
|
||||
private String longUrl;
|
||||
|
||||
public WxPayShorturlRequest() {
|
||||
}
|
||||
|
||||
public WxPayShorturlRequest(String longUrl) {
|
||||
this.longUrl = longUrl;
|
||||
}
|
||||
|
||||
public String getLongUrl() {
|
||||
return this.longUrl;
|
||||
}
|
||||
@@ -32,13 +39,6 @@ public class WxPayShorturlRequest extends WxPayBaseRequest {
|
||||
this.longUrl = longUrl;
|
||||
}
|
||||
|
||||
public WxPayShorturlRequest() {
|
||||
}
|
||||
|
||||
public WxPayShorturlRequest(String longUrl) {
|
||||
this.longUrl = longUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void checkConstraints() {
|
||||
//do nothing
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
package com.github.binarywang.wxpay.bean.result;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
|
||||
public class WxScanPayNotifyResult extends WxPayBaseResult implements Serializable{
|
||||
private static final long serialVersionUID = 3381324564266118986L;
|
||||
|
||||
/**
|
||||
* 预支付ID
|
||||
*/
|
||||
@XStreamAlias("prepay_id")
|
||||
private String prepayId;
|
||||
|
||||
public String getPrepayId() {
|
||||
return prepayId;
|
||||
}
|
||||
|
||||
public void setPrepayId(String prepayId) {
|
||||
this.prepayId = prepayId;
|
||||
}
|
||||
|
||||
}
|
||||
package com.github.binarywang.wxpay.bean.result;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class WxScanPayNotifyResult extends WxPayBaseResult implements Serializable {
|
||||
private static final long serialVersionUID = 3381324564266118986L;
|
||||
|
||||
/**
|
||||
* 预支付ID
|
||||
*/
|
||||
@XStreamAlias("prepay_id")
|
||||
private String prepayId;
|
||||
|
||||
public String getPrepayId() {
|
||||
return prepayId;
|
||||
}
|
||||
|
||||
public void setPrepayId(String prepayId) {
|
||||
this.prepayId = prepayId;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user