報表下載
- 用戶查詢報表 => getway (return record) => 異步 api response data => gcp cloud storeage bucket => change status => 報表下載中心 => 狀態變更
- lock by 後台 userid
- 紀錄查詢條件 (md5)
- query data json
Cloud Storage in Google Cloud Platform | How to create bucket and upload files in GCP| Cloud Storage
報表下載頁
gcp cloud storeage : key https://www.youtube.com/watch?v=eh5ETIoMzOw
table keep
notify download url
========== plt-basic : db : FileDownloadRecordEntity ( id 报表来源 报表枚举 数据检索条件key值 文件地址 部门Id 管理员id status 创建时间 完成時間 )
========== 多 project 數據 join mq1. processMessageOrRequeue // default: requeue times: 6, requeue delay: 1min 調整參數 ( redis-hash.queryDoneCount 判斷 >= 2 , 如果沒有 requene , 6次失敗更新 FileDownloadRecordEntity.status ) : csv to gcp
mq2. FanoutExchange : msg(FileDownloadRecordEntity id : 1111 ) Listener 1. 需要查詢的 plt_user.vs_user_tag_relation , put data in redis , redis-hash.queryDoneCount hinctby 2. 需要查詢的 plt_fund.vs_withdraw , put data in redis , redis-hash.queryDoneCount hinctby
redis-hash : ttl:10min
key: FileDownloadRecordEntity-1111 (tablename-table.id)
value: {
queryDoneCount : 0
plt_user.vs_user_tag_relation.user_id (Listener) : [......]
plt_fund.vs_withdraw.user_id(Listener) : [.....]
}
===========
子查詢
//default: requeue times: 6, requeue delay: 1min
mq1. processMessageOrRequeue
( redis-hash.queryDoneCount 判斷 >= 1 往下一步走 , 如果沒有 requene , 6次失敗更新 FileDownloadRecordEntity.status ) :
mq2. FanoutExchange : msg(FileDownloadRecordEntity id : 1111 ) Listener 1. 需要查詢的 plt_account.vs_admin , put data in redis , redis-hash.queryDoneCount hinctby
redis-hash : ttl:10min
key: FileDownloadRecordEntity-1111 (tablename-table.id)
value: {
queryDoneCount : 0
plt_user.vs_user_tag_relation.user_id (Listener) : [......]
}
整理中間數據
mq3. processMessageOrRequeue
( redis-hash.queryDoneCount 判斷 >= 2 , csv to gcp , 如果沒有 requene , 6次失敗更新 FileDownloadRecordEntity.status ) :
mq4. FanoutExchange : msg(FileDownloadRecordEntity id : 1111 ) Listener 2. 需要查詢的 plt_fund.vs_payment , put data in redis , redis-hash.queryDoneCount hinctby
redis-hash : ttl:10min
key: FileDownloadRecordEntity-1111 (tablename-table.id)
value: {
queryDoneCount : 0
plt_user.vs_user_tag_relation.user_id (Listener) : [......]
plt_fund.vs_withdraw.user_id(Listener) : [.....]
}