feat(培训课程相关调整):1.培训计划中的形式”线上/线下“与课程中的”线上/线下“独立字段!,培训计划中是指线上培训还是线下培训,课程中是指该课程是线上课还是线下课,两者不能共用相互独立!
deploy-hxtesting / build-and-deploy (push) Successful in 1m18s
deploy-hxtesting / build-and-deploy (push) Successful in 1m18s
2.创建课程时课程默认是”线上“,发布课程时必须要有课件! 3.课程管理中的课件上传预览下载交互样式,按维护”试题“交互样式风格来!列表中增加一列”试题“,列表中”试题“、”课件“按实际情况只展示”有/无“即可!
This commit is contained in:
1 parent
ea0524c445
commit
9950a28346
13 files changed
+769
-169
No files matched your search
@@ -179,7 +179,8 @@ func (s *trainingService) GetCourseLibraryItem(ctx context.Context, tenantID uin
|
||||
|
||||
// SetCourseLibraryPublishStatus 课程条目发布/下线(000154):published 已发布 /
|
||||
// offline 已下线;培训中心「和信课程」目录仅展示已发布课程。
|
||||
// 发布前置校验核验状态(000157):仅「已确认」课程可发布。
|
||||
// 发布前置校验核验状态(000157):仅「已确认」课程可发布;
|
||||
// 发布必须有课件(名称登记不算,须已上传课件文件或已挂接知识库课件文档)。
|
||||
func (s *trainingService) SetCourseLibraryPublishStatus(ctx context.Context, tenantID uint64, id, status string) error {
|
||||
if status != "published" && status != "offline" {
|
||||
return werrors.NewBadRequestError("发布状态不合法(仅支持发布/下线)")
|
||||
@@ -191,6 +192,9 @@ func (s *trainingService) SetCourseLibraryPublishStatus(ctx context.Context, ten
|
||||
if status == "published" && item.VerifyStatus != types.CourseLibraryVerifyConfirmed {
|
||||
return werrors.NewBadRequestError(fmt.Sprintf("课程《%s》尚未核验,请先由所属部门课长/经理核验确认后再发布", item.Name))
|
||||
}
|
||||
if status == "published" && strings.TrimSpace(item.FileKey) == "" && strings.TrimSpace(item.KnowledgeID) == "" {
|
||||
return werrors.NewBadRequestError(fmt.Sprintf("课程《%s》尚未上传课件,请先在列表「课件」入口上传课件文件(或从知识库选择)后再发布", item.Name))
|
||||
}
|
||||
return s.repo.UpdateCourseLibraryPublishStatus(ctx, tenantID, id, status)
|
||||
}
|
||||
|
||||
@@ -434,6 +438,29 @@ func (s *trainingService) GetCourseLibraryMaterialFile(ctx context.Context, tena
|
||||
return rc, item.FileName, nil
|
||||
}
|
||||
|
||||
// RemoveCourseLibraryMaterial 移除课程课件原始文件/知识库挂接(名称登记保留,
|
||||
// 上传课件时仍会以文件名兜底名称登记):文件与知识库文档字段清空,课件内容
|
||||
// 变更即回待核验(000157 同口径),移除后课程不满足发布课件前置。
|
||||
func (s *trainingService) RemoveCourseLibraryMaterial(ctx context.Context, tenantID uint64, id, updaterID string) (*types.TrainingCourseLibrary, error) {
|
||||
item, err := s.repo.GetCourseLibraryItem(ctx, tenantID, id)
|
||||
if err != nil || item == nil {
|
||||
return nil, werrors.NewNotFoundError("课程不存在")
|
||||
}
|
||||
if item.FileKey == "" && item.KnowledgeID == "" {
|
||||
return nil, werrors.NewBadRequestError("该课程未上传课件文件,无需移除")
|
||||
}
|
||||
item.FileKey, item.FileName, item.FileSize = "", "", 0
|
||||
item.KnowledgeID = ""
|
||||
item.VerifyStatus = types.CourseLibraryVerifyPending
|
||||
item.ConfirmedBy = ""
|
||||
item.ConfirmedAt = nil
|
||||
if err := s.repo.UpdateCourseLibraryItem(ctx, item); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
logger.Infof(ctx, "[Training] course library material removed, tenant=%d course=%s operator=%s", tenantID, id, updaterID)
|
||||
return item, nil
|
||||
}
|
||||
|
||||
// AttachCourseLibraryMaterialFromKnowledge 从知识库「企业培训(课件)」选择已有
|
||||
// 文档作为课程课件(与上传同步同口径:下载/月计划课件挂接/AI 出题共用 knowledge_id)。
|
||||
// 原始文件字段清空,名称登记为空时以文档名兜底。
|
||||
|
||||
Reference in new issue
Block a user