Commit 20c516fb authored by suhuiguang's avatar suhuiguang

1.增加权限

parent 29f1024d
package com.yeejoin.amos.boot.module.common.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.oracle.webservices.internal.api.databinding.DatabindingMode;
import com.yeejoin.amos.boot.biz.common.annotations.DataAuth;
import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
......@@ -98,6 +100,7 @@ public interface OrgUsrMapper extends BaseMapper<OrgUsr> {
OrgUsr queryByUserId(@Param("userId")Long userId);
@DataAuth(interfacePath = "")
List<OrgUsr> companyTreeByUserAndType(Map<String, Object> param);
OrgUsr queryBySequenceNbr(@Param("parentId") String parentId);
......
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.common.biz.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.interceptors.PermissionInterceptorContext;
import com.yeejoin.amos.boot.biz.common.utils.MenuFrom;
import com.yeejoin.amos.boot.module.common.api.core.framework.PersonIdentify;
import com.yeejoin.amos.boot.module.common.api.dto.FireStationDto;
......@@ -12,6 +13,7 @@ import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
......@@ -48,6 +50,9 @@ public class FireStationController extends BaseController {
@Autowired
OrgUsrServiceImpl iOrgUsrService;
@Value("${auth-key-fire-station:fire_station_info}")
private String authKey;
/**
* 新增微型消防站
*
......@@ -180,6 +185,8 @@ public class FireStationController extends BaseController {
public ResponseModel<List<OrgMenuDto>> companyTreeByUserAndType(@RequestParam(required = false) String type) {
// 获取登陆人角色
ReginParams reginParams = getSelectedOrgInfo();
// 权限赋值
PermissionInterceptorContext.setDataAuthRule(authKey);
return ResponseHelper.buildResponse(iOrgUsrService.companyTreeByUserAndType(reginParams,type));
}
}
......@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.interceptors.PermissionInterceptorContext;
import com.yeejoin.amos.boot.biz.common.utils.Menu;
import com.yeejoin.amos.boot.biz.common.utils.MenuFrom;
import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
......@@ -21,6 +22,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
......@@ -52,6 +54,9 @@ public class FireTeamController extends BaseController {
@Autowired
OrgUsrServiceImpl iOrgUsrService;
@Value("${auth-key-fire-team:fire_team_info}")
private String authKey;
/**
* 新增消防队伍
......@@ -287,6 +292,8 @@ public class FireTeamController extends BaseController {
public ResponseModel<List<OrgMenuDto>> companyTreeByUserAndType(@RequestParam(required = false) String type) throws Exception {
// 获取登陆人角色
ReginParams reginParams = getSelectedOrgInfo();
// 权限赋值
PermissionInterceptorContext.setDataAuthRule(authKey);
List<OrgMenuDto> menus = iOrgUsrService.companyTreeByUserAndType(reginParams, type);
return ResponseHelper.buildResponse(menus);
}
......
......@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.constants.CommonConstant;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.interceptors.PermissionInterceptorContext;
import com.yeejoin.amos.boot.biz.common.utils.NameUtils;
import com.yeejoin.amos.boot.module.common.api.core.framework.PersonIdentify;
import com.yeejoin.amos.boot.module.common.api.dto.*;
......@@ -624,7 +625,8 @@ public class OrgUsrController extends BaseController {
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
String bizOrgCode = personIdentity.getBizOrgCode();
// TODO 伪代码 tianbo 上下文类 set authKey
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
return ResponseHelper.buildResponse(iOrgUsrService.getListByBizOrgTypeCode(orgTypes, bizOrgCode));
}
......@@ -637,7 +639,8 @@ public class OrgUsrController extends BaseController {
@PathVariable String authKey) {
// 获取登陆人角色
ReginParams reginParams = getSelectedOrgInfo();
// TODO 伪代码 tianbo 上下文类 set authKey
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
List<OrgMenuDto> menus = iOrgUsrService.companyTreeByUserAndType(reginParams, orgType);
return ResponseHelper.buildResponse(menus);
}
......
......@@ -8,10 +8,12 @@ import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import com.yeejoin.amos.boot.biz.common.interceptors.PermissionInterceptorContext;
import com.yeejoin.amos.boot.biz.common.utils.Menu;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
......@@ -99,6 +101,10 @@ public class WaterResourceController extends BaseController {
WaterResourceIndexServiceImpl waterResourceIndexServiceImpl;
@Autowired
OrgUsrServiceImpl iOrgUsrService;
@Value("${auth-key-fire-water:fire_water_info}")
private String authKey;
/**
* 新增
*
......@@ -548,6 +554,8 @@ public class WaterResourceController extends BaseController {
public ResponseModel<List<OrgMenuDto>> companyTreeByUserAndType(@RequestParam(required = false) String type) throws Exception {
// 获取登陆人角色
ReginParams reginParams = getSelectedOrgInfo();
// 权限赋值
PermissionInterceptorContext.setDataAuthRule(authKey);
List<OrgMenuDto> menus = iOrgUsrService.companyTreeByUserAndType(reginParams, type);
return ResponseHelper.buildResponse(menus);
}
......
......@@ -12,6 +12,7 @@ import com.google.common.collect.Maps;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.constants.CommonConstant;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.biz.common.interceptors.PermissionInterceptorContext;
import com.yeejoin.amos.boot.biz.common.utils.TreeParser;
import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormColumn;
......@@ -97,6 +98,9 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
@Autowired
AmosTrainingFeignClient amosTrainingFeignClient;
@Value("${auth-key-org-user:org_user_info}")
private String authKey;
public static List<OrgMenuDto> buildTreeParallel(List<OrgUsr> list) {
List<OrgMenuDto> menuList = list.stream().map(o ->
......@@ -2084,6 +2088,8 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
@Override
public List<OrgMenuDto> companyTreeByUserNumber(ReginParams reginParams) {
Map<String, Object> param = new HashMap<>();
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
param.put("bizOrgCode", reginParams.getPersonIdentity().getBizOrgCode());
List<OrgUsr> list = orgUsrMapper.companyDeptListWithPersonCount(param);
return buildTreeParallel(list);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment