spi module提交

This commit is contained in:
yangsong 2023-09-25 20:06:35 +08:00
parent d928f54d8b
commit f748566f5a
9 changed files with 597 additions and 0 deletions

View File

@ -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<Void> updateApply(@RequestBody@Valid UpdatePermissionPointApplyVO permissionPointApply);
@PostMapping(value = "/api/v1/permissionPoint/apply/update-detail")
ApiResult<Void> updateDetail(@RequestBody@Valid PermissionPointApplyDetailUpdateVO updateDetail);
}

View File

@ -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<Integer, PermissionPointApplyStatus> 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);
}
}

View File

@ -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<PermissionPointInfoVO> 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<Long> fitOuTypeList;
/**
* 适用节点类型 1:部门 2:班组 4:小组
*/
private List<Long> fitOuNodeTypeList;
/**
* 所属应用
*/
private String appName;
/**
* 功能URL
*/
private String featureUrl;
// /**
// * 是否认证 0:无需要认证 1:需要认证
// */
// private Boolean needCert;
//
// /**
// * 是否授权 0:无需要授权 1:需要授权
// */
// private Boolean needAuth;
/**
* 授权策略类型允许为空 1-平台授权型 2-客户授权型 3-免授权型
*/
private Integer delegatedType;
}
}

View File

@ -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<PermissionPointInfoVO> permissionPoints;
@Data
public static class PermissionPointInfoVO implements IBaseTree<PermissionPointInfoVO, Long> {
/** 权限点申请明细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<Long> fitOuTypeList;
/**
* 适用节点类型 1:部门 2:班组 4:小组
*/
private List<Long> fitOuNodeTypeList;
/**
* 是否认证 0:无需要认证 1:需要认证
*/
private Boolean needCert;
/**
* 是否授权 0:无需要授权 1:需要授权
*/
private Boolean needAuth;
/** 下级节点 **/
private List<PermissionPointInfoVO> children;
@JsonIgnore
@Override
public Long getNodeCode() {
return id;
}
@JsonIgnore
@Override
public Long getParentNodeCode() {
return parentId;
}
@JsonIgnore
@Override
public List<PermissionPointInfoVO> getNodeChildren() {
return children;
}
@JsonIgnore
@Override
public void setNodeChildren(List<PermissionPointInfoVO> nodeChildren) {
this.children = nodeChildren;
}
/**
* 将树型结构平铺展示会将当前节点也添加到children中
*/
public void flatChildren() {
if (CollectionUtil.isNotEmpty(children)) {
this.children = getNode(new ArrayList<>(),children, 10);
}
}
private List<PermissionPointInfoVO> getNode(List<PermissionPointInfoVO> rootList,List<PermissionPointInfoVO> 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;
}
}
}

View File

@ -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;
}

View File

@ -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<SaasFeatureApply> implements Serializable {
/**
* 业务分类id
*/
private Long businessTypeId;
/**
* 流程实例id
*/
private Long workflowInstantceId;
/**
* 状态 0:初始化 1:权限配置 2:已发布dev 3:已发布test 4:已发布pre 5:已发布生产 6:产品已验收名称
*/
private Integer status;
}

View File

@ -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<SaasFeatureApplyDetail> 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;
}

View File

@ -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<SaasFeatureApplyDetail> {
}

View File

@ -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<SaasFeatureApply> {
}