wangting
2025-01-03 6f7f3834f66b08bed7af331ce1a168d6cd89292d
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
package com.vci.web.controller;
 
import cn.hutool.core.io.FileUtil;
import com.vci.constant.FrameWorkLangCodeConstant;
import com.vci.corba.common.PLException;
import com.vci.corba.portal.data.PLTabPage;
import com.vci.corba.portal.data.PLUILayout;
import com.vci.dto.UIAuthorDTO;
import com.vci.pagemodel.PLDefinationVO;
import com.vci.pagemodel.PLTabButtonVO;
import com.vci.pagemodel.PLUILayoutCloneVO;
import com.vci.pagemodel.UICloneVO;
import com.vci.starter.web.annotation.log.VciBusinessLog;
import com.vci.starter.web.exception.VciBaseException;
import com.vci.starter.web.pagemodel.BaseQueryObject;
import com.vci.starter.web.pagemodel.BaseResult;
import com.vci.starter.web.pagemodel.DataGrid;
import com.vci.starter.web.util.ControllerUtil;
import com.vci.starter.web.util.LocalFileUtil;
import com.vci.starter.web.util.VciBaseUtil;
import com.vci.web.service.OsBtmServiceI;
import com.vci.web.service.UIManagerServiceI;
import com.vci.starter.web.util.Lcm.Func;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
 
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.Date;
import java.util.Map;
 
/**
 * UI定义控制层
 * @author ludc
 * @date 2024/8/28 17:09
 */
@RestController
@RequestMapping("/uiManagerController")
public class UIManagerController {
 
    /**
     * 日志
     */
    private Logger logger = LoggerFactory.getLogger(getClass());
 
    /**
     * 业务类型的服务
     */
    @Autowired
    private OsBtmServiceI btmService;
 
    /**
     * UI定义服务
     */
    @Autowired
    private UIManagerServiceI uiManagerService;
 
    /**
     * 业务类型列表查询,非树结构:用于UI定义左侧业务类型查询
     * @param btmName
     * @return
     * @throws PLException
     */
    @GetMapping( "/getBizTree")
    @VciBusinessLog(operateName = "业务类型列表(主要用于UI定义业务类型树查询使用)")
    public BaseResult getBizTree(String btmName){
        try {
            return BaseResult.success(btmService.getBizTree(btmName));
        }catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "获取UI定义业务类型列表时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 通过业务类型name查询ui上下文,支持分页
     * @param baseQueryObject
     * @return
     * @throws PLException
     */
    @GetMapping( "/gridUIContextData")
    @VciBusinessLog(operateName = "通过业务类型name查询出ui上下文")
    public BaseResult gridUIContextData(BaseQueryObject baseQueryObject){
        try {
            return BaseResult.dataGrid(uiManagerService.gridUIContextData(baseQueryObject));
        }catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "通过业务类型name查询出ui上下文时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 创建UI上下文
     * btmTypeDTO 链接类型的保存对象
     * @return 保存结果
     */
    @PostMapping("/saveUIContextData")
    public BaseResult saveUIContextData(@RequestBody PLUILayout pluiLayout){
        try {
            return uiManagerService.saveUIContextData(pluiLayout) ? BaseResult.success("UI上下文创建成功!"):BaseResult.fail("UI上下文创建失败!");
        } catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "创建UI上下文时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 修改UI上下文
     * btmTypeDTO
     * @return 修改结果
     */
    @PutMapping("/updateUIContextData")
    public BaseResult updateUIContextData(@RequestBody PLUILayout pluiLayout){
        try {
            return uiManagerService.updateUIContextData(pluiLayout) ? BaseResult.success("UI上下文修改成功!"):BaseResult.fail("UI上下文修改失败!");
        } catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "修改UI上下文时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 删除UI上下文数据
     * oids 删除的oid信息
     * @return 删除结果
     */
    @DeleteMapping("/delUIContextData")
    public BaseResult delUIContextData(String[] oids,String plRelatedType){
        try {
            return uiManagerService.delUIContextData(oids,plRelatedType) ? BaseResult.success("UI上下文删除成功!"):BaseResult.fail("UI上下文删除失败!");
        } catch (PLException e) {
            e.printStackTrace();
            String exceptionMessage = "删除UI上下文时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * UI上下文克隆
     * pluiLayoutCloneVO 克隆参数对象
     * @return 克隆结构
     */
    @PostMapping("/cloneUIContextData")
    public BaseResult cloneUIContextData(@RequestBody PLUILayoutCloneVO pluiLayoutCloneVO){
        try {
            return uiManagerService.cloneUIContextData(pluiLayoutCloneVO) ? BaseResult.success("UI上下文克隆成功!"):BaseResult.fail("UI上下文克隆失败!");
        } catch (PLException e) {
            e.printStackTrace();
            String exceptionMessage = "UI上下文克隆时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 查询要导出UI上下文树
     * @param expDatas
     * @return
     * @throws PLException
     */
    @GetMapping( "/getExpContextTree")
    @VciBusinessLog(operateName = "查询要导出UI上下文树")
    public BaseResult getExpContextTree(String[] expDatas){
        try {
            return BaseResult.success(uiManagerService.getExpContextTree(Arrays.asList(expDatas)),"Success");
        }catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "查询要导出UI上下文树时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 导出UI上下文
     * name 链接类型名称
     * @return
     */
    @PostMapping("/expUIContextData")
    public void expUIContextData(@RequestBody Map<String,String> expConditionMap, HttpServletResponse response) throws PLException, IOException {
        try {
            String excelPath = uiManagerService.expUIContextData(expConditionMap);
            ControllerUtil.writeFileToResponse(response,excelPath);
            FileUtil.del(LocalFileUtil.getDefaultTempFolder() + File.separator);
        } catch (Exception e) {
            String msg = "导出UI上下文时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            try {
                //出错时
                e.printStackTrace();
                ControllerUtil.writeDataToResponse(response,"error_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss") + ".txt", StringUtils.isNotBlank(msg)?msg.getBytes():new byte[0],null);
            } catch (IOException ioException) {
                ioException.printStackTrace();
            }
        }
    }
 
    /**
     * 导入UI上下文
     * @param file 上传的文件
     * @param isCovered 是否覆盖
     * @param selectBtm 选择导入到的业务类型
     * @return
     */
    @PostMapping("/impUIContextData")
    public BaseResult impUIContextData(MultipartFile file, boolean isCovered,String selectBtm){
        File file1 = null;
        try {
            //覆盖,不需要传file
            if(!isCovered){
                String excelFileName = LocalFileUtil.getDefaultTempFolder() + File.separator + LocalFileUtil.getFileNameForIE(file.getOriginalFilename());
                file1 = new File(excelFileName);
                file.transferTo(new File(excelFileName));
            }
            if (file != null || isCovered) {
                return uiManagerService.impUIContextData(file1, isCovered,selectBtm);
            } else {
                return BaseResult.fail(FrameWorkLangCodeConstant.IMPORT_FAIL, new String[]{"无导入的文件"});
            }
        }catch (Throwable e) {
            throw new VciBaseException(VciBaseUtil.getExceptionMessage(e),new String[0],e);
        }finally {
            if(!isCovered){
                file1.delete();
            }
        }
    }
 
    /**
     * 根据上下文ID和区域类型,按顺序获取当前区域的tab页
     * @param contextId
     * @param areaType
     * @return
     */
    @GetMapping( "/getTabByContextIdAndType")
    @VciBusinessLog(operateName = "根据上下文ID和区域类型,按顺序获取当前区域的tab页")
    public BaseResult<DataGrid> getTabByContextIdAndType(String contextId, int areaType){
        try {
            return BaseResult.dataGrid(uiManagerService.getTabByContextIdAndType(contextId,areaType));
        }catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "根据上下文ID和区域类型,按顺序获取当前区域的tab时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 创建区域数据
     * @param plTabPage
     * @return 保存结果
     */
    @PostMapping("/addTabData")
    public BaseResult addTabData(@RequestBody PLTabPage plTabPage){
        try {
            return uiManagerService.addTabData(plTabPage) ? BaseResult.success("创建成功!"):BaseResult.fail("创建失败!");
        } catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "创建时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 修改区域数据
     * @param  plTabPage
     * @return 修改结果
     */
    @PutMapping("/updateTabData")
    public BaseResult updateTabData(@RequestBody PLTabPage plTabPage){
        try {
            return uiManagerService.updateTabData(plTabPage) ? BaseResult.success("修改成功!"):BaseResult.fail("修改失败!");
        } catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "修改时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * UI解析类正则检查
     * @param extAttr
     * @return
     */
    @GetMapping("/checkTabPageExtAttrIsOk")
    public BaseResult checkTabPageExtAttrIsOk(String extAttr){
        try {
            return uiManagerService.checkTabPageExtAttrIsOk(extAttr);
        }catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "UI解析类正则检查时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 删除区域定义数据
     * @param oids
     * @return
     */
    @DeleteMapping("/deleteTabData")
    public BaseResult deleteTabData(String[] oids){
        try {
            return uiManagerService.deleteTabData(oids) ? BaseResult.success("删除成功!"):BaseResult.fail("删除失败!");
        } catch (PLException e) {
            e.printStackTrace();
            String exceptionMessage = "删除时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    //页面设计相关接口
    /**
     * 查询页面设计定义
     * @param pageContextOId
     * @return
     */
    @GetMapping( "/getPLPageDefinations")
    @VciBusinessLog(operateName = "查询页面设计定义")
    public BaseResult<DataGrid> getPLPageDefinations(String pageContextOId){
        try {
            return BaseResult.dataGrid(uiManagerService.getPLPageDefinations(pageContextOId));
        }catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "查询页面设计定义时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 添加页面定义
     * @param pdVO
     * @return 保存结果
     */
    @PostMapping("/addPageDefination")
    public BaseResult addPageDefination(@RequestBody PLDefinationVO pdVO){
        try {
            return uiManagerService.addPageDefination(pdVO) ? BaseResult.success("页面定义添加成功!"):BaseResult.fail("页面定义添加失败!");
        } catch (Throwable e) {
            e.printStackTrace();
            String exceptionMessage = "页面定义添加时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 修改页面定义数据
     * @param  pdVO
     * @return 修改结果
     */
    @PutMapping("/updatePageDefination")
    public BaseResult updatePageDefination(@RequestBody PLDefinationVO pdVO){
        try {
            return uiManagerService.updatePageDefination(pdVO) ? BaseResult.success("修改页面定义成功!"):BaseResult.fail("修改页面定义失败!");
        } catch (Throwable e) {
            e.printStackTrace();
            String exceptionMessage = "修改页面定义时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 删除页面定义数据
     * @param oids
     * @return
     */
    @DeleteMapping("/delPageDefination")
    public BaseResult delPageDefination(String[] oids){
        try {
            return uiManagerService.delPageDefination(oids) ? BaseResult.success("删除页面定义成功!"):BaseResult.fail("删除页面定义数据失败!");
        } catch (PLException e) {
            e.printStackTrace();
            String exceptionMessage = "删除页面定义数据时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 业务类型下拉查询
     * @param baseQueryObject selectBtmType 选择的源对象,带分页信息
     * @return
     * @throws PLException
     */
    @GetMapping( "/getBtmDatasByPage")
    @VciBusinessLog(operateName = "业务类型下拉查询")
    public BaseResult getBtmDatasByPage(BaseQueryObject baseQueryObject){
        try {
            return BaseResult.dataGrid(uiManagerService.getBtmDatasByPage(baseQueryObject));
        }catch (Throwable e) {
            e.printStackTrace();
            String exceptionMessage = "业务类型下拉查询时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 链接类型下拉查询
     * @param baseQueryObject selectBtmType 选择的源对象,带分页信息
     * @return
     * @throws PLException
     */
    @GetMapping( "/getLinkDatasByPage")
    @VciBusinessLog(operateName = "链接类型下拉查询")
    public BaseResult getLinkDatasByPage(BaseQueryObject baseQueryObject){
        try {
            return BaseResult.dataGrid(uiManagerService.getLinkDatasByPage(baseQueryObject));
        }catch (Throwable e) {
            e.printStackTrace();
            String exceptionMessage = "链接类型下拉查询时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * UI定义下拉查询(templateType为UI定义时的选择对象下拉查询)
     * @param baseQueryObject selectBtmType 选择的源对象,带分页信息
     * @return
     * @throws PLException
     */
    @GetMapping( "/getUILayoutDatasByPage")
    @VciBusinessLog(operateName = "UI定义下拉查询")
    public BaseResult getUILayoutDatasByPage(BaseQueryObject baseQueryObject){
        try {
            return BaseResult.dataGrid(uiManagerService.getUILayoutDatasByPage(baseQueryObject));
        }catch (Throwable e) {
            e.printStackTrace();
            String exceptionMessage = "UI定义下拉查询时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 选择模板下拉查询
     * @param baseQueryObject
     * @return
     * @throws PLException
     */
    @GetMapping( "/getPortalVIDatasByPage")
    @VciBusinessLog(operateName = "选择模板下拉查询")
    public BaseResult getPortalVIDatasByPage(BaseQueryObject baseQueryObject){
        try {
            return BaseResult.dataGrid(uiManagerService.getPortalVIDatasByPage(baseQueryObject));
        }catch (Throwable e) {
            e.printStackTrace();
            String exceptionMessage = "选择模板下拉查询时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 查询模板下拉查询
     * @param baseQueryObject
     * @return
     * @throws PLException
     */
    @GetMapping( "/getQTInfoDatasByPage")
    @VciBusinessLog(operateName = "查询模板下拉查询")
    public BaseResult getQTInfoDatasByPage(BaseQueryObject baseQueryObject){
        try {
            return BaseResult.dataGrid(uiManagerService.getQTInfoDatasByPage(baseQueryObject));
        }catch (Throwable e) {
            e.printStackTrace();
            String exceptionMessage = "查询模板下拉查询时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
 
    //页面设计下配置按钮相关接口
    /**
     * 获取页签区域按钮配置信息
     * @param pageDefinationOid
     * @return
     */
    @GetMapping( "/getTabButtons")
    @VciBusinessLog(operateName = "获取页签区域按钮配置信息")
    public BaseResult getTabButtons(String pageDefinationOid){
        try {
            return BaseResult.dataList(uiManagerService.getTabButtons(pageDefinationOid));
        }catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "获取页签区域按钮配置信息时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 添加按钮配置信息
     * @param tabButtonVO
     * @return 保存结果
     */
    @PostMapping("/addTabButton")
    public BaseResult addTabButton(@RequestBody PLTabButtonVO tabButtonVO){
        try {
            return uiManagerService.addTabButton(tabButtonVO);
        } catch (Throwable e) {
            e.printStackTrace();
            String exceptionMessage = "按钮配置信息添加时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 修改按钮配置信息
     * @param  tabButtonVO
     * @return 修改结果
     */
    @PutMapping("/updateTabButton")
    public BaseResult updateTabButton(@RequestBody PLTabButtonVO tabButtonVO){
        try {
            return uiManagerService.updateTabButton(tabButtonVO);
        } catch (Throwable e) {
            e.printStackTrace();
            String exceptionMessage = "修改按钮配置信息时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 删除单个按钮配置
     * @param tabButtonVO
     * @return
     */
    @DeleteMapping("/deleteTabButton")
    public BaseResult deleteTabButton(@RequestBody PLTabButtonVO tabButtonVO){
        try {
            return uiManagerService.deleteTabButton(tabButtonVO) ? BaseResult.success("删除单个按钮配置成功!"):BaseResult.fail("删除单个按钮配置失败!");
        } catch (PLException e) {
            e.printStackTrace();
            String exceptionMessage = "删除单个按钮配置时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 调整为下级按钮
     * @param  tabButtonVO
     * @return 修改结果
     */
    @PutMapping("/joinBtn")
    public BaseResult joinBtn(@RequestBody PLTabButtonVO tabButtonVO){
        try {
            return uiManagerService.joinBtn(tabButtonVO);
        } catch (Throwable e) {
            e.printStackTrace();
            String exceptionMessage = "调整为下级按钮时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 调整为上级按钮
     * @param  tabButtonVO
     * @return 修改结果
     */
    @PutMapping("/exitBtn")
    public BaseResult exitBtn(@RequestBody PLTabButtonVO tabButtonVO){
        try {
            return uiManagerService.exitBtn(tabButtonVO);
        } catch (Throwable e) {
            e.printStackTrace();
            String exceptionMessage = "调整为上级按钮时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 根据角色获取UI/表单/按钮的权限.
     * @param baseQueryObject
     * @return
     */
    @GetMapping( "/getUIAuthor")
    @VciBusinessLog(operateName = "UI授权(树形结构)")
    public BaseResult getUIAuthor(BaseQueryObject baseQueryObject){
        try {
            return BaseResult.dataList(uiManagerService.getUIAuthor(baseQueryObject));
        }catch (Throwable e) {
            e.printStackTrace();
            String exceptionMessage = "UI授权加载出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * @param uiAuthorDTO 勾选的需要保存的数据对象
     * @return
     */
    @PostMapping( "/authorizedUI")
    @VciBusinessLog(operateName = "UI授权")
    public BaseResult authorizedUI(@RequestBody UIAuthorDTO uiAuthorDTO){
        try {
            return uiManagerService.authorizedUI(uiAuthorDTO)?BaseResult.success("授权成功!"):BaseResult.fail("授权失败!");
        }catch (Throwable e) {
            e.printStackTrace();
            String exceptionMessage = "UI授权出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 通过业务类型获取UI上下文包含其下关联的区域定义>页面定义等所有关联数据,归纳成tree结构
     * @param btmName
     * @param level
     * @return
     */
    @GetMapping( "/getAllLevelTreeByBtm")
    public BaseResult getAllLevelTreeByBtm(String btmName,String level){
        try {
            return BaseResult.success(uiManagerService.getAllLevelTreeByBtm(btmName,level));
        }catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "获取UI树时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 克隆页签
     * @param uiCloneVO
     * @return
     * @throws Throwable
     */
    @PostMapping("/clonetabPage")
    public BaseResult clonetabPage(@RequestBody UICloneVO uiCloneVO){
        try {
            return uiManagerService.clonetabPage(uiCloneVO);
        } catch (Throwable e) {
            e.printStackTrace();
            String exceptionMessage = "克隆页签时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 克隆页面定义
     * @param uiCloneVO
     * @return
     * @throws Throwable
     */
    @PostMapping("/clonePageDef")
    public BaseResult clonePageDef(@RequestBody UICloneVO uiCloneVO){
        try {
            return uiManagerService.clonePageDef(uiCloneVO);
        } catch (Throwable e) {
            e.printStackTrace();
            String exceptionMessage = "克隆页面定义时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
    /**
     * 克隆按钮
     * @param uiCloneVO
     * @return
     * @throws Throwable
     */
    @PostMapping("/cloneTabButton")
    public BaseResult cloneTabButton(@RequestBody UICloneVO uiCloneVO){
        try {
            return uiManagerService.cloneTabButton(uiCloneVO);
        } catch (Throwable e) {
            e.printStackTrace();
            String exceptionMessage = "克隆按钮配置时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
 
}