From 566e5f31c7c74e202b47647c9aae1b3b51498dd9 Mon Sep 17 00:00:00 2001 From: pg Date: Mon, 21 Jun 2021 11:58:13 +0800 Subject: [PATCH 1/6] =?UTF-8?q?:art:=20#2155=20=E3=80=90=E4=BC=81=E4=B8=9A?= =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E3=80=91=E5=8F=91=E9=80=81=E6=96=B0=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E6=AC=A2=E8=BF=8E=E8=AF=AD=E6=8E=A5=E5=8F=A3=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=AF=B9=E8=A7=86=E9=A2=91=E7=B1=BB=E5=9E=8B=E7=9A=84?= =?UTF-8?q?=E6=94=AF=E6=8C=81=EF=BC=8C=E5=90=8C=E6=97=B6=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E7=BB=93=E6=9E=84=E4=B8=8D=E6=AD=A3=E7=A1=AE=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cp/bean/external/WxCpWelcomeMsg.java | 12 +-- .../cp/bean/external/msg/Attachment.java | 76 +++++++++++++++++++ .../weixin/cp/bean/external/msg/Video.java | 19 +++++ .../weixin/cp/constant/WxCpConsts.java | 20 +++++ .../WxCpExternalContactServiceImplTest.java | 17 +++++ 5 files changed, 135 insertions(+), 9 deletions(-) create mode 100644 weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/msg/Attachment.java create mode 100644 weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/msg/Video.java diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/WxCpWelcomeMsg.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/WxCpWelcomeMsg.java index ce744b9f24..ade49684ce 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/WxCpWelcomeMsg.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/WxCpWelcomeMsg.java @@ -2,13 +2,11 @@ import com.google.gson.annotations.SerializedName; import lombok.*; -import me.chanjar.weixin.cp.bean.external.msg.Image; -import me.chanjar.weixin.cp.bean.external.msg.Link; -import me.chanjar.weixin.cp.bean.external.msg.MiniProgram; -import me.chanjar.weixin.cp.bean.external.msg.Text; +import me.chanjar.weixin.cp.bean.external.msg.*; import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder; import java.io.Serializable; +import java.util.List; /** * 新客户欢迎语. @@ -28,11 +26,7 @@ public class WxCpWelcomeMsg implements Serializable { private Text text; - private Image image; - - private Link link; - - private MiniProgram miniprogram; + private List attachments; public String toJson() { return WxCpGsonBuilder.create().toJson(this); diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/msg/Attachment.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/msg/Attachment.java new file mode 100644 index 0000000000..0c64b9bf63 --- /dev/null +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/msg/Attachment.java @@ -0,0 +1,76 @@ +package me.chanjar.weixin.cp.bean.external.msg; + +import com.google.gson.annotations.SerializedName; +import me.chanjar.weixin.cp.constant.WxCpConsts; + +import java.io.Serializable; + +public class Attachment implements Serializable { + private static final long serialVersionUID = -8078748379570640198L; + + @SerializedName("msgtype") + private String msgType; + + private Image image; + + private Link link; + + private MiniProgram miniprogram; + + private Video video; + + @Override + public String toString() { + return "Attachment{" + + "msgType='" + msgType + '\'' + + ", image=" + image + + ", link=" + link + + ", miniprogram=" + miniprogram + + ", video=" + video + + '}'; + } + + private String getMsgType() { + return msgType; + } + + private void setMsgType(String msgType) { + this.msgType = msgType; + } + + public Image getImage() { + return image; + } + + public void setImage(Image image) { + this.image = image; + this.msgType = WxCpConsts.WelcomeMsgType.IMAGE; + } + + public Link getLink() { + return link; + } + + public void setLink(Link link) { + this.link = link; + this.msgType = WxCpConsts.WelcomeMsgType.LINK; + } + + public MiniProgram getMiniprogram() { + return miniprogram; + } + + public void setMiniprogram(MiniProgram miniprogram) { + this.miniprogram = miniprogram; + this.msgType = WxCpConsts.WelcomeMsgType.MINIPROGRAM; + } + + public Video getVideo() { + return video; + } + + public void setVideo(Video video) { + this.video = video; + this.msgType = WxCpConsts.WelcomeMsgType.VIDEO; + } +} diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/msg/Video.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/msg/Video.java new file mode 100644 index 0000000000..237fb75cfe --- /dev/null +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/msg/Video.java @@ -0,0 +1,19 @@ +package me.chanjar.weixin.cp.bean.external.msg; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; + +import java.io.Serializable; + +/** + * 视频消息 + * + * @author pg + * @date 2021-6-21 + */ +@Data +public class Video implements Serializable { + private static final long serialVersionUID = -6048642921382867138L; + @SerializedName("media_id") + private String mediaId; +} diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/constant/WxCpConsts.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/constant/WxCpConsts.java index 4a41fa8f71..69db78efbe 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/constant/WxCpConsts.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/constant/WxCpConsts.java @@ -334,4 +334,24 @@ public static class WorkBenchType { * */ public static final String WEBVIEW = "webview"; } + + @UtilityClass + public static class WelcomeMsgType { + /** + * 图片消息. + */ + public static final String IMAGE = "image"; + /** + * 图文消息. + */ + public static final String LINK = "link"; + /** + * 视频消息. + */ + public static final String VIDEO = "video"; + /** + * 小程序消息. + */ + public static final String MINIPROGRAM = "miniprogram"; + } } diff --git a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpExternalContactServiceImplTest.java b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpExternalContactServiceImplTest.java index 29089d478d..4b6221d175 100644 --- a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpExternalContactServiceImplTest.java +++ b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpExternalContactServiceImplTest.java @@ -8,6 +8,9 @@ import me.chanjar.weixin.cp.bean.WxCpBaseResp; import me.chanjar.weixin.cp.bean.external.*; import me.chanjar.weixin.cp.bean.external.contact.WxCpExternalContactInfo; +import me.chanjar.weixin.cp.bean.external.msg.Attachment; +import me.chanjar.weixin.cp.bean.external.msg.Image; +import me.chanjar.weixin.cp.bean.external.msg.Video; import org.apache.commons.lang3.time.DateFormatUtils; import org.testng.annotations.Guice; import org.testng.annotations.Test; @@ -214,8 +217,22 @@ public void testAddMsgTemplate() { @Test public void testSendWelcomeMsg() throws WxErrorException { + Image image = new Image(); + image.setMediaId("123123"); + Attachment attachment = new Attachment(); + attachment.setImage(image); + + Video video = new Video(); + video.setMediaId("video_media_id"); + Attachment attachment2 = new Attachment(); + attachment2.setVideo(video); + + List attachments = new ArrayList<>(); + attachments.add(attachment); + attachments.add(attachment2); this.wxCpService.getExternalContactService().sendWelcomeMsg(WxCpWelcomeMsg.builder() .welcomeCode("abc") + .attachments(attachments) .build()); } From 3963c6d471c339dbf52f325478eeebd1b4d14539 Mon Sep 17 00:00:00 2001 From: pg Date: Tue, 22 Jun 2021 10:57:32 +0800 Subject: [PATCH 2/6] =?UTF-8?q?:new:=20#2150=20=E3=80=90=E4=BC=81=E4=B8=9A?= =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E3=80=91=E8=A1=A5=E5=85=85=E5=AE=8C=E5=96=84?= =?UTF-8?q?=E9=83=A8=E5=88=86=E5=AE=A2=E6=88=B7=E8=81=94=E7=B3=BB=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=EF=BC=8C=E4=BB=A5=E5=8F=8A=E6=9C=8D=E5=8A=A1=E5=95=86?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E5=A4=96=E9=83=A8=E8=81=94=E7=B3=BB=E4=BA=BA?= =?UTF-8?q?openid=E8=BD=AC=E6=8D=A2=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cp/api/WxCpExternalContactService.java | 113 ++++++++++++++++++ .../impl/WxCpExternalContactServiceImpl.java | 63 ++++++++++ ...WxCpUserExternalGroupChatTransferResp.java | 51 ++++++++ .../external/WxCpUserTransferCustomerReq.java | 49 ++++++++ .../WxCpUserTransferCustomerResp.java | 60 ++++++++++ .../external/WxCpUserTransferResultResp.java | 92 ++++++++++++++ .../weixin/cp/constant/WxCpApiPathConsts.java | 7 ++ .../WxCpExternalContactServiceImplTest.java | 52 +++++++- 8 files changed, 486 insertions(+), 1 deletion(-) create mode 100644 weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/WxCpUserExternalGroupChatTransferResp.java create mode 100644 weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/WxCpUserTransferCustomerReq.java create mode 100644 weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/WxCpUserTransferCustomerResp.java create mode 100644 weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/WxCpUserTransferResultResp.java diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpExternalContactService.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpExternalContactService.java index 231e0bfa3e..cd65ad3771 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpExternalContactService.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpExternalContactService.java @@ -6,6 +6,7 @@ import me.chanjar.weixin.cp.bean.external.*; import me.chanjar.weixin.cp.bean.external.contact.WxCpExternalContactBatchInfo; import me.chanjar.weixin.cp.bean.external.contact.WxCpExternalContactInfo; +import org.jetbrains.annotations.NotNull; import java.util.Date; import java.util.List; @@ -134,6 +135,14 @@ public interface WxCpExternalContactService { */ WxCpExternalContactInfo getContactDetail(String userId) throws WxErrorException; + /** + * 企业和服务商可通过此接口,将微信外部联系人的userid转为微信openid,用于调用支付相关接口。暂不支持企业微信外部联系人(ExternalUserid为wo开头)的userid转openid。 + * @param externalUserid 微信外部联系人的userid + * @return 该企业的外部联系人openid + * @throws WxErrorException . + */ + String convertToOpenid(String externalUserid) throws WxErrorException; + /** * 批量获取客户详情. *
@@ -225,9 +234,85 @@ WxCpExternalContactBatchInfo getContactDetailBatch(String userId, String cursor,
    * @param takeOverUserid the take over userid
    * @return wx cp base resp
    * @throws WxErrorException the wx error exception
+   * @deprecated 此后续将不再更新维护,建议使用 {@link #transferCustomer(WxCpUserTransferCustomerReq)}
    */
+  @Deprecated
   WxCpBaseResp transferExternalContact(String externalUserid, String handOverUserid, String takeOverUserid) throws WxErrorException;
 
+  /**
+   * 企业可通过此接口,转接在职成员的客户给其他成员。
+   *  
+   * external_userid必须是handover_userid的客户(即配置了客户联系功能的成员所添加的联系人)。
+   * 在职成员的每位客户最多被分配2次。客户被转接成功后,将有90个自然日的服务关系保护期,保护期内的客户无法再次被分配。
+   *
+   * 权限说明:
+   *   * 企业需要使用“客户联系”secret或配置到“可调用应用”列表中的自建应用secret所获取的accesstoken来调用(accesstoken如何获取?)。
+   * 第三方应用需拥有“企业客户权限->客户联系->在职继承”权限
+   * 接替成员必须在此第三方应用或自建应用的可见范围内。
+   * 接替成员需要配置了客户联系功能。
+   * 接替成员需要在企业微信激活且已经过实名认证。
+   *  
+   * @param req 转接在职成员的客户给其他成员请求实体
+   * @return wx cp base resp
+   * @throws WxErrorException the wx error exception
+   */
+  WxCpUserTransferCustomerResp transferCustomer(WxCpUserTransferCustomerReq req) throws WxErrorException;
+
+  /**
+   * 企业和第三方可通过此接口查询在职成员的客户转接情况。
+   * 
+   *   权限说明:
+   *
+   * 企业需要使用“客户联系”secret或配置到“可调用应用”列表中的自建应用secret所获取的accesstoken来调用(accesstoken如何获取?)。
+   * 第三方应用需拥有“企业客户权限->客户联系->在职继承”权限
+   * 接替成员必须在此第三方应用或自建应用的可见范围内。
+   * 
+   * @param handOverUserid 原添加成员的userid
+   * @param takeOverUserid 接替成员的userid
+   * @param cursor 分页查询的cursor,每个分页返回的数据不会超过1000条;不填或为空表示获取第一个分页;
+   * @return 客户转接接口实体
+   * @throws WxErrorException the wx error exception
+   */
+  WxCpUserTransferResultResp transferResult(@NotNull String handOverUserid, @NotNull String takeOverUserid, String cursor)  throws WxErrorException;
+
+  /**
+   * 企业可通过此接口,分配离职成员的客户给其他成员。
+   *  
+   * handover_userid必须是已离职用户。
+   * external_userid必须是handover_userid的客户(即配置了客户联系功能的成员所添加的联系人)。
+   * 在职成员的每位客户最多被分配2次。客户被转接成功后,将有90个自然日的服务关系保护期,保护期内的客户无法再次被分配。
+   *
+   * 权限说明:
+   *
+   * 企业需要使用“客户联系”secret或配置到“可调用应用”列表中的自建应用secret所获取的accesstoken来调用(accesstoken如何获取?)。
+   * 第三方应用需拥有“企业客户权限->客户联系->离职分配”权限
+   * 接替成员必须在此第三方应用或自建应用的可见范围内。
+   * 接替成员需要配置了客户联系功能。
+   * 接替成员需要在企业微信激活且已经过实名认证。
+   *  
+   * @param req 转接在职成员的客户给其他成员请求实体
+   * @return wx cp base resp
+   * @throws WxErrorException the wx error exception
+   */
+  WxCpUserTransferCustomerResp resignedTransferCustomer(WxCpUserTransferCustomerReq req) throws WxErrorException;
+
+  /**
+   * 企业和第三方可通过此接口查询离职成员的客户分配情况。
+   * 
+   * 权限说明:
+   *
+   * 企业需要使用“客户联系”secret或配置到“可调用应用”列表中的自建应用secret所获取的accesstoken来调用(accesstoken如何获取?)。
+   * 第三方应用需拥有“企业客户权限->客户联系->在职继承”权限
+   * 接替成员必须在此第三方应用或自建应用的可见范围内。
+   * 
+   * @param handOverUserid 原添加成员的userid
+   * @param takeOverUserid 接替成员的userid
+   * @param cursor 分页查询的cursor,每个分页返回的数据不会超过1000条;不填或为空表示获取第一个分页;
+   * @return 客户转接接口实体
+   * @throws WxErrorException the wx error exception
+   */
+  WxCpUserTransferResultResp resignedTransferResult(@NotNull String handOverUserid, @NotNull String takeOverUserid, String cursor)  throws WxErrorException;
+
   /**
    * 
    * 该接口用于获取配置过客户群管理的客户群列表。
@@ -260,6 +345,32 @@ WxCpExternalContactBatchInfo getContactDetailBatch(String userId, String cursor,
    */
   WxCpUserExternalGroupChatInfo getGroupChat(String chatId) throws WxErrorException;
 
+  /**
+   *
+   * 企业可通过此接口,将已离职成员为群主的群,分配给另一个客服成员。
+   *
+   * 
+   * 注意::
+   *
+   * 群主离职了的客户群,才可继承
+   * 继承给的新群主,必须是配置了客户联系功能的成员
+   * 继承给的新群主,必须有设置实名
+   * 继承给的新群主,必须有激活企业微信
+   * 同一个人的群,限制每天最多分配300个给新群主
+   *
+   * 权限说明:
+   *
+   * 企业需要使用“客户联系”secret或配置到“可调用应用”列表中的自建应用secret所获取的accesstoken来调用(accesstoken如何获取?)。
+   * 第三方应用需拥有“企业客户权限->客户联系->分配离职成员的客户群”权限
+   * 对于第三方/自建应用,群主必须在应用的可见范围。
+   * 
+   * @param chatIds 需要转群主的客户群ID列表。取值范围: 1 ~ 100
+   * @param newOwner  新群主ID
+   * @return 分配结果,主要是分配失败的群列表
+   * @throws WxErrorException  the wx error exception
+   */
+  WxCpUserExternalGroupChatTransferResp transferGroupChat(String[] chatIds, String newOwner)  throws WxErrorException;
+
   /**
    * 
    * 企业可通过此接口获取成员联系客户的数据,包括发起申请数、新增客户数、聊天数、发送消息数和删除/拉黑成员的客户数等指标。
@@ -397,4 +508,6 @@ WxCpExternalContactBatchInfo getContactDetailBatch(String userId, String cursor,
    * @throws WxErrorException the wx error exception
    */
   WxCpBaseResp markTag(String userid, String externalUserid, String[] addTag, String[] removeTag) throws WxErrorException;
+
+
 }
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpExternalContactServiceImpl.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpExternalContactServiceImpl.java
index 19e7cdfe79..8065d21980 100644
--- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpExternalContactServiceImpl.java
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpExternalContactServiceImpl.java
@@ -7,6 +7,8 @@
 import me.chanjar.weixin.common.error.WxCpErrorMsgEnum;
 import me.chanjar.weixin.common.error.WxErrorException;
 import me.chanjar.weixin.common.error.WxRuntimeException;
+import me.chanjar.weixin.common.util.BeanUtils;
+import me.chanjar.weixin.common.util.json.GsonParser;
 import me.chanjar.weixin.cp.api.WxCpExternalContactService;
 import me.chanjar.weixin.cp.api.WxCpService;
 import me.chanjar.weixin.cp.bean.WxCpBaseResp;
@@ -15,6 +17,7 @@
 import me.chanjar.weixin.cp.bean.external.contact.WxCpExternalContactInfo;
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.jetbrains.annotations.NotNull;
 
 import java.util.Collections;
 import java.util.Date;
@@ -106,6 +109,16 @@ public WxCpExternalContactInfo getContactDetail(String userId) throws WxErrorExc
     return WxCpExternalContactInfo.fromJson(responseContent);
   }
 
+  @Override
+  public String convertToOpenid(@NotNull String externalUserId) throws WxErrorException {
+    JsonObject json = new JsonObject();
+    json.addProperty("external_userid", externalUserId);
+    final String url = this.mainService.getWxCpConfigStorage().getApiUrl(CONVERT_TO_OPENID);
+    String responseContent = this.mainService.post(url, json.toString());
+    JsonObject tmpJson = GsonParser.parse(responseContent);
+    return tmpJson.get("openid").getAsString();
+  }
+
   @Override
   public WxCpExternalContactBatchInfo getContactDetailBatch(String userId,
                                                             String cursor,
@@ -176,6 +189,44 @@ public WxCpBaseResp transferExternalContact(String externalUserid, String handOv
     return WxCpBaseResp.fromJson(result);
   }
 
+  @Override
+  public WxCpUserTransferCustomerResp transferCustomer(WxCpUserTransferCustomerReq req) throws WxErrorException {
+    BeanUtils.checkRequiredFields(req);
+    final String url = this.mainService.getWxCpConfigStorage().getApiUrl(TRANSFER_CUSTOMER);
+    final String result = this.mainService.post(url, req.toJson());
+    return WxCpUserTransferCustomerResp.fromJson(result);
+  }
+
+  @Override
+  public WxCpUserTransferResultResp transferResult(@NotNull String handOverUserid, @NotNull String takeOverUserid, String cursor) throws WxErrorException {
+    JsonObject json = new JsonObject();
+    json.addProperty("cursor", cursor);
+    json.addProperty("handover_userid", handOverUserid);
+    json.addProperty("takeover_userid", takeOverUserid);
+    final String url = this.mainService.getWxCpConfigStorage().getApiUrl(TRANSFER_RESULT);
+    final String result = this.mainService.post(url, json.toString());
+    return WxCpUserTransferResultResp.fromJson(result);
+  }
+
+  @Override
+  public WxCpUserTransferCustomerResp resignedTransferCustomer(WxCpUserTransferCustomerReq req) throws WxErrorException {
+    BeanUtils.checkRequiredFields(req);
+    final String url = this.mainService.getWxCpConfigStorage().getApiUrl(RESIGNED_TRANSFER_CUSTOMER);
+    final String result = this.mainService.post(url, req.toJson());
+    return WxCpUserTransferCustomerResp.fromJson(result);
+  }
+
+  @Override
+  public WxCpUserTransferResultResp resignedTransferResult(@NotNull String handOverUserid, @NotNull String takeOverUserid, String cursor) throws WxErrorException {
+    JsonObject json = new JsonObject();
+    json.addProperty("cursor", cursor);
+    json.addProperty("handover_userid", handOverUserid);
+    json.addProperty("takeover_userid", takeOverUserid);
+    final String url = this.mainService.getWxCpConfigStorage().getApiUrl(RESIGNED_TRANSFER_RESULT);
+    final String result = this.mainService.post(url, json.toString());
+    return WxCpUserTransferResultResp.fromJson(result);
+  }
+
   @Override
   public WxCpUserExternalGroupChatList listGroupChat(Integer pageIndex, Integer pageSize, int status, String[] userIds, String[] partyIds) throws WxErrorException {
     JsonObject json = new JsonObject();
@@ -206,6 +257,18 @@ public WxCpUserExternalGroupChatInfo getGroupChat(String chatId) throws WxErrorE
     return WxCpUserExternalGroupChatInfo.fromJson(result);
   }
 
+  @Override
+  public WxCpUserExternalGroupChatTransferResp transferGroupChat(String[] chatIds, String newOwner) throws WxErrorException {
+    JsonObject json = new JsonObject();
+    if (ArrayUtils.isNotEmpty(chatIds)) {
+      json.add("chat_id_list", new Gson().toJsonTree(chatIds).getAsJsonArray());
+    }
+    json.addProperty("new_owner", newOwner);
+    final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GROUP_CHAT_TRANSFER);
+    final String result = this.mainService.post(url, json.toString());
+    return WxCpUserExternalGroupChatTransferResp.fromJson(result);
+  }
+
   @Override
   public WxCpUserExternalUserBehaviorStatistic getUserBehaviorStatistic(Date startTime, Date endTime, String[] userIds, String[] partyIds) throws WxErrorException {
     JsonObject json = new JsonObject();
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/WxCpUserExternalGroupChatTransferResp.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/WxCpUserExternalGroupChatTransferResp.java
new file mode 100644
index 0000000000..ff6fb82374
--- /dev/null
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/WxCpUserExternalGroupChatTransferResp.java
@@ -0,0 +1,51 @@
+package me.chanjar.weixin.cp.bean.external;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Getter;
+import lombok.Setter;
+import me.chanjar.weixin.cp.bean.WxCpBaseResp;
+import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
+
+import java.util.List;
+
+/**
+ * 分配离职成员的客户群结果
+ * @author pg
+ * @date 2021年6月21日
+ */
+@Getter
+@Setter
+public class WxCpUserExternalGroupChatTransferResp extends WxCpBaseResp {
+  private static final long serialVersionUID = -943124579487821819L;
+  /**
+   * 没有成功继承的群列表
+   */
+  @SerializedName("failed_chat_list")
+  private List failedChatList;
+
+  public static WxCpUserExternalGroupChatTransferResp fromJson(String json) {
+    return WxCpGsonBuilder.create().fromJson(json, WxCpUserExternalGroupChatTransferResp.class);
+  }
+
+  public String toJson() {
+    return WxCpGsonBuilder.create().toJson(this);
+  }
+
+  @Getter
+  @Setter
+  public static class GroupChatFailedTransfer extends WxCpBaseResp  {
+    private static final long serialVersionUID = -5836775099634587239L;
+    /**
+     * 没能成功继承的群ID
+     */
+    private String chatId;
+
+    public static WxCpUserExternalGroupChatTransferResp.GroupChatFailedTransfer fromJson(String json) {
+      return WxCpGsonBuilder.create().fromJson(json, WxCpUserExternalGroupChatTransferResp.GroupChatFailedTransfer.class);
+    }
+
+    public String toJson() {
+      return WxCpGsonBuilder.create().toJson(this);
+    }
+  }
+}
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/WxCpUserTransferCustomerReq.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/WxCpUserTransferCustomerReq.java
new file mode 100644
index 0000000000..e8b8142cc6
--- /dev/null
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/WxCpUserTransferCustomerReq.java
@@ -0,0 +1,49 @@
+package me.chanjar.weixin.cp.bean.external;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Getter;
+import lombok.Setter;
+import me.chanjar.weixin.common.annotation.Required;
+import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 转接在职成员的客户给其他成员,请求对象
+ *
+ * @author pg
+ * @date 2021年6月21日
+ */
+@Getter
+@Setter
+public class WxCpUserTransferCustomerReq implements Serializable {
+  private static final long serialVersionUID = -309819538677411801L;
+  /**
+   * 原跟进成员的userid
+   */
+  @SerializedName("handover_userid")
+  @Required
+  private String handOverUserid;
+  /**
+   * 接替成员的userid
+   */
+  @SerializedName("takeover_userid")
+  @Required
+  private String takeOverUserid;
+  /**
+   * 客户的external_userid列表,每次最多分配100个客户
+   */
+  @SerializedName("external_userid")
+  @Required
+  private List externalUserid;
+  /**
+   * 转移成功后发给客户的消息,最多200个字符,不填则使用默认文案
+   */
+  @SerializedName("transfer_success_msg")
+  private String transferMsg;
+
+  public String toJson() {
+    return WxCpGsonBuilder.create().toJson(this);
+  }
+}
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/WxCpUserTransferCustomerResp.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/WxCpUserTransferCustomerResp.java
new file mode 100644
index 0000000000..27d1c0ad4c
--- /dev/null
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/WxCpUserTransferCustomerResp.java
@@ -0,0 +1,60 @@
+package me.chanjar.weixin.cp.bean.external;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Getter;
+import lombok.Setter;
+import me.chanjar.weixin.cp.bean.WxCpBaseResp;
+import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 转接在职成员的客户给其他成员,返回对象
+ *
+ * @author pg
+ * @date 2021年6月21日
+ */
+@Getter
+@Setter
+public class WxCpUserTransferCustomerResp extends WxCpBaseResp {
+  private static final long serialVersionUID = -8030598756503590089L;
+  /**
+   * 客户转移结果列表
+   */
+  private List customer;
+
+  public static WxCpUserTransferCustomerResp fromJson(String json) {
+    return WxCpGsonBuilder.create().fromJson(json, WxCpUserTransferCustomerResp.class);
+  }
+
+  public String toJson() {
+    return WxCpGsonBuilder.create().toJson(this);
+  }
+
+  /**
+   * 转接客户结果实体
+   */
+  @Getter
+  @Setter
+  public static class TransferCustomer implements Serializable {
+    private static final long serialVersionUID = 8720554208727083338L;
+    /**
+     * 客户的external_userid
+     */
+    @SerializedName("external_userid")
+    private String externalUserid;
+    /**
+     * 对此客户进行分配的结果, 0表示成功发起接替,待24小时后自动接替,并不代表最终接替成功
+     */
+    private Integer errcode;
+
+    public static WxCpUserTransferCustomerResp.TransferCustomer fromJson(String json) {
+      return WxCpGsonBuilder.create().fromJson(json, WxCpUserTransferCustomerResp.TransferCustomer.class);
+    }
+
+    public String toJson() {
+      return WxCpGsonBuilder.create().toJson(this);
+    }
+  }
+}
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/WxCpUserTransferResultResp.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/WxCpUserTransferResultResp.java
new file mode 100644
index 0000000000..e1b8cc4591
--- /dev/null
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/WxCpUserTransferResultResp.java
@@ -0,0 +1,92 @@
+package me.chanjar.weixin.cp.bean.external;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Getter;
+import lombok.Setter;
+import me.chanjar.weixin.cp.bean.WxCpBaseResp;
+import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
+
+import java.io.Serializable;
+
+/**
+ * 在职成员的客户转接情况
+ * @author pg
+ * @date 2021年6月21日
+ */
+@Getter
+@Setter
+public class WxCpUserTransferResultResp extends WxCpBaseResp {
+  private static final long serialVersionUID = 6897979567174991786L;
+  @SerializedName("next_cursor")
+  private String nextCursor;
+
+  public static WxCpUserTransferResultResp fromJson(String json) {
+    return WxCpGsonBuilder.create().fromJson(json, WxCpUserTransferResultResp.class);
+  }
+
+  public String toJson() {
+    return WxCpGsonBuilder.create().toJson(this);
+  }
+
+  /**
+   * 客户转接结果实体
+   */
+  @Getter
+  @Setter
+  public static class TransferResult implements Serializable {
+    private static final long serialVersionUID = 2847784363733118393L;
+
+    /**
+     * 客户的external_userid
+     */
+    @SerializedName("external_userid")
+    private String externalUserid;
+    /**
+     * 接替状态, 1-接替完毕 2-等待接替 3-客户拒绝 4-接替成员客户达到上限 5-无接替记录
+     */
+    private STATUS status;
+    /**
+     * 接替客户的时间,如果是等待接替状态,则为未来的自动接替时间
+     */
+    @SerializedName("takeover_time")
+    private Long takeOverTime;
+
+    public static WxCpUserTransferResultResp.TransferResult fromJson(String json) {
+      return WxCpGsonBuilder.create().fromJson(json, WxCpUserTransferResultResp.TransferResult.class);
+    }
+
+    public String toJson() {
+      return WxCpGsonBuilder.create().toJson(this);
+    }
+  }
+
+  public enum STATUS {
+
+    /**
+     * 接替完毕
+     */
+    @SerializedName("1")
+    COMPLETE,
+
+    /**
+     * 等待接替
+     */
+    @SerializedName("2")
+    WAITING,
+    /**
+     * 客户拒绝
+     */
+    @SerializedName("3")
+    REFUSED,
+    /**
+     * 接替成员客户达到上限
+     */
+    @SerializedName("4")
+    LIMIT,
+    /**
+     * 无接替记录
+     */
+    @SerializedName("5")
+    NORECORD
+  }
+}
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 bc96269ea8..c60a1bddbd 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
@@ -175,13 +175,20 @@ interface ExternalContact {
     String CLOSE_TEMP_CHAT = "/cgi-bin/externalcontact/close_temp_chat";
     String GET_FOLLOW_USER_LIST = "/cgi-bin/externalcontact/get_follow_user_list";
     String GET_CONTACT_DETAIL = "/cgi-bin/externalcontact/get?external_userid=";
+    String CONVERT_TO_OPENID = "/cgi-bin/externalcontact/convert_to_openid";
     String GET_CONTACT_DETAIL_BATCH = "/cgi-bin/externalcontact/batch/get_by_user?";
     String UPDATE_REMARK = "/cgi-bin/externalcontact/remark";
     String LIST_EXTERNAL_CONTACT = "/cgi-bin/externalcontact/list?userid=";
     String LIST_UNASSIGNED_CONTACT = "/cgi-bin/externalcontact/get_unassigned_list";
+    @Deprecated
     String TRANSFER_UNASSIGNED_CONTACT = "/cgi-bin/externalcontact/transfer";
+    String TRANSFER_CUSTOMER = "/cgi-bin/externalcontact/transfer_customer";
+    String TRANSFER_RESULT = "/cgi-bin/externalcontact/transfer_result";
+    String RESIGNED_TRANSFER_CUSTOMER = "/cgi-bin/externalcontact/resigned/transfer_customer";
+    String RESIGNED_TRANSFER_RESULT = "/cgi-bin/externalcontact/resigned/transfer_result";
     String GROUP_CHAT_LIST = "/cgi-bin/externalcontact/groupchat/list";
     String GROUP_CHAT_INFO = "/cgi-bin/externalcontact/groupchat/get";
+    String GROUP_CHAT_TRANSFER = "/cgi-bin/externalcontact/groupchat/transfer";
     String LIST_USER_BEHAVIOR_DATA = "/cgi-bin/externalcontact/get_user_behavior_data";
     String LIST_GROUP_CHAT_DATA = "/cgi-bin/externalcontact/groupchat/statistic";
     String ADD_MSG_TEMPLATE = "/cgi-bin/externalcontact/add_msg_template";
diff --git a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpExternalContactServiceImplTest.java b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpExternalContactServiceImplTest.java
index 4b6221d175..8869a6a02b 100644
--- a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpExternalContactServiceImplTest.java
+++ b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/WxCpExternalContactServiceImplTest.java
@@ -16,6 +16,7 @@
 import org.testng.annotations.Test;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.Date;
 import java.util.List;
 
@@ -196,13 +197,62 @@ public void testTransferExternalContact() {
   }
 
   @Test
-  public void testListGroupChat() {
+  public void testTransferCustomer() throws WxErrorException {
+    WxCpUserTransferCustomerReq req = new WxCpUserTransferCustomerReq();
+    req.setExternalUserid(Collections.emptyList());
+    req.setHandOverUserid("123");
+    req.setTakeOverUserid("234");
+    WxCpBaseResp result = this.wxCpService.getExternalContactService().transferCustomer(req);
+
+    System.out.println(result);
+    assertNotNull(result);
+  }
+
+  @Test
+  public void testTrnsferResult() throws WxErrorException {
+    WxCpUserTransferResultResp result = this.wxCpService.getExternalContactService().transferResult("123", "234", "");
+    System.out.println(result);
+    assertNotNull(result);
+  }
+
+  @Test
+  public void testresignedTransferCustomer() throws WxErrorException {
+    WxCpUserTransferCustomerReq req = new WxCpUserTransferCustomerReq();
+    req.setExternalUserid(Collections.emptyList());
+    req.setHandOverUserid("123");
+    req.setTakeOverUserid("234");
+    WxCpBaseResp result = this.wxCpService.getExternalContactService().resignedTransferCustomer(req);
+
+    System.out.println(result);
+    assertNotNull(result);
+  }
+
+  @Test
+  public void testresignedTrnsferResult() throws WxErrorException {
+    WxCpUserTransferResultResp result = this.wxCpService.getExternalContactService().resignedTransferResult("123", "234", "");
+    System.out.println(result);
+    assertNotNull(result);
+  }
+
+  @Test
+  public void testListGroupChat() throws WxErrorException {
+    WxCpUserExternalGroupChatList result = this.wxCpService.getExternalContactService().listGroupChat(0, 100 ,0,new String[1],new String[1]);
+    System.out.println(result);
+    assertNotNull(result);
   }
 
   @Test
   public void testGetGroupChat() {
   }
 
+  @Test
+  public void testTransferGroupChat() throws WxErrorException {
+    String[] str = {"wri1_QEAAATfnZl_VJ4hlQda0e4Mgf1A"};
+    WxCpUserExternalGroupChatTransferResp result = this.wxCpService.getExternalContactService().transferGroupChat(str, "123");
+    System.out.println(result);
+    assertNotNull(result);
+  }
+
   @Test
   public void testGetUserBehaviorStatistic() {
   }

From 1e64a7f7b3e2ecc45c57180bbc16896ca7e4e735 Mon Sep 17 00:00:00 2001
From: arthur0201 <704538660@qq.com>
Date: Wed, 23 Jun 2021 13:47:24 +0800
Subject: [PATCH 3/6] =?UTF-8?q?:new:=20#2161=20=E3=80=90=E5=85=AC=E4=BC=97?=
 =?UTF-8?q?=E5=8F=B7=E3=80=91=E5=BE=AE=E4=BF=A1=E6=8E=A8=E9=80=81=E6=B6=88?=
 =?UTF-8?q?=E6=81=AF=E7=B1=BB=E5=A2=9E=E5=8A=A0=E7=BE=A4=E5=8F=91=E6=8E=A5?=
 =?UTF-8?q?=E5=8F=A3=E4=BA=8B=E4=BB=B6=E7=9B=B8=E5=85=B3=E5=AD=97=E6=AE=B5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../java/me/chanjar/weixin/common/api/WxConsts.java   | 11 +++++++++++
 .../external/contact/WxCpExternalContactInfo.java     |  3 +++
 2 files changed, 14 insertions(+)

diff --git a/weixin-java-common/src/main/java/me/chanjar/weixin/common/api/WxConsts.java b/weixin-java-common/src/main/java/me/chanjar/weixin/common/api/WxConsts.java
index cfc7fc0f37..3e08462017 100644
--- a/weixin-java-common/src/main/java/me/chanjar/weixin/common/api/WxConsts.java
+++ b/weixin-java-common/src/main/java/me/chanjar/weixin/common/api/WxConsts.java
@@ -156,6 +156,12 @@ public static class MassMsgStatus {
     public static final String ERR_20013 = "err(20013)";
     public static final String ERR_22000 = "err(22000)";
     public static final String ERR_21000 = "err(21000)";
+    public static final String ERR_30001 = "err(30001)";
+    public static final String ERR_30002 = "err(30002)";
+    public static final String ERR_30003 = "err(30003)";
+    public static final String ERR_40001 = "err(40001)";
+    public static final String ERR_40002 = "err(40002)";
+
 
     /**
      * 群发反馈消息代码所对应的文字描述.
@@ -174,6 +180,11 @@ public static class MassMsgStatus {
       STATUS_DESC.put(ERR_20013, "涉嫌版权");
       STATUS_DESC.put(ERR_22000, "涉嫌互推_互相宣传");
       STATUS_DESC.put(ERR_21000, "涉嫌其他");
+      STATUS_DESC.put(ERR_30001, "原创校验出现系统错误且用户选择了被判为转载就不群发");
+      STATUS_DESC.put(ERR_30002, "原创校验被判定为不能群发");
+      STATUS_DESC.put(ERR_30003, "原创校验被判定为转载文且用户选择了被判为转载就不群发");
+      STATUS_DESC.put(ERR_40001, "管理员拒绝");
+      STATUS_DESC.put(ERR_40002, "管理员30分钟内无响应,超时");
     }
   }
 
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/contact/WxCpExternalContactInfo.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/contact/WxCpExternalContactInfo.java
index bd7229384c..468aa53f1e 100644
--- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/contact/WxCpExternalContactInfo.java
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/external/contact/WxCpExternalContactInfo.java
@@ -26,6 +26,9 @@ public class WxCpExternalContactInfo implements Serializable {
   @SerializedName("follow_user")
   private List followedUsers;
 
+  @SerializedName("next_cursor")
+  private String nextCursor;
+
   public static WxCpExternalContactInfo fromJson(String json) {
     return WxCpGsonBuilder.create().fromJson(json, WxCpExternalContactInfo.class);
   }

From 71289e4deadef7b1861356c56c61b4dd6e5629e2 Mon Sep 17 00:00:00 2001
From: pg 
Date: Wed, 23 Jun 2021 16:12:19 +0800
Subject: [PATCH 4/6] =?UTF-8?q?:bug:=20#2148=20=E3=80=90=E4=BC=81=E4=B8=9A?=
 =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E3=80=91=E4=BF=AE=E5=A4=8D=E4=BA=92=E8=81=94?=
 =?UTF-8?q?=E4=BC=81=E4=B8=9A=E6=B6=88=E6=81=AF=E6=8E=A8=E9=80=81=E6=8E=A5?=
 =?UTF-8?q?=E5=8F=A3=E8=BF=94=E5=9B=9E=E5=AD=97=E6=AE=B5=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../weixin/cp/api/WxCpMessageService.java     |  7 +---
 .../cp/api/impl/WxCpMessageServiceImpl.java   |  9 ++---
 .../WxCpLinkedCorpMessageSendResult.java      | 38 +++++++++++++++++++
 3 files changed, 43 insertions(+), 11 deletions(-)
 create mode 100644 weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/message/WxCpLinkedCorpMessageSendResult.java

diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpMessageService.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpMessageService.java
index fae0a6a0d6..1b66d00c07 100644
--- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpMessageService.java
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpMessageService.java
@@ -1,10 +1,7 @@
 package me.chanjar.weixin.cp.api;
 
 import me.chanjar.weixin.common.error.WxErrorException;
-import me.chanjar.weixin.cp.bean.message.WxCpLinkedCorpMessage;
-import me.chanjar.weixin.cp.bean.message.WxCpMessage;
-import me.chanjar.weixin.cp.bean.message.WxCpMessageSendResult;
-import me.chanjar.weixin.cp.bean.message.WxCpMessageSendStatistics;
+import me.chanjar.weixin.cp.bean.message.*;
 
 /**
  * 消息推送接口.
@@ -52,5 +49,5 @@ public interface WxCpMessageService {
    * @return the wx cp message send result
    * @throws WxErrorException the wx error exception
    */
-  WxCpMessageSendResult sendLinkedCorpMessage(WxCpLinkedCorpMessage message) throws WxErrorException;
+  WxCpLinkedCorpMessageSendResult sendLinkedCorpMessage(WxCpLinkedCorpMessage message) throws WxErrorException;
 }
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpMessageServiceImpl.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpMessageServiceImpl.java
index 07824c2183..9be2f60dfe 100644
--- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpMessageServiceImpl.java
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpMessageServiceImpl.java
@@ -5,10 +5,7 @@
 import me.chanjar.weixin.common.error.WxErrorException;
 import me.chanjar.weixin.cp.api.WxCpMessageService;
 import me.chanjar.weixin.cp.api.WxCpService;
-import me.chanjar.weixin.cp.bean.message.WxCpLinkedCorpMessage;
-import me.chanjar.weixin.cp.bean.message.WxCpMessage;
-import me.chanjar.weixin.cp.bean.message.WxCpMessageSendResult;
-import me.chanjar.weixin.cp.bean.message.WxCpMessageSendStatistics;
+import me.chanjar.weixin.cp.bean.message.*;
 import me.chanjar.weixin.cp.constant.WxCpApiPathConsts.Message;
 import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
 
@@ -40,13 +37,13 @@ public WxCpMessageSendStatistics getStatistics(int timeType) throws WxErrorExcep
   }
 
   @Override
-  public WxCpMessageSendResult sendLinkedCorpMessage(WxCpLinkedCorpMessage message) throws WxErrorException {
+  public WxCpLinkedCorpMessageSendResult sendLinkedCorpMessage(WxCpLinkedCorpMessage message) throws WxErrorException {
     Integer agentId = message.getAgentId();
     if (null == agentId) {
       message.setAgentId(this.cpService.getWxCpConfigStorage().getAgentId());
     }
 
-    return WxCpMessageSendResult.fromJson(this.cpService.post(this.cpService.getWxCpConfigStorage()
+    return WxCpLinkedCorpMessageSendResult.fromJson(this.cpService.post(this.cpService.getWxCpConfigStorage()
       .getApiUrl(Message.LINKEDCORP_MESSAGE_SEND), message.toJson()));
   }
 }
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/message/WxCpLinkedCorpMessageSendResult.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/message/WxCpLinkedCorpMessageSendResult.java
new file mode 100644
index 0000000000..2955df54c6
--- /dev/null
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/message/WxCpLinkedCorpMessageSendResult.java
@@ -0,0 +1,38 @@
+package me.chanjar.weixin.cp.bean.message;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Getter;
+import lombok.Setter;
+import me.chanjar.weixin.cp.bean.WxCpBaseResp;
+import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
+
+/**
+ * 互联企业的消息推送接口返回实体
+ *
+ * @author pg
+ * @date 2021年6月22日
+ */
+@Setter
+@Getter
+public class WxCpLinkedCorpMessageSendResult extends WxCpBaseResp {
+  private static final long serialVersionUID = 3990693822996824333L;
+
+  @SerializedName("invaliduser")
+  private String[] invalidUser;
+
+  @SerializedName("invalidparty")
+  private String[] invalidParty;
+
+  @SerializedName("invalidtag")
+  private String[] invalidTag;
+
+  @Override
+  public String toString() {
+    return WxCpGsonBuilder.create().toJson(this);
+  }
+
+  public static WxCpLinkedCorpMessageSendResult fromJson(String json) {
+    return WxCpGsonBuilder.create().fromJson(json, WxCpLinkedCorpMessageSendResult.class);
+  }
+
+}

From 591b2d83c61d78f4c77e870f6d674e75fd7f0be6 Mon Sep 17 00:00:00 2001
From: hywr <33077958+hywr@users.noreply.github.com>
Date: Wed, 23 Jun 2021 16:14:20 +0800
Subject: [PATCH 5/6] =?UTF-8?q?:new:=20#2163=20=E3=80=90=E5=BC=80=E6=94=BE?=
 =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E3=80=91=E5=A2=9E=E5=8A=A0=E6=9F=A5=E8=AF=A2?=
 =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E5=8F=AF=E5=9B=9E=E9=80=80=E7=89=88?=
 =?UTF-8?q?=E6=9C=AC=E7=9A=84=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../open/api/WxOpenComponentService.java      |   2 +
 .../weixin/open/api/WxOpenFastMaService.java  | 191 +----------------
 .../weixin/open/api/WxOpenMaBasicService.java | 199 ++++++++++++++++++
 .../weixin/open/api/WxOpenMaService.java      |  17 ++
 .../api/impl/WxOpenFastMaServiceImpl.java     |   2 +
 .../api/impl/WxOpenMaBasicServiceImpl.java    | 135 ++++++++++++
 .../open/api/impl/WxOpenMaServiceImpl.java    |  11 +
 .../open/bean/ma/WxOpenMaHistoryVersion.java  |  34 +++
 .../result/WxOpenMaHistoryVersionResult.java  |  29 +++
 9 files changed, 432 insertions(+), 188 deletions(-)
 create mode 100644 weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaBasicService.java
 create mode 100644 weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMaBasicServiceImpl.java
 create mode 100644 weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/ma/WxOpenMaHistoryVersion.java
 create mode 100644 weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenMaHistoryVersionResult.java

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 26dc2ba7f2..4c7f5b0911 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
@@ -148,7 +148,9 @@ public interface WxOpenComponentService {
    *
    * @param appid .
    * @return . wx fast ma service by appid
+   * @deprecated 2021-06-23 本接口原有方法并非仅快速创建小程序的专用接口,普通小程序授权到第三方平台皆可使用,所以请使用 {@link WxOpenMaBasicService} 类替代。获取方法: WxOpenMaService.getBasicService()
    */
+  @Deprecated
   WxOpenFastMaService getWxFastMaServiceByAppid(String appid);
 
   /**
diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenFastMaService.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenFastMaService.java
index 8710689cdc..2114d1a816 100644
--- a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenFastMaService.java
+++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenFastMaService.java
@@ -1,11 +1,6 @@
 package me.chanjar.weixin.open.api;
 
 import cn.binarywang.wx.miniapp.api.WxMaService;
-import me.chanjar.weixin.common.error.WxErrorException;
-import me.chanjar.weixin.open.bean.ma.WxFastMaCategory;
-import me.chanjar.weixin.open.bean.result.*;
-
-import java.util.List;
 
 /**
  * 
@@ -16,189 +11,9 @@
  *
  * @author Hipple
  * @date 2019/01/23
+ * @deprecated 2021-06-23 本接口原有方法并非仅快速创建小程序的专用接口,普通小程序授权到第三方平台皆可使用,所以请使用 {@link WxOpenMaBasicService} 类替代。获取方法: WxOpenComponentService.getWxMaServiceByAppid(maApppId).getBasicService()
  */
-public interface WxOpenFastMaService extends WxMaService {
-  /**
-   * 1 获取帐号基本信息.
-   */
-  String OPEN_GET_ACCOUNT_BASIC_INFO = "https://api.weixin.qq.com/cgi-bin/account/getaccountbasicinfo";
-
-  /**
-   * 2 小程序名称设置及改名.
-   */
-  String OPEN_SET_NICKNAME = "https://api.weixin.qq.com/wxa/setnickname";
-
-  /**
-   * 3 小程序改名审核状态查询.
-   */
-  String OPEN_API_WXA_QUERYNICKNAME = "https://api.weixin.qq.com/wxa/api_wxa_querynickname";
-
-  /**
-   * 4 微信认证名称检测.
-   */
-  String OPEN_CHECK_WX_VERIFY_NICKNAME = "https://api.weixin.qq.com/cgi-bin/wxverify/checkwxverifynickname";
-
-  /**
-   * 5 修改头像.
-   */
-  String OPEN_MODIFY_HEADIMAGE = "https://api.weixin.qq.com/cgi-bin/account/modifyheadimage";
-
-  /**
-   * 6修改功能介绍.
-   */
-  String OPEN_MODIFY_SIGNATURE = "https://api.weixin.qq.com/cgi-bin/account/modifysignature";
-
-  /**
-   * 7 换绑小程序管理员接口.
-   */
-  String OPEN_COMPONENT_REBIND_ADMIN = "https://api.weixin.qq.com/cgi-bin/account/componentrebindadmin";
-
-  /**
-   * 8.1 获取账号可以设置的所有类目
-   */
-  String OPEN_GET_ALL_CATEGORIES = "https://api.weixin.qq.com/cgi-bin/wxopen/getallcategories";
-  /**
-   * 8.2 添加类目
-   */
-  String OPEN_ADD_CATEGORY = "https://api.weixin.qq.com/cgi-bin/wxopen/addcategory";
-  /**
-   * 8.3 删除类目
-   */
-  String OPEN_DELETE_CATEGORY = "https://api.weixin.qq.com/cgi-bin/wxopen/deletecategory";
-  /**
-   * 8.4 获取账号已经设置的所有类目
-   */
-  String OPEN_GET_CATEGORY = "https://api.weixin.qq.com/cgi-bin/wxopen/getcategory";
-  /**
-   * 8.5 修改类目
-   */
-  String OPEN_MODIFY_CATEGORY = "https://api.weixin.qq.com/cgi-bin/wxopen/modifycategory";
-
-
-  /**
-   * 1.获取小程序的信息
-   *
-   * @return .
-   * @throws WxErrorException .
-   */
-  WxFastMaAccountBasicInfoResult getAccountBasicInfo() throws WxErrorException;
-
-  /**
-   * 2.小程序名称设置及改名
-   * 
-   *      若接口未返回audit_id,说明名称已直接设置成功,无需审核;若返回audit_id则名称正在审核中。
-   *  
- * - * @param nickname 昵称 - * @param idCard 身份证照片–临时素材mediaid(个人号必填) - * @param license 组织机构代码证或营业执照–临时素材mediaid(组织号必填) - * @param namingOtherStuff1 其他证明材料---临时素材 mediaid - * @param namingOtherStuff2 其他证明材料---临时素材 mediaid - * @return . - * @throws WxErrorException . - */ - WxFastMaSetNickameResult setNickname(String nickname, String idCard, String license, String namingOtherStuff1, - String namingOtherStuff2) throws WxErrorException; - - /** - * 3 小程序改名审核状态查询 - * - * @param auditId 审核单id - * @return . - * @throws WxErrorException . - */ - WxFastMaQueryNicknameStatusResult querySetNicknameStatus(String auditId) throws WxErrorException; - - /** - * 4. 微信认证名称检测 - * - * @param nickname 名称 - * @return . - * @throws WxErrorException . - */ - WxFastMaCheckNickameResult checkWxVerifyNickname(String nickname) throws WxErrorException; - - /** - * 5.修改头像 - *
-   *     图片格式只支持:BMP、JPEG、JPG、GIF、PNG,大小不超过2M
-   *      注:实际头像始终为正方形
-   * 
- * - * @param headImgMediaId 头像素材media_id - * @param x1 裁剪框左上角x坐标(取值范围:[0, 1]) - * @param y1 裁剪框左上角y坐标(取值范围:[0, 1]) - * @param x2 裁剪框右下角x坐标(取值范围:[0, 1]) - * @param y2 裁剪框右下角y坐标(取值范围:[0, 1]) - * @return . - * @throws WxErrorException . - */ - WxOpenResult modifyHeadImage(String headImgMediaId, float x1, float y1, float x2, float y2) throws WxErrorException; - - /** - * 6.修改功能介绍 - * - * @param signature 简介:4-120字 - * @return . - * @throws WxErrorException . - */ - WxOpenResult modifySignature(String signature) throws WxErrorException; - - /** - * 7.3 管理员换绑 - * - * @param taskId 换绑管理员任务序列号(公众平台最终点击提交回跳到第三方平台时携带) - * @return . - * @throws WxErrorException . - */ - WxOpenResult componentRebindAdmin(String taskId) throws WxErrorException; - - /** - * 8.1 获取账号可以设置的所有类目 - *
-   *     因为不同类目含有特定字段
-   *     目前没有完整的类目信息数据
-   *     为保证兼容性,放弃将response转换为实体
-   * 
- * - * @return . - * @throws WxErrorException . - */ - String getAllCategories() throws WxErrorException; - - /** - * 8.2添加类目 - * - * @param categoryList 类目列表 - * @return . - * @throws WxErrorException . - */ - WxOpenResult addCategory(List categoryList) throws WxErrorException; - - /** - * 8.3删除类目 - * - * @param first 一级类目ID - * @param second 二级类目ID - * @return . - * @throws WxErrorException . - */ - WxOpenResult deleteCategory(int first, int second) throws WxErrorException; - - /** - * 8.4获取账号已经设置的所有类目 - * - * @return . - * @throws WxErrorException . - */ - WxFastMaBeenSetCategoryResult getCategory() throws WxErrorException; +@Deprecated +public interface WxOpenFastMaService extends WxOpenMaBasicService, WxMaService { - /** - * 8.5修改类目 - * - * @param category 实体 - * @return . - * @throws WxErrorException . - */ - WxOpenResult modifyCategory(WxFastMaCategory category) throws WxErrorException; } diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaBasicService.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaBasicService.java new file mode 100644 index 0000000000..194da4b9b3 --- /dev/null +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaBasicService.java @@ -0,0 +1,199 @@ +package me.chanjar.weixin.open.api; + +import me.chanjar.weixin.common.error.WxErrorException; +import me.chanjar.weixin.open.bean.ma.WxFastMaCategory; +import me.chanjar.weixin.open.bean.result.*; + +import java.util.List; + +/** + * 微信第三方平台 小程序基础信息接口 (小程序名称、头像、描述、类目等信息设置) + * https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/category/getallcategories.html + * + * @author 广州跨界 + */ +public interface WxOpenMaBasicService { + /** + * 1 获取帐号基本信息. + */ + String OPEN_GET_ACCOUNT_BASIC_INFO = "https://api.weixin.qq.com/cgi-bin/account/getaccountbasicinfo"; + + /** + * 2 小程序名称设置及改名. + */ + String OPEN_SET_NICKNAME = "https://api.weixin.qq.com/wxa/setnickname"; + + /** + * 3 小程序改名审核状态查询. + */ + String OPEN_API_WXA_QUERYNICKNAME = "https://api.weixin.qq.com/wxa/api_wxa_querynickname"; + + /** + * 4 微信认证名称检测. + */ + String OPEN_CHECK_WX_VERIFY_NICKNAME = "https://api.weixin.qq.com/cgi-bin/wxverify/checkwxverifynickname"; + + /** + * 5 修改头像. + */ + String OPEN_MODIFY_HEADIMAGE = "https://api.weixin.qq.com/cgi-bin/account/modifyheadimage"; + + /** + * 6修改功能介绍. + */ + String OPEN_MODIFY_SIGNATURE = "https://api.weixin.qq.com/cgi-bin/account/modifysignature"; + + /** + * 7 换绑小程序管理员接口. + */ + String OPEN_COMPONENT_REBIND_ADMIN = "https://api.weixin.qq.com/cgi-bin/account/componentrebindadmin"; + + /** + * 8.1 获取账号可以设置的所有类目 + */ + String OPEN_GET_ALL_CATEGORIES = "https://api.weixin.qq.com/cgi-bin/wxopen/getallcategories"; + /** + * 8.2 添加类目 + */ + String OPEN_ADD_CATEGORY = "https://api.weixin.qq.com/cgi-bin/wxopen/addcategory"; + /** + * 8.3 删除类目 + */ + String OPEN_DELETE_CATEGORY = "https://api.weixin.qq.com/cgi-bin/wxopen/deletecategory"; + /** + * 8.4 获取账号已经设置的所有类目 + */ + String OPEN_GET_CATEGORY = "https://api.weixin.qq.com/cgi-bin/wxopen/getcategory"; + /** + * 8.5 修改类目 + */ + String OPEN_MODIFY_CATEGORY = "https://api.weixin.qq.com/cgi-bin/wxopen/modifycategory"; + + + /** + * 1.获取小程序的信息 + * + * @return . + * @throws WxErrorException . + */ + WxFastMaAccountBasicInfoResult getAccountBasicInfo() throws WxErrorException; + + /** + * 2.小程序名称设置及改名 + *
+   *      若接口未返回audit_id,说明名称已直接设置成功,无需审核;若返回audit_id则名称正在审核中。
+   *  
+ * + * @param nickname 昵称 + * @param idCard 身份证照片–临时素材mediaid(个人号必填) + * @param license 组织机构代码证或营业执照–临时素材mediaid(组织号必填) + * @param namingOtherStuff1 其他证明材料---临时素材 mediaid + * @param namingOtherStuff2 其他证明材料---临时素材 mediaid + * @return . + * @throws WxErrorException . + */ + WxFastMaSetNickameResult setNickname(String nickname, String idCard, String license, String namingOtherStuff1, + String namingOtherStuff2) throws WxErrorException; + + /** + * 3 小程序改名审核状态查询 + * + * @param auditId 审核单id + * @return . + * @throws WxErrorException . + */ + WxFastMaQueryNicknameStatusResult querySetNicknameStatus(String auditId) throws WxErrorException; + + /** + * 4. 微信认证名称检测 + * + * @param nickname 名称 + * @return . + * @throws WxErrorException . + */ + WxFastMaCheckNickameResult checkWxVerifyNickname(String nickname) throws WxErrorException; + + /** + * 5.修改头像 + *
+   *     图片格式只支持:BMP、JPEG、JPG、GIF、PNG,大小不超过2M
+   *      注:实际头像始终为正方形
+   * 
+ * + * @param headImgMediaId 头像素材media_id + * @param x1 裁剪框左上角x坐标(取值范围:[0, 1]) + * @param y1 裁剪框左上角y坐标(取值范围:[0, 1]) + * @param x2 裁剪框右下角x坐标(取值范围:[0, 1]) + * @param y2 裁剪框右下角y坐标(取值范围:[0, 1]) + * @return . + * @throws WxErrorException . + */ + WxOpenResult modifyHeadImage(String headImgMediaId, float x1, float y1, float x2, float y2) throws WxErrorException; + + /** + * 6.修改功能介绍 + * + * @param signature 简介:4-120字 + * @return . + * @throws WxErrorException . + */ + WxOpenResult modifySignature(String signature) throws WxErrorException; + + /** + * 7.3 管理员换绑 + * + * @param taskId 换绑管理员任务序列号(公众平台最终点击提交回跳到第三方平台时携带) + * @return . + * @throws WxErrorException . + */ + WxOpenResult componentRebindAdmin(String taskId) throws WxErrorException; + + /** + * 8.1 获取账号可以设置的所有类目 + *
+   *     因为不同类目含有特定字段
+   *     目前没有完整的类目信息数据
+   *     为保证兼容性,放弃将response转换为实体
+   * 
+ * + * @return . + * @throws WxErrorException . + */ + String getAllCategories() throws WxErrorException; + + /** + * 8.2添加类目 + * + * @param categoryList 类目列表 + * @return . + * @throws WxErrorException . + */ + WxOpenResult addCategory(List categoryList) throws WxErrorException; + + /** + * 8.3删除类目 + * + * @param first 一级类目ID + * @param second 二级类目ID + * @return . + * @throws WxErrorException . + */ + WxOpenResult deleteCategory(int first, int second) throws WxErrorException; + + /** + * 8.4获取账号已经设置的所有类目 + * + * @return . + * @throws WxErrorException . + */ + WxFastMaBeenSetCategoryResult getCategory() throws WxErrorException; + + /** + * 8.5修改类目 + * + * @param category 实体 + * @return . + * @throws WxErrorException . + */ + WxOpenResult modifyCategory(WxFastMaCategory category) throws WxErrorException; +} diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaService.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaService.java index ccaeeff019..9732e614ac 100644 --- a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaService.java +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaService.java @@ -452,6 +452,16 @@ WxOpenMaDomainResult modifyDomain(String action, List requestDomains, Li */ WxOpenResult revertCodeRelease() throws WxErrorException; + /** + * 获取可回退的小程序版本 + * 调用本接口可以获取可回退的小程序版本(最多保存最近发布或回退的5个版本 + * 文档地址: https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/code/get_history_version.html + * + * @return 历史版本信息 + * @throws WxErrorException 如果调用微信接口失败抛出此异常 + */ + WxOpenMaHistoryVersionResult getHistoryVersion() throws WxErrorException; + /** * 15. 小程序审核撤回 *

@@ -583,4 +593,11 @@ WxOpenMaDomainResult modifyDomain(String action, List requestDomains, Li * @throws WxErrorException the wx error exception */ WxOpenResult publishQrcodeJump(String prefix) throws WxErrorException; + + /** + * 小程序基础信息服务 (小程序名称、头像、描述、类目等信息设置) + * + * @return 小程序基础信息服务 + */ + WxOpenMaBasicService getBasicService(); } diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenFastMaServiceImpl.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenFastMaServiceImpl.java index 2cea9530bb..f5f2160d21 100644 --- a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenFastMaServiceImpl.java +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenFastMaServiceImpl.java @@ -20,7 +20,9 @@ * * @author Hipple * @since 2019/1/23 15:27 + * @deprecated 请使用 {@link WxOpenMaServiceImpl} 替代 */ +@Deprecated public class WxOpenFastMaServiceImpl extends WxMaServiceImpl implements WxOpenFastMaService { private final WxOpenComponentService wxOpenComponentService; private final WxMaConfig wxMaConfig; diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMaBasicServiceImpl.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMaBasicServiceImpl.java new file mode 100644 index 0000000000..4e4db75257 --- /dev/null +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMaBasicServiceImpl.java @@ -0,0 +1,135 @@ +package me.chanjar.weixin.open.api.impl; + +import cn.binarywang.wx.miniapp.api.WxMaService; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import me.chanjar.weixin.common.error.WxErrorException; +import me.chanjar.weixin.open.api.WxOpenMaBasicService; +import me.chanjar.weixin.open.bean.ma.WxFastMaCategory; +import me.chanjar.weixin.open.bean.result.*; +import me.chanjar.weixin.open.util.json.WxOpenGsonBuilder; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 微信第三方平台 小程序基础信息接口 + * + * @author 广州跨界 + */ +public class WxOpenMaBasicServiceImpl implements WxOpenMaBasicService { + + private final WxMaService wxMaService; + + public WxOpenMaBasicServiceImpl(WxMaService wxMaService) { + this.wxMaService = wxMaService; + } + + + @Override + public WxFastMaAccountBasicInfoResult getAccountBasicInfo() throws WxErrorException { + String response = wxMaService.get(OPEN_GET_ACCOUNT_BASIC_INFO, ""); + return WxOpenGsonBuilder.create().fromJson(response, WxFastMaAccountBasicInfoResult.class); + } + + @Override + public WxFastMaSetNickameResult setNickname(String nickname, String idCard, String license, String namingOtherStuff1, String namingOtherStuff2) throws WxErrorException { + JsonObject params = new JsonObject(); + params.addProperty("nick_name", nickname); + params.addProperty("id_card", idCard); + params.addProperty("license", license); + params.addProperty("naming_other_stuff_1", namingOtherStuff1); + params.addProperty("naming_other_stuff_2", namingOtherStuff2); + String response = wxMaService.post(OPEN_SET_NICKNAME, params); + return WxOpenGsonBuilder.create().fromJson(response, WxFastMaSetNickameResult.class); + } + + @Override + public WxFastMaQueryNicknameStatusResult querySetNicknameStatus(String auditId) throws WxErrorException { + JsonObject params = new JsonObject(); + params.addProperty("audit_id", auditId); + String response = wxMaService.post(OPEN_API_WXA_QUERYNICKNAME, params); + return WxOpenGsonBuilder.create().fromJson(response, WxFastMaQueryNicknameStatusResult.class); + } + + @Override + public WxFastMaCheckNickameResult checkWxVerifyNickname(String nickname) throws WxErrorException { + JsonObject params = new JsonObject(); + params.addProperty("nick_name", nickname); + String response = wxMaService.post(OPEN_CHECK_WX_VERIFY_NICKNAME, params); + return WxOpenGsonBuilder.create().fromJson(response, WxFastMaCheckNickameResult.class); + } + + @Override + public WxOpenResult modifyHeadImage(String headImgMediaId, float x1, float y1, float x2, float y2) throws WxErrorException { + JsonObject params = new JsonObject(); + params.addProperty("head_img_media_id", headImgMediaId); + params.addProperty("x1", x1); + params.addProperty("y1", y1); + params.addProperty("x2", x2); + params.addProperty("y2", y2); + String response = wxMaService.post(OPEN_MODIFY_HEADIMAGE, params); + return WxOpenGsonBuilder.create().fromJson(response, WxOpenResult.class); + } + + @Override + public WxOpenResult modifySignature(String signature) throws WxErrorException { + JsonObject params = new JsonObject(); + params.addProperty("signature", signature); + String response = wxMaService.post(OPEN_MODIFY_SIGNATURE, params); + return WxOpenGsonBuilder.create().fromJson(response, WxOpenResult.class); + } + + @Override + public WxOpenResult componentRebindAdmin(String taskid) throws WxErrorException { + JsonObject params = new JsonObject(); + params.addProperty("taskid", taskid); + String response = wxMaService.post(OPEN_COMPONENT_REBIND_ADMIN, params); + return WxOpenGsonBuilder.create().fromJson(response, WxOpenResult.class); + } + + @Override + public String getAllCategories() throws WxErrorException { + return wxMaService.get(OPEN_GET_ALL_CATEGORIES, ""); + } + + @Override + public WxOpenResult addCategory(List categoryList) throws WxErrorException { + Map map = new HashMap<>(); + map.put("categories", categoryList); + String response = wxMaService.post(OPEN_ADD_CATEGORY, WxOpenGsonBuilder.create().toJson(map)); + return WxOpenGsonBuilder.create().fromJson(response, WxOpenResult.class); + } + + @Override + public WxOpenResult deleteCategory(int first, int second) throws WxErrorException { + JsonObject params = new JsonObject(); + params.addProperty("first", first); + params.addProperty("second", second); + String response = wxMaService.post(OPEN_DELETE_CATEGORY, params); + return WxOpenGsonBuilder.create().fromJson(response, WxOpenResult.class); + } + + @Override + public WxFastMaBeenSetCategoryResult getCategory() throws WxErrorException { + String response = wxMaService.get(OPEN_GET_CATEGORY, ""); + return WxOpenGsonBuilder.create().fromJson(response, WxFastMaBeenSetCategoryResult.class); + } + + @Override + public WxOpenResult modifyCategory(WxFastMaCategory category) throws WxErrorException { + String response = wxMaService.post(OPEN_MODIFY_CATEGORY, category); + return WxOpenGsonBuilder.create().fromJson(response, WxOpenResult.class); + } + + private JsonArray toJsonArray(List strList) { + JsonArray jsonArray = new JsonArray(); + if (strList != null && !strList.isEmpty()) { + for (String str : strList) { + jsonArray.add(str); + } + } + return jsonArray; + } +} diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMaServiceImpl.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMaServiceImpl.java index 24d9e23414..9febf639f4 100644 --- a/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMaServiceImpl.java +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMaServiceImpl.java @@ -7,8 +7,10 @@ import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder; import com.google.gson.JsonArray; import com.google.gson.JsonObject; +import lombok.Getter; import me.chanjar.weixin.common.error.WxErrorException; import me.chanjar.weixin.open.api.WxOpenComponentService; +import me.chanjar.weixin.open.api.WxOpenMaBasicService; import me.chanjar.weixin.open.api.WxOpenMaService; import me.chanjar.weixin.open.bean.ma.WxMaOpenCommitExtInfo; import me.chanjar.weixin.open.bean.ma.WxMaQrcodeParam; @@ -34,11 +36,14 @@ public class WxOpenMaServiceImpl extends WxMaServiceImpl implements WxOpenMaServ private final WxOpenComponentService wxOpenComponentService; private final WxMaConfig wxMaConfig; private final String appId; + @Getter + private final WxOpenMaBasicService basicService; public WxOpenMaServiceImpl(WxOpenComponentService wxOpenComponentService, String appId, WxMaConfig wxMaConfig) { this.wxOpenComponentService = wxOpenComponentService; this.appId = appId; this.wxMaConfig = wxMaConfig; + this.basicService = new WxOpenMaBasicServiceImpl(this); initHttp(); } @@ -247,6 +252,12 @@ public WxOpenResult revertCodeRelease() throws WxErrorException { return WxMaGsonBuilder.create().fromJson(response, WxOpenResult.class); } + @Override + public WxOpenMaHistoryVersionResult getHistoryVersion() throws WxErrorException { + String response = get(API_REVERT_CODE_RELEASE, "action=get_history_version"); + return WxMaGsonBuilder.create().fromJson(response, WxOpenMaHistoryVersionResult.class); + } + @Override public WxOpenResult undoCodeAudit() throws WxErrorException { String response = get(API_UNDO_CODE_AUDIT, null); diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/ma/WxOpenMaHistoryVersion.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/ma/WxOpenMaHistoryVersion.java new file mode 100644 index 0000000000..6ef41c8bef --- /dev/null +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/ma/WxOpenMaHistoryVersion.java @@ -0,0 +1,34 @@ +package me.chanjar.weixin.open.bean.ma; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import me.chanjar.weixin.open.util.json.WxOpenGsonBuilder; + +import java.io.Serializable; + +/** + * 微信开放平台小程序 可回退的小程序版本 + * + * @author 广州跨界 + */ +@Data +public class WxOpenMaHistoryVersion implements Serializable { + private static final long serialVersionUID = 98923601148793365L; + + @SerializedName("app_version") + private Integer appVersion; + + @SerializedName("user_version") + private String userVersion; + + @SerializedName("user_desc") + private String userDesc; + + @SerializedName("commit_time") + private Integer commitTime; + + @Override + public String toString() { + return WxOpenGsonBuilder.create().toJson(this); + } +} diff --git a/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenMaHistoryVersionResult.java b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenMaHistoryVersionResult.java new file mode 100644 index 0000000000..61b9f5dddf --- /dev/null +++ b/weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenMaHistoryVersionResult.java @@ -0,0 +1,29 @@ +package me.chanjar.weixin.open.bean.result; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import me.chanjar.weixin.open.bean.ma.WxOpenMaHistoryVersion; +import me.chanjar.weixin.open.util.json.WxOpenGsonBuilder; + +import java.util.List; + +/** + * 微信开放平台小程序 可回退的小程序版本 返回 + * + * @author 广州跨界 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class WxOpenMaHistoryVersionResult extends WxOpenResult { + private static final long serialVersionUID = 4102311851687901079L; + + @SerializedName("template_list") + List templateList; + + @Override + public String toString() { + return WxOpenGsonBuilder.create().toJson(this); + } + +} From b6d4b5e9022626870298478c4c76fbf135168c4f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 24 Jun 2021 10:44:43 +0800 Subject: [PATCH 6/6] :arrow_up: Bump jetty-server from 9.4.38.v20210224 to 9.4.41.v20210516 (#2164) Bumps [jetty-server](https://github.com/eclipse/jetty.project) from 9.4.38.v20210224 to 9.4.41.v20210516. - [Release notes](https://github.com/eclipse/jetty.project/releases) - [Commits](https://github.com/eclipse/jetty.project/compare/jetty-9.4.38.v20210224...jetty-9.4.41.v20210516) --- updated-dependencies: - dependency-name: org.eclipse.jetty:jetty-server dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 83469f8ee5..9c230a0b66 100644 --- a/pom.xml +++ b/pom.xml @@ -119,7 +119,7 @@ UTF-8 4.5.13 - 9.4.38.v20210224 + 9.4.41.v20210516