Commit e7ccccc19d4fca156786de778dec97e08f8aeca6

Authored by Liu Haoyu
1 parent c83b5b39

添加权限配置以及控制接口;

.gitignore 0 → 100644
  1 +/vehicle-simple.iml
  2 +/.idea/
  3 +/target/
... ...
src/main/java/com/objecteye/controller/BasicController.java 0 → 100644
  1 +package com.objecteye.controller;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import com.objecteye.common.CommonResult;
  5 +import com.objecteye.entity.PageResult;
  6 +
  7 +public class BasicController {
  8 +
  9 + /**
  10 + * jsonObject通用处理
  11 + *
  12 + * @param resultObj 返回参数
  13 + * @return 结果集
  14 + */
  15 + CommonResult jsonObjectResultHandle(JSONObject resultObj) {
  16 + if (resultObj.containsKey("error")) {
  17 + return CommonResult.success(201, resultObj.getString("error"), null);
  18 + }
  19 + return CommonResult.success(resultObj);
  20 + }
  21 +
  22 + /**
  23 + * pageResult统一处理
  24 + *
  25 + * @param pageResult 返回参数
  26 + * @return 结果集
  27 + */
  28 + CommonResult pageResultHandle(PageResult<?> pageResult) {
  29 + if (pageResult.getRow().size() > 0) {
  30 + return CommonResult.success(pageResult);
  31 + } else {
  32 + return CommonResult.success(201, "没有找到有效数据", null);
  33 + }
  34 + }
  35 +}
... ...
src/main/java/com/objecteye/controller/SpecialAuthenticationController.java 0 → 100644
  1 +package com.objecteye.controller;
  2 +
  3 +import com.objecteye.common.CommonResult;
  4 +import com.objecteye.service.ISpecialAuthenticationService;
  5 +import com.objecteye.utils.GlobalUtil;
  6 +import io.swagger.annotations.Api;
  7 +import io.swagger.annotations.ApiOperation;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.web.bind.annotation.*;
  10 +
  11 +import java.util.Map;
  12 +
  13 +@RequestMapping("specialAuthConfig")
  14 +@Api(value = "SpecialAuthenticationController", description = "特殊权限")
  15 +@CrossOrigin
  16 +@RestController
  17 +public class SpecialAuthenticationController extends BasicController {
  18 +
  19 + @Autowired
  20 + private ISpecialAuthenticationService iSpecialAuthenticationService;
  21 +
  22 + @ApiOperation("分页查找")
  23 + @RequestMapping(value = "findByPage", method = RequestMethod.POST, produces = GlobalUtil.COMMON_HEADER_CONTENT_TYPE)
  24 + public CommonResult findByPage(@RequestBody Map<String, Object> requestMap) {
  25 + return pageResultHandle(iSpecialAuthenticationService.findByPage(requestMap));
  26 + }
  27 +
  28 + @ApiOperation("添加特殊地址权限要求")
  29 + @RequestMapping(value = "addConfig", method = RequestMethod.POST, produces = GlobalUtil.COMMON_HEADER_CONTENT_TYPE)
  30 + public CommonResult addConfig(@RequestBody Map<String, Object> requestMap) {
  31 + return jsonObjectResultHandle(iSpecialAuthenticationService.addConfig(requestMap));
  32 + }
  33 +
  34 + @ApiOperation("更新配置信息")
  35 + @RequestMapping(value = "updateConfig", method = RequestMethod.POST, produces = GlobalUtil.COMMON_HEADER_CONTENT_TYPE)
  36 + public CommonResult updateConfig(@RequestBody Map<String, Object> requestMap) {
  37 + return jsonObjectResultHandle(iSpecialAuthenticationService.updateConfig(requestMap));
  38 + }
  39 +
  40 + @ApiOperation("删除配置信息")
  41 + @RequestMapping(value = "deleteConfig", method = RequestMethod.POST, produces = GlobalUtil.COMMON_HEADER_CONTENT_TYPE)
  42 + public CommonResult deleteConfig(@RequestBody Map<String, Object> requestMap) {
  43 + return jsonObjectResultHandle(iSpecialAuthenticationService.deleteConfig(requestMap));
  44 + }
  45 +
  46 + @ApiOperation("校验相同配置信息是否存在")
  47 + @RequestMapping(value = "checkConfig", method = RequestMethod.POST, produces = GlobalUtil.COMMON_HEADER_CONTENT_TYPE)
  48 + public CommonResult checkConfig(@RequestBody Map<String, Object> requestMap) {
  49 + return jsonObjectResultHandle(iSpecialAuthenticationService.checkConfig(requestMap));
  50 + }
  51 +
  52 +
  53 +}
... ...
src/main/java/com/objecteye/controller/UserController.java
1 1 package com.objecteye.controller;
2 2  
3   -import com.alibaba.fastjson.JSONObject;
4 3 import com.objecteye.common.CommonResult;
5   -import com.objecteye.entity.PageResult;
6 4 import com.objecteye.service.UserServices;
7 5 import com.objecteye.utils.GlobalUtil;
8 6 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -13,7 +11,7 @@ import java.util.Map;
13 11 @CrossOrigin
14 12 @RestController
15 13 @RequestMapping("/vehicle/user")
16   -public class UserController {
  14 +public class UserController extends BasicController {
17 15  
18 16 @Autowired
19 17 public UserServices userServices;
... ... @@ -40,11 +38,7 @@ public class UserController {
40 38 */
41 39 @RequestMapping(value = "/userPage", method = RequestMethod.POST, produces = GlobalUtil.COMMON_HEADER_CONTENT_TYPE)
42 40 public CommonResult userPage(@RequestBody Map<String, Object> requestMap) {
43   - PageResult pageResult = userServices.userPage(requestMap);
44   - if (pageResult.getRow().size() == 0) {
45   - return CommonResult.success(201, "未找到有效数据", null);
46   - }
47   - return CommonResult.success(pageResult);
  41 + return pageResultHandle(userServices.userPage(requestMap));
48 42 }
49 43  
50 44 /**
... ... @@ -79,17 +73,4 @@ public class UserController {
79 73 return jsonObjectResultHandle(userServices.findUserById(requestMap));
80 74 }
81 75  
82   - /**
83   - * jsonObject通用处理
84   - *
85   - * @param resultObj 返回参数
86   - * @return 结果集
87   - */
88   - private CommonResult jsonObjectResultHandle(JSONObject resultObj) {
89   - if (resultObj.containsKey("error")) {
90   - return CommonResult.success(201, resultObj.getString("error"), null);
91   - }
92   - return CommonResult.success(resultObj);
93   - }
94   -
95 76 }
... ...
src/main/java/com/objecteye/controller/UserGroupController.java 0 → 100644
  1 +package com.objecteye.controller;
  2 +
  3 +import com.objecteye.common.CommonResult;
  4 +import com.objecteye.service.IUserGroupService;
  5 +import com.objecteye.utils.GlobalUtil;
  6 +import io.swagger.annotations.Api;
  7 +import io.swagger.annotations.ApiOperation;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.web.bind.annotation.*;
  10 +
  11 +import java.util.Map;
  12 +
  13 +@RestController
  14 +@RequestMapping("userGroup")
  15 +@CrossOrigin
  16 +@Api(value = "UserGroupController", description = "用户组")
  17 +public class UserGroupController extends BasicController {
  18 + @Autowired
  19 + private IUserGroupService iUserGroupService;
  20 +
  21 + @ApiOperation("分页查询")
  22 + @RequestMapping(value = "findByPage", method = RequestMethod.POST, produces = GlobalUtil.COMMON_HEADER_CONTENT_TYPE)
  23 + public CommonResult findByPage(@RequestBody Map<String, Object> requestMap) {
  24 + return pageResultHandle(iUserGroupService.findByPage(requestMap));
  25 + }
  26 +
  27 + @ApiOperation("检查用户组是否存在")
  28 + @RequestMapping(value = "checkGroup", method = RequestMethod.POST, produces = GlobalUtil.COMMON_HEADER_CONTENT_TYPE)
  29 + public CommonResult checkGroup(@RequestBody Map<String, Object> requestMap) {
  30 + return jsonObjectResultHandle(iUserGroupService.checkGroup(requestMap));
  31 + }
  32 +
  33 + @ApiOperation("添加用户组")
  34 + @RequestMapping(value = "addGroup", method = RequestMethod.POST, produces = GlobalUtil.COMMON_HEADER_CONTENT_TYPE)
  35 + public CommonResult addGroup(@RequestBody Map<String, Object> requestMap) {
  36 + return jsonObjectResultHandle(iUserGroupService.addGroup(requestMap));
  37 + }
  38 +
  39 + @ApiOperation("更新用户组")
  40 + @RequestMapping(value = "updateGroup", method = RequestMethod.POST, produces = GlobalUtil.COMMON_HEADER_CONTENT_TYPE)
  41 + public CommonResult updateGroup(@RequestBody Map<String, Object> requestMap) {
  42 + return jsonObjectResultHandle(iUserGroupService.updateGroup(requestMap));
  43 + }
  44 +
  45 + @ApiOperation("删除用户组")
  46 + @RequestMapping(value = "deleteGroup", method = RequestMethod.POST, produces = GlobalUtil.COMMON_HEADER_CONTENT_TYPE)
  47 + public CommonResult deleteGroup(@RequestBody Map<String, Object> requestMap) {
  48 + return jsonObjectResultHandle(iUserGroupService.deleteGroup(requestMap));
  49 + }
  50 +}
... ...