收紧付款复核资料与阶段编辑(08-01-reimbursement-notification-progress-clarity)
ci-e2e / e2e (push) Canceled after 0s
ci-minimal / check-minimal (push) Canceled after 0s

这个提交包含在:
2026-08-02 15:15:01 +08:00
父节点 9afebdb44d
当前提交 185d64dcd6
共修改 14 个文件,包含 777 行新增和 121 行删除
@@ -5,6 +5,7 @@ const { Client } = require("pg");
const { buildApp } = require("../app");
const { createPrismaClient } = require("../prismaClient");
const { ADVISORY_LOCK_NAMESPACES } = require("../constants/advisoryLocks");
const { encryptStringOrThrow } = require("../services/crypto");
const { currentDateString } = require("../utils/date");
const LOOPBACK_HOSTS = new Set(["127.0.0.1", "localhost", "::1", "[::1]"]);
@@ -93,9 +94,9 @@ function validatePaymentConcurrencyEnvironment(env = process.env) {
fail("database_confirmation_mismatch");
}
requireValue(env, "JWT_SECRET");
requireValue(env, "FIELD_ENCRYPTION_KEY");
const fieldEncryptionKey = requireValue(env, "FIELD_ENCRYPTION_KEY");
return { databaseName, databaseUrl };
return { databaseName, databaseUrl, fieldEncryptionKey };
}
function responseJson(response) {
@@ -200,7 +201,7 @@ async function runBlockedRace({
}
}
function syntheticEmployeeData({ id, runKey, kind, departmentId, legalEntityId }) {
function syntheticEmployeeData({ id, runKey, kind, departmentId, legalEntityId, fieldEncryptionKey }) {
return {
id,
employee_no: `QA-${runKey}-${kind}`,
@@ -211,7 +212,10 @@ function syntheticEmployeeData({ id, runKey, kind, departmentId, legalEntityId }
legal_entity_id: legalEntityId,
title: "并发验收",
hire_date: new Date("2026-01-01T00:00:00.000Z"),
bank_account_encrypted: `synthetic-${runKey}`,
bank_account_encrypted: encryptStringOrThrow(
{ fieldEncryptionKey },
`6222${runKey.slice(0, 8)}5678`,
),
bank_name: "合成银行",
password_hash: "unused-by-token-based-concurrency-check",
token_version: 0,
@@ -219,7 +223,7 @@ function syntheticEmployeeData({ id, runKey, kind, departmentId, legalEntityId }
};
}
async function seedSyntheticFixture(prisma) {
async function seedSyntheticFixture(prisma, fieldEncryptionKey) {
const runKey = crypto.randomBytes(6).toString("hex");
const department = await prisma.department.create({
data: { name: `合成部门-${runKey}` },
@@ -244,6 +248,7 @@ async function seedSyntheticFixture(prisma) {
kind,
departmentId: department.id,
legalEntityId: legalEntity.id,
fieldEncryptionKey,
}),
});
}
@@ -772,7 +777,7 @@ async function runPaymentPostgresConcurrencyCheck(env = process.env) {
const { prisma, pool } = createPrismaClient();
let app = null;
try {
const fixture = await seedSyntheticFixture(prisma);
const fixture = await seedSyntheticFixture(prisma, context.fieldEncryptionKey);
app = await buildApp({ startJobs: async () => undefined });
await app.ready();
const tokens = {