Exemplo n.º 1
0
    def test_01api_78dk_platform_tm_first_viewFirstCheckContract(self):
        # 初审信息查询
        # {'uid': '合同uuid'}
        # contract_uuid = '1e9fe3d0be2344e2acfda1a025a607e2'
        sql = 'contract_uuid="' + contract_uuid + '" and state ="enabled"'
        channelid = MysqlClent.select(loginAction.DB,
                                      'Tbl_Contract',
                                      condition=sql)
        # print(type(channelid[0]),channelid[0])
        # 查询商户名称
        sql = 'id="' + str(channelid[0][4]) + '" and state ="enabled"'
        merchantname = MysqlClent.select_one(loginAction.DB,
                                             'Tbl_MerchantProfile', 'name',
                                             sql)
        # 查询资金包
        sql = 'id="' + str(channelid[0][6]) + '" and state ="enabled"'
        fundname = MysqlClent.select_one(loginAction.DB, 'Tbl_FundPackage',
                                         'name', sql)
        print(merchantname, fundname, channelid[0][22])
        # fundSideName 资方名称
        sql = 'select Tbl_FundSide.name from Tbl_FundSide ,Tbl_FundPackage,Tbl_FundSidePackageRelation WHERE ' \
              'Tbl_FundPackage.id={} and Tbl_FundPackage.id=Tbl_FundSidePackageRelation.fund_package_id and ' \
              'Tbl_FundSide.id=Tbl_FundSidePackageRelation.fund_side_id ;'.format(channelid[0][6])
        fundsidename = MysqlClent.executed_one(loginAction.DB, sql)

        res = PlatformAction.test_api_78dk_platform_tm_first_viewFirstCheckContract(
            contract_uuid)
        # # 法大大地址:
        contract_uuidurl = 'select Tbl_ContractInfo.view_url from Tbl_ContractInfo,Tbl_Contract where ' \
                           'Tbl_Contract.contract_uuid=\'{}\' and Tbl_Contract.id=Tbl_ContractInfo.contract_id' \
            .format(contract_uuid)
        contract_uuid1 = MysqlClent.executed_one(loginAction.DB,
                                                 contract_uuidurl)
        # # 分数
        score = 'select score from Tbl_QifaMachineLog where contract_uuid=\'{}\';'.format(
            contract_uuid)
        score1 = MysqlClent.executed_all(loginAction.DB, score)
        # 查询门店信息
        storenamesql = 'select Tbl_Store.business_address from Tbl_Store,Tbl_Contract where ' \
                       'Tbl_Contract.storm_id={} and Tbl_Contract.storm_id=Tbl_Store.id and ' \
                       'Tbl_Contract.contract_uuid=\'{}\';'.format(channelid[0][5], contract_uuid)
        storename = MysqlClent.executed_all(loginAction.DB, storenamesql)
        Assertion.verity(json.loads(res)['msg'], '成功')
        Assertion.verity(json.loads(res)['code'], '10000')
        Assertion.verity(json.loads(res)['data']['fddUrl'], contract_uuid1)
        Assertion.verity(
            json.loads(res)['data']['earlyRepaymentSupport'], channelid[0][21])
        Assertion.verity(json.loads(res)['data']['merchantName'], merchantname)
        # Assertion.verity(json.loads(res)['data']['aliscore'], '550000.00000000')
        Assertion.verity(
            json.loads(res)['data']['contractNumber'], channelid[0][8])
        Assertion.verity(json.loads(res)['data']['fundPackageName'], fundname)
        # Assertion.verity(json.loads(res)['data']['score'], str(score1[0][0]))
        Assertion.verity(json.loads(res)['data']['fundSideName'], fundsidename)
        # Assertion.verity(json.loads(res)['data']['repaymentMethod'], 'DBDX')
        # Assertion.verity(json.loads(res)['data']['storeName'], storename[0][0])
        # 查询商户贴息费率  discount_rate
        discountRatesql = 'select discount_rate FROM Tbl_Contract WHERE contract_uuid="{}" ' \
                          'and state ="enabled" '.format(contract_uuid)
        discountRate = MysqlClent.executed_all(loginAction.DB, discountRatesql)
        print('bbbbbbbbbbbbbbbbb', discountRate)
        # Assertion.verity(json.loads(res)['data']['discountRate'], discountRate[0][0])
        # 查询产品名称
        productNamesql = ' select Tbl_ProductDetail.name from Tbl_ProductDetail,Tbl_Contract where ' \
                         'Tbl_Contract.product_id=Tbl_ProductDetail.id and Tbl_Contract.contract_uuid=\'{}\'; ' \
            .format(contract_uuid)
        productName = MysqlClent.executed_all(loginAction.DB, productNamesql)
        Assertion.verity(
            json.loads(res)['data']['productName'], productName[0][0])
        Assertion.verity(json.loads(res)['data']['aliOpinion'], '网商审核通过')
        # 查询期数信息
        loanPeriodssql = 'SELECT loan_periods FROM Tbl_Contract where contract_uuid=\'{}\';'.format(
            contract_uuid)
        loanPeriods = MysqlClent.executed_all(loginAction.DB, loanPeriodssql)
        Assertion.verity(
            json.loads(res)['data']['loanPeriods'], loanPeriods[0][0])
        # 查询个人基本资料
        personsql = 'SELECT tpb.* FROM Tbl_Contract tc, Tbl_ContractPersonBasicRelation tcpr, Tbl_PersonBasicInfo tpb ' \
                    'where tc.contract_uuid=\'{}\' and tc.id=tcpr.contract_id and tcpr.person_basic_info_id=tpb.id;' \
            .format(contract_uuid)
        person = MysqlClent.executed_all(loginAction.DB, personsql)
        # Assertion.verity(json.loads(res)['data']['person'], '个人基本资料')
        Assertion.verity(
            json.loads(res)['data']['person']['homeType'], person[0][6])
        Assertion.verity(
            json.loads(res)['data']['person']['idCardNumber'], person[0][3])
        Assertion.verity(
            json.loads(res)['data']['person']['immediateFamilyName'],
            person[0][7])
        Assertion.verity(
            json.loads(res)['data']['person']['immediateFamilyPhone'],
            person[0][9])
        Assertion.verity(
            json.loads(res)['data']['person']['immediateFamilyRelation'],
            person[0][8])
        Assertion.verity(
            json.loads(res)['data']['person']['name'], person[0][2])
        Assertion.verity(
            json.loads(res)['data']['person']['phone'], person[0][4])
        Assertion.verity(
            json.loads(res)['data']['person']['typeOfJob'], person[0][5])
        # 查询 overdue_handling_fee_rate  逾期手续费率 - 手续费'
        overdue_handling_fee_ratesql = 'SELECT overdue_handling_fee_rate FROM Tbl_Contract where contract_uuid=\'{}\';' \
            .format(contract_uuid)
        overdueHandlingFeeRate = MysqlClent.executed_all(
            loginAction.DB, overdue_handling_fee_ratesql)
        # Assertion.verity(json.loads(res)['data']['overdueHandlingFeeRate'], overdueHandlingFeeRate[0][0])
        # 提前还款手续费
        earlyRepaymentHandlingFeesql = 'SELECT early_repayment_handling_fee FROM Tbl_Contract where contract_uuid=\'{}\';' \
            .format(contract_uuid)
        earlyRepaymentHandlingFee = MysqlClent.executed_all(
            loginAction.DB, earlyRepaymentHandlingFeesql)
        # Assertion.verity(json.loads(res)['data']['earlyRepaymentHandlingFee'], earlyRepaymentHandlingFee[0][0])
        # submit_state
        submitStatesql = 'SELECT submit_state FROM Tbl_Contract where contract_uuid=\'{}\';'.format(
            contract_uuid)
        submitState = MysqlClent.executed_all(loginAction.DB, submitStatesql)
        # Assertion.verity(json.loads(res)['data']['submitState'], submitState[0][0])
        # 用户签订日期查询
        signingDatesql = 'SELECT signing_date FROM Tbl_Contract where contract_uuid=\'{}\';'.format(
            contract_uuid)
        signingDate = MysqlClent.executed_all(loginAction.DB, signingDatesql)
        # Assertion.verity(json.loads(res)['data']['signingDate'], signingDate[0][0])
        # 查询分期手续费率   精度问题
        periodRatesql = 'SELECT period_rate FROM Tbl_Contract where contract_uuid=\'{}\';'.format(
            contract_uuid)
        periodRate = MysqlClent.executed_all(loginAction.DB, periodRatesql)
        # Assertion.verity(json.loads(res)['data']['periodRate'], periodRate[0][0])
        #  查询宽限期
        gracePeriodsql = 'SELECT grace_period FROM Tbl_Contract where contract_uuid=\'{}\';'.format(
            contract_uuid)
        gracePeriod = MysqlClent.executed_all(loginAction.DB, gracePeriodsql)
        # Assertion.verity(json.loads(res)['data']['gracePeriod'], gracePeriod[0][0])
        # 查询贷款金额 loan_amount   精度问题  '20000' != Decimal('20000.00000000')
        loan_amountsql = 'SELECT loan_amount FROM Tbl_Contract where contract_uuid=\'{}\';'.format(
            contract_uuid)
        loanAmount = MysqlClent.executed_all(loginAction.DB, loan_amountsql)
        # Assertion.verity(json.loads(res)['data']['loanAmount'], loanAmount[0][0])
        # 查询   逾期手续费率 - 本金
        overduePrincipalRatesql = 'SELECT overdue_principal_rate FROM Tbl_Contract where contract_uuid=\'{}\';'.format(
            contract_uuid)
        overduePrincipalRate = MysqlClent.executed_all(
            loginAction.DB, overduePrincipalRatesql)
        # Assertion.verity(json.loads(res)['data']['overduePrincipalRate'], overduePrincipalRate[0][0])
        # 提前还款周期
        earlyRepaymentFreeCyclesql = 'SELECT early_repayment_free_cycle FROM Tbl_Contract where contract_uuid=\'{}\';'.format(
            contract_uuid)
        earlyRepaymentFreeCycle = MysqlClent.executed_all(
            loginAction.DB, earlyRepaymentFreeCyclesql)
        # 支付宝审核日志
        alipayAuditLogssql = 'SELECT talog.opinion,talog.alipay_audit FROM Tbl_Contract tc ,Tbl_AlipayAuditLog talog  ' \
                             'where tc.contract_uuid=\'{}\' and talog.contract_id=tc.id;'.format(contract_uuid)
        alipayAuditLogs = MysqlClent.executed_all(loginAction.DB,
                                                  alipayAuditLogssql)
        Assertion.verity(
            json.loads(res)['data']['alipayAuditLogs']['opinion'],
            alipayAuditLogs[0][0])
        # 影响资料信息
        contractImagessql = 'SELECT tcim.* FROM Tbl_Contract tc ,Tbl_ContractImage tcim where tc.contract_uuid=\'{}\'' \
                            ' and tc.id=tcim.contract_id ORDER BY tcim.id ASC;'.format(contract_uuid)
        contractImages = MysqlClent.executed_all(loginAction.DB,
                                                 contractImagessql)
        # 身份证照片(正面)
        Assertion.verity(
            json.loads(res)['data']['contractImages'][0]['key'],
            contractImages[0][4])
        Assertion.verity(
            json.loads(res)['data']['contractImages'][0]['keyName'],
            contractImages[0][6])
        # 身份证照片(反面)
        Assertion.verity(
            json.loads(res)['data']['contractImages'][1]['key'],
            contractImages[1][4])
        Assertion.verity(
            json.loads(res)['data']['contractImages'][1]['keyName'],
            contractImages[1][6])
Exemplo n.º 2
0
def get_permission_id():
    # 返回一个
    id = mydb.executed_one(conn=DB_CONN,
                           query='select {} from {}'.format(
                               'id', 'Tbl_Role_Permission'))
    return id