{
 "cells": [
  {
   "cell_type": "code",
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2025-04-21T03:11:22.784774Z",
     "start_time": "2025-04-21T03:11:10.187047Z"
    }
   },
   "source": [
    "from datetime import date, timedelta, datetime\n",
    "import holidays\n",
    "from config import Config\n",
    "import pandas as pd\n",
    "import pymysql  # 使用 pymysql 替代 mysql.connector\n",
    "from log_config import configure_task_logger, configure_error_task_logger\n",
    "from api import API\n",
    "from back_ground_module import CommonModule\n",
    "common_module = CommonModule()\n",
    "api_instance = API()\n",
    "global last_day_end_customer_service, is_customer_service_data_id, customer_service_data_id\n",
    "\n",
    "\n",
    "class JCBAbnormalRevisit:\n",
    "    def __init__(self):\n",
    "        # 使用 pymysql 连接数据库\n",
    "        self.daily_revisit_list = None\n",
    "        self.abnormal_list = None\n",
    "        self.field_mapping = {}\n",
    "        self.staff_id_list = None\n",
    "        self.customer_service_list = None\n",
    "\n",
    "    def load_all_data(self):\n",
    "        # 获取接车宝异常待办\n",
    "        payload = {\"api_key\": \"6717470a0b3975ef583c6df1\",\n",
    "                   \"entry_id\": \"67c156ba635191b64af8a110\",\n",
    "                   }\n",
    "        abnormal_service = api_instance.entry_data_list(payload)\n",
    "        self.abnormal_list = abnormal_service.get(\"data\")  # api请求格式，将数据封装在data字典里\n",
    "\n",
    "        # 获取接车宝日常回访单\n",
    "        payload = {\"api_key\": \"6717470a0b3975ef583c6df1\",\n",
    "                   \"entry_id\": \"67d2369f244cf21d615aa87f\",\n",
    "                   }\n",
    "        daily_revisit = api_instance.entry_data_list(payload)\n",
    "        self.daily_revisit_list = daily_revisit.get(\"data\")  # api请求格式，将数据封装在data字典里\n",
    "\n",
    "    def load_cus_data(self):\n",
    "        # 获取接车宝客服表单\n",
    "        payload = {\"api_key\": \"6717470a0b3975ef583c6df1\",\n",
    "                   \"entry_id\": \"67b6f2462f9ac03b783d409a\",\n",
    "                   }\n",
    "        customer_service = api_instance.entry_data_list(payload)\n",
    "        customer_service_list = customer_service.get(\"data\")  # api请求格式，将数据封装在data字典里\n",
    "        return customer_service_list\n",
    "\n",
    "    def today_customer_service_list(self):\n",
    "        # 获取今日接车宝派发客服顺序\n",
    "        today_customer_service_list = []\n",
    "        all_customer_service_list = []\n",
    "        today_customer_service_start_list = []\n",
    "        for row_items in self.load_cus_data():\n",
    "            # print(row_items)\n",
    "            customer_service_name_id = row_items.get(\"_widget_1740042824214\", {}).get(\"username\", {})\n",
    "            customer_service_name = row_items.get(\"_widget_1740042824214\", {}).get(\"name\", {})\n",
    "            customer_service_state = row_items.get(\"_widget_1740117343937\", {})\n",
    "            is_last_day_end = row_items.get(\"_widget_1740042824216\", {})\n",
    "            customer_service_data_id = row_items.get(\"_id\", {})\n",
    "            print(customer_service_name, customer_service_name_id, customer_service_state, is_last_day_end)\n",
    "            all_customer_service_list.append(\n",
    "                [customer_service_name, customer_service_name_id, customer_service_state, is_last_day_end,\n",
    "                 customer_service_data_id])\n",
    "            if is_last_day_end == \"是\":  # 判断是否是下次开始位置\n",
    "                last_day_end_customer_service = customer_service_name_id\n",
    "                is_customer_service_data_id = row_items.get(\"_id\", {})\n",
    "\n",
    "        split_index = None\n",
    "        for index, row in enumerate(all_customer_service_list):\n",
    "            print(row[3])\n",
    "            if row[3] == \"是\":\n",
    "                split_index = index\n",
    "                print(f\"找到索引 {index}\")\n",
    "                break\n",
    "\n",
    "        if split_index is not None:\n",
    "            # 根据索引切割列表\n",
    "            first_part = all_customer_service_list[split_index:]  # 索引位置及之后的行\n",
    "            second_part = all_customer_service_list[:split_index]  # 索引位置之前的行\n",
    "            # 调换两个子列表的位置并重新组合\n",
    "            today_customer_service_start_list = first_part + second_part\n",
    "        else:\n",
    "            # 如果没有找到“是”，保持原列表不变\n",
    "            today_customer_service_start_list = all_customer_service_list\n",
    "            pass\n",
    "\n",
    "        for index, row in enumerate(today_customer_service_start_list):\n",
    "            if row[2] == \"开\":\n",
    "                today_customer_service_list.append(row[1])\n",
    "\n",
    "        return today_customer_service_list, is_customer_service_data_id, all_customer_service_list\n",
    "\n",
    "    def send_request(self, df):\n",
    "        today_customer_service_list, is_customer_service_data_id, all_customer_service_list = self.today_customer_service_list()\n",
    "        # 初始化派发索引\n",
    "        next_dispatcher_index = 0\n",
    "\n",
    "        # 显式循环分配跟进人\n",
    "        follow_up_persons = []\n",
    "        for _ in range(len(df)):\n",
    "            follow_up_person = today_customer_service_list[next_dispatcher_index]\n",
    "            follow_up_persons.append(follow_up_person)\n",
    "            next_dispatcher_index = (next_dispatcher_index + 1) % len(today_customer_service_list)\n",
    "\n",
    "        # 添加跟进人到 DataFrame\n",
    "        df[\"跟进人\"] = follow_up_persons\n",
    "\n",
    "        # 获取下一个派发人\n",
    "        next_dispatcher = today_customer_service_list[next_dispatcher_index]\n",
    "\n",
    "        new_sign_abnormal_data = [self.row_to_dict(row, self.field_mapping) for index, row in\n",
    "                                  df.iterrows()]\n",
    "\n",
    "        data = {'api_key': Config.EFFICIENT_CAR_PICKUP_APP_ID, 'entry_id': \"67d2369f244cf21d615aa87f\",\n",
    "                \"data_list\": new_sign_abnormal_data} # 派发数据\n",
    "\n",
    "        api_instance.entry_data_batch_create(data)\n",
    "\n",
    "        data1 = {\"api_key\": Config.EFFICIENT_CAR_PICKUP_APP_ID,\n",
    "                 \"entry_id\": Config.EFFICIENT_CAR_PICKUP_CUSTOMER_SERVICE_ID,\n",
    "                 \"data_id\": is_customer_service_data_id,\n",
    "                 \"data\":\n",
    "                     {\"_widget_1740042824216\": {\"value\": \"\"}, }\n",
    "                 }  # 原来的是\"_widget_1740042824216\": {\"value\": \"是\"},修改昨日截至人员\n",
    "        next_customer_service_data_id = None\n",
    "        for index, row in enumerate(all_customer_service_list):\n",
    "            print(row[3])\n",
    "            if row[1] == next_dispatcher:\n",
    "                next_customer_service_data_id = row[4]\n",
    "                break\n",
    "\n",
    "        data2 = {\"api_key\": Config.EFFICIENT_CAR_PICKUP_APP_ID,\n",
    "                 \"entry_id\": Config.EFFICIENT_CAR_PICKUP_CUSTOMER_SERVICE_ID,\n",
    "                 \"data_id\": next_customer_service_data_id,\n",
    "                 \"data\":\n",
    "                     {\"_widget_1740042824216\": {\"value\": \"是\"}, }}# 明日派发起点人员\n",
    "\n",
    "        api_instance.entry_data_update(data1)\n",
    "        api_instance.entry_data_update(data2)\n",
    "\n",
    "    def main(self):\n",
    "        self.load_all_data()\n",
    "        task_start_time =datetime.now().strftime(\"%Y-%m-%d %H:%M:%S\")\n",
    "        print(task_start_time)\n",
    "        print(type(task_start_time))\n",
    "        data_JCB = common_module.get_jcb_details()\n",
    "\n",
    "        # 保存为CSV文件\n",
    "        output_dir = \"output\"  # 设置输出目录\n",
    "\n",
    "        # 创建输出目录（如果不存在）\n",
    "        import os\n",
    "        os.makedirs(output_dir, exist_ok=True)\n",
    "\n",
    "        # data_JCB.to_csv(os.path.join(output_dir, 'JCB_all_data.csv'), index=False)\n",
    "        self.fields()\n",
    "\n",
    "        # 异常待办回访  近1个月开单为0客户\n",
    "        # 当前日期\n",
    "        current_date = datetime.now()\n",
    "        current_date = current_date + timedelta(days=1)\n",
    "        current_date_str = current_date.strftime(\"%Y-%m-%d\")\n",
    "        # current_date = datetime.now()\n",
    "        thirty_days_ago = current_date - timedelta(days=30)\n",
    "        thirty_days_ago = thirty_days_ago.date()\n",
    "        abnormal_data = []\n",
    "        JDY_abnormal_data = []\n",
    "        JDY_revisit_data = []\n",
    "        # df = pd.read_csv(os.path.join(output_dir, \"JCB_异常待办.csv\")) # 读取异常待办表\n",
    "        # print(df)\n",
    "        for index, row in data_JCB.iterrows():\n",
    "            new_row = row.copy()\n",
    "            new_row['开户日'] = datetime.strptime(new_row['开户日'], \"%Y-%m-%d\").date()\n",
    "            if new_row['开户日'] < thirty_days_ago and row['近30天开单天数'] == 0 and row['客户状态'] == \"留存\":\n",
    "                # print(row['账号'], row['开户日'], row['近30天开单天数'], row[\"客户状态\"])\n",
    "                row[\"日期\"] = datetime.strptime(row['开户日'], \"%Y-%m-%d\").date()\n",
    "                row['日期'] = row[\"日期\"].strftime(\"%Y-%m-%d\")\n",
    "                abnormal_data.append(row)\n",
    "                # 推送给客服\n",
    "        abnormal_data = pd.DataFrame(abnormal_data)\n",
    "        abnormal_data[\"表单类型\"] = \"异常待办\"\n",
    "        abnormal_data[\"派发日期\"] = current_date_str\n",
    "        abnormal_data.to_excel(os.path.join(output_dir, 'JCB_异常待办.xlsx'), index=False)  # 派发B(所有异常待办)\n",
    "\n",
    "        for abnormal_items in self.abnormal_list:\n",
    "            last_send_date = abnormal_items.get(\"_widget_1740723898405\", {})  # 派发日期\n",
    "            last_30_days_orders = abnormal_items.get(\"_widget_1740723898401\", {})  # 近30天开单数\n",
    "            phone = abnormal_items.get(\"_widget_1740723898391\", {})  # 手机号\n",
    "            account = abnormal_items.get(\"_widget_1740723898390\", {})  # 账号\n",
    "            data_id = abnormal_items.get(\"_id\", {})  # 数据id\n",
    "            JDY_abnormal_data.append([data_id, account, phone, last_send_date, last_30_days_orders])\n",
    "\n",
    "        JDY_abnormal_data = pd.DataFrame(JDY_abnormal_data,\n",
    "                                         columns=[\"数据id\", \"账号\", \"联系手机号\", \"派发日期\",\n",
    "                                                  \"近30天开单天数\"])  # 派发A（简道云上异常待办）\n",
    "        # JDY_abnormal_data.columns = [\"数据id\", \"账号\", \"联系手机号\", \"派发日期\", \"近30天开单天数\"]\n",
    "        JDY_abnormal_data.to_excel(os.path.join(output_dir, 'JCB_云端异常待办.xlsx'), index=False)  # 派发A\n",
    "\n",
    "        # 将 '联系手机号' 列转换为字符串类型\n",
    "        JDY_abnormal_data['联系手机号'] = JDY_abnormal_data['联系手机号'].astype(str).str.replace('.0', '')\n",
    "        abnormal_data['联系手机号'] = abnormal_data['联系手机号'].astype(str)\n",
    "        JDY_abnormal_data.to_excel(os.path.join(output_dir, 'JCB_云端异常待办.xlsx'), index=False) # 派发A\n",
    "        abnormal_data.to_excel(os.path.join(output_dir, 'JCB_今日异常待办.xlsx'), index=False) # 派发B\n",
    "\n",
    "        today = datetime.now().weekday()\n",
    "        \n",
    "        # 随机抽40条派发\n",
    "        df_40 = pd.DataFrame()\n",
    "        if 0 <= today <= 4:\n",
    "        # if 1>2:\n",
    "            # 假设 JDY_abnormal_data 和 abnormal_data 都有重复列 '重复列'\n",
    "            df3 = pd.merge(JDY_abnormal_data, abnormal_data, on=[\"联系手机号\", \"账号\"], how='inner',\n",
    "                           suffixes=('', '_y'))\n",
    "            # 删除以 _y 结尾的列（即来自右侧 DataFrame 的重复列）\n",
    "            df3 = df3.loc[:, ~df3.columns.str.endswith('_y')]\n",
    "            df3['派发日期'] = pd.to_datetime(df3['派发日期']).dt.strftime(\"%Y-%m-%d\")\n",
    "            df3.to_excel(os.path.join(output_dir, 'JCB_异常待办情况1.xlsx'),\n",
    "                         index=False, )  # B存在，A存在 ，今日派发与历史派发都存在，派发并删历史\n",
    "\n",
    "            df_40 = df3[df3.index < 40]\n",
    "            df_40.to_excel(os.path.join(output_dir, 'JCB_异常待办情况2.xlsx'), index=False, )\n",
    "\n",
    "            for index, row in df_40.iterrows():  # 删除已推送的数据\n",
    "                delete_data = {\"api_key\": Config.EFFICIENT_CAR_PICKUP_APP_ID,\n",
    "                               \"entry_id\": Config.EFFICIENT_CAR_PICKUP_CUSTOMER_HISTORY_ID,\n",
    "                               \"data_id\": row[\"数据id\"]}\n",
    "                # print(delete_data)\n",
    "                api_instance.entry_data_delete(delete_data)\n",
    "\n",
    "        # B不存在A存在  今日派发不存在，历史存在，删历史\n",
    "        # 使用 outer 合并，并添加指示器列 _merge\n",
    "        df_merged = pd.merge(JDY_abnormal_data, abnormal_data, on=[\"联系手机号\", \"账号\"], how='outer', indicator=True,\n",
    "                             suffixes=('', '_y'))  # outer保留所有数据，indicator标注来源\n",
    "        # 筛选出只存在于 JDY_abnormal_data 中的行\n",
    "        df_a_not_in_b = df_merged[df_merged['_merge'] == 'left_only']\n",
    "        # 删除以 _y 结尾的列（即来自右侧 DataFrame 的重复列）\n",
    "        df_a_not_in_b = df_a_not_in_b.loc[:, ~df_a_not_in_b.columns.str.endswith('_y')]\n",
    "        df_a_not_in_b['派发日期'] = pd.to_datetime(df_a_not_in_b['派发日期']).dt.strftime(\"%Y-%m-%d\")\n",
    "        # 保存到 Excel 文件\n",
    "        df_a_not_in_b.to_excel(os.path.join(output_dir, 'JCB_异常待办情况_A存在B不存在.xlsx'), index=False)\n",
    "        for index, row in df_a_not_in_b.iterrows():  # 删除已推送的数据\n",
    "            delete_data = {\"api_key\": Config.EFFICIENT_CAR_PICKUP_APP_ID,\n",
    "                           \"entry_id\": Config.EFFICIENT_CAR_PICKUP_CUSTOMER_HISTORY_ID,\n",
    "                           \"data_id\": row[\"数据id\"]}\n",
    "            # print(delete_data)\n",
    "            api_instance.entry_data_delete(delete_data)\n",
    "\n",
    "        # B存在A不存在  今日派发存在，历史不存在，为新增异常，直接派发\n",
    "        df_merged = pd.merge(JDY_abnormal_data, abnormal_data, on=[\"联系手机号\", \"账号\"], how='outer', indicator=True,\n",
    "                             suffixes=('_x', ''))  # outer保留所有数据，indicator标注来源\n",
    "        df_merged.to_excel(os.path.join(output_dir, 'JCB_异常待办情况_B存在A不存在_134434.xlsx'), index=False)\n",
    "        # 筛选出只存在于 JDY_abnormal_data 中的行\n",
    "        df_b_not_in_a = df_merged[df_merged['_merge'] == 'right_only']\n",
    "        df_b_not_in_a.to_excel(os.path.join(output_dir, 'JCB_异常待办情况_B存在A不存在_111.xlsx'), index=False)\n",
    "        # 删除以 _y 结尾的列（即来自右侧 DataFrame 的重复列）\n",
    "        df_b_not_in_a = df_b_not_in_a.loc[:, ~df_b_not_in_a.columns.str.endswith('_x')]\n",
    "        df_b_not_in_a.to_excel(os.path.join(output_dir, 'JCB_异常待办情况_B存在A不存在_122.xlsx'), index=False)\n",
    "        df_b_not_in_a['派发日期'] = pd.to_datetime(df_b_not_in_a['派发日期']).dt.strftime(\"%Y-%m-%d\")\n",
    "        # 保存到 Excel 文件\n",
    "        df_b_not_in_a.to_excel(os.path.join(output_dir, 'JCB_异常待办情况_B存在A不存在.xlsx'), index=False)\n",
    "\n",
    "        # 合并两个当日派发的df\n",
    "        df_abnormal_data = pd.concat([df_40, df_b_not_in_a], ignore_index=True)\n",
    "        df_abnormal_data.to_excel(os.path.join(output_dir, 'JCB_异常待办情况_合并当日派发.xlsx'), index=False)\n",
    "\n",
    "        for abnormal_items in self.daily_revisit_list:  # 遍历云端已经派发的数据\n",
    "            account = abnormal_items.get(\"_widget_1739258942667\", {})  # 账号\n",
    "            sub_date = abnormal_items.get(\"createTime\", {})  # 提交时间\n",
    "            update_date = abnormal_items.get(\"updateTime\", {})  # 更新时间\n",
    "            entry_style = abnormal_items.get(\"_widget_1739951204545\", {})  # 表单类型\n",
    "            entry_type = abnormal_items.get(\"flowState\", {})  # 表单状态 0流转中 1流转完成 2 手动结束\n",
    "\n",
    "            data_id = abnormal_items.get(\"_id\", {})  # 数据id\n",
    "            JDY_revisit_data.append([data_id, account, sub_date, update_date, entry_style, entry_type])\n",
    "\n",
    "        JDY_revisit_data = pd.DataFrame(JDY_revisit_data)\n",
    "        JDY_revisit_data.columns = [\"数据id\", \"账号\", \"提交时间\", \"更新时间\", \"表单类型\", \"表单状态\"]\n",
    "        JDY_revisit_data.to_excel(os.path.join(output_dir, 'JCB_日常回访_原始数据.xlsx'), index=False)\n",
    "\n",
    "        filtered_data = JDY_revisit_data[JDY_revisit_data['表单类型'] == '异常待办']  # 过滤表单类型\n",
    "        # filtered_data = filtered_data[filtered_data['表单状态'] == 1]  # 过滤表单状态\n",
    "        # filtered_data.to_excel(os.path.join(output_dir, 'JCB_日常回访_过滤数据.xlsx'), index=False)\n",
    "\n",
    "        filtered_data['提交时间'] = pd.to_datetime(filtered_data['提交时间']).dt.strftime(\"%Y-%m-%d\")\n",
    "        latest_update_time = filtered_data.groupby('账号')['提交时间'].max().reset_index()\n",
    "        latest_update_time.rename(columns={'提交时间': '最新提交时间'}, inplace=True)\n",
    "\n",
    "\n",
    "        filtered_data_with_latest = pd.merge(\n",
    "            filtered_data,\n",
    "            latest_update_time,\n",
    "            left_on=['账号', '提交时间'],\n",
    "            right_on=['账号', '最新提交时间']\n",
    "        )\n",
    "\n",
    "        # 过滤出每个账号中提交时间为最新的记录\n",
    "        latest_JDY_abnormal_data = filtered_data_with_latest[\n",
    "            filtered_data_with_latest['提交时间'] == filtered_data_with_latest['最新提交时间']\n",
    "            ]\n",
    "        latest_JDY_abnormal_data.to_excel(os.path.join(output_dir, 'JCB_日常回访_最新数据_1.xlsx'), index=False)\n",
    "\n",
    "\n",
    "        latest_JDY_abnormal_data['提交时间'] = pd.to_datetime(latest_JDY_abnormal_data['提交时间']).dt.strftime(\"%Y-%m-%d\")\n",
    "\n",
    "        thirty_days_ago = (current_date - timedelta(days=30)).strftime(\"%Y-%m-%d\")\n",
    "\n",
    "        final_JDY_abnormal_data = latest_JDY_abnormal_data[latest_JDY_abnormal_data['提交时间'] > thirty_days_ago]  # 筛选出提交时间为近30天的数据\n",
    "\n",
    "        final_JDY_abnormal_data.to_excel(os.path.join(output_dir, 'JCB_日常回访_最新数据.xlsx'), index=False)\n",
    "\n",
    "        df_abnormal_data = df_abnormal_data[~df_abnormal_data['账号'].isin(final_JDY_abnormal_data['账号'])]\n",
    "        # empty_num = df_abnormal_data['手机号'].isnull().sum()\n",
    "        df_abnormal_data = df_abnormal_data[df_abnormal_data[\"联系手机号\"] != \"None\"]\n",
    "        df_abnormal_data.to_excel(os.path.join(output_dir, 'JCB_异常待办情况_派发数据.xlsx'), index=False)\n",
    "\n",
    "        self.send_request(df_abnormal_data)\n",
    "        common_module.send_task_status(task_start_time, \"测试\")\n",
    "        \n",
    "\n",
    "        # df_abnormal_data = [self.row_to_dict(row, self.field_mapping) for index, row in\n",
    "        #                     df_abnormal_data.iterrows()]\n",
    "        # \n",
    "        # data = {'api_key': Config.EFFICIENT_CAR_PICKUP_APP_ID, 'entry_id':\"67d2369f244cf21d615aa87f\",\n",
    "        #         \"data_list\": df_abnormal_data}\n",
    "        # \n",
    "        # \n",
    "        # result = api_instance.entry_data_batch_create(data)\n",
    "\n",
    "    @staticmethod\n",
    "    def row_to_dict(row, field_mapping):\n",
    "        \"\"\"将一行数据转换为指定格式的字典\"\"\"\n",
    "        result = {}\n",
    "        # print(field_mapping)\n",
    "        for col_name, widget_id in field_mapping.items():\n",
    "            # print(col_name, widget_id)\n",
    "            if col_name in row:\n",
    "                value = row[col_name]\n",
    "                clean_value = None if pd.isna(value) else value\n",
    "                result[widget_id] = {\"value\": clean_value}\n",
    "        return result\n",
    "\n",
    "    def fields(self):\n",
    "        self.field_mapping = {\"日期\": \"_widget_1739252804406\", \"产品名称\": \"_widget_1739252804397\",\n",
    "                              \"账号\": \"_widget_1739258942667\", \"联系手机号\": \"_widget_1739252804407\",\n",
    "                              \"使用时长\": \"_widget_1739252804409\", \"开户日\": \"_widget_1739252804396\",\n",
    "                              \"到期日\": \"_widget_1739252804408\", \"续约日\": \"_widget_1739252804410\",\n",
    "                              \"客户状态\": \"_widget_1739252804400\", \"近一周开单量\": \"_widget_1739252804413\",\n",
    "                              \"近一周是否活跃\": \"_widget_1739252804414\",\n",
    "                              \"G状态：近30天开单大于等于10天\": \"_widget_1739252804415\",\n",
    "                              \"当月开单天数\": \"_widget_1739252804416\", \"近30天开单天数\": \"_widget_1739252804417\",\n",
    "                              \"当月G天数\": \"_widget_1739252804418\", \"日分区\": \"_widget_1739252804419\",\n",
    "                              \"表单类型\": \"_widget_1739951204545\", \"派发日期\": \"_widget_1740036367181\",\n",
    "                              \"跟进人\": \"_widget_1740043340255\",\n",
    "                              }\n",
    "\n",
    "\n",
    "if __name__ == \"__main__\":\n",
    "    start = JCBAbnormalRevisit()\n",
    "    start.main()\n",
    "    # if result is not None:\n",
    "    #     print(result.head())  # 打印前几行数据\n"
   ],
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "已获取 100 条数据\n",
      "已获取 200 条数据\n",
      "已获取 300 条数据\n",
      "已获取 400 条数据\n",
      "已获取 500 条数据\n",
      "已获取 600 条数据\n",
      "已获取 700 条数据\n",
      "已获取 800 条数据\n",
      "已获取 900 条数据\n",
      "已获取 1000 条数据\n",
      "已获取 1100 条数据\n",
      "已获取 1133 条数据\n",
      "已获取 100 条数据\n",
      "已获取 200 条数据\n",
      "已获取 300 条数据\n",
      "已获取 400 条数据\n",
      "已获取 500 条数据\n",
      "已获取 600 条数据\n",
      "已获取 700 条数据\n",
      "已获取 800 条数据\n",
      "已获取 900 条数据\n",
      "已获取 1000 条数据\n",
      "已获取 1088 条数据\n",
      "2025-04-21 11:11:18\n",
      "<class 'str'>\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Administrator.DESKTOP-7IC2USJ\\AppData\\Local\\Temp\\ipykernel_11188\\624376566.py:285: SettingWithCopyWarning: \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",
      "\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_data['提交时间'] = pd.to_datetime(filtered_data['提交时间']).dt.strftime(\"%Y-%m-%d\")\n",
      "2025-04-21 11:11:22,775 - 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-04-21T03:11:22.379Z', 'updateTime': '2025-04-21T03:11:22.379Z', 'deleteTime': None, '_widget_1744873387500': '2025-04-21T00:00:00.000Z', '_widget_1743644977694': '测试', '_widget_1744873387501': '2025-04-21T11:11:18.000Z', '_widget_1744873387502': '2025-04-21T11:11:22.000Z', '_widget_1744873387504': '4', '_id': '6805b75ac1e7d8a6d2b1863d', 'appId': '6694d3c4fcb69ca9a111a6c4', 'entryId': '67ede908eb9c22261016466e'}}\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "返回结果: {'data': {'creator': {'name': 'F6汽车科技', 'username': '#admin', 'status': 1, 'type': 0}, 'updater': {'name': 'F6汽车科技', 'username': '#admin', 'status': 1, 'type': 0}, 'deleter': None, 'createTime': '2025-04-21T03:11:22.379Z', 'updateTime': '2025-04-21T03:11:22.379Z', 'deleteTime': None, '_widget_1744873387500': '2025-04-21T00:00:00.000Z', '_widget_1743644977694': '测试', '_widget_1744873387501': '2025-04-21T11:11:18.000Z', '_widget_1744873387502': '2025-04-21T11:11:22.000Z', '_widget_1744873387504': '4', '_id': '6805b75ac1e7d8a6d2b1863d', 'appId': '6694d3c4fcb69ca9a111a6c4', 'entryId': '67ede908eb9c22261016466e'}}\n"
     ]
    }
   ],
   "execution_count": 13
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
