You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
2.2 KiB
42 lines
2.2 KiB
# -*- coding: utf-8 -*-
|
|
"""heavy 二跑 F-14 行数构成取证:任务计数 / fail 分组 / E2C-IMP 落库 / 联系人挂接 / UPDATE_ONLY 任务态"""
|
|
import sys, io, json
|
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
|
import pymysql
|
|
|
|
conn = pymysql.connect(host='8.129.84.155', user='root', password='Itc@123456',
|
|
database='crm', charset='utf8mb4', autocommit=True,
|
|
cursorclass=pymysql.cursors.DictCursor)
|
|
cur = conn.cursor()
|
|
|
|
print('== 最近 3 个导入任务 ==')
|
|
cur.execute("SELECT id,status,import_mode,total_count,insert_count,update_count,fail_count,"
|
|
"suspect_count,unchanged_count FROM customer_import_task ORDER BY id DESC LIMIT 3")
|
|
for x in cur.fetchall():
|
|
print(json.dumps({k: str(v) for k, v in x.items()}, ensure_ascii=False))
|
|
|
|
print('== 最新 APPEND_ONLY 任务 fail 按 sheet 分组 ==')
|
|
cur.execute("SELECT sheet_name,COUNT(*) n FROM customer_import_fail WHERE task_id="
|
|
"(SELECT MAX(id) FROM customer_import_task WHERE import_mode='APPEND_ONLY') GROUP BY sheet_name")
|
|
for x in cur.fetchall():
|
|
print(json.dumps({k: str(v) for k, v in x.items()}, ensure_ascii=False))
|
|
|
|
print('== 最新 UPDATE_ONLY 任务(14.8 的 DRAFT 是否永挂)==')
|
|
cur.execute("SELECT id,status,import_mode,total_count,insert_count,update_count,fail_count "
|
|
"FROM customer_import_task WHERE import_mode='UPDATE_ONLY' ORDER BY id DESC LIMIT 2")
|
|
for x in cur.fetchall():
|
|
print(json.dumps({k: str(v) for k, v in x.items()}, ensure_ascii=False))
|
|
|
|
print('== E2C-IMP 客户落库(最近 3)==')
|
|
cur.execute("SELECT id,customer_no,customer_name,customer_star_level s,relation_star_level r,"
|
|
"is_biz_negotiated b FROM customer WHERE customer_no LIKE 'E2C-IMP-%' ORDER BY id DESC LIMIT 3")
|
|
for x in cur.fetchall():
|
|
print(json.dumps({k: str(v) for k, v in x.items()}, ensure_ascii=False))
|
|
|
|
print('== 挂接联系人(按最新 E2C-IMP 客户)==')
|
|
cur.execute("SELECT c.name cn FROM customer_contact c JOIN customer cu ON c.customer_id=cu.id "
|
|
"WHERE cu.customer_no LIKE 'E2C-IMP-%' ORDER BY c.id DESC LIMIT 3")
|
|
for x in cur.fetchall():
|
|
print(json.dumps({k: str(v) for k, v in x.items()}, ensure_ascii=False))
|
|
conn.close()
|
|
print('DONE')
|
|
|