|
@@ -25,7 +25,7 @@ import java.util.List;
|
|
|
import static me.chanjar.weixin.cp.constant.WxCpApiPathConsts.ExternalContact.*;
|
|
|
|
|
|
/**
|
|
|
- * @author 曹祖鹏 & yuanqixun
|
|
|
+ * @author 曹祖鹏 & yuanqixun & Mr.Pan
|
|
|
*/
|
|
|
@RequiredArgsConstructor
|
|
|
public class WxCpExternalContactServiceImpl implements WxCpExternalContactService {
|
|
@@ -136,6 +136,49 @@ public class WxCpExternalContactServiceImpl implements WxCpExternalContactServic
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public String toServiceExternalUserid(@NotNull String externalUserid) throws WxErrorException {
|
|
|
+ JsonObject json = new JsonObject();
|
|
|
+ json.addProperty("external_userid", externalUserid);
|
|
|
+ final String url = this.mainService.getWxCpConfigStorage().getApiUrl(TO_SERVICE_EXTERNAL_USERID);
|
|
|
+ String responseContent = this.mainService.post(url, json.toString());
|
|
|
+ JsonObject tmpJson = GsonParser.parse(responseContent);
|
|
|
+ return tmpJson.get("external_userid").getAsString();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public WxCpExternalUserIdList unionidToExternalUserid3rd(@NotNull String unionid, @NotNull String openid, String corpid) throws WxErrorException {
|
|
|
+ JsonObject json = new JsonObject();
|
|
|
+ json.addProperty("unionid", unionid);
|
|
|
+ json.addProperty("openid", openid);
|
|
|
+ if(StringUtils.isNotEmpty(corpid)){
|
|
|
+ json.addProperty("corpid",corpid);
|
|
|
+ }
|
|
|
+ final String url = this.mainService.getWxCpConfigStorage().getApiUrl(UNIONID_TO_EXTERNAL_USERID_3RD);
|
|
|
+ String responseContent = this.mainService.post(url, json.toString());
|
|
|
+ return WxCpExternalUserIdList.fromJson(responseContent);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public WxCpNewExternalUserIdList getNewExternalUserId(String[] externalUserIdList) throws WxErrorException {
|
|
|
+ JsonObject json = new JsonObject();
|
|
|
+ if (ArrayUtils.isNotEmpty(externalUserIdList)) {
|
|
|
+ json.add("external_userid_list", new Gson().toJsonTree(externalUserIdList).getAsJsonArray());
|
|
|
+ }
|
|
|
+ final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GET_NEW_EXTERNAL_USERID);
|
|
|
+ String responseContent = this.mainService.post(url, json.toString());
|
|
|
+ return WxCpNewExternalUserIdList.fromJson(responseContent);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public WxCpBaseResp finishExternalUserIdMigration(@NotNull String corpid) throws WxErrorException {
|
|
|
+ JsonObject json = new JsonObject();
|
|
|
+ json.addProperty("corpid", corpid);
|
|
|
+ final String url = this.mainService.getWxCpConfigStorage().getApiUrl(FINISH_EXTERNAL_USERID_MIGRATION);
|
|
|
+ String responseContent = this.mainService.post(url, json.toString());
|
|
|
+ return WxCpBaseResp.fromJson(responseContent);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public String opengidToChatid(@NotNull String opengid) throws WxErrorException {
|
|
|
JsonObject json = new JsonObject();
|
|
|
json.addProperty("opengid",opengid);
|