异常回访提交

This commit is contained in:
z66
2025-10-24 09:22:19 +08:00
parent d9d52df726
commit f212bd6a12
5 changed files with 41665 additions and 23 deletions
+3 -1
View File
@@ -139,11 +139,12 @@ class CommonModule:
# 获取指定天数前的日期 # 获取指定天数前的日期
now_time = datetime.now() now_time = datetime.now()
target_time = now_time + timedelta(days=-days_back) target_time = now_time + timedelta(days=-days_back)
target_date_id = int(target_time.strftime('%Y%m%d')) # 获取目标日期 target_date_id = int(target_time.strftime('%Y%m%d')) # 获取目标日期
# sql语句查询 # sql语句查询
sql = f"""SELECT * FROM "public"."holo_ads_dataservice_saas_org_health_warning" WHERE "pt" = '{target_date_id}' and "org_type" = '一般';""" sql = f"""-- SELECT * FROM "public"."holo_ads_dataservice_saas_org_health_warning" WHERE "pt" = '{target_date_id}' and "org_type" = '一般';"""
# 执行语句并获取结果集 # 执行语句并获取结果集
cursor.execute(sql) cursor.execute(sql)
@@ -165,6 +166,7 @@ class CommonModule:
cursor.close() cursor.close()
conn.close() conn.close()
return data_yichang return data_yichang
except Exception as e: except Exception as e:
File diff suppressed because it is too large Load Diff
+2
View File
@@ -16,3 +16,5 @@
2025-09-26 13:52:38,421 - ngv更新.py - error_task_logger - ERROR - NGV更新数据执行时发生异常: [Errno 13] Permission denied: 'output\\only_in_temp_jdy.csv' 2025-09-26 13:52:38,421 - ngv更新.py - error_task_logger - ERROR - NGV更新数据执行时发生异常: [Errno 13] Permission denied: 'output\\only_in_temp_jdy.csv'
2025-09-26 17:42:51,517 - ngv更新.py - error_task_logger - ERROR - NGV更新数据执行时发生异常: [Errno 13] Permission denied: 'output\\only_in_temp_jdy.csv' 2025-09-26 17:42:51,517 - ngv更新.py - error_task_logger - ERROR - NGV更新数据执行时发生异常: [Errno 13] Permission denied: 'output\\only_in_temp_jdy.csv'
2025-09-26 17:54:44,808 - ngv更新.py - error_task_logger - ERROR - NGV更新数据执行时发生异常: 'org_code' 2025-09-26 17:54:44,808 - ngv更新.py - error_task_logger - ERROR - NGV更新数据执行时发生异常: 'org_code'
2025-10-23 17:50:48,142 - 异常回访排查.py - error_task_logger - ERROR - 异常服务待办派发执行时发生异常: 'NoneType' object has no attribute 'astype'
2025-10-23 17:51:08,065 - 异常回访排查.py - error_task_logger - ERROR - 异常服务待办派发执行时发生异常: 'NoneType' object has no attribute 'astype'
+15
View File
@@ -1059,3 +1059,18 @@
2025-10-15 15:14:12,294 - 4281365028.py - task_logger - INFO - 数据加载完成 2025-10-15 15:14:12,294 - 4281365028.py - task_logger - INFO - 数据加载完成
2025-10-15 15:14:36,032 - 4281365028.py - task_logger - INFO - 时间转换完成 2025-10-15 15:14:36,032 - 4281365028.py - task_logger - INFO - 时间转换完成
2025-10-15 15:14:36,045 - 4281365028.py - task_logger - INFO - 人员转换完成 2025-10-15 15:14:36,045 - 4281365028.py - task_logger - INFO - 人员转换完成
2025-10-23 17:35:15,845 - api.py - task_logger - WARNING - 请求异常: HTTPSConnectionPool(host='api.jiandaoyun.com', port=443): Read timed out. (read timeout=10), 将重新请求
2025-10-23 17:35:28,869 - api.py - task_logger - INFO - 获取了3670条数据
2025-10-23 17:35:29,318 - api.py - task_logger - INFO - 获取了146条数据
2025-10-23 17:39:08,288 - api.py - task_logger - INFO - 获取了42941条数据
2025-10-23 17:39:30,025 - api.py - task_logger - INFO - 获取了4044条数据
2025-10-23 17:39:30,702 - 异常回访排查.py - task_logger - INFO - 开始运行SaaS异常回访
2025-10-23 17:39:30,857 - 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-10-23T09:39:31.658Z', 'updateTime': '2025-10-23T09:39:31.658Z', 'deleteTime': None, '_widget_1744873387500': '2025-10-23T00:00:00.000Z', '_widget_1743644977694': '异常服务待办派发', '_widget_1744873387501': '2025-10-23T09:35:00.000Z', '_widget_1744873387502': '2025-10-23T09:39:30.000Z', '_widget_1744873387504': '270', '_id': '68f9f7d31a14fafa3c3d62cb', 'appId': '6694d3c4fcb69ca9a111a6c4', 'entryId': '67ede908eb9c22261016466e'}}
2025-10-23 17:42:50,287 - api.py - task_logger - INFO - 获取了146条数据
2025-10-23 17:42:50,288 - 3381905813.py - task_logger - INFO - 数据加载完成
2025-10-23 17:43:17,224 - 3381905813.py - task_logger - INFO - 时间转换完成
2025-10-23 17:43:17,245 - 3381905813.py - task_logger - INFO - 人员转换完成
2025-10-23 17:46:55,514 - 异常回访排查.py - task_logger - INFO - 开始运行SaaS异常回访
2025-10-23 17:46:55,662 - 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-10-23T09:46:56.461Z', 'updateTime': '2025-10-23T09:46:56.461Z', 'deleteTime': None, '_widget_1744873387500': '2025-10-23T00:00:00.000Z', '_widget_1743644977694': '异常服务待办派发', '_widget_1744873387501': '2025-10-23T09:46:55.000Z', '_widget_1744873387502': '2025-10-23T09:46:55.000Z', '_widget_1744873387504': '0', '_id': '68f9f99039b7e0a47e88475b', 'appId': '6694d3c4fcb69ca9a111a6c4', 'entryId': '67ede908eb9c22261016466e'}}
2025-10-23 17:50:48,282 - 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-10-23T09:50:49.086Z', 'updateTime': '2025-10-23T09:50:49.086Z', 'deleteTime': None, '_widget_1744873387500': '2025-10-23T00:00:00.000Z', '_widget_1743644977694': '异常服务待办派发', '_widget_1744873387501': '2025-10-23T09:50:48.000Z', '_widget_1744873387502': '2025-10-23T09:50:48.000Z', '_widget_1744873387504': '0', '_widget_1754981992215': "'NoneType' object has no attribute 'astype'", '_id': '68f9fa7990af7e45f306b10a', 'appId': '6694d3c4fcb69ca9a111a6c4', 'entryId': '689ae65da00c17578e27cd74'}}
2025-10-23 17:51:08,186 - 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-10-23T09:51:08.994Z', 'updateTime': '2025-10-23T09:51:08.994Z', 'deleteTime': None, '_widget_1744873387500': '2025-10-23T00:00:00.000Z', '_widget_1743644977694': '异常服务待办派发', '_widget_1744873387501': '2025-10-23T09:51:07.000Z', '_widget_1744873387502': '2025-10-23T09:51:08.000Z', '_widget_1744873387504': '1', '_widget_1754981992215': "'NoneType' object has no attribute 'astype'", '_id': '68f9fa8c90af7e45f306bd1b', 'appId': '6694d3c4fcb69ca9a111a6c4', 'entryId': '689ae65da00c17578e27cd74'}}
+30 -22
View File
@@ -526,8 +526,8 @@
{ {
"metadata": { "metadata": {
"ExecuteTime": { "ExecuteTime": {
"end_time": "2025-10-15T07:14:36.277142Z", "end_time": "2025-10-23T09:43:17.547186Z",
"start_time": "2025-10-15T07:14:11.975620Z" "start_time": "2025-10-23T09:42:48.434237Z"
} }
}, },
"cell_type": "code", "cell_type": "code",
@@ -583,8 +583,9 @@
" self.load_all_data()\n", " self.load_all_data()\n",
" logger.info(f\"数据加载完成\")\n", " logger.info(f\"数据加载完成\")\n",
"\n", "\n",
" data_NGV_j = common_module.get_ngv_details(days_back=2)\n", " data_NGV_j = common_module.get_ngv_details(days_back=1)\n",
" data_NGV_j1 = common_module.get_ngv_details(days_back=3)\n", " data_NGV_j.to_csv(os.path.join(output_dir, f\"data_NGV_j.csv\"), index=False)\n",
" data_NGV_j1 = common_module.get_ngv_details(days_back=2)\n",
"\n", "\n",
" # 找出在 data_NGV_j 中存在但在 data_NGV_j1 中不存在的 data_id\n", " # 找出在 data_NGV_j 中存在但在 data_NGV_j1 中不存在的 data_id\n",
" unique_data_ids = data_NGV_j[~data_NGV_j['org_code'].isin(data_NGV_j1['org_code'])]\n", " unique_data_ids = data_NGV_j[~data_NGV_j['org_code'].isin(data_NGV_j1['org_code'])]\n",
@@ -642,7 +643,7 @@
" # all_data = [self.row_to_dict(row, self.field_mapping) for index, row in data_NGV_j1.iterrows()] # 前两天的全部数据\n", " # all_data = [self.row_to_dict(row, self.field_mapping) for index, row in data_NGV_j1.iterrows()] # 前两天的全部数据\n",
" # all_data = [self.row_to_dict(row, self.field_mapping) for index, row in data_NGV_j.iterrows()] # 前一天的全部数据\n", " # all_data = [self.row_to_dict(row, self.field_mapping) for index, row in data_NGV_j.iterrows()] # 前一天的全部数据\n",
" all_data = [self.row_to_dict(row, self.field_mapping) for index, row in filtered_df.iterrows()] # 增量数据\n", " all_data = [self.row_to_dict(row, self.field_mapping) for index, row in filtered_df.iterrows()] # 增量数据\n",
" filtered_df.to_csv(output_dir + \"\\\\filtered_df.csv\", index=False)\n", " # filtered_df.to_csv(output_dir + \"\\\\filtered_df.csv\", index=False)\n",
"\n", "\n",
"\n", "\n",
" #\n", " #\n",
@@ -779,92 +780,99 @@
], ],
"id": "6ce49b7686e91712", "id": "6ce49b7686e91712",
"outputs": [ "outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"dfc264b77bee3205aaf2099572a46c57\n",
"已获取 100 条数据\n"
]
},
{ {
"name": "stderr", "name": "stderr",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"\u001B[92m2025-10-15 15:14:12,293 - api.py - task_logger - INFO - 获取了145条数据\u001B[0m\n" "\u001B[92m2025-10-23 17:42:50,287 - api.py - task_logger - INFO - 获取了146条数据\u001B[0m\n",
"\u001B[92m2025-10-23 17:42:50,288 - 3381905813.py - task_logger - INFO - 数据加载完成\u001B[0m\n"
] ]
}, },
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"已获取 100 条数据\n", "已获取 146 条数据\n"
"已获取 145 条数据\n"
] ]
}, },
{ {
"name": "stderr", "name": "stderr",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"\u001B[92m2025-10-15 15:14:12,294 - 4281365028.py - task_logger - INFO - 数据加载完成\u001B[0m\n", "C:\\Users\\zy187\\AppData\\Local\\Temp\\ipykernel_24808\\3381905813.py:77: SettingWithCopyWarning: \n",
"C:\\Users\\zy187\\AppData\\Local\\Temp\\ipykernel_5028\\4281365028.py:76: SettingWithCopyWarning: \n",
"A value is trying to be set on a copy of a slice from a DataFrame.\n", "A value is trying to be set on a copy of a slice from a DataFrame.\n",
"Try using .loc[row_indexer,col_indexer] = value instead\n", "Try using .loc[row_indexer,col_indexer] = value instead\n",
"\n", "\n",
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
" filtered_df[col + '_date'] = (\n", " filtered_df[col + '_date'] = (\n",
"C:\\Users\\zy187\\AppData\\Local\\Temp\\ipykernel_5028\\4281365028.py:76: SettingWithCopyWarning: \n", "C:\\Users\\zy187\\AppData\\Local\\Temp\\ipykernel_24808\\3381905813.py:77: SettingWithCopyWarning: \n",
"A value is trying to be set on a copy of a slice from a DataFrame.\n", "A value is trying to be set on a copy of a slice from a DataFrame.\n",
"Try using .loc[row_indexer,col_indexer] = value instead\n", "Try using .loc[row_indexer,col_indexer] = value instead\n",
"\n", "\n",
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
" filtered_df[col + '_date'] = (\n", " filtered_df[col + '_date'] = (\n",
"C:\\Users\\zy187\\AppData\\Local\\Temp\\ipykernel_5028\\4281365028.py:76: SettingWithCopyWarning: \n", "C:\\Users\\zy187\\AppData\\Local\\Temp\\ipykernel_24808\\3381905813.py:77: SettingWithCopyWarning: \n",
"A value is trying to be set on a copy of a slice from a DataFrame.\n", "A value is trying to be set on a copy of a slice from a DataFrame.\n",
"Try using .loc[row_indexer,col_indexer] = value instead\n", "Try using .loc[row_indexer,col_indexer] = value instead\n",
"\n", "\n",
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
" filtered_df[col + '_date'] = (\n", " filtered_df[col + '_date'] = (\n",
"C:\\Users\\zy187\\AppData\\Local\\Temp\\ipykernel_5028\\4281365028.py:76: SettingWithCopyWarning: \n", "C:\\Users\\zy187\\AppData\\Local\\Temp\\ipykernel_24808\\3381905813.py:77: SettingWithCopyWarning: \n",
"A value is trying to be set on a copy of a slice from a DataFrame.\n", "A value is trying to be set on a copy of a slice from a DataFrame.\n",
"Try using .loc[row_indexer,col_indexer] = value instead\n", "Try using .loc[row_indexer,col_indexer] = value instead\n",
"\n", "\n",
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
" filtered_df[col + '_date'] = (\n", " filtered_df[col + '_date'] = (\n",
"C:\\Users\\zy187\\AppData\\Local\\Temp\\ipykernel_5028\\4281365028.py:76: SettingWithCopyWarning: \n", "C:\\Users\\zy187\\AppData\\Local\\Temp\\ipykernel_24808\\3381905813.py:77: SettingWithCopyWarning: \n",
"A value is trying to be set on a copy of a slice from a DataFrame.\n", "A value is trying to be set on a copy of a slice from a DataFrame.\n",
"Try using .loc[row_indexer,col_indexer] = value instead\n", "Try using .loc[row_indexer,col_indexer] = value instead\n",
"\n", "\n",
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
" filtered_df[col + '_date'] = (\n", " filtered_df[col + '_date'] = (\n",
"C:\\Users\\zy187\\AppData\\Local\\Temp\\ipykernel_5028\\4281365028.py:76: SettingWithCopyWarning: \n", "C:\\Users\\zy187\\AppData\\Local\\Temp\\ipykernel_24808\\3381905813.py:77: SettingWithCopyWarning: \n",
"A value is trying to be set on a copy of a slice from a DataFrame.\n", "A value is trying to be set on a copy of a slice from a DataFrame.\n",
"Try using .loc[row_indexer,col_indexer] = value instead\n", "Try using .loc[row_indexer,col_indexer] = value instead\n",
"\n", "\n",
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
" filtered_df[col + '_date'] = (\n", " filtered_df[col + '_date'] = (\n",
"\u001B[92m2025-10-15 15:14:36,032 - 4281365028.py - task_logger - INFO - 时间转换完成\u001B[0m\n", "\u001B[92m2025-10-23 17:43:17,224 - 3381905813.py - task_logger - INFO - 时间转换完成\u001B[0m\n",
"C:\\Users\\zy187\\AppData\\Local\\Temp\\ipykernel_5028\\4281365028.py:102: SettingWithCopyWarning: \n", "C:\\Users\\zy187\\AppData\\Local\\Temp\\ipykernel_24808\\3381905813.py:103: SettingWithCopyWarning: \n",
"A value is trying to be set on a copy of a slice from a DataFrame.\n", "A value is trying to be set on a copy of a slice from a DataFrame.\n",
"Try using .loc[row_indexer,col_indexer] = value instead\n", "Try using .loc[row_indexer,col_indexer] = value instead\n",
"\n", "\n",
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
" filtered_df[col + \"_staff_id\"] = staff_ids\n", " filtered_df[col + \"_staff_id\"] = staff_ids\n",
"C:\\Users\\zy187\\AppData\\Local\\Temp\\ipykernel_5028\\4281365028.py:102: SettingWithCopyWarning: \n", "C:\\Users\\zy187\\AppData\\Local\\Temp\\ipykernel_24808\\3381905813.py:103: SettingWithCopyWarning: \n",
"A value is trying to be set on a copy of a slice from a DataFrame.\n", "A value is trying to be set on a copy of a slice from a DataFrame.\n",
"Try using .loc[row_indexer,col_indexer] = value instead\n", "Try using .loc[row_indexer,col_indexer] = value instead\n",
"\n", "\n",
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
" filtered_df[col + \"_staff_id\"] = staff_ids\n", " filtered_df[col + \"_staff_id\"] = staff_ids\n",
"C:\\Users\\zy187\\AppData\\Local\\Temp\\ipykernel_5028\\4281365028.py:102: SettingWithCopyWarning: \n", "C:\\Users\\zy187\\AppData\\Local\\Temp\\ipykernel_24808\\3381905813.py:103: SettingWithCopyWarning: \n",
"A value is trying to be set on a copy of a slice from a DataFrame.\n", "A value is trying to be set on a copy of a slice from a DataFrame.\n",
"Try using .loc[row_indexer,col_indexer] = value instead\n", "Try using .loc[row_indexer,col_indexer] = value instead\n",
"\n", "\n",
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
" filtered_df[col + \"_staff_id\"] = staff_ids\n", " filtered_df[col + \"_staff_id\"] = staff_ids\n",
"C:\\Users\\zy187\\AppData\\Local\\Temp\\ipykernel_5028\\4281365028.py:102: SettingWithCopyWarning: \n", "C:\\Users\\zy187\\AppData\\Local\\Temp\\ipykernel_24808\\3381905813.py:103: SettingWithCopyWarning: \n",
"A value is trying to be set on a copy of a slice from a DataFrame.\n", "A value is trying to be set on a copy of a slice from a DataFrame.\n",
"Try using .loc[row_indexer,col_indexer] = value instead\n", "Try using .loc[row_indexer,col_indexer] = value instead\n",
"\n", "\n",
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
" filtered_df[col + \"_staff_id\"] = staff_ids\n", " filtered_df[col + \"_staff_id\"] = staff_ids\n",
"\u001B[92m2025-10-15 15:14:36,045 - 4281365028.py - task_logger - INFO - 人员转换完成\u001B[0m\n" "\u001B[92m2025-10-23 17:43:17,245 - 3381905813.py - task_logger - INFO - 人员转换完成\u001B[0m\n"
] ]
} }
], ],
"execution_count": 2 "execution_count": 1
} }
], ],
"metadata": { "metadata": {