# -*- coding: utf-8 -*-
import os
import sys
import datetime
import threading
from itertools import product
from threading import Thread

import pandas as pd
from dateutil.relativedelta import relativedelta

from sqlalchemy import create_engine
import multiprocessing as mtp

reload(sys)
sys.setdefaultencoding('utf8')

# 说明文档 ：http://confluence.quantgroup.cn/pages/viewpage.action?pageId=4446042
# 查询条件 代偿，充值提现，追偿

engine_payment_center = create_engine(
    'mysql+mysqldb://bowang:in78u6ytgbhj56r@192.168.4.6:8066/payment_center?charset=utf8',
    echo=False)

sql_query_compensation = """
SELECT amount,channel_serial_no,merchant_order_no,merchant_repay_order_no,updated_at FROM hf_compensatory WHERE is_active=1 AND status=3;
"""

sql_query_history = """
SELECT amount,channel_serial_number,merchant_order_no,order_id,updated_at,event_type,event_status FROM hf_event_status_history WHERE is_success=1 AND  (event_type=6 OR (event_type=4 AND event_status=3))
"""

df_compensation = pd.read_sql(sql=sql_query_compensation,con=engine_payment_center)


