纸通宝新交易版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

146 lines
11 KiB

*** Settings ***
Library DateTime
Library Collections
Library RequestsLibrary
Library String
*** Test Cases ***
FactoringPartner
#获取保理id
Create Session factoring ${ztbscops} ${ztbsc_header}
${reps} GET On Session factoring ztb-user-enterprise-service/admin/scrap-paper/factor/get/factor-list params=certificationStatus=&status=&organizationName=小小保理&pageNum=1&pageSize=10
${FactoringId} Get From Dictionary ${reps.json()['data']['records'][0]} id #组织唯一标识
${organizationId} Get From Dictionary ${reps.json()['data']['records'][0]} organizationId #组织id
Set Global Variable ${FactoringId}
Set Global Variable ${organizationId}
#获取费纸厂类型保理客户数据
Create Session factoring ${uecclient} ${ztbsc_factoring_header}
${reps} GET On Session factoring factoring/user/get/factoring-partner-list params=pageNum=1&pageSize=30
${PartnerList} Get From Dictionary ${reps.json()['data']} records #保理客户列表
FOR ${PartnerInfo} IN @{PartnerList}
${bizRole} Get From Dictionary ${PartnerInfo} bizRole #客户组织类型
${PartnerId} Get From Dictionary ${PartnerInfo} id #客户id
${PartnerName} Get From Dictionary ${PartnerInfo} name #客户name
${PartnerOrgId} Get From Dictionary ${PartnerInfo} partnerOrgId #客户组织id
Exit For Loop If '${bizRole}'!='2'
END
Set Global Variable ${PartnerId}
Set Global Variable ${PartnerName}
Set Global Variable ${PartnerOrgId}
#获取纸厂类型保理客户数据
Create Session factoring ${uecclient} ${ztbsc_factoring_header}
${reps} GET On Session factoring factoring/user/get/factoring-partner-list params=pageNum=1&pageSize=30
${PaperPartnerList} Get From Dictionary ${reps.json()['data']} records #保理客户列表
FOR ${PaperPartnerInfo} IN @{PaperPartnerList}
${bizRole} Get From Dictionary ${PaperPartnerInfo} bizRole #客户组织类型
${PaperPartnerId} Get From Dictionary ${PaperPartnerInfo} id #客户id
${PaperPartnerName} Get From Dictionary ${PaperPartnerInfo} name #客户name
${PaperPartnerOrgId} Get From Dictionary ${PaperPartnerInfo} partnerOrgId #客户组织id
Exit For Loop If '${bizRole}'=='2'
END
Set Global Variable ${PaperPartnerId}
Set Global Variable ${PaperPartnerName}
Set Global Variable ${PaperPartnerOrgId}
#查询保理客户是否有银行卡
${reps} GET On Session factoring factoring/user/get/factoring-partner-details params=id=${PartnerId}
${ownBankAccount} Get From Dictionary ${reps.json()['data']} ownBankAccount #客户实体银行卡信息
${factoringBankAccount} Get From Dictionary ${reps.json()['data']} factoringBankAccount #客户虚拟银行卡信息
Run Keyword If ${factoringBankAccount}!=None log 已存在银行卡
... ELSE Run Keyword 保理客户添加银行卡
#正向保理额度信息
${reps} GET On Session factoring factoring/user/get/credit-line params=factoringPartnerId=${PartnerId}
${CreditId} Get From Dictionary ${reps.json()['data']} id #保理授信额度标识
Run Keyword If ${CreditId}!=None log 授信额度配置已存在
... ELSE Run Keyword 保存正向保理授信额度
#反向保理额度信息
${reps} GET On Session factoring factoring/user/get/credit-line params=factoringPartnerId=${PaperPartnerId}
${PaperCreditId} Get From Dictionary ${reps.json()['data']} id #保理授信额度标识
Run Keyword If ${PaperCreditId}!=None log 授信额度配置已存在
... ELSE Run Keyword 保存反向保理授信额度
ForwardContract
#获取核心企业信息
Create Session factoring ${ztbscops} ${ztbsc_factoring_header}
${reps} GET On Session factoring ztb-user-enterprise-service/user/get/paper-mill-list/for/option params=pageNum=1&pageSize=30
${PaperMillList} Get From Dictionary ${reps.json()['data']} records #核心纸业(纸厂)列表
${PaperMillInfo} Evaluate random.choice(${PaperMillList}) random #随机获取纸厂信息
${paperMillId} Get From Dictionary ${PaperMillInfo} paperMillId #核心企业id
${paperMillName} Get From Dictionary ${PaperMillInfo} paperMillName #核心企业name
${paperMillOrgId} Get From Dictionary ${PaperMillInfo} paperMillOrgId #核心企业组织名称
#创建正向保理合同
Create Session factoring ${ztbclient} ${ztbsc_factoring_header}
${Time} Get Time #获取当前时间
${EndTime} Add Time To Date ${Time} 30 days
${endDate} Get Substring ${EndTime} 0 19
${startDate} Set Variable ${Time} #保理合同开始时间
${maxPeriod} Evaluate random.randint(30,75) random #最长账期
${InterestRate} Evaluate round(random.uniform(8,15),1) random #年化利率(%)
${factoringType} Set Variable [3021,3022]
${factoringType} Evaluate random.choice(${factoringType}) random #保理类型
${ServiceFeeType} Set Variable [3041,3042,3043,3044]
${ServiceFeeType} Evaluate random.choice(${ServiceFeeType}) random #保理服务费类型
Run Keyword If ${ServiceFeeType}==3041 Run Keyword ServiceFee3041
... ELSE IF ${ServiceFeeType}==3042 Run Keyword ServiceFee3042
... ELSE IF ${ServiceFeeType}==3043 Run Keyword ServiceFee3043
... ELSE Run Keyword ServiceFee3044 #按车结算 #按吨结算-扣点前 #按吨结算-扣点后 #按百分比结算
${Contract} Set Variable { \ \ \ \ "firstPartyOrgId":"${paperMillOrgId}", \ \ \ \ "thirdPartyOrgId":"${PartnerOrgId}", \ \ \ \ "contractName":"${paperMillName}-${PartnerName}(正向)", \ \ \ \ "receiveAccountType":${factoringType}, \ \ \ \ "factoringType":3031, \ \ \ \ "maxPeriod":${maxPeriod}, \ \ \ \ "factoringServiceFeeType":${ServiceFeeType}, \ \ \ \ "factoringServiceFee":${ServiceFee}, \ \ \ \ "factoringAnnualInterestRate":${InterestRate}, \ \ \ \ "startDate":"${startDate}", \ \ \ \ "endDate":"${endDate}", \ \ \ \ "secondPartyOrgId":"${organizationId}" }
${reps} POST On Session factoring ztb-supply-chain-service/user/create/factoring-contract ${Contract.encode('utf-8')}
ReverseContract
#获取上游供应商信息
#${reps} GET On Session factoring ztb-user-enterprise-service/user/page/supplier/by-keyword params=pageNum=1&pageSize=30
#${SupplierList} Get From Dictionary ${reps.json()['data']} records #上游供应商列表
#${SupplierInfo} Evaluate random.choice(${SupplierList}) random #随机获取上游供应商信息
#${SupplierName} Get From Dictionary ${SupplierInfo} fullName #上游供应商name
#${SupplierOrgId} Get From Dictionary ${SupplierInfo} organizationId #上游供应商组织名称
#创建反向保理合同
Create Session factoring ${ztbclient} ${ztbsc_factoring_header}
${Time} Get Time #获取当前时间
${EndTime} Add Time To Date ${Time} 30 days
${endDate} Get Substring ${EndTime} 0 19 #保理合同结束时间
${startDate} Set Variable ${Time} #保理合同开始时间
${maxPeriod} Evaluate random.randint(30,75) random #最长账期
${InterestRate} Evaluate round(random.uniform(8,15),1) random #年化利率(%)
${factoringType} Set Variable [3021,3022]
${factoringType} Evaluate random.choice(${factoringType}) random #保理类型
${Contract} Set Variable { \ \ \ \ "contractName":"${PaperPartnerName}-${PartnerName}(反向)", \ \ \ \ "firstPartyOrgId":"${PaperPartnerOrgId}", \ \ \ \ "thirdPartyOrgId":"${PartnerOrgId}", \ \ \ \ "maxPeriod":${maxPeriod}, \ \ \ \ "receiveAccountType":${factoringType}, \ \ \ \ "factoringType":3032, \ \ \ \ "startDate":"${startDate}", \ \ \ \ "endDate":"${endDate}", \ \ \ \ "factoringAnnualInterestRate":${InterestRate}, \ \ \ \ "secondPartyOrgId":"${organizationId}" }
${reps} POST On Session factoring ztb-supply-chain-service/user/create/factoring-contract ${Contract.encode('utf-8')}
*** Keywords ***
保理客户添加银行卡
#保理客户添加银行卡
Create Session factoring ${uecclient} ${ztbsc_factoring_header}
${Code} Evaluate random.randint(11111111,22222222) random
${BankData} Set Variable { \ \ \ \ "bankAccountName":"${Code}", \ \ \ \ "bankName":"${Code}", \ \ \ \ "bankCardNo":"${Code}", \ \ \ \ "bankBranchName":"${Code}", \ \ \ \ "cnapsCode":"${Code}", \ \ \ \ "factorId":"${FactoringId}", \ \ \ \ "factorOrgId":"${organizationId}", \ \ \ \ "partnerId":"${PartnerId}" }
${reps} POST On Session factoring factoring/user/create/factoring-bank-account ${BankData.encode('utf-8')}
Should Be Equal As Strings ${reps.json()['message']} successful
保存正向保理授信额度
#编辑保理额度
Create Session factoring ${uecclient} ${ztbsc_factoring_header}
${Amount} Evaluate random.randint(10000,50000) random #随机获取保理额度
${CreditData} Set Variable { \ \ \ \ "id":null, \ \ \ \ "creditAmount":${Amount}, \ \ \ \ "usedCreditAmount":null, \ \ \ \ "factoringType":3031, \ \ \ \ "factoringPartnerId":"${PartnerId}", \ \ \ \ "factorOrgId":"${organizationId}" }
${reps} POST On Session factoring factoring/user/save/credit-line ${CreditData.encode('utf-8')}
保存反向保理授信额度
#编辑保理额度
Create Session factoring ${uecclient} ${ztbsc_factoring_header}
${Amount} Evaluate random.randint(100000,500000) random #随机获取保理额度
${CreditData} Set Variable { \ \ \ \ "id":null, \ \ \ \ "creditAmount":${Amount}, \ \ \ \ "usedCreditAmount":null, \ \ \ \ "factoringType":3032, \ \ \ \ "factoringPartnerId":"${PaperPartnerId}", \ \ \ \ "factorOrgId":"${organizationId}" }
${reps} POST On Session factoring factoring/user/save/credit-line ${CreditData.encode('utf-8')}
ServiceFee3041
${ServiceFee} Evaluate random.randint(1000,1500) random
Set Global Variable ${ServiceFee}
ServiceFee3042
${ServiceFee} Evaluate round(random.uniform(0.01,0.02),3) random
Set Global Variable ${ServiceFee}
ServiceFee3043
${ServiceFee} Evaluate round(random.uniform(0.01,0.02),3) random
Set Global Variable ${ServiceFee}
ServiceFee3044
${ServiceFee} Evaluate random.randint(5,15) random
Set Global Variable ${ServiceFee}