@@ -301,4 +301,84 @@ public void testChangeContact() {
301
301
302
302
System .out .println (XStreamTransformer .toXml (WxCpXmlMessage .class , wxCpXmlMessage ));
303
303
}
304
+
305
+ /**
306
+ * Test open approval change.
307
+ */
308
+ public void testOpenApprovalChange () {
309
+ String xml = "<xml>\n " +
310
+ " <ToUserName><![CDATA[wwddddccc7775555aaa]]></ToUserName>\n " +
311
+ " <FromUserName><![CDATA[sys]]></FromUserName>\n " +
312
+ " <CreateTime>1527838022</CreateTime>\n " +
313
+ " <MsgType><![CDATA[event]]></MsgType>\n " +
314
+ " <Event><![CDATA[open_approval_change]]></Event>\n " +
315
+ " <AgentID>1</AgentID>\n " +
316
+ " <ApprovalInfo>\n " +
317
+ " <ThirdNo><![CDATA[201806010001]]></ThirdNo>\n " +
318
+ " <OpenSpName><![CDATA[付款]]></OpenSpName>\n " +
319
+ " <OpenTemplateId><![CDATA[1234567890]]></OpenTemplateId>\n " +
320
+ " <OpenSpStatus>1</OpenSpStatus>\n " +
321
+ " <ApplyTime>1527837645</ApplyTime>\n " +
322
+ " <ApplyUserName><![CDATA[xiaoming]]></ApplyUserName>\n " +
323
+ " <ApplyUserId><![CDATA[1]]></ApplyUserId>\n " +
324
+ " <ApplyUserParty><![CDATA[产品部]]></ApplyUserParty>\n " +
325
+ " <ApplyUserImage><![CDATA[http://www.qq.com/xxx.png]]></ApplyUserImage>\n " +
326
+ " <ApprovalNodes>\n " +
327
+ " <ApprovalNode>\n " +
328
+ " <NodeStatus>1</NodeStatus>\n " +
329
+ " <NodeAttr>1</NodeAttr>\n " +
330
+ " <NodeType>1</NodeType>\n " +
331
+ " <Items>\n " +
332
+ " <Item>\n " +
333
+ " <ItemName><![CDATA[xiaohong]]></ItemName>\n " +
334
+ " <ItemUserId><![CDATA[2]]></ItemUserId>\n " +
335
+ " <ItemImage><![CDATA[http://www.qq.com/xxx.png]]></ItemImage>\n " +
336
+ " <ItemStatus>1</ItemStatus>\n " +
337
+ " <ItemSpeech><![CDATA[]]></ItemSpeech>\n " +
338
+ " <ItemOpTime>0</ItemOpTime>\n " +
339
+ " </Item>\n " +
340
+ " </Items>\n " +
341
+ " </ApprovalNode>\n " +
342
+ " <ApprovalNode>\n " +
343
+ " <NodeStatus>1</NodeStatus>\n " +
344
+ " <NodeAttr>1</NodeAttr>\n " +
345
+ " <NodeType>1</NodeType>\n " +
346
+ " <Items>\n " +
347
+ " <Item>\n " +
348
+ " <ItemName><![CDATA[xiaohong]]></ItemName>\n " +
349
+ " <ItemUserId><![CDATA[2]]></ItemUserId>\n " +
350
+ " <ItemImage><![CDATA[http://www.qq.com/xxx.png]]></ItemImage>\n " +
351
+ " <ItemStatus>1</ItemStatus>\n " +
352
+ " <ItemSpeech><![CDATA[]]></ItemSpeech>\n " +
353
+ " <ItemOpTime>0</ItemOpTime>\n " +
354
+ " </Item>\n " +
355
+ " <Item>\n " +
356
+ " <ItemName><![CDATA[xiaohong]]></ItemName>\n " +
357
+ " <ItemUserId><![CDATA[2]]></ItemUserId>\n " +
358
+ " <ItemImage><![CDATA[http://www.qq.com/xxx.png]]></ItemImage>\n " +
359
+ " <ItemStatus>1</ItemStatus>\n " +
360
+ " <ItemSpeech><![CDATA[]]></ItemSpeech>\n " +
361
+ " <ItemOpTime>0</ItemOpTime>\n " +
362
+ " </Item>\n " +
363
+ " </Items>\n " +
364
+ " </ApprovalNode>\n " +
365
+ " </ApprovalNodes>\n " +
366
+ " <NotifyNodes>\n " +
367
+ " <NotifyNode>\n " +
368
+ " <ItemName><![CDATA[xiaogang]]></ItemName>\n " +
369
+ " <ItemUserId><![CDATA[3]]></ItemUserId>\n " +
370
+ " <ItemImage><![CDATA[http://www.qq.com/xxx.png]]></ItemImage>\n " +
371
+ " </NotifyNode>\n " +
372
+ " </NotifyNodes>\n " +
373
+ " <approverstep>0</approverstep>\n " +
374
+ " </ApprovalInfo>\n " +
375
+ "</xml>\n " ;
376
+
377
+ WxCpXmlMessage wxCpXmlMessage = WxCpXmlMessage .fromXml (xml );
378
+ assertThat (wxCpXmlMessage ).isNotNull ();
379
+ assertThat (wxCpXmlMessage .getApprovalInfo ().getApprovalNodes ()).isNotEmpty ();
380
+ assertThat (wxCpXmlMessage .getApprovalInfo ().getApprovalNodes ().get (0 ).getItems ()).isNotEmpty ();
381
+ assertThat (wxCpXmlMessage .getApprovalInfo ().getApprovalNodes ().get (0 ).getItems ().get (0 ).getItemName ()).isNotEmpty ();
382
+ assertThat (wxCpXmlMessage .getApprovalInfo ().getNotifyNodes ().get (0 ).getItemName ()).isNotEmpty ();
383
+ }
304
384
}
0 commit comments