yuxc
2024-09-13 fa88edda7b1e6523e64b2642c6291a1a4866bd43
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
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
package com.vci.web.service.impl;
import cn.hutool.core.io.FileUtil;
import com.vci.constant.FrameWorkLangCodeConstant;
import com.vci.corba.common.PLException;
import com.vci.corba.portal.data.Constraint;
import com.vci.corba.portal.data.PLAction;
import com.vci.corba.portal.data.PLActionCls;
import com.vci.corba.portal.data.PLActionParam;
import com.vci.dto.*;
import com.vci.starter.poi.bo.WriteExcelData;
import com.vci.starter.poi.bo.WriteExcelOption;
import com.vci.starter.poi.util.ExcelUtil;
import com.vci.starter.web.exception.VciBaseException;
import com.vci.starter.web.pagemodel.BaseResult;
import com.vci.starter.web.util.ControllerUtil;
import com.vci.starter.web.util.LangBaseUtil;
import com.vci.starter.web.util.LocalFileUtil;
import com.vci.web.enumpck.ActionEnum;
import com.vci.web.enumpck.PlTypetypeEnum;
import com.vci.web.other.ExportActionLogBean;
import com.vci.web.other.ExportBeans;
import com.vci.web.service.*;
import com.vci.web.util.*;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
 
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.util.*;
import java.util.stream.Collectors;
 
/**
 * Action管理的服务实现类
 * @author yuxc
 * @date 2024-8-16
 */
@Service
public class OsActionServiceImpl implements OsActionServiceI {
 
    @Autowired
    private PlatformClientUtil platformClientUtil;
    /**
     * 保存Action分类信息
     * @param pLActionCls Action分类信息
     * @return 保存结果
     */
    @Override
    public BaseResult saveActionCls(PLActionClsDTO pLActionCls) throws PLException {
 
        if (pLActionCls.getName() == null || pLActionCls.getName().trim().equals("")) {
            throw new PLException("500", new String[]{"分类名称不能为空!"});
        }
        if (pLActionCls.getName().equals("未分类")) {
            throw new PLException("500", new String[]{"未分类节点已经存在!"});
        }
        PLActionCls pac = new PLActionCls();
        pac.id = WebUtil.getSnowflakePk();
        pac.name = pLActionCls.getName();
        pac.pid = pLActionCls.getPid();
        pac.description = pLActionCls.getDescription() == null ? "" : pLActionCls.getDescription();
        pac.creator = WebUtil.getCurrentUserId();
        pac.createTime = System.currentTimeMillis();
        pac.serialno = pLActionCls.getSerialno();
        // 保存分类信息
        String message = platformClientUtil.getUIService().creaetePLActionCls(pac);
        if (message.startsWith("0")) {
            if (message.equals("01")) {
                message = "分类" + pac.name + "已经存在!";
            } else if (message.equals("02")) {
                message = "同一分类下序号不能重复!";
            } else {
                message = "保存分类时发生异常!" + message.substring(1);
            }
            throw new PLException("500", new String[]{message});
        }
        return BaseResult.success("分类创建成功!");
    }
 
    /**
     * 修改Action分类信息
     * @param pLActionCls Action分类信息
     * @return 保存结果
     */
    @Override
    public BaseResult updateActionCls(PLActionClsDTO pLActionCls) throws PLException {
 
        if (pLActionCls.getName() == null || pLActionCls.getName().trim().equals("")) {
            throw new PLException("500", new String[]{"分类名称不能为空!"});
        }
        if (pLActionCls.getName().equals("未分类")) {
            throw new PLException("500", new String[]{"未分类节点已经存在!"});
        }
        if (pLActionCls.getId() == null || pLActionCls.getId().trim().equals("")) {
            throw new PLException("500", new String[]{"主键不能为空!"});
        }
        PLActionCls pac = new PLActionCls();
        pac.name = pLActionCls.getName();
        pac.pid = pLActionCls.getPid();
        pac.description = pLActionCls.getDescription() == null ? "" : pLActionCls.getDescription();
        pac.creator = WebUtil.getCurrentUserId();
        pac.createTime = System.currentTimeMillis();
        pac.serialno = pLActionCls.getSerialno();
        // 修改分类信息
        String message = platformClientUtil.getUIService().editPLActionCls(pac);
        if (message.startsWith("0")) {
            if (message.equals("01")) {
                message = "分类" + pac.name + "已经存在!";
            } else if (message.equals("02")) {
                message = "同一分类下序号不能重复!";
            } else {
                message = "修改分类时发生异常!" + message.substring(1);
            }
            throw new PLException("500", new String[]{message});
        }
        return BaseResult.success("分类修改成功!");
    }
 
    /**
     * 获取Action分类树
     * isExp 是否用户导出 true是,false否
     * @return 查询结果
     */
    @Override
    public BaseResult getActionTree(boolean isExp) throws PLException {
        PLActionCls[] clses = platformClientUtil.getUIService().getPLActionClsArray();
        PLActionClsDTO treDto = new PLActionClsDTO();
        treDto.setName("Action分类");
        treDto.setId("root");
        Map<String, List<PLActionCls>> allDataMap = Arrays.stream(clses).collect(Collectors.groupingBy(pl -> pl.pid));
 
        for (PLActionCls cls : clses) {
            if (StringUtils.isBlank(cls.pid)) {
                PLActionClsDTO parentDto = new PLActionClsDTO();
                parentDto.setId(cls.id);
                parentDto.setName(cls.name);
                parentDto.setPid("root");
                parentDto.setDescription(cls.description);
                parentDto.setCreator(cls.creator);
                parentDto.setCreateTime(cls.createTime);
                parentDto.setSerialno(cls.serialno);
                //这里处理导出树的逻辑
                if(isExp){
                    Constraint[] consArray = new Constraint[1];
                    consArray[0] =  new Constraint("plactioncls", cls.id);
                    PLAction[] plActionsByConsArray = platformClientUtil.getUIService().getPLActionsByConsArray(consArray);
                    if(parentDto.getChilds().isEmpty() && plActionsByConsArray.length == 0){
                        continue;
                    }
                    for (PLAction plAction : plActionsByConsArray) {
                        PLActionDTO plActionDTO = new PLActionDTO();
                        plActionDTO.setPlName(plAction.plCode + "/" + plAction.plName);
                        plActionDTO.setPlCode(plAction.plCode);
                        plActionDTO.setPlOId(plAction.plOId);
                        parentDto.getActionChilds().add(plActionDTO);
                    }
                }
                addClsTreeNode(parentDto, allDataMap, isExp);
                treDto.getChilds().add(parentDto);
            }
        }
        PLActionClsDTO plac = new PLActionClsDTO();
        plac.setName("未分类");
        if(isExp){
            Constraint[] consArray = new Constraint[1];
            consArray[0] =  new Constraint("plactioncls", "");
            PLAction[] plActionsByConsArray = platformClientUtil.getUIService().getPLActionsByConsArray(consArray);
            for (PLAction plAction : plActionsByConsArray) {
                PLActionDTO plActionDTO = new PLActionDTO();
                plActionDTO.setPlName(plAction.plCode + "/" + plAction.plName);
                plActionDTO.setPlCode(plAction.plCode);
                plActionDTO.setPlOId(plAction.plOId);
                plac.getActionChilds().add(plActionDTO);
            }
        }
        treDto.getChilds().add(plac);
        return BaseResult.success(treDto);
    }
    /**
     * 获取Action表格数据
     * dto 查询条件
     * @return 查询结果
     */
    @Override
    public BaseResult getActionTableData(PLActionQueryDTO dto) throws PLException {
        Constraint[] consArray ;
        if(StringUtils.isNotBlank(dto.getPlactioncls())){
            consArray = new Constraint[7];
            consArray[6] = new Constraint("plactioncls", dto.getPlactioncls().equals("root") ? "": dto.getPlactioncls());
        }else {
            consArray = new Constraint[6];
        }
        consArray[0] = new Constraint("plcode", dto.getPlcode());
        consArray[1] = new Constraint("plname", dto.getPlname());
        consArray[2] = new Constraint("plbsurl", dto.getPlbsurl());
        consArray[3] = new Constraint("plcsclass", dto.getPlcsclass());
        consArray[4] = new Constraint("pltypetype", dto.getPltypetype());
        consArray[5] = new Constraint("pldesc", dto.getPldesc());
        PLAction[] plActionsByConsArray = platformClientUtil.getUIService().getPLActionsByConsArray(consArray);
        Arrays.sort(plActionsByConsArray, new Comparator<PLAction>() {
            @Override
            public int compare(PLAction o1, PLAction o2) {
                String py1 = PinyinCommon.getPingYin(o1.plCode);
                String py2 = PinyinCommon.getPingYin(o2.plCode);
                return py1.compareTo(py2);
            }
        });
        return BaseResult.dataList(Arrays.asList(plActionsByConsArray));
    }
    /**
     * 保存Action数据
     * dto action传输对象
     * @return 保存结果
     */
    @Override
    public BaseResult saveAction(PLActionDTO dto) throws PLException {
        if(StringUtils.isBlank(dto.getPlCode())){
            throw new PLException("500", new String[]{"请输入编号"});
        }
        PLAction[] actionsInDB= platformClientUtil.getUIService().getAllPLAction();
        for(int i =0;i<actionsInDB.length;i++){
            if (dto.getPlCode().equals(actionsInDB[i].plCode)) {
                throw new PLException("500", new String[]{"新建Action编号重复,请重新输入编号"});
            }
        }
        PLAction plAction = new PLAction();
        plAction.plOId = WebUtil.getSnowflakePk();
        plAction.plCode = StringUtils.defaultString(dto.getPlCode());
        plAction.plName = StringUtils.defaultString(dto.getPlName());
        plAction.plCSClass = StringUtils.defaultString(dto.getPlCSClass());
        plAction.plBSUrl = StringUtils.defaultString(dto.getPlBSUrl());
        plAction.plDesc = StringUtils.defaultString(dto.getPlDesc());
        plAction.plCreateUser = WebUtil.getCurrentUserId();
        plAction.plModifyUser = WebUtil.getCurrentUserId();
        plAction.plActionCls = StringUtils.defaultString(dto.getPlActionCls());
        plAction.plTypeType = StringUtils.defaultString(dto.getPlTypeType());
        boolean b = platformClientUtil.getUIService().savePLAction(plAction);
        if(!b){
            throw new PLException("500", new String[]{"保存失败!!"});
        }
        return BaseResult.success("操作成功!");
    }
    /**
     * 修改Action数据
     * dto action传输对象
     * @return 修改结果
     */
    @Override
    public BaseResult updateAction(PLActionDTO dto) throws PLException {
        if(StringUtils.isBlank(dto.getPlCode())){
            throw new PLException("500", new String[]{"编号不能为空"});
        }
        PLAction[] actionsInDB= platformClientUtil.getUIService().getAllPLAction();
        for(int i =0;i<actionsInDB.length;i++){
            if (dto.getPlCode().equals(actionsInDB[i].plCode) && !dto.getPlOId().equals(actionsInDB[i].plOId)) {
                throw new PLException("500", new String[]{"修改Action编号重复,请确认编号"});
            }
        }
        PLAction plAction = new PLAction();
        plAction.plOId = StringUtils.defaultString(dto.getPlOId());
        plAction.plCode = StringUtils.defaultString(dto.getPlCode());
        plAction.plName = StringUtils.defaultString(dto.getPlName());
        plAction.plCSClass = StringUtils.defaultString(dto.getPlCSClass());
        plAction.plBSUrl = StringUtils.defaultString(dto.getPlBSUrl());
        plAction.plDesc = StringUtils.defaultString(dto.getPlDesc());
        plAction.plCreateUser = dto.getPlCreateUser();
        plAction.plModifyUser = WebUtil.getCurrentUserId();
        plAction.plActionCls = StringUtils.defaultString(dto.getPlActionCls());
        plAction.plTypeType = StringUtils.defaultString(dto.getPlTypeType());
        boolean b = platformClientUtil.getUIService().updatePLAction(plAction);
        if(!b){
            throw new PLException("500", new String[]{"修改失败!!"});
        }
        return BaseResult.success("修改成功!");
    }
 
    /**
     * 删除Action数据
     * dto action传输对象
     * @return 删除结果
     */
    @Override
    public BaseResult deleteAction(PLActionDTO dto) throws PLException {
        PLAction plAction = new PLAction();
        plAction.plOId = StringUtils.defaultString(dto.getPlOId());
        plAction.plCode = StringUtils.defaultString(dto.getPlCode());
        plAction.plName = StringUtils.defaultString(dto.getPlName());
        plAction.plCSClass = StringUtils.defaultString(dto.getPlCSClass());
        plAction.plBSUrl = StringUtils.defaultString(dto.getPlBSUrl());
        plAction.plDesc = StringUtils.defaultString(dto.getPlDesc());
        plAction.plCreateUser = dto.getPlCreateUser();
        plAction.plModifyUser = WebUtil.getCurrentUserId();
        plAction.plActionCls = StringUtils.defaultString(dto.getPlActionCls());
        plAction.plTypeType = StringUtils.defaultString(dto.getPlTypeType());
        boolean b = platformClientUtil.getUIService().deletePLAction(plAction);
        if(!b){
            throw new PLException("500", new String[]{"删除失败!!"});
        }
        return BaseResult.success("删除成功!");
    }
    /**
     * 导出Action
     * @return
     */
    @Override
    public void exportBeans(List<String> actionOid, HttpServletResponse response) throws PLException, IOException {
        String defaultTempFolder = LocalFileUtil.getDefaultTempFolder();
        String vciqtmfFileName = defaultTempFolder + File.separator + "VCIACTIONMODELFILE" + new Date().getTime() + ".vciamf";
        HashMap exportBeans = new HashMap<String, Object>();
        getExportBeans(actionOid, exportBeans);// 获得导出Bean同时,记录log
 
        ObjectOutputStream vciamfFileStream = null;
        try {
            File vciqtmfFile = new File(vciqtmfFileName);
            vciamfFileStream = new ObjectOutputStream(new FileOutputStream(vciqtmfFile));
            vciamfFileStream.writeObject(exportBeans);
        }finally {
            try {
                if (vciamfFileStream != null) {
                    vciamfFileStream.flush();
                    vciamfFileStream.close();
                }
            } catch (Exception e) {
                throw new PLException("500",new String[]{"导出流关闭异常!"});
            }
        }
        ControllerUtil.writeFileToResponse(response,vciqtmfFileName);
        FileUtil.del(defaultTempFolder + File.separator);
    }
 
    @Override
    public BaseResult impData(MultipartFile file) throws IOException, PLException {
        // 导入的对象
        ExportBeans exportBeans = null;
        if (file == null) {
            return BaseResult.fail(FrameWorkLangCodeConstant.IMPORT_FAIL, new String[]{"无导入的文件"});
        }
        if (!file.getOriginalFilename().endsWith(".vciamf")) {
            throw new VciBaseException("仅能上传.vciqtf格式文件,请重新上传!");
        }
        HashMap map;
        try {
            ObjectInputStream obj = new ObjectInputStream(file.getInputStream());
            map = (HashMap) obj.readObject();
        } catch (ClassNotFoundException e) {
            return BaseResult.fail("导入对象未获取成功!!导入对象版本号不同!");
        }
        //最终的持久化
        ArrayList<PLActionCls> pLActionClsList = new ArrayList<>();
        // 更换actionId后,可以从此导航中获得原来的id
        HashMap<String /* newId */, String /* oldId */> actionIdNav = new HashMap<String /* newId */, String /* oldId */>();
        // 更换actionClsId后,可以从此导航中获得原来的id
        HashMap<String /* newId */, String /* oldId */> actionClsIdNav = new HashMap<String /* newId */, String /* oldId */>();
        //保存所有父分类,用id主key
        HashMap<String/*id*/,PLActionCls> actionClses = new HashMap<String/*id*/,PLActionCls>();
        // 存储符合条件的PLAction
        ArrayList<PLAction> optionPLActionList = new ArrayList<>();
        // 存储符合条件的PLActionCls
        ArrayList<PLActionCls> optionPLActionClsList =  new ArrayList<>();
        // 库中的所有Action分类对象
        PLActionCls[] pLActionClses = null;
        exportBeans = (ExportBeans) map.get("exportBeans");
        // 添加导入的数据
        addImportData(exportBeans, pLActionClsList, actionIdNav, actionClsIdNav, optionPLActionClsList, pLActionClses, optionPLActionList);
        // 将PLActionCls 、PLAction 对应的set集合转换成数组(匹配原addExportTreeNode方法)
        PLActionCls[] newPLActionClsArray = new PLActionCls[optionPLActionClsList.size()];
        PLAction[] newPLActionArray = new PLAction[optionPLActionList.size()];
        optionPLActionClsList.toArray(newPLActionClsArray);
        optionPLActionList.toArray(newPLActionArray);
        //清楚分类id
        actionClses.clear();
        //保存所有分类id
        for (int i = 0; i < newPLActionClsArray.length; i++) {
            actionClses.put(newPLActionClsArray[i].id,newPLActionClsArray[i]);
        }
        //保存所有存在action的分类(子分类存在action也保存)
        HashSet<PLActionCls> pLActionClss =new HashSet<PLActionCls> ();
        for (int i = 0; i < newPLActionArray.length; i++) {
            //缓存该分类的所有父分类
            saveParentCls(newPLActionArray[i].plActionCls,pLActionClss,actionClses);
        }
        PLActionCls[] actionClslist = new PLActionCls[pLActionClss.size()];
        pLActionClss.toArray(actionClslist);
        PLActionClsDTO treDto = new PLActionClsDTO();
        treDto.setName("Action分类");
 
        Map<String, List<PLAction>> plActionMap = Arrays.stream(newPLActionArray).collect(Collectors.groupingBy(e -> e.plActionCls));
        Map<String, List<PLActionCls>> plActionClsMap = pLActionClss.stream().collect(Collectors.groupingBy(e -> e.pid));
        Map<String, List<PLActionCls>> allCls = Arrays.stream(platformClientUtil.getUIService().getPLActionClsArray()).collect(Collectors.groupingBy(e -> e.name));
        // 添加子节点(源树节点)
        for (Map.Entry<String, PLActionCls> entry : exportBeans.getPLActionClsBeans().entrySet()) {
            if (StringUtils.isBlank(entry.getValue().pid)) {
                PLActionClsDTO parentDto = new PLActionClsDTO();
                parentDto.setId(entry.getValue().id);
                parentDto.setName(entry.getValue().name);
                parentDto.setPid(entry.getValue().pid);
                parentDto.setDescription(entry.getValue().description);
                parentDto.setCreator(entry.getValue().creator);
                parentDto.setCreateTime(entry.getValue().createTime);
                parentDto.setSerialno(entry.getValue().serialno);
                addExportTreeNode(plActionClsMap, plActionMap, parentDto, allCls, exportBeans);
                treDto.getChilds().add(parentDto);
            }
        }
        PLActionClsDTO noDto = new PLActionClsDTO();
        noDto.setName("未分类");
        if(plActionMap.containsKey("")){
            for (PLAction plAction : plActionMap.get("")) {
                PLActionClsDTO childPrentDto = new PLActionClsDTO();
                if (plAction.plName.endsWith("@#修改$%")) {
                    childPrentDto.setName(plAction.plCode + "/" + plAction.plName.replace("@#修改$%", "【修改完成】"));
                    plAction.plName = plAction.plName.replace("@#修改$%", "");
                    platformClientUtil.getUIService().updatePLAction(plAction);
                }else
                if (plAction.plName.endsWith("@#存在在未分类中$%")) {
                    childPrentDto.setName(plAction.plCode + "/" + plAction.plName.replace("@#存在在未分类中$%", "【action存在在未分类中,修改完成】"));
                    plAction.plName = plAction.plName.replace("@#存在在未分类中$%", "");
                    platformClientUtil.getUIService().updatePLAction(plAction);
//                    plAction.plName = plAction.plName.replace("@#存在在未分类中$%", "【action存在在未分类中,修改Action并按导入文件创建action分类】");
                }
                else {
                    childPrentDto.setName(plAction.plCode + "/" + "【新增完成】");
//                    plAction.plName += "【新增】";
                    platformClientUtil.getUIService().savePLAction(plAction);
                }
                dealParam(exportBeans, plAction);
                childPrentDto.setId(plAction.plOId);
                childPrentDto.setPid(plAction.plActionCls);
                noDto.getChilds().add(childPrentDto);
            }
        }
        treDto.getChilds().add(noDto);
 
        return BaseResult.success(treDto);
    }
    /**
     * 导出Action
     * @param plActionExpDTO 导出属性设置对象
     */
    @Override
    public void exportAction(PLActionExpDTO plActionExpDTO, HttpServletResponse response) throws PLException, IOException {
        String defaultTempFolder = LocalFileUtil.getDefaultTempFolder();
        String excelPath = defaultTempFolder + File.separator + plActionExpDTO.getFileName() + ".xls";
        try {
            new File(excelPath).createNewFile();
        } catch (Throwable e) {
            throw new VciBaseException(LangBaseUtil.getErrorMsg(e), new String[]{excelPath}, e);
        }
        isValidPageForamt(plActionExpDTO);
        //设置列
        List<WriteExcelData> excelDataList = new ArrayList<>();
        //设置列头
        for (int index = 0; index < plActionExpDTO.getColumnName().size(); index++) {
            excelDataList.add(new WriteExcelData(0,index, plActionExpDTO.getColumnName().get(index)));
        }
        PLAction[] allPLAction ;
        if(plActionExpDTO.getDataType().equals(ActionEnum.EXP_ALL.getValue()) ||
                plActionExpDTO.getDataType().equals(ActionEnum.EXP_PAGE.getValue())){
            allPLAction = platformClientUtil.getUIService().getAllPLAction();
        }else{
            allPLAction = new PLAction[plActionExpDTO.getChooseDataOid().size()];
            for (int i = 0; i < plActionExpDTO.getChooseDataOid().size(); i++) {
                allPLAction[i] = platformClientUtil.getUIService().getPLActionById(plActionExpDTO.getChooseDataOid().get(i));
            }
        }
        if(Func.isEmpty(allPLAction)){
            excelDataList.add(new WriteExcelData(1,1, "根据属性名称未查询到属性信息,请刷新后尝试重新导出!"));
        }else{
            for (int i = 0; i < allPLAction.length; i++) {
                PLAction action = allPLAction[i];
                List<String> columnName = plActionExpDTO.getColumnName();
                for (int index = 0; index < columnName.size(); index++) {
                    switch (columnName.get(index)){
                        case "编号":
                            excelDataList.add(new WriteExcelData(i+1,index, action.plCode));
                            break;
                        case "类路径":
                            excelDataList.add(new WriteExcelData(i+1,index, action.plBSUrl));
                            break;
                        case "链接地址":
                            excelDataList.add(new WriteExcelData(i+1,index, action.plCSClass));
                            break;
                        case "描述":
                            excelDataList.add(new WriteExcelData(i+1,index, action.plDesc));
                            break;
                        case "类型":
                            excelDataList.add(new WriteExcelData(i+1,index, action.plTypeType.equals(PlTypetypeEnum.BUSINESS.getValue()) ?
                                    PlTypetypeEnum.BUSINESS.getText() : PlTypetypeEnum.LINK.getText()));
                            break;
                        case "名称":
                            excelDataList.add(new WriteExcelData(i+1,index, action.plName));
                            break;
                    }
                }
            }
        }
        WriteExcelOption excelOption = new WriteExcelOption(excelDataList);
        ExcelUtil.writeDataToFile(excelPath, excelOption);
        ControllerUtil.writeFileToResponse(response,excelPath);
        FileUtil.del(defaultTempFolder + File.separator);
    }
    /**
     * 保存Action参数数据
     * dto action传输对象
     * @return 保存结果
     */
    @Override
    public BaseResult savePLActionParam(PLActionParamDTO dto) throws PLException {
        if(dto.getName() == null || dto.getName().equals("")) {
            throw new PLException("500",new String[]{"参数名称不能为空"});
        }
        PLActionParam param = new PLActionParam();
        param.oid = "";
        param.name = dto.getName();
        param.defaultValue = dto.getDefaultValue();
        param.description = dto.getDescription();
        param.action = dto.getAction();
        String message = platformClientUtil.getUIService().createPLActionParam(param);
 
        if(message.startsWith("0")) {
            if(message.equals("01")) {
                throw new PLException("500",new String[]{"参数名已经存在!"});
            } else {
                throw new PLException("500",new String[]{"添加按钮参数时发生异常:" + message.substring(1)});
            }
        }
        return BaseResult.success();
    }
 
    @Override
    public BaseResult updatePLActionParam(PLActionParamDTO dto) throws PLException {
        if(dto.getName() == null || dto.getName().equals("")) {
            throw new PLException("500",new String[]{"参数名称不能为空"});
        }
        PLActionParam param = new PLActionParam();
        param.oid = dto.getOid();
        param.name = dto.getName();
        param.defaultValue = dto.getDefaultValue();
        param.description = dto.getDescription();
        param.action = dto.getAction();
        String message = platformClientUtil.getUIService().editPLActionParam(param);
 
        if(message.startsWith("0")) {
            if(message.equals("01")) {
                throw new PLException("500",new String[]{"参数名已经存在!"});
            } else {
                throw new PLException("500",new String[]{"添加按钮参数时发生异常:" + message.substring(1)});
            }
        }
        return BaseResult.success();
    }
    /**
     * 删除Action参数数据
     * oid 参数主键
     * @return 保存结果
     */
    @Override
    public BaseResult deletePLActionParam(String oid) throws PLException {
        if(StringUtils.isBlank(oid)){
            throw new PLException("500", new String[]{"参数主键不能为空"});
        }
        String message = platformClientUtil.getUIService().deletePLActionParam(oid);
        if (message.startsWith("0")) {
            throw new PLException("500", new String[]{"删除按钮参数时发生异常:" + message.substring(1)});
        }
        return BaseResult.success();
    }
    /**
     * 查询Action参数列表数据
     * actionOid 参数主键
     * @return 保存结果
     */
    @Override
    public BaseResult getPLActionParam(String actionOid) throws PLException {
        if (StringUtils.isBlank(actionOid)){
            throw new PLException("500", new String[]{"Action主键不能为空!"});
        }
        PLActionParam[] paramArrays = platformClientUtil.getUIService().getPLActionParamArrayByActionId(actionOid);
        List<PLActionParamDTO> dtos = new ArrayList<>();
        for (PLActionParam paramArray : paramArrays) {
            PLActionParamDTO dto = new PLActionParamDTO();
            dto.setAction(paramArray.action);
            dto.setOid(paramArray.oid);
            dto.setName(paramArray.name);
            dto.setDescription(paramArray.description);
            dto.setDefaultValue(paramArray.defaultValue);
            dtos.add(dto);
        }
        return BaseResult.dataList(dtos);
    }
 
    /**
     * 删除分类
     * @param dto 分类对象
     * @return 处理结果
     * @throws PLException
     */
    @Override
    public BaseResult deleteActionCls(PLActionClsDTO dto) throws PLException {
        PLActionCls[] clses = platformClientUtil.getUIService().getPLActionClsArray();
        // 将所有分类父分类保存
        HashSet<String> clsPids = new HashSet<String>();
        for (PLActionCls plActionCls : clses) {
            clsPids.add(plActionCls.pid);
        }
        if (dto.getName().equals("未分类")) {
            throw new PLException("500", new String[]{"未分类不能删除!"});
        }
        if (clsPids.contains(dto.getId())) {
            throw new PLException("500", new String[]{"该分类下存在子分类不能删除!\n请删除此分类下的子分类!"});
        }
        // 执行删除操作
        String message = platformClientUtil.getUIService().deletePLActionClsById(dto.getId());
        if (message.startsWith("0")) {
            throw new PLException("500", new String[]{"删除分类失败!" + message.substring(1)});
        }
        return BaseResult.success("分类删除成功!" + message.substring(1));
    }
 
    public boolean isValidPageForamt(PLActionExpDTO plActionExpDTO) throws PLException {
 
        boolean res = false;
        if(plActionExpDTO.getDataType().equals(ActionEnum.EXP_ALL.getValue()) ||
                plActionExpDTO.getDataType().equals(ActionEnum.EXP_CHOOSE.getValue())) {
            res = true;
            return res;
        }
        if(StringUtils.isBlank(plActionExpDTO.getPageNum())){
            throw new PLException("500", new String[]{"页码不能为空"});
        } else{
            int pageCount = 1;//这里固定由于界面没有翻页功能
            String[] pages = plActionExpDTO.getPageNum().split("-");
 
            // 用dobule接收输入的数据,防止输入超大值(大于Integer.MAX_VALUE)
            // 转换成Integer,进行比较,及在提示内容中去掉double类型数据可能会出现的小数点
            if(pages.length == 1){
                double pageD = Double.parseDouble(pages[0]);
                if(pageD > Integer.MAX_VALUE){
                    throw new PLException("500", new String[]{"起始页码 " + String.valueOf(pageD) + " 不得大于 " + Integer.MAX_VALUE});
                }else{
                    int page = (int)pageD;
                    if(page > pageCount){
                        throw new PLException("500", new String[]{"输入的页码 " + page + " 不得大于总页数 " + pageCount});
                    } else if(page > Integer.MAX_VALUE){
                        throw new PLException("500", new String[]{"输入的页码 " + page + " 不得大于 " + Integer.MAX_VALUE});
                    } else {
                        res = true;
                    }
                }
            } else{
                double pageStartD = Double.parseDouble(pages[0]);
                double pageEndD = Double.parseDouble(pages[1]);
                if(pageStartD > Integer.MAX_VALUE){
                    throw new PLException("500", new String[]{"起始页码 " + pageStartD + " 不得大于 " + Integer.MAX_VALUE});
                } else if(pageEndD > Integer.MAX_VALUE){
                    throw new PLException("500", new String[]{"结束页码 " + pageEndD + " 不得大于 " + Integer.MAX_VALUE});
                } else{
                    int pageStart = (int)pageStartD;
                    int pageEnd = (int)pageEndD;
                    if(pageStart > pageCount){
                        throw new PLException("500", new String[]{"起始页码 " + pageStart + " 不得大于总页数 " + pageCount});
                    } else if(pageEnd > pageCount){
                        throw new PLException("500", new String[]{"结束页码 " + pageEnd + " 不得大于总页数 " + pageCount});
                    } else if(pageStart > pageEnd){
                        throw new PLException("500", new String[]{"起始页码 " + pageStart + " 不得大于结束页码 " + pageEnd});
                    } else{
                        res = true;
                    }
                }
            }
        }
        return res;
    }
 
 
    /**
     * 处理参数列表
     * @param exportBeans 导入数据集合
     * @param plAction action对象
     * @throws PLException
     */
    private void dealParam(ExportBeans exportBeans, PLAction plAction) throws PLException {
        PLActionParam[] plActionParamArrayByActionId = exportBeans.getPLActionParamArrayByActionId(plAction.plOId);
        PLActionParam[] paramArray = platformClientUtil.getUIService().getPLActionParamArrayByActionId(plAction.plOId);
        Map<String, List<PLActionParam>> params = Arrays.stream(paramArray).collect(Collectors.groupingBy(e -> e.oid));
        if(plActionParamArrayByActionId == null){
            return;
        }
        for (PLActionParam param : plActionParamArrayByActionId) {
            if(params.containsKey(param)){
                platformClientUtil.getUIService().editPLActionParam(param);
            }else {
                platformClientUtil.getUIService().createPLActionParam(param);
            }
        }
    }
 
    private void addExportTreeNode(Map<String, List<PLActionCls>> pLActionClses, Map<String, List<PLAction>> plActions,
                                   PLActionClsDTO parentDto,Map<String, List<PLActionCls>> allCls, ExportBeans exportBeans) throws PLException {
 
        //处理当前节点下的action
        if(plActions.containsKey(parentDto.getId())){
            for (PLAction plAction : plActions.get(parentDto.getId())) {
                PLActionClsDTO childPrentDto = new PLActionClsDTO();
                childPrentDto.setId(plAction.plOId);
                if (plAction.plName.endsWith("@#修改$%")) {
                    childPrentDto.setName(plAction.plCode + "/" + plAction.plName.replace("@#修改$%", "【修改成功】"));
//                    plAction.plName = plAction.plName.replace("@#修改$%", "【修改】");
                    plAction.plName = plAction.plName.replace("@#修改$%", "");
                    platformClientUtil.getUIService().updatePLAction(plAction);
                }else
                if (plAction.plName.endsWith("@#存在在未分类中$%")) {
                    childPrentDto.setName(plAction.plCode + "/" + plAction.plName.replace("@#存在在未分类中$%", "【action存在在未分类中,修改Action成功】"));
//                    plAction.plName = plAction.plName.replace("@#存在在未分类中$%", "【action存在在未分类中,修改Action并按导入文件创建action分类】");
                    plAction.plName = plAction.plName.replace("@#存在在未分类中$%", "");
                    platformClientUtil.getUIService().updatePLAction(plAction);
                }
                else {
                    childPrentDto.setName(plAction.plCode + "/" + plAction.plName.replace("@#新增%", "【新增成功】"));
//                    plAction.plName += "【新增】";
                    platformClientUtil.getUIService().savePLAction(plAction);
                }
                dealParam(exportBeans, plAction);
                childPrentDto.setPid(plAction.plActionCls);
                parentDto.getChilds().add(childPrentDto);
            }
        }
        if(pLActionClses.containsKey(parentDto.getId())){
            List<PLActionCls> plActionCls = pLActionClses.get(parentDto.getId());
            for (PLActionCls plActionCl : plActionCls) {
                PLActionClsDTO childParentDto = new PLActionClsDTO();
                childParentDto.setId(plActionCl.id);
                if(allCls.containsKey(childParentDto.getName())){
                    childParentDto.setName(plActionCl.name);
                }else {
                    childParentDto.setName(plActionCl.name + "【新增完成】");
                    platformClientUtil.getUIService().creaetePLActionCls(plActionCl);
                }
                childParentDto.setPid(plActionCl.pid);
                childParentDto.setDescription(plActionCl.description);
                childParentDto.setCreator(plActionCl.creator);
                childParentDto.setCreateTime(plActionCl.createTime);
                childParentDto.setSerialno(plActionCl.serialno);
                addExportTreeNode(pLActionClses, plActions, childParentDto, allCls, exportBeans);
                parentDto.getChilds().add(childParentDto);
            }
 
        }
 
    }
 
 
    /**
     * 保存所有父分类
     * @param plActionCls
     * @param pLActionClsList
     */
    private void saveParentCls(String plActionCls, HashSet<PLActionCls> pLActionClsList,
                               HashMap<String/*id*/,PLActionCls> actionClses) {
        if(actionClses.containsKey(plActionCls)){
            PLActionCls pCls = actionClses.get(plActionCls);
            pLActionClsList.add(pCls);
            saveParentCls(pCls.pid, pLActionClsList, actionClses);
        }
 
    }
 
    private void addImportData(ExportBeans exportBeans, ArrayList<PLActionCls> pLActionClsList, HashMap<String /* newId */,
            String /* oldId */> actionIdNav,HashMap<String /* newId */, String /* oldId */> actionClsIdNav,
            ArrayList<PLActionCls> optionPLActionClsList, PLActionCls[] pLActionClses, ArrayList<PLAction> plActionList)
            throws PLException {
        HashMap<String, PLAction> pLActionBeans = exportBeans.getPLActions();
        if (pLActionBeans == null) {
            throw new VciBaseException("导入对象未获取成功!!");
        }
        //数据库中没有存在的数据对象,需要进行保存
//        ArrayList<PLAction> plActionList = new ArrayList<>();
        PLAction[] allPLAction = platformClientUtil.getUIService().getAllPLAction();
        Map<String, PLAction> allPLActionMap = Arrays.stream(allPLAction).collect(Collectors.toMap(e -> e.plOId, e -> e));
        Set<Map.Entry<String, PLAction>> plActions = pLActionBeans.entrySet();
        for (Map.Entry<String, PLAction> entry : plActions) {
            PLAction plAction = entry.getValue();
            PLAction plActionInDB =allPLActionMap.get(plAction.plOId);
 
            if (plActionInDB != null) {
                if( plActionInDB.plActionCls != ""){
                    plAction.plActionCls = plActionInDB.plActionCls;
                    // plAction.plOId = newId;
                    plAction.plName += "@#修改$%";
                    plActionList.add(plAction);
                    continue;
                }else{
                    plAction.plName += "@#存在在未分类中$%";
                }
 
            }
            // 将该实例acion存入到plActionList中
            plActionList.add(plAction);
 
            // 定义list存储当前action到数据库action的路径上的所有PLActionCls对象
            List<PLActionCls> plActionClsList = new ArrayList<PLActionCls>();
            // 获得库中的最近的PLActionCls对象
            String pId = WebUtil.getSnowflakePk();
            String oId = WebUtil.getSnowflakePk();
 
            PLActionCls pLActionCls = getParentPLActionClsInDBById(plAction,
                    pId, plActionClsList, actionClsIdNav, exportBeans, optionPLActionClsList, pLActionClses);
 
            changePLActionOID(plAction, oId, pId, actionIdNav);
 
            if (plActionClsList.size() == 1) {
                // 删除"未分类"分类对象
                PLActionCls plActionCls = plActionClsList.get(plActionClsList
                        .size() - 1);
 
                if(pLActionCls != null){
                    plAction.plActionCls = pLActionCls.id;
                    if(plActionCls.name.equals("未分类")){
                        plAction.plActionCls = "";
                    }
                    plActionClsList.remove(plActionClsList.size() - 1);
                }else{
                    if(plActionCls.name.equals("未分类")){
                        plActionClsList.remove(plActionClsList.size() - 1);
                    }else{
                        plActionCls.pid = "";
                    }
 
                }
 
            }
            if (plActionClsList.size() >= 2) {
 
                PLActionCls plActionCls2 = plActionClsList.get(plActionClsList
                        .size() - 2);
                PLActionCls plActionCls1 = plActionClsList.get(plActionClsList
                        .size() - 1);
                if (pLActionCls != null) {
                    // 将导入对象与“库中的最近的PLActionCls对 象”name相同的对象
                    // 的下一个PLActionCls对象父id改为库中“最近”PLActionCls对象id
                    plActionClsList.remove(plActionClsList.size() - 1);
                    plActionCls2.pid = pLActionCls.id;
                }else{
                    if(plActionCls1.name.equals("未分类")){
                        plActionClsList.remove(plActionClsList.size() - 1);
                        plActionCls2.pid = "";
                    }else{
                        plActionCls1.pid = "";
                    }
 
                }
 
            }
            // 增加到整体list中用来最终持久化
            pLActionClsList.addAll(plActionClsList);
        }
    }
 
 
    private void changePLActionOID(PLAction plAction, String oId, String pId, HashMap<String /* newId */, String /* oldId */> actionIdNav) {
        actionIdNav.put(oId, plAction.plOId);
        plAction.plOId = oId;
        plAction.plActionCls = pId;
    }
    /***
     * 获得库中的PLActionCls对象,用来嫁接导入来的树
     *
     * @param
     * @param plActionClsList
     * @return
     */
    private PLActionCls getParentPLActionClsInDBById(Object plActionClsIdObj,
                                                     String newPLActionClsId, List<PLActionCls> plActionClsList,
                                                     HashMap<String /* newId */, String /* oldId */> actionClsIdNav,ExportBeans exportBeans,
                                                     ArrayList<PLActionCls> optionPLActionClsList, PLActionCls[] pLActionClses) {
        String pId = null;
        if (plActionClsIdObj instanceof PLAction) {
            pId = ((PLAction) plActionClsIdObj).plActionCls;
            if(pId.equals("")){
                PLActionCls noneCls = new PLActionCls("", "未分类", "", "", "", 0, (short)0);
                plActionClsList.add(noneCls);
                return noneCls;
            }
        }
        if (plActionClsIdObj instanceof PLActionCls) {
            pId = ((PLActionCls) plActionClsIdObj).pid;
            pId = actionClsIdNav.get(pId);
            if(pId.equals("")){
                pId = "null";
            }
 
        }
 
        PLActionCls plActionCls = exportBeans.getPLActionClsBeanById(pId);// 从导入对象中获得父分类
 
 
        PLActionCls tempPLActionCls = null;
        if (plActionCls != null) {// plActionCls为空 证明父节点为根节点
 
            plActionClsList.add(plActionCls);
            if(optionPLActionClsList.contains(plActionCls)){
                return plActionCls ;
            }
            for (PLActionCls Cls : pLActionClses) {
                if ((plActionCls.id.equals("") && plActionCls.name.trim()
                        .equals("未分类"))
                        || plActionCls.name.trim().equals(Cls.name.trim())) {
                    tempPLActionCls = Cls;
                }
            }
            plActionCls.id = newPLActionClsId; // 修改父分类id
        } else {
            return null;
        }
 
        if (tempPLActionCls == null) {
            String newClsId = WebUtil.getSnowflakePk();
            actionClsIdNav.put(newClsId, plActionCls.pid);
            plActionCls.pid = newClsId;
            return getParentPLActionClsInDBById(plActionCls, newClsId,
                    plActionClsList, actionClsIdNav, exportBeans, optionPLActionClsList, pLActionClses);
        }
        return tempPLActionCls;
    }
 
    /**
     * 处理导出的对象
     * @param actionOid 界面选择的action列表数据
     * @param exportBeansMap 导出对象
     * @return
     * @throws PLException
     */
    private void getExportBeans(List<String> actionOid, HashMap exportBeansMap) throws PLException {
        PLActionCls[] plActionClsArray = platformClientUtil.getUIService().getPLActionClsArray();
        Map<String, PLActionCls> clsMap = Arrays.stream(plActionClsArray).collect(Collectors.toMap(e -> e.id, e -> e));
        ExportBeans exportBeans = new ExportBeans();
        for (String oid : actionOid) {
            PLAction plAction = platformClientUtil.getUIService().getPLActionById(oid);
            //有父节点则进行处理
            if(StringUtils.isNotBlank(plAction.plActionCls)){
                allPLActionClsParent(exportBeans, clsMap.get(plAction.plActionCls), clsMap);
            }
            exportBeans.getPLActions().put(plAction.plOId, plAction);
            PLActionParam[] params = platformClientUtil.getUIService().getPLActionParamArrayByActionId(plAction.plOId);
            if(params != null && params.length > 0){//如果参数存在
                for (PLActionParam plActionParam : params) {//添加action参数
                    exportBeans.addPLActionParamBean(plActionParam);
                }
            }
            String category = clsMap.containsKey(plAction.plActionCls) ? clsMap.get(plAction.plActionCls).name : "";
            exportBeans.setLogBean(new ExportActionLogBean(ExportActionLogBean.RIGHT_STATE,
                    plAction.plCode,plAction.plName,plAction.plCSClass,plAction.plBSUrl,
                    plAction.plTypeType,plAction.plDesc,category));
        }
        exportBeansMap.put("exportBeans", exportBeans);
    }
    //增加父类数据
    private void allPLActionClsParent(ExportBeans exportBeans, PLActionCls cls, Map<String, PLActionCls> clsMap) {
        if(cls.pid != ""){
            allPLActionClsParent(exportBeans, clsMap.get(cls.pid), clsMap);
        }
        exportBeans.addPLActionClsBean(cls);
    }
 
    /**
     * 添加子节点
     * @param parentDto 父节点对象
     * @param allDataMap 所有分组对象
     * @param isExp true为导出功能的树,false为界面分类树
     */
    private void addClsTreeNode(PLActionClsDTO parentDto, Map<String, List<PLActionCls>> allDataMap, Boolean isExp) throws PLException {
        if(allDataMap.containsKey(parentDto.id)){
            for (PLActionCls cls : allDataMap.get(parentDto.id)) {
                PLActionClsDTO childDto = new PLActionClsDTO();
                childDto.setId(cls.id);
                childDto.setName(cls.name);
                childDto.setPid(cls.pid);
                childDto.setDescription(cls.description);
                childDto.setCreator(cls.creator);
                childDto.setCreateTime(cls.createTime);
                childDto.setSerialno(cls.serialno);
                if(isExp){
                    Constraint[] consArray = new Constraint[1];
                    consArray[0] =  new Constraint("plactioncls", cls.id);
                    PLAction[] plActionsByConsArray = platformClientUtil.getUIService().getPLActionsByConsArray(consArray);
                    if(parentDto.getChilds().isEmpty() && plActionsByConsArray.length == 0){
                        continue;
                    }
                    for (PLAction plAction : plActionsByConsArray) {
                        PLActionDTO plActionDTO = new PLActionDTO();
                        plActionDTO.setPlName(plAction.plCode + "/" + plAction.plName);
                        plActionDTO.setPlCode(plAction.plCode);
                        plActionDTO.setPlOId(plAction.plOId);
                        parentDto.getActionChilds().add(plActionDTO);
                    }
                }
                addClsTreeNode(childDto, allDataMap, isExp);
                parentDto.getChilds().add(childDto);
            }
        }
    }
 
}