fix(settlement): 全部门店可未出账提现并企微提醒

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-03 15:43:24 +08:00
parent f3353bbce5
commit 26472f8678
12 changed files with 60 additions and 87 deletions
@@ -49,22 +49,13 @@ export class SettlementScheduler {
}
}
/** FIN-003:工作日 18:05 扫描超时未审门店提现 */
/** FIN-003:工作日 18:05 扫描超时未审门店提现(企微提醒在 SettlementService 内发送) */
@Cron('5 18 * * 1-5', { timeZone: 'Asia/Shanghai' })
async handleWithdrawOverdueAlert() {
this.logger.log('Store withdraw overdue scan start');
try {
const summary = await this.settlementService.scanOverdueStoreWithdrawals();
this.logger.log(`Store withdraw overdue: ${JSON.stringify(summary)}`);
if (summary.overdueCount > 0) {
this.alert.notify({
level: 'P1',
category: 'finance',
title: '门店提现超时未审',
detail: `待审 ${summary.pendingCount} 笔,超时 ${summary.overdueCount} 笔,超时金额 ¥${summary.overdueAmount.toFixed(2)}`,
dedupeKey: `job_store_withdraw_overdue|${new Date().toISOString().slice(0, 10)}`,
});
}
} catch (e) {
this.logger.error('Store withdraw overdue scan failed', e instanceof Error ? e.stack : e);
this.alert.notify({
@@ -72,7 +63,7 @@ export class SettlementScheduler {
category: 'job',
title: '门店提现超时扫描失败',
detail: e instanceof Error ? e.message : String(e),
dedupeKey: `job_store_withdraw_overdue|${new Date().toISOString().slice(0, 10)}`,
dedupeKey: `job_store_withdraw_overdue_fail|${new Date().toISOString().slice(0, 10)}`,
});
}
}