def ICGR(processInstanceId,head,domain):#第五步录入授信结果 out('正在录入授信结果……\t\t\t\t\t\t') key={ 'processInstanceId':processInstanceId, 'grantingType':'LG_APPLICATION',#LG_APPLICATION大保理进件 LG_LIFTING大保理提额 'grantingPlatformCode':str(uuid1()).replace('-',''), 'grantingAmount':randint(5,9)*10**6, 'grantingWithdrawalsAmount':randint(1,4)*10**6, 'circulation':'Y',#Y可循环 N不可循环 'guaranteeType':'SELF_SUPPORTING',#SELF_SUPPORTING自担 OUTSIDE_CREDIT_ENHANCEMENT外部增信 'effectiveDate':time.strftime('%Y-%m-%d',time.localtime()), 'expirationDate':f"{time.localtime().tm_year+1}-{time.strftime('%m-%d',time.localtime())}", 'rightRecourse':'N',#Y有追索权 N无追索权 'factoringType':'MING_INSURANCE',#MING_INSURANCE明保 SILENT_CONFIRMATION暗保 'externalEnhcType':'RE_FACTORING',#SURETY_BOND保证担保 BUY_BACK回购 RE_FACTORING再保理 MORTGAGE抵押 'remark':'自动化测试数据', } for i in range(5): r=requests.post(f'{domain}/actCreditGranting/saveInputCreditGrantingResult',headers=head,data=key,verify=False) try: result=r.json() state=result['state'] if state==1:return True except json.decoder.JSONDecodeError: saveLog('录入授信请求失败!',r.text) time.sleep(1);continue except KeyError: saveLog('录入授信失败!',str(result)) time.sleep(1);continue goonORquit() return True
def uploadCustomerPic(processInstanceId,head,domain):#第三步上传图片 out('正在上传图片……\t\t\t\t\t\t') key={ 'processInstanceId':processInstanceId, 'customerFilesReqDTOList[0].fileName':'法人*屏蔽的关键字*背面', 'customerFilesReqDTOList[0].fileCode':'INF201901221125019791032', 'customerFilesReqDTOList[0].filePath':'group2/M00/B6/3A/rBGkFlyKFq-EHG9CAAAAABjiGCM515.png', 'customerFilesReqDTOList[1].fileName':'开户许可证', 'customerFilesReqDTOList[1].fileCode':'INF201901221125018623138', 'customerFilesReqDTOList[1].filePath':'group2/M00/B6/3A/rBGkFlyKFrOEbIFeAAAAALolShc807.png', 'customerFilesReqDTOList[2].fileName':'统一社会信用代码', 'customerFilesReqDTOList[2].fileCode':'INF201901221125018058703', 'customerFilesReqDTOList[2].filePath':'group2/M00/B6/3A/rBGkFlyKFriET-lSAAAAAC7Lx4U342.png', 'customerFilesReqDTOList[3].fileName':'法人*屏蔽的关键字*背面', 'customerFilesReqDTOList[3].fileCode':'INF201901221110014955628', 'customerFilesReqDTOList[3].filePath':'group2/M00/B6/3A/rBGkFlyKFryEMeLNAAAAAOdAfM4298.png', 'customerFilesReqDTOList[4].fileName':'法人*屏蔽的关键字*', 'customerFilesReqDTOList[4].fileCode':'INF201901221110014533804', 'customerFilesReqDTOList[4].filePath':'group2/M00/B6/3A/rBGkFlyKFr-EBEalAAAAAH1fsFg293.png', } for i in range(5): r=requests.post(f'{domain}/actCreditGranting/saveUploadCustomerDatum',headers=head,data=key,verify=False) try: result=r.json() state=result['state'] if state==1:return True except json.decoder.JSONDecodeError: saveLog('上传图片请求失败!',r.text) time.sleep(1);continue except KeyError: saveLog('上传图片失败!',str(result)) time.sleep(1);continue goonORquit() return True
def getProcessInstanceId(loginID,env='c',MMusername='******',MMpassword='******',head=False): out(f'{MMusername} 正在获取 {loginID} 对应流程实例Id……\t\t\t\t\t\t') if not head:head=loginMMReq(env=env,username=MMusername,password=MMpassword) for i in range(5): r=requests.get(f'{MMdomainDic[env]}/myTask/list?page=1&limit=10',headers=head,verify=False) try: result=r.json() except json.decoder.JSONDecodeError: saveLog('查询流程实例Id失败!',r.text) time.sleep(1);continue for data in result['data']: if data['loginCode']==loginID:return MMdomainDic[env],head,data['processInstanceId'] time.sleep(1) print('未查询到',loginID,'对应的 processInstanceId')
def factorApply(head):#发起保理申请 out('正在发起保理申请……\t\t\t\t\t\t') if not head:head=loginMMReq(env=args.env,username='',password='') key={ 'loginCode':args.loginID, 'partnerCode':'BESTPAY', 'productCode':productCodeDic[_productCodeDic[args.productCode]], 'forecastReceAmount':args.FRA, 'applyAmount':args.applyAmount, 'expectTransferAmount':args.ETA, 'expectLoanDay':args.expectLoanDay, 'loanUsage':args.loanUsage, 'factoringExpires':args.factorExp, 'fundingCode':args.daddy, 'creditAgencyCode':args.CAC, 'factoringRate':args.factorRate, 'totalPeriod':args.totalPeriod, 'discountRate':args.discountRate, 'coreEnterpriseCode':args.CEC, 'repaymentType':args.repaymentType, 'repayType':args.repayType, 'guaranteeType':args.guarante, 'loanType':args.loanType, 'isRightRecourse':args.recourse, 'factoringType':'', 'informationSources':'', 'contractSignWay':'', 'repaySource':'', 'externalEnhcType':'', 'agent':'', 'agentContact':'13207165870', 'applyTime':f'{time.strftime("%Y%m%d",time.localtime())}000000', } for i in range(5): r=requests.post(f'{MMdomainDic[args.env]}/actFactoringApply/applyLargeFactoring',headers=head,data=key,verify=False) try: result=r.json() if result['success']: print("发起保理申请成功: ",result) return True else: print("发起保理申请失败: ",result) except json.decoder.JSONDecodeError: saveLog('发起保理申请请求失败!',r.text) time.sleep(1);continue except KeyError: saveLog('发起保理申请失败,返回数据异常!',r.text) time.sleep(1);continue
def signProduct(domain,head,processInstanceId,agreTempCode='XYMB201903091129384912119'):#第一步签约产品协议 out('正在签约产品……\t\t\t\t\t\t') key={ 'processInstanceId':processInstanceId, 'agreementTempleteCode':agreTempCode, 'busiManager':'*', } for i in range(5): r=requests.post(f'{domain}/actCreditGranting/saveSignProduct',headers=head,data=key,verify=False) try: result=r.json() state=result['state'] if state==1:return True except json.decoder.JSONDecodeError: saveLog('签约产品请求失败!',r.text) time.sleep(1);continue except KeyError: saveLog('签约产品失败!',str(result)) time.sleep(1);continue goonORquit() return True
def creditGrant(loginID,env):#第六步审核申请 out('正在审核申请……\t\t\t\t\t\t') domain,head,processInstanceId=getProcessInstanceId(loginID=loginID,env=env,MMusername='******',MMpassword='******') key={ 'result':'Y', 'processInstanceId':processInstanceId, } for i in range(5): r=requests.post(f'{domain}/actCreditGranting/saveAuditingCreditGrantingResult',headers=head,data=key,verify=False) try: result=r.json() state=result['state'] if state==1:return True,head except json.decoder.JSONDecodeError: saveLog('审核申请请求失败!',r.text) time.sleep(1);continue except KeyError: saveLog('审核申请失败!',str(result)) time.sleep(1);continue goonORquit() return True
def actCreditGranting(MMusername='',MMpassword=''):#授信申请发起 out(f'发起授信申请:{args.loginID}\t\t\t\t\t\t') head=loginMMReq(env=args.env,username=MMusername,password=MMpassword) key={ 'loginCode':args.loginID, 'customerType':args.cusType, 'productCode':productCodeDic[_productCodeDic[args.productCode]], } for i in range(5): r=requests.post(f'{domain}/actCreditGranting/start',headers=head,data=key,verify=False) try: result=r.json() state=result['state'] if state==1:return head except json.decoder.JSONDecodeError: saveLog(f'{args.loginID} 发起授信申请请求失败!',r.text) time.sleep(1);continue except KeyError: saveLog(f'{args.loginID} 发起授信申请失败!',str(result)) time.sleep(1);continue goonORquit() return False
def bindBankCard(loginID,companyName,processInstanceId,domain,head):#第四步绑定银行卡 out('正在绑定银行卡……\t\t\t\t\t\t') soup=0 for i in range(5): r=requests.get(f'{domain}/actCreditGranting/bindingBankCard?processInstanceId={processInstanceId}&roleName=admin',headers=head) if '绑定账户' in r.text: soup=BeautifulSoup(r.text,'lxml') break else: saveLog('获取绑定账户页面失败!',r.text) time.sleep(1) if not soup:myexit() key={ 'processInstanceId':processInstanceId, 'index':soup.select_one("[name='index']")['value'], 'customerAccountReqDTOList[0].code':soup.select_one('[class="tbfongtweight"]').contents[4]['value'], 'customerAccountReqDTOList[0].accountCode':soup.select_one('[class="tbfongtweight"]').contents[7]['value'], 'customerAccountReqDTOList[0].accountType':'1',#0对私 1对公 2第三方 'customerAccountReqDTOList[0].accountUsage':'ENTRY_EXIT',#ENTRY_EXIT出入帐 ENTRY入账 EXIT出帐 'customerAccountReqDTOList[0].accountCategery':'1',#1银行账户 2第三方账户 'customerAccountReqDTOList[0].accountNumber':loginID, 'customerAccountReqDTOList[0].accountUserName':companyName, 'customerAccountReqDTOList[0].accountBank':'', 'customerAccountReqDTOList[0].bankBranch':'', 'customerAccountReqDTOList[0].paymentAgreementCode':'', 'customerAccountReqDTOList[0].remark':'', } for i in range(5): r=requests.post(f'{domain}/actCreditGranting/saveBindingBankCard',headers=head,data=key,verify=False) try: result=r.json() state=result['state'] if state==1:return True except json.decoder.JSONDecodeError: saveLog('绑定银行卡请求失败!',r.text) time.sleep(1);continue except KeyError: saveLog('绑定银行卡失败!',str(result)) time.sleep(1);continue goonORquit() return True
def fillCustomerInfo(processInstanceId,cusType,domain,head,key=False):#第二步填写客户信息 out('正在填写客户信息……\t\t\t\t\t\t') soup=0 for i in range(5): r=requests.get(f'{domain}/actCreditGranting/fillCustomerInformation?processInstanceId={processInstanceId}&roleName=admin',headers=head) if '客户基本信息' in r.text: soup=BeautifulSoup(r.text,'lxml') break else: saveLog('获取客户基本信息页面失败!',r.text) time.sleep(1) if not soup:goonORquit() if not key: key={ 'processInstanceId':processInstanceId, 'customerType':'enterprise', 'customerCode':soup.select_one("[name='customerCode']")['value'], 'partnerCode':soup.select_one("[name='partnerCode']").select_one("[selected='selected']")['value'], 'certType':soup.select_one("[name='certType']").select_one("[selected='selected']")['value'], 'certCode':soup.select_one("[name='certCode']")['value'], 'customerName':soup.select_one("[name='customerName']")['value'], 'isRealnameAuth':soup.select_one("[name='isRealnameAuth']").select_one("[selected='selected']")['value'], 'customerState':soup.select_one("[name='customerState']").select_one("[selected='selected']")['value'], 'area':soup.select_one("[name='area']")['value'], 'province':soup.select_one("[name='province']")['value'], 'city':soup.select_one("[name='city']")['value'], 'electronicSignatureAccount':soup.select_one("[name='electronicSignatureAccount']")['value'], 'electronicSignaturePwd':soup.select_one("[name='electronicSignaturePwd']")['value'], 'busiManager':soup.select_one("[name='busiManager']")['value'], 'remark':soup.select_one("[name='remark']")['value'], 'type':cusType,# cusType='CORE' or 'CUSTOMER' 'merchantName':soup.select_one("[name='merchantName']")['value'], 'busiLicenseNumber':soup.select_one("[name='busiLicenseNumber']")['value'], 'registeredAddr':soup.select_one("[name='registeredAddr']")['value'], 'legalPerson':soup.select_one("[name='legalPerson']")['value'], 'legalPersonCertNo':soup.select_one("[name='legalPersonCertNo']")['value'], 'legalPersonMobile':soup.select_one("[name='legalPersonMobile']")['value'], 'registrationDate':soup.select_one("[name='registrationDate']")['value'], 'registeredCapital':soup.select_one("[name='registeredCapital']")['value'], 'enterpriseType':soup.select_one("[name='enterpriseType']")['value'], 'enterpriseNature':soup.select_one("[name='enterpriseNature']")['value'], 'enterpriseScale':soup.select_one("[name='enterpriseScale']")['value'], 'registrationAuthority':soup.select_one("[name='registrationAuthority']")['value'], 'officeAddr':soup.select_one("[name='officeAddr']")['value'], 'businessOpeningDate':soup.select_one("[name='businessOpeningDate']")['value'], 'businessClosingDate':soup.select_one("[name='businessClosingDate']")['value'], 'businessScope':soup.select_one("[name='businessScope']")['value'], 'nationalTaxNo':soup.select_one("[name='nationalTaxNo']")['value'], 'localTaxNo':soup.select_one("[name='localTaxNo']")['value'], 'organizationalCode':soup.select_one("[name='organizationalCode']")['value'], 'organizationalValidity':soup.select_one("[name='organizationalValidity']")['value'], 'unifiedSocialCode':soup.select_one("[name='unifiedSocialCode']")['value'], 'importExportCert':soup.select_one("[name='importExportCert']")['value'], 'annualInspectionDate':soup.select_one("[name='annualInspectionDate']")['value'], 'employeeNum':soup.select_one("[name='employeeNum']")['value'], 'shareholdersNum':soup.select_one("[name='shareholdersNum']")['value'], 'tel':soup.select_one("[name='tel']")['value'], 'fax':soup.select_one("[name='fax']")['value'], 'email':soup.select_one("[name='email']")['value'], 'establishmentBackground':soup.select_one("[name='establishmentBackground']")['value'], 'developingProcess':soup.select_one("[name='developingProcess']")['value'], 'managementStructure':soup.select_one("[name='managementStructure']")['value'], 'mainProducts':soup.select_one("[name='mainProducts']")['value'], 'industryPolicy':soup.select_one("[name='industryPolicy']")['value'], 'marketCompetition':soup.select_one("[name='marketCompetition']")['value'], 'futureDevelopmentPlan':soup.select_one("[name='futureDevelopmentPlan']")['value'], 'busiPlacesNature':soup.select_one("[name='busiPlacesNature']")['value'], 'busiPlacesArea':soup.select_one("[name='busiPlacesArea']")['value'], 'busiPlacesEvaluation':soup.select_one("[name='busiPlacesEvaluation']")['value'], 'actualController':soup.select_one("[name='actualController']")['value'], 'actualControllerCertNo':soup.select_one("[name='actualControllerCertNo']")['value'], 'actualControllerMobile':soup.select_one("[name='actualControllerMobile']")['value'], 'contacts':soup.select_one("[name='contacts']")['value'], 'contactsMobile':soup.select_one("[name='contactsMobile']")['value'], } for i in range(5): r=requests.post(f'{domain}/actCreditGranting/saveFillCustomerInformation',headers=head,data=key,verify=False) try: result=r.json() state=result['state'] if state==1:return True except json.decoder.JSONDecodeError: saveLog('填写客户信息请求失败!',r.text) time.sleep(1);continue except KeyError: saveLog('填写客户信息失败!',str(result)) time.sleep(1);continue goonORquit() return True