java110
2021-05-15 811e8e7139ad6e331c2f84bcd5cf3f927a8b3312
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
package com.java110.order.api;
 
import com.java110.core.base.controller.BaseController;
import com.java110.order.smo.IPrivilegeSMO;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
 
import javax.servlet.http.HttpServletRequest;
 
/**
 * 权限API 处理类
 * Created by Administrator on 2019/4/1.
 */
@RestController
@RequestMapping(path = "/privilegeApi")
public class PrivilegeApi extends BaseController {
    private final static Logger logger = LoggerFactory.getLogger(PrivilegeApi.class);
 
 
    @Autowired
    private IPrivilegeSMO privilegeSMOImpl;
 
    @RequestMapping(path = "/saveUserDefaultPrivilege",method= RequestMethod.POST)
    @ApiOperation(value="添加用户默认权限", notes="test: 返回 200 表示服务受理成功,其他表示失败")
    @ApiImplicitParam(paramType="query", name = "privilegeInfo", value = "权限信息", required = true, dataType = "String")
    public ResponseEntity<String> saveUserDefaultPrivilege(@RequestBody String privilegeInfo, HttpServletRequest request){
 
        ResponseEntity<String> responseEntity = null;
 
        try {
            responseEntity = privilegeSMOImpl.saveUserDefaultPrivilege(privilegeInfo);
        }catch (Exception e){
            logger.error("请求订单异常",e);
            responseEntity =  new ResponseEntity<String>("请求中心服务发生异常,"+e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
        }finally {
            logger.debug("订单服务返回报文为: {}",responseEntity);
        }
        return responseEntity;
    }
 
    @RequestMapping(path = "/deleteUserAllPrivilege",method= RequestMethod.POST)
    @ApiOperation(value="删除用户所有权限", notes="test: 返回 200 表示服务受理成功,其他表示失败")
    @ApiImplicitParam(paramType="query", name = "privilegeInfo", value = "权限信息", required = true, dataType = "String")
    public ResponseEntity<String> deleteUserAllPrivilege(@RequestBody String privilegeInfo,HttpServletRequest request){
        ResponseEntity<String> responseEntity = null;
 
        try {
            responseEntity = privilegeSMOImpl.deleteUserAllPrivilege(privilegeInfo);
        }catch (Exception e){
            logger.error("请求订单异常",e);
            responseEntity =  new ResponseEntity<String>("请求中心服务发生异常,"+e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
        }finally {
            logger.debug("订单服务返回报文为: {}",responseEntity);
        }
        return responseEntity;
    }
 
 
    @RequestMapping(path = "/savePrivilegeGroup",method= RequestMethod.POST)
    @ApiOperation(value="保存权限组", notes="test: 返回 200 表示服务受理成功,其他表示失败")
    @ApiImplicitParam(paramType="query", name = "privilegeGroupInfo", value = "权限信息", required = true, dataType = "String")
    public ResponseEntity<String> savePrivilegeGroup(@RequestBody String privilegeGroupInfo,HttpServletRequest request){
        ResponseEntity<String> responseEntity = null;
 
        try {
            responseEntity = privilegeSMOImpl.savePrivilegeGroup(privilegeGroupInfo);
        }catch (Exception e){
            logger.error("请求订单异常",e);
            responseEntity =  new ResponseEntity<String>("请求中心服务发生异常,"+e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
        }finally {
            logger.debug("订单服务返回报文为: {}",responseEntity);
        }
        return responseEntity;
    }
 
    @RequestMapping(path = "/editPrivilegeGroup",method= RequestMethod.POST)
    @ApiOperation(value="编辑权限组", notes="test: 返回 200 表示服务受理成功,其他表示失败")
    @ApiImplicitParam(paramType="query", name = "privilegeGroupInfo", value = "权限信息", required = true, dataType = "String")
    public ResponseEntity<String> editPrivilegeGroup(@RequestBody String privilegeGroupInfo,HttpServletRequest request){
        ResponseEntity<String> responseEntity = null;
 
        try {
            responseEntity = privilegeSMOImpl.editPrivilegeGroup(privilegeGroupInfo);
        }catch (Exception e){
            logger.error("请求订单异常",e);
            responseEntity =  new ResponseEntity<String>("请求中心服务发生异常,"+e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
        }finally {
            logger.debug("订单服务返回报文为: {}",responseEntity);
        }
        return responseEntity;
    }
 
    @RequestMapping(path = "/deletePrivilegeGroup",method= RequestMethod.POST)
    @ApiOperation(value="删除权限组", notes="test: 返回 200 表示服务受理成功,其他表示失败")
    @ApiImplicitParam(paramType="query", name = "privilegeGroupInfo", value = "权限信息", required = true, dataType = "String")
    public ResponseEntity<String> deletePrivilegeGroup(@RequestBody String privilegeGroupInfo,HttpServletRequest request){
        ResponseEntity<String> responseEntity = null;
 
        try {
            responseEntity = privilegeSMOImpl.deletePrivilegeGroup(privilegeGroupInfo);
        }catch (Exception e){
            logger.error("请求订单异常",e);
            responseEntity =  new ResponseEntity<String>("请求中心服务发生异常,"+e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
        }finally {
            logger.debug("订单服务返回报文为: {}",responseEntity);
        }
        return responseEntity;
    }
 
    @RequestMapping(path = "/addPrivilegeToPrivilegeGroup",method= RequestMethod.POST)
    @ApiOperation(value="添加权限到权限组", notes="test: 返回 200 表示服务受理成功,其他表示失败")
    @ApiImplicitParam(paramType="query", name = "privilegeInfo", value = "权限信息", required = true, dataType = "String")
    public ResponseEntity<String> addPrivilegeToPrivilegeGroup(@RequestBody String privilegeInfo,HttpServletRequest request){
        ResponseEntity<String> responseEntity = null;
 
        try {
            responseEntity = privilegeSMOImpl.addPrivilegeToPrivilegeGroup(privilegeInfo);
        }catch (Exception e){
            logger.error("请求订单异常",e);
            responseEntity =  new ResponseEntity<String>("请求中心服务发生异常,"+e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
        }finally {
            logger.debug("订单服务返回报文为: {}",responseEntity);
        }
        return responseEntity;
    }
 
 
    @RequestMapping(path = "/deletePrivilegeFromPrivilegeGroup",method= RequestMethod.POST)
    @ApiOperation(value="从权限组删除权限", notes="test: 返回 200 表示服务受理成功,其他表示失败")
    @ApiImplicitParam(paramType="query", name = "privilegeInfo", value = "权限信息", required = true, dataType = "String")
    public ResponseEntity<String> deletePrivilegeFromPrivilegeGroup(@RequestBody String privilegeInfo,HttpServletRequest request){
        ResponseEntity<String> responseEntity = null;
 
        try {
            responseEntity = privilegeSMOImpl.deletePrivilegeToPrivilegeGroup(privilegeInfo);
        }catch (Exception e){
            logger.error("请求订单异常",e);
            responseEntity =  new ResponseEntity<String>("请求中心服务发生异常,"+e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
        }finally {
            logger.debug("订单服务返回报文为: {}",responseEntity);
        }
        return responseEntity;
    }
 
 
    @RequestMapping(path = "/addStaffPrivilegeOrPrivilegeGroup",method= RequestMethod.POST)
    @ApiOperation(value="用户添加权限或权限组", notes="test: 返回 200 表示服务受理成功,其他表示失败")
    @ApiImplicitParam(paramType="query", name = "privilegeInfo", value = "权限信息", required = true, dataType = "String")
    public ResponseEntity<String> addStaffPrivilegeOrPrivilegeGroup(@RequestBody String privilegeInfo,HttpServletRequest request){
        ResponseEntity<String> responseEntity = null;
 
        try {
            responseEntity = privilegeSMOImpl.addStaffPrivilegeOrPrivilegeGroup(privilegeInfo);
        }catch (Exception e){
            logger.error("请求订单异常",e);
            responseEntity =  new ResponseEntity<String>("请求中心服务发生异常,"+e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
        }finally {
            logger.debug("订单服务返回报文为: {}",responseEntity);
        }
        return responseEntity;
    }
 
 
    @RequestMapping(path = "/deleteStaffPrivilegeOrPrivilegeGroup",method= RequestMethod.POST)
    @ApiOperation(value="删除用户权限或权限组", notes="test: 返回 200 表示服务受理成功,其他表示失败")
    @ApiImplicitParam(paramType="query", name = "privilegeInfo", value = "权限信息", required = true, dataType = "String")
    public ResponseEntity<String> deleteStaffPrivilegeOrPrivilegeGroup(@RequestBody String privilegeInfo,HttpServletRequest request){
        ResponseEntity<String> responseEntity = null;
 
        try {
            responseEntity = privilegeSMOImpl.deleteStaffPrivilegeOrPrivilegeGroup(privilegeInfo);
        }catch (Exception e){
            logger.error("请求订单异常",e);
            responseEntity =  new ResponseEntity<String>("请求中心服务发生异常,"+e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
        }finally {
            logger.debug("订单服务返回报文为: {}",responseEntity);
        }
        return responseEntity;
    }
 
 
 
    public IPrivilegeSMO getPrivilegeSMOImpl() {
        return privilegeSMOImpl;
    }
 
    public void setPrivilegeSMOImpl(IPrivilegeSMO privilegeSMOImpl) {
        this.privilegeSMOImpl = privilegeSMOImpl;
    }
}