feat(energy): optimize mobile hydrogen daily and customer lists
ci/woodpecker/push/woodpecker Pipeline was canceled

Co-authored-by: HiFox Agent <agents-noreply@hifox.com>
This commit is contained in:
kfluous
2026-09-05 15:51:52 +08:00
co-authored by HiFox Agent
parent 98efde3f75
commit 637a72c1e9
8 changed files with 352 additions and 57 deletions
@@ -140,7 +140,9 @@ export function registerHydrogenStationBoardRoute(
kg: dailyKgByStation.get(id)?.get(date) ?? 0,
})),
};
}).filter(station => station.recordCount > 0);
}).filter(station => station.recordCount > 0
|| station.name.includes('东鹏大道')
|| (station.name.includes('佛山南海') && station.name.includes('羚牛')));
let selected = null;
if (stationId) {
+22 -1
View File
@@ -460,7 +460,28 @@ test("氢能 BI v2 月度上下文换算为完整自然月并沿用至明细", a
]);
});
test("单站看板仅保留有加氢记录的站点并合并区间现结流水", async () => {
test("指定单站即使无记录仍可选择,不伪造加氢量", async () => {
const app = new Hono();
registerHydrogenStationBoardRoute(app, {
hydrogenPool: { query: createQueryMock([
[
{ id: 341, name: "佛山南海羚牛加氢站", kg: 0, fee: 0, recordCount: 0 },
{ id: 342, name: "广州交投东鹏大道加氢站", kg: 0, fee: 0, recordCount: 0 },
{ id: 343, name: "其他零业务站", kg: 0, fee: 0, recordCount: 0 },
], [], [], [], [],
], []) },
cached: createCachedMock([]),
} as unknown as HydrogenStationBoardDependencies);
const response = await app.request("/hydrogen/station-board?startDate=2026-08-16&endDate=2026-08-17");
assert.equal(response.status, 200);
const payload = await response.json();
assert.deepEqual(payload.stations.map((station: { id: number }) => station.id), [341, 342]);
assert.equal(payload.summary.totalKg, 0);
assert.equal(payload.summary.activeStationCount, 0);
assert.ok(payload.stations.every((station: { dailyKg: { kg: number }[] }) => station.dailyKg.every(row => row.kg === 0)));
});
test("单站看板过滤非指定零业务站并合并区间现结流水", async () => {
const calls: QueryCall[] = [];
const cacheCalls: CacheCall[] = [];
const stationBoardApp = new Hono();