mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
🎨 【小程序】同城配送查询门店余额接口补充了几个遗漏属性,同时优化代码,避免可能出现的NPE问题
This commit is contained in:
@@ -302,7 +302,7 @@ public abstract class BaseWxMaServiceImpl<H, P> implements WxMaService, RequestH
|
||||
if (isApiSignatureRequired(url)) {
|
||||
// 接口需要签名
|
||||
log.debug("已经配置接口需要签名,接口{}将走加密访问路径", url);
|
||||
JsonObject jsonObject = GSON.fromJson(postData, JsonObject.class);
|
||||
JsonObject jsonObject = GSON.fromJson(postData == null ? "{}" : postData, JsonObject.class);
|
||||
return postWithSignature(url, jsonObject);
|
||||
} else {
|
||||
return execute(SimplePostRequestExecutor.create(this), url, postData);
|
||||
@@ -323,12 +323,12 @@ public abstract class BaseWxMaServiceImpl<H, P> implements WxMaService, RequestH
|
||||
|
||||
@Override
|
||||
public String post(String url, ToJson obj) throws WxErrorException {
|
||||
return this.post(url, obj.toJson());
|
||||
return this.post(url, obj == null ? "{}" : obj.toJson());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String post(String url, JsonObject jsonObject) throws WxErrorException {
|
||||
return this.post(url, jsonObject.toString());
|
||||
return this.post(url, jsonObject == null ? "{}" : jsonObject.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -845,7 +845,12 @@ public abstract class BaseWxMaServiceImpl<H, P> implements WxMaService, RequestH
|
||||
new GsonBuilder()
|
||||
.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
|
||||
.create();
|
||||
JsonObject jsonObject = gson.toJsonTree(obj).getAsJsonObject();
|
||||
JsonObject jsonObject;
|
||||
if (obj == null) {
|
||||
jsonObject = gson.fromJson("{}", JsonObject.class);
|
||||
} else {
|
||||
jsonObject = gson.toJsonTree(obj).getAsJsonObject();
|
||||
}
|
||||
return this.postWithSignature(url, jsonObject);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ public class WxMaStoreBalance {
|
||||
private String appid;
|
||||
private int allBalance;
|
||||
|
||||
private List<Detail> balanceDetail;
|
||||
private List<BalanceDetail> balanceDetail;
|
||||
|
||||
public String getWxStoreId() {
|
||||
return wxStoreId;
|
||||
@@ -39,11 +39,11 @@ public class WxMaStoreBalance {
|
||||
this.allBalance = allBalance;
|
||||
}
|
||||
|
||||
public List<Detail> getBalanceDetail() {
|
||||
public List<BalanceDetail> getBalanceDetail() {
|
||||
return balanceDetail;
|
||||
}
|
||||
|
||||
public void setBalanceDetail(List<Detail> balanceDetail) {
|
||||
public void setBalanceDetail(List<BalanceDetail> balanceDetail) {
|
||||
this.balanceDetail = balanceDetail;
|
||||
}
|
||||
|
||||
@@ -52,7 +52,51 @@ public class WxMaStoreBalance {
|
||||
return ToStringBuilder.reflectionToString(this);
|
||||
}
|
||||
|
||||
public static class Detail {
|
||||
public static class BalanceDetail {
|
||||
private int balance;
|
||||
private String serviceTransId;
|
||||
private String serviceTransName;
|
||||
private List<OrderDetail> orderList;
|
||||
|
||||
public int getBalance() {
|
||||
return balance;
|
||||
}
|
||||
|
||||
public void setBalance(int balance) {
|
||||
this.balance = balance;
|
||||
}
|
||||
|
||||
public String getServiceTransId() {
|
||||
return serviceTransId;
|
||||
}
|
||||
|
||||
public void setServiceTransId(String serviceTransId) {
|
||||
this.serviceTransId = serviceTransId;
|
||||
}
|
||||
|
||||
public String getServiceTransName() {
|
||||
return serviceTransName;
|
||||
}
|
||||
|
||||
public void setServiceTransName(String serviceTransName) {
|
||||
this.serviceTransName = serviceTransName;
|
||||
}
|
||||
|
||||
public List<OrderDetail> getOrderList() {
|
||||
return orderList;
|
||||
}
|
||||
|
||||
public void setOrderList(List<OrderDetail> orderList) {
|
||||
this.orderList = orderList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return ToStringBuilder.reflectionToString(this);
|
||||
}
|
||||
}
|
||||
|
||||
public static class OrderDetail {
|
||||
private String payorderId;
|
||||
private int chargeAmt;
|
||||
private int unusedAmt;
|
||||
|
||||
Reference in New Issue
Block a user