| | |
| | | package com.moon.server.controller.all; |
| | | |
| | | import com.moon.server.annotation.SysLog; |
| | | import com.moon.server.entity.data.LayerEntity; |
| | | import com.moon.server.entity.sys.LayerEntity; |
| | | import com.moon.server.entity.sys.MenuEntity; |
| | | import com.moon.server.entity.sys.ResEntity; |
| | | import com.moon.server.entity.sys.UserEntity; |
| | | import com.moon.server.service.all.PermsService; |
| | | import com.moon.server.service.data.LayerService; |
| | | import com.moon.server.service.sys.LayerService; |
| | | import com.moon.server.service.sys.MenuService; |
| | | import com.moon.server.service.sys.TokenService; |
| | | import com.moon.server.entity.all.*; |
| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 授权控制器 |
| | | * @author WWW |
| | | */ |
| | | @Api(tags = "运维管理\\授权管理") |
| | | @RestController |
| | | @RequestMapping("/perms") |
| | | @SuppressWarnings("ALL") |
| | | public class PermsController extends BaseController { |
| | | @Autowired |
| | | PermsService permsService; |
| | |
| | | LayerService layerService; |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "查询当前用户的资源授权") |
| | | @GetMapping(value = "/selectRes") |
| | | public ResponseMsg<List<ResAuthEntity>> selectRes(HttpServletRequest req) { |
| | | @ApiOperation(value = "查询当前用户的图层授权") |
| | | @GetMapping(value = "/selectLayers") |
| | | public ResponseMsg<Object> selectLayers(HttpServletRequest req) { |
| | | try { |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | if (ue == null) { |
| | |
| | | } |
| | | |
| | | String uid = StaticData.ADMIN.equals(ue.getUid()) ? null : ue.getUid(); |
| | | List<ResAuthEntity> rs = permsService.selectRes(uid); |
| | | List<LayerEntity> rs = layerService.selectLayers(uid); |
| | | |
| | | return success(rs); |
| | | return success(null == rs ? 0 : rs.size(), rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "查询当前用户的投影图层授权") |
| | | @GetMapping(value = "/selectProjectLayers") |
| | | public ResponseMsg<Object> selectProjectLayers(HttpServletRequest req) { |
| | | try { |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | if (ue == null) { |
| | | return fail("用户未登录", null); |
| | | } |
| | | |
| | | String uid = StaticData.ADMIN.equals(ue.getUid()) ? null : ue.getUid(); |
| | | List<LayerEntity> rs = layerService.selectProjectLayers(uid); |
| | | |
| | | return success(null == rs ? 0 : rs.size(), rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "查询当前用户的资源授权") |
| | | @GetMapping(value = "/selectRes") |
| | | public ResponseMsg<Object> selectRes(HttpServletRequest req) { |
| | | try { |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | if (ue == null) { |
| | | return fail("用户未登录", null); |
| | | } |
| | | |
| | | String uid = StaticData.ADMIN.equals(ue.getUid()) ? null : ue.getUid(); |
| | | List<ResEntity> rs = permsService.selectRes(uid); |
| | | |
| | | return success(null == rs ? 0 : rs.size(), rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | /*@SysLog() |
| | | @ApiOperation(value = "查询所有图层") |
| | | @GetMapping(value = "/selectLayers") |
| | | public ResponseMsg<Object> selectLayers(HttpServletRequest req) { |
| | | try { |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | if (ue == null) { |
| | | return fail("用户未登录", null); |
| | | } |
| | | |
| | | List<LayerEntity> list = layerService.selectAll(); |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | | }*/ |
| | | } |