🎨 #1659 Json解析统一优化

* 解决动态添加第一个公众号时由于configStorageMap为null报空指针异常

* Json解析统一优化

Co-authored-by: niefy <niefy@qq.com>
This commit is contained in:
niefy
2020-07-06 17:01:37 +08:00
committed by GitHub
parent 8121a521d3
commit 0adca9650d
114 changed files with 229 additions and 337 deletions

View File

@@ -8,7 +8,6 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import me.chanjar.weixin.common.annotation.Required;
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
import java.util.Map;

View File

@@ -2,7 +2,6 @@ package com.github.binarywang.wxpay.bean.profitsharing;
import com.github.binarywang.wxpay.bean.request.BaseWxPayRequest;
import com.github.binarywang.wxpay.constant.WxPayConstants;
import com.github.binarywang.wxpay.exception.WxPayException;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import lombok.*;
import me.chanjar.weixin.common.annotation.Required;

View File

@@ -1,11 +1,11 @@
package com.github.binarywang.wxpay.bean.result;
import com.google.common.collect.Lists;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import com.google.gson.JsonObject;
import com.google.gson.reflect.TypeToken;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import lombok.*;
import me.chanjar.weixin.common.util.json.GsonParser;
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
import org.apache.commons.lang3.StringUtils;
import org.w3c.dom.Document;
@@ -149,10 +149,10 @@ public class WxPayRefundQueryResult extends BaseWxPayResult implements Serializa
return;
}
JsonElement tmpJsonElement = new JsonParser().parse(this.promotionDetailString);
JsonObject tmpJson = GsonParser.parse(this.promotionDetailString);
final List<WxPayRefundPromotionDetail> promotionDetail = WxGsonBuilder.create()
.fromJson(tmpJsonElement.getAsJsonObject().get("promotion_detail"),
.fromJson(tmpJson.get("promotion_detail"),
new TypeToken<List<WxPayRefundPromotionDetail>>() {
}.getType()
);

View File

@@ -1,13 +1,13 @@
package com.github.binarywang.wxpay.bean.result;
import com.google.common.collect.Lists;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import com.google.gson.JsonObject;
import com.google.gson.reflect.TypeToken;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import me.chanjar.weixin.common.util.json.GsonParser;
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
import org.apache.commons.lang3.StringUtils;
import org.w3c.dom.Document;
@@ -138,10 +138,10 @@ public class WxPayRefundResult extends BaseWxPayResult implements Serializable {
return;
}
JsonElement tmpJsonElement = new JsonParser().parse(this.promotionDetailString);
JsonObject tmpJson = GsonParser.parse(this.promotionDetailString);
final List<WxPayRefundPromotionDetail> promotionDetail = WxGsonBuilder.create()
.fromJson(tmpJsonElement.getAsJsonObject().get("promotion_detail"),
.fromJson(tmpJson.get("promotion_detail"),
new TypeToken<List<WxPayRefundPromotionDetail>>() {
}.getType()
);