财务接口按俱乐部过滤,日收支只读daily_income_stat与daily_payout_stat

This commit is contained in:
XingQue
2026-06-24 22:22:12 +08:00
parent 8e5db24bad
commit 7f2f0caaa1
6 changed files with 260 additions and 133 deletions

View File

@@ -0,0 +1,29 @@
"""只修正今日 daily_income_stat.total_count不动金额、不动其它天"""
from datetime import date
from django.core.management.base import BaseCommand
from jituan.services.szjilu_accounting import fix_income_stat_count_for_date
class Command(BaseCommand):
help = '修正今日收入笔数repair 会把 total_count 虚增,本命令只改笔数列)'
def add_arguments(self, parser):
parser.add_argument('--date', type=str, default='', help='YYYY-MM-DD默认今天')
parser.add_argument('--yes', action='store_true')
def handle(self, *args, **options):
stat_date = date.fromisoformat(options['date']) if options['date'] else date.today()
dry_run = not options['yes']
r = fix_income_stat_count_for_date(stat_date, dry_run=dry_run)
self.stdout.write(f'日期: {r["date"]}')
self.stdout.write(f' 表内笔数合计(错): {r["before_count"]}')
self.stdout.write(self.style.SUCCESS(f' 修正后笔数: {r["after_count"]}'))
if r['clubs']:
for cid, cnt in r['clubs'].items():
self.stdout.write(f' club={cid}: {cnt}')
if dry_run:
self.stdout.write(self.style.WARNING('\n确认: python manage.py fix_today_income_count --yes'))
else:
self.stdout.write(self.style.SUCCESS('\n已写入 daily_income_stat.total_count请刷新财务页。'))