From 47c42d1a19c720b41d4ffc69df2f0ee3a47429ba Mon Sep 17 00:00:00 2001 From: z66 <1415243231@qq.com> Date: Wed, 24 Sep 2025 14:09:08 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9D=9E=E6=A0=87=E4=B8=9A=E7=BB=A9=E6=8F=90?= =?UTF-8?q?=E6=8A=A5=E3=80=81=E5=90=88=E4=BC=99=E4=BA=BA=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back_ground_module/logs/task.log | 19 +++++++++++++++++++ .../non_standar_performance_to_BI.py | 5 ++++- .../partner_settlement_to_BI.py | 13 ++++++++++++- doc/更新记录.md | 12 +++++++++++- test/BI.ipynb | 12 ++++++------ 5 files changed, 52 insertions(+), 9 deletions(-) diff --git a/back_ground_module/logs/task.log b/back_ground_module/logs/task.log index 48be72d..e362e49 100644 --- a/back_ground_module/logs/task.log +++ b/back_ground_module/logs/task.log @@ -33548,3 +33548,22 @@ 2025-09-24 12:35:59,266 - api.py - task_logger - INFO - 多数据写入行数: 348 2025-09-24 12:36:00,709 - import_performance_data.py - task_logger - INFO - 简道云数据写入完成 2025-09-24 12:36:00,906 - common_module.py - task_logger - INFO - 任务状态发送成功: {'data': {'creator': {'name': 'F6汽车科技', 'username': '#admin', 'status': 1, 'type': 0}, 'updater': {'name': 'F6汽车科技', 'username': '#admin', 'status': 1, 'type': 0}, 'deleter': None, 'createTime': '2025-09-24T04:36:03.757Z', 'updateTime': '2025-09-24T04:36:03.757Z', 'deleteTime': None, '_widget_1744873387500': '2025-09-24T00:00:00.000Z', '_widget_1743644977694': '履约表数据支撑', '_widget_1744873387501': '2025-09-24T03:57:42.000Z', '_widget_1744873387502': '2025-09-24T04:36:00.000Z', '_widget_1744873387504': '2298', '_id': '68d375334fa1c642a7855db6', 'appId': '6694d3c4fcb69ca9a111a6c4', 'entryId': '67ede908eb9c22261016466e'}} +2025-09-24 13:56:43,367 - non_standar_performance_to_BI.py - task_logger - INFO - 任务开始 +2025-09-24 13:56:43,692 - partner_settlement_to_BI.py - task_logger - INFO - 任务开始 +2025-09-24 13:56:43,898 - api.py - task_logger - INFO - 已获取 100 条数据 +2025-09-24 13:56:44,008 - api.py - task_logger - INFO - 已获取 107 条数据 +2025-09-24 13:56:44,096 - partner_settlement_to_BI.py - task_logger - INFO - 加载数据完成 +2025-09-24 13:56:44,112 - partner_settlement_to_BI.py - task_logger - INFO - 数据处理完成 +2025-09-24 13:56:44,322 - partner_settlement_to_BI.py - task_logger - INFO - 目标数据库已清空 +2025-09-24 13:56:46,371 - partner_settlement_to_BI.py - task_logger - INFO - 成功写入 132 条记录到 partner_settlement_to_BI 表中。 +2025-09-24 13:56:46,372 - partner_settlement_to_BI.py - task_logger - INFO - 数据已写入数据库中 +2025-09-24 13:56:46,492 - common_module.py - task_logger - INFO - 任务状态发送成功: {'data': {'creator': {'name': 'F6汽车科技', 'username': '#admin', 'status': 1, 'type': 0}, 'updater': {'name': 'F6汽车科技', 'username': '#admin', 'status': 1, 'type': 0}, 'deleter': None, 'createTime': '2025-09-24T05:56:49.237Z', 'updateTime': '2025-09-24T05:56:49.237Z', 'deleteTime': None, '_widget_1744873387500': '2025-09-24T00:00:00.000Z', '_widget_1743644977694': '合伙人结算登记同步到BI', '_widget_1744873387501': '2025-09-24T05:56:43.000Z', '_widget_1744873387502': '2025-09-24T05:56:46.000Z', '_widget_1744873387504': '3', '_id': '68d388218cbedea06c6bad73', 'appId': '6694d3c4fcb69ca9a111a6c4', 'entryId': '67ede908eb9c22261016466e'}} +2025-09-24 13:56:47,709 - api.py - task_logger - INFO - 已获取 12 条数据 +2025-09-24 13:56:47,802 - non_standar_performance_to_BI.py - task_logger - INFO - 加载数据完成 +2025-09-24 13:56:47,815 - non_standar_performance_to_BI.py - task_logger - INFO - 数据处理完成 +2025-09-24 13:56:47,981 - non_standar_performance_to_BI.py - task_logger - INFO - 成功清空表 non_standard_performance_to_BI 中的所有数据 +2025-09-24 13:56:47,993 - non_standar_performance_to_BI.py - task_logger - INFO - 数据库连接已关闭 +2025-09-24 13:56:47,993 - non_standar_performance_to_BI.py - task_logger - INFO - 目标数据库已清空 +2025-09-24 13:56:48,277 - non_standar_performance_to_BI.py - task_logger - INFO - 成功写入 12 条记录到 non_standard_performance_to_BI 表中。 +2025-09-24 13:56:48,278 - non_standar_performance_to_BI.py - task_logger - INFO - 数据已写入数据库中 +2025-09-24 13:56:48,637 - common_module.py - task_logger - INFO - 任务状态发送成功: {'data': {'creator': {'name': 'F6汽车科技', 'username': '#admin', 'status': 1, 'type': 0}, 'updater': {'name': 'F6汽车科技', 'username': '#admin', 'status': 1, 'type': 0}, 'deleter': None, 'createTime': '2025-09-24T05:56:51.363Z', 'updateTime': '2025-09-24T05:56:51.363Z', 'deleteTime': None, '_widget_1744873387500': '2025-09-24T00:00:00.000Z', '_widget_1743644977694': '非标业绩提报转BI', '_widget_1744873387501': '2025-09-24T05:56:43.000Z', '_widget_1744873387502': '2025-09-24T05:56:48.000Z', '_widget_1744873387504': '5', '_id': '68d388238cdf57159e111ff7', 'appId': '6694d3c4fcb69ca9a111a6c4', 'entryId': '67ede908eb9c22261016466e'}} diff --git a/back_ground_module/non_standar_performance_to_BI.py b/back_ground_module/non_standar_performance_to_BI.py index 0f12fbf..17622b2 100644 --- a/back_ground_module/non_standar_performance_to_BI.py +++ b/back_ground_module/non_standar_performance_to_BI.py @@ -60,6 +60,9 @@ class NonStandardPerformanceToBI: "新签阶段及提成比例.选择提成阶段": "_widget_1753778656359._widget_1753778656361", "新签阶段及提成比例.新签阶段": "_widget_1753778656359._widget_1753948745962", "新签阶段及提成比例.提成比例": "_widget_1753778656359._widget_1753778656362", + "提交人": "creator", + "提交时间": "createTime", + "更新时间": "updateTime" } # 定义需要特殊处理的列表字段及其内部字段映射 @@ -122,7 +125,7 @@ class NonStandardPerformanceToBI: df[col] = df[col].map(lambda x: x.get("name", "") if isinstance(x, dict) else "") # 3.日期字段转为北京时间 - time_columns = ["支付日期", "开户/处理日期"] + time_columns = ["支付日期", "开户/处理日期","提交时间","更新时间"] df[time_columns] = df[time_columns].apply( lambda col: pd.to_datetime(col, errors='coerce') diff --git a/back_ground_module/partner_settlement_to_BI.py b/back_ground_module/partner_settlement_to_BI.py index f3c154f..0d332f5 100644 --- a/back_ground_module/partner_settlement_to_BI.py +++ b/back_ground_module/partner_settlement_to_BI.py @@ -53,6 +53,8 @@ class PartnerSettlementToBI: "特殊情况备注": "_widget_1712805391035", "合伙人介绍证明(微信聊天截图等)": "_widget_1712815331256", "合伙人类型": "_widget_1753957844818", + "提交时间": "createTime", + "更新时间": "updateTime" } # 定义需要特殊处理的列表字段及其内部字段映射 @@ -124,7 +126,16 @@ class PartnerSettlementToBI: for col in user_columns: df[col] = df[col].map(lambda x: x.get("name", "") if isinstance(x, dict) else "") - # 3.处理订单登记表列表字段,将其拆分成多行 + # 3.日期字段转为北京时间 + time_columns = ["提交时间", "更新时间"] + + df[time_columns] = df[time_columns].apply( + lambda col: pd.to_datetime(col, errors='coerce') + .dt.tz_localize(None) + .dt.strftime('%Y-%m-%d %H:%M:%S') + ) + + # 4.处理订单登记表列表字段,将其拆分成多行 if "订单登记表" in df.columns: # 先处理订单登记表字段 df["订单登记表"] = df["订单登记表"].apply( diff --git a/doc/更新记录.md b/doc/更新记录.md index 9dde7a5..ba4c052 100644 --- a/doc/更新记录.md +++ b/doc/更新记录.md @@ -52,7 +52,17 @@ common_module 增加日期字段转UTC 方法,支持处理Timestamp输入与 ## 1.7更新 -新增合伙人结算登记同步到BI、非标业绩提报脚本 +新增合伙人结算登记同步到BI、非标业绩提报脚本高德api匹配手机号脚本 + +数据源账号更新 + +简道云成员id与字段监控分离 + +完善接车宝空数据处理 + +异常回访新增过滤逻辑 + + diff --git a/test/BI.ipynb b/test/BI.ipynb index ed4078c..f8b303d 100644 --- a/test/BI.ipynb +++ b/test/BI.ipynb @@ -257,8 +257,8 @@ { "metadata": { "ExecuteTime": { - "end_time": "2025-09-05T06:57:23.280139Z", - "start_time": "2025-09-05T06:57:22.995373Z" + "end_time": "2025-09-24T05:56:32.216878Z", + "start_time": "2025-09-24T05:56:31.974390Z" } }, "cell_type": "code", @@ -274,8 +274,8 @@ "} # 衡时数据库链接配置-mysql\n", "# table_name = \"new_dealer_service_order_to_bi\" # 替换为你的实际表名\n", "\n", - "table_name = \"new_dealer_service_order_to_bi\"\n", - "column_name = \"不进行滞销回抽盘点介绍原因\"\n", + "table_name = \"partner_settlement_to_BI\"\n", + "column_name = \"提交时间\"\n", "# new_column_type = \"VARCHAR(255)\" # 目标数据类型\n", "new_column_type = \"DATETIME\" # 目标数据类型\n", "\n", @@ -336,12 +336,12 @@ "name": "stdout", "output_type": "stream", "text": [ - "✅ 成功添加字段: `Contract start date`\n", + "✅ 成功添加字段: `提交时间`\n", "数据库连接已关闭\n" ] } ], - "execution_count": 2 + "execution_count": 4 }, { "metadata": {},