diff --git a/AGENTS.md b/AGENTS.md index 650bbde..6c3f0af 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -38,7 +38,7 @@ AI 智能体开发约束 & 项目执行规范 5. 发版与自动更新操作规范 - 自动更新:插件由执行机按账号权限自下载(plugin_sync.py);壳子由执行机自动下载安装包 + 用户点击升级重启(shell_updater.py)。版本源都在中心机控制面。 - 发版统一走 agent CLI(在 desktop/ 目录下执行:.venv\Scripts\python.exe -m controlplane.tools.agent_cli,即控制面 /api/admin/pkg 与 shell 源)。鉴权两种方式:① 密码登录(推荐,任意机器可用):`--admin <管理员> --password <密码>`(或环境变量 AGENT_ADMIN_PASSWORD / AGENT_ADMIN_ACCOUNT),远程机器再加 `--base http://<中心机地址>:8800`;② 本机密钥自签(中心机本机):复用 controlplane/.env 与 .admin_secret。 - - 壳子发版:改 desktop/webhost/tools/shell.version 与 install.iss 的 MyAppVersion → desktop/webhost/frontend 执行 npm run build → PyInstaller 依次打 desktop/webhost/tools/37du-host.spec、37du-host-runner.spec、37du-host-console.spec → ISCC.exe desktop/webhost/tools/install.iss 出安装包;然后 agent_cli shell-release <安装包> --version <新版本> [--notes "说明"]。 + - 壳子发版(按实际流程):改 desktop/webhost/tools/shell.version 与 install.iss 的 MyAppVersion → desktop/webhost/frontend 执行 npm run build → PyInstaller 打 desktop/webhost/tools/37du-host.spec、37du-host-runner.spec(37du-host-console.spec 是调试版不入安装包,可跳过)→ ISCC.exe desktop/webhost/tools/install.iss 出安装包;然后 agent_cli file push <安装包> --category shell --version <新版本> [--notes "说明"](安装包上传到内网文件服务器 FILESERVER_BASE_URL=172.30.35.135:8802,并登记到中心机 file_sources(shell),执行机 shell_updater 从该直链下载;不要用旧的 shell-release 子命令)。 - 插件发版:根级 plugins// 目录打成 zip(根目录含 plugin.json)后 agent_cli publish <插件.zip> --id --version ;权限用 agent_cli grant / revoke 管理。 - 中心机发版:控制面为源码部署(宝塔 gunicorn 8800,不打包 exe)。改后端代码后按 .trae/documents/控制面前后端部署SOP.md「后端部署流程」上传文件 + 重启项目;改前端后按同一文档「前端部署流程」构建并发布到静态站 8090。 - 发布后:执行机下次启动自动检测下载、前端提示后点击升级;插件登录后按权限自动下载更新。 \ No newline at end of file diff --git a/aa.md b/aa.md index 782ddfe..ad57d2b 100644 --- a/aa.md +++ b/aa.md @@ -1,1716 +1,6 @@ -请求 URL -https://hr.37du.co/RedseaPlatform/WeTask.mc?method=query&sortName=create_time&sortType=asc&process_id=3186d5b4-2d7e-4458-9a14-73fb52436788 -请求方法 -POST -{ - "state" : "1", - "meg" : "处理成功", - "des" : "", - "result" : null, - "total" : "", - "jsonList" : [ { - "participantSignature" : null, - "taskId" : "e40aab2f-b931-4411-b2b8-a800308450fe", - "activityId" : "75044052-88c4-498b-90a1-67f95d6f1cf9", - "processId" : "3186d5b4-2d7e-4458-9a14-73fb52436788", - "packageId" : "cq37du", - "defProcessId" : "daily-78-20260815183015", - "defActivityId" : "activity_tr_0", - "activityName" : "申请", - "currentState" : "COMPLETED", - "title" : "车站北路时尚会馆保健师 蒋宴如-改签离职电子签流程", - "businessKey" : "bpme384c7939852415083c8a146190b9a61", - "participantId" : "d3383802-8b3f-4c55-a1bd-a3566cb93e55", - "participantName" : "张玲玲", - "participantType" : "CREATER", - "delegantUserId" : "", - "delegantName" : "", - "priority" : 1, - "remark" : "", - "isThrough" : "1", - "hasAttach" : "", - "createTime" : "2026-09-15 17:30:01", - "activatedTime" : null, - "acceptedTime" : "2026-09-15 17:30:01", - "endTime" : "2026-09-15 17:30:02", - "fromActivityId" : "", - "fromActivityName" : "", - "fromUserId" : "", - "fromUserName" : "", - "inUse" : "1", - "operator" : "d3383802-8b3f-4c55-a1bd-a3566cb93e55", - "operatTime" : "2026-09-15 17:31:18", - "char1" : "", - "char2" : "5d2ed621-7a9f-11ec-b449-000c296f9469", - "char3" : "", - "char4" : "", - "char5" : "{\"fromTaskId\":\"\"}", - "weTaskExt1" : "", - "weTaskExt2" : "", - "weTaskExt3" : "", - "num1" : 0, - "num2" : 0, - "isPredictTask" : null, - "contextMap" : { }, - "createYear" : null, - "startTime" : null, - "createUserName" : "", - "createUserId" : "", - "processName" : "", - "processState" : "", - "processTimeLimit" : null, - "activityTimeLimit" : null, - "weTaskExtendProp" : { - "fromTaskId" : "", - "showInApproveList" : null - }, - "overtime" : 0, - "weTaskExt4" : null, - "weTaskExt5" : null, - "weTaskExt6" : null, - "formId" : null, - "userPhoto" : null, - "applyUserPhoto" : null, - "createUserDept" : null, - "currentActivityName" : null, - "serialNumber" : null, - "businessactafter" : null, - "processChar2" : null, - "taskAction" : null, - "creatorDeptName" : null, - "creatorBelongUnitOrgName" : null, - "creatorOrgFullPath" : null, - "taskCommentList" : null, - "processEnd" : false - }, { - "participantSignature" : null, - "taskId" : "053e7837-fd3c-4263-b8ef-29a018b6961e", - "activityId" : "4062c7d9c74c4cf4b10440acd5223cb3", - "processId" : "3186d5b4-2d7e-4458-9a14-73fb52436788", - "packageId" : "cq37du", - "defProcessId" : "daily-78-20260815183015", - "defActivityId" : "activity_tr_4", - "activityName" : "完善信息(操作人)", - "currentState" : "OVERDUE", - "title" : "车站北路时尚会馆保健师 蒋宴如-改签离职电子签流程", - "businessKey" : "bpme384c7939852415083c8a146190b9a61", - "participantId" : "c29bd7c7-91eb-4c2e-bf14-96316e34d103", - "participantName" : "赵晓雪", - "participantType" : "ORG", - "delegantUserId" : "", - "delegantName" : "", - "priority" : 2, - "remark" : "", - "isThrough" : "", - "hasAttach" : "", - "createTime" : "2026-09-15 17:30:02", - "activatedTime" : null, - "acceptedTime" : null, - "endTime" : "2026-09-15 17:31:14", - "fromActivityId" : "75044052-88c4-498b-90a1-67f95d6f1cf9", - "fromActivityName" : "申请", - "fromUserId" : "d3383802-8b3f-4c55-a1bd-a3566cb93e55", - "fromUserName" : "张玲玲", - "inUse" : "1", - "operator" : "d3383802-8b3f-4c55-a1bd-a3566cb93e55", - "operatTime" : "2026-09-15 17:31:18", - "char1" : "0", - "char2" : "55ded105-4ff4-11f0-a0a5-000c296f9469", - "char3" : "", - "char4" : "", - "char5" : "{\"fromTaskId\":\"\"}", - "weTaskExt1" : "", - "weTaskExt2" : "", - "weTaskExt3" : "", - "num1" : 0, - "num2" : 0, - "isPredictTask" : null, - "contextMap" : { }, - "createYear" : null, - "startTime" : null, - "createUserName" : "", - "createUserId" : "", - "processName" : "", - "processState" : "", - "processTimeLimit" : null, - "activityTimeLimit" : null, - "weTaskExtendProp" : { - "fromTaskId" : "", - "showInApproveList" : null - }, - "overtime" : 0, - "weTaskExt4" : null, - "weTaskExt5" : "5d2ed621-7a9f-11ec-b449-000c296f9469", - "weTaskExt6" : null, - "formId" : null, - "userPhoto" : null, - "applyUserPhoto" : null, - "createUserDept" : null, - "currentActivityName" : null, - "serialNumber" : null, - "businessactafter" : null, - "processChar2" : null, - "taskAction" : null, - "creatorDeptName" : null, - "creatorBelongUnitOrgName" : null, - "creatorOrgFullPath" : null, - "taskCommentList" : null, - "processEnd" : false - }, { - "participantSignature" : null, - "taskId" : "1f02e48e-38e0-45b2-b43b-dd962f8b9d19", - "activityId" : "4062c7d9c74c4cf4b10440acd5223cb3", - "processId" : "3186d5b4-2d7e-4458-9a14-73fb52436788", - "packageId" : "cq37du", - "defProcessId" : "daily-78-20260815183015", - "defActivityId" : "activity_tr_4", - "activityName" : "完善信息(操作人)", - "currentState" : "OVERDUE", - "title" : "车站北路时尚会馆保健师 蒋宴如-改签离职电子签流程", - "businessKey" : "bpme384c7939852415083c8a146190b9a61", - "participantId" : "07b83185-6243-42bc-b79f-b81b4cffb471", - "participantName" : "人资测试专用", - "participantType" : "ORG", - "delegantUserId" : "", - "delegantName" : "", - "priority" : 2, - "remark" : "", - "isThrough" : "", - "hasAttach" : "", - "createTime" : "2026-09-15 17:30:02", - "activatedTime" : null, - "acceptedTime" : null, - "endTime" : "2026-09-15 17:31:14", - "fromActivityId" : "75044052-88c4-498b-90a1-67f95d6f1cf9", - "fromActivityName" : "申请", - "fromUserId" : "d3383802-8b3f-4c55-a1bd-a3566cb93e55", - "fromUserName" : "张玲玲", - "inUse" : "1", - "operator" : "d3383802-8b3f-4c55-a1bd-a3566cb93e55", - "operatTime" : "2026-09-15 17:31:18", - "char1" : "0", - "char2" : "04f38164-7135-4e34-adf2-492d7839a3d9", - "char3" : "", - "char4" : "", - "char5" : "{\"fromTaskId\":\"\"}", - "weTaskExt1" : "", - "weTaskExt2" : "", - "weTaskExt3" : "", - "num1" : 0, - "num2" : 0, - "isPredictTask" : null, - "contextMap" : { }, - "createYear" : null, - "startTime" : null, - "createUserName" : "", - "createUserId" : "", - "processName" : "", - "processState" : "", - "processTimeLimit" : null, - "activityTimeLimit" : null, - "weTaskExtendProp" : { - "fromTaskId" : "", - "showInApproveList" : null - }, - "overtime" : 0, - "weTaskExt4" : null, - "weTaskExt5" : "5d2ed621-7a9f-11ec-b449-000c296f9469", - "weTaskExt6" : null, - "formId" : null, - "userPhoto" : null, - "applyUserPhoto" : null, - "createUserDept" : null, - "currentActivityName" : null, - "serialNumber" : null, - "businessactafter" : null, - "processChar2" : null, - "taskAction" : null, - "creatorDeptName" : null, - "creatorBelongUnitOrgName" : null, - "creatorOrgFullPath" : null, - "taskCommentList" : null, - "processEnd" : false - }, { - "participantSignature" : null, - "taskId" : "257d14c5-fd1e-45b7-b88a-4db0901a476b", - "activityId" : "4062c7d9c74c4cf4b10440acd5223cb3", - "processId" : "3186d5b4-2d7e-4458-9a14-73fb52436788", - "packageId" : "cq37du", - "defProcessId" : "daily-78-20260815183015", - "defActivityId" : "activity_tr_4", - "activityName" : "完善信息(操作人)", - "currentState" : "OVERDUE", - "title" : "车站北路时尚会馆保健师 蒋宴如-改签离职电子签流程", - "businessKey" : "bpme384c7939852415083c8a146190b9a61", - "participantId" : "265ca696-9918-4e44-97f4-9b9362c26490", - "participantName" : "李泽燕", - "participantType" : "ORG", - "delegantUserId" : "", - "delegantName" : "", - "priority" : 2, - "remark" : "", - "isThrough" : "", - "hasAttach" : "", - "createTime" : "2026-09-15 17:30:02", - "activatedTime" : null, - "acceptedTime" : null, - "endTime" : "2026-09-15 17:31:14", - "fromActivityId" : "75044052-88c4-498b-90a1-67f95d6f1cf9", - "fromActivityName" : "申请", - "fromUserId" : "d3383802-8b3f-4c55-a1bd-a3566cb93e55", - "fromUserName" : "张玲玲", - "inUse" : "1", - "operator" : "d3383802-8b3f-4c55-a1bd-a3566cb93e55", - "operatTime" : "2026-09-15 17:31:18", - "char1" : "0", - "char2" : "4595b95e-7a9f-11ec-b449-000c296f9469", - "char3" : "", - "char4" : "", - "char5" : "{\"fromTaskId\":\"\"}", - "weTaskExt1" : "", - "weTaskExt2" : "", - "weTaskExt3" : "", - "num1" : 0, - "num2" : 0, - "isPredictTask" : null, - "contextMap" : { }, - "createYear" : null, - "startTime" : null, - "createUserName" : "", - "createUserId" : "", - "processName" : "", - "processState" : "", - "processTimeLimit" : null, - "activityTimeLimit" : null, - "weTaskExtendProp" : { - "fromTaskId" : "", - "showInApproveList" : null - }, - "overtime" : 0, - "weTaskExt4" : null, - "weTaskExt5" : "5d2ed621-7a9f-11ec-b449-000c296f9469", - "weTaskExt6" : null, - "formId" : null, - "userPhoto" : null, - "applyUserPhoto" : null, - "createUserDept" : null, - "currentActivityName" : null, - "serialNumber" : null, - "businessactafter" : null, - "processChar2" : null, - "taskAction" : null, - "creatorDeptName" : null, - "creatorBelongUnitOrgName" : null, - "creatorOrgFullPath" : null, - "taskCommentList" : null, - "processEnd" : false - }, { - "participantSignature" : null, - "taskId" : "2ffc5765-dc5c-4e23-b0b5-516247ea0a68", - "activityId" : "4062c7d9c74c4cf4b10440acd5223cb3", - "processId" : "3186d5b4-2d7e-4458-9a14-73fb52436788", - "packageId" : "cq37du", - "defProcessId" : "daily-78-20260815183015", - "defActivityId" : "activity_tr_4", - "activityName" : "完善信息(操作人)", - "currentState" : "OVERDUE", - "title" : "车站北路时尚会馆保健师 蒋宴如-改签离职电子签流程", - "businessKey" : "bpme384c7939852415083c8a146190b9a61", - "participantId" : "c572c9dc-df93-48f1-b75a-b5ea969db7d2", - "participantName" : "刘纤", - "participantType" : "ORG", - "delegantUserId" : "", - "delegantName" : "", - "priority" : 2, - "remark" : "", - "isThrough" : "", - "hasAttach" : "", - "createTime" : "2026-09-15 17:30:02", - "activatedTime" : null, - "acceptedTime" : null, - "endTime" : "2026-09-15 17:31:14", - "fromActivityId" : "75044052-88c4-498b-90a1-67f95d6f1cf9", - "fromActivityName" : "申请", - "fromUserId" : "d3383802-8b3f-4c55-a1bd-a3566cb93e55", - "fromUserName" : "张玲玲", - "inUse" : "1", - "operator" : "d3383802-8b3f-4c55-a1bd-a3566cb93e55", - "operatTime" : "2026-09-15 17:31:18", - "char1" : "0", - "char2" : "1c33e7ea-4a7e-11f0-a0a5-000c296f9469", - "char3" : "", - "char4" : "", - "char5" : "{\"fromTaskId\":\"\"}", - "weTaskExt1" : "", - "weTaskExt2" : "", - "weTaskExt3" : "", - "num1" : 0, - "num2" : 0, - "isPredictTask" : null, - "contextMap" : { }, - "createYear" : null, - "startTime" : null, - "createUserName" : "", - "createUserId" : "", - "processName" : "", - "processState" : "", - "processTimeLimit" : null, - "activityTimeLimit" : null, - "weTaskExtendProp" : { - "fromTaskId" : "", - "showInApproveList" : null - }, - "overtime" : 0, - "weTaskExt4" : null, - "weTaskExt5" : "5d2ed621-7a9f-11ec-b449-000c296f9469", - "weTaskExt6" : null, - "formId" : null, - "userPhoto" : null, - "applyUserPhoto" : null, - "createUserDept" : null, - "currentActivityName" : null, - "serialNumber" : null, - "businessactafter" : null, - "processChar2" : null, - "taskAction" : null, - "creatorDeptName" : null, - "creatorBelongUnitOrgName" : null, - "creatorOrgFullPath" : null, - "taskCommentList" : null, - "processEnd" : false - }, { - "participantSignature" : null, - "taskId" : "6638cc8a-0ab3-4758-959a-00b82e6d4825", - "activityId" : "4062c7d9c74c4cf4b10440acd5223cb3", - "processId" : "3186d5b4-2d7e-4458-9a14-73fb52436788", - "packageId" : "cq37du", - "defProcessId" : "daily-78-20260815183015", - "defActivityId" : "activity_tr_4", - "activityName" : "完善信息(操作人)", - "currentState" : "COMPLETED", - "title" : "车站北路时尚会馆保健师 蒋宴如-改签离职电子签流程", - "businessKey" : "bpme384c7939852415083c8a146190b9a61", - "participantId" : "fe0d7b33-7e26-4a78-ba81-b7211c1f914d", - "participantName" : "徐红丽", - "participantType" : "ORG", - "delegantUserId" : "", - "delegantName" : "", - "priority" : 2, - "remark" : "同意", - "isThrough" : "1", - "hasAttach" : "", - "createTime" : "2026-09-15 17:30:02", - "activatedTime" : null, - "acceptedTime" : "2026-09-15 17:31:05", - "endTime" : "2026-09-15 17:31:14", - "fromActivityId" : "75044052-88c4-498b-90a1-67f95d6f1cf9", - "fromActivityName" : "申请", - "fromUserId" : "d3383802-8b3f-4c55-a1bd-a3566cb93e55", - "fromUserName" : "张玲玲", - "inUse" : "1", - "operator" : "fe0d7b33-7e26-4a78-ba81-b7211c1f914d", - "operatTime" : "2026-09-15 17:31:18", - "char1" : "0", - "char2" : "6320d516-7a9f-11ec-b449-000c296f9469", - "char3" : "", - "char4" : "", - "char5" : "{\"fromTaskId\":\"\"}", - "weTaskExt1" : "", - "weTaskExt2" : "", - "weTaskExt3" : "", - "num1" : 0, - "num2" : 0, - "isPredictTask" : null, - "contextMap" : { }, - "createYear" : null, - "startTime" : null, - "createUserName" : "", - "createUserId" : "", - "processName" : "", - "processState" : "", - "processTimeLimit" : null, - "activityTimeLimit" : null, - "weTaskExtendProp" : { - "fromTaskId" : "", - "showInApproveList" : null - }, - "overtime" : 0, - "weTaskExt4" : null, - "weTaskExt5" : "5d2ed621-7a9f-11ec-b449-000c296f9469", - "weTaskExt6" : null, - "formId" : null, - "userPhoto" : null, - "applyUserPhoto" : null, - "createUserDept" : null, - "currentActivityName" : null, - "serialNumber" : null, - "businessactafter" : null, - "processChar2" : null, - "taskAction" : null, - "creatorDeptName" : null, - "creatorBelongUnitOrgName" : null, - "creatorOrgFullPath" : null, - "taskCommentList" : null, - "processEnd" : false - }, { - "participantSignature" : null, - "taskId" : "8faba0ee-b871-4eb3-94a8-dc293ce2e967", - "activityId" : "4062c7d9c74c4cf4b10440acd5223cb3", - "processId" : "3186d5b4-2d7e-4458-9a14-73fb52436788", - "packageId" : "cq37du", - "defProcessId" : "daily-78-20260815183015", - "defActivityId" : "activity_tr_4", - "activityName" : "完善信息(操作人)", - "currentState" : "OVERDUE", - "title" : "车站北路时尚会馆保健师 蒋宴如-改签离职电子签流程", - "businessKey" : "bpme384c7939852415083c8a146190b9a61", - "participantId" : "9d3971d1-b0d1-4b49-b8a5-fd2505ae2e13", - "participantName" : "周卫", - "participantType" : "ORG", - "delegantUserId" : "", - "delegantName" : "", - "priority" : 2, - "remark" : "", - "isThrough" : "", - "hasAttach" : "", - "createTime" : "2026-09-15 17:30:02", - "activatedTime" : null, - "acceptedTime" : null, - "endTime" : "2026-09-15 17:31:14", - "fromActivityId" : "75044052-88c4-498b-90a1-67f95d6f1cf9", - "fromActivityName" : "申请", - "fromUserId" : "d3383802-8b3f-4c55-a1bd-a3566cb93e55", - "fromUserName" : "张玲玲", - "inUse" : "1", - "operator" : "d3383802-8b3f-4c55-a1bd-a3566cb93e55", - "operatTime" : "2026-09-15 17:31:18", - "char1" : "0", - "char2" : "4bac6bf3-000f-11f1-a7d9-000c296f9469", - "char3" : "", - "char4" : "", - "char5" : "{\"fromTaskId\":\"\"}", - "weTaskExt1" : "", - "weTaskExt2" : "", - "weTaskExt3" : "", - "num1" : 0, - "num2" : 0, - "isPredictTask" : null, - "contextMap" : { }, - "createYear" : null, - "startTime" : null, - "createUserName" : "", - "createUserId" : "", - "processName" : "", - "processState" : "", - "processTimeLimit" : null, - "activityTimeLimit" : null, - "weTaskExtendProp" : { - "fromTaskId" : "", - "showInApproveList" : null - }, - "overtime" : 0, - "weTaskExt4" : null, - "weTaskExt5" : "5d2ed621-7a9f-11ec-b449-000c296f9469", - "weTaskExt6" : null, - "formId" : null, - "userPhoto" : null, - "applyUserPhoto" : null, - "createUserDept" : null, - "currentActivityName" : null, - "serialNumber" : null, - "businessactafter" : null, - "processChar2" : null, - "taskAction" : null, - "creatorDeptName" : null, - "creatorBelongUnitOrgName" : null, - "creatorOrgFullPath" : null, - "taskCommentList" : null, - "processEnd" : false - }, { - "participantSignature" : null, - "taskId" : "979143c8-0dbd-4b0f-a276-bdc87d1159d7", - "activityId" : "4062c7d9c74c4cf4b10440acd5223cb3", - "processId" : "3186d5b4-2d7e-4458-9a14-73fb52436788", - "packageId" : "cq37du", - "defProcessId" : "daily-78-20260815183015", - "defActivityId" : "activity_tr_4", - "activityName" : "完善信息(操作人)", - "currentState" : "OVERDUE", - "title" : "车站北路时尚会馆保健师 蒋宴如-改签离职电子签流程", - "businessKey" : "bpme384c7939852415083c8a146190b9a61", - "participantId" : "b28cea41-bce3-4fed-8383-4657ce1c115b", - "participantName" : "陈莲", - "participantType" : "ORG", - "delegantUserId" : "", - "delegantName" : "", - "priority" : 2, - "remark" : "", - "isThrough" : "", - "hasAttach" : "", - "createTime" : "2026-09-15 17:30:02", - "activatedTime" : null, - "acceptedTime" : null, - "endTime" : "2026-09-15 17:31:14", - "fromActivityId" : "75044052-88c4-498b-90a1-67f95d6f1cf9", - "fromActivityName" : "申请", - "fromUserId" : "d3383802-8b3f-4c55-a1bd-a3566cb93e55", - "fromUserName" : "张玲玲", - "inUse" : "1", - "operator" : "d3383802-8b3f-4c55-a1bd-a3566cb93e55", - "operatTime" : "2026-09-15 17:31:18", - "char1" : "0", - "char2" : "329868a3-4a7e-11f0-a0a5-000c296f9469", - "char3" : "", - "char4" : "", - "char5" : "{\"fromTaskId\":\"\"}", - "weTaskExt1" : "", - "weTaskExt2" : "", - "weTaskExt3" : "", - "num1" : 0, - "num2" : 0, - "isPredictTask" : null, - "contextMap" : { }, - "createYear" : null, - "startTime" : null, - "createUserName" : "", - "createUserId" : "", - "processName" : "", - "processState" : "", - "processTimeLimit" : null, - "activityTimeLimit" : null, - "weTaskExtendProp" : { - "fromTaskId" : "", - "showInApproveList" : null - }, - "overtime" : 0, - "weTaskExt4" : null, - "weTaskExt5" : "5d2ed621-7a9f-11ec-b449-000c296f9469", - "weTaskExt6" : null, - "formId" : null, - "userPhoto" : null, - "applyUserPhoto" : null, - "createUserDept" : null, - "currentActivityName" : null, - "serialNumber" : null, - "businessactafter" : null, - "processChar2" : null, - "taskAction" : null, - "creatorDeptName" : null, - "creatorBelongUnitOrgName" : null, - "creatorOrgFullPath" : null, - "taskCommentList" : null, - "processEnd" : false - }, { - "participantSignature" : null, - "taskId" : "98d7009d-2f94-482a-921d-310b3b212a16", - "activityId" : "4062c7d9c74c4cf4b10440acd5223cb3", - "processId" : "3186d5b4-2d7e-4458-9a14-73fb52436788", - "packageId" : "cq37du", - "defProcessId" : "daily-78-20260815183015", - "defActivityId" : "activity_tr_4", - "activityName" : "完善信息(操作人)", - "currentState" : "OVERDUE", - "title" : "车站北路时尚会馆保健师 蒋宴如-改签离职电子签流程", - "businessKey" : "bpme384c7939852415083c8a146190b9a61", - "participantId" : "a0db50a0-8fa5-11ec-b449-000c296f9469", - "participantName" : "杨芸", - "participantType" : "ORG", - "delegantUserId" : "", - "delegantName" : "", - "priority" : 2, - "remark" : "", - "isThrough" : "", - "hasAttach" : "", - "createTime" : "2026-09-15 17:30:02", - "activatedTime" : null, - "acceptedTime" : null, - "endTime" : "2026-09-15 17:31:14", - "fromActivityId" : "75044052-88c4-498b-90a1-67f95d6f1cf9", - "fromActivityName" : "申请", - "fromUserId" : "d3383802-8b3f-4c55-a1bd-a3566cb93e55", - "fromUserName" : "张玲玲", - "inUse" : "1", - "operator" : "d3383802-8b3f-4c55-a1bd-a3566cb93e55", - "operatTime" : "2026-09-15 17:31:18", - "char1" : "0", - "char2" : "a0d9dc12-8fa5-11ec-b449-000c296f9469", - "char3" : "", - "char4" : "", - "char5" : "{\"fromTaskId\":\"\"}", - "weTaskExt1" : "", - "weTaskExt2" : "", - "weTaskExt3" : "", - "num1" : 0, - "num2" : 0, - "isPredictTask" : null, - "contextMap" : { }, - "createYear" : null, - "startTime" : null, - "createUserName" : "", - "createUserId" : "", - "processName" : "", - "processState" : "", - "processTimeLimit" : null, - "activityTimeLimit" : null, - "weTaskExtendProp" : { - "fromTaskId" : "", - "showInApproveList" : null - }, - "overtime" : 0, - "weTaskExt4" : null, - "weTaskExt5" : "5d2ed621-7a9f-11ec-b449-000c296f9469", - "weTaskExt6" : null, - "formId" : null, - "userPhoto" : null, - "applyUserPhoto" : null, - "createUserDept" : null, - "currentActivityName" : null, - "serialNumber" : null, - "businessactafter" : null, - "processChar2" : null, - "taskAction" : null, - "creatorDeptName" : null, - "creatorBelongUnitOrgName" : null, - "creatorOrgFullPath" : null, - "taskCommentList" : null, - "processEnd" : false - }, { - "participantSignature" : null, - "taskId" : "aa25ceca-2397-41e2-b75e-88222a125300", - "activityId" : "4062c7d9c74c4cf4b10440acd5223cb3", - "processId" : "3186d5b4-2d7e-4458-9a14-73fb52436788", - "packageId" : "cq37du", - "defProcessId" : "daily-78-20260815183015", - "defActivityId" : "activity_tr_4", - "activityName" : "完善信息(操作人)", - "currentState" : "OVERDUE", - "title" : "车站北路时尚会馆保健师 蒋宴如-改签离职电子签流程", - "businessKey" : "bpme384c7939852415083c8a146190b9a61", - "participantId" : "f751a008-6cac-4943-be09-b260ada56c95", - "participantName" : "陈杰", - "participantType" : "ORG", - "delegantUserId" : "", - "delegantName" : "", - "priority" : 2, - "remark" : "", - "isThrough" : "", - "hasAttach" : "", - "createTime" : "2026-09-15 17:30:02", - "activatedTime" : null, - "acceptedTime" : null, - "endTime" : "2026-09-15 17:31:14", - "fromActivityId" : "75044052-88c4-498b-90a1-67f95d6f1cf9", - "fromActivityName" : "申请", - "fromUserId" : "d3383802-8b3f-4c55-a1bd-a3566cb93e55", - "fromUserName" : "张玲玲", - "inUse" : "1", - "operator" : "d3383802-8b3f-4c55-a1bd-a3566cb93e55", - "operatTime" : "2026-09-15 17:31:18", - "char1" : "0", - "char2" : "6266ee53-7a9f-11ec-b449-000c296f9469", - "char3" : "", - "char4" : "", - "char5" : "{\"fromTaskId\":\"\"}", - "weTaskExt1" : "", - "weTaskExt2" : "", - "weTaskExt3" : "", - "num1" : 0, - "num2" : 0, - "isPredictTask" : null, - "contextMap" : { }, - "createYear" : null, - "startTime" : null, - "createUserName" : "", - "createUserId" : "", - "processName" : "", - "processState" : "", - "processTimeLimit" : null, - "activityTimeLimit" : null, - "weTaskExtendProp" : { - "fromTaskId" : "", - "showInApproveList" : null - }, - "overtime" : 0, - "weTaskExt4" : null, - "weTaskExt5" : "5d2ed621-7a9f-11ec-b449-000c296f9469", - "weTaskExt6" : null, - "formId" : null, - "userPhoto" : null, - "applyUserPhoto" : null, - "createUserDept" : null, - "currentActivityName" : null, - "serialNumber" : null, - "businessactafter" : null, - "processChar2" : null, - "taskAction" : null, - "creatorDeptName" : null, - "creatorBelongUnitOrgName" : null, - "creatorOrgFullPath" : null, - "taskCommentList" : null, - "processEnd" : false - }, { - "participantSignature" : null, - "taskId" : "c4c41054-b42a-4d47-b2ec-b60d467c0139", - "activityId" : "4062c7d9c74c4cf4b10440acd5223cb3", - "processId" : "3186d5b4-2d7e-4458-9a14-73fb52436788", - "packageId" : "cq37du", - "defProcessId" : "daily-78-20260815183015", - "defActivityId" : "activity_tr_4", - "activityName" : "完善信息(操作人)", - "currentState" : "OVERDUE", - "title" : "车站北路时尚会馆保健师 蒋宴如-改签离职电子签流程", - "businessKey" : "bpme384c7939852415083c8a146190b9a61", - "participantId" : "178b0efa-8a65-11f1-a7d9-000c296f9469", - "participantName" : "人资专用号", - "participantType" : "ORG", - "delegantUserId" : "", - "delegantName" : "", - "priority" : 2, - "remark" : "", - "isThrough" : "", - "hasAttach" : "", - "createTime" : "2026-09-15 17:30:02", - "activatedTime" : null, - "acceptedTime" : null, - "endTime" : "2026-09-15 17:31:14", - "fromActivityId" : "75044052-88c4-498b-90a1-67f95d6f1cf9", - "fromActivityName" : "申请", - "fromUserId" : "d3383802-8b3f-4c55-a1bd-a3566cb93e55", - "fromUserName" : "张玲玲", - "inUse" : "1", - "operator" : "d3383802-8b3f-4c55-a1bd-a3566cb93e55", - "operatTime" : "2026-09-15 17:31:18", - "char1" : "0", - "char2" : "246fcc74-a5e3-11f1-a7d9-000c296f9469", - "char3" : "", - "char4" : "", - "char5" : "{\"fromTaskId\":\"\"}", - "weTaskExt1" : "", - "weTaskExt2" : "", - "weTaskExt3" : "", - "num1" : 0, - "num2" : 0, - "isPredictTask" : null, - "contextMap" : { }, - "createYear" : null, - "startTime" : null, - "createUserName" : "", - "createUserId" : "", - "processName" : "", - "processState" : "", - "processTimeLimit" : null, - "activityTimeLimit" : null, - "weTaskExtendProp" : { - "fromTaskId" : "", - "showInApproveList" : null - }, - "overtime" : 0, - "weTaskExt4" : null, - "weTaskExt5" : "5d2ed621-7a9f-11ec-b449-000c296f9469", - "weTaskExt6" : null, - "formId" : null, - "userPhoto" : null, - "applyUserPhoto" : null, - "createUserDept" : null, - "currentActivityName" : null, - "serialNumber" : null, - "businessactafter" : null, - "processChar2" : null, - "taskAction" : null, - "creatorDeptName" : null, - "creatorBelongUnitOrgName" : null, - "creatorOrgFullPath" : null, - "taskCommentList" : null, - "processEnd" : false - }, { - "participantSignature" : null, - "taskId" : "f8370c79-2aa5-4f83-a6e7-30cc06e705a1", - "activityId" : "4062c7d9c74c4cf4b10440acd5223cb3", - "processId" : "3186d5b4-2d7e-4458-9a14-73fb52436788", - "packageId" : "cq37du", - "defProcessId" : "daily-78-20260815183015", - "defActivityId" : "activity_tr_4", - "activityName" : "完善信息(操作人)", - "currentState" : "OVERDUE", - "title" : "车站北路时尚会馆保健师 蒋宴如-改签离职电子签流程", - "businessKey" : "bpme384c7939852415083c8a146190b9a61", - "participantId" : "d3383802-8b3f-4c55-a1bd-a3566cb93e55", - "participantName" : "张玲玲", - "participantType" : "ORG", - "delegantUserId" : "", - "delegantName" : "", - "priority" : 2, - "remark" : "", - "isThrough" : "", - "hasAttach" : "", - "createTime" : "2026-09-15 17:30:02", - "activatedTime" : null, - "acceptedTime" : null, - "endTime" : "2026-09-15 17:31:14", - "fromActivityId" : "75044052-88c4-498b-90a1-67f95d6f1cf9", - "fromActivityName" : "申请", - "fromUserId" : "d3383802-8b3f-4c55-a1bd-a3566cb93e55", - "fromUserName" : "张玲玲", - "inUse" : "1", - "operator" : "d3383802-8b3f-4c55-a1bd-a3566cb93e55", - "operatTime" : "2026-09-15 17:31:18", - "char1" : "0", - "char2" : "5d2ed621-7a9f-11ec-b449-000c296f9469", - "char3" : "", - "char4" : "", - "char5" : "{\"fromTaskId\":\"\"}", - "weTaskExt1" : "", - "weTaskExt2" : "", - "weTaskExt3" : "", - "num1" : 0, - "num2" : 0, - "isPredictTask" : null, - "contextMap" : { }, - "createYear" : null, - "startTime" : null, - "createUserName" : "", - "createUserId" : "", - "processName" : "", - "processState" : "", - "processTimeLimit" : null, - "activityTimeLimit" : null, - "weTaskExtendProp" : { - "fromTaskId" : "", - "showInApproveList" : null - }, - "overtime" : 0, - "weTaskExt4" : null, - "weTaskExt5" : "5d2ed621-7a9f-11ec-b449-000c296f9469", - "weTaskExt6" : null, - "formId" : null, - "userPhoto" : null, - "applyUserPhoto" : null, - "createUserDept" : null, - "currentActivityName" : null, - "serialNumber" : null, - "businessactafter" : null, - "processChar2" : null, - "taskAction" : null, - "creatorDeptName" : null, - "creatorBelongUnitOrgName" : null, - "creatorOrgFullPath" : null, - "taskCommentList" : null, - "processEnd" : false - }, { - "participantSignature" : null, - "taskId" : "0333ece4-d21c-42b3-9030-b0a2ac51b2b5", - "activityId" : "e9c8b420d1ac486abe4818c84fed53b4", - "processId" : "3186d5b4-2d7e-4458-9a14-73fb52436788", - "packageId" : "cq37du", - "defProcessId" : "daily-78-20260815183015", - "defActivityId" : "activity_tr_1", - "activityName" : "离职电子签办理", - "currentState" : "WAITING", - "title" : "车站北路时尚会馆保健师 蒋宴如-改签离职电子签流程", - "businessKey" : "bpme384c7939852415083c8a146190b9a61", - "participantId" : "c29bd7c7-91eb-4c2e-bf14-96316e34d103", - "participantName" : "赵晓雪", - "participantType" : "ORG", - "delegantUserId" : "", - "delegantName" : "", - "priority" : 3, - "remark" : "", - "isThrough" : "", - "hasAttach" : "", - "createTime" : "2026-09-15 17:31:14", - "activatedTime" : null, - "acceptedTime" : null, - "endTime" : null, - "fromActivityId" : "4062c7d9c74c4cf4b10440acd5223cb3", - "fromActivityName" : "完善信息(操作人)", - "fromUserId" : "fe0d7b33-7e26-4a78-ba81-b7211c1f914d", - "fromUserName" : "徐红丽", - "inUse" : "1", - "operator" : "fe0d7b33-7e26-4a78-ba81-b7211c1f914d", - "operatTime" : "2026-09-15 17:31:18", - "char1" : "0", - "char2" : "5af4f340-7a9f-11ec-b449-000c296f9469", - "char3" : "", - "char4" : "", - "char5" : "{\"fromTaskId\":\"\"}", - "weTaskExt1" : "", - "weTaskExt2" : "", - "weTaskExt3" : "", - "num1" : 0, - "num2" : 0, - "isPredictTask" : null, - "contextMap" : { }, - "createYear" : null, - "startTime" : null, - "createUserName" : "", - "createUserId" : "", - "processName" : "", - "processState" : "", - "processTimeLimit" : null, - "activityTimeLimit" : null, - "weTaskExtendProp" : { - "fromTaskId" : "", - "showInApproveList" : null - }, - "overtime" : 0, - "weTaskExt4" : null, - "weTaskExt5" : "6320d516-7a9f-11ec-b449-000c296f9469", - "weTaskExt6" : null, - "formId" : null, - "userPhoto" : null, - "applyUserPhoto" : null, - "createUserDept" : null, - "currentActivityName" : null, - "serialNumber" : null, - "businessactafter" : null, - "processChar2" : null, - "taskAction" : null, - "creatorDeptName" : null, - "creatorBelongUnitOrgName" : null, - "creatorOrgFullPath" : null, - "taskCommentList" : null, - "processEnd" : false - }, { - "participantSignature" : null, - "taskId" : "045a4076-b4d5-4345-b24b-6e153ed2d764", - "activityId" : "e9c8b420d1ac486abe4818c84fed53b4", - "processId" : "3186d5b4-2d7e-4458-9a14-73fb52436788", - "packageId" : "cq37du", - "defProcessId" : "daily-78-20260815183015", - "defActivityId" : "activity_tr_1", - "activityName" : "离职电子签办理", - "currentState" : "WAITING", - "title" : "车站北路时尚会馆保健师 蒋宴如-改签离职电子签流程", - "businessKey" : "bpme384c7939852415083c8a146190b9a61", - "participantId" : "c572c9dc-df93-48f1-b75a-b5ea969db7d2", - "participantName" : "刘纤", - "participantType" : "ORG", - "delegantUserId" : "", - "delegantName" : "", - "priority" : 3, - "remark" : "", - "isThrough" : "", - "hasAttach" : "", - "createTime" : "2026-09-15 17:31:14", - "activatedTime" : null, - "acceptedTime" : null, - "endTime" : null, - "fromActivityId" : "4062c7d9c74c4cf4b10440acd5223cb3", - "fromActivityName" : "完善信息(操作人)", - "fromUserId" : "fe0d7b33-7e26-4a78-ba81-b7211c1f914d", - "fromUserName" : "徐红丽", - "inUse" : "1", - "operator" : "fe0d7b33-7e26-4a78-ba81-b7211c1f914d", - "operatTime" : "2026-09-15 17:31:18", - "char1" : "0", - "char2" : "5b834b6a-7a9f-11ec-b449-000c296f9469", - "char3" : "", - "char4" : "", - "char5" : "{\"fromTaskId\":\"\"}", - "weTaskExt1" : "", - "weTaskExt2" : "", - "weTaskExt3" : "", - "num1" : 0, - "num2" : 0, - "isPredictTask" : null, - "contextMap" : { }, - "createYear" : null, - "startTime" : null, - "createUserName" : "", - "createUserId" : "", - "processName" : "", - "processState" : "", - "processTimeLimit" : null, - "activityTimeLimit" : null, - "weTaskExtendProp" : { - "fromTaskId" : "", - "showInApproveList" : null - }, - "overtime" : 0, - "weTaskExt4" : null, - "weTaskExt5" : "6320d516-7a9f-11ec-b449-000c296f9469", - "weTaskExt6" : null, - "formId" : null, - "userPhoto" : null, - "applyUserPhoto" : null, - "createUserDept" : null, - "currentActivityName" : null, - "serialNumber" : null, - "businessactafter" : null, - "processChar2" : null, - "taskAction" : null, - "creatorDeptName" : null, - "creatorBelongUnitOrgName" : null, - "creatorOrgFullPath" : null, - "taskCommentList" : null, - "processEnd" : false - }, { - "participantSignature" : null, - "taskId" : "53e79394-ee47-4e12-a9c4-d74ad6337507", - "activityId" : "e9c8b420d1ac486abe4818c84fed53b4", - "processId" : "3186d5b4-2d7e-4458-9a14-73fb52436788", - "packageId" : "cq37du", - "defProcessId" : "daily-78-20260815183015", - "defActivityId" : "activity_tr_1", - "activityName" : "离职电子签办理", - "currentState" : "WAITING", - "title" : "车站北路时尚会馆保健师 蒋宴如-改签离职电子签流程", - "businessKey" : "bpme384c7939852415083c8a146190b9a61", - "participantId" : "a0db50a0-8fa5-11ec-b449-000c296f9469", - "participantName" : "杨芸", - "participantType" : "ORG", - "delegantUserId" : "", - "delegantName" : "", - "priority" : 3, - "remark" : "", - "isThrough" : "", - "hasAttach" : "", - "createTime" : "2026-09-15 17:31:14", - "activatedTime" : null, - "acceptedTime" : null, - "endTime" : null, - "fromActivityId" : "4062c7d9c74c4cf4b10440acd5223cb3", - "fromActivityName" : "完善信息(操作人)", - "fromUserId" : "fe0d7b33-7e26-4a78-ba81-b7211c1f914d", - "fromUserName" : "徐红丽", - "inUse" : "1", - "operator" : "fe0d7b33-7e26-4a78-ba81-b7211c1f914d", - "operatTime" : "2026-09-15 17:31:18", - "char1" : "0", - "char2" : "a0d9dc12-8fa5-11ec-b449-000c296f9469", - "char3" : "", - "char4" : "", - "char5" : "{\"fromTaskId\":\"\"}", - "weTaskExt1" : "", - "weTaskExt2" : "", - "weTaskExt3" : "", - "num1" : 0, - "num2" : 0, - "isPredictTask" : null, - "contextMap" : { }, - "createYear" : null, - "startTime" : null, - "createUserName" : "", - "createUserId" : "", - "processName" : "", - "processState" : "", - "processTimeLimit" : null, - "activityTimeLimit" : null, - "weTaskExtendProp" : { - "fromTaskId" : "", - "showInApproveList" : null - }, - "overtime" : 0, - "weTaskExt4" : null, - "weTaskExt5" : "6320d516-7a9f-11ec-b449-000c296f9469", - "weTaskExt6" : null, - "formId" : null, - "userPhoto" : null, - "applyUserPhoto" : null, - "createUserDept" : null, - "currentActivityName" : null, - "serialNumber" : null, - "businessactafter" : null, - "processChar2" : null, - "taskAction" : null, - "creatorDeptName" : null, - "creatorBelongUnitOrgName" : null, - "creatorOrgFullPath" : null, - "taskCommentList" : null, - "processEnd" : false - }, { - "participantSignature" : null, - "taskId" : "57563642-3d78-490b-9e43-04e0c8f5d508", - "activityId" : "e9c8b420d1ac486abe4818c84fed53b4", - "processId" : "3186d5b4-2d7e-4458-9a14-73fb52436788", - "packageId" : "cq37du", - "defProcessId" : "daily-78-20260815183015", - "defActivityId" : "activity_tr_1", - "activityName" : "离职电子签办理", - "currentState" : "ACCEPTED", - "title" : "车站北路时尚会馆保健师 蒋宴如-改签离职电子签流程", - "businessKey" : "bpme384c7939852415083c8a146190b9a61", - "participantId" : "178b0efa-8a65-11f1-a7d9-000c296f9469", - "participantName" : "人资专用号", - "participantType" : "HUMAN", - "delegantUserId" : "", - "delegantName" : "", - "priority" : 3, - "remark" : "", - "isThrough" : "", - "hasAttach" : "", - "createTime" : "2026-09-15 17:31:14", - "activatedTime" : null, - "acceptedTime" : "2026-09-15 22:04:04", - "endTime" : null, - "fromActivityId" : "4062c7d9c74c4cf4b10440acd5223cb3", - "fromActivityName" : "完善信息(操作人)", - "fromUserId" : "fe0d7b33-7e26-4a78-ba81-b7211c1f914d", - "fromUserName" : "徐红丽", - "inUse" : "1", - "operator" : "fe0d7b33-7e26-4a78-ba81-b7211c1f914d", - "operatTime" : "2026-09-15 17:31:18", - "char1" : "0", - "char2" : "17867121-8a65-11f1-a7d9-000c296f9469", - "char3" : "", - "char4" : "", - "char5" : "{\"fromTaskId\":\"\"}", - "weTaskExt1" : "", - "weTaskExt2" : "", - "weTaskExt3" : "", - "num1" : 0, - "num2" : 0, - "isPredictTask" : null, - "contextMap" : { }, - "createYear" : null, - "startTime" : null, - "createUserName" : "", - "createUserId" : "", - "processName" : "", - "processState" : "", - "processTimeLimit" : null, - "activityTimeLimit" : null, - "weTaskExtendProp" : { - "fromTaskId" : "", - "showInApproveList" : null - }, - "overtime" : 0, - "weTaskExt4" : null, - "weTaskExt5" : "6320d516-7a9f-11ec-b449-000c296f9469", - "weTaskExt6" : null, - "formId" : null, - "userPhoto" : null, - "applyUserPhoto" : null, - "createUserDept" : null, - "currentActivityName" : null, - "serialNumber" : null, - "businessactafter" : null, - "processChar2" : null, - "taskAction" : null, - "creatorDeptName" : null, - "creatorBelongUnitOrgName" : null, - "creatorOrgFullPath" : null, - "taskCommentList" : null, - "processEnd" : false - }, { - "participantSignature" : null, - "taskId" : "688fcbdb-aada-4521-8bc7-e950eebf5be1", - "activityId" : "e9c8b420d1ac486abe4818c84fed53b4", - "processId" : "3186d5b4-2d7e-4458-9a14-73fb52436788", - "packageId" : "cq37du", - "defProcessId" : "daily-78-20260815183015", - "defActivityId" : "activity_tr_1", - "activityName" : "离职电子签办理", - "currentState" : "ACCEPTED", - "title" : "车站北路时尚会馆保健师 蒋宴如-改签离职电子签流程", - "businessKey" : "bpme384c7939852415083c8a146190b9a61", - "participantId" : "fe0d7b33-7e26-4a78-ba81-b7211c1f914d", - "participantName" : "徐红丽", - "participantType" : "ORG", - "delegantUserId" : "", - "delegantName" : "", - "priority" : 3, - "remark" : "", - "isThrough" : "", - "hasAttach" : "", - "createTime" : "2026-09-15 17:31:14", - "activatedTime" : null, - "acceptedTime" : "2026-09-15 17:31:24", - "endTime" : null, - "fromActivityId" : "4062c7d9c74c4cf4b10440acd5223cb3", - "fromActivityName" : "完善信息(操作人)", - "fromUserId" : "fe0d7b33-7e26-4a78-ba81-b7211c1f914d", - "fromUserName" : "徐红丽", - "inUse" : "1", - "operator" : "fe0d7b33-7e26-4a78-ba81-b7211c1f914d", - "operatTime" : "2026-09-15 17:31:18", - "char1" : "0", - "char2" : "6320d516-7a9f-11ec-b449-000c296f9469", - "char3" : "", - "char4" : "", - "char5" : "{\"fromTaskId\":\"\"}", - "weTaskExt1" : "", - "weTaskExt2" : "", - "weTaskExt3" : "", - "num1" : 0, - "num2" : 0, - "isPredictTask" : null, - "contextMap" : { }, - "createYear" : null, - "startTime" : null, - "createUserName" : "", - "createUserId" : "", - "processName" : "", - "processState" : "", - "processTimeLimit" : null, - "activityTimeLimit" : null, - "weTaskExtendProp" : { - "fromTaskId" : "", - "showInApproveList" : null - }, - "overtime" : 0, - "weTaskExt4" : null, - "weTaskExt5" : "6320d516-7a9f-11ec-b449-000c296f9469", - "weTaskExt6" : null, - "formId" : null, - "userPhoto" : null, - "applyUserPhoto" : null, - "createUserDept" : null, - "currentActivityName" : null, - "serialNumber" : null, - "businessactafter" : null, - "processChar2" : null, - "taskAction" : null, - "creatorDeptName" : null, - "creatorBelongUnitOrgName" : null, - "creatorOrgFullPath" : null, - "taskCommentList" : null, - "processEnd" : false - }, { - "participantSignature" : null, - "taskId" : "8a355fa3-c368-4292-b48b-cb777373e490", - "activityId" : "e9c8b420d1ac486abe4818c84fed53b4", - "processId" : "3186d5b4-2d7e-4458-9a14-73fb52436788", - "packageId" : "cq37du", - "defProcessId" : "daily-78-20260815183015", - "defActivityId" : "activity_tr_1", - "activityName" : "离职电子签办理", - "currentState" : "WAITING", - "title" : "车站北路时尚会馆保健师 蒋宴如-改签离职电子签流程", - "businessKey" : "bpme384c7939852415083c8a146190b9a61", - "participantId" : "d3383802-8b3f-4c55-a1bd-a3566cb93e55", - "participantName" : "张玲玲", - "participantType" : "ORG", - "delegantUserId" : "", - "delegantName" : "", - "priority" : 3, - "remark" : "", - "isThrough" : "", - "hasAttach" : "", - "createTime" : "2026-09-15 17:31:14", - "activatedTime" : null, - "acceptedTime" : null, - "endTime" : null, - "fromActivityId" : "4062c7d9c74c4cf4b10440acd5223cb3", - "fromActivityName" : "完善信息(操作人)", - "fromUserId" : "fe0d7b33-7e26-4a78-ba81-b7211c1f914d", - "fromUserName" : "徐红丽", - "inUse" : "1", - "operator" : "fe0d7b33-7e26-4a78-ba81-b7211c1f914d", - "operatTime" : "2026-09-15 17:31:18", - "char1" : "0", - "char2" : "5d2ed621-7a9f-11ec-b449-000c296f9469", - "char3" : "", - "char4" : "", - "char5" : "{\"fromTaskId\":\"\"}", - "weTaskExt1" : "", - "weTaskExt2" : "", - "weTaskExt3" : "", - "num1" : 0, - "num2" : 0, - "isPredictTask" : null, - "contextMap" : { }, - "createYear" : null, - "startTime" : null, - "createUserName" : "", - "createUserId" : "", - "processName" : "", - "processState" : "", - "processTimeLimit" : null, - "activityTimeLimit" : null, - "weTaskExtendProp" : { - "fromTaskId" : "", - "showInApproveList" : null - }, - "overtime" : 0, - "weTaskExt4" : null, - "weTaskExt5" : "6320d516-7a9f-11ec-b449-000c296f9469", - "weTaskExt6" : null, - "formId" : null, - "userPhoto" : null, - "applyUserPhoto" : null, - "createUserDept" : null, - "currentActivityName" : null, - "serialNumber" : null, - "businessactafter" : null, - "processChar2" : null, - "taskAction" : null, - "creatorDeptName" : null, - "creatorBelongUnitOrgName" : null, - "creatorOrgFullPath" : null, - "taskCommentList" : null, - "processEnd" : false - }, { - "participantSignature" : null, - "taskId" : "9dc28a25-44ac-4dd8-a011-80eb35fdadf6", - "activityId" : "e9c8b420d1ac486abe4818c84fed53b4", - "processId" : "3186d5b4-2d7e-4458-9a14-73fb52436788", - "packageId" : "cq37du", - "defProcessId" : "daily-78-20260815183015", - "defActivityId" : "activity_tr_1", - "activityName" : "离职电子签办理", - "currentState" : "WAITING", - "title" : "车站北路时尚会馆保健师 蒋宴如-改签离职电子签流程", - "businessKey" : "bpme384c7939852415083c8a146190b9a61", - "participantId" : "b28cea41-bce3-4fed-8383-4657ce1c115b", - "participantName" : "陈莲", - "participantType" : "ORG", - "delegantUserId" : "", - "delegantName" : "", - "priority" : 3, - "remark" : "", - "isThrough" : "", - "hasAttach" : "", - "createTime" : "2026-09-15 17:31:14", - "activatedTime" : null, - "acceptedTime" : null, - "endTime" : null, - "fromActivityId" : "4062c7d9c74c4cf4b10440acd5223cb3", - "fromActivityName" : "完善信息(操作人)", - "fromUserId" : "fe0d7b33-7e26-4a78-ba81-b7211c1f914d", - "fromUserName" : "徐红丽", - "inUse" : "1", - "operator" : "fe0d7b33-7e26-4a78-ba81-b7211c1f914d", - "operatTime" : "2026-09-15 17:31:18", - "char1" : "0", - "char2" : "589d1c66-7a9f-11ec-b449-000c296f9469", - "char3" : "", - "char4" : "", - "char5" : "{\"fromTaskId\":\"\"}", - "weTaskExt1" : "", - "weTaskExt2" : "", - "weTaskExt3" : "", - "num1" : 0, - "num2" : 0, - "isPredictTask" : null, - "contextMap" : { }, - "createYear" : null, - "startTime" : null, - "createUserName" : "", - "createUserId" : "", - "processName" : "", - "processState" : "", - "processTimeLimit" : null, - "activityTimeLimit" : null, - "weTaskExtendProp" : { - "fromTaskId" : "", - "showInApproveList" : null - }, - "overtime" : 0, - "weTaskExt4" : null, - "weTaskExt5" : "6320d516-7a9f-11ec-b449-000c296f9469", - "weTaskExt6" : null, - "formId" : null, - "userPhoto" : null, - "applyUserPhoto" : null, - "createUserDept" : null, - "currentActivityName" : null, - "serialNumber" : null, - "businessactafter" : null, - "processChar2" : null, - "taskAction" : null, - "creatorDeptName" : null, - "creatorBelongUnitOrgName" : null, - "creatorOrgFullPath" : null, - "taskCommentList" : null, - "processEnd" : false - }, { - "participantSignature" : null, - "taskId" : "9e0aabd9-720c-4825-a2a8-8b046637d0f1", - "activityId" : "e9c8b420d1ac486abe4818c84fed53b4", - "processId" : "3186d5b4-2d7e-4458-9a14-73fb52436788", - "packageId" : "cq37du", - "defProcessId" : "daily-78-20260815183015", - "defActivityId" : "activity_tr_1", - "activityName" : "离职电子签办理", - "currentState" : "WAITING", - "title" : "车站北路时尚会馆保健师 蒋宴如-改签离职电子签流程", - "businessKey" : "bpme384c7939852415083c8a146190b9a61", - "participantId" : "f751a008-6cac-4943-be09-b260ada56c95", - "participantName" : "陈杰", - "participantType" : "ORG", - "delegantUserId" : "", - "delegantName" : "", - "priority" : 3, - "remark" : "", - "isThrough" : "", - "hasAttach" : "", - "createTime" : "2026-09-15 17:31:14", - "activatedTime" : null, - "acceptedTime" : null, - "endTime" : null, - "fromActivityId" : "4062c7d9c74c4cf4b10440acd5223cb3", - "fromActivityName" : "完善信息(操作人)", - "fromUserId" : "fe0d7b33-7e26-4a78-ba81-b7211c1f914d", - "fromUserName" : "徐红丽", - "inUse" : "1", - "operator" : "fe0d7b33-7e26-4a78-ba81-b7211c1f914d", - "operatTime" : "2026-09-15 17:31:18", - "char1" : "0", - "char2" : "6266ee53-7a9f-11ec-b449-000c296f9469", - "char3" : "", - "char4" : "", - "char5" : "{\"fromTaskId\":\"\"}", - "weTaskExt1" : "", - "weTaskExt2" : "", - "weTaskExt3" : "", - "num1" : 0, - "num2" : 0, - "isPredictTask" : null, - "contextMap" : { }, - "createYear" : null, - "startTime" : null, - "createUserName" : "", - "createUserId" : "", - "processName" : "", - "processState" : "", - "processTimeLimit" : null, - "activityTimeLimit" : null, - "weTaskExtendProp" : { - "fromTaskId" : "", - "showInApproveList" : null - }, - "overtime" : 0, - "weTaskExt4" : null, - "weTaskExt5" : "6320d516-7a9f-11ec-b449-000c296f9469", - "weTaskExt6" : null, - "formId" : null, - "userPhoto" : null, - "applyUserPhoto" : null, - "createUserDept" : null, - "currentActivityName" : null, - "serialNumber" : null, - "businessactafter" : null, - "processChar2" : null, - "taskAction" : null, - "creatorDeptName" : null, - "creatorBelongUnitOrgName" : null, - "creatorOrgFullPath" : null, - "taskCommentList" : null, - "processEnd" : false - }, { - "participantSignature" : null, - "taskId" : "a7594f6e-b8f1-45d4-a0d5-fbb5e1e7c4b7", - "activityId" : "e9c8b420d1ac486abe4818c84fed53b4", - "processId" : "3186d5b4-2d7e-4458-9a14-73fb52436788", - "packageId" : "cq37du", - "defProcessId" : "daily-78-20260815183015", - "defActivityId" : "activity_tr_1", - "activityName" : "离职电子签办理", - "currentState" : "WAITING", - "title" : "车站北路时尚会馆保健师 蒋宴如-改签离职电子签流程", - "businessKey" : "bpme384c7939852415083c8a146190b9a61", - "participantId" : "265ca696-9918-4e44-97f4-9b9362c26490", - "participantName" : "李泽燕", - "participantType" : "ORG", - "delegantUserId" : "", - "delegantName" : "", - "priority" : 3, - "remark" : "", - "isThrough" : "", - "hasAttach" : "", - "createTime" : "2026-09-15 17:31:14", - "activatedTime" : null, - "acceptedTime" : null, - "endTime" : null, - "fromActivityId" : "4062c7d9c74c4cf4b10440acd5223cb3", - "fromActivityName" : "完善信息(操作人)", - "fromUserId" : "fe0d7b33-7e26-4a78-ba81-b7211c1f914d", - "fromUserName" : "徐红丽", - "inUse" : "1", - "operator" : "fe0d7b33-7e26-4a78-ba81-b7211c1f914d", - "operatTime" : "2026-09-15 17:31:18", - "char1" : "0", - "char2" : "4595b95e-7a9f-11ec-b449-000c296f9469", - "char3" : "", - "char4" : "", - "char5" : "{\"fromTaskId\":\"\"}", - "weTaskExt1" : "", - "weTaskExt2" : "", - "weTaskExt3" : "", - "num1" : 0, - "num2" : 0, - "isPredictTask" : null, - "contextMap" : { }, - "createYear" : null, - "startTime" : null, - "createUserName" : "", - "createUserId" : "", - "processName" : "", - "processState" : "", - "processTimeLimit" : null, - "activityTimeLimit" : null, - "weTaskExtendProp" : { - "fromTaskId" : "", - "showInApproveList" : null - }, - "overtime" : 0, - "weTaskExt4" : null, - "weTaskExt5" : "6320d516-7a9f-11ec-b449-000c296f9469", - "weTaskExt6" : null, - "formId" : null, - "userPhoto" : null, - "applyUserPhoto" : null, - "createUserDept" : null, - "currentActivityName" : null, - "serialNumber" : null, - "businessactafter" : null, - "processChar2" : null, - "taskAction" : null, - "creatorDeptName" : null, - "creatorBelongUnitOrgName" : null, - "creatorOrgFullPath" : null, - "taskCommentList" : null, - "processEnd" : false - }, { - "participantSignature" : null, - "taskId" : "cd25a032-d98b-4c3e-9922-cbbcadafe1f7", - "activityId" : "e9c8b420d1ac486abe4818c84fed53b4", - "processId" : "3186d5b4-2d7e-4458-9a14-73fb52436788", - "packageId" : "cq37du", - "defProcessId" : "daily-78-20260815183015", - "defActivityId" : "activity_tr_1", - "activityName" : "离职电子签办理", - "currentState" : "WAITING", - "title" : "车站北路时尚会馆保健师 蒋宴如-改签离职电子签流程", - "businessKey" : "bpme384c7939852415083c8a146190b9a61", - "participantId" : "07b83185-6243-42bc-b79f-b81b4cffb471", - "participantName" : "人资测试专用", - "participantType" : "ORG", - "delegantUserId" : "", - "delegantName" : "", - "priority" : 3, - "remark" : "", - "isThrough" : "", - "hasAttach" : "", - "createTime" : "2026-09-15 17:31:14", - "activatedTime" : null, - "acceptedTime" : null, - "endTime" : null, - "fromActivityId" : "4062c7d9c74c4cf4b10440acd5223cb3", - "fromActivityName" : "完善信息(操作人)", - "fromUserId" : "fe0d7b33-7e26-4a78-ba81-b7211c1f914d", - "fromUserName" : "徐红丽", - "inUse" : "1", - "operator" : "fe0d7b33-7e26-4a78-ba81-b7211c1f914d", - "operatTime" : "2026-09-15 17:31:18", - "char1" : "0", - "char2" : "04f38164-7135-4e34-adf2-492d7839a3d9", - "char3" : "", - "char4" : "", - "char5" : "{\"fromTaskId\":\"\"}", - "weTaskExt1" : "", - "weTaskExt2" : "", - "weTaskExt3" : "", - "num1" : 0, - "num2" : 0, - "isPredictTask" : null, - "contextMap" : { }, - "createYear" : null, - "startTime" : null, - "createUserName" : "", - "createUserId" : "", - "processName" : "", - "processState" : "", - "processTimeLimit" : null, - "activityTimeLimit" : null, - "weTaskExtendProp" : { - "fromTaskId" : "", - "showInApproveList" : null - }, - "overtime" : 0, - "weTaskExt4" : null, - "weTaskExt5" : "6320d516-7a9f-11ec-b449-000c296f9469", - "weTaskExt6" : null, - "formId" : null, - "userPhoto" : null, - "applyUserPhoto" : null, - "createUserDept" : null, - "currentActivityName" : null, - "serialNumber" : null, - "businessactafter" : null, - "processChar2" : null, - "taskAction" : null, - "creatorDeptName" : null, - "creatorBelongUnitOrgName" : null, - "creatorOrgFullPath" : null, - "taskCommentList" : null, - "processEnd" : false - }, { - "participantSignature" : null, - "taskId" : "f327ebfd-30d5-4f0e-9bce-185daccc72a3", - "activityId" : "e9c8b420d1ac486abe4818c84fed53b4", - "processId" : "3186d5b4-2d7e-4458-9a14-73fb52436788", - "packageId" : "cq37du", - "defProcessId" : "daily-78-20260815183015", - "defActivityId" : "activity_tr_1", - "activityName" : "离职电子签办理", - "currentState" : "WAITING", - "title" : "车站北路时尚会馆保健师 蒋宴如-改签离职电子签流程", - "businessKey" : "bpme384c7939852415083c8a146190b9a61", - "participantId" : "9d3971d1-b0d1-4b49-b8a5-fd2505ae2e13", - "participantName" : "周卫", - "participantType" : "ORG", - "delegantUserId" : "", - "delegantName" : "", - "priority" : 3, - "remark" : "", - "isThrough" : "", - "hasAttach" : "", - "createTime" : "2026-09-15 17:31:14", - "activatedTime" : null, - "acceptedTime" : null, - "endTime" : null, - "fromActivityId" : "4062c7d9c74c4cf4b10440acd5223cb3", - "fromActivityName" : "完善信息(操作人)", - "fromUserId" : "fe0d7b33-7e26-4a78-ba81-b7211c1f914d", - "fromUserName" : "徐红丽", - "inUse" : "1", - "operator" : "fe0d7b33-7e26-4a78-ba81-b7211c1f914d", - "operatTime" : "2026-09-15 17:31:18", - "char1" : "0", - "char2" : "5583dba1-7a9f-11ec-b449-000c296f9469", - "char3" : "", - "char4" : "", - "char5" : "{\"fromTaskId\":\"\"}", - "weTaskExt1" : "", - "weTaskExt2" : "", - "weTaskExt3" : "", - "num1" : 0, - "num2" : 0, - "isPredictTask" : null, - "contextMap" : { }, - "createYear" : null, - "startTime" : null, - "createUserName" : "", - "createUserId" : "", - "processName" : "", - "processState" : "", - "processTimeLimit" : null, - "activityTimeLimit" : null, - "weTaskExtendProp" : { - "fromTaskId" : "", - "showInApproveList" : null - }, - "overtime" : 0, - "weTaskExt4" : null, - "weTaskExt5" : "6320d516-7a9f-11ec-b449-000c296f9469", - "weTaskExt6" : null, - "formId" : null, - "userPhoto" : null, - "applyUserPhoto" : null, - "createUserDept" : null, - "currentActivityName" : null, - "serialNumber" : null, - "businessactafter" : null, - "processChar2" : null, - "taskAction" : null, - "creatorDeptName" : null, - "creatorBelongUnitOrgName" : null, - "creatorOrgFullPath" : null, - "taskCommentList" : null, - "processEnd" : false - } ], - "viewMapper" : null, - "record" : false -} \ No newline at end of file +
+31号插件要更新一下,仓库编码切换一下位置,先点击条件,点击新增行, +
select0101010101
+输入仓库编码,输入实际仓库编码,选择或者 +和之前的类似,然后在回到快捷,设置日期,组织等等 +
\ No newline at end of file diff --git a/desktop/controlplane/apis/auth.py b/desktop/controlplane/apis/auth.py index 310d5e6..88d4c90 100644 --- a/desktop/controlplane/apis/auth.py +++ b/desktop/controlplane/apis/auth.py @@ -132,7 +132,7 @@ def admin_password(p: schemas.PwdIn, # ==================== 员工端登录 /auth/exchange(v3 最简方案,壳本机直连接 code) ==================== # 壳 login 云端的唯一接口:壳把浏览器带回的钉钉 code POST 到此,用 AppSecret 换身份 → 只验证不建号 # → 签发云端会话 token(供壳调 /api/plugins 鉴权,见 apis/plugins §2.2)。token 存储统一在 -# core.auth._cloud_tokens(_issue_cloud_token 签发、_cloud_account 解析),此处不再重复声明。 +# core.auth(_issue_cloud_token 签发落库 cloud_tokens 表、_cloud_account 解析),此处不再重复声明。 @router.post("/auth/exchange") diff --git a/desktop/controlplane/apis/plugins.py b/desktop/controlplane/apis/plugins.py index af2826a..7fe72ea 100644 --- a/desktop/controlplane/apis/plugins.py +++ b/desktop/controlplane/apis/plugins.py @@ -146,8 +146,9 @@ def me_control_list(x_api_token: str = Header(default="", alias="X-API-Token")) return {"ticket": crypto._sign_blob(payload), "control": payload} -# 一次性下载票据(内存态,兑换后失效) -_DL_TICKETS: dict = {} +# 一次性下载票据落库(download_tickets 表):gunicorn 多 worker 下签发与兑换必须共享同一份状态, +# 否则 A worker 签发的票据落到 B/C/D worker 兑换会 404「票据无效」,3/4 概率下载失败(同云令牌坑)。 +_DL_TICKET_TTL = 3600 # 票据有效期(秒):签发后 1 小时未兑换即清理 @router.get("/api/plugins/{plugin_id}/versions/{version}/download-ticket") @@ -172,10 +173,16 @@ def download_ticket(plugin_id: str, version: str, path = config.PKG_DIR / ver["filename"] if not path.exists(): raise HTTPException(404, f"包文件缺失:{ver['filename']}") - # 票据内含可下载文件名与校验值;用一次性 nonce 存内存,兑换后失效 + # 票据内含可下载文件名与校验值;落库共享,兑换时原子置 used=1 作废 nonce = secrets.token_hex(16) - _DL_TICKETS[nonce] = {"filename": ver["filename"], "sha256": ver["sha256"] or "", - "used": False} + with _db() as conn: + # 顺手清理过期票据,防表无限增长 + conn.execute( + "DELETE FROM download_tickets WHERE created_at < DATE_SUB(NOW(), INTERVAL %d SECOND)" + % int(_DL_TICKET_TTL)) + conn.execute( + "INSERT INTO download_tickets(nonce, filename, sha256, used) VALUES (%s, %s, %s, 0)", + (nonce, ver["filename"], ver["sha256"] or "")) url = f"/api/download/{nonce}" return {"ticket": nonce, "url": url, "filename": ver["filename"], "sha256": ver["sha256"] or "", "expiresAt": _now()} @@ -185,15 +192,19 @@ def download_ticket(plugin_id: str, version: str, def download(ticket: str, x_api_token: str = Header(default="", alias="X-API-Token")): """兑换下载票据:一次性有效,兑换即作废并写审计。""" _check_token(x_api_token) - item = _DL_TICKETS.get(ticket) - if not item or item["used"]: + with _db() as conn: + # 原子占位:仅 used=0 才能改成 1,命中行数=0 说明票据不存在或已被兑换 + cur = conn.execute( + "UPDATE download_tickets SET used = 1 WHERE nonce = %s AND used = 0", (ticket,)) + row = conn.execute( + "SELECT filename FROM download_tickets WHERE nonce = %s", (ticket,)).fetchone() + if not cur.rowcount or not row: raise HTTPException(404, "下载票据无效或已使用") - item["used"] = True - path = config.PKG_DIR / item["filename"] + path = config.PKG_DIR / row["filename"] if not path.exists(): - raise HTTPException(404, f"包文件缺失:{item['filename']}") - _audit("", "download-ticket", item["filename"]) - return FileResponse(path, filename=item["filename"], media_type="application/octet-stream") + raise HTTPException(404, f"包文件缺失:{row['filename']}") + _audit("", "download-ticket", row["filename"]) + return FileResponse(path, filename=row["filename"], media_type="application/octet-stream") @router.post("/api/runtime/report") diff --git a/desktop/controlplane/core/auth.py b/desktop/controlplane/core/auth.py index 4d9618e..13cace4 100644 --- a/desktop/controlplane/core/auth.py +++ b/desktop/controlplane/core/auth.py @@ -14,8 +14,8 @@ import hashlib import hmac import json import secrets -import threading import time +from datetime import datetime, timedelta from fastapi import HTTPException @@ -116,8 +116,8 @@ def _auth_fail(account: str) -> None: # ==================== 云端会话 token(员工端扫码登录,§2.2) ==================== _CLOUD_TOKEN_TTL = 7 * 24 * 3600 # 云端会话 token 有效期(秒,7 天) -_cloud_tokens: dict = {} # token -> {exp, account, nickname};壳持此调云端 API -_cloud_lock = threading.Lock() +# 云令牌落库(cloud_tokens 表)而非进程内存:gunicorn 多 worker 下登录签发的令牌 +# 必须能被任意 worker 解出,否则 Bearer 身份解析只有 1/N 概率命中。 def _auth_account_lookup(account: str) -> dict: @@ -134,32 +134,38 @@ def _auth_account_lookup(account: str) -> dict: def _cloud_account(bearer: str) -> str: - """从 Bearer 云端会话 token 解出工号(§2.2);无效/过期/缺失返回空串。""" + """从 Bearer 云端会话 token 解出工号(§2.2);无效/过期/缺失返回空串。 + + 查 cloud_tokens 表(落库共享):签发与解析不再受 worker 进程限制。 + 库不可用时返回空串(身份解析失败不抛异常,交由各路由的兜底逻辑处理)。 + """ token = (bearer or "").strip() if token.lower().startswith("bearer "): token = token[7:].strip() if not token: return "" - now = time.time() - with _cloud_lock: - rec = _cloud_tokens.get(token) - if rec and rec["exp"] >= now: - return rec["account"] - if rec: # 过期顺手清理,防内存无限增长 - _cloud_tokens.pop(token, None) - return "" + try: + with _db() as conn: + row = conn.execute( + "SELECT account FROM cloud_tokens WHERE token = %s AND expires_at > NOW()", + (token,)).fetchone() + except Exception: # noqa: BLE001 库异常按“无身份”处理,不阻断请求 + return "" + return str(row["account"]) if row else "" def _issue_cloud_token(account: str, nickname: str) -> str: - """签发云端会话 token 并写入共享存储(与 _cloud_account 同源,供 apis/auth /auth/exchange 调用)。 + """签发云端会话 token 并落库(与 _cloud_account 同源,供 apis/auth /auth/exchange 调用)。 - 之前 apis/auth 里另建了一份同名 dict,写读不通导致 Bearer 永远解不出账号;这里统一出口。 + 之前用进程内存 dict,gunicorn 多 worker 下写读不通导致 Bearer 随机解不出账号;改为落库。 """ token = secrets.token_urlsafe(32) - now = time.time() - with _cloud_lock: - for k in [k for k, v in _cloud_tokens.items() if v["exp"] < now]: - _cloud_tokens.pop(k, None) - _cloud_tokens[token] = {"exp": now + _CLOUD_TOKEN_TTL, "account": account, - "nickname": nickname} + expires = datetime.now() + timedelta(seconds=_CLOUD_TOKEN_TTL) + with _db() as conn: + # 顺手清理已过期令牌,防表无限增长 + conn.execute("DELETE FROM cloud_tokens WHERE expires_at < NOW()") + conn.execute( + "INSERT INTO cloud_tokens(token, account, nickname, expires_at) VALUES (%s, %s, %s, %s)", + (token, account, nickname, expires.strftime("%Y-%m-%d %H:%M:%S"))) + conn.commit() return token \ No newline at end of file diff --git a/desktop/controlplane/core/db.py b/desktop/controlplane/core/db.py index 85fb597..eeaca44 100644 --- a/desktop/controlplane/core/db.py +++ b/desktop/controlplane/core/db.py @@ -21,7 +21,7 @@ from controlplane.core.crypto import _hash_password # 初始迁移版本:全量 DDL 建齐后登记;后续增量 DDL 在此追加新版本并配套迁移逻辑 _SCHEMA_VERSION = "20260917_001" -# 全量 DDL(11 张表,MySQL 5.7 兼容;与 tools/schema_mysql.sql 逐条一致) +# 全量 DDL(13 张表,MySQL 5.7 兼容;与 tools/schema_mysql.sql 逐条一致) _DDL_TABLES = ( """ CREATE TABLE IF NOT EXISTS schema_migrations ( @@ -204,6 +204,28 @@ _DDL_TABLES = ( KEY idx_category (category) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='大文件源(内网直链,走内网文件服务器)' """, + """ + CREATE TABLE IF NOT EXISTS cloud_tokens ( + token VARCHAR(64) NOT NULL COMMENT '云端会话令牌(secrets.token_urlsafe(32))', + account VARCHAR(64) NOT NULL COMMENT '所属账号(工号)', + nickname VARCHAR(64) NOT NULL DEFAULT '' COMMENT '昵称快照(登录时冗余,省一次查库)', + expires_at DATETIME NOT NULL COMMENT '过期时间(签发时间 + 7 天)', + created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '签发时间', + PRIMARY KEY (token), + KEY idx_expires (expires_at) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='云端会话令牌(落库共享,多 worker 通用)' + """, + """ + CREATE TABLE IF NOT EXISTS download_tickets ( + nonce VARCHAR(32) NOT NULL COMMENT '一次性下载票据(secrets.token_hex(16))', + filename VARCHAR(255) NOT NULL COMMENT '插件包文件名(packages/ 下)', + sha256 CHAR(64) NOT NULL DEFAULT '' COMMENT '安装包 sha256 校验值', + used TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否已兑换:1=是 0=否(兑换即作废)', + created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '签发时间', + PRIMARY KEY (nonce), + KEY idx_created (created_at) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='一次性插件下载票据(落库共享,多 worker 通用)' + """, ) diff --git a/desktop/controlplane/tools/schema_mysql.sql b/desktop/controlplane/tools/schema_mysql.sql index fc87996..4635f9e 100644 --- a/desktop/controlplane/tools/schema_mysql.sql +++ b/desktop/controlplane/tools/schema_mysql.sql @@ -215,3 +215,29 @@ CREATE TABLE IF NOT EXISTS file_sources ( PRIMARY KEY (id), KEY idx_category (category) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='大文件源(内网直链,走内网文件服务器)'; + +-- ------------------------------------------------------------ +-- 云端会话令牌:落库共享(gunicorn 多 worker 下 Bearer 身份解析通用) +-- ------------------------------------------------------------ +CREATE TABLE IF NOT EXISTS cloud_tokens ( + token VARCHAR(64) NOT NULL COMMENT '云端会话令牌(secrets.token_urlsafe(32))', + account VARCHAR(64) NOT NULL COMMENT '所属账号(工号)', + nickname VARCHAR(64) NOT NULL DEFAULT '' COMMENT '昵称快照(登录时冗余,省一次查库)', + expires_at DATETIME NOT NULL COMMENT '过期时间(签发时间 + 7 天)', + created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '签发时间', + PRIMARY KEY (token), + KEY idx_expires (expires_at) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='云端会话令牌(落库共享,多 worker 通用)'; + +-- ------------------------------------------------------------ +-- 一次性插件下载票据:落库共享,多 worker 通用(进程内存版在 4 worker 下 3/4 概率查不到票据) +-- ------------------------------------------------------------ +CREATE TABLE IF NOT EXISTS download_tickets ( + nonce VARCHAR(32) NOT NULL COMMENT '一次性下载票据(secrets.token_hex(16))', + filename VARCHAR(255) NOT NULL COMMENT '插件包文件名(packages/ 下)', + sha256 CHAR(64) NOT NULL DEFAULT '' COMMENT '安装包 sha256 校验值', + used TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否已兑换:1=是 0=否(兑换即作废)', + created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '签发时间', + PRIMARY KEY (nonce), + KEY idx_created (created_at) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='一次性插件下载票据(落库共享,多 worker 通用)'; diff --git a/desktop/webhost/backend/apis/runs.py b/desktop/webhost/backend/apis/runs.py index c3169a0..e51e356 100644 --- a/desktop/webhost/backend/apis/runs.py +++ b/desktop/webhost/backend/apis/runs.py @@ -13,7 +13,7 @@ from fastapi import APIRouter, HTTPException, Request, WebSocket from webhost.backend import licensing from webhost.backend import scheduler as _scheduler from webhost.backend import state as _st -from webhost.backend.core.runner import RunReq, _run_target +from webhost.backend.core.runner import RunReq, _run_target, terminate_run from webhost.backend.core.hub import HUB from webhost.backend.plugins import PLUGINS from webhost.backend.core.session import _require_login, _sess_account @@ -94,6 +94,21 @@ def get_run(run_id: str, request: Request) -> dict: return run +@router.post("/api/runs/{run_id}/stop") +def stop_run(run_id: str, request: Request) -> dict: + """手动强制停止指定运行:仅运行属主可操作,整树强杀执行子进程(含浏览器)。""" + account = _require_login(request) + with _st.RUN_LOCK: + run = _st.RUNS.get(run_id) + if not run or run.get("account") != account: + raise HTTPException(404, "运行不存在") + if run.get("status") != "running": + raise HTTPException(409, "运行已结束,无需停止") + if not terminate_run(run_id): + raise HTTPException(409, "任务尚未真正启动(排队中或刚结束),请稍候再试") + return {"ok": True} + + @router.websocket("/ws") async def ws(websocket: WebSocket): if not _sess_account(websocket): # WS 握手需有效统一账户会话 diff --git a/desktop/webhost/backend/core/chrome_manager.py b/desktop/webhost/backend/core/chrome_manager.py index 5f30ba7..5ceb5ba 100644 --- a/desktop/webhost/backend/core/chrome_manager.py +++ b/desktop/webhost/backend/core/chrome_manager.py @@ -116,9 +116,10 @@ def _read_version(exe: Path) -> str: import subprocess as _sp try: out2 = _sp.run( - ["powershell", "-NoProfile", "-Command", + ["powershell", "-NoProfile", "-NonInteractive", "-Command", "(Get-Item -LiteralPath '%s').VersionInfo.ProductVersion" % exe], - capture_output=True, text=True, timeout=5) + capture_output=True, text=True, timeout=5, + creationflags=getattr(_sp, "CREATE_NO_WINDOW", 0)) # 不弹 PowerShell 窗口 v = (out2.stdout or "").strip() return v if _VERSION_RE.match(v) else "" except Exception: # noqa: BLE001 diff --git a/desktop/webhost/backend/core/licensing.py b/desktop/webhost/backend/core/licensing.py index e732f95..2733d00 100644 --- a/desktop/webhost/backend/core/licensing.py +++ b/desktop/webhost/backend/core/licensing.py @@ -145,13 +145,16 @@ def license_status() -> tuple[str, dict | None]: def ensure_license(account: str) -> tuple[bool, dict | None]: - """确保本地授权票据可用:ok → (True, payload);否则联网刷新一次后复查。 + """确保本地授权票据可用且属于当前账号:ok → (True, payload);否则联网刷新一次后复查。 + 票据必须与登录账号一致:票据只按 expiresAt 判过期,换账号登录后旧票仍在有效期内, + 沿用旧票会让「个人中心可见插件」与「运行门禁」停留在上一账号的授权快照 + (表现为换账号后显示"暂无可用插件"),故账号不匹配一律视为不可用并强制刷新。 刷新失败(离线/控制面不可达)→ (False, None)。这是「可见性/运行/平台登录」的统一授权门禁, 过期且实际在线时会自动刷新恢复(用户无感),离线则拒绝并提示联网刷新。 """ status, payload = license_status() - if status == "ok": + if status == "ok" and (payload or {}).get("userId") == account: return True, payload try: from webhost.backend.core.cpapi import _sync_licensing # 延迟导入,避免模块环 @@ -159,7 +162,7 @@ def ensure_license(account: str) -> tuple[bool, dict | None]: except Exception as _exc: # noqa: BLE001 联网刷新失败(离线/控制面不可达) _LOGGER.warning("授权票据联网刷新失败(离线或控制面不可达):%s", _exc) status, payload = license_status() - return (status == "ok"), payload + return (status == "ok" and (payload or {}).get("userId") == account), payload # ==================== 缓存写读 ==================== @@ -285,11 +288,17 @@ def _push_report(rec: dict) -> bool: def _push_via_tempfile(rec: dict) -> None: - """向 /api/runtime/report 的同步 POST(requests)。""" + """向 /api/runtime/report 的同步 POST(requests)。 + 必须带 X-API-Token 内部凭证:中心机 CONTROLPLANE_TOKEN 非空时该接口强制校验, + 无头 POST 一律 401(此前运行上报全部静默失败落离线暂存、补报同样无头永远补不上), + 与 cpapi.py 各接口的头注入保持一致。""" import requests + from webhost.backend.core import config + + headers = {"X-API-Token": config.CONTROLPLANE_TOKEN} if config.CONTROLPLANE_TOKEN else {} r = requests.post(f"{_CONTROLPLANE_URL}/api/runtime/report", - json=rec, timeout=5) + json=rec, headers=headers, timeout=5) r.raise_for_status() diff --git a/desktop/webhost/backend/core/meta.py b/desktop/webhost/backend/core/meta.py index 7f964db..3753fb7 100644 --- a/desktop/webhost/backend/core/meta.py +++ b/desktop/webhost/backend/core/meta.py @@ -32,7 +32,9 @@ def _plugin_schema(p) -> dict: fields = p.fields caps = (manifest or {}).get("capabilities") or p.capabilities perms = (manifest or {}).get("permissions") or p.permissions - return {"id": p.id, "name": name, "version": p.version, + return {"id": p.id, "name": name, + # 版本优先取 plugin.json 的 version(与发布包一致),缺 manifest 时回退类的默认值 + "version": (manifest or {}).get("version") or p.version, "description": description, "uses_month": getattr(p, "uses_month", False), "ui": bool((manifest or {}).get("ui")), "capabilities": caps, "permissions": perms, "fields": fields} diff --git a/desktop/webhost/backend/core/plugin_runner.py b/desktop/webhost/backend/core/plugin_runner.py index 60522e7..e291bda 100644 --- a/desktop/webhost/backend/core/plugin_runner.py +++ b/desktop/webhost/backend/core/plugin_runner.py @@ -35,10 +35,12 @@ except OSError: def _emit(obj: dict) -> None: - """写一行 JSON 到协议通道(原始 stdout)。插件 print 已改道 stderr,不污染协议。""" + """写一行 JSON 到协议通道(原始 stdout.buffer,显式 UTF-8 字节)。 + 插件 print 已改道 stderr,不污染协议;不走文本层是避免 Windows GBK 环境下 + stdout 按 locale 编码导致中文变 mojibake(父进程按 UTF-8 解码会对不上)。""" try: - _PROTO.write(json.dumps(obj, ensure_ascii=False) + "\n") - _PROTO.flush() + _PROTO.buffer.write((json.dumps(obj, ensure_ascii=False) + "\n").encode("utf-8")) + _PROTO.buffer.flush() except Exception: # noqa: BLE001 通道已关则静默 pass @@ -65,12 +67,14 @@ def _run() -> int: if "--allowed" in sys.argv else "") allowed = {s for s in allowed_arg.split(",") if s} if allowed_arg else None - # fields 经 stdin 传入(单行 JSON) + # fields 经 stdin 传入(单行 JSON,UTF-8 字节):显式走 buffer 按 UTF-8 解, + # 不依赖 sys.stdin 的 locale 解码(Windows GBK 环境下中文会被解出乱码/孤立代理字符, + # 导致 fields 值与插件内字符串常量比对失败,如「未知执行模式」) fields: dict = {} try: - _line = sys.stdin.readline().strip() - if _line: - fields = json.loads(_line) or {} + _raw = sys.stdin.buffer.readline().strip() + if _raw: + fields = json.loads(_raw) or {} except Exception as _e: # noqa: BLE001 fields = {} diff --git a/desktop/webhost/backend/core/runner.py b/desktop/webhost/backend/core/runner.py index 7cc36cc..08aee96 100644 --- a/desktop/webhost/backend/core/runner.py +++ b/desktop/webhost/backend/core/runner.py @@ -32,6 +32,34 @@ class RunReq(BaseModel): fields: dict = {} +# ==================== 手动强制停止 ==================== +# run_id → 执行中 Job 句柄(供 POST /api/runs/{id}/stop 整树强杀,含浏览器孙进程) +_ACTIVE: dict = {} +_ACTIVE_LOCK = threading.Lock() +_USER_STOPPED: set = set() +_STOP_LOCK = threading.Lock() + + +def terminate_run(run_id: str) -> bool: + """手动终止运行:登记停止标记并整树强杀 Job。返回是否已找到并触发终止。""" + with _ACTIVE_LOCK: + job = _ACTIVE.get(run_id) + with _STOP_LOCK: + _USER_STOPPED.add(run_id) + if job is None: + return False # 尚未真正拉起执行子进程(排队中)或已结束 + try: + job.terminate() + except Exception: + pass + return True + + +def _is_user_stopped(run_id: str) -> bool: + with _STOP_LOCK: + return run_id in _USER_STOPPED + + def _run_target(plugin, fields: dict, run_id: str) -> None: """进程级隔离执行插件:拉起独立 python 子进程,stdout JSON 事件转发 /ws,超时强杀。 @@ -55,14 +83,24 @@ def _run_target(plugin, fields: dict, run_id: str) -> None: # Windows Job Object:整树托管(含浏览器孙进程),超时整树强杀 + 内存上限兜底 job = _winjob.Job(max_mem_mb=max_mem_mb) + # 子进程 stdio 编码统一 UTF-8:默认跟随 Windows locale(GBK) 会导致 + # stderr 中文 traceback 变 mojibake、stdin JSON 中文解出孤立代理字符 + _child_env = dict(os.environ) + _child_env["PYTHONIOENCODING"] = "utf-8" + _child_env["PYTHONUTF8"] = "1" try: proc = subprocess.Popen( cmd, cwd=str(root), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, encoding="utf-8", - errors="replace", + errors="replace", env=_child_env, + # 抑制宿主进程的控制台窗口(runner.exe 为 console 子系统), + # 同时 stdout/stderr 走 PIPE 捕获不受影响 + creationflags=getattr(subprocess, "CREATE_NO_WINDOW", 0), ) job.assign(proc) + with _ACTIVE_LOCK: + _ACTIVE[run_id] = job # 登记句柄,供手动强制停止整树强杀 except Exception as e: # noqa: BLE001 子进程拉起失败 job.close() _st._set_run(run_id, status="error", result=None, error=f"拉起执行子进程失败: {e}") @@ -134,6 +172,10 @@ def _run_target(plugin, fields: dict, run_id: str) -> None: result=ev.get("result"), error=ev.get("error")) HUB.publish({"t": "run_done", "run_id": run_id, "ok": ok, "error": ev.get("error")}) + elif _is_user_stopped(run_id): + msg = "用户手动强制停止" + _st._set_run(run_id, status="error", result=None, error=msg) + HUB.publish({"t": "run_done", "run_id": run_id, "ok": False, "error": msg}) elif timed_out: msg = f"插件执行超时({timeout}s)已强制终止" _st._set_run(run_id, status="error", result=None, error=msg) @@ -143,6 +185,8 @@ def _run_target(plugin, fields: dict, run_id: str) -> None: _st._set_run(run_id, status="error", result=None, error=msg) HUB.publish({"t": "run_done", "run_id": run_id, "ok": False, "error": msg}) finally: + with _ACTIVE_LOCK: + _ACTIVE.pop(run_id, None) _scheduler.mark_done(plugin.id, run_id) # 单活槽位回空闲并唤醒排队请求 _report_run(plugin.id, run_id) # 运行上报(联网实时/离线暂存补报) job.close() # KILL_ON_JOB_CLOSE 兜底清理残留子进程 diff --git a/desktop/webhost/frontend/src/App.vue b/desktop/webhost/frontend/src/App.vue index 32d7cd4..4b090e3 100644 --- a/desktop/webhost/frontend/src/App.vue +++ b/desktop/webhost/frontend/src/App.vue @@ -383,9 +383,18 @@ async function onShellDownload() { if (downloading.value) return downloading.value = true shellDismissed.value = false + // 点击即进入"下载中"反馈(不等轮询):内网直连下载很快,若靠 15s 轮询拉状态, + // 进度条可能还没显示就已经下载完,用户会以为点了没反应 + const v = shellUpdate.value.latest || '' + shellUpdate.value = { ...shellUpdate.value, + dl: { status: 'downloading', version: v, received: 0, total: 0, pct: 0, error: '' } } + lastDlStatus = 'downloading' // 兜底:即使立即下载完成,也能触发"已就绪"一次性提示 try { await downloadShellUpdate() // 后端后台流式下载,进度经轮询展示 + try { shellUpdate.value = await getShellStatus() } catch (_) {} // 抢拉真实进度,避免卡在 0% } catch (e) { + shellUpdate.value = { ...shellUpdate.value, + dl: { status: 'failed', version: v, received: 0, total: 0, pct: 0, error: (e.message || e) } } ElMessage.error('开始下载失败:' + (e.message || e)) } downloading.value = false diff --git a/desktop/webhost/tools/install.iss b/desktop/webhost/tools/install.iss index 7c2076a..47507e7 100644 --- a/desktop/webhost/tools/install.iss +++ b/desktop/webhost/tools/install.iss @@ -1,11 +1,11 @@ -; 37du 自动化工作台 - Inno Setup 安装脚本 (Inno Setup 7) +; 37du 自动化工作台 - Inno Setup 安装脚本 (Inno Setup 7) ; 编译: "C:\Program Files\Inno Setup 7\ISCC.exe" webhost\tools\install.iss ; 打包内容: 主程序 37du-host.exe + 插件执行壳 37du-host-runner.exe + .env 默认配置 ; .env 与 webhost/.env 同源(控制面/平台共享配置):仅首次安装写入(onlyifdoesntexist), ; 升级不覆盖机器已有 .env;不含 37du-host-console.exe(调试版)、plugins/(登录后自下载) #define MyAppName "37du 自动化工作台" -#define MyAppVersion "1.1.3" +#define MyAppVersion "1.1.7" #define MyAppExeName "37du-host.exe" [Setup] diff --git a/desktop/webhost/tools/shell.version b/desktop/webhost/tools/shell.version index 781dcb0..91a821f 100644 --- a/desktop/webhost/tools/shell.version +++ b/desktop/webhost/tools/shell.version @@ -1 +1 @@ -1.1.3 +1.1.7 \ No newline at end of file diff --git a/plugins/xq0031_xq0032/__init__.py b/plugins/xq0031_xq0032/__init__.py index 716645c..f795176 100644 --- a/plugins/xq0031_xq0032/__init__.py +++ b/plugins/xq0031_xq0032/__init__.py @@ -48,8 +48,8 @@ def _as_str_list(value): class ErpReportExportPlugin(ScenePlugin): id = "xq0031_xq0032" name = "ERP物料收发汇总-采购订单报表导出" - version = "1.0.2" - description = "金蝶K3Cloud报表导出:物料收发汇总表(需求31)+ 采购订单列表(需求32),支持新旧系统与个性化配置" + version = "1.0.8" + description = "金蝶K3Cloud报表导出:物料收发汇总表+ 采购订单列表,支持新旧系统与个性化配置" platform = "" # ERP 自带登录页(无验证码),插件内现场真登录,不使用底座共享登录态 uses_month = False # 富字段声明(与 plugin.json 保持一致):ui=true 时壳子隐藏通用表单、展示打开插件窗口入口; @@ -84,14 +84,14 @@ class ErpReportExportPlugin(ScenePlugin): password = str(fields.get("erp_password") or "") org = str(fields.get("org_name") or "").strip() or config.ORG_NAME scheme = str(fields.get("scheme_name") or "").strip() or config.SCHEME_NAME - codes = _as_str_list(fields.get("stock_codes")) or list(config.STOCK_CODES_DEFAULT) + codes = _as_str_list(fields.get("stock_codes")) # 空 = 全部仓库不筛选 dates = _as_str_list(fields.get("date_options")) or list(config.DATE_OPTIONS_DEFAULT) if not username or not password: raise RuntimeError("ERP 登录账号/密码缺失:请在插件界面填写并保存配置后重试") if mode not in (MODE_BOTH, MODE_31, MODE_32): raise RuntimeError(f"未知执行模式:{mode}") - if mode in (MODE_BOTH, MODE_31) and not (codes and dates): - raise RuntimeError("物料收发汇总表需要仓库编码与日期选项(请在插件界面配置)") + if mode in (MODE_BOTH, MODE_31) and not dates: + raise RuntimeError("物料收发汇总表需要日期选项(请在插件界面配置);仓库编码可留空=下载全部仓库") save_dir_raw = str(fields.get("save_dir") or "").strip().strip('"') save_dir = Path(save_dir_raw) if save_dir_raw else Path( @@ -127,20 +127,28 @@ class ErpReportExportPlugin(ScenePlugin): if do_31: try: - ctx.log(f"开始导出物料收发汇总表:仓库 {len(codes)} 个 / 日期 {len(dates)} 档") + ctx.log(f"开始导出物料收发汇总表:下载全部仓库,按所选 {len(codes)} 个仓库中文名筛选" if codes else "开始导出物料收发汇总表:下载全部仓库(未筛选)") files31, failed31 = material_summary.run( page, save_dir, org, codes, dates, - progress=lambda done_i, _total: _report(done_i)) + progress=lambda done_i, _total: _report(done_i), + set_org=(erp != 'old')) # 旧系统不换组织,使用登录默认组织 saved += files31 failed += [f"物料收发汇总表[{x}]" for x in failed31] except RuntimeError as e: failed.append(f"物料收发汇总表[{e}]") - if do_32: - _back_home(page, erp) # 报表间回到主界面,保证全局搜索可用 + files31 = [] + # 各档报表导出后合并为汇总文件(合并失败不阻断整体结果) + if files31: + try: + merged = material_summary.merge_summary(save_dir) + if merged: + saved.append(str(merged)) + except Exception as e: + ctx.log(f"汇总文件生成失败: {e}") if do_32: try: ctx.log(f"开始导出采购订单列表(方案:{scheme})") - f32 = purchase_order.run(page, save_dir, scheme, + f32 = purchase_order.run(page, save_dir, scheme, erp=erp, progress=lambda _i, _t: _report(units_31 + 1)) if f32: saved.append(f32) @@ -171,15 +179,4 @@ def _desktop(): return get_desktop() -def _back_home(page, erp): - """两种报表连导时回到 K3 主界面(全局搜索入口所在页),保证下个报表可打开。""" - try: - home = erp_login.ERP_URLS.get(erp, erp_login.ERP_URLS['new']) - if erp_login.SUCCESS_KEYWORD not in (page.url or ''): - page.get(home) - time.sleep(2) - except Exception as e: - config.log(f"回主界面异常(继续尝试): {e}") - - PLUGINS.append(ErpReportExportPlugin()) diff --git a/plugins/xq0031_xq0032/config.py b/plugins/xq0031_xq0032/config.py index 67fa91c..340c8d5 100644 --- a/plugins/xq0031_xq0032/config.py +++ b/plugins/xq0031_xq0032/config.py @@ -11,6 +11,20 @@ webhost /api/plugin-config 落执行机本机,run() 时经 fields 注入; # ==================== 1. 业务默认值(fields 未传/留空时的兜底) ==================== ORG_NAME = '99.01 重庆金七象供应链管理有限公司' # 查询组织 +# 仓库编码→仓库中文名(现场映射,供「下载全部仓库后按中文名筛选」使用): +# 0101010101 重庆运营总仓 / 0101010201 重庆美得三方仓 / 0101020201 成都美得三方仓 +# 0101030201 长沙乐行三方仓 / 0101040201 西安美得三方仓 +# 前端仍要求选择仓库编码(决定最终保留哪些仓库),查询统一下载全部仓库, +# 下载后用 openpyxl 按本映射把仓库中文名列筛到所选编码对应仓库,覆盖保存。 +STOCK_NAME_MAP = { + '0101010101': '重庆运营总仓', + '0101010201': '重庆美得三方仓', + '0101020201': '成都美得三方仓', + '0101030201': '长沙乐行三方仓', + '0101040201': '西安美得三方仓', +} + +# 前端可选仓库编码列表(与 STOCK_NAME_MAP 键一致;留空 = 全部仓库不筛选) STOCK_CODES_DEFAULT = ['0101010101', '0101010201', '0101020201', '0101030201', '0101040201'] DATE_OPTIONS_DEFAULT = ['60D', '30D', '15D', '7D', '3D'] SCHEME_NAME = '默认方案(个人)' # 需求32 快捷方案(精确匹配) diff --git a/plugins/xq0031_xq0032/erp_login.py b/plugins/xq0031_xq0032/erp_login.py index c0bc70c..4387e72 100644 --- a/plugins/xq0031_xq0032/erp_login.py +++ b/plugins/xq0031_xq0032/erp_login.py @@ -3,15 +3,15 @@ 自 workflows/share/erp_login.py 迁移,插件化改造点: - 账号密码由插件界面配置经 fields 注入(不再读 .env),个性化归属明确; -- auto_port 独立浏览器实例:不接管用户已开的浏览器,cookies 天然隔离, - 确保每次真实登录的就是本次配置的账号(不做 cookies 缓存复用); +- 每次全新浏览器(auto_port 随机端口 + 独立用户目录),不保存任何目录/cookies, + 用完由调用方 page.quit() 关闭; - print → config.log。 登录页元素(新旧版一致): 用户名输入框 密码输入框 登录按钮 -登录成功判定:URL 包含 /k3cloud/html5/dform.aspx。 +登录成功判定:URL 包含 /k3cloud/html5/dform.aspx,或站点页面无登录输入框(已登录态)。 特殊弹窗:登录时若弹出「该帐号已登录在线,确认让对方下线」警告框,自动点确认。 """ import time @@ -78,6 +78,16 @@ def _handle_kick_dialog(page): return False +def _open_browser(headless): + """启动全新的浏览器(auto_port 随机端口 + 独立用户目录),不保存登录态。""" + co = ChromiumOptions() + if headless: + co.headless() + co.auto_port() + co.set_argument('--start-maximized') + return ChromiumPage(co) + + def erp_login(erp='new', username='', password='', headless=None): """ 登录金蝶 K3Cloud ERP(新旧系统通用,现场真登录)。 @@ -88,8 +98,8 @@ def erp_login(erp='new', username='', password='', headless=None): password 密码(插件界面配置注入,必填) 返回: - (success, page) success=True 时 page 为已登录的 ChromiumPage; - 失败时 page 为 None(浏览器已关闭)。调用方负责成功后的 page.quit()。 + (success, page) success=True 时 page 为已登录的 ChromiumPage;失败时 page 为 None。 + 调用方使用完毕应 page.quit() 关闭浏览器(不保存任何目录/cookies)。 """ login_url = _resolve_url(erp) username = (username or '').strip() @@ -103,16 +113,19 @@ def erp_login(erp='new', username='', password='', headless=None): page = None try: config.log(f"[ERP登录] 第 {attempt}/{RETRY_MAX} 次 → {login_url}") - co = ChromiumOptions() - if headless: - co.headless() - # auto_port:独立端口 + 独立临时用户目录,不接管用户浏览器、不残留旧登录态 - co.auto_port(True) - co.set_argument('--start-maximized') - page = ChromiumPage(co) + page = _open_browser(headless) + config.log("[ERP登录] 浏览器已启动(干净环境,不保存登录态)") + + # 回到目标登录页;已登录站点会跳转/保留会话,未登录则停在登录页 page.get(login_url) time.sleep(2) + # 3) 已登录判定:页面无登录输入框 → 会话有效,直接复用 + if page.ele(USER_INPUT, timeout=3) is None: + config.log("[ERP登录] 检测到已登录会话,直接复用") + return True, page + + # 4) 未登录 → 填表登录 user = page.ele(USER_INPUT, timeout=TIMEOUT) if not user: config.log("[ERP登录] 找不到用户名输入框") diff --git a/plugins/xq0031_xq0032/k3_common.py b/plugins/xq0031_xq0032/k3_common.py index f04a9d3..252ca63 100644 --- a/plugins/xq0031_xq0032/k3_common.py +++ b/plugins/xq0031_xq0032/k3_common.py @@ -178,9 +178,18 @@ def download_file(page, save_dir, new_name, tag=''): config.log(f'{tag} 设置下载目录异常: {e}') before_names = {b.name for b in save_dir.glob('*')} if save_dir.exists() else set() - # 找可见的「下载」按钮 + # 找可见的「下载」按钮(引出后 K3 服务端生成文件可能较慢,窗口延迟弹出, + # 15s 会误报「找不到下载按钮」——实测采购订单列表大数据量时超过 15s,放宽到 120s)。 + # 生成失败静默场景(用户现场确认):数据量大时生成中途失败、生成窗口直接消失, + # 永远不会弹「文件下载」——监听生成类窗口(生成/进度/稍候/处理/导出),一旦出现后 + # 消失且 8s 内仍无下载按钮,立即判失败返回,交外层重试,不做无谓死等。 dl = None - end = time.time() + config.TIMEOUT + end = time.time() + 120 + seen_busy, busy_gone_since = False, None + + def _busy(titles): + return any(k in t for t in titles for k in ('生成', '进度', '稍候', '处理中', '导出')) + while time.time() < end: for el in page.eles('css:[id*="FDOWNLOAD_c"]'): try: @@ -191,6 +200,15 @@ def download_file(page, save_dir, new_name, tag=''): pass if dl: break + busy = _busy(visible_titles(page)) + if busy: + seen_busy, busy_gone_since = True, None + elif seen_busy: + if busy_gone_since is None: + busy_gone_since = time.time() + elif time.time() - busy_gone_since > 8: + config.log(f'{tag} 生成窗口已消失且未出现下载窗口,判定本次引出失败') + return False time.sleep(0.5) if not dl: config.log(f'{tag} 找不到下载按钮') diff --git a/plugins/xq0031_xq0032/material_summary.py b/plugins/xq0031_xq0032/material_summary.py index bebde38..d85f8a1 100644 --- a/plugins/xq0031_xq0032/material_summary.py +++ b/plugins/xq0031_xq0032/material_summary.py @@ -6,8 +6,12 @@ 组织/仓库编码/日期选项由插件界面配置经 run() 参数注入;交互逻辑与影刀版保持同源。 """ import json +import re import time from datetime import datetime, timedelta +from pathlib import Path + +import openpyxl from . import config from . import k3_common as kc @@ -54,7 +58,10 @@ def _wait_window_title(page, keyword, timeout=None): # ================== 报表操作 ================== def _open_report(page): - """点击全局搜索 → 输入「物料收发汇总表」→ 回车 → 等待过滤界面出现。""" + """点击全局搜索 → 输入「物料收发汇总表」→ 等联想下拉 → 点结果项(与需求32同法,不回车)→ 等待过滤界面出现。 + + 不能用回车直接开第一个结果:回车会收起联想下拉且可能开成其它报表/列表页, + 导致后续「点击搜索结果」兜底找不到项。改成在联想下拉里点选「物料收发汇总表」。""" if not kc.click_visible(page, 'css:.kd-fullsearch-searchicon', timeout=10): config.log(f'{TAG} 找不到全局搜索图标') return False @@ -65,9 +72,9 @@ def _open_report(page): return False sbox.clear() sbox.input('物料收发汇总表') - time.sleep(0.3) - kc.press_enter(page) - time.sleep(1.5) + time.sleep(0.8) # 只出联想下拉,不回车 + + _click_search_result(page) # 等待过滤界面(含组织字段 FSTOCKORGID)出现,限定在 .k-window 弹窗内 end = time.time() + 40 @@ -77,7 +84,7 @@ def _open_report(page): return True time.sleep(0.5) - # 兜底:点击搜索结果中的「物料收发汇总表」菜单项 + # 兜底:联想下拉里点选失败时,再扫一遍含关键字的可见菜单项 config.log(f'{TAG} 未自动打开,尝试点击搜索结果') els = page.eles('xpath://*[contains(text(), "物料收发汇总表")]') for el in els: @@ -93,6 +100,29 @@ def _open_report(page): return False +def _click_search_result(page): + """在联想下拉(.kd-fullsearch-selectable li)里点选文本为「物料收发汇总表」的结果项。""" + end = time.time() + 20 + while time.time() < end: + for li in page.eles('css:.kd-fullsearch-selectable li.kd-fullsearch-item-container', + timeout=2): + try: + if not li.states.is_displayed: + continue + t = li.ele('css:span[searchitem="text"]', timeout=0.5) + txt = ((t.attr('title') or (t.text or '')).strip() if t is not None else '') + if '物料收发汇总表' not in txt: + continue + li.click() + time.sleep(2) + return True + except Exception: + pass + time.sleep(0.5) + config.log(f'{TAG} 联想下拉中未找到「物料收发汇总表」结果项') + return False + + def _open_filter(page): """确保过滤界面打开: 1. 先关闭「文件下载」窗口(K3 下载完成后残留、挡在最上层) @@ -308,13 +338,13 @@ def _set_date(page, begin, end): def _click_add_row(page): - """点击仓库过滤面板「新增行」。 - 全局 li.k-link.kdFilterAdd 会同时匹配「主报表过滤」+「仓库过滤」两个面板, - 原实现总点到主过滤那个(其行数不增加导致误判失败)。因此必须限定在仓库过滤 - 容器(id 含 FBeginStockId_Filter)内定位。物理点击只会选中文字,改用 JS click 触发。""" + """点击过滤窗口「条件」页签过滤网格的「新增行」。 + 新流程不再打开仓库过滤面板,过滤窗口内 li.kdFilterAdd 即为目标 + (aa.md: