diff --git a/tyr-api/src/main/java/cn/axzo/tyr/client/feign/PermissionPointApplyApi.java b/tyr-api/src/main/java/cn/axzo/tyr/client/feign/PermissionPointApplyApi.java new file mode 100644 index 00000000..f7062eef --- /dev/null +++ b/tyr-api/src/main/java/cn/axzo/tyr/client/feign/PermissionPointApplyApi.java @@ -0,0 +1,26 @@ +package cn.axzo.tyr.client.feign; + +import javax.validation.Valid; + +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +import cn.axzo.framework.domain.web.result.ApiResult; +import cn.axzo.tyr.client.model.vo.PermissionPointApplyDetailUpdateVO; +import cn.axzo.tyr.client.model.vo.UpdatePermissionPointApplyVO; + +/** + * PermissionPointApplyApi 权限点申请spi + * + * @author yangsong + * @version 2023/09/25 16:20 + **/ +@FeignClient(name = "tyr", url = "${axzo.service.tyr:http://tyr:8080}") +public interface PermissionPointApplyApi { + @PostMapping(value = "/api/v1/permissionPoint/apply/update") + ApiResult updateApply(@RequestBody@Valid UpdatePermissionPointApplyVO permissionPointApply); + + @PostMapping(value = "/api/v1/permissionPoint/apply/update-detail") + ApiResult updateDetail(@RequestBody@Valid PermissionPointApplyDetailUpdateVO updateDetail); +} \ No newline at end of file diff --git a/tyr-api/src/main/java/cn/axzo/tyr/client/model/enums/PermissionPointApplyStatus.java b/tyr-api/src/main/java/cn/axzo/tyr/client/model/enums/PermissionPointApplyStatus.java new file mode 100644 index 00000000..e7ae47cf --- /dev/null +++ b/tyr-api/src/main/java/cn/axzo/tyr/client/model/enums/PermissionPointApplyStatus.java @@ -0,0 +1,40 @@ +package cn.axzo.tyr.client.model.enums; + +import java.util.HashMap; +import java.util.Map; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * apply 权限点申请状态 + * + * @author yangsong + * @version 2023/09/25 16:33 + **/ +@Getter +@AllArgsConstructor +public enum PermissionPointApplyStatus { + INITIALIZED(0, "初始化"), + CONFIGURED (1, "权限配置"), + PUBLISHED_DEV(2, "已发布dev"), + PUBLISHED_TEST(3, "已发布test"), + PUBLISHED_PRE(4, "已发布pre"), + PUBLISHED_PROD(5, "已发布生产"), + ACCEPTED(6, "产品已验收"), + ; + + private Integer code; + private String desc; + + private static final Map MAPPING = new HashMap<>(); + static { + for (PermissionPointApplyStatus type : PermissionPointApplyStatus.values()) { + MAPPING.put(type.code, type); + } + } + + public static PermissionPointApplyStatus apply(Integer code) { + return code == null ? null :MAPPING.get(code); + } +} \ No newline at end of file diff --git a/tyr-api/src/main/java/cn/axzo/tyr/client/model/vo/PermissionPointApplyDetailUpdateVO.java b/tyr-api/src/main/java/cn/axzo/tyr/client/model/vo/PermissionPointApplyDetailUpdateVO.java new file mode 100644 index 00000000..626af0f4 --- /dev/null +++ b/tyr-api/src/main/java/cn/axzo/tyr/client/model/vo/PermissionPointApplyDetailUpdateVO.java @@ -0,0 +1,113 @@ +package cn.axzo.tyr.client.model.vo; + +import java.util.List; + +import javax.validation.Valid; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +import lombok.Data; + +/** + * PermissionPointApplySubmitReq 完成配置 + * + * @author yangsong + * @version 2023/09/25 14:51 + **/ +@Data +public class PermissionPointApplyDetailUpdateVO { + /** + * 申请id + */ + @NotNull + private Long applyId; + /** + * 权限点信息, 平铺结构 + */ + @NotEmpty + @Valid + private List permissionPoints; + + /** + * 权限点 + */ + @Data + public static class PermissionPointInfoVO{ + @NotNull + private Long id; + /** + * 元素code + */ + private String featureCode; + + /** + * 菜单icon + */ + private String icon; + /** + * 页面路由 + */ + private String linkUrl; + + /** + * 适用终端 1:PC 2:UNI 4:APP + */ + private Integer linkType; + + /** + * 扩展字段 - APP适配参数 + */ + private String linkExt; + + /** + * 小程序AppID + */ + private String microAppItemId; + + /** + * 元素类别 0.菜单 1.页面 3按钮 + */ + private Integer featureType; + +// /** +// * 0:查看 1:操作 +// */ +// private Integer operateType; + + + /** + * 适用单位类型 1:总包 2:建设单位 4:监理单位 8:劳务分包 16:专业分包 32-班组 + */ + private List fitOuTypeList; + + /** + * 适用节点类型 1:部门 2:班组 4:小组 + */ + private List fitOuNodeTypeList; + + /** + * 所属应用 + */ + private String appName; + + /** + * 功能URL + */ + private String featureUrl; + +// /** +// * 是否认证 0:无需要认证 1:需要认证 +// */ +// private Boolean needCert; +// +// /** +// * 是否授权 0:无需要授权 1:需要授权 +// */ +// private Boolean needAuth; + + /** + * 授权策略类型,允许为空 1-平台授权型 2-客户授权型 3-免授权型 + */ + private Integer delegatedType; + } +} \ No newline at end of file diff --git a/tyr-api/src/main/java/cn/axzo/tyr/client/model/vo/PermissionPointApplyVO.java b/tyr-api/src/main/java/cn/axzo/tyr/client/model/vo/PermissionPointApplyVO.java new file mode 100644 index 00000000..1c67248e --- /dev/null +++ b/tyr-api/src/main/java/cn/axzo/tyr/client/model/vo/PermissionPointApplyVO.java @@ -0,0 +1,210 @@ +package cn.axzo.tyr.client.model.vo; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonIgnore; + +import cn.axzo.basics.common.model.IBaseTree; +import cn.axzo.framework.domain.ServiceException; +import cn.hutool.core.collection.CollectionUtil; +import lombok.Data; + +/** + * PermissionPointApplyRes 权限点申请详情 + * + * @author yangsong + * @version 2023/09/25 15:39 + **/ +@Data +public class PermissionPointApplyVO { + /** + * 权限点申请id + */ + private Long id; + /** + * 业务分类id + */ + private Long businessTypeId; + /** + * 流程实例id + */ + private Long workflowInstantceId; + /** + * 状态 0:初始化 1:权限配置 2:已发布dev 3:已发布test 4:已发布pre 5:已发布生产 6:产品已验收名称 + */ + private Integer status; + /** + * 创建时间 + */ + private Date createAt; + /** + * 修改时间 + */ + private Date updateAt; + + private List permissionPoints; + + @Data + public static class PermissionPointInfoVO implements IBaseTree { + + /** 权限点申请明细ID **/ + private Long id; + + /** 父级节点ID **/ + private Long parentId; + + /** 权限点名称 **/ + private String permissionName; + + /** 权限code **/ + private String featureCode; + + /** 排序 **/ + private Integer sort; + + /** 所属端 **/ + private String terminal; + + /** 权限点层级path **/ + private String path; + /** + * 权限点层级pathName + */ + private String pathName; + /** + * 描述 + */ + private String description; + + /** + * 元素类别 0.菜单 1.页面 3按钮 + */ + private Integer featureType; + + /** 元素类别描述 - 对应featureType **/ + private String featureTypeDesc; + + /** + * 授权策略类型,允许为空 1-平台授权型 2-客户授权型 3-免授权型 + */ + private Integer delegatedType; + + /** 图标 **/ + private String icon; + + /** 页面路由地址 **/ + private String linkUrl; + + /** 链接类型 1-PC 2-小程序 4-原生 **/ + private String linkType; + + /** 扩展字段 **/ + private String linkExt; + + /** 小程序ID **/ + private String microAppItemId; + + /** + * 网关专属字段,所属应用 + */ + private String appName; + + /** + * 网关专属字段 ,功能URL,对应后端接口url + */ + private String featureUrl; + + /** + * 创建人id + */ + private Long createBy; + + /** + * 创建时间 + */ + private Date createAt; + + /** + * 更新时间 + */ + private Date updateAt; + + /** + * 修改人id + */ + private Long updateBy; + + /** + * 适用单位类型 1:总包 2:建设单位 4:监理单位 8:劳务分包 16:专业分包 32-班组 + */ + private List fitOuTypeList; + + /** + * 适用节点类型 1:部门 2:班组 4:小组 + */ + private List fitOuNodeTypeList; + + /** + * 是否认证 0:无需要认证 1:需要认证 + */ + private Boolean needCert; + + /** + * 是否授权 0:无需要授权 1:需要授权 + */ + private Boolean needAuth; + + /** 下级节点 **/ + private List children; + + + @JsonIgnore + @Override + public Long getNodeCode() { + return id; + } + + @JsonIgnore + @Override + public Long getParentNodeCode() { + return parentId; + } + + @JsonIgnore + @Override + public List getNodeChildren() { + return children; + } + + @JsonIgnore + @Override + public void setNodeChildren(List nodeChildren) { + this.children = nodeChildren; + } + /** + * 将树型结构平铺展示。会将当前节点也添加到children中 + */ + public void flatChildren() { + if (CollectionUtil.isNotEmpty(children)) { + this.children = getNode(new ArrayList<>(),children, 10); + } + } + + private List getNode(List rootList,List list,Integer maxDepth) { + if (maxDepth < 1) { + throw new ServiceException("超过最大递归深度,可能发生死循环"); + } + if (CollectionUtil.isEmpty(list)) { + return rootList; + } + list.stream().forEach(e -> { + getNode(rootList, e.getChildren(), maxDepth - 1); + e.setChildren(null); + } ); + rootList.addAll(list); + return rootList; + } + } +} \ No newline at end of file diff --git a/tyr-api/src/main/java/cn/axzo/tyr/client/model/vo/UpdatePermissionPointApplyVO.java b/tyr-api/src/main/java/cn/axzo/tyr/client/model/vo/UpdatePermissionPointApplyVO.java new file mode 100644 index 00000000..101ded64 --- /dev/null +++ b/tyr-api/src/main/java/cn/axzo/tyr/client/model/vo/UpdatePermissionPointApplyVO.java @@ -0,0 +1,31 @@ +package cn.axzo.tyr.client.model.vo; + +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * SaveOrUpdatePermissionPointApplyVO 新增或者修改权限点申请 + * + * @author yangsong + * @version 2023/09/25 16:27 + **/ +@Data +public class UpdatePermissionPointApplyVO { + @NotNull + private Long id; + /** + * 业务分两类id, 不修改留空 + */ + private Long businessTypeId; + /** + * 流程实例id, 不修改留空 + */ + private Long workflowInstantceId; + /** + * 状态 0:初始化 1:权限配置 2:已发布dev 3:已发布test 4:已发布pre 5:已发布生产 6:产品已验收名称 + * 不修改留空 + * @see cn.axzo.tyr.client.model.enums.PermissionPointApplyStatus + */ + private Integer status; +} \ No newline at end of file diff --git a/tyr-server/src/main/java/cn/axzo/tyr/server/repository/entity/SaasFeatureApply.java b/tyr-server/src/main/java/cn/axzo/tyr/server/repository/entity/SaasFeatureApply.java new file mode 100644 index 00000000..5bbc54ba --- /dev/null +++ b/tyr-server/src/main/java/cn/axzo/tyr/server/repository/entity/SaasFeatureApply.java @@ -0,0 +1,36 @@ +package cn.axzo.tyr.server.repository.entity; + +import java.io.Serializable; + +import com.baomidou.mybatisplus.annotation.TableName; + +import cn.axzo.pokonyan.config.mybatisplus.BaseEntity; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** +* 业务分类 +* @TableName saas_feature_apply +*/ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@TableName("saas_feature_apply") +public class SaasFeatureApply extends BaseEntity implements Serializable { + + /** + * 业务分类id + */ + private Long businessTypeId; + /** + * 流程实例id + */ + private Long workflowInstantceId; + /** + * 状态 0:初始化 1:权限配置 2:已发布dev 3:已发布test 4:已发布pre 5:已发布生产 6:产品已验收名称 + */ + private Integer status; +} diff --git a/tyr-server/src/main/java/cn/axzo/tyr/server/repository/entity/SaasFeatureApplyDetail.java b/tyr-server/src/main/java/cn/axzo/tyr/server/repository/entity/SaasFeatureApplyDetail.java new file mode 100644 index 00000000..62f879be --- /dev/null +++ b/tyr-server/src/main/java/cn/axzo/tyr/server/repository/entity/SaasFeatureApplyDetail.java @@ -0,0 +1,108 @@ +package cn.axzo.tyr.server.repository.entity; + +import java.io.Serializable; + +import com.baomidou.mybatisplus.annotation.TableName; + +import cn.axzo.pokonyan.config.mybatisplus.BaseEntity; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** +* +* @TableName saas_feature_apply_detail +*/ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@TableName("saas_feature_apply_detail") +public class SaasFeatureApplyDetail extends BaseEntity implements Serializable { + + /** + * 申请id + */ + private Long applyId; + /** + * 名称 + */ + private String featureName; + /** + * code + */ + private String featureCode; + /** + * 图标地址 + */ + private String icon; + /** + * 菜单上级id + */ + private Long parentId; + /** + * 链接地址 + */ + private String linkUrl; + /** + * 1:CMS 2:小程序 4:原生 + */ + private Integer linkType; + /** + * 扩展字段 + */ + private String linkExt; + /** + * 小程序id 关联micro_app_item id + */ + private String microAppItemId; + /** + * 路径 + */ + private String path; + /** + * 描述 + */ + private String description; + /** + * 排序 + */ + private Integer sort; + /** + * 菜单适用于平台 0:企业工作台 1:项目工作台 + */ + private String terminal; + /** + * 类型 0.模块 1.菜单 2页面 3功能 + */ + private Integer featureType; + /** + * 创建人id + */ + private Long createBy; + /** + * 修改人id + */ + private Long updateBy; + /** + * 网关专属字段,所属应用 + */ + private String appName; + /** + * 网关专属字段 ,功能URL,对应后端接口url + */ + private String featureUrl; + /** + * 网关专属字段,是否认证 0:无需要认证 1:需要认证 + */ + private Integer needCert; + /** + * 网关专属字段,是否授权 0:无需要授权 1:需要授权 + */ + private Integer needAuth; + /** + * 授权策略类型,允许为空 1-平台授权型 2-客户授权型 3-免授权型 + */ + private Integer delegatedType; +} diff --git a/tyr-server/src/main/java/cn/axzo/tyr/server/repository/mapper/SaasFeatureApplyDetailMapper.java b/tyr-server/src/main/java/cn/axzo/tyr/server/repository/mapper/SaasFeatureApplyDetailMapper.java new file mode 100644 index 00000000..d01feda7 --- /dev/null +++ b/tyr-server/src/main/java/cn/axzo/tyr/server/repository/mapper/SaasFeatureApplyDetailMapper.java @@ -0,0 +1,17 @@ +package cn.axzo.tyr.server.repository.mapper; + +import org.apache.ibatis.annotations.Mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +import cn.axzo.tyr.server.repository.entity.SaasFeatureApplyDetail; + +/** + * SaasFeatureApplyDetailMapper 数据库操作类 + * + * @author yangsong + * @version 2023/09/25 20:04 + **/ +@Mapper +public interface SaasFeatureApplyDetailMapper extends BaseMapper { +} \ No newline at end of file diff --git a/tyr-server/src/main/java/cn/axzo/tyr/server/repository/mapper/SaasFeatureApplyMapper.java b/tyr-server/src/main/java/cn/axzo/tyr/server/repository/mapper/SaasFeatureApplyMapper.java new file mode 100644 index 00000000..f0fdc0a0 --- /dev/null +++ b/tyr-server/src/main/java/cn/axzo/tyr/server/repository/mapper/SaasFeatureApplyMapper.java @@ -0,0 +1,16 @@ +package cn.axzo.tyr.server.repository.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +import cn.axzo.tyr.server.repository.entity.SaasFeatureApply; +import org.apache.ibatis.annotations.Mapper; + +/** + * SaasFeatureApplyMapper 数据库操作类 + * + * @author yangsong + * @version 2023/09/25 20:04 + **/ +@Mapper +public interface SaasFeatureApplyMapper extends BaseMapper { +} \ No newline at end of file