feat: 采购管理按设备、按创建人筛选,记录采购任务创建人与来源 #382
Open
opened 2026-10-12 16:51:12 +08:00 by ila
·
3 comments
No Branch/Tag Specified
main
feat/384-client-key-agent-release
feat/383-collection-device-filter
feat/382-purchase-creator-filters
feat/381-syb-cancelled-block
feat/375-open-in-pdd
feat/380-status-device-connection
fix/370-horizontal-grid
feat/372-export-shop
feat/378-heartbeat-diagnostics
feat/372-export-price
feat/372-list-export
fix/377-rejected-purchase-outbox
fix/376-pre-address-spec-verification
fix/374-final-spec-confirmation
fix/373-navigation-diagnostics
fix/370-color-discovery
feat/367-last-batch-repurchase
fix/368-image-search-partial-link
integration/364-365-366-main
feat/364-purchase-failure-snapshot
integration/365-366-validation
fix/365-order-result-observation
fix/366-address-editor-ready
fix/359-auto-match-resume
feat/363-inner-code-page-size
fix/362-truncated-spec-card
fix/361-spec-probe-click
docs/agents-worktree-rules
fix/358-syb-size-weight
feat/357-syb-cancel-status
feat/356-purchase-order-filter
fix/355-syb-list-timeout
feat/353-syb-shop-multiselect
fix/354-syb-top-pagination
fix/352-syb-source-created
fix/348-reveal-swipe
feat/340-syb-excluded-products
fix/351-inner-code-apply-selection
fix/350-match-layout
fix/350-inner-code-matching
feat/349-batch-return-use
feat/347-batch-return-cancel
feat/345-yeeke-reship
fix/346-root-serves-spa
fix/344-inner-code-stall-match
fix/343-syb-writeback-session
feat/339-syb-page-size
feat/338-return-match
feat/337-yeeke-admin-ui
feat/336-yeeke-return-sync
fix/335-bottom-submit-node
fix/334-spec-probe-top-swipe
fix/333-purchaser-device-owner
fix/331-spec-panel-recognition
fix/330-syb-writeback-session
feat/327-syb-writeback-filter
feat/326-order-information
fix/325-order-result
feat/316-chrome-order-backfill
fix/307-backfill-entry
feat/305-syb-order-writeback
feat/306-order-paid-amount
release/283
fix/283-purchase-mapping-consistency
fix/230-horizontal-spec-selection
feat/263-spec-rematch
fix/262-purchase-handoff
fix/260-261-purchase-readiness
fix/259-partial-collection-link
feat/258-one-click-replace
fix/257-color-normalized-match
fix/256-collection-single-dimension
fix/255-current-page-reidentify
feat/253-one-click-link
fix/254-match-loading
fix/251-syb-spec-candidates
feat/250-continuous-collection
fix/249-local-purchase-diagnostics
fix/248-bottom-submit
fix/247-short-address-panel
fix/246-address-return-panel
fix/245-purchase-failure-diagnostics
fix/244-selected-card-duplicates
fix/243-spec-entry-recovery
feat/242-agent-order-backfill
feat/241-order-backfill-endpoint
fix/239-syb-partial-sync
fix/238-spec-panel-preswipe
feat/237-client-api-keys
feat/236-purchaser-syb-sync
fix/235-syb-pagination-overlap
release/234-integrated
fix/229-address-entry-dedup
fix/228-selection-proof-panel-transition
fix/227-address-panel-return
fix/226-reopen-pdd-on-manual-retry
fix/225-in-place-purchase-retry
fix/224-final-spec-revalidation
fix/223-probed-confirmed-mapping
chore/221-devharness-sync
feat/218-purchase-result-bubble
fix/217-agent-retry-current-spec
fix/216-syb-spec-role-order
feat/215-mandatory-live-spec-probe
feat/214-verified-purchase-actions
fix/212-syb-sync-shop-snapshot
feat/211-spec-entry-ready-wait
feat/210-order-result-payment-transition
feat/209-pdd-bottom-spec-entry
feat/200-ai-match-result-purchase-ready
feat/199-job-execution-logs
feat/198-syb-ai-parse
feat/195-scheduled-spec-auto-match
fix/197-ai-write-timeout
feat/190-syb-inline-correction
fix/193-address-entry-reveal
feat/194-one-click-spec-match
fix/192-order-result-scroll
No results found.
Labels
No items
No labels
Milestone
No items
No Milestone
Projects
Clear projects
No projects
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: OPC/goauto#382
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
基本信息
已核验事实(
origin/main16e3d35,2026-10-12)purchase_task.device_id已有索引(models/purchase.go:89),列表已显示设备名(web/src/views/goauto/purchase-tasks/index.vue:32「尚未分派」)。purchase_task没有创建人字段;只有spec_decision_by、payment_reviewed_by、re_purchase_authorized_by、cancelled_by等其他动作的操作人。GET /api/admin/v1/purchase-tasks(purchase/handler.go:24AdminList→admin_query.go:17AdminListRequest),现有筛选:任务、类型、状态、执行模式、SYB 商品、蝦皮订单号(含多行)、PDD 订单号、下单日期。允许角色 admin / purchaser / after_sales 及客户端密钥(allowedOperator)。operatorID(c)(handler.go:553):JWTidentity;客户端密钥请求取AuthorizedBy(= 密钥的UpdatedBy,clientapi/gateway.go:82)。Create(service.go:71)、备货CreateStock(:365)、批量BatchCreate(batch.go:272→Create)、Agent 重试AgentRetry(retry.go:218→batchRetryCreate→Create,Device Token,无 Admin 账号)及 Agent 最后一批重购(同走 Agent 重试路径)。index.vue:7–20,导出按当前筛选(#372)。目标
非目标
sys_opera_log反推。方案
purchase_task新增可空列created_by(bigint unsigned,索引)与created_source(varchar(16),非空默认'';取值admin/client_api/agent,空串表示历史未记录)。只新增列,不改已有数据。created_by= 当前 JWT 用户,created_source=admin;BatchRetry实为原地重置原任务(Reset,任务号不变),不新建任务,因此不写创建人;created_by=AuthorizedBy,created_source=client_api;created_by为空,created_source=agent(设备由既有device_id体现)。requestId)返回原任务,不改写创建人。AdminListRequest新增deviceId(数字,或unassigned表示device_id IS NULL)与createdBy(数字,或agent表示created_source='agent',unrecorded表示created_source='');列表项新增createdBy、createdByName、createdSource。GET /api/admin/v1/purchase-tasks/filter-options,同样受allowedOperator保护,返回采购任务中实际出现过的设备(id、名称)与创建人(id、显示名),避免为采购员开放设备或用户管理接口。purchase-tasks/index.vue、api/goauto/purchase-tasks.js):筛选区新增「设备」「创建人」两个可清空下拉(含「未分派」/「Agent 发起」/「未记录」选项),参与查询、重置与导出;表格新增「创建人」列(显示名,Agent 发起显示「Agent」,历史显示「未记录」);详情页同步显示创建人与来源。复用现有el-select与表格列样式。设计证据
现有页面小范围变化:筛选区追加两个与「类型」「状态」同样式的下拉,表格在「设备」列后追加一列「创建人」,详情描述追加一项;复用现有组件与样式,无新页面、无布局重构,不需要原型。
子项目影响、依赖与并行
server/cmd/migrate/migration/version-local/)、models/purchase.go、purchase/(service、batch、retry、admin_query、handler、router)及测试。views/goauto/purchase-tasks/index.vue、api/goauto/purchase-tasks.js。purchase/包但不同文件区域,建议串行合并。验收标准
created_by为 NULL、created_source为空。agent且创建人为空。deviceId(含unassigned)、createdBy(含agent、unrecorded)筛选及与现有筛选组合;非法值返回 400;filter-options 只返回实际出现的设备与创建人,权限与列表一致。风险与回退
文档影响
created_by/created_source字段)与 Business-Rules-and-Glossary(创建人与来源的记录规则、历史显示「未记录」、Agent 发起无创建人)。开始实施(2026-10-12,Claude Code)
用户:「按照顺序安排subagent用sonnet做#381 #382 #383。」(视为同意实施本单含迁移的代码;执行迁移与发布仍需用户另行授权。)
D:/OPC/goauto-worktrees/issue-382,分支feat/382-purchase-creator-filters,基线origin/main16e3d35(与 #381 独立,合并时串行)。实现回写(2026-10-12,Claude Code)
用户授权:「按照顺序做1,2,3,4。」。Sonnet 子 Agent 实施,Claude Code 审查复跑。Gitea MCP 不可用,回退 REST。
feat/382-purchase-creator-filters已推送:6cc3bb9(迁移+模型)、ac7f811(purchase 包:写入、筛选、filter-options)、9e54263(Web)。13 文件 +758/−8。1791700000000_purchase_task_creator.go:created_by(可空,索引idx_purchase_task_created_by)、created_source(varchar(16) 默认'');逐步判断已存在,可重跑;不改已有行。仅在 sqlite 测试中验证。admin+ JWT 用户;客户端密钥 →client_api+AuthorizedBy;Agent 重试 →agent、创建人空;操作人 0 存 NULL;幂等重放不改写。deviceId(数字/unassigned)、createdBy(数字/agent/unrecorded);返回createdBy/createdByName/createdSource;GET /api/admin/v1/purchase-tasks/filter-options(allowedOperator,路由在/:taskId之前)。BatchRetry实为原地Reset,不新建任务,不写创建人(正文已更正);② 非法筛选值沿用CodeInvalidRequest返回 422(非 400)。TestMigratePurchaseTaskCreatorAddsColumnsKeepsLegacyRowsAndIsIdempotent;purchasecreator_filter_test.go11 项(写入、重放、Agent、客户端、筛选组合与非法值、filter-options 内容/空/权限、路由不冲突)。Claude Code 复核:go test -count=1 ./app/goauto/purchase/ ./cmd/migrate/...通过,go build通过;改动 Web 文件 eslint 结果与基线一致(24 错误/11 警告均为旧问题),build:prod成功。TestOrderBackfillConcurrentResolveUnknown失败一次后 3 次复跑通过,与本单无关。合并、发布与 Wiki(2026-10-12,Claude Code)
用户授权:「按照顺序做1,2,3,4。如果线上有采集和采购任务进行着,等待无任务时再重启」;发布前用户选择「A」(按 main 发布,含 #378)。Gitea MCP 不可用,回退 REST。
origin/main16e3d35,依次--no-ff合并 #381 →c5709a0、#382 →0893b55、#383 →15bab9c,无冲突,已推送。合并后go test ./...除既有失败外通过(sybimport基线已有失败;appreleaseTestParseBuiltAgentAPKWhenAvailable为本地有 Debug APK 时才运行的过时用例),Linux 构建与 Webbuild:prod通过。/home/goauto/releases/20261012-15bab9c-381-382-383;数据库备份/home/goauto/backups/20261012-381-382-383;迁移1791600000000、1791700000000执行成功并回读;迁移前与切换前无执行中的采集/采购/同步/AI/自动匹配任务;current 原子切换并重启,active。server SHA256f3486444…ff3695(进程一致),index.htmla4c85aa8…d5853。filter-options)401,日志无 panic/fatal/1146/1054;采购1/2 心跳恢复在线。/home/goauto/releases/20261010-3d5e964-372v3-web并重启;新增列/表保留。c8aa5a4716d0b9a462677b1276a7362d7227c95c、Architecture-and-Code-Map72fa776c9adb4993c84918494b37516f3156d354、Deployment-and-Operations4103d9b6174bdba2886c4916e85e0763ce2dcd53,回读一致;sync与sync --check各一次通过,镜像ac112b5已推送 main。