# BaoYPro — Weaver E10 接收统一待办数据(已实现骨架) Source doc: 接收统一待办数据.docx Field extract: [weaver-receive-todo-api.md](weaver-receive-todo-api.md) SSO deep link: skill **kdshrsso** Option B-qy (`/qy/auth/weaver/app.do`). Target: Kingdee SHR → Weaver/Fanwei E10 统一待办中心(报业 BaoYPro)。 **New project / new channel:** complete **Agent intake** in [SKILL.md](SKILL.md) before coding. ## Endpoint (E10 OpenAPI) Private E10 often needs **`/papi/openapi`** prefix (root `/oauth2/authorize` may hit portal HTML): ``` POST {host}/papi/openapi/api/open_intunifytodo/server_engine/receiveRequestInfo?access_token={token} ``` Auth: 1. corpid / app_key / app_secret (开放平台,与 SSO oauth apps **分开**) 2. authorize → code → access_token (~2h) 3. Success: `message.errcode == "200"` and `data.operResult == "1"` ## Upsert / concurrency Same **syscode + flowid + workflowname(workflowcode) + receiver** → update; else insert. Update compares **receivets** (ms): newer wins. ## isremark / viewtype | isremark | Meaning | SHR SPI | |----------|---------|---------| | 0 | 待办 | `addMessage` | | 2 | 已办 | `addCompletedMessage` (task done) | | 4 | 办结 | Flow end (`requestStatus` often 3) | | 8 | 抄送/待阅 | `updateMessages` | | -1 | 删除 | `removeMessage` | | viewtype | Meaning | |----------|---------| | 0 | 未读 | | 1 | 已读 | ## Field map (highlights) | Weaver | SHR | |--------|-----| | syscode | e.g. `s-HRCloud` (后台注册,<=10) | | flowid | **procInstId**(不要用 assignId) | | receiver | 工号 / PERSON_NUMBER 规则 | | pcurl / appurl | **相对路径 only**(禁止 http/https 开头) | | receivets | 毫秒时间戳,乱序必传 | ## pcurl 拼法(BaoYPro 已落地) Weaver 禁止绝对 URL。SHR 推相对路径,由泛微外链前缀补全域名。 ``` /{weaver.sso.entryPath}?appId={weaver.sso.appId}&redirect={encode(approveAbs)} ``` Defaults: - `weaver.sso.entryPath=/qy/auth/weaver/app.do` - `approveAbs = shrServerName + path.pc.approve + ?AssignmentId=&billID=` Code: `WeaverTodoSupport.buildRelativePcUrl` + `WeaverTodoConfig`. **Do not** use Unified `/qy/auth/app` + UA for todo links (PC browser from Weaver fails UA detect). ## Config strategy (multi-platform later) | File | Scope | |------|-------| | `baoye/weaverTodoConfig.properties` | **Keep name** — Weaver OpenAPI push only | | `baoye/dingtalkTodoConfig.properties` | Future — separate credentials + `dingtalk.sso.entryPath` | | `baoye/feishuTodoConfig.properties` | Future | | `integration-config-*.json` | SSO OAuth only(kdshrsso),not OpenAPI push secrets | Do **not** rename weaverTodoConfig into a mega shared file for BY. Shared ideas: approve path builder + SSO entry template convention; each channel own config + push client. Hot-reload: `WeaverTodoConfig` reloads on file mtime (`WEAVER_TODO_CONFIG_PATH` override optional). ### Template ```properties weaver.todo.enabled=true weaver.openapi.host=http://{e10-host}:{port} weaver.openapi.authorizePath=/papi/openapi/oauth2/authorize weaver.openapi.accessTokenPath=/papi/openapi/oauth2/access_token weaver.openapi.receivePath=/papi/openapi/api/open_intunifytodo/server_engine/receiveRequestInfo weaver.corpid= weaver.app_key= weaver.app_secret= weaver.syscode=s-HRCloud weaver.shrServerName=http://{shr-host}:{port} weaver.sso.appId={integration oauth appId} weaver.sso.entryPath=/qy/auth/weaver/app.do weaver.path.pc.approve=/easweb/webviews/workflow/transferApprove.jsp weaver.wf.delayMs=3000 ``` ## SPI (BaoYPro) Package: `com.kingdee.eas.custom.weaverTodo` Facade: `WeaverMessageWebServiceDao` → `WeaverTodoMessageServer` / ToBeRead path as implemented. ``` addMessage → isremark=0 addCompletedMessage → isremark=2; flow end → 4 removeMessage → isremark=-1 updateMessages → isremark=8 (+ viewtype) ``` CallLog: empty `requestparams` often means exception path (e.g. authorize HTTP 502) — check server logs, not only CallLog. ## Checklist BaoYPro ``` - [x] OpenAPI token + receiveRequestInfo - [x] WeaverMessageWebServiceDao + relative pcurl via weaver entryPath - [x] flowid=procInstId; receivets; sanitize title - [x] weaver.sso.entryPath configurable - [ ] 泛微后台:异构系统 / IP 白名单 / 流程类型开关 - [ ] SPI 产品注册 + deploy jar/properties to EAS_HOME - [ ] E2E: 0→2→4; 待阅; delete -1 - [ ] Compensation via CallLog (optional) - [ ] 切生产:见项目 docs/integration/go-live-prod.html + skill Go-live ``` ## Diff vs YHPro PORTAL-* | Item | YHPro | BaoY Weaver E10 | |------|-------|-----------------| | APIs | Many PORTAL URLs | One receiveRequestInfo (+ oauth) | | Auth | HTTP Basic | OAuth2 → access_token | | Links | Absolute HTTPS OK | **Relative path only** | | SSO wrap | `/shr/api/oAToSHR?redirect=` | `/qy/auth/weaver/app.do?appId&redirect=` | | Config | receiveOAConfig | **weaverTodoConfig** (per platform later) | ## Future DingTalk / Feishu todos 1. New `*TodoConfig.properties` + push client (different API — not Weaver receive) 2. Deep link = that platform SSO entry + same approve redirect 3. Fan-out from SPI / router by `enabled` flags — do not overload weaverTodoConfig