feat(training): 企业培训迭代:推送深链接与签名下载、课程管理修复与收集模板调整
推送域(000155):
- 广播通知支持 link_url:demand_collect 场景自动签发教育训练需求表模板
匿名下载直链(HMAC token,20 天有效,免登录路由),企微消息尾部拼
「下载模板 + 查看更多详情」链接;站内文本保持纯文本不受影响
- 配置中心新增「推送链接基址」(notify_link_base_url,多入口/内外网部署固定
权威地址,留空跟随推送人访问地址)与「年培训计划收集推送文案」
(demand_collect_*,{year} 渲染收集年度);空标题/内容按模板回落渲染
- 迁移 000155:tr_training_notifications 增 link_url/link_token 列
课程管理:
- 修复点【发布/下线】报「不支持的操作」:动作取值兼容字面量路由(FullPath
末段)与 :action 通配两种注册形态
- 列表新增「创建人」列:creator_id 联查 users 带出姓名,导出 Excel 同步;
新增课程「所属部门」默认当前登录用户所在部门
- 导入加固:表头归一化 + 别名模糊匹配(兼容内置模板/旧口径/自定义模板变体);
导入与新增行支持按部门名兜底解析为 id(前端名册未命中时传 owner_dept_name)
年培训计划:
- 需求列表新增「创建人/创建时间」列(submitter_id 联查 users 带出姓名)
- 收集模板调整:下载时动态删除「培训费用(RMB)」列(旧版自定义模板同步归一,
右侧列/合并/下拉随删列平移);备注右侧追加「调研维度/培训策划要求」说明列
(合并至数据区末行,自动换行带边框,已带说明的自定义模板不覆盖)
开发工具:
- air 热重载适配 Windows:构建收敛到 scripts/air_build.sh(规避 air 经
PowerShell 执行不支持 bash 命令替换),产物改 .exe 后缀;CGO_CFLAGS 取
持久化值并集追加,不覆盖 go env -w 的头文件包含路径
This commit is contained in:
1 parent
242dd7e1a6
commit
4e25fce9aa
30 files changed
+1150
-143
No files matched your search
@@ -26,6 +26,7 @@ import (
|
||||
"academy/internal/errors"
|
||||
"academy/internal/logger"
|
||||
"academy/internal/types"
|
||||
"academy/internal/utils"
|
||||
)
|
||||
|
||||
// 周一讲师汇总提醒的规则键(ruleKeyNotifyWeeklyLecturer* 定义在
|
||||
@@ -121,6 +122,9 @@ type notifyTextTemplates struct {
|
||||
// 周一讲师未完成汇总提醒:标题与内容
|
||||
WeeklyTitle string `json:"weekly_title"`
|
||||
WeeklyContent string `json:"weekly_content"`
|
||||
// 年培训计划收集推送(scene=demand_collect):广播空标题/内容回落渲染
|
||||
DemandCollectTitle string `json:"demand_collect_title"`
|
||||
DemandCollectContent string `json:"demand_collect_content"`
|
||||
}
|
||||
|
||||
// 内置默认文案(与历史硬编码逐字一致;{lecturer} 缺讲师时渲染为「待定」)。
|
||||
@@ -133,6 +137,9 @@ const (
|
||||
defaultLecturerMaintainFooter = "该课程尚未上传课件/学习材料,请尽快登录培训平台补齐,以免影响学员课前学习。"
|
||||
defaultWeeklyTitle = "{year}年{month}月教育训练(第{week}周提醒)"
|
||||
defaultWeeklyContent = "{month} 月已进入第 {week} 周({week_start} 至 {week_end}),您本月仍有 {count} 场培训未结束,请与人事约定培训时间并于月内完成课件、签到与评价。"
|
||||
// 年培训计划收集推送默认文案(与前端收集弹窗历史硬编码逐字一致;{year} 渲染收集年度)
|
||||
defaultDemandCollectTitle = "【培训需求收集】{year}年度培训计划收集"
|
||||
defaultDemandCollectContent = "请各部门于 {year} 年 1 月 31 日前提报 {year} 年度培训需求:可点击消息中的「教育训练需求表模板」链接直接下载批量填写后导入,或登录 AIDO → 企业培训 → 培训计划 → 年度需求收集在线逐条提报。"
|
||||
)
|
||||
|
||||
func defaultNotifyTextTemplates() notifyTextTemplates {
|
||||
@@ -145,6 +152,8 @@ func defaultNotifyTextTemplates() notifyTextTemplates {
|
||||
LecturerMaintainFooter: defaultLecturerMaintainFooter,
|
||||
WeeklyTitle: defaultWeeklyTitle,
|
||||
WeeklyContent: defaultWeeklyContent,
|
||||
DemandCollectTitle: defaultDemandCollectTitle,
|
||||
DemandCollectContent: defaultDemandCollectContent,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,6 +178,8 @@ func parseNotifyTextTemplates(raw []byte) notifyTextTemplates {
|
||||
fill(&t.LecturerMaintainFooter, saved.LecturerMaintainFooter)
|
||||
fill(&t.WeeklyTitle, saved.WeeklyTitle)
|
||||
fill(&t.WeeklyContent, saved.WeeklyContent)
|
||||
fill(&t.DemandCollectTitle, saved.DemandCollectTitle)
|
||||
fill(&t.DemandCollectContent, saved.DemandCollectContent)
|
||||
return t
|
||||
}
|
||||
|
||||
@@ -562,6 +573,53 @@ func (s *trainingService) RunWeeklyLecturerReminders(ctx context.Context, tenant
|
||||
return s.enqueueWeeklyLecturerReminders(ctx, tenantID, time.Now(), s.loadPushEnabled(ctx, tenantID))
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// demand_collect 年培训计划收集推送(2026-11 需求:文案可配 + 模板下载/详情入口)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// demandCollectYear 从广播 ref_id 前缀解析收集年度("2027-<纳秒>" → 2027,
|
||||
// 前端收集弹窗恒传下一年度);无合法年份前缀时回退北京时间下一年。
|
||||
func demandCollectYear(refID string, now time.Time) int {
|
||||
if idx := strings.IndexByte(refID, '-'); idx > 0 {
|
||||
refID = refID[:idx]
|
||||
}
|
||||
if year, err := strconv.Atoi(refID); err == nil && year >= 2000 && year <= 2999 {
|
||||
return year
|
||||
}
|
||||
return beijingNow(now).Year() + 1
|
||||
}
|
||||
|
||||
// demandCollectPlanPath 年培训计划页(前端铃铛 ref_type=plan 同款跳转目标)。
|
||||
const demandCollectPlanPath = "/platform/training/plan"
|
||||
|
||||
// wecomDispatchContent 企微投递正文 = 站内 content + 场景尾部链接。
|
||||
// demand_collect 且行内带 link_url 时追加两行 markdown 链接:
|
||||
//
|
||||
// 下载教育训练需求表模板(签名匿名直链,20 天有效;无 token 时省略)
|
||||
// 查看更多详情>>(进入企业培训系统年培训计划页)
|
||||
//
|
||||
// 其余场景原样返回(提醒类场景的 markdown 由生成侧 remindContent 拼好)。
|
||||
func wecomDispatchContent(row *claimedNotification) string {
|
||||
if row.Scene != types.SceneDemandCollect || row.LinkURL == "" {
|
||||
return row.Content
|
||||
}
|
||||
var b strings.Builder
|
||||
b.WriteString(strings.TrimRight(row.Content, "\n"))
|
||||
if row.LinkToken != "" {
|
||||
b.WriteString("\n\n[下载教育训练需求表模板](")
|
||||
b.WriteString(row.LinkURL)
|
||||
b.WriteString(utils.TrainingTemplateSignedFilePath)
|
||||
b.WriteString("?token=")
|
||||
b.WriteString(row.LinkToken)
|
||||
b.WriteString(")")
|
||||
}
|
||||
b.WriteString("\n[查看更多详情>>](")
|
||||
b.WriteString(row.LinkURL)
|
||||
b.WriteString(demandCollectPlanPath)
|
||||
b.WriteString(")")
|
||||
return b.String()
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// 推送记录(管理台逐人明细)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Reference in new issue
Block a user