ludc
2023-11-16 d8d0fd16af2f88cc7623b01493338c1f53b64e74
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
package com.vci.ubcs.starter.web.pagemodel;
 
 
import org.springblade.core.tool.utils.StringUtil;
 
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
 
public class Tree implements Serializable {
    private static final long serialVersionUID = 6886695271635257882L;
    private String oid;
    private String text;
    private String count;
    private String name;
    private boolean leaf = false;
    private boolean showCheckbox = false;
    private boolean checked = false;
    private List<Tree> children = new ArrayList();
    private String icon;
    private String iconCls;
    private String parentId;
    private String parentName;
    private String parentBtmName;
    private boolean expanded = false;
    private String href;
    private String index;
    private Map<String, String> attributes = new HashMap();
 
 
 
    public Tree() {
    }
 
    public Tree(String oid, String text) {
        this.setOid(oid);
        this.setText(text);
    }
 
    public String getCount() {
        return count;
    }
 
    public void setCount(String count) {
        this.count = count;
    }
 
    public String getOid() {
        return this.oid;
    }
 
    public void setOid(String oid) {
        this.oid = oid;
    }
 
    public String getName() {
        return this.name;
    }
 
    public void setName(String name) {
        this.name = name;
    }
 
    public String getText() {
        return this.text;
    }
 
    public void setText(String text) {
        this.text = text;
    }
 
    public boolean isLeaf() {
        return this.leaf;
    }
 
    public void setLeaf(boolean leaf) {
        this.leaf = leaf;
    }
 
    public boolean isShowCheckbox() {
        return this.showCheckbox;
    }
 
    public void setShowCheckbox(boolean showCheckbox) {
        this.showCheckbox = showCheckbox;
    }
 
    public boolean isChecked() {
        return this.checked;
    }
 
    public void setChecked(boolean checked) {
        this.checked = checked;
    }
 
    public List<Tree> getChildren() {
        return this.children;
    }
 
    public void setChildren(List<Tree> children) {
        this.children = children;
    }
 
    public String getIcon() {
        return this.icon;
    }
 
    public void setIcon(String icon) {
        this.icon = icon;
    }
 
    public String getIconCls() {
        return this.iconCls;
    }
 
    public void setIconCls(String iconCls) {
        this.iconCls = iconCls;
    }
 
    public String getParentId() {
        return this.parentId;
    }
 
    public void setParentId(String parentId) {
        this.parentId = parentId;
    }
 
    public boolean isExpanded() {
        return this.expanded;
    }
 
    public void setExpanded(boolean expanded) {
        this.expanded = expanded;
    }
 
    public String getHref() {
        return this.href;
    }
 
    public void setHref(String href) {
        this.href = href;
    }
 
    public String getIndex() {
        return this.index;
    }
 
    public void setIndex(String index) {
        this.index = index;
    }
 
    public Map<String, String> getAttributes() {
        return this.attributes;
    }
 
    public void setAttributes(Map<String, String> attributes) {
        this.attributes = attributes;
    }
 
    public String getParentName() {
        return this.parentName;
    }
 
    public void setParentName(String parentName) {
        this.parentName = parentName;
    }
 
    public String getParentBtmName() {
        return this.parentBtmName;
    }
 
    public void setParentBtmName(String parentBtmName) {
        this.parentBtmName = parentBtmName;
    }
 
    public static List<Tree> getChildList(List<Tree> rootTree, List<Tree> children) {
        if (rootTree == null || rootTree.size() == 0) {
            if (children == null || children.size() <= 0) {
                return null;
            }
 
            rootTree = children.subList(0, children.size());
        }
 
        Tree bt = new Tree();
        bt.findChild(rootTree, children);
        return rootTree;
    }
 
    public void findChild(List<Tree> treenode, List<Tree> children) {
        Tree node;
        for(Iterator var3 = treenode.iterator(); var3.hasNext(); this.getChildren().add(node)) {
            node = (Tree)var3.next();
            Iterator var5 = children.iterator();
 
            while(var5.hasNext()) {
                Tree childnode = (Tree)var5.next();
                if (node.getOid().equalsIgnoreCase(childnode.getParentId())) {
                    childnode.setParentName(node.getText());
                    if (StringUtil.isBlank(childnode.getParentBtmName())) {
                        childnode.setParentBtmName((String)node.getAttributes().getOrDefault("btmname", ""));
                    }
 
                    node.getChildren().add(childnode);
                }
            }
 
            if (node.getChildren().size() > 0) {
                this.findChild(node.getChildren(), children);
                node.setLeaf(false);
            } else {
                node.setLeaf(true);
            }
        }
 
    }
 
    public void findSystemClassChild(List<Tree> treenode, List<Tree> children) {
        Tree node;
        for(Iterator var3 = treenode.iterator(); var3.hasNext(); this.getChildren().add(node)) {
            node = (Tree)var3.next();
            Iterator var5 = children.iterator();
 
            while(var5.hasNext()) {
                Tree childnode = (Tree)var5.next();
                if (node.getAttributes().get("classifyOid").equalsIgnoreCase(childnode.getParentId())) {
                    childnode.setParentName(node.getText());
                    if (StringUtil.isBlank(childnode.getParentBtmName())) {
                        childnode.setParentBtmName((String)node.getAttributes().getOrDefault("btmname", ""));
                    }
 
                    node.getChildren().add(childnode);
                }
            }
 
            if (node.getChildren().size() > 0) {
                this.findSystemClassChild(node.getChildren(), children);
                node.setLeaf(false);
            } else {
                node.setLeaf(true);
            }
        }
 
    }
 
    @Override
    public String toString() {
        return "Tree{oid='" + this.oid + '\'' + ", text='" + this.text + '\'' + ", leaf=" + this.leaf + ", showCheckbox=" + this.showCheckbox + ", checked=" + this.checked + ", children=" + this.children + ", icon='" + this.icon + '\'' + ", iconCls='" + this.iconCls + '\'' + ", parentId='" + this.parentId + '\'' + ", parentName='" + this.parentName + '\'' + ", parentBtmName='" + this.parentBtmName + '\'' + ", expanded=" + this.expanded + ", href='" + this.href + '\'' + ", index='" + this.index + '\'' + ", attributes=" + this.attributes + '}';
    }
}