OnecardDemo 用户信息每批 1000 条实施计划

For agentic workers: REQUIRED SUB-SKILL: Use executing-plans to implement this plan task-by-task. Steps use checkbox (- [ ]) syntax for tracking.

Goal: 将“获取全部用户信息”的自动分页大小集中到 Constants 并设置为每批 1000 条,为后续可配置化保留单一取值入口。

Architecture: 在现有 Constants 增加一卡通用户分页常量,OnecardWebServiceClient 删除私有的 200 条常量并统一引用公共常量。现有 Math.min(分页大小, 剩余数量)最大 CUSTOMERID + 1 游标规则保持不变。

Tech Stack: Java、Android、JUnit 4、Gradle


Task 1:用测试固定 1000 条默认值

Files:

package com.cpt.onecarddemo;

import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class ConstantsTest {
    @Test
    public void customerBatchSizeDefaultsToOneThousand() {
        assertEquals(1000, Constants.ONE_CARD_CUSTOMER_BATCH_SIZE);
    }
}

Run: ./gradlew testDebugUnitTest --tests com.cpt.onecarddemo.ConstantsTest

Expected: 编译失败,提示 ONE_CARD_CUSTOMER_BATCH_SIZE 不存在。

在一卡通相关常量区域增加:

public static final int ONE_CARD_CUSTOMER_BATCH_SIZE = 1000;

Run: ./gradlew testDebugUnitTest --tests com.cpt.onecarddemo.ConstantsTest

Expected: BUILD SUCCESSFUL,测试通过。

Task 2:WebService 客户端改为读取统一常量

Files:

删除:

private static final int CUSTOMER_BATCH_SIZE = 200;

增加:

import com.cpt.onecarddemo.Constants;
int size = Math.min(Constants.ONE_CARD_CUSTOMER_BATCH_SIZE, remaining);

现有 getCustomers(startingCustomerId, size)、返回 CUSTOMERID 解析和下一批游标计算保持不变。

Run: ./gradlew testDebugUnitTest

Expected: BUILD SUCCESSFUL,0 failure、0 error。

Task 3:同步文档和变更记录

Files:

将设计状态更新为“已实施,待现场验证”,并保留“后续可配置化时替换取值来源”的边界。

将“每段最多 200 条”改为:

当前 Android 自动分页每批 1000 条,最后一批按剩余数量;该值来自 Constants,是实现策略,不是厂家文档规定的服务端硬上限。

记录常量位置、客户端引用、测试证据、构建结果、现场验证状态和未执行 Git 写操作。

确认标题、1000 条分页口径、后续可配置化边界和验证状态在两种格式中一致。

Task 4:完整构建验证

Files:

Run: ./gradlew testDebugUnitTest assembleDebug lintDebug --rerun-tasks

Expected: BUILD SUCCESSFUL;JVM 测试 0 failure、0 error;Lint 0 error。

Run: rg -n "CUSTOMER_BATCH_SIZE|每段最多 200|每批 1000" app/src/main zhctprompt/work_android/OnecardDemo

Expected: Java 业务实现只通过 Constants.ONE_CARD_CUSTOMER_BATCH_SIZE 读取 1000;协议说明不再把 200 描述为当前分页大小。

安装 Debug APK 后连接现场 WebService,执行“获取全部用户信息”,核对分页请求没有超时、返回用户总数与 GetCustomerCount 一致。

执行约束