|
| 1 | +package me.chanjar.weixin.cp.api.impl; |
| 2 | + |
| 3 | +import com.google.gson.JsonObject; |
| 4 | +import com.google.gson.reflect.TypeToken; |
| 5 | +import lombok.RequiredArgsConstructor; |
| 6 | +import me.chanjar.weixin.common.error.WxErrorException; |
| 7 | +import me.chanjar.weixin.common.util.json.GsonParser; |
| 8 | +import me.chanjar.weixin.cp.api.WxCpCorpGroupService; |
| 9 | +import me.chanjar.weixin.cp.api.WxCpService; |
| 10 | +import me.chanjar.weixin.cp.bean.corpgroup.*; |
| 11 | +import me.chanjar.weixin.cp.constant.WxCpApiPathConsts; |
| 12 | +import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder; |
| 13 | + |
| 14 | +import java.util.List; |
| 15 | + |
| 16 | +import static me.chanjar.weixin.cp.constant.WxCpApiPathConsts.CorpGroup.*; |
| 17 | +import static me.chanjar.weixin.cp.constant.WxCpApiPathConsts.LinkedCorp.GET_PERM_LIST; |
| 18 | + |
| 19 | +/** |
| 20 | + * @Project: WxJava |
| 21 | + * @Package: me.chanjar.weixin.cp.api.impl |
| 22 | + * @Description: 企业互联相关接口实现类 |
| 23 | + * @Author: libo |
| 24 | + * @Email: 422423229@qq.com |
| 25 | + * @Date: 27/2/2023 10:02 PM |
| 26 | + */ |
| 27 | +@RequiredArgsConstructor |
| 28 | +public class WxCpCorpGroupServiceImpl implements WxCpCorpGroupService { |
| 29 | + private final WxCpService cpService; |
| 30 | + |
| 31 | + @Override |
| 32 | + public List<WxCpCorpGroupCorp> listAppShareInfo(Integer agentId, Integer businessType, String corpId, Integer limit, String cursor) throws WxErrorException { |
| 33 | + final String url = this.cpService.getWxCpConfigStorage().getApiUrl(LIST_SHARE_APP_INFO); |
| 34 | + JsonObject jsonObject = new JsonObject(); |
| 35 | + jsonObject.addProperty("agentid", agentId); |
| 36 | + jsonObject.addProperty("corpid", corpId); |
| 37 | + jsonObject.addProperty("business_type", businessType); |
| 38 | + jsonObject.addProperty("limit", limit); |
| 39 | + jsonObject.addProperty("cursor", cursor); |
| 40 | + String responseContent = this.cpService.post(url, jsonObject); |
| 41 | + JsonObject tmpJson = GsonParser.parse(responseContent); |
| 42 | + |
| 43 | + return WxCpGsonBuilder.create().fromJson(tmpJson.get("corp_list"), |
| 44 | + new TypeToken<List<WxCpCorpGroupCorpListAppShareInfoResp>>() { |
| 45 | + }.getType() |
| 46 | + ); |
| 47 | + } |
| 48 | +} |
0 commit comments