dangsn
2025-01-02 ce8dfd0bff9ee20e9c2647c771b3a3787f37269e
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
package com.vci.web.controller;
 
import com.vci.corba.common.PLException;
import com.vci.starter.web.util.VciBaseUtil;
import com.vci.web.service.ISmFunctionQueryService;
import com.vci.web.enumpck.ResourceControlTypeEnum;
import com.vci.pagemodel.MenuVO;
import com.vci.pagemodel.SmFunctionVO;
import com.vci.starter.web.annotation.controller.VciUnCheckRight;
import com.vci.starter.web.pagemodel.*;
import com.vci.pagemodel.UIContentVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.util.ArrayList;
import java.util.List;
 
 
/**
 * 系统功能控制器
 * @author weidy
 */
@RestController
@RequestMapping("/smFunctionController")
public class SmFunctionController {
 
    /**
     * 功能查询服务
     */
    @Autowired
    private ISmFunctionQueryService functionQueryService;
 
    /**
     * 日志
     */
    private Logger logger = LoggerFactory.getLogger(getClass());
 
   /**
    * 获取当前用户的菜单
    * @param treeQueryObject 树查询对象
    * @return  树节点,出现错误会在异常处理器中统一返回Json
    */
    @GetMapping("/treeMyMenu")
    public List<MenuVO> treeMyMenu(TreeQueryObject treeQueryObject) throws PLException {
        return functionQueryService.treeCurrentUserMenu(treeQueryObject, ResourceControlTypeEnum.BS);
    }
 
    /**
     * 获取当前用户的所有按钮
     * @param treeQueryObject 树查询对象
     * @return
     */
    @GetMapping("/getAllButtons")
    public BaseResult getAllButtons(TreeQueryObject treeQueryObject){
        return BaseResult.dataList(functionQueryService.buttons(treeQueryObject));
    }
 
    /**
     * 获取当前用户的菜单
     * @param treeQueryObject 树查询对象
     * @return  树节点,出现错误会在异常处理器中统一返回Json
     */
    @VciUnCheckRight
    @GetMapping("/getUIContentByBtmTypeAndId")
    public BaseResult getUIContentByBtmTypeAndId(@RequestBody TreeQueryObject treeQueryObject) {
        try {
            return BaseResult.success(functionQueryService.getUIContentByBtmTypeAndId(treeQueryObject, ResourceControlTypeEnum.BS));
        } catch (Exception e) {
            e.printStackTrace();
            String exceptionMessage = "获取当前用户的菜单时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e);
            logger.error(exceptionMessage);
            return BaseResult.fail(exceptionMessage);
        }
    }
    
    /**
    * 获取所有的功能菜单
     * @param treeQueryObject 树查询对象
    * @return  树节点,出现错误会在异常处理器中统一返回Json
    */
    @GetMapping("/treeAllMenu")
    public List<Tree> treeAllMenu(TreeQueryObject treeQueryObject){
        return functionQueryService.treeAllMenu(treeQueryObject, ResourceControlTypeEnum.BS);
    }
 
    /**
     * 通过上级节点获取下级的所有的菜单节点
     *  @param treeQueryObject 树查询对象
     * @return  树节点,出现错误会在异常处理器中统一返回Json
     */
    @GetMapping("/treeFunctionByParent")
    public List<Tree> treeFunctionByParent(TreeQueryObject treeQueryObject) {
        return new ArrayList<Tree>();
    }
 
    /**
     * 通过上级节点获取当前用户有权限的下级的所有的菜单节点
     *  @param treeQueryObject 树查询对象
     * @return List<Tree>,其中treeList属性才是树节点
     */
    @GetMapping("/treeMyFunctionByParent")
    public List<Tree> treeMyFunctionByParent(TreeQueryObject treeQueryObject) {
        return new ArrayList<Tree>();
    }
 
    /**
     * 获取系统功能列表
     * @param queryObject 查询、排序和分页对象
     * @return DataGrid 系统功能列表
     */
    @GetMapping("/dataGrid")
    public DataGrid<SmFunctionVO> dataGrid(BaseQueryObject queryObject){
        return new DataGrid<>();
    }
 
    /**
     * 获取当前用户的菜单
     * @param treeQueryObject 树查询对象
     * @return  树节点,出现错误会在异常处理器中统一返回Json
     */
    @VciUnCheckRight
    @GetMapping("/getTreeMyMenu")
    @ResponseBody
    public List<MenuVO> getTreeMyMenu(TreeQueryObject treeQueryObject) throws PLException {
        return functionQueryService.treeCurrentUserMenu(treeQueryObject, ResourceControlTypeEnum.BS);
    }
}