许鹏程
2023-06-30 3bbfaa3d7d416afbd154576453c8ee9e7e2f8899
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
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
package com.product.server.report.service;
 
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.product.core.dao.BaseDao;
import com.product.core.entity.DataTableEntity;
import com.product.core.entity.FieldSetEntity;
import com.product.core.exception.BaseException;
import com.product.core.service.support.AbstractBaseService;
import com.product.core.service.support.QueryFilterService;
import com.product.core.transfer.Transactional;
import com.product.server.report.config.CmnConst;
import com.product.server.report.service.idel.IChartPropertyConfigService;
import com.product.util.BaseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
@Service
public class ChartPropertyConfigService extends AbstractBaseService implements IChartPropertyConfigService {
 
    @Autowired
    BaseDao baseDao;
 
    @Autowired
    QueryFilterService queryFilterService;
    @Override
    @Transactional
    public String addChartsMasterTable(FieldSetEntity fse) throws BaseException {
        DataTableEntity chartsData = fse.getSubDataTable(CmnConst.PRODUCT_SYS_REPORT_CONFIG_CHARTS);
        if(chartsData.getRows() == 1){
            fse.setValue("type_uuid", chartsData.getString(0, "report_type_config_uuid"));
            fse.setValue("is_valid", 1);
        }
        fse.removeSubData(CmnConst.PRODUCT_SYS_REPORT_CONFIG_CHARTS);
        fse.setValue("is_load", 0);
        String uuid = baseDao.add(fse);
        for (int i = 0; i < chartsData.getRows(); i++) {
            FieldSetEntity chartsField = chartsData.getFieldSetEntity(i);
            chartsField.setValue("report_config_uuid",uuid);
            if("empty".equals(chartsField.getString("type"))){
                baseDao.add(chartsField);
                continue;
            }
            DataTableEntity attributeData = chartsField.getSubDataTable(CmnConst.PRODUCT_SYS_REPORT_CONFIG_ATTRIBUTE);
            chartsField.removeSubData(CmnConst.PRODUCT_SYS_REPORT_CONFIG_ATTRIBUTE);
            String chartsUuid = baseDao.add(chartsField);
            for (int j = 0; j < attributeData.getRows(); j++) {
                FieldSetEntity attributeField = attributeData.getFieldSetEntity(j);
                attributeField.setValue("report_config_uuid", chartsUuid);
                String report_type_attr_value = attributeField.getString("report_type_attr_value");
                if(!BaseUtil.strIsNull(report_type_attr_value) && report_type_attr_value.contains("{#") && report_type_attr_value.contains("#}")){
                    String field_name = report_type_attr_value.replace("{#", "").replace("#}", "");
                    attributeField.setValue("field_name", field_name);
                }
                baseDao.add(attributeField);
            }
        }
        return uuid;
    }
 
    @Override
    @Transactional
    public Boolean upChartsMasterTable(FieldSetEntity fse) throws BaseException {
        //具体类型子表
        DataTableEntity subChartsData = fse.getSubDataTable(CmnConst.PRODUCT_SYS_REPORT_CONFIG_CHARTS);
        if(subChartsData.getRows() == 1){
            fse.setValue("type_uuid", subChartsData.getString(0, "report_type_config_uuid"));
            fse.setValue("is_valid", 1);
        }
        fse.setValue("is_load", 0);
        fse.removeSubData(CmnConst.PRODUCT_SYS_REPORT_CONFIG_CHARTS);
        if(!BaseUtil.dataTableIsEmpty(subChartsData)){
            for (int i = 0; i < subChartsData.getRows(); i++) {
                FieldSetEntity subChartsFieldSet = subChartsData.getFieldSetEntity(i);
                String status = subChartsFieldSet.getString("status");
                subChartsFieldSet.remove("status");
                String subChartsUuid = subChartsFieldSet.getUUID();
                subChartsFieldSet.setValue("report_config_uuid", fse.getUUID());
                //处理空白
                if("empty".equals(subChartsFieldSet.getString("type"))){
                    if("add".equals(status)) {
                        baseDao.add(subChartsFieldSet);
                    }else if("delete".equals(status)){
                        baseDao.delete(CmnConst.PRODUCT_SYS_REPORT_CONFIG_CHARTS, new String[]{subChartsUuid});
                    }else if("update".equals(status)){
                        baseDao.update(subChartsFieldSet);
                    }
                    continue;
                }
                DataTableEntity attributeDataTable = subChartsFieldSet.getSubDataTable(CmnConst.PRODUCT_SYS_REPORT_CONFIG_ATTRIBUTE);
                subChartsFieldSet.removeSubData(CmnConst.PRODUCT_SYS_REPORT_CONFIG_ATTRIBUTE);
 
                //删除当前选择的图表类型 及属性值子表
                if("delete".equals(status)){
                    baseDao.delete(CmnConst.PRODUCT_SYS_REPORT_CONFIG_CHARTS, new String[]{subChartsUuid});
                    baseDao.delete(CmnConst.PRODUCT_SYS_REPORT_CONFIG_ATTRIBUTE, " report_config_uuid = ? ",new String[]{subChartsUuid});
                    continue;
                }
                if ("add".equals(status)) {
                    String uuid = baseDao.add(subChartsFieldSet);
                    if(!BaseUtil.dataTableIsEmpty(attributeDataTable)){
                        for (int j = 0; j < attributeDataTable.getRows(); j++) {
                            FieldSetEntity fieldSetEntity = attributeDataTable.getFieldSetEntity(j);
                            fieldSetEntity.setValue("report_config_uuid", uuid);
                            baseDao.add(fieldSetEntity);
                        }
                    }
                    continue;
                }
                //先删除之前所有属性值子表数据
                baseDao.delete(CmnConst.PRODUCT_SYS_REPORT_CONFIG_ATTRIBUTE, " report_config_uuid = ? ", new String[]{subChartsUuid});
                //再添加数据
                if(!BaseUtil.dataTableIsEmpty(attributeDataTable)){
                    for (int j = 0; j < attributeDataTable.getRows(); j++) {
                       FieldSetEntity fieldSetEntity = attributeDataTable.getFieldSetEntity(j);
                        fieldSetEntity.setValue("report_config_uuid", subChartsUuid);
                        String report_type_attr_value = fieldSetEntity.getString("report_type_attr_value");
                        if(!BaseUtil.strIsNull(report_type_attr_value) && report_type_attr_value.contains("{#") && report_type_attr_value.contains("#}")){
                            String field_name = report_type_attr_value.replace("{#", "").replace("#}", "");
                            fieldSetEntity.setValue("field_name", field_name);
                        }
                        baseDao.add(fieldSetEntity);
                    }
                }
                if("update".equals(status)){
                    baseDao.update(subChartsFieldSet);
                }
            }
        }
        return baseDao.update(fse);
    }
 
    @Override
    @Transactional
    public Boolean delChartsMasterTable(FieldSetEntity fse) throws BaseException {
        String[] uuids = fse.getUUID().split(",");
        for (int i = 0; i < uuids.length; i++) {
            baseDao.delete(CmnConst.PRODUCT_SYS_REPORT_CONFIG_CHARTS, "report_config_uuid = ?",new String[]{uuids[i]});
            baseDao.delete(CmnConst.PRODUCT_SYS_REPORT_CONFIG_ATTRIBUTE, "report_config_uuid in (SELECT uuid FROM product_sys_report_config_charts where report_config_uuid = ?)",new String[]{uuids[i]});
        }
        return baseDao.delete(CmnConst.PRODUCT_SYS_REPORT_CONFIG, uuids);
    }
 
    @Override
    public JSONObject getChartsMasterTable(String uuid) throws BaseException {
        FieldSetEntity configField = baseDao.getFieldSetEntity(CmnConst.PRODUCT_SYS_REPORT_CONFIG,uuid,false);
        DataTableEntity dataTableEntity = baseDao.listTable(CmnConst.PRODUCT_SYS_REPORT_CONFIG_CHARTS, "report_config_uuid = ?", new String[]{uuid});
        JSONArray jsonArray = new JSONArray();
        for (int i = 0; i < dataTableEntity.getRows(); i++) {
           FieldSetEntity fieldSetEntity = dataTableEntity.getFieldSetEntity(i);
            String config_charts_uuid = fieldSetEntity.getString(CmnConst.UUID);
            String report_type_config_uuid = fieldSetEntity.getString("report_type_config_uuid");
            JSONObject chartsObj = BaseUtil.fieldSetEntityToJson(fieldSetEntity);
            //获取元素及元素值
            chartsObj.put("element",this.getEChartsElement(report_type_config_uuid, config_charts_uuid));
            jsonArray.add(chartsObj);
        }
        JSONObject object = new JSONObject();
        object.put("report_name",configField.getString("report_name"));
        object.put("report_width_type",configField.getString("report_width_type"));
        object.put("report_width_value",configField.getString("report_width_value"));
        object.put("is_valid",configField.getString("is_valid"));
        object.put("chartsObject", jsonArray);
        return object;
    }
 
    @Override
    public DataTableEntity getChartsMasterList(FieldSetEntity fse) throws BaseException {
        StringBuffer sql = new StringBuffer();
        sql.append(" SELECT * FROM ( ")
            .append(" select b.uuid,b.report_name FROM product_sys_report_config_charts a left join PRODUCT_SYS_report_config b on a.report_config_uuid = b.uuid WHERE b.function_uuid is null or b.function_uuid = '' group by b.uuid,b.report_name ) c ");
        if (!BaseUtil.dataTableIsEmpty(fse.getSubDataTable("systemSeniorQueryString"))) {
            sql.append(" where " + queryFilterService.getQueryFilter(fse));
        }
        return baseDao.listTable(sql.toString(), new String[]{}, fse.getInteger(CmnConst.PAGESIZE), fse.getInteger(CmnConst.CPAGE));
    }
 
    @Override
    public JSONObject getChartsTypeData(String uuid) throws BaseException {
//        FieldSetEntity fieldSetEntity = baseDao.getFieldSetEntity(CmnConst.PRODUCT_SYS_REPORT_TYPE_CONFIG, uuid, false);
//        DataTableEntity dataTableEntity = baseDao.listTable(CmnConst.PRODUCT_SYS_REPORT_TYPE_ATTRIBUTE, "type_uuid = ? and config_properties = 1", new String[]{uuid});
//        fieldSetEntity.addSubDataTable(dataTableEntity);
        return this.getEChartsElement(uuid, null);
    }
 
    /**
     * 获取上级属性树
     * report_type_config_uuid 属性类型主表uuid
     * config_charts_uuid 中间表uuid
     * xinluo
     * @return
     */
    public JSONObject getEChartsElement(String report_type_config_uuid,String config_charts_uuid) throws BaseException {
        FieldSetEntity masterField = baseDao.getFieldSetEntity(CmnConst.PRODUCT_SYS_REPORT_TYPE_CONFIG,report_type_config_uuid,false);
        DataTableEntity dataTableEntity = this.getEChartsElementList(report_type_config_uuid);
        String[] parameter = new String[]{"f", "e", "d", "c", "b", "a"};
        JSONArray array = new JSONArray();
        for (int j = 0; j < parameter.length; j++) {
            for (int i = 0; i <dataTableEntity.getRows(); i++) {
                FieldSetEntity fieldSetEntity = dataTableEntity.getFieldSetEntity(i);
                if(BaseUtil.strIsNull(fieldSetEntity.getString("nonRepeating"))){
                    //如果父属性或属性不为空,取出当前数据所有父子元素
                    if(!BaseUtil.strIsNull(fieldSetEntity.getString(parameter[j]+"name"))){
                        array = this.returnTree(fieldSetEntity,parameter,j, array, config_charts_uuid);
                        //存入树的元素需要从dataTableEntity里面剃掉
                        fieldSetEntity.setValue("nonRepeating", 1);
                    }
                }
            }
        }
        JSONObject object = BaseUtil.fieldSetEntityToJson(masterField);
        //获取是否子元素有分组字段 如有分组字段   需添加分组
        for (int i = 0; i < array.size(); i++) {
            JSONObject jsonObject = array.getJSONObject(i);
            this.getGroupAttributes(jsonObject);
        }
 
        object.put(CmnConst.PRODUCT_SYS_REPORT_TYPE_ATTRIBUTE,array);
        return object;
    }
 
    /**
     * 获取子集分组元素
     * @param jsonObject
     */
    public void getGroupAttributes(JSONObject jsonObject){
        JSONArray children = jsonObject.getJSONArray("children");
        if(children != null && children.size() > 0) {
            for (int i = 0; i < children.size(); i++) {
                JSONObject object = children.getJSONObject(i);
                String grouping = object.getString("grouping");
                JSONArray subChildren = object.getJSONArray("children");
                if ("1".equals(grouping) && "1".equals(jsonObject.getString("subordinateElementType"))) {
                    JSONObject group = new JSONObject();
                    group.put("children", JSONArray.parseArray(children.toJSONString()));
                    group.put("label", "组名");
                    group.put("value", "1");
                    JSONArray newArray = new JSONArray();
                    newArray.add(group);
                    jsonObject.put("children", newArray);
                    String reportConfigUuid = object.getString("report_config_uuid");
                    String reportTypeAttr = object.getString("report_type_attr");
                    DataTableEntity dataTableEntity = baseDao.listTable(CmnConst.PRODUCT_SYS_REPORT_CONFIG_ATTRIBUTE, " report_type_attr = ? AND report_config_uuid = ? and  grouping != 1 ", new String[]{reportTypeAttr, reportConfigUuid});
                    for (int j = 0; j < dataTableEntity.getRows(); j++) {
                        JSONObject groupNew = JSONObject.parseObject(group.toJSONString());
                        String key = dataTableEntity.getString(j, "grouping");
                        groupNew.put("label", "组名");
                        groupNew.put("value", key);
                        newArray.add(this.addGroupAttributes(groupNew, key));
                    }
                } else if (subChildren != null && subChildren.size() > 0) {
                    this.getGroupAttributes(object);
                }
            }
        }
    }
 
    /**
     * 添加子集分组元素
     * @param group
     */
    public JSONObject addGroupAttributes(JSONObject group, String key){
        JSONArray children = group.getJSONArray("children");
        if(children != null && children.size() > 0) {
            for (int i = 0; i < children.size(); i++) {
                this.addGroupAttributes(children.getJSONObject(i), key);
            }
        }
        String reportConfigUuid = group.getString("report_config_uuid");
        String reportTypeAttr = group.getString("report_type_attr");
        if(!BaseUtil.strIsNull(reportConfigUuid) && !BaseUtil.strIsNull(reportTypeAttr)){
            FieldSetEntity fieldSetEntity = baseDao.getFieldSetEntityByFilter(CmnConst.PRODUCT_SYS_REPORT_CONFIG_ATTRIBUTE, " report_type_attr = ? AND report_config_uuid = ? AND grouping = ? ", new String[]{reportTypeAttr, reportConfigUuid, key}, false);
            if(fieldSetEntity != null) {
                group.put("config_attribute_uuid", fieldSetEntity.getString("uuid"));
                //列表关.PRODUCT_SYS_report_config,图表关.PRODUCT_SYS_report_config_charts表UUID
                group.put("report_config_uuid", fieldSetEntity.getString("report_config_uuid"));
                //关联属.PRODUCT_SYS_report_type_attribute表UUID
                group.put("report_type_attr", fieldSetEntity.getString("report_type_attr"));
                //字段名称
                group.put("field_name", fieldSetEntity.getString("field_name"));
                //属性值
                group.put("report_type_attr_value", fieldSetEntity.getString("report_type_attr_value"));
                //分组标识,加载多条数据需要加标识
                group.put("grouping", key);
            }
        }
        return group;
    }
 
    /**
     * 获取上级属性列表
     * xinluo
     * @return
     */
    public DataTableEntity getEChartsElementList(String uuid)throws BaseException{
        StringBuffer sql = new StringBuffer();
        sql.append(" SELECT a.uuid auuid,a.detail adetail,a.attribute_name aname,a.subordinateElementType asubordinateElementType,a.prompt_name,a.default_value, ")
                .append(" b.uuid buuid,b.detail bdetail,b.attribute_name bname,b.subordinateElementType bsubordinateElementType, ")
                .append(" c.uuid cuuid,c.detail cdetail,c.attribute_name cname,c.subordinateElementType csubordinateElementType, ")
                .append(" d.uuid duuid,d.detail ddetail,d.attribute_name dname,d.subordinateElementType dsubordinateElementType, ")
                .append(" e.uuid euuid,e.detail edetail,e.attribute_name ename,e.subordinateElementType esubordinateElementType, ")
                .append(" f.uuid fuuid,f.detail fdetail,f.attribute_name fname,f.subordinateElementType fsubordinateElementType FROM ")
                .append("product_sys_report_type_attribute a LEFT JOIN ")
                .append("product_sys_report_type_attribute b on a.parentAttributeUuid = b.uuid LEFT JOIN ")
                .append("product_sys_report_type_attribute c on b.parentAttributeUuid = c.uuid LEFT JOIN ")
                .append("product_sys_report_type_attribute d on c.parentAttributeUuid = d.uuid LEFT JOIN ")
                .append("product_sys_report_type_attribute e on d.parentAttributeUuid = e.uuid LEFT JOIN ")
                .append("product_sys_report_type_attribute f on e.parentAttributeUuid = f.uuid ")
                .append(" WHERE  a.config_properties = 1 ")
                .append(" AND a.type_uuid = ? ");
 
        return baseDao.listTable(sql.toString(), new String[]{uuid});
    }
 
    /**
     * @param fieldSetEntity
     * @param parameter
     * @param paramIndex
     * @param array
     * @return
     * 同级元素不能重复 xinluo
     */
    public JSONArray returnTree(FieldSetEntity fieldSetEntity, String[] parameter, int paramIndex,JSONArray array, String config_charts_uuid){
        boolean flag = true;
        String value = fieldSetEntity.getString(parameter[paramIndex]+"name");
        if(array.size() > 0) {
            for (int i = 0; i < array.size(); i++) {
                JSONObject jsonObject = array.getJSONObject(i);
                String objValue = jsonObject.getString("value");
                //子属性相同
                if(objValue == null)
                    System.out.println("null");
                if (objValue.equals(value)) {
                    paramIndex++;
                    JSONArray childrenArray = jsonObject.getJSONArray("children");
                    flag = false;
                    if (paramIndex < parameter.length && childrenArray != null && childrenArray.size() > 0) {
                        this.returnTree(fieldSetEntity, parameter, paramIndex, childrenArray, config_charts_uuid);
                    }
                }
            }
            //子属性不同
            if(flag){
                return this.returnChildrenTree(fieldSetEntity, parameter, paramIndex, array, config_charts_uuid);
            }
        }else {
            return this.returnChildrenTree(fieldSetEntity, parameter, paramIndex, array, config_charts_uuid);
        }
        return array;
    }
    //封装子元素 xinluo
    public JSONArray returnChildrenTree(FieldSetEntity fieldSetEntity, String[] parameter, Integer paramIndex,JSONArray array, String config_charts_uuid){
        Boolean is_addGroup = true;
        //元素名
        String name = fieldSetEntity.getString(parameter[paramIndex]+"name");
        //元素描述
        String detail = fieldSetEntity.getString(parameter[paramIndex]+"detail");
        //元素uuid
        String uuid = fieldSetEntity.getString(parameter[paramIndex]+"uuid");
        //元素子元素类型
        String subType = fieldSetEntity.getString(parameter[paramIndex]+"subordinateElementType");
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("value",name);
        jsonObject.put("label",detail);
        jsonObject.put("uuid",uuid);
        jsonObject.put("subordinateElementType",subType);
        jsonObject.put("config_properties",fieldSetEntity.getString("config_properties"));
        paramIndex++;
        if(paramIndex < parameter.length) {
            JSONArray childrenArray = new JSONArray();
            jsonObject.put("children", this.returnTree(fieldSetEntity, parameter, paramIndex, childrenArray, config_charts_uuid));
        }else {
            // 字典值
            jsonObject.put("prompt_name",fieldSetEntity.getString("prompt_name"));
            // 默认值
            jsonObject.put("default_value",fieldSetEntity.getString("default_value"));
            // 获取
            if(!BaseUtil.strIsNull(config_charts_uuid)) {
                DataTableEntity dataTableEntity = baseDao.listTable(CmnConst.PRODUCT_SYS_REPORT_CONFIG_ATTRIBUTE, " report_type_attr = ? AND report_config_uuid = ? ", new String[]{uuid, config_charts_uuid});
                if(!BaseUtil.dataTableIsEmpty(dataTableEntity)) {
                    if(dataTableEntity.getRows() > 1) {
                        for (int i = 0; i < dataTableEntity.getRows(); i++) {
                            FieldSetEntity fse = dataTableEntity.getFieldSetEntity(i);
                            String grouping = fse.getString("grouping");
                            if("1".equals(grouping)) {
                                jsonObject.put("config_attribute_uuid", fse.getString("uuid"));
                                //列表关.PRODUCT_SYS_report_config,图表关.PRODUCT_SYS_report_config_charts表UUID
                                jsonObject.put("report_config_uuid", fse.getString("report_config_uuid"));
                                //关联属.PRODUCT_SYS_report_type_attribute表UUID
                                jsonObject.put("report_type_attr", fse.getString("report_type_attr"));
                                //字段名称
                                jsonObject.put("field_name", fse.getString("field_name"));
                                //属性值
                                jsonObject.put("report_type_attr_value", fse.getString("report_type_attr_value"));
                                //分组标识,加载多条数据需要加标识
                                jsonObject.put("grouping",grouping);
                            }
                        }
                    }else if(dataTableEntity.getRows() == 1){
                        jsonObject.put("config_attribute_uuid", dataTableEntity.getString(0,"uuid"));
                        //列表关.PRODUCT_SYS_report_config,图表关.PRODUCT_SYS_report_config_charts表UUID
                        jsonObject.put("report_config_uuid", dataTableEntity.getString(0,"report_config_uuid"));
                        //关联属.PRODUCT_SYS_report_type_attribute表UUID
                        jsonObject.put("report_type_attr", dataTableEntity.getString(0,"report_type_attr"));
                        //字段名称
                        jsonObject.put("field_name", dataTableEntity.getString(0,"field_name"));
                        //属性值
                        jsonObject.put("report_type_attr_value", dataTableEntity.getString(0,"report_type_attr_value"));
                    }
                }
            }
        }
        array.add(jsonObject);
        return array;
    }
 
    public void addLayerOf(JSONArray childrenArray){
        if(childrenArray != null && childrenArray.size() > 0){
            for (int i = 0; i < childrenArray.size(); i++) {
                JSONObject o = childrenArray.getJSONObject(i);
                JSONArray children = o.getJSONArray("children");
                if(!BaseUtil.strIsNull(o.getString("grouping"))){
                    o.getInteger("grouping");
                }else if(children != null && children.size() > 0){
                    this.addLayerOf(children);
                }
            }
        }
    }
}