实现企业银行账户与建行制单(corporate-bank-account-payment-order)
这个提交包含在:
@@ -567,6 +567,36 @@ async function seedExpenseTypes(prisma) {
|
||||
}
|
||||
}
|
||||
|
||||
async function seedBankInstitutions(prisma) {
|
||||
const existing = await prisma.bankInstitution.findUnique({
|
||||
where: { code: "CCB" },
|
||||
select: { id: true },
|
||||
});
|
||||
|
||||
if (existing) {
|
||||
return { created: 0, preserved: 1 };
|
||||
}
|
||||
|
||||
return prisma.bankInstitution.create({
|
||||
data: {
|
||||
code: "CCB",
|
||||
name: "中国建设银行",
|
||||
enabled: true,
|
||||
archived_at: null,
|
||||
created_by: null,
|
||||
updated_by: null,
|
||||
},
|
||||
}).then(
|
||||
() => ({ created: 1, preserved: 0 }),
|
||||
(error) => {
|
||||
if (error?.code === "P2002") {
|
||||
return { created: 0, preserved: 1 };
|
||||
}
|
||||
throw error;
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
async function seedApprovalRules(prisma) {
|
||||
const existingCount = await prisma.approvalRule.count();
|
||||
if (existingCount > 0) {
|
||||
@@ -1032,6 +1062,7 @@ async function main() {
|
||||
await prisma.$connect();
|
||||
|
||||
try {
|
||||
const bankInstitutionSeed = await seedBankInstitutions(prisma);
|
||||
await seedExpenseTypes(prisma);
|
||||
const approvalRuleSeed = await seedApprovalRules(prisma);
|
||||
await seedDocumentSequence(prisma);
|
||||
@@ -1046,6 +1077,10 @@ async function main() {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log("Seeded config data:");
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(
|
||||
`- bank institutions: ${bankInstitutionSeed.created} created / ${bankInstitutionSeed.preserved} preserved`,
|
||||
);
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`- expense types: ${ENABLED_EXPENSE_TYPES.length} enabled + ${DISABLED_LEGACY_EXPENSE_TYPES.length} disabled`);
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(
|
||||
@@ -1096,6 +1131,7 @@ module.exports = {
|
||||
DEFAULT_FEATURE_FLAGS,
|
||||
ENABLED_EXPENSE_TYPES,
|
||||
seedApprovalRules,
|
||||
seedBankInstitutions,
|
||||
seedExpenseTypes,
|
||||
seedFeatureFlags,
|
||||
};
|
||||
|
||||
在新工单中引用
屏蔽一个用户