Skip to content

fix: 修复多个问题 — 错误处理、宽限期、邮件通知、法人代表同步#479

Open
JavaPythonAIForBAT wants to merge 10 commits into
reviewfrom
fix/representative-sync-and-errors
Open

fix: 修复多个问题 — 错误处理、宽限期、邮件通知、法人代表同步#479
JavaPythonAIForBAT wants to merge 10 commits into
reviewfrom
fix/representative-sync-and-errors

Conversation

@JavaPythonAIForBAT

@JavaPythonAIForBAT JavaPythonAIForBAT commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

修改内容

1. 修复 "doc doesn't exist" 错误未正确转换

  • toModelError 中添加对 ErrorResourceNotFound 的判断,映射为 ErrNoLink
  • FindCLAs 中捕获资源不存在错误并转换为 ErrorCodeLinkNotExists

2. 宽限期默认改为 2 年,每季度发送邮件通知

  • 默认宽限期从 365 天改为 730 天(2 年)
  • 通知间隔为 90 天(每季度)

3. 修复邮件通知 URL 路径问题

  • 移除邮件中多余的 sign/ 前缀

4. 修复测试文件编译错误

  • signing/watch/config_test.go
  • signing/watch/notify_corp_admin_test.go

5. 修复 UpdateRepresentative 未同步更新 cs.Admin 和 User 表的 BUG

  • 修改法人代表邮箱后,同步更新管理员登录账号信息(cs.Admin.Representative
  • 同步更新 User 表中的 emailaccount 字段
  • 确保修改后可用新邮箱登录和重置密码
  • 已上传 CLA PDF 的企业状态不受影响(HasPDF 不会被清除)

Issue

resolve https://github.com/opensourceways/backlog/pull/909

1. 修复 "doc doesn't exist" 错误未正确转换为领域错误的问题
   - toModelError 中添加对 ErrorResourceNotFound 的判断
   - FindCLAs 中捕获资源不存在错误并转换为 ErrorCodeLinkNotExists

2. 宽限期默认改为 2 年(730天),每季度(90天)发送邮件通知

3. 修复邮件通知 URL 路径问题,移除多余的 sign/ 前缀

4. 修复 signing/watch/config_test.go 和 notify_corp_admin_test.go 编译错误

5. 修复 UpdateRepresentative 未同步更新 cs.Admin 和 User 表的 BUG
   - 修改法人代表邮箱后,同步更新管理员登录账号信息
   - 同步更新 User 表中的 email 和 account 字段
   - 确保修改后可用新邮箱登录和重置密码
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@opensourceways-bot

Copy link
Copy Markdown

Welcome To opensourceways Community

Hey @JavaPythonAIForBAT , thanks for your contribution to the community.

Bot Usage Manual

I'm the Bot here serving you. You can find the instructions on how to interact with me at Here . That means you can comment below every pull request or issue to trigger Bot Commands.

Contact Guide

If you have any questions, please contact the SIG: infratructure ,
and any of the maintainers: @GeorgeCao-hw, @TangJia025, @pkking, @zhongjun2 ,
and any of the committers: @JavaPythonAIForBAT, @Zherphy, @tfhddd, @zhongjun2 .

@opensourceways-bot

Copy link
Copy Markdown

CLA Signature Pass

JavaPythonAIForBAT, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@opensourceways-bot

Copy link
Copy Markdown

Linking Issue Notice

@JavaPythonAIForBAT , the pull request must be linked to at least one issue.
If an issue has already been linked, but the needs-issue label remains, you can remove the label by commenting /check-issue .

@opensourceways-bot

Copy link
Copy Markdown
检查项 状态
敏感信息扫描
漏洞扫描
Check代码检查
开源license合规扫描
开发阶段设计文档检查
流水线链接 点击跳转查看日志

@JavaPythonAIForBAT

Copy link
Copy Markdown
Contributor Author

/retest

@opensourceways-bot

Copy link
Copy Markdown
检查项 状态
敏感信息扫描
漏洞扫描
Check代码检查
开源license合规扫描
开发阶段设计文档检查
流水线链接 点击跳转查看日志

1. 修复企业管理员登录URL缺少 /corporation-manager-login/ 前缀
   - URLOfCLAPlatform 改为 rootURL() + /corporation-manager-login/ + linkId
   - 例如: https://clasign.osinfra.cn/corporation-manager-login/{linkId}

2. 修复个人签署更新URL缺少 /sign-cla/ 前缀
   - SignCLAURL 改为 rootURL() + /sign-cla/ + linkId + /individual-update?email=xxx
   - 例如: https://clasign.osinfra.cn/sign-cla/{linkId}/individual-update?email=xxx

3. 恢复 IndividualSigned.Status 字段并通过adapter传递
   - API响应中恢复 status 字段("not_signed" | "valid" | "expired")
@opensourceways-bot

Copy link
Copy Markdown

CLA Signature Pass

JavaPythonAIForBAT, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@opensourceways-bot

Copy link
Copy Markdown
检查项 状态
敏感信息扫描
漏洞扫描
Check代码检查
开源license合规扫描
开发阶段设计文档检查
流水线链接 点击跳转查看日志

UpdateCLA 的 $set 操作只更新了 updated_at,没有更新 url/lang/type 字段,
导致更新 CLA PDF 后数据库中仍保留旧 URL,页面显示的也是旧 PDF。

修复:$set 操作包含 url、lang、type、updated_at 四个字段。
同时移除对 claDO 无意义的 fieldCLANum 字段更新(cla_num 是 link 级别字段)。
@opensourceways-bot

Copy link
Copy Markdown

CLA Signature Pass

JavaPythonAIForBAT, thanks for your pull request. All authors of the commits have signed the CLA. 👍

signed + version_matched 已完整覆盖所有签署状态:
- signed=false, version_matched=false → 未签署
- signed=true,  version_matched=false → 签署过但已过期
- signed=true,  version_matched=true  → 签署过且在有效期内

status 字段冗余,移除。
@opensourceways-bot

Copy link
Copy Markdown

CLA Signature Pass

JavaPythonAIForBAT, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@opensourceways-bot

Copy link
Copy Markdown
检查项 状态
敏感信息扫描
漏洞扫描
Check代码检查
开源license合规扫描
开发阶段设计文档检查
流水线链接 点击跳转查看日志

@opensourceways-bot

Copy link
Copy Markdown
检查项 状态
敏感信息扫描
漏洞扫描
Check代码检查
开源license合规扫描
开发阶段设计文档检查
流水线链接 点击跳转查看日志

ContainsCla 只查内存缓存,当缓存因服务未重启等原因落后于数据库时,
AgreeNewCLA 会错误地返回 "cla not exists"。

修复:缓存未命中时查询数据库,并将结果回填缓存。
@opensourceways-bot

Copy link
Copy Markdown

CLA Signature Pass

JavaPythonAIForBAT, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@opensourceways-bot

Copy link
Copy Markdown
检查项 状态
敏感信息扫描
漏洞扫描
Check代码检查
开源license合规扫描
开发阶段设计文档检查
流水线链接 点击跳转查看日志

与 ContainsCla 同样的问题:只查内存缓存,缓存未命中时返回空值,
导致 Check 接口的 isLatestClaVersion 误判、FindDiffCLAFile 对新签署
用户也生成 diff 文件。

修复:提取 fillCacheFromDB 公共方法,三个方法缓存未命中时都兜底查 DB。
@opensourceways-bot

Copy link
Copy Markdown

CLA Signature Pass

JavaPythonAIForBAT, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@opensourceways-bot

Copy link
Copy Markdown
检查项 状态
敏感信息扫描
漏洞扫描
Check代码检查
开源license合规扫描
开发阶段设计文档检查
流水线链接 点击跳转查看日志

UpdateClaId 只更新了 cla_id,没有清除 cla_notify。导致企业管理员
同意新协议后,数据库中 cla_notify 仍为旧值,前端可能因此仍认为
有待同意项,展示旧版PDF而非新版。

修复:UpdateClaId 同时将 cla_notify 置空,与个人 SaveNewCLA 行为一致。
@opensourceways-bot

Copy link
Copy Markdown

CLA Signature Pass

JavaPythonAIForBAT, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@opensourceways-bot

Copy link
Copy Markdown
检查项 状态
敏感信息扫描
漏洞扫描
Check代码检查
开源license合规扫描
开发阶段设计文档检查
流水线链接 点击跳转查看日志

- UpdateCLA 的  操作补充 fieldId,确保 clas 中的 id 正确更新为新 CLA id
- 企业管理员通知支持每90天重复提醒,与个人保持一致
- corpSigningDO 增加 cla_notify_count/cla_notify_time 字段进行持久化
- 补充 ErrorCodeCorpSigningCLAIsLatest 和 ErrorCodeIndividualSigningCLAIsLatest 的错误码映射
@opensourceways-bot

Copy link
Copy Markdown

CLA Signature Pass

JavaPythonAIForBAT, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@opensourceways-bot

Copy link
Copy Markdown
检查项 状态
敏感信息扫描
漏洞扫描
Check代码检查
开源license合规扫描
开发阶段设计文档检查
流水线链接 点击跳转查看日志

- CLA 更新成功后调用 SetPendingCLAForLink,将所有企业签署的
  cla_notify 设置为新 CLA id,watcher 检测后立即发送通知
- SetPendingCLAForLink 同步重置 cla_notify_count/time,确保
  第一次通知不被 90 天阈值误跳过
- Redis 缓存层补齐 ClaNotifyCount/ClaNotifyTime 字段
@opensourceways-bot

Copy link
Copy Markdown

CLA Signature Pass

JavaPythonAIForBAT, thanks for your pull request. All authors of the commits have signed the CLA. 👍

旧数据 cla_notify_count/time 为 0,上线后会被误判为未通知而立即发邮件。
新增兼容逻辑:当 cla_notify 已指向最新 CLA 但 count/time 为 0 时,
视为旧系统已通知过一次,初始化 count=1、time=now,跳过本次发送,
从当前时间起 90 天后才发送下次提醒。
@opensourceways-bot

Copy link
Copy Markdown
检查项 状态
敏感信息扫描
漏洞扫描
Check代码检查
开源license合规扫描
开发阶段设计文档检查
流水线链接 点击跳转查看日志

@opensourceways-bot

Copy link
Copy Markdown

CLA Signature Pass

JavaPythonAIForBAT, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@opensourceways-bot

Copy link
Copy Markdown
检查项 状态
敏感信息扫描
漏洞扫描
Check代码检查
开源license合规扫描
开发阶段设计文档检查
流水线链接 点击跳转查看日志

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants