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.
78 lines
2.6 KiB
78 lines
2.6 KiB
|
3 days ago
|
# -*- coding: utf-8 -*-
|
||
|
|
"""从 db-scout-heavy.json 提取票 05 关键决策信息。"""
|
||
|
|
import json
|
||
|
|
import io
|
||
|
|
import sys
|
||
|
|
|
||
|
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
||
|
|
|
||
|
|
d = json.load(open(r'e:\code\crm-backend-matt\.scratch\customer-e2e\db-scout-heavy.json', encoding='utf-8'))
|
||
|
|
|
||
|
|
print('== users (admin/buddy) ==')
|
||
|
|
for u in d['users']:
|
||
|
|
print({k: u.get(k) for k in ('id', 'username', 'account', 'dept_id', 'enabled',
|
||
|
|
'employment_status', 'title', 'deleted')})
|
||
|
|
|
||
|
|
print('\n== depts ==')
|
||
|
|
for t in d['depts']:
|
||
|
|
keys = {k: v for k, v in t.items() if v not in (None, '', 0) and 'time' not in k.lower()
|
||
|
|
and 'by' not in k.lower() and k != 'deleted'}
|
||
|
|
print(keys)
|
||
|
|
|
||
|
|
print('\n== all users ==')
|
||
|
|
for u in d['all_users']:
|
||
|
|
print({k: u.get(k) for k in ('id', 'username', 'account', 'dept_id', 'enabled',
|
||
|
|
'employment_status', 'title')})
|
||
|
|
|
||
|
|
print('\n== owner_dist ==')
|
||
|
|
for r in d['owner_dist']:
|
||
|
|
print(r)
|
||
|
|
|
||
|
|
print('\n== anchor_samples ==')
|
||
|
|
for r in d['anchor_samples']:
|
||
|
|
print({k: r.get(k) for k in ('id', 'customer_no', 'customer_name', 'owner_user_id',
|
||
|
|
'archive_status', 'last_valid_follow_time', 'enter_pool_time')})
|
||
|
|
|
||
|
|
print('\n== pending_notice ==')
|
||
|
|
print('cnt:', d['pending_notice_cnt'])
|
||
|
|
print('cols:', d['pending_notice_cols'])
|
||
|
|
for r in d['pending_notice_rows']:
|
||
|
|
print(r)
|
||
|
|
|
||
|
|
print('\n== dedup tables ==', d['dedup_rule_tables'])
|
||
|
|
print('== reminder tables ==', d['reminder_rule_tables'])
|
||
|
|
for k, v in d.items():
|
||
|
|
if k.startswith('reminder_rows_'):
|
||
|
|
print(k, '->', v)
|
||
|
|
|
||
|
|
print('\n== transfers ==')
|
||
|
|
for r in d['transfers']:
|
||
|
|
print(r)
|
||
|
|
|
||
|
|
print('\n== opp_bind ==')
|
||
|
|
for r in d['opp_bind']:
|
||
|
|
print(r)
|
||
|
|
|
||
|
|
print('\n== transfer_custs ==')
|
||
|
|
for r in d['transfer_custs']:
|
||
|
|
print({k: r.get(k) for k in ('id', 'customer_no', 'customer_name', 'owner_user_id',
|
||
|
|
'archive_status', 'last_valid_follow_time')})
|
||
|
|
|
||
|
|
print('\n== import tables ==', d['import_tables'], d.get('import_task_cnt'))
|
||
|
|
|
||
|
|
print('\n== dict groups ==')
|
||
|
|
for g in d['dict_groups']:
|
||
|
|
print({k: g.get(k) for k in g.keys() if 'time' not in k.lower() and 'by' not in k.lower()})
|
||
|
|
|
||
|
|
print('\n== dict items (去重摘要) ==')
|
||
|
|
items = d['dict_items_all']
|
||
|
|
print('total:', len(items))
|
||
|
|
if items:
|
||
|
|
print('columns:', list(items[0].keys()))
|
||
|
|
# 找 transfer_reason 与 customer_type 相关
|
||
|
|
for it in items:
|
||
|
|
s = json.dumps(it, ensure_ascii=False, default=str)
|
||
|
|
if any(kw in s for kw in ('transfer_reason', 'resign', 'transfer_post', 'region_adjust',
|
||
|
|
'customer_type')):
|
||
|
|
print(s)
|