Merge remote-tracking branch 'origin/feature/REQ-1102' into feature/REQ-1102
This commit is contained in:
commit
5284c72ab1
@ -4,6 +4,7 @@ import cn.axzo.framework.domain.web.result.ApiResult;
|
||||
import cn.axzo.tyr.client.model.permission.PermissionPointDTO;
|
||||
import cn.axzo.tyr.client.model.permission.PermissionPointTreeNode;
|
||||
import cn.axzo.tyr.client.model.permission.PermissionPointTreeQueryReq;
|
||||
import cn.axzo.tyr.client.model.permission.PermissionPointVO;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
@ -29,7 +30,7 @@ public interface PermissionPointApi {
|
||||
|
||||
/** 根据权限点ID查询详情 **/
|
||||
@GetMapping(value = "/api/v1/permissionPoint/getDetail/{permissionId}")
|
||||
ApiResult<PermissionPointDTO> getDetail(@PathVariable Long permissionId);
|
||||
ApiResult<PermissionPointVO> getDetail(@PathVariable Long permissionId);
|
||||
|
||||
/** 根据权限点ID批量查询节点信息 **/
|
||||
@PostMapping(value = "/api/v1/permissionPoint/listTreeNodesByIds")
|
||||
|
||||
@ -2,6 +2,8 @@ package cn.axzo.tyr.client.model.permission;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@ -23,11 +25,13 @@ public class PermissionPointDTO {
|
||||
/**
|
||||
* 权限点名称
|
||||
*/
|
||||
@NotBlank(message = "权限点名称不能为空")
|
||||
private String featureName;
|
||||
|
||||
/**
|
||||
* 元素code
|
||||
*/
|
||||
@NotBlank(message = "权限点元素code不能为空")
|
||||
private String featureCode;
|
||||
|
||||
/**
|
||||
@ -80,11 +84,13 @@ public class PermissionPointDTO {
|
||||
/**
|
||||
* 菜单适用工作台
|
||||
*/
|
||||
@NotBlank(message = "所属工作台不能为空")
|
||||
private String terminal;
|
||||
|
||||
/**
|
||||
* 元素类别 0.模块 1.菜单 2页面 3按钮
|
||||
*/
|
||||
@NotNull(message = "元素类别不能为空")
|
||||
private Integer featureType;
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,164 @@
|
||||
package cn.axzo.tyr.client.model.permission;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 权限点展示对象
|
||||
*
|
||||
* @version V1.0
|
||||
* @author: ZhanSiHu
|
||||
* @date: 2023/9/5 15:50
|
||||
*/
|
||||
@Data
|
||||
public class PermissionPointVO {
|
||||
|
||||
/**
|
||||
* 权限点id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 权限点名称
|
||||
*/
|
||||
private String featureName;
|
||||
|
||||
/**
|
||||
* 元素code
|
||||
*/
|
||||
private String featureCode;
|
||||
|
||||
/**
|
||||
* 菜单icon
|
||||
*/
|
||||
private String icon;
|
||||
|
||||
/**
|
||||
* 父级权限点id
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/** 父级权限点名称 **/
|
||||
private String parentName;
|
||||
/**
|
||||
* 父级元素类别 0.模块 1.菜单 2页面 3按钮
|
||||
* **/
|
||||
private Integer parentFeatureType;
|
||||
|
||||
/** 父级元素类别描述 **/
|
||||
private String parentFeatureTypeDes;
|
||||
|
||||
|
||||
/**
|
||||
* 页面路由
|
||||
*/
|
||||
private String linkUrl;
|
||||
|
||||
/**
|
||||
* 适用终端 1:PC 2:UNI 4:APP
|
||||
*/
|
||||
private Integer linkType;
|
||||
|
||||
/**
|
||||
* 扩展字段 - APP适配参数
|
||||
*/
|
||||
private String linkExt;
|
||||
|
||||
/**
|
||||
* 小程序AppID
|
||||
*/
|
||||
private String microAppItemId;
|
||||
|
||||
/**
|
||||
* 权限点层级path
|
||||
*/
|
||||
private String path;
|
||||
|
||||
/** 层级名称 顶级-……-当前节点 **/
|
||||
private List<String> pathName;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 菜单适用工作台
|
||||
*/
|
||||
private String terminal;
|
||||
|
||||
/**
|
||||
* 元素类别 0.模块 1.菜单 2页面 3按钮
|
||||
*/
|
||||
private Integer featureType;
|
||||
|
||||
/**
|
||||
* 元素类别描述
|
||||
* **/
|
||||
private String featureTypeDesc;
|
||||
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
private Long createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createAt;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private LocalDateTime updateAt;
|
||||
|
||||
/**
|
||||
* 修改人id
|
||||
*/
|
||||
private Long updateBy;
|
||||
|
||||
|
||||
/**
|
||||
* 适用单位类型-65535:所有 1:总包 2:建设单位 4:监理单位 8:劳务分包 16:专业分包
|
||||
*/
|
||||
private Long fitOuTypeBit;
|
||||
|
||||
/**
|
||||
* 适用节点类型 65535:所有 1:部门 2:班组 4:小组
|
||||
*/
|
||||
private Long fitOuNodeTypeBit;
|
||||
|
||||
/**
|
||||
* 所属应用
|
||||
*/
|
||||
private String appName;
|
||||
|
||||
/**
|
||||
* 功能URL
|
||||
*/
|
||||
private String featureUrl;
|
||||
|
||||
/**
|
||||
* 是否认证 0:无需要认证 1:需要认证
|
||||
*/
|
||||
private Boolean needCert;
|
||||
|
||||
/**
|
||||
* 是否授权 0:无需要授权 1:需要授权
|
||||
*/
|
||||
private Boolean needAuth;
|
||||
|
||||
/**
|
||||
* 授权策略类型,允许为空 1-平台授权型 2-客户授权型 3-免授权型
|
||||
*/
|
||||
private Integer delegatedType;
|
||||
|
||||
/** 授权策略类型描述 **/
|
||||
private String delegatedTypeDesc;
|
||||
|
||||
}
|
||||
@ -5,6 +5,7 @@ import cn.axzo.tyr.client.feign.PermissionPointApi;
|
||||
import cn.axzo.tyr.client.model.permission.PermissionPointDTO;
|
||||
import cn.axzo.tyr.client.model.permission.PermissionPointTreeNode;
|
||||
import cn.axzo.tyr.client.model.permission.PermissionPointTreeQueryReq;
|
||||
import cn.axzo.tyr.client.model.permission.PermissionPointVO;
|
||||
import cn.axzo.tyr.server.service.PermissionPointService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -35,7 +36,7 @@ public class PermissionPointController implements PermissionPointApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiResult<PermissionPointDTO> getDetail(Long permissionId) {
|
||||
public ApiResult<PermissionPointVO> getDetail(Long permissionId) {
|
||||
return ApiResult.ok(permissionPointService.getDetail(permissionId));
|
||||
}
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ package cn.axzo.tyr.server.service;
|
||||
import cn.axzo.tyr.client.model.permission.PermissionPointDTO;
|
||||
import cn.axzo.tyr.client.model.permission.PermissionPointTreeNode;
|
||||
import cn.axzo.tyr.client.model.permission.PermissionPointTreeQueryReq;
|
||||
import cn.axzo.tyr.client.model.permission.PermissionPointVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -28,7 +29,7 @@ public interface PermissionPointService {
|
||||
/**
|
||||
* 根据权限点ID查询详情
|
||||
* **/
|
||||
PermissionPointDTO getDetail(Long permissionId);
|
||||
PermissionPointVO getDetail(Long permissionId);
|
||||
|
||||
/** 保存权限点 **/
|
||||
void save(PermissionPointDTO dto);
|
||||
|
||||
@ -8,6 +8,7 @@ import cn.axzo.tyr.client.model.enums.FeatureType;
|
||||
import cn.axzo.tyr.client.model.permission.PermissionPointDTO;
|
||||
import cn.axzo.tyr.client.model.permission.PermissionPointTreeNode;
|
||||
import cn.axzo.tyr.client.model.permission.PermissionPointTreeQueryReq;
|
||||
import cn.axzo.tyr.client.model.permission.PermissionPointVO;
|
||||
import cn.axzo.tyr.server.repository.entity.SaasFeature;
|
||||
import cn.axzo.tyr.server.repository.service.SaasFeatureDao;
|
||||
import cn.axzo.tyr.server.service.PermissionPointService;
|
||||
@ -138,25 +139,26 @@ public class PermissionPointServiceImpl implements PermissionPointService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PermissionPointDTO getDetail(Long permissionId) {
|
||||
public PermissionPointVO getDetail(Long permissionId) {
|
||||
SaasFeature feature = this.saasFeatureDao.getById(permissionId);
|
||||
if (feature == null) {
|
||||
log.warn("no saasFeature found for:{}", permissionId);
|
||||
throw new BizException(BaseCode.BAD_REQUEST);
|
||||
}
|
||||
PermissionPointDTO dto = BeanMapper.copyBean(feature, PermissionPointDTO.class);
|
||||
PermissionPointVO vo = BeanMapper.copyBean(feature, PermissionPointVO.class);
|
||||
vo.setFeatureTypeDesc(FeatureType.apply(vo.getFeatureType()).getDesc());
|
||||
|
||||
//补充上级信息
|
||||
//TODO:@Zhan 依赖字典接口构建上级
|
||||
List<String> pathName = new ArrayList<>();
|
||||
if (dto.getParentId() == null || dto.getParentId() == 0) {
|
||||
if (vo.getParentId() == null || vo.getParentId() == 0) {
|
||||
//没有parent直接挂在工作台下
|
||||
dto.setParentName("");
|
||||
dto.setPathName(pathName);
|
||||
return dto;
|
||||
vo.setParentName("");
|
||||
vo.setPathName(pathName);
|
||||
return vo;
|
||||
}
|
||||
//所有父级处理
|
||||
List<String> split = StrUtil.split(dto.getPath(), FEATURE_PATH_DELIMITER, true, true);
|
||||
List<String> split = StrUtil.split(vo.getPath(), FEATURE_PATH_DELIMITER, true, true);
|
||||
List<Long> ids = split.stream()
|
||||
.filter(x -> !StrUtil.equals(FEATURE_NO_PARENT, x))
|
||||
.map(Long::valueOf)
|
||||
@ -167,10 +169,13 @@ public class PermissionPointServiceImpl implements PermissionPointService {
|
||||
for (Long parentId : ids) {
|
||||
pathName.add(parentsMapping.get(parentId).getFeatureName());
|
||||
}
|
||||
dto.setPathName(pathName);
|
||||
dto.setParentName(parentsMapping.get(dto.getParentId()).getFeatureName());
|
||||
vo.setPathName(pathName);
|
||||
SaasFeature parent = parentsMapping.get(vo.getParentId());
|
||||
vo.setParentName(parent.getFeatureName());
|
||||
vo.setParentFeatureType(parent.getFeatureType());
|
||||
vo.setParentFeatureTypeDes(FeatureType.apply(parent.getFeatureType()).getDesc());
|
||||
|
||||
return dto;
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -4,6 +4,7 @@ import cn.axzo.framework.domain.web.result.ApiResult;
|
||||
import cn.axzo.tyr.client.model.permission.PermissionPointDTO;
|
||||
import cn.axzo.tyr.client.model.permission.PermissionPointTreeNode;
|
||||
import cn.axzo.tyr.client.model.permission.PermissionPointTreeQueryReq;
|
||||
import cn.axzo.tyr.client.model.permission.PermissionPointVO;
|
||||
import cn.axzo.tyr.server.controller.permission.PermissionPointController;
|
||||
import cn.axzo.tyr.server.repository.entity.SaasFeature;
|
||||
import cn.axzo.tyr.server.repository.service.SaasFeatureDao;
|
||||
@ -49,7 +50,7 @@ public class PermissionPointTest {
|
||||
@Test
|
||||
public void testGetDetail() {
|
||||
Long permissionId = 360L;
|
||||
ApiResult<PermissionPointDTO> result = controller.getDetail(permissionId);
|
||||
ApiResult<PermissionPointVO> result = controller.getDetail(permissionId);
|
||||
System.out.println(JSON.toJSONString(result));
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user