forked from erp-dev/erp
fea: business completed
This commit is contained in:
@@ -98,7 +98,16 @@ AGENT_ACCESS_KEY = env('AGENT_ACCESS_KEY', default='')
|
||||
HAOBUYE_API_BASE_URL = env('HAOBUYE_API_BASE_URL', default='http://43.139.183.222:18080')
|
||||
HAOBUYE_API_AUTHORIZATION = env('HAOBUYE_API_AUTHORIZATION', default='your-fixed-authorization-secret')
|
||||
HAOBUYE_API_TIMEOUT_SECONDS = env.float('HAOBUYE_API_TIMEOUT_SECONDS', default=30.0)
|
||||
HAOBUYE_FINANCE_SYNC_OPERATOR_ID = env.int('HAOBUYE_FINANCE_SYNC_OPERATOR_ID', default=0)
|
||||
HAOBUYE_FINANCE_SYNC_OPERATOR_ID = env.int('HAOBUYE_FINANCE_SYNC_OPERATOR_ID', default=6)
|
||||
|
||||
# 定时财务同步客户列表(临时需求,直接写死不走 env)
|
||||
FINANCE_SYNC_CUSTOMER_NAMES: list[str] = [
|
||||
'曾念', '紫琪', '胡肖宇', '歌斯拉-胜利星厂', '胡鼎',
|
||||
'罗标', '永琪服饰', '罗兵', '杜辉', '李群', '超麦汇大洋',
|
||||
'展兴', '王杰敏', '锐木', '何玄', '周刚(周总)', '彤彤服饰',
|
||||
'杰恩', '来发裁床', '刘静贤', '金源', '达达-金腾达qs', '周乔峰',
|
||||
'杨锐辉',
|
||||
]
|
||||
|
||||
|
||||
# CORS 配置
|
||||
@@ -560,96 +569,101 @@ CELERY_TIMEZONE = TIME_ZONE
|
||||
from celery.schedules import crontab
|
||||
|
||||
CELERY_BEAT_SCHEDULE = {
|
||||
'daily_database_backup': {
|
||||
'task': 'api_v1.tasks.backup_database',
|
||||
'schedule': crontab(hour=3, minute=0),
|
||||
'kwargs': {
|
||||
'output_dir': str(BASE_DIR / 'data-bak'),
|
||||
'filename_prefix': 'db-backup',
|
||||
},
|
||||
},
|
||||
'daily_settlement': {
|
||||
'task': 'settlement.tasks.run_daily_settlement',
|
||||
'schedule': crontab(
|
||||
hour=SETTLEMENT_RUN_HOUR,
|
||||
minute=SETTLEMENT_RUN_MINUTE
|
||||
),
|
||||
},
|
||||
'daily_plate_order_tiia_image_upload': {
|
||||
'task': 'printing.tasks.upload_yesterday_plate_order_images_to_tencent_tiia',
|
||||
'schedule': crontab(hour=3, minute=0),
|
||||
},
|
||||
'daily_mdy_plate_order_staging_tiia_image_upload': {
|
||||
'task': 'api_v1.tasks.upload_mdy_plate_order_staging_images_to_tencent_tiia',
|
||||
'schedule': crontab(hour=3, minute=20),
|
||||
'kwargs': {
|
||||
'batch_size': 500,
|
||||
'dry_run': False,
|
||||
},
|
||||
},
|
||||
'mdy_product_sync': {
|
||||
'task': 'api_v1.tasks.sync_mdy_products',
|
||||
'schedule': crontab(minute='*/10'),
|
||||
'kwargs': {
|
||||
'page_size': MDY_SYNC_PAGE_SIZE,
|
||||
'max_pages': MDY_SYNC_MAX_PAGES,
|
||||
'max_records': MDY_SYNC_MAX_RECORDS,
|
||||
},
|
||||
},
|
||||
'mdy_customer_sync': {
|
||||
'task': 'api_v1.tasks.sync_mdy_customers',
|
||||
'schedule': crontab(minute='*/5'),
|
||||
'kwargs': {
|
||||
'page_size': MDY_SYNC_PAGE_SIZE,
|
||||
'max_pages': MDY_SYNC_MAX_PAGES,
|
||||
'max_records': MDY_SYNC_MAX_RECORDS,
|
||||
},
|
||||
},
|
||||
'printing_external_records_sync': {
|
||||
'task': 'api_v1.tasks.sync_external_printing_records',
|
||||
'schedule': crontab(minute='*/5'),
|
||||
'kwargs': {
|
||||
'limit': 100,
|
||||
},
|
||||
},
|
||||
'notify_unreplied_missions_every_minute': {
|
||||
'task': 'notifier.tasks.notify_unreplied_missions_task',
|
||||
'schedule': crontab(minute='*'),
|
||||
'kwargs': {
|
||||
'limit': 100,
|
||||
},
|
||||
},
|
||||
'backfill_external_product_images_hourly': {
|
||||
'task': 'api_v1.tasks.backfill_external_product_images',
|
||||
'schedule': crontab(minute=17),
|
||||
'kwargs': {
|
||||
'limit': 500,
|
||||
'dry_run': False,
|
||||
},
|
||||
},
|
||||
'retry_external_printing_sync_failures_every_120_minutes': {
|
||||
'task': 'api_v1.tasks.retry_external_printing_sync_failures',
|
||||
'schedule': crontab(minute='0', hour='*/2'),
|
||||
'kwargs': {
|
||||
'limit': 100,
|
||||
},
|
||||
# 'daily_database_backup': {
|
||||
# 'task': 'api_v1.tasks.backup_database',
|
||||
# 'schedule': crontab(hour=3, minute=0),
|
||||
# 'kwargs': {
|
||||
# 'output_dir': str(BASE_DIR / 'data-bak'),
|
||||
# 'filename_prefix': 'db-backup',
|
||||
# },
|
||||
# },
|
||||
# 'daily_settlement': {
|
||||
# 'task': 'settlement.tasks.run_daily_settlement',
|
||||
# 'schedule': crontab(
|
||||
# hour=SETTLEMENT_RUN_HOUR,
|
||||
# minute=SETTLEMENT_RUN_MINUTE
|
||||
# ),
|
||||
# },
|
||||
# 'daily_plate_order_tiia_image_upload': {
|
||||
# 'task': 'printing.tasks.upload_yesterday_plate_order_images_to_tencent_tiia',
|
||||
# 'schedule': crontab(hour=3, minute=0),
|
||||
# },
|
||||
# 'daily_mdy_plate_order_staging_tiia_image_upload': {
|
||||
# 'task': 'api_v1.tasks.upload_mdy_plate_order_staging_images_to_tencent_tiia',
|
||||
# 'schedule': crontab(hour=3, minute=20),
|
||||
# 'kwargs': {
|
||||
# 'batch_size': 500,
|
||||
# 'dry_run': False,
|
||||
# },
|
||||
# },
|
||||
# 'mdy_product_sync': {
|
||||
# 'task': 'api_v1.tasks.sync_mdy_products',
|
||||
# 'schedule': crontab(minute='*/10'),
|
||||
# 'kwargs': {
|
||||
# 'page_size': MDY_SYNC_PAGE_SIZE,
|
||||
# 'max_pages': MDY_SYNC_MAX_PAGES,
|
||||
# 'max_records': MDY_SYNC_MAX_RECORDS,
|
||||
# },
|
||||
# },
|
||||
# 'mdy_customer_sync': {
|
||||
# 'task': 'api_v1.tasks.sync_mdy_customers',
|
||||
# 'schedule': crontab(minute='*/5'),
|
||||
# 'kwargs': {
|
||||
# 'page_size': MDY_SYNC_PAGE_SIZE,
|
||||
# 'max_pages': MDY_SYNC_MAX_PAGES,
|
||||
# 'max_records': MDY_SYNC_MAX_RECORDS,
|
||||
# },
|
||||
# },
|
||||
# 'printing_external_records_sync': {
|
||||
# 'task': 'api_v1.tasks.sync_external_printing_records',
|
||||
# 'schedule': crontab(minute='*/5'),
|
||||
# 'kwargs': {
|
||||
# 'limit': 100,
|
||||
# },
|
||||
# },
|
||||
# 'notify_unreplied_missions_every_minute': {
|
||||
# 'task': 'notifier.tasks.notify_unreplied_missions_task',
|
||||
# 'schedule': crontab(minute='*'),
|
||||
# 'kwargs': {
|
||||
# 'limit': 100,
|
||||
# },
|
||||
# },
|
||||
# 'backfill_external_product_images_hourly': {
|
||||
# 'task': 'api_v1.tasks.backfill_external_product_images',
|
||||
# 'schedule': crontab(minute=17),
|
||||
# 'kwargs': {
|
||||
# 'limit': 500,
|
||||
# 'dry_run': False,
|
||||
# },
|
||||
# },
|
||||
# 'retry_external_printing_sync_failures_every_120_minutes': {
|
||||
# 'task': 'api_v1.tasks.retry_external_printing_sync_failures',
|
||||
# 'schedule': crontab(minute='0', hour='*/2'),
|
||||
# 'kwargs': {
|
||||
# 'limit': 100,
|
||||
# },
|
||||
# },
|
||||
# 外部财务同步:每天凌晨 5 点同步指定客户列表的对账数据
|
||||
'sync_external_customer_finance_daily': {
|
||||
'task': 'business.tasks.sync_external_customer_finance_scheduled',
|
||||
'schedule': crontab(hour=5, minute=0),
|
||||
},
|
||||
# 明道云开版:同步到“暂存表”
|
||||
# - 仅在 02:00-08:00 时间窗内持续运行(每 N 分钟触发一次)
|
||||
# - 通过 request_interval_seconds 控制单次任务对明道云 API 的请求节奏,避免超 QPS
|
||||
'mdy_plate_order_staging_sync': {
|
||||
'task': 'api_v1.tasks.sync_mdy_plate_orders',
|
||||
# 02:00 - 07:59(不包含 08:xx)
|
||||
'schedule': crontab(minute='*/2', hour='2-7'),
|
||||
'kwargs': {
|
||||
'page_size': max(1, int(MDY_SYNC_PAGE_SIZE)),
|
||||
'max_pages': max(1, int(MDY_SYNC_MAX_PAGES)),
|
||||
'max_records': max(1, int(MDY_SYNC_MAX_RECORDS)),
|
||||
'with_related': True,
|
||||
'max_related_per_type': 5,
|
||||
'request_interval_seconds': float(MDY_PLATE_ORDER_SYNC_REQUEST_INTERVAL_SECONDS),
|
||||
},
|
||||
},
|
||||
# 'mdy_plate_order_staging_sync': {
|
||||
# 'task': 'api_v1.tasks.sync_mdy_plate_orders',
|
||||
# # 02:00 - 07:59(不包含 08:xx)
|
||||
# 'schedule': crontab(minute='*/2', hour='2-7'),
|
||||
# 'kwargs': {
|
||||
# 'page_size': max(1, int(MDY_SYNC_PAGE_SIZE)),
|
||||
# 'max_pages': max(1, int(MDY_SYNC_MAX_PAGES)),
|
||||
# 'max_records': max(1, int(MDY_SYNC_MAX_RECORDS)),
|
||||
# 'with_related': True,
|
||||
# 'max_related_per_type': 5,
|
||||
# 'request_interval_seconds': float(MDY_PLATE_ORDER_SYNC_REQUEST_INTERVAL_SECONDS),
|
||||
# },
|
||||
# },
|
||||
}
|
||||
|
||||
if MDY_ISOLATED_MERCHANT_ID and MDY_ISOLATED_MERCHANT_ID > 0:
|
||||
|
||||
Reference in New Issue
Block a user