mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-08-25 01:14:36 +08:00
重构简化方法命名
This commit is contained in:
parent
8500368574
commit
2d072e909f
@ -207,7 +207,7 @@ public abstract class WxPayBaseResult {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getXmlValueIfExists(XmlPath xmlPath, String path) {
|
private String getXmlValue(XmlPath xmlPath, String path) {
|
||||||
if (xmlPath.get(path) instanceof NodeChildrenImpl) {
|
if (xmlPath.get(path) instanceof NodeChildrenImpl) {
|
||||||
if (((NodeChildrenImpl) xmlPath.get(path)).size() == 0) {
|
if (((NodeChildrenImpl) xmlPath.get(path)).size() == 0) {
|
||||||
return null;
|
return null;
|
||||||
@ -217,8 +217,8 @@ public abstract class WxPayBaseResult {
|
|||||||
return xmlPath.getString(path);
|
return xmlPath.getString(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected <T> T getXmlValueIfExists(XmlPath xmlPath, String path, Class<T> clz) {
|
protected <T> T getXmlValue(XmlPath xmlPath, String path, Class<T> clz) {
|
||||||
String value = this.getXmlValueIfExists(xmlPath, path);
|
String value = this.getXmlValue(xmlPath, path);
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -397,9 +397,9 @@ public class WxPayOrderQueryResult extends WxPayBaseResult {
|
|||||||
this.coupons = Lists.newArrayList();
|
this.coupons = Lists.newArrayList();
|
||||||
XmlPath xmlPath = new XmlPath(this.getXmlString());
|
XmlPath xmlPath = new XmlPath(this.getXmlString());
|
||||||
for (int i = 0; i < this.couponCount; i++){
|
for (int i = 0; i < this.couponCount; i++){
|
||||||
this.coupons.add(new Coupon(this.getXmlValueIfExists(xmlPath, "xml.coupon_type_" + i, String.class),
|
this.coupons.add(new Coupon(this.getXmlValue(xmlPath, "xml.coupon_type_" + i, String.class),
|
||||||
this.getXmlValueIfExists(xmlPath, "xml.coupon_id_" + i, String.class),
|
this.getXmlValue(xmlPath, "xml.coupon_id_" + i, String.class),
|
||||||
this.getXmlValueIfExists(xmlPath, "xml.coupon_fee_" + i, Integer.class)));
|
this.getXmlValue(xmlPath, "xml.coupon_fee_" + i, Integer.class)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -196,16 +196,16 @@ public class WxPayRefundQueryResult extends WxPayBaseResult {
|
|||||||
RefundRecord refundRecord = new RefundRecord();
|
RefundRecord refundRecord = new RefundRecord();
|
||||||
this.refundRecords.add(refundRecord);
|
this.refundRecords.add(refundRecord);
|
||||||
|
|
||||||
refundRecord.setOutRefundNo(this.getXmlValueIfExists(xmlPath, "xml.out_refund_no_" + i, String.class));
|
refundRecord.setOutRefundNo(this.getXmlValue(xmlPath, "xml.out_refund_no_" + i, String.class));
|
||||||
refundRecord.setRefundId(this.getXmlValueIfExists(xmlPath, "xml.refund_id_" + i, String.class));
|
refundRecord.setRefundId(this.getXmlValue(xmlPath, "xml.refund_id_" + i, String.class));
|
||||||
refundRecord.setRefundChannel(this.getXmlValueIfExists(xmlPath, "xml.refund_channel_" + i, String.class));
|
refundRecord.setRefundChannel(this.getXmlValue(xmlPath, "xml.refund_channel_" + i, String.class));
|
||||||
refundRecord.setRefundFee(this.getXmlValueIfExists(xmlPath, "xml.refund_fee_" + i, Integer.class));
|
refundRecord.setRefundFee(this.getXmlValue(xmlPath, "xml.refund_fee_" + i, Integer.class));
|
||||||
refundRecord.setSettlementRefundFee(this.getXmlValueIfExists(xmlPath, "xml.settlement_refund_fee_" + i, Integer.class));
|
refundRecord.setSettlementRefundFee(this.getXmlValue(xmlPath, "xml.settlement_refund_fee_" + i, Integer.class));
|
||||||
refundRecord.setCouponType(this.getXmlValueIfExists(xmlPath, "xml.coupon_type_" + i, String.class));
|
refundRecord.setCouponType(this.getXmlValue(xmlPath, "xml.coupon_type_" + i, String.class));
|
||||||
refundRecord.setCouponRefundFee(this.getXmlValueIfExists(xmlPath, "xml.coupon_refund_fee_" + i, Integer.class));
|
refundRecord.setCouponRefundFee(this.getXmlValue(xmlPath, "xml.coupon_refund_fee_" + i, Integer.class));
|
||||||
refundRecord.setCouponRefundCount(this.getXmlValueIfExists(xmlPath, "xml.coupon_refund_count_" + i, Integer.class));
|
refundRecord.setCouponRefundCount(this.getXmlValue(xmlPath, "xml.coupon_refund_count_" + i, Integer.class));
|
||||||
refundRecord.setRefundStatus(this.getXmlValueIfExists(xmlPath, "xml.refund_status_" + i, String.class));
|
refundRecord.setRefundStatus(this.getXmlValue(xmlPath, "xml.refund_status_" + i, String.class));
|
||||||
refundRecord.setRefundRecvAccout(this.getXmlValueIfExists(xmlPath, "xml.refund_recv_accout_" + i, String.class));
|
refundRecord.setRefundRecvAccout(this.getXmlValue(xmlPath, "xml.refund_recv_accout_" + i, String.class));
|
||||||
|
|
||||||
if (refundRecord.getCouponRefundCount() == null || refundRecord.getCouponRefundCount() == 0) {
|
if (refundRecord.getCouponRefundCount() == null || refundRecord.getCouponRefundCount() == 0) {
|
||||||
continue;
|
continue;
|
||||||
@ -215,8 +215,8 @@ public class WxPayRefundQueryResult extends WxPayBaseResult {
|
|||||||
for (int j = 0; j < refundRecord.getCouponRefundCount(); j++) {
|
for (int j = 0; j < refundRecord.getCouponRefundCount(); j++) {
|
||||||
coupons.add(
|
coupons.add(
|
||||||
new RefundRecord.RefundCoupon(
|
new RefundRecord.RefundCoupon(
|
||||||
this.getXmlValueIfExists(xmlPath, "xml.coupon_refund_id_" + i + "_" + j, String.class),
|
this.getXmlValue(xmlPath, "xml.coupon_refund_id_" + i + "_" + j, String.class),
|
||||||
this.getXmlValueIfExists(xmlPath, "xml.coupon_refund_fee_" + i + "_" + j, Integer.class)
|
this.getXmlValue(xmlPath, "xml.coupon_refund_fee_" + i + "_" + j, Integer.class)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user