Exemple #1
0
 def __init__(self, config):
     ppbao_config = PPBaoConfig(config)
     ppdloginid, dbhost, dbuser, dbpwd, dbname = ppbao_config.read_ppbao_config(
     )
     PPBaoUtil.init_logging('test_bid_strategy', ppbao_config.logdir)
     ppddao = PPDDAO({
         'host': dbhost,
         'username': dbuser,
         'password': dbpwd,
         'database': dbname
     })
     ppddao.connect()
     self.loandao = PPDLoanDAO(ppddao)
     self.userdao = PPDUserDAO(ppddao)
     unidao = UniversityDAO(ppddao)
     PPBaoUtil.set_university_to_rank(unidao.get_university_ranks())
     self.bid_strategy = BidStrategyPlus(ppbao_config)
     self.date_to_bids = {}
Exemple #2
0
    def get_all_ppdusers(self):
        db_stat = "select * from ppduser"
        ppduser_hash = {}
        if (self.dao.execute(db_stat)):
            data = self.dao.dbcursor.fetchall()
            for results in data:
                ppduser_hash[results[0]] = self.parse_ppduser_db_row(results)
            return ppduser_hash
        else:
            logging.error("Not able to get PPDUsers")
            return None


if __name__ == '__main__':

    from dao.UniversityDAO import UniversityDAO
    from util.PPBaoUtil import PPBaoUtil
    ppddao = PPDDAO({
        'host': 'localhost',
        'username': '******',
        'password': '******',
        'database': 'ppdai'
    })
    ppddao.connect()
    ppduserdao = PPDUserDAO(ppddao)
    unidao = UniversityDAO(ppddao)
    PPBaoUtil.set_university_to_rank(unidao.get_university_ranks())
    ppduser = ppduserdao.get_db_ppduser_by_userid('pdu26068827')
    print ppduser.to_string()
    ppddao.disconnect()
Exemple #3
0
                ppdloan.ppduser = ppduser
                ppdloan.loantitle = results[14]
                ppdloan.set_history_info(int(results[7]), int(results[8]), int(results[9]), int(results[10]), int(results[11]), int(results[12]))
                ppdloan.has_30or36rate_loan_history = int(results[17])
                ppdloan.new_total_loan = int(results[18])
                ppdloan.history_highest_total_loan = int(results[19])
                ppdloan_list.append(ppdloan)
            return ppdloan_list
        else:
            logging.error("No ppdloan in DB found for in last %d days" % (ndays))
            return None
                    
                    
if __name__ == '__main__':
    from dao.UniversityDAO import UniversityDAO
    from dao.PPDDAO import PPDDAO
    from dao.PPDUserDAO import PPDUserDAO
    from util.PPBaoUtil import PPBaoUtil
    import sys
    reload(sys)
    sys.setdefaultencoding('utf8')

    ppddao = PPDDAO({'host':'localhost','username':'******','password':'******','database':'ppdai'})
    ppddao.connect()
    loandao = PPDLoanDAO(ppddao)
    userdao = PPDUserDAO(ppddao)
    unidao = UniversityDAO(ppddao)
    PPBaoUtil.set_university_to_rank(unidao.get_university_ranks())
    loan = loandao.get_db_ppdloan_by_loanid(12000659, userdao)
    print loan.get_loan_summary()
    ppddao.disconnect()