纸通宝新交易版
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.
 
 

141 lines
17 KiB

*** Settings ***
Library RequestsLibrary
Library Collections
Library DateTime
Library urllib3
Library String
*** Test Cases ***
AgentOrg
#创建代理商组织
Create Session agent ${ztbscops} ${ztbsc_header}
${DataTime} Get Current Date result_format=%Y-%m-%d
${OrgData} Set Variable { \ \ \ \ "fullName":"测试代理商${DataTime}" }
${reps} POST On Session agent ztb-user-enterprise-service/admin/scrap-paper/agent/create ${OrgData.encode('utf-8')}
${AgentId} Get From Dictionary ${reps.json()['data']} id #代理商id
${AgentOrgId} Get From Dictionary ${reps.json()['data']} organizationId #代理商组织id
Set Global Variable ${AgentOrgId}
sleep 0.5
#获取创建的代理商信息
${reps} GET On Session agent ztb-user-enterprise-service/admin/scrap-paper/agent/get/agent-list params=certificationStatus=&status=&pageNum=1&pageSize=10
${AgentList} Get From Dictionary ${reps.json()['data']} records #代理商列表
FOR ${items} IN @{AgentList}
${AgentOrgId} Get From Dictionary ${items} organizationId #代理商组织id
${AgentFullName} Get From Dictionary ${items} fullName #代理商组织名称
Exit For Loop If '${AgentOrgId}'=='${AgentOrgId}'
END
Set Global Variable ${AgentFullName}
#创建代理商店铺信息
${SaleNum} Evaluate random.randint(1000,3000) random #线下交易吨数
${TradingVolume} Evaluate ${SaleNum}*1000
${StoreData} Set Variable { \ \ \ \ "id":null, \ \ \ \ "ownerAgentId":"${AgentId}", \ \ \ \ "name":"${AgentFullName}的店铺", \ \ \ \ "introduction":null, \ \ \ \ "logoImgUrl":"", \ \ \ \ "offlineHistoricalTradingVolume":${TradingVolume} }
${reps} POST On Session agent ztb-supply-chain-service/admin/save/scrap-paper-store ${StoreData.encode('utf-8')}
#获取店铺信息
${reps} GET On Session agent ztb-supply-chain-service/admin/scrap-paper/store/get/${AgentId}
${AgentStoreId} Get From Dictionary ${reps.json()['data']} id #代理商组织店铺id
Set Global Variable ${AgentStoreId}
#修改代理商税务信息
Create Session agent ${uecops} ${ztbsc_header}
${TaxInfo} Set Variable { \ \ \ \ "inputTaxPoint":"2052,2053,2054", \ \ \ \ "salesTaxPoint":2052, \ \ \ \ "organizationId":"${AgentOrgId}" }
${reps} POST On Session agent uec/admin/save/enterprise-tax-info ${TaxInfo.encode('utf-8')}
PaperMillOrg
#创建造纸厂组织
Create Session papermill ${ztbscops} ${ztbsc_header}
${DataTime} Get Current Date result_format=%Y-%m-%d
${OrgData} Set Variable { \ \ \ \ "fullName":"测试造纸厂${DataTime}" }
${reps} POST On Session papermill ztb-user-enterprise-service/admin/paper-mill/create ${OrgData.encode('utf-8')}
${PaperMillId} Get From Dictionary ${reps.json()['data']} id #造纸厂id
${PaperMillOrgId} Get From Dictionary ${reps.json()['data']} organizationId #造纸厂组织id
Set Global Variable ${PaperMillId}
Set Global Variable ${PaperMillOrgId}
sleep 0.5
#获取创建的纸厂信息
${reps} GET On Session papermill ztb-user-enterprise-service/admin/paper-mill/get/paper-mill-list params=certificationStatus=&status=&pageNum=1&pageSize=10
${PaperList} Get From Dictionary ${reps.json()['data']} records #造纸厂列表
FOR ${items} IN @{PaperList}
${PaperOrgId} Get From Dictionary ${items} organizationId #纸厂组织id
${PaperFullName} Get From Dictionary ${items} fullName #纸厂组织名称
Exit For Loop If '${PaperOrgId}'=='${PaperMillOrgId}'
END
Set Global Variable ${PaperFullName}
#修改造纸厂税务信息
Create Session papermill ${uecops} ${ztbsc_header}
${TaxInfo} Set Variable { \ \ \ \ "inputTaxPoint":"2051,2052,2053,2054", \ \ \ \ "salesTaxPoint":null, \ \ \ \ "organizationId":"${PaperMillOrgId}" }
${reps} POST On Session papermill uec/admin/save/enterprise-tax-info ${TaxInfo.encode('utf-8')}
Sleep 0.5
Information
#新增纸厂情报
#获取当前时间未添加情报纸厂列表
${statsDate} Get Current Date result_format=%Y-%m-%d #获取当前日期
Create Session information ${ztbscops} ${ztbsc_header}
${reps} GET On Session information ztb-supply-chain-service/admin/get/paper-mill-info/selectable-paper-mill-list params=pageNum=1&pageSize=30&statsDate=${statsDate}&paperMillName=${PaperFullName}
${PaperMillList} Get From Dictionary ${reps.json()['data']} records #选择时间没有情报的纸厂列表
FOR ${PpaerMill} IN @{PaperMillList}
${paperMillId} Get From Dictionary ${PpaerMill} paperMillId #造纸厂id
Exit For Loop If '${paperMillId}'=='${PaperMillId}'
END
#确认新增
${InfoData} Set Variable { \ \ \ \ "informationStatistics":{ \ \ \ \ \ \ \ \ "startingDeductionPoint":null \ \ \ \ }, \ \ \ \ "paperMillId":"${paperMillId}", \ \ \ \ "receivedWeight":{ \ \ \ \ \ \ \ \ "retainedQuantity":null, \ \ \ \ \ \ \ \ "totalQuantity":null \ \ \ \ }, \ \ \ \ "statsDate":"${statsDate}" }
${reps} POST On Session information ztb-supply-chain-service/admin/create/paper-mill-info ${InfoData.encode('utf-8')}
#获取纸品大类
Create Session information ${ztbops} ${ztbsc_header}
${reps} GET On Session information recycle-user-center/admin/get/first-two-level-product-category
${categoryList} Get From Dictionary ${reps.json()['data'][0]} categoryList #废纸列表
${CategoryInfo} Evaluate random.choice(${categoryList}) random #随机获取纸品大类
${parentId} Get From Dictionary ${CategoryInfo} id #纸品大类id
${MainCategoryName} Get From Dictionary ${CategoryInfo} name #纸品大类name
#创建纸厂品类
${CategoryData} Set Variable { \ \ \ \ "toCreateCategoryList":[ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ "paperMillScrapPaperCategoryName":"一级纸", \ \ \ \ \ \ \ \ \ \ \ \ "parentId":"${parentId}", \ \ \ \ \ \ \ \ \ \ \ \ "sortNumber":1, \ \ \ \ \ \ \ \ \ \ \ \ "paperMillId":"${paperMillId}" \ \ \ \ \ \ \ \ } \ \ \ \ ], \ \ \ \ "toUpdateCategoryList":[ \ \ \ \ \ ], \ \ \ \ "toDeleteCategoryList":[ \ \ \ \ \ ] }
Create Session information ${ztbscops} ${ztbsc_header}
${reps} POST On Session information ztb-supply-chain-service/admin/save/scrap-paper-category ${CategoryData.encode('utf-8')}
#获取纸厂品类信息
${reps} GET On Session information ztb-supply-chain-service/admin/list/scrap-paper-category/by/${paperMillId}
${CategoryId} Get From Dictionary ${reps.json()['data'][0]} id #纸厂品类id
${CategoryName} Get From Dictionary ${reps.json()['data'][0]} paperMillScrapPaperCategoryName #纸厂品类name
Set Global Variable ${CategoryId}
Set Global Variable ${CategoryName}
#发布纸厂品类报价
${Time} Get Time #获取当前时间
${quotedPrice} Evaluate round(random.uniform(1,2.5),2) random #随机获取纸厂价格
${CategoryQuotePrice} Set Variable { \ \ \ \ "categoryQuoteList":[ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ "id":null, \ \ \ \ \ \ \ \ \ \ \ \ "scrapPaperCategoryQuoteEffectiveTimeId":null, \ \ \ \ \ \ \ \ \ \ \ \ "paperMillScrapPaperCategoryId":"${CategoryId}", \ \ \ \ \ \ \ \ \ \ \ \ "paperMillScrapPaperCategoryName":"${CategoryName}", \ \ \ \ \ \ \ \ \ \ \ \ "paperMillScrapPaperMainCategoryName":"${MainCategoryName}", \ \ \ \ \ \ \ \ \ \ \ \ "quotedPrice":${quotedPrice}, \ \ \ \ \ \ \ \ \ \ \ \ "totalQuotedPrice":0, \ \ \ \ \ \ \ \ \ \ \ \ "sortNumber":1, \ \ \ \ \ \ \ \ \ \ \ \ "publicSubsidies":"", \ \ \ \ \ \ \ \ \ \ \ \ "allowOrder":1, \ \ \ \ \ \ \ \ \ \ \ \ "floatingQuotedPrice":"", \ \ \ \ \ \ \ \ \ \ \ \ "inspectionNote":null, \ \ \ \ \ \ \ \ \ \ \ \ "parentId":${parentId}, \ \ \ \ \ \ \ \ \ \ \ \ "quoteEffectiveTime":null, \ \ \ \ \ \ \ \ \ \ \ \ "paperMillId":"${paperMillId}" \ \ \ \ \ \ \ \ } \ \ \ \ ], \ \ \ \ "id":null, \ \ \ \ "isUpdatedFloatingQuotedPrice":false, \ \ \ \ "paperMillId":"${paperMillId}", \ \ \ \ "quoteEffectiveTime":"${Time}" }
${reps} POST On Session information ztb-supply-chain-service/admin/create/scrap-paper-category-quote-effective-time ${CategoryQuotePrice.encode('utf-8')}
Set Global Variable ${quotedPrice}
#获取纸厂品类报价列表
${reps} GET On Session information ztb-supply-chain-service/admin/get/paper-mill-purchase/scrap-paper-category-quote-list params=paperMillId=${paperMillId}&pageNum=1&pageSize=10
${PaperMillQuoteId} Get From Dictionary ${reps.json()['data']['records'][0]} id #纸厂品类报价id
AgencyPaperMillContract
#创建代理纸厂合同
#选择纸厂
Create Session agent ${ztbscops} ${ztbsc_header}
${reps} GET On Session agent ztb-user-enterprise-service/admin/get/paper-mill-list/by-name params=pageNum=1&pageSize=30&keyword=${PaperFullName}
${paperMillId} Get From Dictionary ${reps.json()['data']['records'][0]} paperMillId #获取纸厂id
#获取代理商税务信息
${reps} GET On Session agent ztb-supply-chain-service/admin/match/tax-point params=agentOrgId=${AgentOrgId}&paperMillOrgId=${PaperMillOrgId}
${agentInputTaxPointList} Get From Dictionary ${reps.json()['data']} agentInputTaxPointList #代理商进项税点List
${2052} Get From List ${agentInputTaxPointList} 0
${2053} Get From List ${agentInputTaxPointList} 1
${2054} Get From List ${agentInputTaxPointList} 2
${agentSalesTaxPoint} Get From Dictionary ${reps.json()['data']} agentSalesTaxPoint #代理商销项税点
#创建代理支持供应链合同
${Time} Get Time #获取当前时间
${endTime} Get Current Date result_format=%Y-%m-%d 23:59:59
${endDate} Add Time To Date ${endTime} 30 days
${endDate} Get Substring ${endDate} 0 19
${startDate} Set Variable ${Time}
${Surcharge} Evaluate round(random.uniform(0.005,0.02),3) random #代理服务费
${accountPeriod} Evaluate random.randint(1,10) random #代理商付款账期(天)
#${rebateStrategy} Set Variable { \ \ \ \ \ \ \ \ \ \ \ \ "id":null, \ \ \ \ \ \ \ \ \ \ \ \ "rebate":1, \ \ \ \ \ \ \ \ \ \ \ \ "rebateStrategyType":${agentSalesTaxPoint}, \ \ \ \ \ \ \ \ \ \ \ \ "label":"销项税点" \ \ \ \ \ \ \ \ }
#${rebateStrategyList} Set Variable [ \ \ \ \ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "id":null, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "rebate":1, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "rebateStrategyType":${2052}, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "label":"进项税点", \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "rebatesLabel":"1%" \ \ \ \ \ \ \ \ \ \ \ \ }, \ \ \ \ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "id":null, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "rebate":3, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "rebateStrategyType":${2053}, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "label":"进项税点", \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "rebatesLabel":"3%" \ \ \ \ \ \ \ \ \ \ \ \ }, \ \ \ \ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "id":null, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "rebate":13, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "rebateStrategyType":${2054}, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "label":"进项税点", \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "rebatesLabel":"13%" \ \ \ \ \ \ \ \ \ \ \ \ } \ \ \ \ \ \ \ \ ] #代理商进项税点
${supplyData} Set Variable { \ \ \ \ "receivingPaperMillId":"${paperMillId}", \ \ \ \ "storeId":"${AgentStoreId}", \ \ \ \ "purchaseStrategy":{ \ \ \ \ \ \ \ \ "role":[ \ \ \ \ \ \ \ \ \ \ \ \ 2, \ \ \ \ \ \ \ \ \ \ \ \ 3 \ \ \ \ \ \ \ \ ], \ \ \ \ \ \ \ \ "accountPeriodType":2041, \ \ \ \ \ \ \ \ "proxyPaySurchargeType":2012, \ \ \ \ \ \ \ \ "accountPeriod":${accountPeriod}, \ \ \ \ \ \ \ \ "rebateStrategyList":[ \ \ \ \ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "id":null, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "rebate":1, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "rebateStrategyType":${2052}, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "label":"进项税点", \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "rebatesLabel":"1%" \ \ \ \ \ \ \ \ \ \ \ \ }, \ \ \ \ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "id":null, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "rebate":3, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "rebateStrategyType":${2053}, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "label":"进项税点", \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "rebatesLabel":"3%" \ \ \ \ \ \ \ \ \ \ \ \ }, \ \ \ \ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "id":null, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "rebate":13, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "rebateStrategyType":${2054}, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "label":"进项税点", \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "rebatesLabel":"13%" \ \ \ \ \ \ \ \ \ \ \ \ } \ \ \ \ \ \ \ \ ], \ \ \ \ \ \ \ \ "supplyPartnerOrgId":"${AgentOrgId}", \ \ \ \ \ \ \ \ "supplyPartnerName":"${AgentFullName}", \ \ \ \ \ \ \ \ "proxyPaySurcharge":${Surcharge} \ \ \ \ }, \ \ \ \ "supplyChainContract":{ \ \ \ \ \ \ \ \ "role":[ \ \ \ \ \ \ \ \ \ \ \ \ 4 \ \ \ \ \ \ \ \ ], \ \ \ \ \ \ \ \ "accountPeriodType":2042, \ \ \ \ \ \ \ \ "supplyPartnerOrgId":null, \ \ \ \ \ \ \ \ "accountPeriod":${accountPeriod}, \ \ \ \ \ \ \ \ "paperMillRebateType":null, \ \ \ \ \ \ \ \ "contractType":1, \ \ \ \ \ \ \ \ "billType":1, \ \ \ \ \ \ \ \ "contractDate":"${Time}", \ \ \ \ \ \ \ \ "contractName":"${PaperFullName}代理合同", \ \ \ \ \ \ \ \ "startDate":"${startDate}", \ \ \ \ \ \ \ \ "endDate":"${endDate}", \ \ \ \ \ \ \ \ "firstPartyOrgId":"${AgentOrgId}", \ \ \ \ \ \ \ \ "secondPartyOrgId":"${PaperMillOrgId}", \ \ \ \ \ \ \ \ "rebateStrategy":{ \ \ \ \ \ \ \ \ \ \ \ \ "id":null, \ \ \ \ \ \ \ \ \ \ \ \ "rebate":1, \ \ \ \ \ \ \ \ \ \ \ \ "rebateStrategyType":${agentSalesTaxPoint}, \ \ \ \ \ \ \ \ \ \ \ \ "label":"销项税点" \ \ \ \ \ \ \ \ } \ \ \ \ }, \ \ \ \ "supplyChainOrgList":[ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ "role":[ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 2, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 3 \ \ \ \ \ \ \ \ \ \ \ \ ], \ \ \ \ \ \ \ \ \ \ \ \ "orgId":"${AgentOrgId}" \ \ \ \ \ \ \ \ }, \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ "role":[ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 4 \ \ \ \ \ \ \ \ \ \ \ \ ], \ \ \ \ \ \ \ \ \ \ \ \ "orgId":"${PaperMillOrgId}" \ \ \ \ \ \ \ \ } \ \ \ \ ], \ \ \ \ "startDate":"${startDate}", \ \ \ \ "endDate":"${endDate}" }
${reps} POST On Session agent ztb-supply-chain-service/admin/create/scrap-paper-supply-chain ${supplyData.encode('utf-8')}
${supplyChainId} Get From Dictionary ${reps.json()['data']} supplyChainId #供应链id
${purchaseStrategyId} Get From Dictionary ${reps.json()['data']} purchaseStrategyId #供应链纸厂采购策略id
#获取代理纸厂供应链详情
${reps} GET On Session agent ztb-supply-chain-service/admin/get/supply-chain-detail params=supplyChainId=${supplyChainId}
${StrategyId} Get From Dictionary ${reps.json()['data']['purchaseStrategy']} id #代理纸厂采购id
#保存供应链纸厂采购策略
${StrategyData} Set Variable { \ \ \ \ "strategyId":"${StrategyId}", \ \ \ \ "toDeletedCategoryStrategyIdList":[ \ \ \ \ \ ], \ \ \ \ "toCreateCategoryStrategyList":[ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ "id":null, \ \ \ \ \ \ \ \ \ \ \ \ "strategyId":"${StrategyId}", \ \ \ \ \ \ \ \ \ \ \ \ "paperMillCategoryId":"${CategoryId}", \ \ \ \ \ \ \ \ \ \ \ \ "paperMillCategoryQuote":${quotedPrice}, \ \ \ \ \ \ \ \ \ \ \ \ "paperMillCategoryName":"${CategoryName}", \ \ \ \ \ \ \ \ \ \ \ \ "paperMillCategoryQuoteTime":"${Time}", \ \ \ \ \ \ \ \ \ \ \ \ "categoryPrice":${quotedPrice}, \ \ \ \ \ \ \ \ \ \ \ \ "categoryDisplayName":"${CategoryName}", \ \ \ \ \ \ \ \ \ \ \ \ "enable":true, \ \ \ \ \ \ \ \ \ \ \ \ "categoryStrategyItems":[ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "name":1, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "type":1, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ "value":null \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ } \ \ \ \ \ \ \ \ \ \ \ \ ], \ \ \ \ \ \ \ \ \ \ \ \ "isAdd":true \ \ \ \ \ \ \ \ } \ \ \ \ ], \ \ \ \ "toUpdateCategoryStrategyList":[ \ \ \ \ \ ] }
${reps} POST On Session agent ztb-supply-chain-service/admin/save/scrap-paper-category/agency-purchase-strategy ${StrategyData.encode('utf-8')}