--- name: kdshrpmsg description: >- Design and implement Kingdee EAS/SHR workflow todo and to-be-read message push to external portals or Weaver/Fanwei via MessageWebServiceDao. Use for 待办, 待阅, PORTAL-002/003/006/007/011/012/013, OAMessageWebServiceDao, WeaverMessageWebServiceDao, BMCMessage, assignReadRecord, receiveOAConfig, BaoYPro, Weaver, ReceiveTodoRequestByJson, weaverTodoConfig, pcurl entryPath, or ESB portal message integration on Kingdee SHR. BEFORE coding: ask intake questions in this skill (channel, API, identity, deep link, config file). When user says 上线/切生产/go-live: follow Go-live section with kdshrsso; update weaverTodoConfig host/credentials/shrServerName/sso.appId. --- # Kingdee SHR Portal Message Push (待办 / 待阅) Reusable pattern from **YHPro** (玉湖,已测通) and **BaoYPro** (报业 / 泛微统一待办). Do not copy secrets; adapt per customer. Related SSO deep-link entry: skill **kdshrsso** (BaoYPro: Option B-qy `/qy/auth/weaver/app.do`). --- ## Agent intake — ask before coding (mandatory) When implementing **待办 / 待阅** for a new project or new channel, do **not** start coding until goals are confirmed. Ask in one batch. If SSO is in the same delivery, run **kdshrsso** intake first (or together). ### Must confirm (block if unanswered) 1. **渠道**: 泛微统一待办 / YH 门户 PORTAL-* / 钉钉 / 飞书 / 其他?**接口文档**是否已提供? 2. **范围**: 只要待办,还是待办+待阅(BMC)?是否只要推送、SSO 已另做? 3. **鉴权**: OpenAPI token / HTTP Basic / 其他?凭证放哪份 properties(勿与无关渠道混文件)? 4. **人员**: 推送接收人字段 = 工号 / 手机 / 对方 userid?与 sHR 哪一列对齐? 5. **幂等键**: 对方如何判重(如 Weaver:`syscode+flowid+workflow+receiver`;YH:`taskId`)?`flowid` 是否用 **procInstId**? 6. **深链**: 绝对 URL 还是相对路径?SSO 入口(须与 kdshrsso 一致,如 `/qy/auth/weaver/app.do`)?审批页 path? 7. **SPI**: 新建独立 `*MessageWebServiceDao`,还是 Router fan-out 多渠道?默认 **独立 Dao + enabled 开关**,少动已上线渠道。 ### Should confirm (sensible defaults) 8. 配置命名:泛微继续 `weaverTodoConfig.properties`;钉钉/飞书用 `dingtalkTodoConfig` / `feishuTodoConfig`,**不要**改名合并成一个大文件。 9. 状态机:待办/已办/删除/办结/待阅 与对方字段映射(Weaver `isremark` 等)——无文档则先按 weaver-baoy-plan 草案请用户改。 10. CallLog / 失败补推是否要做;WF 延迟(如 `wf.delayMs`)经验值。 11. 与 SSO 是否同期:深链入口必须已存在或同期交付(否则只推链接无法点开登录)。 ### Output before coding 给出 **目标确认表**:渠道、配置文件名、SPI 策略、深链模板、人员字段、状态映射来源。用户确认后再改代码。用户说「按报业/按 BaoYPro」时可复述默认假设请一次确认。 --- ## Go-live / 切生产 (with kdshrsso) When user says **上线 / 切生产**, coordinate with **kdshrsso** Go-live. For Weaver todo channel, update server file: `{EAS_HOME}/server/properties/baoye/weaverTodoConfig.properties` | Key | Set to production | |-----|-------------------| | `weaver.openapi.host` | 生产 OpenAPI/ecology | | `weaver.corpid` / `app_key` / `app_secret` | 生产开放平台 | | `weaver.syscode` | 生产已注册标识 | | `weaver.shrServerName` | 生产 SHR(redirect) | | `weaver.sso.appId` | 与 `integration-config-prod.json` 中 appId 一致 | | `weaver.sso.entryPath` | 通常仍 `/qy/auth/weaver/app.do` | Also: 泛微异构系统/IP 白名单;验收待办点击走生产 SSO。 Full list: project `docs/integration/go-live-prod.html`. --- ## When to use | Scenario | Fit | |----------|-----| | Push workflow **待办** to enterprise portal / OA | Yes | | Push BMC **通知/待阅** to portal | Yes | | Portal APIs match YH PORTAL-* REST + HTTP Basic + ESB envelope | Yes | | Weaver/Fanwei/统一待办中心 (BaoYPro) via ReceiveTodo API | Yes — see weaver-baoy-plan.md | | Only DingTalk/Feishu, no portal | Partial — separate channel + config file; skip PORTAL-* / Weaver receive | | Replace product message center entirely | No | ## Quick decision ``` Need portal sync for SHR workflow/messages? │ ├─ Implement MessageWebServiceDao (platform SPI) — NEVER invent a parallel push framework │ ├─ Todo: addMessage / addCompletedMessage / removeMessage │ └─ ToBeRead: updateMessages(id, MsgStatus, ctx) │ ├─ Downstream? │ ├─ YH-style ESB PORTAL-* → TodoMessageServer + receiveOAConfig │ └─ Weaver E10 receiveRequestInfo → weaverTodo + weaverTodoConfig │ ├─ Deep link back to SHR? │ ├─ Weaver: relative /qy/auth/weaver/app.do?appId&redirect=approveAbs (kdshrsso B-qy) │ ├─ Future DingTalk/Feishu: that platform SSO entry + same approveAbs │ └─ Never rely on Unified /auth/app + UA for PC Weaver todos │ └─ Config naming ├─ Keep weaverTodoConfig.properties for Weaver only (do not mega-rename for BY) └─ Later: dingtalkTodoConfig.properties / feishuTodoConfig.properties ``` --- ## Adapter targets (YH vs BaoY) | Project | Downstream | API style | |---------|------------|-----------| | YHPro | Enterprise portal ESB | Multiple PORTAL-* URLs | | BaoYPro | Weaver / Fanwei / eteams | One receiveRequestInfo (+ OpenAPI oauth) | Reuse YHPro SPI/hooks idea; replace HTTP payload and status fields. Detail: [weaver-baoy-plan.md](weaver-baoy-plan.md) --- ## Architecture (reference layout) ### YHPro ``` platform workflow / BMC → XxxMessageWebServiceDao → Todo / ToBeRead servers → PORTAL-* → MessageCommonUtil (Basic + JSON) ``` ### BaoYPro (Weaver) ``` platform workflow / BMC → WeaverMessageWebServiceDao → WeaverTodoMessageServer → WeaverReceiveTodoClient (OpenAPI token + receiveRequestInfo) → pcurl from WeaverTodoSupport (entryPath + appId + redirect) ``` Config: `{EAS_HOME}/server/properties/baoye/weaverTodoConfig.properties` Key: `weaver.sso.entryPath` (default `/qy/auth/weaver/app.do`) + `weaver.sso.appId`. --- ## Platform SPI map (MessageWebServiceDao) | Method | YH PORTAL | Weaver isremark | |--------|-----------|-----------------| | `addMessage` | 002 | 0 | | `addCompletedMessage` | 006 then 003 | 2; flow end → 4 | | `removeMessage` | 007 | -1 | | `updateMessages` | 011 / 012 | 8 (+ viewtype) | --- ## Implementation checklist (new project) ``` - [ ] 1. Downstream API doc + env + auth - [ ] 2. Person mapping field (工号 / cfidmusercode / …) - [ ] 3. MessageWebServiceDao facade + servers - [ ] 4. Per-channel properties (weaverTodoConfig / receiveOAConfig / …) - [ ] 5. assignReadRecord / CallLog - [ ] 6. Register SPI in product - [ ] 7. BMC hook if 待阅 needed - [ ] 8. PC URL: SSO wrap (kdshrsso) + approve page - [ ] 9. Mobile URL if required - [ ] 10. E2E create → approve → complete/delete ``` --- ## Thinking patterns 1. **SPI first** — Extend `MessageWebServiceDao`. 2. **Idempotency keys** — Decide before coding (YH taskId vs Weaver flowid+receiver). 3. **Order** — Complete/delete tasks before terminal flow update. 4. **Identity** — Same code across SSO + push + SHR person. 5. **Deep link + SSO** — Always SSO entry then target (kdshrsso); platform-specific entry URL. 6. **Latency** — WF DB lag; delay/retry. 7. **Observability** — CallLog; empty requestparams often = exception before body write. 8. **Channels** — Separate configs/clients per IdP; fan-out later; don’t block one channel on another. 9. **Config externalization** — No secrets in git; hot-reload when possible. 10. **Weaver links** — Relative path only; configurable `sso.entryPath`. --- ## Anti-patterns | Avoid | Why | |-------|-----| | Bypass MessageWebServiceDao | Missed callbacks | | Absolute pcurl to Weaver | API rejects / 外链规则不符 | | Unified `/auth/app` for Weaver PC todo | UA → unsupported_client | | Rename weaverTodoConfig to “todoConfig” mid-project | Risk / little gain | | One config file for Weaver OpenAPI + DingTalk push | Secrets and APIs differ | | Soft-fail empty person mapping | Wrong assignee | --- ## Search terms ``` MessageWebServiceDao WeaverMessageWebServiceDao WeaverTodoMessageServer WeaverTodoSupport WeaverTodoConfig weaver.sso.entryPath receiveRequestInfo syscode s-HRCloud assignReadRecord OAMsgCallLog receiveOAConfig PORTAL-002 ``` ## References | Doc | Content | |-----|---------| | [yhpro-reference.md](yhpro-reference.md) | YHPro package + field mapping | | [portal-api-map.md](portal-api-map.md) | PORTAL field quick map | | [weaver-baoy-plan.md](weaver-baoy-plan.md) | BaoYPro Weaver todo (implemented notes) | | [weaver-receive-todo-api.md](weaver-receive-todo-api.md) | Weaver E10 field extract | | kdshrsso Option B-qy | SSO entry / logout / AttackFilter |