Skip to content

Commit 0adca96

Browse files
niefyniefy
andauthored
🎨 #1659 Json解析统一优化
* 解决动态添加第一个公众号时由于configStorageMap为null报空指针异常 * Json解析统一优化 Co-authored-by: niefy <[email protected]>
1 parent 8121a52 commit 0adca96

File tree

114 files changed

+229
-337
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+229
-337
lines changed

weixin-graal/src/main/java/cn/binarywang/wx/graal/GraalProcessor.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package cn.binarywang.wx.graal;
22

33
import lombok.Data;
4-
import lombok.extern.slf4j.Slf4j;
54

65
import javax.annotation.processing.AbstractProcessor;
76
import javax.annotation.processing.RoundEnvironment;

weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/apache/ApacheSimpleGetRequestExecutor.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package me.chanjar.weixin.common.util.http.apache;
22

33
import me.chanjar.weixin.common.WxType;
4-
import me.chanjar.weixin.common.error.WxError;
54
import me.chanjar.weixin.common.error.WxErrorException;
65
import me.chanjar.weixin.common.util.http.RequestHttp;
76
import me.chanjar.weixin.common.util.http.SimpleGetRequestExecutor;

weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/apache/ApacheSimplePostRequestExecutor.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package me.chanjar.weixin.common.util.http.apache;
22

33
import me.chanjar.weixin.common.WxType;
4-
import me.chanjar.weixin.common.error.WxError;
54
import me.chanjar.weixin.common.error.WxErrorException;
65
import me.chanjar.weixin.common.util.http.RequestHttp;
76
import me.chanjar.weixin.common.util.http.SimplePostRequestExecutor;
@@ -12,7 +11,6 @@
1211
import org.apache.http.client.methods.HttpPost;
1312
import org.apache.http.entity.StringEntity;
1413
import org.apache.http.impl.client.CloseableHttpClient;
15-
import org.jetbrains.annotations.NotNull;
1614

1715
import java.io.IOException;
1816

weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/jodd/JoddHttpSimpleGetRequestExecutor.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import jodd.http.ProxyInfo;
77
import jodd.util.StringPool;
88
import me.chanjar.weixin.common.WxType;
9-
import me.chanjar.weixin.common.error.WxError;
109
import me.chanjar.weixin.common.error.WxErrorException;
1110
import me.chanjar.weixin.common.util.http.RequestHttp;
1211
import me.chanjar.weixin.common.util.http.SimpleGetRequestExecutor;

weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/okhttp/OkHttpSimpleGetRequestExecutor.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package me.chanjar.weixin.common.util.http.okhttp;
22

33
import me.chanjar.weixin.common.WxType;
4-
import me.chanjar.weixin.common.error.WxError;
54
import me.chanjar.weixin.common.error.WxErrorException;
65
import me.chanjar.weixin.common.util.http.RequestHttp;
76
import me.chanjar.weixin.common.util.http.SimpleGetRequestExecutor;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package me.chanjar.weixin.common.util.json;
2+
3+
import com.google.gson.JsonObject;
4+
import com.google.gson.JsonParser;
5+
import com.google.gson.stream.JsonReader;
6+
7+
import java.io.Reader;
8+
9+
public class GsonParser {
10+
private static final JsonParser JSON_PARSER = new JsonParser();
11+
12+
public static JsonObject parse(String json){
13+
return JSON_PARSER.parse(json).getAsJsonObject();
14+
}
15+
16+
public static JsonObject parse(Reader json){
17+
return JSON_PARSER.parse(json).getAsJsonObject();
18+
}
19+
20+
public static JsonObject parse(JsonReader json){
21+
return JSON_PARSER.parse(json).getAsJsonObject();
22+
}
23+
}

weixin-java-common/src/test/java/me/chanjar/weixin/common/api/WxMessageInMemoryDuplicateCheckerTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package me.chanjar.weixin.common.api;
22

3-
import org.testng.Assert;
43
import org.testng.annotations.Test;
54

65
import java.util.concurrent.TimeUnit;

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpExternalContactService.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import me.chanjar.weixin.common.error.WxErrorException;
44
import me.chanjar.weixin.cp.bean.*;
55

6-
import java.util.Calendar;
76
import java.util.Date;
87
import java.util.List;
98

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/BaseWxCpServiceImpl.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
import com.google.common.base.Joiner;
44
import com.google.gson.JsonArray;
5-
import com.google.gson.JsonElement;
65
import com.google.gson.JsonObject;
7-
import com.google.gson.JsonParser;
86
import lombok.extern.slf4j.Slf4j;
97
import me.chanjar.weixin.common.WxType;
108
import me.chanjar.weixin.common.bean.WxJsapiSignature;
@@ -20,6 +18,7 @@
2018
import me.chanjar.weixin.common.util.http.RequestHttp;
2119
import me.chanjar.weixin.common.util.http.SimpleGetRequestExecutor;
2220
import me.chanjar.weixin.common.util.http.SimplePostRequestExecutor;
21+
import me.chanjar.weixin.common.util.json.GsonParser;
2322
import me.chanjar.weixin.cp.api.*;
2423
import me.chanjar.weixin.cp.bean.WxCpMaJsCode2SessionResult;
2524
import me.chanjar.weixin.cp.bean.WxCpMessage;
@@ -110,7 +109,7 @@ public String getAgentJsapiTicket(boolean forceRefresh) throws WxErrorException
110109
synchronized (this.globalAgentJsapiTicketRefreshLock) {
111110
if (this.configStorage.isAgentJsapiTicketExpired()) {
112111
String responseContent = this.get(this.configStorage.getApiUrl(GET_AGENT_CONFIG_TICKET), null);
113-
JsonObject jsonObject = new JsonParser().parse(responseContent).getAsJsonObject();
112+
JsonObject jsonObject = GsonParser.parse(responseContent);
114113
this.configStorage.updateAgentJsapiTicket(jsonObject.get("ticket").getAsString(),
115114
jsonObject.get("expires_in").getAsInt());
116115
}
@@ -135,7 +134,7 @@ public String getJsapiTicket(boolean forceRefresh) throws WxErrorException {
135134
synchronized (this.globalJsapiTicketRefreshLock) {
136135
if (this.configStorage.isJsapiTicketExpired()) {
137136
String responseContent = this.get(this.configStorage.getApiUrl(GET_JSAPI_TICKET), null);
138-
JsonObject tmpJsonObject = new JsonParser().parse(responseContent).getAsJsonObject();
137+
JsonObject tmpJsonObject = GsonParser.parse(responseContent);
139138
this.configStorage.updateJsapiTicket(tmpJsonObject.get("ticket").getAsString(),
140139
tmpJsonObject.get("expires_in").getAsInt());
141140
}
@@ -191,8 +190,8 @@ public WxCpMaJsCode2SessionResult jsCode2Session(String jsCode) throws WxErrorEx
191190
@Override
192191
public String[] getCallbackIp() throws WxErrorException {
193192
String responseContent = get(this.configStorage.getApiUrl(GET_CALLBACK_IP), null);
194-
JsonElement tmpJsonElement = new JsonParser().parse(responseContent);
195-
JsonArray jsonArray = tmpJsonElement.getAsJsonObject().get("ip_list").getAsJsonArray();
193+
JsonObject tmpJsonObject = GsonParser.parse(responseContent);
194+
JsonArray jsonArray = tmpJsonObject.get("ip_list").getAsJsonArray();
196195
String[] ips = new String[jsonArray.size()];
197196
for (int i = 0; i < jsonArray.size(); i++) {
198197
ips[i] = jsonArray.get(i).getAsString();

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/BaseWxCpTpServiceImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import com.google.common.base.Joiner;
44
import com.google.gson.JsonObject;
5-
import com.google.gson.JsonParser;
65
import lombok.SneakyThrows;
76
import lombok.extern.slf4j.Slf4j;
87
import me.chanjar.weixin.common.WxType;
@@ -15,6 +14,7 @@
1514
import me.chanjar.weixin.common.util.http.RequestHttp;
1615
import me.chanjar.weixin.common.util.http.SimpleGetRequestExecutor;
1716
import me.chanjar.weixin.common.util.http.SimplePostRequestExecutor;
17+
import me.chanjar.weixin.common.util.json.GsonParser;
1818
import me.chanjar.weixin.cp.api.WxCpTpService;
1919
import me.chanjar.weixin.cp.bean.*;
2020
import me.chanjar.weixin.cp.config.WxCpTpConfigStorage;
@@ -119,7 +119,7 @@ public WxCpTpCorp getPermanentCode(String authCode) throws WxErrorException {
119119
jsonObject.addProperty("auth_code", authCode);
120120

121121
String result = post(configStorage.getApiUrl(GET_PERMANENT_CODE), jsonObject.toString());
122-
jsonObject = new JsonParser().parse(result).getAsJsonObject();
122+
jsonObject = GsonParser.parse(result);
123123
WxCpTpCorp wxCpTpCorp = WxCpTpCorp.fromJson(jsonObject.get("auth_corp_info").getAsJsonObject().toString());
124124
wxCpTpCorp.setPermanentCode(jsonObject.get("permanent_code").getAsString());
125125
return wxCpTpCorp;

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpAgentServiceImpl.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package me.chanjar.weixin.cp.api.impl;
22

33
import com.google.gson.JsonObject;
4-
import com.google.gson.JsonParser;
54
import com.google.gson.reflect.TypeToken;
65
import lombok.RequiredArgsConstructor;
76
import me.chanjar.weixin.common.WxType;
87
import me.chanjar.weixin.common.error.WxError;
98
import me.chanjar.weixin.common.error.WxErrorException;
9+
import me.chanjar.weixin.common.util.json.GsonParser;
1010
import me.chanjar.weixin.cp.api.WxCpAgentService;
1111
import me.chanjar.weixin.cp.api.WxCpService;
1212
import me.chanjar.weixin.cp.bean.WxCpAgent;
@@ -27,7 +27,7 @@
2727
*/
2828
@RequiredArgsConstructor
2929
public class WxCpAgentServiceImpl implements WxCpAgentService {
30-
private static final JsonParser JSON_PARSER = new JsonParser();
30+
3131

3232
private final WxCpService mainService;
3333

@@ -45,7 +45,7 @@ public WxCpAgent get(Integer agentId) throws WxErrorException {
4545
public void set(WxCpAgent agentInfo) throws WxErrorException {
4646
String url = this.mainService.getWxCpConfigStorage().getApiUrl(AGENT_SET);
4747
String responseContent = this.mainService.post(url, agentInfo.toJson());
48-
JsonObject jsonObject = JSON_PARSER.parse(responseContent).getAsJsonObject();
48+
JsonObject jsonObject = GsonParser.parse(responseContent);
4949
if (jsonObject.get("errcode").getAsInt() != 0) {
5050
throw new WxErrorException(WxError.fromJson(responseContent, WxType.CP));
5151
}
@@ -55,7 +55,7 @@ public void set(WxCpAgent agentInfo) throws WxErrorException {
5555
public List<WxCpAgent> list() throws WxErrorException {
5656
String url = this.mainService.getWxCpConfigStorage().getApiUrl(AGENT_LIST);
5757
String responseContent = this.mainService.get(url, null);
58-
JsonObject jsonObject = JSON_PARSER.parse(responseContent).getAsJsonObject();
58+
JsonObject jsonObject = GsonParser.parse(responseContent);
5959
if (jsonObject.get("errcode").getAsInt() != 0) {
6060
throw new WxErrorException(WxError.fromJson(responseContent, WxType.CP));
6161
}

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpChatServiceImpl.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
package me.chanjar.weixin.cp.api.impl;
22

3-
import com.google.gson.JsonParser;
43
import lombok.RequiredArgsConstructor;
54
import me.chanjar.weixin.common.error.WxErrorException;
5+
import me.chanjar.weixin.common.util.json.GsonParser;
66
import me.chanjar.weixin.common.util.json.WxGsonBuilder;
77
import me.chanjar.weixin.cp.api.WxCpChatService;
88
import me.chanjar.weixin.cp.api.WxCpService;
99
import me.chanjar.weixin.cp.bean.WxCpAppChatMessage;
1010
import me.chanjar.weixin.cp.bean.WxCpChat;
11-
import me.chanjar.weixin.cp.constant.WxCpApiPathConsts;
1211
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
1312
import org.apache.commons.lang3.StringUtils;
1413

@@ -25,7 +24,7 @@
2524
*/
2625
@RequiredArgsConstructor
2726
public class WxCpChatServiceImpl implements WxCpChatService {
28-
private static final JsonParser JSON_PARSER = new JsonParser();
27+
2928
private final WxCpService cpService;
3029

3130
@Override
@@ -45,7 +44,7 @@ public String chatCreate(String name, String owner, List<String> users, String c
4544
}
4645
final String url = this.cpService.getWxCpConfigStorage().getApiUrl(APPCHAT_CREATE);
4746
String result = this.cpService.post(url, WxGsonBuilder.create().toJson(data));
48-
return new JsonParser().parse(result).getAsJsonObject().get("chatid").getAsString();
47+
return GsonParser.parse(result).get("chatid").getAsString();
4948
}
5049

5150
@Override
@@ -87,7 +86,7 @@ public void update(String chatId, String name, String owner, List<String> usersT
8786
public WxCpChat chatGet(String chatId) throws WxErrorException {
8887
final String url = this.cpService.getWxCpConfigStorage().getApiUrl(APPCHAT_GET_CHATID + chatId);
8988
String result = this.cpService.get(url, null);
90-
final String chatInfo = JSON_PARSER.parse(result).getAsJsonObject().getAsJsonObject("chat_info").toString();
89+
final String chatInfo = GsonParser.parse(result).getAsJsonObject("chat_info").toString();
9190
return WxCpGsonBuilder.create().fromJson(chatInfo, WxCpChat.class);
9291
}
9392

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpDepartmentServiceImpl.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
package me.chanjar.weixin.cp.api.impl;
22

3-
import com.google.gson.JsonElement;
4-
import com.google.gson.JsonParser;
3+
import com.google.gson.JsonObject;
54
import com.google.gson.reflect.TypeToken;
65
import lombok.RequiredArgsConstructor;
76
import me.chanjar.weixin.common.error.WxErrorException;
87
import me.chanjar.weixin.common.util.json.GsonHelper;
8+
import me.chanjar.weixin.common.util.json.GsonParser;
99
import me.chanjar.weixin.cp.api.WxCpDepartmentService;
1010
import me.chanjar.weixin.cp.api.WxCpService;
1111
import me.chanjar.weixin.cp.bean.WxCpDepart;
12-
import me.chanjar.weixin.cp.constant.WxCpApiPathConsts;
1312
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
1413

1514
import java.util.List;
@@ -32,8 +31,8 @@ public class WxCpDepartmentServiceImpl implements WxCpDepartmentService {
3231
public Long create(WxCpDepart depart) throws WxErrorException {
3332
String url = this.mainService.getWxCpConfigStorage().getApiUrl(DEPARTMENT_CREATE);
3433
String responseContent = this.mainService.post(url, depart.toJson());
35-
JsonElement tmpJsonElement = new JsonParser().parse(responseContent);
36-
return GsonHelper.getAsLong(tmpJsonElement.getAsJsonObject().get("id"));
34+
JsonObject tmpJsonObject = GsonParser.parse(responseContent);
35+
return GsonHelper.getAsLong(tmpJsonObject.get("id"));
3736
}
3837

3938
@Override
@@ -56,9 +55,9 @@ public List<WxCpDepart> list(Long id) throws WxErrorException {
5655
}
5756

5857
String responseContent = this.mainService.get(url, null);
59-
JsonElement tmpJsonElement = new JsonParser().parse(responseContent);
58+
JsonObject tmpJsonObject = GsonParser.parse(responseContent);
6059
return WxCpGsonBuilder.create()
61-
.fromJson(tmpJsonElement.getAsJsonObject().get("department"),
60+
.fromJson(tmpJsonObject.get("department"),
6261
new TypeToken<List<WxCpDepart>>() {
6362
}.getType()
6463
);

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpMediaServiceImpl.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@
66
import me.chanjar.weixin.common.util.fs.FileUtils;
77
import me.chanjar.weixin.common.util.http.BaseMediaDownloadRequestExecutor;
88
import me.chanjar.weixin.common.util.http.MediaUploadRequestExecutor;
9-
import me.chanjar.weixin.common.util.http.RequestExecutor;
109
import me.chanjar.weixin.cp.api.WxCpMediaService;
1110
import me.chanjar.weixin.cp.api.WxCpService;
12-
import me.chanjar.weixin.cp.constant.WxCpApiPathConsts;
1311

1412
import java.io.File;
1513
import java.io.IOException;

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpMenuServiceImpl.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import me.chanjar.weixin.common.error.WxErrorException;
66
import me.chanjar.weixin.cp.api.WxCpMenuService;
77
import me.chanjar.weixin.cp.api.WxCpService;
8-
import me.chanjar.weixin.cp.constant.WxCpApiPathConsts;
98
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
109

1110
import static me.chanjar.weixin.cp.constant.WxCpApiPathConsts.Menu.*;

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpOAuth2ServiceImpl.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
11
package me.chanjar.weixin.cp.api.impl;
22

3-
import com.google.gson.JsonElement;
43
import com.google.gson.JsonObject;
5-
import com.google.gson.JsonParser;
6-
import lombok.AllArgsConstructor;
74
import lombok.RequiredArgsConstructor;
8-
import me.chanjar.weixin.common.api.WxConsts;
95
import me.chanjar.weixin.common.error.WxErrorException;
106
import me.chanjar.weixin.common.util.http.URIUtil;
117
import me.chanjar.weixin.common.util.json.GsonHelper;
8+
import me.chanjar.weixin.common.util.json.GsonParser;
129
import me.chanjar.weixin.cp.api.WxCpOAuth2Service;
1310
import me.chanjar.weixin.cp.api.WxCpService;
1411
import me.chanjar.weixin.cp.bean.WxCpOauth2UserInfo;
1512
import me.chanjar.weixin.cp.bean.WxCpUserDetail;
16-
import me.chanjar.weixin.cp.constant.WxCpApiPathConsts;
1713
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
1814

1915
import static me.chanjar.weixin.common.api.WxConsts.OAuth2Scope.*;
20-
import static me.chanjar.weixin.common.api.WxConsts.OAuth2Scope.SNSAPI_PRIVATEINFO;
21-
import static me.chanjar.weixin.common.api.WxConsts.OAuth2Scope.SNSAPI_USERINFO;
2216
import static me.chanjar.weixin.cp.constant.WxCpApiPathConsts.OAuth2.*;
2317

2418
/**
@@ -74,8 +68,7 @@ public WxCpOauth2UserInfo getUserInfo(String code) throws WxErrorException {
7468
@Override
7569
public WxCpOauth2UserInfo getUserInfo(Integer agentId, String code) throws WxErrorException {
7670
String responseText = this.mainService.get(String.format(this.mainService.getWxCpConfigStorage().getApiUrl(GET_USER_INFO), code, agentId), null);
77-
JsonElement je = new JsonParser().parse(responseText);
78-
JsonObject jo = je.getAsJsonObject();
71+
JsonObject jo = GsonParser.parse(responseText);
7972

8073
return WxCpOauth2UserInfo.builder()
8174
.userId(GsonHelper.getString(jo, "UserId"))

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpOaServiceImpl.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
package me.chanjar.weixin.cp.api.impl;
22

33
import com.google.gson.JsonArray;
4-
import com.google.gson.JsonElement;
54
import com.google.gson.JsonObject;
65
import com.google.gson.JsonParser;
76
import com.google.gson.reflect.TypeToken;
87
import lombok.NonNull;
98
import lombok.RequiredArgsConstructor;
109
import me.chanjar.weixin.common.error.WxErrorException;
10+
import me.chanjar.weixin.common.util.json.GsonParser;
1111
import me.chanjar.weixin.cp.api.WxCpOaService;
1212
import me.chanjar.weixin.cp.api.WxCpService;
1313
import me.chanjar.weixin.cp.bean.oa.*;
@@ -64,10 +64,10 @@ public List<WxCpCheckinData> getCheckinData(Integer openCheckinDataType, Date st
6464

6565
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GET_CHECKIN_DATA);
6666
String responseContent = this.mainService.post(url, jsonObject.toString());
67-
JsonElement tmpJsonElement = new JsonParser().parse(responseContent);
67+
JsonObject tmpJson = GsonParser.parse(responseContent);
6868
return WxCpGsonBuilder.create()
6969
.fromJson(
70-
tmpJsonElement.getAsJsonObject().get("checkindata"),
70+
tmpJson.get("checkindata"),
7171
new TypeToken<List<WxCpCheckinData>>() {
7272
}.getType()
7373
);
@@ -94,11 +94,11 @@ public List<WxCpCheckinOption> getCheckinOption(Date datetime, List<String> user
9494

9595
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GET_CHECKIN_OPTION);
9696
String responseContent = this.mainService.post(url, jsonObject.toString());
97-
JsonElement tmpJsonElement = new JsonParser().parse(responseContent);
97+
JsonObject tmpJson = GsonParser.parse(responseContent);
9898

9999
return WxCpGsonBuilder.create()
100100
.fromJson(
101-
tmpJsonElement.getAsJsonObject().get("info"),
101+
tmpJson.get("info"),
102102
new TypeToken<List<WxCpCheckinOption>>() {
103103
}.getType()
104104
);
@@ -202,9 +202,9 @@ public List<WxCpDialRecord> getDialRecord(Date startTime, Date endTime, Integer
202202

203203
final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GET_DIAL_RECORD);
204204
String responseContent = this.mainService.post(url, jsonObject.toString());
205-
JsonElement tmpJsonElement = new JsonParser().parse(responseContent);
205+
JsonObject tmpJson = GsonParser.parse(responseContent);
206206

207-
return WxCpGsonBuilder.create().fromJson(tmpJsonElement.getAsJsonObject().get("record"),
207+
return WxCpGsonBuilder.create().fromJson(tmpJson.get("record"),
208208
new TypeToken<List<WxCpDialRecord>>() {
209209
}.getType()
210210
);

0 commit comments

Comments
 (0)