@@ -95,4 +95,99 @@ public void testToJson() {
9595
9696 assertThat (request .toJson ()).isEqualTo (GsonParser .parse (json ).toString ());
9797 }
98+
99+ /**
100+ * Test to json with process.
101+ */
102+ @ Test
103+ public void testToJsonWithProcess () {
104+ String json = "{\n " +
105+ " \" creator_userid\" : \" WangXiaoMing\" ,\n " +
106+ " \" template_id\" : \" 3Tka1eD6v6JfzhDMqPd3aMkFdxqtJMc2ZRioeFXkaaa\" ,\n " +
107+ " \" use_template_approver\" :0,\n " +
108+ " \" process\" : {\n " +
109+ " \" node_list\" : [\n " +
110+ " {\n " +
111+ " \" type\" : 1,\n " +
112+ " \" apv_rel\" : 2,\n " +
113+ " \" userid\" : [\" WuJunJie\" ,\" WangXiaoMing\" ]\n " +
114+ " },\n " +
115+ " {\n " +
116+ " \" type\" : 1,\n " +
117+ " \" apv_rel\" : 1,\n " +
118+ " \" userid\" : [\" LiuXiaoGang\" ]\n " +
119+ " },\n " +
120+ " {\n " +
121+ " \" type\" : 2,\n " +
122+ " \" userid\" : [\" ZhangSan\" ,\" LiSi\" ]\n " +
123+ " }\n " +
124+ " ]\n " +
125+ " },\n " +
126+ " \" apply_data\" : {\n " +
127+ " \" contents\" : [\n " +
128+ " {\n " +
129+ " \" control\" : \" Text\" ,\n " +
130+ " \" id\" : \" Text-15111111111\" ,\n " +
131+ " \" value\" : {\n " +
132+ " \" text\" : \" 文本填写的内容\" \n " +
133+ " }\n " +
134+ " }\n " +
135+ " ]\n " +
136+ " },\n " +
137+ " \" summary_list\" : [\n " +
138+ " {\n " +
139+ " \" summary_info\" : [{\n " +
140+ " \" text\" : \" 摘要第1行\" ,\n " +
141+ " \" lang\" : \" zh_CN\" \n " +
142+ " }]\n " +
143+ " },\n " +
144+ " {\n " +
145+ " \" summary_info\" : [{\n " +
146+ " \" text\" : \" 摘要第2行\" ,\n " +
147+ " \" lang\" : \" zh_CN\" \n " +
148+ " }]\n " +
149+ " },\n " +
150+ " {\n " +
151+ " \" summary_info\" : [{\n " +
152+ " \" text\" : \" 摘要第3行\" ,\n " +
153+ " \" lang\" : \" zh_CN\" \n " +
154+ " }]\n " +
155+ " }\n " +
156+ " ]\n " +
157+ "}" ;
158+
159+ WxCpOaApplyEventRequest request = new WxCpOaApplyEventRequest ();
160+ request .setCreatorUserId ("WangXiaoMing" )
161+ .setTemplateId ("3Tka1eD6v6JfzhDMqPd3aMkFdxqtJMc2ZRioeFXkaaa" )
162+ .setUseTemplateApprover (0 )
163+ .setProcess (new WxCpOaApplyEventRequest .Process ()
164+ .setNodeList (Arrays .asList (
165+ new WxCpOaApplyEventRequest .ProcessNode ()
166+ .setType (1 )
167+ .setApvRel (2 )
168+ .setUserIds (new String []{"WuJunJie" , "WangXiaoMing" }),
169+ new WxCpOaApplyEventRequest .ProcessNode ()
170+ .setType (1 )
171+ .setApvRel (1 )
172+ .setUserIds (new String []{"LiuXiaoGang" }),
173+ new WxCpOaApplyEventRequest .ProcessNode ()
174+ .setType (2 )
175+ .setUserIds (new String []{"ZhangSan" , "LiSi" })
176+ )))
177+ .setApplyData (new WxCpOaApplyEventRequest .ApplyData ()
178+ .setContents (Collections .singletonList (new ApplyDataContent ()
179+ .setControl ("Text" ).setId ("Text-15111111111" ).setValue (new ContentValue ().setText ("文本填写的内容" )))))
180+ .setSummaryList (Arrays .asList (new SummaryInfo ()
181+ .setSummaryInfoData (Collections .singletonList (new SummaryInfo .SummaryInfoData ().setLang ("zh_CN" ).setText (
182+ "摘要第1行" ))),
183+ new SummaryInfo ()
184+ .setSummaryInfoData (Collections .singletonList (new SummaryInfo .SummaryInfoData ().setLang ("zh_CN" ).setText (
185+ "摘要第2行" ))),
186+ new SummaryInfo ()
187+ .setSummaryInfoData (Collections .singletonList (new SummaryInfo .SummaryInfoData ().setLang ("zh_CN" ).setText (
188+ "摘要第3行" )))))
189+ ;
190+
191+ assertThat (request .toJson ()).isEqualTo (GsonParser .parse (json ).toString ());
192+ }
98193}
0 commit comments