diff --git a/frontend/src/api/training/index.ts b/frontend/src/api/training/index.ts
index b8092f6..406cac5 100644
--- a/frontend/src/api/training/index.ts
+++ b/frontend/src/api/training/index.ts
@@ -661,6 +661,10 @@ export interface TrainingSignRecord {
status: 'normal' | 'late' | 'abnormal' | 'duplicate' | 'outside'
abnormal_flags: string[]
reviewed_by: string
+ // 后端联查回填的学员展示字段(签到明细学员列优先用它,名册反查仅兜底)
+ member_name?: string
+ employee_no?: string
+ dept_name?: string
}
export interface SignSummary {
diff --git a/frontend/src/views/training/components/SignPanel.vue b/frontend/src/views/training/components/SignPanel.vue
index 6c0e57c..d25d343 100644
--- a/frontend/src/views/training/components/SignPanel.vue
+++ b/frontend/src/views/training/components/SignPanel.vue
@@ -114,12 +114,12 @@
补录
- {{ memberLabel(row.member_id) }}
+ {{ recordMemberLabel(row) }}
{{ fmtRecordTime(row.signed_at) }}
{{ channelText(row.channel) }}
{{ statusText(row.status) }}
- {{ flagText(f) }}
+ {{ flagText(f) }}
@@ -378,6 +378,19 @@ const memberLabelText = (m: TrainingMember) =>
.filter(Boolean)
.join(' ')
+// 签到明细学员列优先后端联查返回的「姓名 工号」(明细接口已 JOIN 员工档案,
+// 不再依赖名册全量反查 —— 名册分页截断时曾回退显示 member_id);缺失时回退
+// 名册标签,再回退 member_id 前缀。
+const recordMemberLabel = (row: TrainingSignRecord) => {
+ const direct = [row.member_name || '', row.employee_no || ''].filter(Boolean).join(' ')
+ return direct || memberLabel(row.member_id)
+}
+
+// 状态标签已表达 outside 时,abnormal_flags 里的同名标记不再重复渲染
+// (复核前曾出现连续两个「定位异常」标签)。
+const extraFlags = (row: TrainingSignRecord) =>
+ (row.abnormal_flags || []).filter((f) => !(f === 'outside' && row.status === 'outside'))
+
const loadAll = async () => {
loading.value = true
try {
diff --git a/internal/application/repository/training_exam_dash.go b/internal/application/repository/training_exam_dash.go
index 8df6933..768dc3d 100644
--- a/internal/application/repository/training_exam_dash.go
+++ b/internal/application/repository/training_exam_dash.go
@@ -641,7 +641,7 @@ func (r *trainingRepository) EvidenceRows(ctx context.Context, tenantID uint64,
Table("tr_sign_records sr").
Select(`COALESCE(dp.name, '') AS dept_name,
COALESCE(m.employee_no, '') AS employee_no,
- COALESCE(u.username, '') AS member_name,
+ COALESCE(NULLIF(u.display_name, ''), u.username, '') AS member_name,
TO_CHAR(sr.signed_at, 'YYYY-MM-DD HH24:MI') AS signed_at,
COALESCE(lu.username, '') AS lecturer_name,
COALESCE(c.name, '') AS course_name,
diff --git a/internal/application/repository/training_plan_course.go b/internal/application/repository/training_plan_course.go
index d67e5dc..78287ca 100644
--- a/internal/application/repository/training_plan_course.go
+++ b/internal/application/repository/training_plan_course.go
@@ -879,11 +879,21 @@ func (r *trainingRepository) GetSignRecordByID(ctx context.Context, tenantID uin
}
// ListSignRecords returns all records of a session, earliest first.
+// 联查员工档案/账号/部门补齐学员展示字段(姓名/工号/部门):签到明细学员列
+// 不能依赖前端名册全量反查(名册分页截断或未入名册时曾回退显示 member_id)。
func (r *trainingRepository) ListSignRecords(ctx context.Context, tenantID uint64, sessionID string) ([]*types.TrainingSignRecord, error) {
var items []*types.TrainingSignRecord
err := r.db.WithContext(ctx).
- Where("tenant_id = ? AND session_id = ?", tenantID, sessionID).
- Order("signed_at ASC").Find(&items).Error
+ Table("tr_sign_records sr").
+ Joins("LEFT JOIN org_employees e ON e.tenant_id = sr.tenant_id AND e.id = sr.member_id AND e.deleted_at IS NULL").
+ Joins("LEFT JOIN users u ON u.id = e.user_id").
+ Joins("LEFT JOIN org_depts dp ON dp.id = e.dept_id AND dp.tenant_id = e.tenant_id AND dp.deleted_at IS NULL").
+ Where("sr.tenant_id = ? AND sr.session_id = ? AND sr.deleted_at IS NULL", tenantID, sessionID).
+ // user_name 取真实姓名(display_name)优先:员工编号型 IdP(Casdoor)的
+ // username 存工号,真实姓名在 display_name(与组织中心列表口径一致)。
+ Select(`sr.*, COALESCE(NULLIF(u.display_name, ''), u.username, '') AS member_name,
+ COALESCE(e.employee_no, '') AS employee_no, COALESCE(dp.name, '') AS dept_name`).
+ Order("sr.signed_at ASC").Scan(&items).Error
return items, err
}
diff --git a/internal/application/service/training_course.go b/internal/application/service/training_course.go
index 4003242..d4b3040 100644
--- a/internal/application/service/training_course.go
+++ b/internal/application/service/training_course.go
@@ -783,7 +783,12 @@ func (s *trainingService) CreateSignCode(ctx context.Context, tenantID uint64, s
if err != nil {
return nil, errors.NewNotFoundError("课程场次不存在")
}
- if radius <= 0 {
+ // 半径兜底仅在真实圆心下生效:前端生成签到码不携带定位(圆心为零值)时
+ // 不启用围栏 —— 否则 (0,0)+300m 会把所有真实扫码判成定位异常(距离一万
+ // 公里级)。需要围栏时由生成方显式传 geo_lat/geo_lng。
+ if lat == 0 && lng == 0 {
+ radius = 0
+ } else if radius <= 0 {
radius = int(s.ruleFloat(ctx, tenantID, types.RuleKeySignPolicy, "geo_radius_m", 300))
}
now := time.Now()
@@ -982,9 +987,10 @@ func (s *trainingService) Checkin(ctx context.Context, tenantID uint64, userID s
status = types.TrainingSignLate
}
- // 定位围栏判定。
+ // 定位围栏判定。圆心 (0,0) 视为未配置(生成签到码不带定位时圆心落零值):
+ // 距离按 0 记、不打 outside —— 否则圆心在几万公里外,全国任意扫码全是定位异常。
distance := 0.0
- if code.GeoRadius > 0 {
+ if code.GeoRadius > 0 && (code.GeoLat != 0 || code.GeoLng != 0) {
distance = haversineMeters(lat, lng, code.GeoLat, code.GeoLng)
if distance > float64(code.GeoRadius) {
flags = append(flags, "outside")
diff --git a/internal/application/service/training_notify.go b/internal/application/service/training_notify.go
index 6f830c8..c48dd82 100644
--- a/internal/application/service/training_notify.go
+++ b/internal/application/service/training_notify.go
@@ -139,7 +139,7 @@ const (
defaultWeeklyContent = "{month} 月已进入第 {week} 周({week_start} 至 {week_end}),您本月仍有 {count} 场培训未结束,请与人事约定培训时间并于月内完成课件、签到与评价。"
// 年培训计划收集推送默认文案(与前端收集弹窗历史硬编码逐字一致;{year} 渲染收集年度)
defaultDemandCollectTitle = "【培训需求收集】{year}年度培训计划收集"
- defaultDemandCollectContent = "请各部门于 {year} 年 1 月 31 日前提报 {year} 年度培训需求:可点击消息中的「教育训练需求表模板」链接直接下载批量填写后导入,或登录 AIDO → 企业培训 → 培训计划 → 年度需求收集在线逐条提报。"
+ defaultDemandCollectContent = "请各部门于 {year} 年 1 月 31 日前提报 {year} 年度培训需求:可点击消息中的「教育训练需求表模板」链接直接下载批量填写后导入,或登录和信智汇学院 → 企业培训 → 培训计划 → 年度需求收集在线逐条提报。"
)
func defaultNotifyTextTemplates() notifyTextTemplates {
diff --git a/internal/handler/training/training.go b/internal/handler/training/training.go
index 8779d9f..20b00c8 100644
--- a/internal/handler/training/training.go
+++ b/internal/handler/training/training.go
@@ -991,7 +991,7 @@ func (h *Handler) notifyDemandVerify(ctx context.Context, tenantID uint64, deman
}
title := fmt.Sprintf("【年度培训需求核验】%d年度 %s 培训需求待核验", year, name)
content := fmt.Sprintf(
- "%s 新导入 %d 条年度培训需求(课程:%s)。请登录 AIDO → 企业培训 → 年培训计划,逐条核验并【确认】,确认后将自动转入月培训计划。",
+ "%s 新导入 %d 条年度培训需求(课程:%s)。请登录和信智汇学院 → 企业培训 → 年培训计划,逐条核验并【确认】,确认后将自动转入月培训计划。",
name, len(courses), strings.Join(courses, "、"),
)
n, err := h.svc.BroadcastNotification(ctx, tenantID, recipients, "demand_verify", title, content, "plan", strconv.Itoa(year), "")
@@ -1027,7 +1027,7 @@ func (h *Handler) notifyDemandConfirmed(ctx context.Context, tenantID uint64, op
}
title := fmt.Sprintf("【培训计划维护】%s 已确认转入月培训计划", demand.CourseName)
content := fmt.Sprintf(
- "%d年度需求「%s」已核验确认并自动转入月培训计划:请讲师维护课程信息(课件/试题),课长安排授课时间/地点与学员名单。入口:AIDO → 企业培训 → 月培训计划。",
+ "%d年度需求「%s」已核验确认并自动转入月培训计划:请讲师维护课程信息(课件/试题),课长安排授课时间/地点与学员名单。入口:和信智汇学院 → 企业培训 → 月培训计划。",
demand.Year, demand.CourseName,
)
if _, err := h.svc.BroadcastNotification(ctx, tenantID, final, "demand_confirmed", title, content, "course", demand.ID, ""); err != nil {
diff --git a/internal/types/training.go b/internal/types/training.go
index 65ca1c0..646ffe8 100644
--- a/internal/types/training.go
+++ b/internal/types/training.go
@@ -887,6 +887,14 @@ type TrainingSignRecord struct {
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt *time.Time `json:"-" gorm:"index"`
+
+ // 联查只读展示字段(不落库,签到明细学员列由 ListSignRecords JOIN 提供):
+ // MemberName 真实姓名(users.display_name 优先,回退 username 工号);
+ // EmployeeNo/DeptName 来自 org_employees/org_depts 联查。
+ // 前端不再依赖名册全量反查(名册分页截断时学员列曾回退显示 member_id)。
+ MemberName string `json:"member_name" gorm:"->"`
+ EmployeeNo string `json:"employee_no" gorm:"->"`
+ DeptName string `json:"dept_name" gorm:"->"`
}
// TableName pins the physical table name.