mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
🎨 #1659 Json解析统一优化
* 解决动态添加第一个公众号时由于configStorageMap为null报空指针异常 * Json解析统一优化 Co-authored-by: niefy <niefy@qq.com>
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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()
|
||||
);
|
||||
|
||||
@@ -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()
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user