feat:新增ai分析,新增储值账户,优化通知规则

This commit is contained in:
2026-03-12 14:03:01 +08:00
parent 6a00875246
commit 6ca962a187
22 changed files with 1294 additions and 237 deletions

View File

@@ -1,4 +1,4 @@
import fs from 'node:fs'
import fs from 'node:fs'
import path from 'node:path'
import notificationRules from '../src/config/notificationRules.js'
@@ -28,6 +28,8 @@ const toKotlinRegex = (spec) => {
return `Regex(${toKotlinString(spec.pattern)}${flags})`
}
const toOptionalString = (value) => (value ? toKotlinString(value) : 'null')
const toRuleBlock = (rule) => ` NotificationRuleDefinition(
id = ${toKotlinString(rule.id)},
label = ${toKotlinString(rule.label)},
@@ -35,12 +37,19 @@ const toRuleBlock = (rule) => ` NotificationRuleDefinition(
keywords = ${toKotlinStringList(rule.keywords)},
requiredTextPatterns = ${toKotlinStringList(rule.requiredTextPatterns)},
direction = NotificationRuleDirection.${rule.direction === 'income' ? 'INCOME' : 'EXPENSE'},
entryType = ${toKotlinString(rule.entryType || 'expense')},
fundSourceType = ${toKotlinString(rule.fundSourceType || 'cash')},
fundSourceName = ${toOptionalString(rule.fundSourceName)},
fundSourceNameFromChannel = ${rule.fundSourceNameFromChannel ? 'true' : 'false'},
fundTargetType = ${toKotlinString(rule.fundTargetType || 'merchant')},
fundTargetName = ${toOptionalString(rule.fundTargetName)},
fundTargetNameFromChannel = ${rule.fundTargetNameFromChannel ? 'true' : 'false'},
impactExpense = ${rule.impactExpense === false ? 'false' : 'true'},
impactIncome = ${rule.impactIncome ? 'true' : 'false'},
defaultCategory = ${toKotlinString(rule.defaultCategory)},
autoCapture = ${rule.autoCapture ? 'true' : 'false'},
merchantPattern = ${toKotlinRegex(rule.merchantPattern)},
defaultMerchant = ${
rule.defaultMerchant ? toKotlinString(rule.defaultMerchant) : 'null'
},
defaultMerchant = ${toOptionalString(rule.defaultMerchant)},
)`
const content = `package com.echo.app.notification