1111import me .chanjar .weixin .cp .api .WxCpSchoolUserService ;
1212import me .chanjar .weixin .cp .api .WxCpService ;
1313import me .chanjar .weixin .cp .bean .WxCpBaseResp ;
14+ import me .chanjar .weixin .cp .bean .WxCpOauth2UserInfo ;
1415import me .chanjar .weixin .cp .bean .school .user .*;
1516import org .apache .commons .lang3 .StringUtils ;
1617
@@ -32,6 +33,16 @@ public class WxCpSchoolUserServiceImpl implements WxCpSchoolUserService {
3233
3334 private final WxCpService cpService ;
3435
36+ @ Override
37+ public WxCpOauth2UserInfo getUserInfo (@ NonNull String code ) throws WxErrorException {
38+ return cpService .getOauth2Service ().getUserInfo (code );
39+ }
40+
41+ @ Override
42+ public WxCpOauth2UserInfo getSchoolUserInfo (@ NonNull String code ) throws WxErrorException {
43+ return cpService .getOauth2Service ().getSchoolUserInfo (code );
44+ }
45+
3546 @ Override
3647 public WxCpBaseResp createStudent (@ NonNull String studentUserId , @ NonNull String name , @ NonNull List <Integer > departments ) throws WxErrorException {
3748 String apiUrl = this .cpService .getWxCpConfigStorage ().getApiUrl (CREATE_STUDENT );
@@ -104,6 +115,33 @@ public WxCpBaseResp createParent(@NonNull WxCpCreateParentRequest request) throw
104115 return WxCpBaseResp .fromJson (responseContent );
105116 }
106117
118+ @ Override
119+ public WxCpBatchResultList batchCreateParent (@ NonNull WxCpBatchCreateParentRequest request ) throws WxErrorException {
120+ String apiUrl = this .cpService .getWxCpConfigStorage ().getApiUrl (BATCH_CREATE_PARENT );
121+ String responseContent = this .cpService .post (apiUrl , request .toJson ());
122+ return WxCpBatchResultList .fromJson (responseContent );
123+ }
124+
125+ @ Override
126+ public WxCpBatchResultList batchDeleteParent (@ NonNull String ... userIdList ) throws WxErrorException {
127+ String apiUrl = this .cpService .getWxCpConfigStorage ().getApiUrl (BATCH_DELETE_PARENT );
128+ JsonObject jsonObject = new JsonObject ();
129+ JsonArray jsonArray = new JsonArray ();
130+ for (String userId : userIdList ) {
131+ jsonArray .add (new JsonPrimitive (userId ));
132+ }
133+ jsonObject .add ("useridlist" , jsonArray );
134+ String responseContent = this .cpService .post (apiUrl , jsonObject .toString ());
135+ return WxCpBatchResultList .fromJson (responseContent );
136+ }
137+
138+ @ Override
139+ public WxCpBatchResultList batchUpdateParent (@ NonNull WxCpBatchUpdateParentRequest request ) throws WxErrorException {
140+ String apiUrl = this .cpService .getWxCpConfigStorage ().getApiUrl (BATCH_UPDATE_PARENT );
141+ String responseContent = this .cpService .post (apiUrl , request .toJson ());
142+ return WxCpBatchResultList .fromJson (responseContent );
143+ }
144+
107145 @ Override
108146 public WxCpBaseResp updateParent (@ NonNull WxCpUpdateParentRequest request ) throws WxErrorException {
109147 String apiUrl = this .cpService .getWxCpConfigStorage ().getApiUrl (UPDATE_PARENT );
0 commit comments