feat(settlement): 门店未出账手动提现与总部审核(OPT-010)

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-03 15:32:01 +08:00
parent 666bcb8633
commit f3353bbce5
29 changed files with 1733 additions and 15 deletions
@@ -7,6 +7,7 @@ import { AlertService } from '../common/alert/alert.service';
* 财务对账单定时任务(Asia/Shanghai
* - 每日 08:00:酒厂日账单 + 门店日账单(统计昨日 00:00~今日 00:00
* - 每月 1 日 08:00:合伙人上一自然月账单 + 物流承运商上一自然月对账
* - 工作日 18:05:门店提现 T+0 审完预警(FIN-003
*/
@Injectable()
export class SettlementScheduler {
@@ -48,6 +49,34 @@ export class SettlementScheduler {
}
}
/** FIN-003:工作日 18:05 扫描超时未审门店提现 */
@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({
level: 'P1',
category: 'job',
title: '门店提现超时扫描失败',
detail: e instanceof Error ? e.message : String(e),
dedupeKey: `job_store_withdraw_overdue|${new Date().toISOString().slice(0, 10)}`,
});
}
}
@Cron('0 8 1 * *', { timeZone: 'Asia/Shanghai' })
async handleMonthlyPartnerBills() {
this.logger.log('Monthly partner bills job start');