海外客户档案同步简bi修复
This commit is contained in:
Generated
+7
@@ -3,6 +3,13 @@
|
||||
<component name="CsvFileAttributes">
|
||||
<option name="attributeMap">
|
||||
<map>
|
||||
<entry key="\back_ground_module\DF.csv">
|
||||
<value>
|
||||
<Attribute>
|
||||
<option name="separator" value="," />
|
||||
</Attribute>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="\db\task_queue.csv">
|
||||
<value>
|
||||
<Attribute>
|
||||
|
||||
@@ -2,3 +2,14 @@
|
||||
2025-11-17 17:08:41,207 - Exception_Task.py - error_task_logger - ERROR - 异常服务待办派发执行时发生异常: [Errno 13] Permission denied: 'output\\异常派发.csv'
|
||||
2025-11-18 09:04:21,887 - update_BI_CRM_info.py - error_task_logger - ERROR - 任务简道云海外项目CRM客户档案迁移BI执行失败。
|
||||
2025-11-18 09:06:54,279 - update_BI_CRM_info.py - error_task_logger - ERROR - 任务简道云海外项目CRM客户档案迁移BI执行失败。
|
||||
2025-11-18 09:09:10,231 - update_BI_CRM_info.py - error_task_logger - ERROR - 任务简道云海外项目CRM客户档案迁移BI执行失败。
|
||||
2025-11-18 09:11:15,907 - update_BI_CRM_info.py - error_task_logger - ERROR - 导入数据时发生错误: Failed executing the operation; Python type dict cannot be converted
|
||||
2025-11-18 09:11:16,451 - update_BI_CRM_info.py - error_task_logger - ERROR - 任务简道云海外项目CRM客户档案迁移BI执行失败。
|
||||
2025-11-18 09:14:02,671 - update_BI_CRM_info.py - error_task_logger - ERROR - 任务简道云海外项目CRM客户档案迁移BI执行失败。
|
||||
2025-11-18 09:14:18,875 - update_BI_CRM_info.py - error_task_logger - ERROR - 导入数据时发生错误: 1054 (42S22): Unknown column 'nan' in 'field list'
|
||||
2025-11-18 09:14:19,185 - update_BI_CRM_info.py - error_task_logger - ERROR - 任务简道云海外项目CRM客户档案迁移BI执行失败。
|
||||
2025-11-18 09:15:37,826 - update_BI_CRM_info.py - error_task_logger - ERROR - 导入数据时发生错误: 1054 (42S22): Unknown column 'nan' in 'field list'
|
||||
2025-11-18 09:15:38,068 - update_BI_CRM_info.py - error_task_logger - ERROR - 任务简道云海外项目CRM客户档案迁移BI执行失败。
|
||||
2025-11-18 09:16:52,668 - update_BI_CRM_info.py - error_task_logger - ERROR - 任务简道云海外项目CRM客户档案迁移BI执行失败。
|
||||
2025-11-18 09:17:05,585 - update_BI_CRM_info.py - error_task_logger - ERROR - 导入数据时发生错误: 1054 (42S22): Unknown column 'nan' in 'field list'
|
||||
2025-11-18 09:17:05,912 - update_BI_CRM_info.py - error_task_logger - ERROR - 任务简道云海外项目CRM客户档案迁移BI执行失败。
|
||||
|
||||
@@ -9,6 +9,8 @@ from back_ground_module import CommonModule
|
||||
import numpy as np
|
||||
from config import Config
|
||||
from log_config import configure_task_logger, configure_error_task_logger
|
||||
import os
|
||||
import json
|
||||
|
||||
common_module = CommonModule()
|
||||
|
||||
@@ -18,6 +20,9 @@ logger = configure_task_logger()
|
||||
# 获取已经配置好的错误任务日志记录器
|
||||
error_task_logger = configure_error_task_logger()
|
||||
|
||||
# 设置输出目录
|
||||
output_dir = "output"
|
||||
os.makedirs(output_dir, exist_ok=True)
|
||||
|
||||
class CRMDataProcessor:
|
||||
"""泰国CRM数据迁移到BI"""
|
||||
@@ -187,10 +192,11 @@ class CRMDataProcessor:
|
||||
|
||||
def process_data(self, df):
|
||||
"""处理CRM数据"""
|
||||
# 去掉前六列和后两列
|
||||
df.to_csv("CRM.csv", index=False)
|
||||
df = df.iloc[:, 6:-2]
|
||||
print(df)
|
||||
# 保留第一列,去掉2-7列和后两列
|
||||
# df.to_csv(os.path.join(output_dir, "CRM.csv"), index=False)
|
||||
df = df.copy()
|
||||
df = df.iloc[:, [0] + list(range(6, df.shape[1] - 2))] # shape【1】含义,df的列数,第二维度的大小shape(行,列)
|
||||
# df.to_csv(os.path.join(output_dir, "CRM_processed.csv"), index=False)
|
||||
|
||||
# 生成URL
|
||||
base_url = f"https://www.jiandaoyun.com/dashboard/app/{self.api_key}/form/{self.entry_id}/data/"
|
||||
@@ -303,6 +309,7 @@ class CRMDataProcessor:
|
||||
self.close_db()
|
||||
|
||||
def import_data(self, df, table_name):
|
||||
# 不支持json的值
|
||||
try:
|
||||
self.connect_db()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user