@@ -51,6 +51,7 @@ public abstract class BaseWxCpServiceImpl<H, P> implements WxCpService, RequestH
51
51
private WxCpOaService oaService = new WxCpOaServiceImpl (this );
52
52
private WxCpTaskCardService taskCardService = new WxCpTaskCardServiceImpl (this );
53
53
private WxCpExternalContactService externalContactService = new WxCpExternalContactServiceImpl (this );
54
+ private WxCpGroupRobotService groupRobotService = new WxCpGroupRobotServiceImpl (this );
54
55
55
56
/**
56
57
* 全局的是否正在刷新access token的锁.
@@ -217,6 +218,11 @@ public String post(String url, String postData) throws WxErrorException {
217
218
return execute (SimplePostRequestExecutor .create (this ), url , postData );
218
219
}
219
220
221
+ @ Override
222
+ public String postWithoutToken (String url , String postData ) throws WxErrorException {
223
+ return this .executeNormal (SimplePostRequestExecutor .create (this ), url , postData );
224
+ }
225
+
220
226
/**
221
227
* 向微信端发送请求,在这里执行的策略是当发生access_token过期时才去刷新,然后重新执行请求,而不是全局定时请求.
222
228
*/
@@ -296,6 +302,27 @@ protected <T, E> T executeInternal(RequestExecutor<T, E> executor, String uri, E
296
302
}
297
303
}
298
304
305
+ /**
306
+ * 普通请求,不自动带accessToken
307
+ */
308
+ private <T , E > T executeNormal (RequestExecutor <T , E > executor , String uri , E data ) throws WxErrorException {
309
+ try {
310
+ T result = executor .execute (uri , data , WxType .CP );
311
+ log .debug ("\n 【请求地址】: {}\n 【请求参数】:{}\n 【响应数据】:{}" , uri , data , result );
312
+ return result ;
313
+ } catch (WxErrorException e ) {
314
+ WxError error = e .getError ();
315
+ if (error .getErrorCode () != 0 ) {
316
+ log .error ("\n 【请求地址】: {}\n 【请求参数】:{}\n 【错误信息】:{}" , uri , data , error );
317
+ throw new WxErrorException (error , e );
318
+ }
319
+ return null ;
320
+ } catch (IOException e ) {
321
+ log .error ("\n 【请求地址】: {}\n 【请求参数】:{}\n 【异常信息】:{}" , uri , data , e .getMessage ());
322
+ throw new RuntimeException (e );
323
+ }
324
+ }
325
+
299
326
@ Override
300
327
public void setWxCpConfigStorage (WxCpConfigStorage wxConfigProvider ) {
301
328
this .configStorage = wxConfigProvider ;
@@ -412,6 +439,11 @@ public WxCpOaService getOAService() {
412
439
return oaService ;
413
440
}
414
441
442
+ @ Override
443
+ public WxCpGroupRobotService getGroupRobotService () {
444
+ return groupRobotService ;
445
+ }
446
+
415
447
@ Override
416
448
public WxCpTaskCardService getTaskCardService () {
417
449
return taskCardService ;
0 commit comments