ハイブデータウェアハウス金融ビジネス-ビジネスコンバットワン

事業名:金融会社の事業部門の月間取引量上位10社の顧客

技術的な説明:

1.データアクセス

データは、カウンターシステムのビジネステーブルとLexusマーケティング統合システムのテーブルから取得されます。

システムデータベース1:

hive_s5_szdb_sz_asset_client
hive_s5_szdb_sz_his_his_deliver
hive_s5_szdb_sz_his_his_fundjour
hive_s5_szdb_sz_his_his_assetdebit

システムデータベース2:
hive_s8__t_gxgl_gxmx_query
hive_s8__t_ehr_jjr_jbxx

2.ハイブデータウェアハウスでビジネスSQLを作成する

スターモデル開発に基づく

ファクトテーブル関連のディメンションテーブル

事業準備:

1.月間取引量=収入=手数料+発生額+支払利息

--Cina佣金運賃0 
、as(select branch_no、client_id from hive.hive_s5_szdb_sz_asset_client where hive_p_date = 20190531 and branch_no in(1,2))
with b as(select branch_no、client_id、fund_account、client_name、sum(fare0)value from hive .hive_s5_szdb_sz_his_his_deliverここで、hive_p_dateは20190501から20190531まで、branch_no in(1,2)およびasset_prop = 7 group by branch_no、client_id、fund_account、client_name order by sum(fare0)desc)
-陳pul生金额occur_balance(默
、c as(select branch_no、client_id、fund_account、max(client_name)client_name、sum(-occur_balance)value from hive.hive_s5_szdb_sz_his_his_fundjour where hive_p_date between 20190501 and 20190531 and branch_no in(271,2)and business_flag、15 、2718,2721,2724,2732,2735,2738,2741,2744,2769,2776,2778,2779,2794,2795)およびasset_prop = 7 group by branch_no、client_id、fund_account order by sum(-occur_balance)desc)
- -現在の期間の終わりの受取利息収入-前の期間の終わりの受取利息収入=支払利息の融資fin_pre_interest
、da as(select a.branch_no、a.client_id、a.client_name、a.fund_account、(value1-value2)value from
 (選択BRANCH_NO、CLIENT_ID、fund_account、MAX(CLIENT_NAME)CLIENT_NAME、和(fin_pre_interest)値1 hive.hive_s5_szdb_sz_his_his_assetdebitからhive_p_date = 20190531とBRANCH_NOにおける(1,2)基BRANCH_NO、CLIENT_IDによってBRANCH_NO、CLIENT_ID、fund_account順序によって)
左join(select branch_no、client_id、fund_account、max(client_name)client_name、sum(fin_pre_interest)value2 from hive.hive_s5_szdb_sz_his_his_assetdebit where hive_p_date = 20181231 and branch_no in(1,2)group by branch_no、client_id、fund_ a.branch_no = b.branch_noおよびa.client_id = b.client_idのbranch_noによる順序(value1-value2)desc)
-、c as(select branch_no、client_id、fund_account、max(client_name)client_name、sum(fin_pre_interest)value1 from hive.hive_s5_szdb_sz_his_his_assetdebit where hive_p_date between 20190501 and 20190531 and branch_no in(1,2)group by branch_no、 by branch_no、client_id、fund_account)
-客户服务関系
、e as(select a.ryid、a.khid、a.gxlxbh、b.xm from(
select * from(select ryid、khid、case when gxlxbh = 2 then '服务関連系 'else' @ 'end gxlxbh from hive.hive_s8__t_gxgl_gxmx_query where hive_p_date = 20190507)where gxlxbh!=' @ ')a 
join(select ryid、xm from hive.hive_s8__t_ehr_jjr_jb ryid)
/ *查看中時間利态結選択a.branch_no、a.client_id、
nvl(nvl(b.client_name、c.client_name)、d.client_name)client_name、
nvl(nvl(b.fund_account、c.fund_account)、d.fund_account)fund_account、
(nvl(b.value、0)+ nvl(c.value、0)+ nvl(d.value、0))value1、xm 、gxlxbh
from a.branch_no = b.branch_no and a.client_id = b.client_id
left join c on a.branch_no = c.branch_no and a.client_id = c.client_id
left join d on a.branch_no = d.branch_noとa.client_id = d.client_id  
left join e on a.client_id = e.khid 
order by value1 desc; * /
-目前里面都是信用账户的业务(后续若有変形π请调整)
、f as (a.branch_no、a.client_id、
nvl(nvl(b.client_name、c.client_name)、d.client_name)client_name、
nvl(nvl(b.fund_account、c.fund_account)、d.fund_account)fund_account、
(nvl (b.value、0)+ nvl(c.value、0)+ nvl(d.value、0))value1、xm、gxlxbh
a.branch_no = b.branch_noおよびa.client_id = b.client_idの
左結合bからa.branch_no = c.branch_noおよびa.client_id = c.client_idの
左結合ca.branch_no = dの左結合d。 branch_noとa.client_id = d.client_id
、a.client_id = e.khidで  eに左結合します。value1desc
による順序)
-去重、每TB营业部全出10条交易量前10的客户数データ
、g as(select * 、row_number()over(partition by branch_no order by value1 desc)rid from f where value1> 0)
select branch_no、client_id、client_name、fund_account、value1、rid、201904、xm、gxlxbh from g where rid <= 10;

3.sqlを.pyスクリプトにパッケージ化します

1)python xxx.pydateを実行するスクリプト

2)ビッグデータ管理プラットフォームで構成された後、プラットフォームはデフォルトで実行前日のタスクをスケジュールします

4.レポートプラットフォームのバックエンドデータベースにデータをエクスポートします

1)レポートプラットフォーム(テーブル、キーと値のペア、リングに取り付けられた図、レーダー図など)ディスプレイ、大画面ディスプレイでビジネスSQLの結果データをパーソナライズします。

2)レポートプラットフォームの関連操作

3)レポートの権限構成は指定されたユーザーに表示され、対応するレポート権限は対応する需要部門に公開されます。

5.タスク管理

1)スクリプトの依存関係ビューを構成します。注:各ステップはタスクであり、対応するタスクIDがあります。

インバウンド->インジケーターの計算->統計インジケーター->レポートプラットフォームのバックエンドデータベースxxxreportの関連テーブルへのインジケーターのエクスポート

2)取引日にデータを実行しているだけであるかどうかに関係なく、タスクの実行日パラメーターを設定します

3)翌日の運用中にエラーログが発生した場合は、ログに基づいて具体的な理由を調べて分析してください。

6.構成のスケジューリング

1)タスク時間の設定

タスクは毎日3:30に呼び出され、実行画面に実行ログが出力されます。

7.データ検証

1)ビッグデータ管理プラットフォームのダッシュボードには、アクセス、計算、統計、および毎日のアウトバウンドのために、キュー内のすべての失敗したタスクが表示されます

2)プラットフォーム監視ダッシュボードによると、失敗した個々のタスクを表示できます。タスクが失敗した場合は、ログから理由を見つけることができます。それ以外の場合は何もありません。タスクは非常に正常に実行されています。

 

おすすめ

転載: blog.csdn.net/ALIVEE/article/details/89978177