fix(bug):和信智汇学院上线培训 · 2026/11/27 10:00对该课程扫码签到如图所示学员信息丢失了!请核对矫正!
deploy-hxtesting / build-and-deploy (push) Successful in 1m17s
deploy-hxtesting / build-and-deploy (push) Successful in 1m17s
This commit is contained in:
1 parent
4f77907a8a
commit
0c471efb9f
8 files changed
+52
-11
No files matched your search
@@ -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,
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user