deploy-hxtesting / build-and-deploy (push) Successful in 1m14s
1.将职称角色中的“从OA同步企微账号”及设置角色、“员工与部门在「组织架构」中统一维护,此处仅配置职称角色”迁移到组织架构页面中, 2.平台新增成员自动添加到“组织架构”页面自动匹配对应部门; 3.在“组织架构”页面可直接设置角色 4.“组织架构”页面职称按名称、工号、部门查找员工 5.新增成员默认放在最上面按时间倒序排列 6.所有登录平台的用户直接默认打开AI对话页面 7.页面3、4中的”AIDO“改为”和信智汇学院“
53 lines
2.5 KiB
Go
53 lines
2.5 KiB
Go
package router
|
|
|
|
import (
|
|
"academy/internal/handler/orgcenter"
|
|
"academy/internal/handler/training"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// RegisterOrgRoutes registers the org-center routes (/api/v1/org/*).
|
|
//
|
|
// 组织中心为租户级共享组织架构(部门/员工档案/模块角色绑定):
|
|
// - 空间 RBAC 把关:读 Viewer+,写 Contributor+;
|
|
// - 业务模块语义(职称角色等)由各模块自己的接口细控,本组不感知;
|
|
// - 不对 API Key 开放(组织数据面向登录用户,默认拒绝)。
|
|
//
|
|
// th 为培训域 handler,可空:职称角色/企微账号维护自培训域迁入组织架构页后,
|
|
// /org 域提供同名写接口(直接复用培训 handler —— 其 requireRoles 基于
|
|
// callerTenantID 做角色细控,与 org 域租户口径一致,且不经培训域的
|
|
// TrainingTenantResolution 租户回落,跨空间 HR 在组织架构页操作不会错绑租户)。
|
|
func RegisterOrgRoutes(r *gin.RouterGroup, h *orgcenter.Handler, th *training.Handler, g *rbacGuards) {
|
|
if h == nil {
|
|
return
|
|
}
|
|
orgGroup := r.Group("/org", g.Viewer())
|
|
{
|
|
// ---- 部门 ----
|
|
orgGroup.GET("/depts", h.ListDepts)
|
|
orgGroup.POST("/depts", g.Contributor(), h.SaveDept)
|
|
orgGroup.DELETE("/depts/:id", g.Contributor(), h.DeleteDept)
|
|
|
|
// ---- 员工档案 ----
|
|
orgGroup.GET("/employees", h.ListEmployees)
|
|
orgGroup.PUT("/employees/:id", g.Contributor(), h.UpdateEmployee)
|
|
orgGroup.GET("/platform-users", g.Contributor(), h.ListPlatformUsers)
|
|
orgGroup.POST("/employees/import", g.Contributor(), h.ImportEmployees)
|
|
|
|
// ---- 职称角色 / 企微账号(培训域语义,handler 内 requireRoles(HR,经理) 细控) ----
|
|
// 职称角色页(培训 members 子页)迁入组织架构页后的 /org 域别名路由:
|
|
// 复用培训 handler,角色绑定仍写 module_key='training' 的 org_module_members。
|
|
if th != nil {
|
|
orgGroup.PUT("/employees/:id/roles", g.Contributor(), th.UpdateMemberRoles)
|
|
orgGroup.PUT("/employees/:id/wecom-userid", g.Contributor(), th.UpdateMemberWecomUserid)
|
|
// wecom-userid-sync 从 OA 目录按工号批量拉取企微 userid(预览→写入两段式)。
|
|
orgGroup.POST("/employees/wecom-userid-sync/preview", g.Contributor(), th.SyncWecomUseridsPreview)
|
|
orgGroup.POST("/employees/wecom-userid-sync/apply", g.Contributor(), th.SyncWecomUseridsApply)
|
|
}
|
|
|
|
// ---- 模块角色绑定 ----
|
|
orgGroup.GET("/modules/:module_key/members", h.ListModuleMembers)
|
|
orgGroup.PUT("/modules/:module_key/members/:employee_id", g.Contributor(), h.PutModuleMember)
|
|
}
|
|
}
|