1
0
forked from erp-dev/erp

feat: added mdy stagging upload to tiia, and change outgoing_date to datetime type

This commit is contained in:
2026-01-22 17:06:23 +08:00
parent 49ac17cf37
commit 7fd44c64aa
18 changed files with 661 additions and 11 deletions

View File

@@ -92,6 +92,7 @@ class DataSync(ModelBase):
PRODUCT = 'product', '产品'
CUSTOMER = 'customer', '客户'
PLATE_ORDER = 'plate_order', '开版(明道云)'
MDY_PLATE_ORDER_STAGING_TIIA_UPLOAD = 'mdy_plate_order_staging_tiia_upload', '开版暂存-腾讯图库上传'
table_name = models.CharField(max_length=50, choices=TableName.choices, verbose_name='同步目标')
page_index = models.PositiveIntegerField(default=1, verbose_name='页码')
@@ -173,6 +174,44 @@ class MDYPlateOrderStaging(ModelBase):
return f'{self.mdy_rowid}'
class MDYPlateOrderStagingTiiaUploadFailure(ModelBase):
"""
明道云开版暂存MDYPlateOrderStaging图片上传到腾讯云 TIIA 失败记录。
说明:
- 用于定时任务/批处理的失败落库,便于后续排查与补偿重试
- 以 (run_date, mdy_rowid) 唯一,避免同一天重复刷屏
"""
run_date = models.DateField(db_index=True, verbose_name='任务日期')
mdy_rowid = models.CharField(max_length=64, db_index=True, verbose_name='明道云 RowID')
staging_id = models.PositiveBigIntegerField(null=True, blank=True, db_index=True, verbose_name='暂存表ID')
error = models.TextField(blank=True, verbose_name='错误摘要')
details = models.JSONField(
default=list,
blank=True,
verbose_name='错误详情',
help_text='通常存储上传 service 返回的失败条目列表',
)
attempts = models.PositiveIntegerField(default=0, verbose_name='尝试次数')
last_attempt_at = models.DateTimeField(null=True, blank=True, verbose_name='最后尝试时间')
class Meta:
db_table = 'api_mdy_plate_order_staging_tiia_upload_failure'
verbose_name = '开版暂存图片上传失败记录'
verbose_name_plural = '开版暂存图片上传失败记录'
ordering = ['-created_at']
constraints = [
models.UniqueConstraint(
fields=['run_date', 'mdy_rowid'],
name='uniq_mdy_po_staging_tiia_fail_run_date_rowid',
)
]
def __str__(self):
return f'{self.run_date} {self.mdy_rowid}'
class ApiAuditLog(models.Model):
"""API审计日志 - 记录创建操作的历史现场