@TOC

获取到前端的json,对其进行分析

1、获取最外层前端json对应得JavaBean

(1)未分析格式的json串

首先我们获取到原始的json字符串

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
{
"type":"start",
"content":"所有人",
"properties":{
"title":"发起人124124",
"initiator":"ALL",
"nodeName":"发起人124124",
"withdrawSwitch":true,
"memberSet":[
{
"deptId":38165,
"nickName":"哈哈",
"userId":417586,
"userName":"baiboit"
}
],
"formOperates":[
{
"name":"单行输入框",
"key":"1598583241000_12287",
"type":"input",
"checkedList":[
"visibility"
]
},
{
"name":"单选框",
"key":"1598583242000_8033",
"type":"radio",
"checkedList":[
"visibility"
]
},
{
"name":"日期",
"key":"1598583244000_29500",
"type":"date",
"checkedList":[
"visibility"
]
}
]
},
"nodeId":"SID-55cf0a21-2ebc-febe-dc71-f5a629374be6",
"childNode":{
"type":"fill",
"content":"发起人自选",
"properties":{
"title":"填报人",
"menbers":{
"dep":[
{
"nodeId":4,
"deptId":4,
"deptName":"xxx研发部",
"parentDeptId":1
}
]
},
"userOptional":true,
"nodeName":"填报人",
"fillSetSwitch":false,
"memberSet":[
{
"deptId":38165,
"nickName":"哈哈",
"userId":417571,
"userName":"wuniting"
}
],
"memberSetOptional":[
{
"deptId":null,
"nickName":"",
"userId":null,
"userName":null
}
],
"circulationRules":"",
"processNodeTipForm":{
"arriveReminders":[

],
"UntreatedNum":"",
"UntreatedTime":"",
"AutoAlert":[

]
},
"formOperates":[
{
"name":"",
"type":"",
"key":"",
"checkedList":[
"visibility",
"write"
]
}
]
},
"nodeId":"SID-6745bda6-55fd-9029-ac2e-b6bf38e756db",
"prevId":"SID-55cf0a21-2ebc-febe-dc71-f5a629374be6",
"childNode":{
"type":"fill",
"content":"发起人自选",
"properties":{
"title":"填报人12323455",
"menbers":{
"dep":[
{
"nodeId":4,
"deptId":4,
"deptName":"xxx研发部",
"parentDeptId":1
}
]
},
"userOptional":true,
"nodeName":"填报人",
"fillSetSwitch":false,
"memberSet":[
{
"deptId":38165,
"nickName":"哈哈哈",
"userId":417557,
"userName":"zhangmiao"
}
],
"memberSetOptional":[
{
"deptId":null,
"nickName":"",
"userId":null,
"userName":null
}
],
"circulationRules":"renyi",
"processNodeTipForm":{
"arriveReminders":[
"shortMessage",
"mail"
],
"UntreatedNum":"30",
"UntreatedTime":"minutes",
"AutoAlert":[
"shortMessage"
]
},
"formOperates":[
{
"name":"单行输入框",
"key":"1598583241000_12287",
"type":"input",
"checkedList":[
"visibility"
]
},
{
"name":"单选框",
"key":"1598583242000_8033",
"type":"radio",
"checkedList":[
"visibility"
]
},
{
"name":"日期",
"key":"1598583244000_29500",
"type":"date",
"checkedList":[
"visibility"
]
}
]
},
"nodeId":"SID-2bbfe3a8-4c3b-a143-e644-6193fe141426",
"prevId":"SID-6745bda6-55fd-9029-ac2e-b6bf38e756db",
"childNode":{
"nodeId":"SID-990e8b6a-68d1-dcf9-9ad1-00f8d2ccdc6a",
"type":"approver",
"content":"发起人自选",
"properties":{
"title":"审批人123124",
"nodeName":"审批人",
"assigneeType":"optional",
"approverSetSwitch":false,
"memberSet":[
{
"deptId":38165,
"nickName":"哈哈哈",
"userId":417555,
"userName":"yuansong"
}
],
"memberSetOptional":[
{
"deptId":null,
"nickName":"",
"userId":null,
"userName":null
}
],
"fillSwitch":false,
"ccSetSwitch":false,
"approvalOpinions":"disable",
"backOff":{
"Switch":true,
"backOffState":false,
"backOffNode":"faqiren",
"btnName":"1213",
"surebackOffNode":"zhiding"
},
"transfer":{
"Switch":false,
"transferState":false,
"btnName":"",
"memberSet":[
{
"deptId":38165,
"nickName":"哈哈哈哈",
"userId":417555,
"userName":"yuansong"
}
]
},
"addApproverPerson":{
"Switch":false,
"addApproverState":false,
"btnName":"",
"memberSet":[
{
"deptId":38165,
"nickName":"哈哈哈哈哈",
"userId":417555,
"userName":"yuansong"
}
]
},
"addCcPerson":{
"Switch":false,
"addCcState":false,
"btnName":"",
"memberSet":[
{
"deptId":38165,
"nickName":"哈哈哈哈哈",
"userId":417555,
"userName":"yuansong"
}
]
},
"addEnclosurePerson":{
"Switch":false,
"addEncloureState":false,
"btnName":"",
"findEnclosurePower":[

]
},
"circulationRules":"renyi",
"processNodeTipForm":{
"arriveReminders":[
"shortMessage",
"mail"
],
"UntreatedNum":"40",
"UntreatedTime":"minutes",
"AutoAlert":[
"shortMessage"
]
},
"formOperates":[
{
"name":"单行输入框",
"key":"1598583241000_12287",
"type":"input",
"checkedList":[
"visibility"
]
},
{
"name":"单选框",
"key":"1598583242000_8033",
"type":"radio",
"checkedList":[
"visibility"
]
},
{
"name":"日期",
"key":"1598583244000_29500",
"type":"date",
"checkedList":[
"visibility"
]
}
]
},
"prevId":"SID-2bbfe3a8-4c3b-a143-e644-6193fe141426",
"childNode":{
"nodeId":"SID-8c2cef4a-450c-a248-8328-bfaae369232a",
"type":"approver",
"content":"发起人自选",
"properties":{
"title":"审批人212",
"nodeName":"审批人",
"assigneeType":"optional",
"approverSetSwitch":false,
"memberSet":[
{
"deptId":38165,
"nickName":"哈哈哈",
"userId":440815,
"userName":"mofei"
}
],
"memberSetOptional":[
{
"deptId":null,
"nickName":"",
"userId":null,
"userName":null
}
],
"fillSwitch":false,
"ccSetSwitch":false,
"approvalOpinions":"required",
"backOff":{
"Switch":false,
"backOffState":false,
"backOffNode":"",
"btnName":"",
"surebackOffNode":""
},
"transfer":{
"Switch":false,
"transferState":false,
"btnName":"",
"memberSet":[
{
"deptId":38165,
"nickName":"哈哈哈哈哈",
"userId":440815,
"userName":"mofei"
}
]
},
"addApproverPerson":{
"Switch":false,
"addApproverState":false,
"btnName":"",
"memberSet":[
{
"deptId":38165,
"nickName":"哈哈哈哈哈哈",
"userId":440815,
"userName":"mofei"
}
]
},
"addCcPerson":{
"Switch":false,
"addCcState":false,
"btnName":"",
"memberSet":[
{
"deptId":38165,
"nickName":"哈哈哈哈哈",
"userId":440815,
"userName":"mofei"
}
]
},
"addEnclosurePerson":{
"Switch":false,
"addEncloureState":false,
"btnName":"",
"findEnclosurePower":[

]
},
"circulationRules":"",
"processNodeTipForm":{
"arriveReminders":[

],
"UntreatedNum":"",
"UntreatedTime":"",
"AutoAlert":[

]
},
"formOperates":[
{
"name":"",
"type":"",
"key":"",
"checkedList":[
"visibility",
"write"
]
}
]
},
"prevId":"SID-990e8b6a-68d1-dcf9-9ad1-00f8d2ccdc6a"
}
}
}
}
}

(2)初步格式化json,获取到最外层的JavaBean与其对应的字段名

紧接着,我们需要对json传中一些共性的东西进行分析,这里可以很容易看出,在后台进行解析这条json串时我们需要使用递归的思想对这一条json串进行解析,这里我推荐一个json自动格式化网站
json格式化

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{
"type":"start",
"content":"所有人",
"properties":Object{...},
"nodeId":"SID-55cf0a21-2ebc-febe-dc71-f5a629374be6",
"childNode":{
"type":"fill",
"content":"发起人自选",
"properties":Object{...},
"nodeId":"SID-6745bda6-55fd-9029-ac2e-b6bf38e756db",
"prevId":"SID-55cf0a21-2ebc-febe-dc71-f5a629374be6",
"childNode":{
"type":"fill",
"content":"发起人自选",
"properties":Object{...},
"nodeId":"SID-2bbfe3a8-4c3b-a143-e644-6193fe141426",
"prevId":"SID-6745bda6-55fd-9029-ac2e-b6bf38e756db",
"childNode":{
"nodeId":"SID-990e8b6a-68d1-dcf9-9ad1-00f8d2ccdc6a",
"type":"approver",
"content":"发起人自选",
"properties":Object{...},
"prevId":"SID-2bbfe3a8-4c3b-a143-e644-6193fe141426",
"childNode":{
"nodeId":"SID-8c2cef4a-450c-a248-8328-bfaae369232a",
"type":"approver",
"content":"发起人自选",
"properties":Object{...},
"prevId":"SID-990e8b6a-68d1-dcf9-9ad1-00f8d2ccdc6a"
}
}
}
}
}

这里我们可以看到,这一条Json串中有一些共性的东西,这些便是最外层JavaBean对象中对用的字段

(3)最外层Json串对应得JavaBean实体类

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/**
* Copyright 2020 bejson.com
*/
package com.activiti.domain;

/**
* Auto-generated: 2020-08-28 16:44:47
*
* @author bejson.com (i@bejson.com)
* @website http://www.bejson.com/java2pojo/
*
* 解析流程Json获取相关的信息
*/
public class JsonProcessRootBean {

/**
* 节点类型start
*/
private String type;
/**
* 节点对应的内容
*/
private String content;
/**
* 节点属性
*/
private Properties properties;
/**
* 节点id
*/
private String nodeId;

/**
* 上一任务节点的id
*/
private String prevId;
public void setType(String type) {
this.type = type;
}
public String getType() {
return type;
}

public void setContent(String content) {
this.content = content;
}
public String getContent() {
return content;
}

public void setProperties(Properties properties) {
this.properties = properties;
}
public Properties getProperties() {
return properties;
}

public void setNodeId(String nodeId) {
this.nodeId = nodeId;
}
public String getNodeId() {
return nodeId;
}

public String getPrevId() {
return prevId;
}

public void setPrevId(String prevId) {
this.prevId = prevId;
}

@Override
public String toString() {
return "JsonProcessRootBean{" +
"type='" + type + '\'' +
", content='" + content + '\'' +
", properties=" + properties +
", nodeId='" + nodeId + '\'' +
", prevId='" + prevId + '\'' +
'}';
}
}

2、仔细刨析每一层中共性的细节,发现properties这个字段也能够封装成一个实体类

(1)properties字段对应的json

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
{
"type":"start",
"content":"所有人",
"properties":Object{...},
"nodeId":"SID-55cf0a21-2ebc-febe-dc71-f5a629374be6",
"childNode":{
"type":"fill",
"content":"发起人自选",
"properties":{
"title":"填报人",
"menbers":Object{...},
"userOptional":true,
"nodeName":"填报人",
"fillSetSwitch":false,
"memberSet":Array[1],
"memberSetOptional":Array[1],
"circulationRules":"",
"processNodeTipForm":Object{...},
"formOperates":Array[1]
},
"nodeId":"SID-6745bda6-55fd-9029-ac2e-b6bf38e756db",
"prevId":"SID-55cf0a21-2ebc-febe-dc71-f5a629374be6",
"childNode":{
"type":"fill",
"content":"发起人自选",
"properties":Object{...},
"nodeId":"SID-2bbfe3a8-4c3b-a143-e644-6193fe141426",
"prevId":"SID-6745bda6-55fd-9029-ac2e-b6bf38e756db",
"childNode":{
"nodeId":"SID-990e8b6a-68d1-dcf9-9ad1-00f8d2ccdc6a",
"type":"approver",
"content":"发起人自选",
"properties":Object{...},
"prevId":"SID-2bbfe3a8-4c3b-a143-e644-6193fe141426",
"childNode":{
"nodeId":"SID-8c2cef4a-450c-a248-8328-bfaae369232a",
"type":"approver",
"content":"发起人自选",
"properties":Object{...},
"prevId":"SID-990e8b6a-68d1-dcf9-9ad1-00f8d2ccdc6a"
}
}
}
}
}

通过json串我们可以看出,Properties这个JavaBean对象包括Menber、ProcessNodeTipForm的JavaBean对象,包含List<MemberSet>、List<MemberSetOptional>、List<FormOperates>这里只做流程相关的操作,表单Form的砍掉三个集合

(2)Properties对应的JavaBean对象

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/**
* Copyright 2020 bejson.com
*/
package com.activiti.domain;
import java.util.List;
import java.util.Set;

/**
* Auto-generated: 2020-08-28 16:44:47
*
* @author bejson.com (i@bejson.com)
* @website http://www.bejson.com/java2pojo/
*/
public class Properties {

/**
* 当前属性的title
*/
private String title;
/**
* 审批人部门,有时只传部门信息,只传部门信息,没有用户信息,整个
*/
private Menbers menbers;
/**
* 用户的操作选择
*/
private boolean userOptional;
/**
* 节点名
*/
private String nodeName;
/**
* 是否填充
*/
private boolean fillSetSwitch;
/**
* 流程自己设置的负责人
*/
private Set<MemberSet> memberSet;
/**
* 发起人自选
*/
private Set<MemberSetOptional> memberSetOptional;
/**
*
*/
private String circulationRules;
private ProcessNodeTipForm processNodeTipForm;
public void setTitle(String title) {
this.title = title;
}
public String getTitle() {
return title;
}

public void setMenbers(Menbers menbers) {
this.menbers = menbers;
}
public Menbers getMenbers() {
return menbers;
}

public void setUserOptional(boolean userOptional) {
this.userOptional = userOptional;
}
public boolean getUserOptional() {
return userOptional;
}

public void setNodeName(String nodeName) {
this.nodeName = nodeName;
}
public String getNodeName() {
return nodeName;
}

public void setFillSetSwitch(boolean fillSetSwitch) {
this.fillSetSwitch = fillSetSwitch;
}
public boolean getFillSetSwitch() {
return fillSetSwitch;
}

public Set<MemberSet> getMemberSet() {
return memberSet;
}

public void setMemberSet(Set<MemberSet> memberSet) {
this.memberSet = memberSet;
}

public Set<MemberSetOptional> getMemberSetOptional() {
return memberSetOptional;
}

public void setMemberSetOptional(Set<MemberSetOptional> memberSetOptional) {
this.memberSetOptional = memberSetOptional;
}

public void setCirculationRules(String circulationRules) {
this.circulationRules = circulationRules;
}
public String getCirculationRules() {
return circulationRules;
}

public void setProcessNodeTipForm(ProcessNodeTipForm processNodeTipForm) {
this.processNodeTipForm = processNodeTipForm;
}
public ProcessNodeTipForm getProcessNodeTipForm() {
return processNodeTipForm;
}

@Override
public String toString() {
return "Properties{" +
"title='" + title + '\'' +
", menbers=" + menbers +
", userOptional=" + userOptional +
", nodeName='" + nodeName + '\'' +
", fillSetSwitch=" + fillSetSwitch +
", memberSet=" + memberSet +
", memberSetOptional=" + memberSetOptional +
", circulationRules='" + circulationRules + '\'' +
", processNodeTipForm=" + processNodeTipForm +
'}';
}
}

(3)MemberSet、FormOperates的Java实体类对应为

MemberSet

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/**
* Copyright 2020 bejson.com
*/
package cmcc.it.project.light.manage.domain.processjson;

/**
* Auto-generated: 2020-08-28 16:44:47
* 根据前端传入的json封装的JavaBean实体对象,审批人信息
* @author bejson.com (i@bejson.com)
* @website http://www.bejson.com/java2pojo/
*/
public class MemberSet {

/**
* 流程设置审批人的部门id
*/
private String deptId;
/**
* 用户的别名
*/
private String nickName;
/**
* 用户的用户id
*/
private String userId;
/**
* 用户名
*/
private String userName;

public String getDeptId() {
return deptId;
}

public void setDeptId(String deptId) {
this.deptId = deptId;
}

public String getNickName() {
return nickName;
}

public void setNickName(String nickName) {
this.nickName = nickName;
}

public String getUserId() {
return userId;
}

public void setUserId(String userId) {
this.userId = userId;
}

public String getUserName() {
return userName;
}

public void setUserName(String userName) {
this.userName = userName;
}

@Override
public String toString() {
return "MemberSet{" +
"deptId='" + deptId + '\'' +
", nickName='" + nickName + '\'' +
", userId='" + userId + '\'' +
", userName='" + userName + '\'' +
'}';
}
}

FormOperates

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package cmcc.it.project.light.manage.domain.processjson;

import java.util.List;

/**
* @author zhudunfeng
* @date 2020/9/4 9:45
* 解析json
*/
public class FormOperates {
private String name;
private String key;
private String type;
private List<String> checkedList;

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getKey() {
return key;
}

public void setKey(String key) {
this.key = key;
}

public String getType() {
return type;
}

public void setType(String type) {
this.type = type;
}

public List<String> getCheckedList() {
return checkedList;
}

public void setCheckedList(List<String> checkedList) {
this.checkedList = checkedList;
}

@Override
public String toString() {
return "FormOperates{" +
"name='" + name + '\'' +
", key='" + key + '\'' +
", type='" + type + '\'' +
", checkedList=" + checkedList +
'}';
}
}

、、、这样对接送不断进行分析与封装

3、使用fastJson解析json对JavaBean对象进行赋值

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
/**
* 解析前端的自定义流程Json信息
* @param modelId
* @return Json对应的实体类对象信息
* @author zhudunfeng
*/
@Override
public List<JsonProcessRootBean> parsejsonProcessRootBean(String modelId) {
//获取流程模板数据
ActDeModel actDeModel = actDeModelMapper.selectActDeModelById(modelId);
String modelEditorJson =actDeModel.getModelEditorJson();
List<JsonProcessRootBean> jsonProcessRootBeanList = new ArrayList<>();
String childNode = modelEditorJson;
while (null != childNode && !"".equals(childNode)) {
try {
JsonProcessRootBean jsonProcessRootBean = new JsonProcessRootBean();
//流程json
JSONObject jsonObject = JSONObject.parseObject(childNode);
//开始装配流程节点数据
jsonProcessRootBean.setNodeId(jsonObject.get("nodeId").toString());
jsonProcessRootBean.setType(jsonObject.get("type").toString());
jsonProcessRootBean.setContent(jsonObject.get("content").toString());
//节点的变量名
jsonProcessRootBean.setAssignee(jsonObject.get("assignee").toString());
//会签节点的变量名
if (jsonObject.get("assigneeList") != null) {
jsonProcessRootBean.setAssigneeList(jsonObject.get("assigneeList").toString());
}

//发起节点没有prevId属性,其他节点都有prevId属性
if (jsonObject.get("prevId") != null) {
jsonProcessRootBean.setPrevId(jsonObject.get("prevId").toString());
}
//开始解析当前节点的人员数据
//1、获取properties属性值
JSONObject propertiesObj = JSONObject.parseObject(jsonObject.get("properties").toString());
Properties properties = new Properties();
if (null != propertiesObj && !"".equals(propertiesObj)) {
properties.setTitle(propertiesObj.get("title").toString());
Object userOptional = propertiesObj.get("userOptional");
if (userOptional != null) {
properties.setUserOptional((Boolean)userOptional);
}
Object fillSetSwitch = propertiesObj.get("fillSetSwitch");
if (fillSetSwitch != null) {
properties.setFillSetSwitch((Boolean)fillSetSwitch);
}
properties.setNodeName(propertiesObj.get("nodeName").toString());
//当前任务节点是否为会签节点
properties.setCountersign(propertiesObj.get("countersign").toString());

List<MemberSet> processNodeMemberSet = new ArrayList<>();
List<MemberSetOptional> processNodeMemberSetOptional=new ArrayList<>();
List<DeptSet> processNodeDeptSet=new ArrayList<>();
List<FormOperates> processNodeFormOperatesSet=new ArrayList<>();

//获取memberSet属性值,转换为JSONArray数组类型
JSONArray memberSetArray = JSONArray.parseArray(propertiesObj.get("memberSet").toString());
Object memberSetOptional = propertiesObj.get("memberSetOptional");
JSONArray memberSetOptionalArray=null;
if (memberSetOptional != null&&!"".equals(memberSetOptional)) {
memberSetOptionalArray = JSONArray.parseArray(memberSetOptional.toString());
}
Object deptSet = propertiesObj.get("deptSet");
JSONArray deptSetArray=null;
if (deptSet != null&&!"".equals(deptSet)) {
deptSetArray= JSONArray.parseArray(deptSet.toString());
}

Object formOperatesList = propertiesObj.get("formOperates");
JSONArray formOperatesArray=null;
if (formOperatesList != null) {
formOperatesArray= JSONArray.parseArray(formOperatesList.toString());
}

//如果当前节点有选择的人员数据
if(memberSetArray != null && memberSetArray.size() >= 0){
//遍历memberSet数组
for (Object obj : memberSetArray) {
JSON memberSetJson = (JSON) obj;
//转换为实体类对象
MemberSet processNodeMember = JSON.parseObject(memberSetJson.toJSONString(),
new TypeReference<MemberSet>() {
});
processNodeMemberSet.add(processNodeMember);
}
}
//如果是发起人自选
if(memberSetOptionalArray != null && memberSetOptionalArray.size() >= 0){
//遍历memberSetOptional数组
for (Object obj : memberSetOptionalArray) {
JSON memberSetOptionalJson = (JSON) obj;
//转换为实体类对象
MemberSetOptional processNodeMemberOptional = JSON.parseObject(memberSetOptionalJson.toJSONString(),
new TypeReference<MemberSetOptional>() {
});
processNodeMemberSetOptional.add(processNodeMemberOptional);
}
}

//部门信息
if(deptSetArray!=null&&deptSetArray.size()>0){
//遍历deptSetArray数组
for (Object obj : deptSetArray) {
JSON deptSetJson = (JSON) obj;
//转换为实体类对象
DeptSet deptSet1 = JSON.parseObject(deptSetJson.toJSONString(),
new TypeReference<DeptSet>() {
});
processNodeDeptSet.add(deptSet1);
}
}

//formOperates
if(formOperatesArray!=null&&formOperatesArray.size()>0){
//遍历formOperatesArray数组
for (Object obj : formOperatesArray) {
JSON formOperatesJson= (JSON) obj;
//转换为实体类
FormOperates formOperates = JSON.parseObject(formOperatesJson.toJSONString(),
new TypeReference<FormOperates>() {
});
processNodeFormOperatesSet.add(formOperates);
}
}


properties.setMemberSet(processNodeMemberSet);
properties.setMemberSetOptional(processNodeMemberSetOptional);
properties.setDeptSet(processNodeDeptSet);
properties.setFormOperates(processNodeFormOperatesSet);
}
jsonProcessRootBean.setProperties(properties);
jsonProcessRootBeanList.add(jsonProcessRootBean);
//更新childNode
childNode = "";
Object childNodeObj = jsonObject.get("childNode");
//有下一节点
if (childNodeObj != null) {
childNode = JSON.toJSONString(jsonObject.get("childNode"));
}
} catch (Exception e) {
e.printStackTrace();
return null;
}
}

return jsonProcessRootBeanList;
}

请大家提出意见,进行优化