fix(培训课程):优化培训课程

This commit is contained in:
runny committed 2026-11-17 08:21:59 +08:00
1 parent e378e8b7fd
commit aae041a0b4
19 files changed
+777 -188

No files matched your search

+1 -1
View File
@@ -598,7 +598,7 @@ func aiRuleSummary(scope, courseName string, stats *types.TrainingAIStats) strin
b.WriteString(fmt.Sprintf("4. 对薄弱知识点「%s」安排集中补训。\n", stats.WrongQuestions[0].KnowledgePoint))
}
if stats.Sign.Absent > 0 || stats.Sign.Late > 0 {
b.WriteString("5. 强化课堂签到纪律,缺席/迟到情况同步部门主管。\n")
b.WriteString("5. 强化培训签到纪律,缺席/迟到情况同步部门主管。\n")
}
return b.String()
}
@@ -12,7 +12,7 @@ import (
// ---------------------------------------------------------------------------
// 培训佐证文件(签到照/培训视频):线下课按场次归档,文件走 fileSvc 原始
// 存取(不入知识库解析链路),供课堂签到页上传、在线预览与请款佐证。
// 存取(不入知识库解析链路),供培训签到页上传、在线预览与请款佐证。
// ---------------------------------------------------------------------------
// validEvidenceKinds 佐证文件类型白名单。
+36
View File
@@ -153,6 +153,42 @@ func (h *Handler) ImportEmployees(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{"success": true, "data": gin.H{"imported": count}})
}
// updateEmployeeRequest is the body of PUT /org/employees/:id.
// 姓名/工号随平台账号维护,不在可编辑范围;部门必填(与导入同规)。
type updateEmployeeRequest struct {
DeptID string `json:"dept_id" binding:"required"`
Post string `json:"post"`
Status string `json:"status"`
}
// UpdateEmployee PUT /org/employees/:id — 修改员工档案。
// Read-modify-write:先取现有档案再覆盖可编辑字段,wecom_userid/lecturer_rate
// 等由 OA 同步/业务模块维护的字段保持不动;状态留空表示不变更。
func (h *Handler) UpdateEmployee(c *gin.Context) {
ctx := c.Request.Context()
var req updateEmployeeRequest
if err := c.ShouldBindJSON(&req); err != nil {
_ = c.Error(errors.NewBadRequestError("请求参数不合法").WithDetails(err.Error()))
return
}
employee, err := h.svc.GetEmployee(ctx, callerTenantID(c), c.Param("id"))
if err != nil {
_ = c.Error(err)
return
}
employee.DeptID = req.DeptID
employee.Post = req.Post
if req.Status != "" {
employee.Status = req.Status
}
updated, err := h.svc.UpdateEmployee(ctx, callerTenantID(c), employee)
if err != nil {
_ = c.Error(err)
return
}
c.JSON(http.StatusOK, gin.H{"success": true, "data": updated})
}
// ListPlatformUsers GET /org/platform-users — 员工导入的用户选择器数据源。
func (h *Handler) ListPlatformUsers(c *gin.Context) {
users, err := h.svc.ListTenantUsers(c.Request.Context(), callerTenantID(c))
+1
View File
@@ -24,6 +24,7 @@ func RegisterOrgRoutes(r *gin.RouterGroup, h *orgcenter.Handler, g *rbacGuards)
// ---- 员工档案 ----
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)