Commit 834d83a7 authored by 邱阿朋's avatar 邱阿朋

feat(app): 添加协议类型字段并优化数据处理逻辑

- 在处理 coop 信息时,添加了协议类型字段
- 根据协议标题中的关键词,判断并设置协议类型
- 在推送数据时,添加协议类型字段
- 优化了数据处理逻辑,提高了代码可读性和维护性
parent de519bda
......@@ -119,8 +119,8 @@ class Spa(AutoInterface):
vendor_funding = item.get("Vendor Funding In Agreement Currency", None)
processed_item = item.copy()
processed_item.pop("Title")
processed_item.pop("Asin")
processed_item["Agreement title"] = coop.get("Agreement title")
processed_item["Invoice date"] = coop.get("Invoice date")
processed_item['Funding Type'] = coop.get("Funding Type")
processed_item['Asin'] = asin
......@@ -147,7 +147,6 @@ class Spa(AutoInterface):
vendor_funding = item.get("Vendor Funding In Agreement Currency", None)
processed_item = coop.copy()
processed_item.pop("Agreement title")
processed_item.pop("Original balance")
processed_item.pop("Invoice date")
if "Funding Type" in processed_item.keys():
......@@ -210,6 +209,16 @@ class Spa(AutoInterface):
else:
parent_id = sheet_name
# 协议类型
agreement_type = 0
agreement_title = item_row.get("Agreement title")
if "4.22%" in agreement_title:
agreement_type = 3
if "5.5%" in agreement_title:
agreement_type = 2
if "10.0%" in agreement_title:
agreement_type = 1
push_data = {
'ad_date': item_row.get('Invoice date', ""), # spa费用数据日期
'erp_sku': item_row.get('ERP SKU', ""), # ERP SKU
......@@ -224,6 +233,7 @@ class Spa(AutoInterface):
'type': 2, # 1 sheet1 2 其他sheet
'parent_id': parent_id, # sheet1 为Invoice ID 其他sheet为sheet名称
'order_no': item_row.get('Purchase Order', ""), # 订单号
'agreement_title': agreement_type
}
# 推送数据
rabbit.send_message(push_data)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment