Skip to content

Commit 7478361

Browse files
committed
去掉多余重复的日志输出
1 parent f300831 commit 7478361

File tree

2 files changed

+9
-58
lines changed

2 files changed

+9
-58
lines changed

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpDataCubeServiceImpl.java

Lines changed: 6 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,21 @@
11
package me.chanjar.weixin.mp.api.impl;
22

3-
import java.text.Format;
4-
import java.util.Date;
5-
import java.util.List;
6-
7-
import org.apache.commons.lang3.time.FastDateFormat;
8-
import org.slf4j.Logger;
9-
import org.slf4j.LoggerFactory;
10-
113
import com.google.gson.JsonObject;
12-
134
import me.chanjar.weixin.common.exception.WxErrorException;
145
import me.chanjar.weixin.mp.api.WxMpDataCubeService;
156
import me.chanjar.weixin.mp.api.WxMpService;
16-
import me.chanjar.weixin.mp.bean.datacube.WxDataCubeArticleResult;
17-
import me.chanjar.weixin.mp.bean.datacube.WxDataCubeArticleTotal;
18-
import me.chanjar.weixin.mp.bean.datacube.WxDataCubeInterfaceResult;
19-
import me.chanjar.weixin.mp.bean.datacube.WxDataCubeMsgResult;
20-
import me.chanjar.weixin.mp.bean.datacube.WxDataCubeUserCumulate;
21-
import me.chanjar.weixin.mp.bean.datacube.WxDataCubeUserSummary;
7+
import me.chanjar.weixin.mp.bean.datacube.*;
8+
import org.apache.commons.lang3.time.FastDateFormat;
9+
10+
import java.text.Format;
11+
import java.util.Date;
12+
import java.util.List;
2213

2314
/**
2415
* Created by Binary Wang on 2016/8/23.
2516
* @author binarywang (https://github.com/binarywang)
2617
*/
2718
public class WxMpDataCubeServiceImpl implements WxMpDataCubeService {
28-
protected final Logger log = LoggerFactory.getLogger(WxMpDataCubeServiceImpl.class);
29-
3019
private static final String API_URL_PREFIX = "https://api.weixin.qq.com/datacube";
3120

3221
private final Format dateFormat = FastDateFormat.getInstance("yyyy-MM-dd");
@@ -44,7 +33,6 @@ public List<WxDataCubeUserSummary> getUserSummary(Date beginDate, Date endDate)
4433
param.addProperty("begin_date", this.dateFormat.format(beginDate));
4534
param.addProperty("end_date", this.dateFormat.format(endDate));
4635
String responseContent = this.wxMpService.post(url, param.toString());
47-
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent);
4836
return WxDataCubeUserSummary.fromJson(responseContent);
4937
}
5038

@@ -55,7 +43,6 @@ public List<WxDataCubeUserCumulate> getUserCumulate(Date beginDate, Date endDate
5543
param.addProperty("begin_date", this.dateFormat.format(beginDate));
5644
param.addProperty("end_date", this.dateFormat.format(endDate));
5745
String responseContent = this.wxMpService.post(url, param.toString());
58-
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent);
5946
return WxDataCubeUserCumulate.fromJson(responseContent);
6047
}
6148

@@ -66,7 +53,6 @@ public List<WxDataCubeArticleResult> getArticleSummary(Date beginDate, Date endD
6653
param.addProperty("begin_date", this.dateFormat.format(beginDate));
6754
param.addProperty("end_date", this.dateFormat.format(endDate));
6855
String responseContent = this.wxMpService.post(url, param.toString());
69-
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent);
7056
return WxDataCubeArticleResult.fromJson(responseContent);
7157
}
7258

@@ -77,7 +63,6 @@ public List<WxDataCubeArticleTotal> getArticleTotal(Date beginDate, Date endDate
7763
param.addProperty("begin_date", this.dateFormat.format(beginDate));
7864
param.addProperty("end_date", this.dateFormat.format(endDate));
7965
String responseContent = this.wxMpService.post(url, param.toString());
80-
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent);
8166
return WxDataCubeArticleTotal.fromJson(responseContent);
8267
}
8368

@@ -88,7 +73,6 @@ public List<WxDataCubeArticleResult> getUserRead(Date beginDate, Date endDate) t
8873
param.addProperty("begin_date", this.dateFormat.format(beginDate));
8974
param.addProperty("end_date", this.dateFormat.format(endDate));
9075
String responseContent = this.wxMpService.post(url, param.toString());
91-
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent);
9276
return WxDataCubeArticleResult.fromJson(responseContent);
9377
}
9478

@@ -99,7 +83,6 @@ public List<WxDataCubeArticleResult> getUserReadHour(Date beginDate, Date endDat
9983
param.addProperty("begin_date", this.dateFormat.format(beginDate));
10084
param.addProperty("end_date", this.dateFormat.format(endDate));
10185
String responseContent = this.wxMpService.post(url, param.toString());
102-
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent);
10386
return WxDataCubeArticleResult.fromJson(responseContent);
10487
}
10588

@@ -110,7 +93,6 @@ public List<WxDataCubeArticleResult> getUserShare(Date beginDate, Date endDate)
11093
param.addProperty("begin_date", this.dateFormat.format(beginDate));
11194
param.addProperty("end_date", this.dateFormat.format(endDate));
11295
String responseContent = this.wxMpService.post(url, param.toString());
113-
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent);
11496
return WxDataCubeArticleResult.fromJson(responseContent);
11597
}
11698

@@ -121,7 +103,6 @@ public List<WxDataCubeArticleResult> getUserShareHour(Date beginDate, Date endDa
121103
param.addProperty("begin_date", this.dateFormat.format(beginDate));
122104
param.addProperty("end_date", this.dateFormat.format(endDate));
123105
String responseContent = this.wxMpService.post(url, param.toString());
124-
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent);
125106
return WxDataCubeArticleResult.fromJson(responseContent);
126107
}
127108

@@ -133,7 +114,6 @@ public List<WxDataCubeMsgResult> getUpstreamMsg(Date beginDate, Date endDate)
133114
param.addProperty("begin_date", this.dateFormat.format(beginDate));
134115
param.addProperty("end_date", this.dateFormat.format(endDate));
135116
String responseContent = this.wxMpService.post(url, param.toString());
136-
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent);
137117
return WxDataCubeMsgResult.fromJson(responseContent);
138118
}
139119

@@ -145,7 +125,6 @@ public List<WxDataCubeMsgResult> getUpstreamMsgHour(Date beginDate,
145125
param.addProperty("begin_date", this.dateFormat.format(beginDate));
146126
param.addProperty("end_date", this.dateFormat.format(endDate));
147127
String responseContent = this.wxMpService.post(url, param.toString());
148-
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent);
149128
return WxDataCubeMsgResult.fromJson(responseContent);
150129
}
151130

@@ -157,7 +136,6 @@ public List<WxDataCubeMsgResult> getUpstreamMsgWeek(Date beginDate,
157136
param.addProperty("begin_date", this.dateFormat.format(beginDate));
158137
param.addProperty("end_date", this.dateFormat.format(endDate));
159138
String responseContent = this.wxMpService.post(url, param.toString());
160-
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent);
161139
return WxDataCubeMsgResult.fromJson(responseContent);
162140
}
163141

@@ -169,7 +147,6 @@ public List<WxDataCubeMsgResult> getUpstreamMsgMonth(Date beginDate,
169147
param.addProperty("begin_date", this.dateFormat.format(beginDate));
170148
param.addProperty("end_date", this.dateFormat.format(endDate));
171149
String responseContent = this.wxMpService.post(url, param.toString());
172-
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent);
173150
return WxDataCubeMsgResult.fromJson(responseContent);
174151
}
175152

@@ -181,7 +158,6 @@ public List<WxDataCubeMsgResult> getUpstreamMsgDist(Date beginDate,
181158
param.addProperty("begin_date", this.dateFormat.format(beginDate));
182159
param.addProperty("end_date", this.dateFormat.format(endDate));
183160
String responseContent = this.wxMpService.post(url, param.toString());
184-
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent);
185161
return WxDataCubeMsgResult.fromJson(responseContent);
186162
}
187163

@@ -193,7 +169,6 @@ public List<WxDataCubeMsgResult> getUpstreamMsgDistWeek(Date beginDate,
193169
param.addProperty("begin_date", this.dateFormat.format(beginDate));
194170
param.addProperty("end_date", this.dateFormat.format(endDate));
195171
String responseContent = this.wxMpService.post(url, param.toString());
196-
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent);
197172
return WxDataCubeMsgResult.fromJson(responseContent);
198173
}
199174

@@ -205,7 +180,6 @@ public List<WxDataCubeMsgResult> getUpstreamMsgDistMonth(Date beginDate,
205180
param.addProperty("begin_date", this.dateFormat.format(beginDate));
206181
param.addProperty("end_date", this.dateFormat.format(endDate));
207182
String responseContent = this.wxMpService.post(url, param.toString());
208-
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent);
209183
return WxDataCubeMsgResult.fromJson(responseContent);
210184
}
211185

@@ -217,7 +191,6 @@ public List<WxDataCubeInterfaceResult> getInterfaceSummary(Date beginDate,
217191
param.addProperty("begin_date", this.dateFormat.format(beginDate));
218192
param.addProperty("end_date", this.dateFormat.format(endDate));
219193
String responseContent = this.wxMpService.post(url, param.toString());
220-
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent);
221194
return WxDataCubeInterfaceResult.fromJson(responseContent);
222195
}
223196

@@ -229,7 +202,6 @@ public List<WxDataCubeInterfaceResult> getInterfaceSummaryHour(Date beginDate,
229202
param.addProperty("begin_date", this.dateFormat.format(beginDate));
230203
param.addProperty("end_date", this.dateFormat.format(endDate));
231204
String responseContent = this.wxMpService.post(url, param.toString());
232-
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}",url, param, responseContent);
233205
return WxDataCubeInterfaceResult.fromJson(responseContent);
234206
}
235207
}

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpUserTagServiceImpl.java

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,26 @@
11
package me.chanjar.weixin.mp.api.impl;
22

3-
import java.util.List;
4-
5-
import org.apache.commons.lang3.StringUtils;
6-
import org.slf4j.Logger;
7-
import org.slf4j.LoggerFactory;
8-
93
import com.google.gson.JsonArray;
104
import com.google.gson.JsonObject;
115
import com.google.gson.JsonParser;
126
import com.google.gson.reflect.TypeToken;
13-
147
import me.chanjar.weixin.common.bean.result.WxError;
158
import me.chanjar.weixin.common.exception.WxErrorException;
169
import me.chanjar.weixin.mp.api.WxMpService;
1710
import me.chanjar.weixin.mp.api.WxMpUserTagService;
1811
import me.chanjar.weixin.mp.bean.tag.WxTagListUser;
1912
import me.chanjar.weixin.mp.bean.tag.WxUserTag;
2013
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
14+
import org.apache.commons.lang3.StringUtils;
15+
16+
import java.util.List;
2117

2218
/**
2319
*
2420
* @author binarywang(https://github.com/binarywang)
2521
* Created by Binary Wang on 2016/9/2.
2622
*/
2723
public class WxMpUserTagServiceImpl implements WxMpUserTagService {
28-
protected final Logger log = LoggerFactory
29-
.getLogger(WxMpDataCubeServiceImpl.class);
3024
private static final String API_URL_PREFIX = "https://api.weixin.qq.com/cgi-bin/tags";
3125

3226
private WxMpService wxMpService;
@@ -44,8 +38,6 @@ public WxUserTag tagCreate(String name) throws WxErrorException {
4438
json.add("tag", tagJson);
4539

4640
String responseContent = this.wxMpService.post(url, json.toString());
47-
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}", url, json.toString(),
48-
responseContent);
4941
return WxUserTag.fromJson(responseContent);
5042
}
5143

@@ -54,8 +46,6 @@ public List<WxUserTag> tagGet() throws WxErrorException {
5446
String url = API_URL_PREFIX + "/get";
5547

5648
String responseContent = this.wxMpService.get(url, null);
57-
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}", url, "[empty]",
58-
responseContent);
5949
return WxUserTag.listFromJson(responseContent);
6050
}
6151

@@ -70,7 +60,6 @@ public Boolean tagUpdate(Long id, String name) throws WxErrorException {
7060
json.add("tag", tagJson);
7161

7262
String responseContent = this.wxMpService.post(url, json.toString());
73-
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}", url, json.toString(), responseContent);
7463
WxError wxError = WxError.fromJson(responseContent);
7564
if (wxError.getErrorCode() == 0) {
7665
return true;
@@ -89,8 +78,6 @@ public Boolean tagDelete(Long id) throws WxErrorException {
8978
json.add("tag", tagJson);
9079

9180
String responseContent = this.wxMpService.post(url, json.toString());
92-
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}", url, json.toString(),
93-
responseContent);
9481
WxError wxError = WxError.fromJson(responseContent);
9582
if (wxError.getErrorCode() == 0) {
9683
return true;
@@ -109,8 +96,6 @@ public WxTagListUser tagListUser(Long tagId, String nextOpenid)
10996
json.addProperty("next_openid", StringUtils.trimToEmpty(nextOpenid));
11097

11198
String responseContent = this.wxMpService.post(url, json.toString());
112-
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}", url, json.toString(),
113-
responseContent);
11499
return WxTagListUser.fromJson(responseContent);
115100
}
116101

@@ -128,8 +113,6 @@ public boolean batchTagging(Long tagId, String[] openids)
128113
json.add("openid_list", openidArrayJson);
129114

130115
String responseContent = this.wxMpService.post(url, json.toString());
131-
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}", url, json.toString(),
132-
responseContent);
133116
WxError wxError = WxError.fromJson(responseContent);
134117
if (wxError.getErrorCode() == 0) {
135118
return true;
@@ -152,8 +135,6 @@ public boolean batchUntagging(Long tagId, String[] openids)
152135
json.add("openid_list", openidArrayJson);
153136

154137
String responseContent = this.wxMpService.post(url, json.toString());
155-
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}", url, json.toString(),
156-
responseContent);
157138
WxError wxError = WxError.fromJson(responseContent);
158139
if (wxError.getErrorCode() == 0) {
159140
return true;
@@ -170,8 +151,6 @@ public List<Integer> userTagList(String openid) throws WxErrorException {
170151
json.addProperty("openid", openid);
171152

172153
String responseContent = this.wxMpService.post(url, json.toString());
173-
this.log.debug("\nurl:{}\nparams:{}\nresponse:{}", url, json.toString(),
174-
responseContent);
175154

176155
return WxMpGsonBuilder.create().fromJson(
177156
new JsonParser().parse(responseContent).getAsJsonObject().get("tagid_list"),

0 commit comments

Comments
 (0)