2.下载课程管理默认模板字段按列表字段调整! 3.课程维护完成后审核通过发布到培训中心如图四所示,打开展示区域不够大! 4,在月度计划所选课程这里重新上传课件、试题按临时上传的课件、试题作为本次培训课件、试题,如果只是改课件、试题不用审核课程可直接发布!
This commit is contained in:
1 parent
0427a60bc3
commit
aa2c89f69e
7 files changed
+124
-95
No files matched your search
@@ -179,31 +179,12 @@ func (s *trainingService) ImportQuestionBankFromKnowledge(ctx context.Context, t
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// 试题变更回待核验(000163):同课件「换课件即回待核验」口径,导入后须
|
||||
// 所属部门课长/经理重新签核,课程方可发布。
|
||||
s.resetLibraryCourseVerify(ctx, tenantID, created.LibraryCourseID)
|
||||
// 试题变更不再回待审核(000165 复测):课件/试题调整视为培训资料更新,
|
||||
// 课程信息未变则维持原审核结论,月计划可直接发布;导入的题库即作为
|
||||
// 本次培训试题(考试/学习均取该课程当前挂接题库)。
|
||||
return created, nil
|
||||
}
|
||||
|
||||
// resetLibraryCourseVerify 课程管理条目试题变更后重置签核状态(000163):
|
||||
// 更换/导入题库同课件变更口径回「待核验」。fail-open:条目缺失或回写失败
|
||||
// 仅记日志,不阻断题库操作本身。
|
||||
func (s *trainingService) resetLibraryCourseVerify(ctx context.Context, tenantID uint64, libraryCourseID string) {
|
||||
if libraryCourseID == "" {
|
||||
return
|
||||
}
|
||||
item, err := s.repo.GetCourseLibraryItem(ctx, tenantID, libraryCourseID)
|
||||
if err != nil || item == nil {
|
||||
return
|
||||
}
|
||||
item.VerifyStatus = types.CourseLibraryVerifyPending
|
||||
item.ConfirmedBy = ""
|
||||
item.ConfirmedAt = nil
|
||||
if err := s.repo.UpdateCourseLibraryItem(ctx, item); err != nil {
|
||||
logger.Warnf(ctx, "[Training] reset library course verify failed, tenant=%d course=%s err=%v", tenantID, libraryCourseID, err)
|
||||
}
|
||||
}
|
||||
|
||||
// ListLibraryCourseQuestionBanks 课程管理条目下的题库列表(试题维护抽屉,000153)。
|
||||
func (s *trainingService) ListLibraryCourseQuestionBanks(ctx context.Context, tenantID uint64, libraryCourseID string) ([]*types.TrainingQuestionBank, error) {
|
||||
if libraryCourseID == "" {
|
||||
@@ -214,7 +195,7 @@ func (s *trainingService) ListLibraryCourseQuestionBanks(ctx context.Context, te
|
||||
|
||||
// LinkQuestionBankToLibraryCourse 更换课程管理条目的试题(000156):所选题库整体
|
||||
// 替换该条目当前挂接的题库,回写课程管理资产(月计划侧更换入口)。
|
||||
// 更换后重置签核状态(000163):同课件变更口径,须课长/经理重新签核方可发布。
|
||||
// 更换试题不回待审核(000165 复测):维持原审核结论,月计划可直接发布。
|
||||
func (s *trainingService) LinkQuestionBankToLibraryCourse(ctx context.Context, tenantID uint64, libraryCourseID, bankID string) error {
|
||||
if libraryCourseID == "" {
|
||||
return errors.NewBadRequestError("缺少课程管理条目")
|
||||
@@ -222,11 +203,7 @@ func (s *trainingService) LinkQuestionBankToLibraryCourse(ctx context.Context, t
|
||||
if _, err := s.repo.GetQuestionBank(ctx, tenantID, bankID); err != nil {
|
||||
return errors.NewNotFoundError("题库不存在")
|
||||
}
|
||||
if err := s.repo.RelinkQuestionBankToLibraryCourse(ctx, tenantID, libraryCourseID, bankID); err != nil {
|
||||
return err
|
||||
}
|
||||
s.resetLibraryCourseVerify(ctx, tenantID, libraryCourseID)
|
||||
return nil
|
||||
return s.repo.RelinkQuestionBankToLibraryCourse(ctx, tenantID, libraryCourseID, bankID)
|
||||
}
|
||||
|
||||
// DeleteQuestionBank 删除题库(连带题目与缓存试卷;试题维护抽屉删除入口,000153)。
|
||||
|
||||
@@ -202,7 +202,9 @@ func (s *trainingService) SaveCourseLibraryItem(ctx context.Context, tenantID ui
|
||||
if strings.TrimSpace(item.OwnerDeptID) == "" {
|
||||
item.OwnerDeptID = old.OwnerDeptID
|
||||
}
|
||||
// 编辑即回待审核(000157):内容变更后原审核结论作废,需重新审核。
|
||||
// 编辑即回待审核(000157):课程信息(名称/部门/权限等)变更后原审核结论
|
||||
// 作废,需重新审核;课件/试题变更例外 —— 000165 复测起不回待审核
|
||||
// (课件走上传/知识库挂接专端点,不走本表单保存)。
|
||||
item.VerifyStatus = types.CourseLibraryVerifyPending
|
||||
item.ConfirmedBy = ""
|
||||
item.ConfirmedAt = nil
|
||||
@@ -473,7 +475,8 @@ func (s *trainingService) ExportCourseLibrary(ctx context.Context, tenantID uint
|
||||
// 不再替换既有课件)。fileSvc 落 file_key,不入知识库解析链路;文档类同步知识库
|
||||
// 「企业培训(课件)」(000153:AI 出题与对话问答依赖知识库分块;视频类仅存原始
|
||||
// 文件,同步失败 fail-open 退回原始文件存取)。主字段(file_*/knowledge_id)镜像
|
||||
// 最新一条,发布校验/AI 出题/学习抽屉等既有依赖口径不变;课件变更即回待审核。
|
||||
// 最新一条,发布校验/AI 出题/学习抽屉等既有依赖口径不变;课件变更不回待审核
|
||||
// (000165 复测,详见 UploadCourseLibraryMaterial)。
|
||||
func (s *trainingService) UploadCourseLibraryMaterial(ctx context.Context, tenantID uint64, id string, fh *multipart.FileHeader, updaterID string) (*types.TrainingCourseLibrary, error) {
|
||||
if fh == nil {
|
||||
return nil, werrors.NewBadRequestError("缺少上传文件")
|
||||
@@ -511,10 +514,9 @@ func (s *trainingService) UploadCourseLibraryMaterial(ctx context.Context, tenan
|
||||
if strings.TrimSpace(item.MaterialName) == "" {
|
||||
item.MaterialName = fh.Filename
|
||||
}
|
||||
// 换课件即回待审核(000157):课件内容变更后需重新审核。
|
||||
item.VerifyStatus = types.CourseLibraryVerifyPending
|
||||
item.ConfirmedBy = ""
|
||||
item.ConfirmedAt = nil
|
||||
// 课件变更不再回待审核(000165 复测):课件/试题调整视为培训资料更新,
|
||||
// 课程信息(名称/部门/权限等)未变则维持原审核结论,月计划可直接发布;
|
||||
// 上传的课件即作为本次培训课件(学习抽屉/计划课件均取最新条)。
|
||||
if err := s.repo.UpdateCourseLibraryItem(ctx, item); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -563,7 +565,8 @@ func (s *trainingService) GetCourseLibraryMaterialFile(ctx context.Context, tena
|
||||
|
||||
// RemoveCourseLibraryMaterial 移除课件条目(000164 多课件:按 mid 定位,mid 空 =
|
||||
// 移除最新一条兼容旧调用):文件与知识库挂接随条目移除,名称登记保留;主字段镜像
|
||||
// 回退为剩余最新条(无剩余则清空);课件变更即回待审核(000157 同口径)。未跑
|
||||
// 回退为剩余最新条(无剩余则清空);课件变更不回待审核(000165 复测同上传口径)。
|
||||
// 未跑
|
||||
// 000164 回填的存量行(列表为空而主字段有课件)按清空主字段兜底。
|
||||
func (s *trainingService) RemoveCourseLibraryMaterial(ctx context.Context, tenantID uint64, id, mid, updaterID string) (*types.TrainingCourseLibrary, error) {
|
||||
item, err := s.repo.GetCourseLibraryItem(ctx, tenantID, id)
|
||||
@@ -598,9 +601,7 @@ func (s *trainingService) RemoveCourseLibraryMaterial(ctx context.Context, tenan
|
||||
refreshPrimaryFromMaterials(item)
|
||||
logger.Infof(ctx, "[Training] course library material removed, tenant=%d course=%s material=%s operator=%s", tenantID, id, removed.Mid, updaterID)
|
||||
}
|
||||
item.VerifyStatus = types.CourseLibraryVerifyPending
|
||||
item.ConfirmedBy = ""
|
||||
item.ConfirmedAt = nil
|
||||
// 课件移除同上传口径(000165 复测):不回待审核,维持原审核结论。
|
||||
if err := s.repo.UpdateCourseLibraryItem(ctx, item); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -640,10 +641,7 @@ func (s *trainingService) AttachCourseLibraryMaterialFromKnowledge(ctx context.C
|
||||
if name != "" && strings.TrimSpace(item.MaterialName) == "" {
|
||||
item.MaterialName = name
|
||||
}
|
||||
// 换课件即回待审核(000157):课件内容变更后需重新审核。
|
||||
item.VerifyStatus = types.CourseLibraryVerifyPending
|
||||
item.ConfirmedBy = ""
|
||||
item.ConfirmedAt = nil
|
||||
// 知识库挂课件同上传口径(000165 复测):不回待审核,维持原审核结论。
|
||||
if err := s.repo.UpdateCourseLibraryItem(ctx, item); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -106,16 +106,17 @@ func TestRemoveCourseLibraryMaterial(t *testing.T) {
|
||||
require.Zero(t, updated.FileSize)
|
||||
require.Empty(t, updated.KnowledgeID)
|
||||
require.Equal(t, "登记名称保留", updated.MaterialName)
|
||||
require.Equal(t, types.CourseLibraryVerifyPending, updated.VerifyStatus)
|
||||
require.Empty(t, updated.ConfirmedBy)
|
||||
require.Nil(t, updated.ConfirmedAt)
|
||||
// 课件移除不再回待审核(000165 复测):维持原审核结论与核验痕迹。
|
||||
require.Equal(t, types.CourseLibraryVerifyConfirmed, updated.VerifyStatus)
|
||||
require.Equal(t, "u-verifier", updated.ConfirmedBy)
|
||||
require.NotNil(t, updated.ConfirmedAt)
|
||||
|
||||
// 落库复核(更新为全列覆盖,防只改内存对象)。
|
||||
stored, err := svc.GetCourseLibraryItem(ctx, tenantID, item.ID)
|
||||
require.NoError(t, err)
|
||||
require.Empty(t, stored.FileKey)
|
||||
require.Empty(t, stored.KnowledgeID)
|
||||
require.Equal(t, types.CourseLibraryVerifyPending, stored.VerifyStatus)
|
||||
require.Equal(t, types.CourseLibraryVerifyConfirmed, stored.VerifyStatus)
|
||||
|
||||
// 已无课件再移除:拒绝。
|
||||
_, err = svc.RemoveCourseLibraryMaterial(ctx, tenantID, item.ID, "", "u-op")
|
||||
|
||||
Binary file not shown.
Reference in new issue
Block a user