From 63131ec61f5a7a150fb6e9ea6805af57be48f38f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E6=A2=81?= <77617245+llw5181@users.noreply.github.com> Date: Tue, 29 Oct 2024 14:44:06 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20#3394=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=E2=80=9C=E5=AE=A1?= =?UTF-8?q?=E6=89=B9=E7=8A=B6=E6=80=81=E9=80=9A=E7=9F=A5=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E2=80=9D=E4=BC=81=E5=BE=AE=E5=9B=9E=E8=B0=83XML=E5=BA=8F?= =?UTF-8?q?=E5=88=97=E5=8C=96=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cp/bean/message/WxCpXmlApprovalInfo.java | 12 +-- .../cp/bean/message/WxCpXmlMessageTest.java | 80 +++++++++++++++++++ 2 files changed, 86 insertions(+), 6 deletions(-) diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/message/WxCpXmlApprovalInfo.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/message/WxCpXmlApprovalInfo.java index c9e8ffa70..7193c7cf6 100644 --- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/message/WxCpXmlApprovalInfo.java +++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/message/WxCpXmlApprovalInfo.java @@ -91,19 +91,19 @@ public class WxCpXmlApprovalInfo implements Serializable { /** * 审批流程信息 */ - @XStreamImplicit(itemFieldName = "ApprovalNodes") + @XStreamAlias("ApprovalNodes") private List approvalNodes; /** * 抄送信息,可能有多个抄送人 */ - @XStreamImplicit(itemFieldName = "NotifyNodes") + @XStreamAlias("NotifyNodes") private List notifyNodes; /** * 抄送人信息 */ - @XStreamAlias("NotifyNodes") + @XStreamAlias("NotifyNode") @Data public static class NotifyNode implements Serializable { private static final long serialVersionUID = -979255011922209018L; @@ -141,7 +141,7 @@ public class WxCpXmlApprovalInfo implements Serializable { /** * 审批流程信息,可以有多个审批节点 */ - @XStreamAlias("ApprovalNodes") + @XStreamAlias("ApprovalNode") @Data public static class ApprovalNode implements Serializable { private static final long serialVersionUID = -979255011922209018L; @@ -167,7 +167,7 @@ public class WxCpXmlApprovalInfo implements Serializable { /** * 审批节点信息,当节点为标签或上级时,一个节点可能有多个分支 */ - @XStreamImplicit(itemFieldName = "Items") + @XStreamAlias("Items") private List items; } @@ -175,7 +175,7 @@ public class WxCpXmlApprovalInfo implements Serializable { /** * 审批节点分支,当节点为标签或上级时,一个节点可能有多个分支 */ - @XStreamAlias("Items") + @XStreamAlias("Item") @Data public static class Item implements Serializable { private static final long serialVersionUID = -979255011922209018L; diff --git a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/bean/message/WxCpXmlMessageTest.java b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/bean/message/WxCpXmlMessageTest.java index cb5a9b02e..04a4c6998 100644 --- a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/bean/message/WxCpXmlMessageTest.java +++ b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/bean/message/WxCpXmlMessageTest.java @@ -301,4 +301,84 @@ public class WxCpXmlMessageTest { System.out.println(XStreamTransformer.toXml(WxCpXmlMessage.class, wxCpXmlMessage)); } + + /** + * Test open approval change. + */ + public void testOpenApprovalChange() { + String xml = "\n" + + " \n" + + " \n" + + " 1527838022\n" + + " \n" + + " \n" + + " 1\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 1\n" + + " 1527837645\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 1\n" + + " 1\n" + + " 1\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 1\n" + + " \n" + + " 0\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 1\n" + + " 1\n" + + " 1\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 1\n" + + " \n" + + " 0\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 1\n" + + " \n" + + " 0\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 0\n" + + " \n" + + "\n"; + + WxCpXmlMessage wxCpXmlMessage = WxCpXmlMessage.fromXml(xml); + assertThat(wxCpXmlMessage).isNotNull(); + assertThat(wxCpXmlMessage.getApprovalInfo().getApprovalNodes()).isNotEmpty(); + assertThat(wxCpXmlMessage.getApprovalInfo().getApprovalNodes().get(0).getItems()).isNotEmpty(); + assertThat(wxCpXmlMessage.getApprovalInfo().getApprovalNodes().get(0).getItems().get(0).getItemName()).isNotEmpty(); + assertThat(wxCpXmlMessage.getApprovalInfo().getNotifyNodes().get(0).getItemName()).isNotEmpty(); + } }