luoweijian
|
ecc3c49636
|
feat(opportunity): 票 03 商机主表落地(Opportunity 实体 + 5 态枚举 + Mapper 骨架)
TDD 三切片(红→绿各一轮,19 测试全绿):
- OpportunityStatus:轴 1 归属流转 5 态枚举(1待领取/2推进中/3暂缓中/4已关闭/5已转项目),
implements HasValueEnum<Integer>;只钉值域,迁移逻辑归票 04
- Opportunity:主表实体(票 03 三簇 + Amendment 1),同构 crm-lead/Lead 写法
* 簇 A 业务字段 12 列(含 project_amount decimal(14,2) 选填,Amendment 1)
* 簇 B 归属三层(owner_user_id/owner_dept_id/origin_dept_id)+ 两轴落点
(opp_status/current_stage_id/stage_template_id+版本号冗余)+ 来源快照 4 列
+ 单计时器 claim_time/last_valid_follow_time
* C3 主客户冗余快照 2 列、暂缓附加 4 列落主表(E4 写/E5 清空)
* 乐观锁 @Version version=0(切主客户票 13 / 状态 CAS 票 04 复用,接线归后续票)
* @DataScope(module=opportunity, owner_user_id, owner_dept_id)——module 已在
crm-auth DataInitializer 预注册,不触发 ADR-0006 启动拒绝
* 索引:UNIQUE(source_lead_id) + (owner_user_id,opp_status) + (owner_dept_id,opp_status)
* 不建:pool_id/dept_id/recycle_deadline/expected_deal_date(票 05/10 定稿排除)
- OpportunityMapper:骨架 extends CrmBaseMapper(同构 LeadMapper)
- 模块装配:根 pom modules/dependencyManagement + crm-app 聚合依赖
- CONTEXT.md 待细化小节勾销主表项
边界守住:子表归 07/08/09,customerId 契约归 11,关联客户表归 13,均未触碰。
验证:全量 BOM 扫描 0 命中;全反应堆 clean test 9 模块 SUCCESS。
|
2 weeks ago |
luoweijian
|
fa476b4766
|
feat: 单端在线登录(顶号)——每 (用户, 端类型) 至多一个活会话
按 .scratch/single-device-login spec(票 01-07)落地:
- 会话反向索引 session:{userId}:{clientType}->jti(token 键为真相、索引为线索,
反查必验证、脏索引自愈),与 token 键 TTL 对齐并跟随滑动续期
- login/dingtalk 增可选 clientType(默认 pc、大小写不敏感、非法值 61016);
检测到设备在线不签正式 token,返回 61013 + 短命 preLoginToken(带 data 不抛异常)
- 新增 login/dingtalk/confirm:GETDEL 消费 preLoginToken(拿到即烧)-> 踢旧会话
(埋 kicked 标记 + 删旧 token)-> 签新 token 覆写索引;失效统一 61014
- 被顶设备下次请求:filter 埋 ATTR_KICKED_OFFLINE -> commence 输出 401 + 61015
- 登出改 CAS 删索引(Lua 脚本,防误删已被顶号覆写的新索引)
- crm-base Result 增 fail(code, msg, data) 重载;错误码 61013-61016 登记 README
- 存量会话(无 clientType)与老前端(不传 clientType)路径完全兼容;JWT 不变
- 测试:TokenServiceTest 18 / FilterTest 4 / HandlersTest 3 / AuthServiceImplTest +5,
crm-auth 183 全过,全仓 8 模块 BUILD SUCCESS
|
3 weeks ago |
luoweijian
|
3d55eeb196
|
feat(dict): data dictionary module — two-level flat model, CRUD/default/cache/permission/seed (ADR-0015)
- 4 tables (dict_group/dict_item/dict_group_default/dict_ref_count), delete_key soft-delete reuse
- DictGroup/DictItem full CRUD + force-delete + status toggle + enabled-list
- DictReferenceService: increment/decrement/batchApply/isReferenced, same-tx ref_count, no cache
- DictQueryService: Caffeine 10s cache + 2s negative cache for empty results, group.status join
- Default item: INSERT ON DUPLICATE KEY UPDATE, hibernate on group disable, auto-restore
- Permission seeds: 10 perm codes → sys_menu tree, bound to ROLE_ADMIN, no crm-auth import
- Built-in dict initializer: idempotent upsert, builtin=false never touched (US-41), value not overwritten
- 48 tests pass; full project compiles
|
1 month ago |