diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpTpAppQrcode.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpTpAppQrcode.java
new file mode 100644
index 000000000..ada85c760
--- /dev/null
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpTpAppQrcode.java
@@ -0,0 +1,35 @@
+package me.chanjar.weixin.cp.bean;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
+
+/**
+ * 应用的管理员
+ *
+ * @author huangxiaoming
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class WxCpTpAppQrcode extends WxCpBaseResp {
+ private static final long serialVersionUID = -5028321625140879571L;
+
+ @SerializedName("qrcode")
+ private String qrcode;
+
+ /**
+ * From json wx cp tp admin.
+ *
+ * @param json the json
+ * @return the wx cp tp admin
+ */
+ public static WxCpTpAppQrcode fromJson(String json) {
+ return WxCpGsonBuilder.create().fromJson(json, WxCpTpAppQrcode.class);
+ }
+
+ public String toJson() {
+ return WxCpGsonBuilder.create().toJson(this);
+ }
+
+}
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpTpCorpId2OpenCorpId.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpTpCorpId2OpenCorpId.java
new file mode 100644
index 000000000..73dfd4906
--- /dev/null
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpTpCorpId2OpenCorpId.java
@@ -0,0 +1,35 @@
+package me.chanjar.weixin.cp.bean;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
+
+/**
+ * 应用的管理员
+ *
+ * @author huangxiaoming
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class WxCpTpCorpId2OpenCorpId extends WxCpBaseResp {
+ private static final long serialVersionUID = -5028321625140879571L;
+
+ @SerializedName("open_corpid")
+ private String openCorpId;
+
+ /**
+ * From json wx cp tp admin.
+ *
+ * @param json the json
+ * @return the wx cp tp admin
+ */
+ public static WxCpTpCorpId2OpenCorpId fromJson(String json) {
+ return WxCpGsonBuilder.create().fromJson(json, WxCpTpCorpId2OpenCorpId.class);
+ }
+
+ public String toJson() {
+ return WxCpGsonBuilder.create().toJson(this);
+ }
+
+}
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/constant/WxCpApiPathConsts.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/constant/WxCpApiPathConsts.java
index 1ee843c66..4038562e2 100644
--- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/constant/WxCpApiPathConsts.java
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/constant/WxCpApiPathConsts.java
@@ -795,6 +795,15 @@ public interface WxCpApiPathConsts {
* The constant GET_ADMIN_LIST.
*/
String GET_ADMIN_LIST = "/cgi-bin/service/get_admin_list";
+ /**
+ * The constant GET_APP_QRCODE.
+ */
+ String GET_APP_QRCODE = "/cgi-bin/service/get_app_qrcode";
+
+ /**
+ * The constant CORPID_TO_OPENCORPID.
+ */
+ String CORPID_TO_OPENCORPID = "/cgi-bin/service/corpid_to_opencorpid";
/**
* The constant GET_ORDER.
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/service/WxCpTpService.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/service/WxCpTpService.java
index ecb7084c7..e654ee9f2 100644
--- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/service/WxCpTpService.java
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/service/WxCpTpService.java
@@ -525,6 +525,28 @@ public interface WxCpTpService {
*/
WxCpTpAdmin getAdminList(String authCorpId, Integer agentId) throws WxErrorException;
+ /**
+ * 获取应用二维码
+ * @param suiteId 第三方应用id(即ww或wx开头的suiteid)
+ * @param appId 第三方应用id,单应用不需要该参数,多应用旧套件才需要传该参数。若不传默认为1
+ * @param state state值,用于区分不同的安装渠道
+ * @param style 二维码样式选项,默认为不带说明外框小尺寸。0:带说明外框的二维码,适合于实体物料,1:带说明外框的二维码,适合于屏幕类,2:不带说明外框(小尺寸),3:不带说明外框(中尺寸),4:不带说明外框(大尺寸)。具体样式与服务商管理端获取到的应用二维码样式一一对应,参见下文二维码样式说明
+ * @param resultType 结果返回方式,默认为返回二维码图片buffer。1:二维码图片buffer,2:二维码图片url
+ * @return 二维码
+ * @throws WxErrorException the wx error exception
+ */
+ WxCpTpAppQrcode getAppQrcode(String suiteId, String appId, String state, Integer style, Integer resultType) throws WxErrorException ;
+
+ /**
+ *
+ * 明文corpid转换为加密corpid 为更好地保护企业与用户的数据,第三方应用获取的corpid不再是明文的corpid,将升级为第三方服务商级别的加密corpid。文档说明
+ * 第三方可以将已有的明文corpid转换为第三方的加密corpid。
+ * @param corpId
+ * @return
+ * @throws WxErrorException
+ */
+ WxCpTpCorpId2OpenCorpId corpId2OpenCorpId(String corpId) throws WxErrorException;
+
/**
* 创建机构级jsApiTicket签名
* 详情参见企业微信第三方应用开发文档:https://work.weixin.qq.com/api/doc/90001/90144/90539
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/service/impl/BaseWxCpTpServiceImpl.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/service/impl/BaseWxCpTpServiceImpl.java
index c089cb3e2..9d84b152e 100644
--- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/service/impl/BaseWxCpTpServiceImpl.java
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/service/impl/BaseWxCpTpServiceImpl.java
@@ -654,6 +654,24 @@ public abstract class BaseWxCpTpServiceImpl implements WxCpTpService, Requ
return WxCpTpAdmin.fromJson(result);
}
+ public WxCpTpAppQrcode getAppQrcode(String suiteId, String appId, String state, Integer style, Integer resultType) throws WxErrorException {
+ JsonObject jsonObject = new JsonObject();
+ jsonObject.addProperty("suite_id", suiteId);
+ jsonObject.addProperty("appid", appId);
+ jsonObject.addProperty("state", state);
+ jsonObject.addProperty("style", style);
+ jsonObject.addProperty("result_type", resultType);
+ String result = post(configStorage.getApiUrl(GET_APP_QRCODE), jsonObject.toString());
+ return WxCpTpAppQrcode.fromJson(result);
+ }
+
+ public WxCpTpCorpId2OpenCorpId corpId2OpenCorpId(String corpId) throws WxErrorException {
+ JsonObject jsonObject = new JsonObject();
+ jsonObject.addProperty("corpid", corpId);
+ String result = post(configStorage.getApiUrl(CORPID_TO_OPENCORPID) +"?provider_access_token=" + this.configStorage.getAccessToken(corpId), jsonObject.toString());
+ return WxCpTpCorpId2OpenCorpId.fromJson(result);
+ }
+
@Override
public WxJsapiSignature createAuthCorpJsApiTicketSignature(String url, String authCorpId) throws WxErrorException {
return doCreateWxJsapiSignature(url, authCorpId, this.getAuthCorpJsApiTicket(authCorpId));
diff --git a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/tp/service/impl/WxCpTpServiceApacheHttpClientImplTest.java b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/tp/service/impl/WxCpTpServiceApacheHttpClientImplTest.java
index cca0baa13..75927af4d 100644
--- a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/tp/service/impl/WxCpTpServiceApacheHttpClientImplTest.java
+++ b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/tp/service/impl/WxCpTpServiceApacheHttpClientImplTest.java
@@ -4,6 +4,7 @@ import me.chanjar.weixin.common.bean.WxAccessToken;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.redis.RedissonWxRedisOps;
import me.chanjar.weixin.cp.bean.WxCpProviderToken;
+import me.chanjar.weixin.cp.bean.WxCpTpCorpId2OpenCorpId;
import me.chanjar.weixin.cp.config.WxCpTpConfigStorage;
import me.chanjar.weixin.cp.config.impl.WxCpTpRedissonConfigImpl;
import me.chanjar.weixin.cp.tp.service.WxCpTpService;
@@ -178,4 +179,10 @@ public class WxCpTpServiceApacheHttpClientImplTest {
suiteJsApiTicket = wxCpTpService.getSuiteJsApiTicket(AUTH_CORP_ID);
System.out.println("suiteJsApiTicket:" + suiteJsApiTicket);
}
+
+ @Test
+ public void testCorpId2OpenCorpId() throws WxErrorException {
+ WxCpTpCorpId2OpenCorpId openCorpId = wxCpTpService.corpId2OpenCorpId("wpVIkfEAAAu2wGiOEeNMQ69afwLM6BbA");
+ System.out.println("openCorpId:" + openCorpId);
+ }
}
diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenComponentService.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenComponentService.java
index b781236fc..5c0d75e3c 100644
--- a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenComponentService.java
+++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenComponentService.java
@@ -200,6 +200,7 @@ public interface WxOpenComponentService {
String BATCH_SHARE_ENV = "https://api.weixin.qq.com/componenttcb/batchshareenv";
+ String COMPONENT_CLEAR_QUOTA_URL = "https://api.weixin.qq.com/cgi-bin/component/clear_quota/v2";
/**
* Gets wx mp service by appid.
*
@@ -1085,4 +1086,15 @@ public interface WxOpenComponentService {
* @throws WxErrorException
*/
ShareCloudBaseEnvResponse shareCloudBaseEnv(ShareCloudBaseEnvRequest request) throws WxErrorException;
+
+ /**
+ * 使用 AppSecret 重置第三方平台 API 调用次数
+ * https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/openapi/clearComponentQuotaByAppSecret.html
+ *
+ * @param appid 授权用户appid
+ * @return
+ * @throws WxErrorException
+ */
+ WxOpenResult clearQuotaV2(String appid) throws WxErrorException;
+
}
diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenComponentServiceImpl.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenComponentServiceImpl.java
index 52d9b30db..8571dbe2d 100644
--- a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenComponentServiceImpl.java
+++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenComponentServiceImpl.java
@@ -1265,4 +1265,14 @@ public class WxOpenComponentServiceImpl implements WxOpenComponentService {
String response = post(BATCH_SHARE_ENV, gson.toJson(request));
return WxOpenGsonBuilder.create().fromJson(response, ShareCloudBaseEnvResponse.class);
}
+
+ @Override
+ public WxOpenResult clearQuotaV2(String appid) throws WxErrorException {
+ JsonObject jsonObject = new JsonObject();
+ jsonObject.addProperty("appid", appid);
+ jsonObject.addProperty("component_appid", getWxOpenConfigStorage().getComponentAppId());
+ jsonObject.addProperty("appsecret", getWxOpenConfigStorage().getComponentAppSecret());
+ String response = getWxOpenService().post(COMPONENT_CLEAR_QUOTA_URL, jsonObject.toString());
+ return WxOpenResult.fromJson(response);
+ }
}
diff --git a/weixin-java-open/src/test/java/me/chanjar/weixin/open/api/impl/WxOpenComponentServiceImplTest.java b/weixin-java-open/src/test/java/me/chanjar/weixin/open/api/impl/WxOpenComponentServiceImplTest.java
index dd8a9f1c4..497311e08 100644
--- a/weixin-java-open/src/test/java/me/chanjar/weixin/open/api/impl/WxOpenComponentServiceImplTest.java
+++ b/weixin-java-open/src/test/java/me/chanjar/weixin/open/api/impl/WxOpenComponentServiceImplTest.java
@@ -213,4 +213,11 @@ public class WxOpenComponentServiceImplTest {
ShareCloudBaseEnvResponse response = wxOpenComponentService.shareCloudBaseEnv(request);
Assert.assertNotNull(response);
}
+
+
+ @Test
+ public void testClearQuotaV2() throws WxErrorException {
+ WxOpenResult wxOpenResult = wxOpenComponentService.clearQuotaV2("");
+ Assert.assertNotNull(wxOpenResult);
+ }
}