Ejemplo n.º 1
0
def process_debt_transfer(dea_item_list, fp_item_list):
    for dea_item in dea_item_list:
        dea_index = dea_item_list.index(dea_item)
        while True:
            fp_item = fetch_fp_item(dea_index, fp_item_list)
            fp_id = fp_item['id']
            if fp_id > 0 or len(fp_item_list) == 0:
                break

        if len(fp_item_list) == 0 or fp_id == 0:
            print "all of the plan have finished debt match"
            return False
        if debt_price_dict['price'] > 20000000:
            print "all of the price have finished %s" % debt_price_dict['price']
            return False
        fp_dict[fp_id] += dea_item['price']
        debt_price_dict['price'] += dea_item['price']
        param = get_transfer_param(dea_item, fp_id)
        # print param
        time.sleep(3)
        try:
            process_request(path=url, data=param)
        except Exception, e:
            fp_dict[fp_id] -= dea_item['price']
            debt_price_dict['price'] -= dea_item['price']
            print e.message
Ejemplo n.º 2
0
def process_dea_repair():
    dea_list = fetch_dea_list()
    if dea_list is None:
        return
    param_list = map(map_param, dea_list)
    for param in param_list:
        process_request(url, param)
Ejemplo n.º 3
0
def process_unlock_bo(item_list):
    for item in filter(filter_paid_bo, item_list):
        # process_unlock_request(item)
        bo_id = item['bo_id']
        trans_id = item['trans_id']
        #print "unlock the bo %s trans id %s "%(bo_id, trans_id)
        process_request(path, get_transfer_param(bo_id, trans_id))
Ejemplo n.º 4
0
def read_data_from_csv(file_name="task.csv"):
    csv_reader = csv.reader(open(file_name))
    data_list = {31800954, 31800955, 31800963, 31800964, 31800965, 31800966, 31800967, 31800968, 31800969, 31800970, 31800971, 31800972, 31800973, 31800974, 31800975, 31800976, 31800977, 31800978, 31800979, 31800980, 31800981, 31800982, 31800983, 31800984, 31800985, 31800986, 31800987, 31800988, 31800989, 31800990, 31800991, 31800992, 31800993, 31800994, 31800995, 31800996, 31800997, 31800998, 31800999, 31801000, 31801001, 31801002, 31801003, 31801004, 31801005, 31801006, 31801007, 31801008, 31801009, 31801010, 31801011, 31801012, 31801013, 31801014, 31801015, 31801016, 31801017, 31801018, 31801019, 31801020, 31801021, 31801022, 31801023, 31801024, 31801025, 31801026, 31801027, 31801028, 31801029, 31801030, 31801031, 31801032, 31801033, 31801034, 31801035, 31801036, 31801037, 31801038, 31801039, 31801040, 31801041, 31801042, 31801043, 31801044, 31801045, 31801046, 31801047, 31801048, 31801049, 31801050, 31801051, 31801052, 31801053, 31801054, 31801055, 31801056, 31801057, 31801058, 31801059, 31801060, 31801061, 31801062, 31801063, 31801064, 31801065, 31801066, 31801067, 31801068, 31801069, 31801070, 31801071, 31801072, 31801073, 31801074, 31801075, 31801076, 31801077, 31801078, 31801079, 31801080, 31801081, 31801082, 31801083, 31801084, 31801085, 31801086, 31801087, 31801088, 31801089, 31801090, 31801091, 31801092, 31801093, 31801094, 31801095, 31801096, 31801097, 31801098, 31801099, 31801100, 31801101, 31801102, 31801103, 31801104, 31801105, 31801106, 31801107, 31801108, 31801109, 31801110, 31801111, 31801112, 31801113, 31801114, 31801115, 31801116, 31801117, 31801118, 31801119, 31801120, 31801121, 31801122, 31801123, 31801124, 31801125, 31801126, 31801127, 31801128, 31801129, 31801130, 31801131, 31801132, 31801133, 31801134, 31801135, 31801136, 31801137, 31801138, 31801139, 31801140, 31801141, 31801142, 31801143, 31801144, 31801145, 31801146, 31801147, 31801148, 31801149, 31801150, 31801151, 31801152, 31801153, 31801154, 31801155, 31801156, 31801157, 31801158, 31801159, 31801160, 31801161, 31801162, 31801163, 31801164, 31801165, 31801166, 31801167, 31801168, 31801169, 31801170, 31801171, 31801172, 31801173, 31801174, 31801175, 31801176, 31801177, 31801178, 31801179, 31801180, 31801181, 31801182, 31801183, 31801184, 31801185, 31801186, 31801187, 31801188, 31801189, 31801190, 31801191, 31801192, 31801193, 31801194, 31801195, 31801196, 31801197, 31801198, 31801199, 31801200, 31801201, 31801202, 31801203, 31801204, 31801205, 31801206, 31801207, 31801208, 31801209, 31801210, 31801211, 31801212, 31801213, 31801214, 31801215, 31801216, 31801217, 31801218, 31801219, 31801220, 31801221, 31801222, 31801223, 31801224, 31801225, 31801226, 31801227, 31801228, 31801229, 31801230, 31801231, 31801232, 31801233, 31801234, 31801235, 31801236, 31801237, 31801238, 31801239, 31801240, 31801241, 31801242, 31801243, 31801244, 31801245, 31801246, 31801247, 31801248, 31801249, 31801250, 31801251, 31801252, 31801253, 31801254, 31801255, 31801256, 31801257, 31801258, 31801259, 31801260, 31801261, 31801262, 31801263, 31801264, 31801265, 31801266, 31801267, 31801268, 31801269, 31801270, 31801271, 31801272, 31801273, 31801274, 31801275, 31801276, 31801277, 31801278, 31801279, 31801280, 31801281, 31801282, 31801283, 31801284, 31801285, 31801286, 31801287, 31801288, 31801289, 31801290, 31801291, 31801292, 31801293, 31801294, 31801295, 31801296, 31801297, 31801298, 31801299, 31801300, 31801301, 31801302, 31801303, 31801304, 31801305, 31801306, 31801307, 31801308, 31801309, 31801310, 31801311, 31801312, 31801313, 31801314, 31801315, 31801316, 31801317, 31801318, 31801319, 31801320, 31801321, 31801322, 31801323, 31801324, 31801325, 31801326, 31801327, 31801328, 31801329, 31801330, 31801331, 31801332, 31801333, 31801334, 31801335, 31801336, 31801337, 31801338, 31801339, 31801340, 31801341, 31801342, 31801343, 31801344, 31801345, 31801346, 31801347, 31801348, 31801349, 31801350, 31801351, 31801352, 31801353, 31801354, 31801355, 31801356, 31801357, 31801358, 31801359, 31801360, 31801361, 31801362, 31801363, 31801364, 31801365, 31801366, 31801367, 31801368, 31801369, 31801370, 31801371, 31801372, 31801373, 31801374, 31801375, 31801376, 31801377, 31801378, 31801379, 31801380, 31801381, 31801382, 31801383, 31801384, 31801385, 31801386, 31801387, 31801388, 31801389, 31801390, 31801391, 31801392, 31801393, 31801394, 31801395, 31801396, 31801397, 31801398, 31801399, 31801400, 31801401, 31801402, 31801403, 31801404, 31801405, 31801406, 31801407, 31801408, 31801409, 31801410, 31801411, 31801412, 31801413, 31801414, 31801415, 31801416, 31801417, 31801418, 31801419, 31801420, 31801421, 31801422, 31801423, 31801424, 31801425, 31801426, 31801427, 31801428, 31801429, 31801430, 31801431, 31801432, 31801433, 31801434, 31801435, 31801436, 31801437, 31801438, 31801439, 31801440, 31801441, 31801442, 31801443, 31801444, 31801721, 31801722, 31801723, 31801724, 31801725, 31801726, 31801727, 31801728, 31801729, 31801730, 31801731, 31801732, 31801733, 31801734, 31801735, 31801736, 31801737, 31801738, 31801739, 31801740, 31801741, 31801742, 31801743, 31801744, 31801745, 31801746, 31801747, 31801748, 31801749, 31801750, 31801751, 31801752, 31801753, 31801754, 31801755, 31801756, 31801757, 31801758, 31801759, 31801760, 31801761, 31801762, 31801763, 31801764, 31801765, 31801766, 31801767, 31801768, 31801769, 31801770, 31801771, 31801772, 31801773, 31801774, 31801775, 31801776, 31801777, 31801778, 31801779, 31801780, 31801781, 31801782, 31801783, 31801784, 31801785, 31801786, 31801787, 31801788, 31801789, 31801790, 31801791, 31801792, 31801793, 31801794, 31801795, 31801796, 31801797, 31801798}
    for row in data_list:
        defaut_dict = defaultdict()
        defaut_dict['taskId'] = row
        process_request(path, defaut_dict)
Ejemplo n.º 5
0
def transfer_debt(param_list):
    for dea_item in param_list:
        if price_dict['expect'] > expect_money:
            return
        price_dict['expect'] += dea_item['price']
        param = get_transfer_deb_param(0, dea_item, target_type=0)
        print param
        process_request(path, param)
Ejemplo n.º 6
0
def process_debt_change(va_id, target_id):
    sql = '''select va_id, bo_id, seri_no, user_id 
            from debt_exchange_account 
            where va_id = %s and price > 0 and status in (1,2) and bank_flag = 1 '''
    dea_list = db.query(sql=sql, param=(va_id, ))
    if len(dea_list) == 0:
        return None
    for dea_item in dea_list:
        data = get_transfer_deb_param(dea_item=dea_item, target_id=target_id, target_type=3)
        process_request(path=url, data=data)
def process_swith_bidder(fp_item):
    ''' path: http://XXXX.prod.com/XXXX-XXXX/financePlan/batchCreateAutoBidTask
        data : {
        "fpId": 8932,
        "autoBid": 1
    }'''
    param = dict()
    param["fpId"] = fp_item['id']
    param['autoBid'] = 1
    print "the fp is %s"%(fp_item["id"])
    process_request(path, param)
Ejemplo n.º 8
0
def process_transfer(dea_item_list):
    transfer_price = 0
    for dea_item in dea_item_list:
        transfer_price += dea_item['price']
        param = get_transfer_deb_param(23665, dea_item, target_type=3)
        #print param
        process_request(url, param)
        if transfer_price > expect_price:
            print "repurchase debt completed, the compelted price is %s" % (
                transfer_price)
            return
        # time.sleep(1)
    print "THE CURRENT PRICE IS %s" % (transfer_price)
Ejemplo n.º 9
0
def fetch_dea():
    # task_sql = '''select * from XXXX_debt_sale_task where task_type = 6 and status < 4'''
    dea_sql = '''select id from debt_exchange_account where va_id=%s and bo_id=%s and seri_no = %s '''

    task_list = conn.query(dea_va_sql, (80691, ))
    for task_item in task_list:
        bo_id = task_item['bo_id']
        va_id = task_item['from_id']
        seri_no = task_item['seri_no']
        dea_item = conn.query(dea_sql, (va_id, bo_id, seri_no))
        if len(dea_item) == 0:
            continue
        process_request(url, {"ids": str(dea_item[0]['id'])})
Ejemplo n.º 10
0
def process_debt_transfer(target_id, dea_list):
    filter_list = list(filter(filter_by_expect, dea_list))
    for dea_item in filter_list:
        param = dict()
        param['pid'] = dea_item["bo_id"]
        param['userId'] = dea_item["user_id"]
        param['vaId'] = dea_item['va_id']
        param['targetFpId'] = 0
        param['targetVaId'] = target_id
        param['fromType'] = 1
        param['seriNo'] = dea_item["seri_no"]
        process_request(url, param)
        print param
Ejemplo n.º 11
0
def process_history_data(bo_id):
    pending_sql = '''SELECT bo_id, trans_id FROM prod_debt_repayment_lock where bo_id = %s group by trans_id , bo_id HAVING count(1) <2 '''
    lock_list = conn.query(pending_sql, (bo_id, ))
    bo_dict = dict()
    if lock_list is None and len(lock_list) == 0:
        print "the bo %s have already unlocked" % (bo_id)
        return
    for item in lock_list:
        trans_id = item['trans_id']
        bo_id = item['bo_id']
        #print "repair the history data bo %s trans_id %s "%(item['bo_id'], item['trans_id'])
        if trans_id not in bo_dict:
            process_request(path, get_transfer_param(bo_id, trans_id))
            bo_dict[trans_id] = bo_id
            print "process_history_data bo %s transid %s" % (bo_id, trans_id)
Ejemplo n.º 12
0
def process_unlock_request(task_item):
    va_id = task_item['from_id']
    bo_id = task_item['bo_id']
    seri_no = task_item['seri_no']
    operation_sql = '''select * from XXXX_debt_operation_log where va_id = %s and bo_id=%s and seri_no=%s AND trans_type = 7 and status = 10'''
    operation_item_list = conn.query(operation_sql, (va_id, bo_id, seri_no))

    if len(operation_item_list) == 0:
        print "the bo %s is paying , the va_id is %s " % (bo_id, va_id)
        return

    for operation_item in operation_item_list:
        trans_id = operation_item['trans_id']
        repay_sql = '''select * from prod_debt_repayment_lock where bo_id = %s and trans_id = %s and status = 2 '''
        lock_item = conn.query_one(repay_sql, (bo_id, trans_id))
        if len(lock_item) == 0:
            process_request(path, get_transfer_param(bo_id, trans_id))
def process_debt_transfer(dea_item_list, fp_item_list):
    for dea_item in dea_item_list:
        dea_index = dea_item_list.index(dea_item)
        while True:
            fp_item = fetch_fp_item(dea_index, fp_item_list)
            fp_id = fp_item['id']
            if fp_id > 0 or len(fp_item_list) == 0:
                break

        if len(fp_item_list) == 0 or fp_id == 0:
            print "all of the plan have finished debt match"
            return False
        if price_dict['expect'] > 20000000:
            print "have transfer %s" % price_dict['expect']
            return False

        fp_dict[fp_id] += dea_item['price']
        param = get_transfer_param(dea_item, fp_id)
        # print param
        price_dict['expect'] += dea_item['price']
        time.sleep(3)
        process_request(path=url, data=param)
    return True
Ejemplo n.º 14
0
def process_resend_message(proof_item):
    error_msg = json.loads(proof_item['err_msg'])
    param = dict()
    param['transId'] = error_msg['transId']
    time.sleep(3)
    process_request(path, param)
Ejemplo n.º 15
0
def process_unlock_request(item):
    bo_id = item['bo_id']
    trans_id = item['trans_id']
    process_request(path, get_transfer_param(bo_id, trans_id))
    print "process_history_data bo %s transid %s" % (bo_id, trans_id)
Ejemplo n.º 16
0
def clear_cache(dea_list):
    for item in dea_list:
        bo_id = item["bo_id"]
        cache_key = "da_fang_dong_" + str(bo_id)
        process_request(path=url, data={"key": cache_key})
Ejemplo n.º 17
0
def transfer_debt(param_list):
    for dea_item in param_list:
        param = get_transfer_deb_param(0, dea_item, target_type=0)
        # print param
        process_request(path, param)
Ejemplo n.º 18
0
def process_deb_app_request(user_id):
    param = build_debt_param(user_id)
    before = datetime.datetime.now()
    process_request(debt_pc_url, param)
    print "the user %s get debt buy log from XXXX take %s ms" % (
        user_id, (datetime.datetime.now() - before).microseconds / 1000)
Ejemplo n.º 19
0
def repaire_dea():
    dea_va_sql = '''select * from debt_exchange_account where va_id=%s AND hold_num>0 and price =0 '''
    task_list = conn.query(dea_va_sql, (80691, ))
    for id_item in task_list:
        process_request(url, {"ids": str(id_item['id'])})