Commit 4aae0274 authored by xiao-hesheng's avatar xiao-hesheng
Browse files

流程十七脚本提交

parent 1a0ad915
......@@ -25,7 +25,7 @@ id1,cname=es()
"""
#企业注册提交接口_认领
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "updateById_url")
username = commonFuc().get_business_data(module, "username")
username = commonFuc().get_business_data(module, "username1")
password = commonFuc().get_business_data(module, "password")
# print(username, password)
# 获取token和projectCode
......
......@@ -25,12 +25,14 @@ id1=global_var_id
输出:"rtn_msg": "企业被锁定"
"""
#企业注册提交接口_锁定_开始
username = commonFuc().get_business_data(module, "username")
username = commonFuc().get_business_data(module, "username1")
password = commonFuc().get_business_data(module, "password")
# 获取token和projectCode
token,projectCode,uxid,corpId,info= login_system(username, password).get_token()
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "queryAlCompanyRegistInfo_url")
print('企业锁定url',url)
#获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
......@@ -38,6 +40,7 @@ headers = commonFuc().get_business_data(module, "json_headers2",
request_body = commonFuc().get_business_data(module, "payload3",id1)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('企业锁定结果',result)
#获取接口返回数据
code = commonFuc().analysis_json('code', result)
#断言实际结果中是否包含预期结果的内容
......
# -*- encoding=utf8 -*-
from common.dateUtils import dateUtils
from common.fileUtls import FileUtils
__author__ = "xiaohesheng"
......@@ -14,9 +15,9 @@ from airtest.core.api import using
import sys
pro_path=commonFuc().get_pro_path()
sys.path.append(pro_path+r'\\air_case\\a2_mdm3_ea\\a企业认领.air')
using(pro_path+r'\\air_case\\a2_mdm3_ea\\a企业认领.air')
from a企业认领 import *
sys.path.append(pro_path+r'\\air_case\\a2_mdm3_ea\\a企业锁定.air')
using(pro_path+r'\\air_case\\a2_mdm3_ea\\a企业锁定.air')
from a企业锁定 import *
# print('global_var_id',global_var_id)
id1=global_var_id
cname=global_var_cname
......@@ -29,7 +30,7 @@ def test1():
输出:"rtn_msg": "{"code": 0,'msg': None,'data':'审核通过'}"
"""
# 企业注册提交接口_审核通过_开始
username = commonFuc().get_business_data(module, "username")
username = commonFuc().get_business_data(module, "username1")
password = commonFuc().get_business_data(module, "password")
# print(username, password)
# 获取token和projectCode
......@@ -40,10 +41,24 @@ def test1():
projectCode, token)
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "auditCompanyRegistBill_url")
request_body = commonFuc().get_business_data(module, "payload5",id1)
print('企业审核url',url)
lastModified=dateUtils().get_current_time()
createTime=dateUtils().get_current_time()
lastModifiedUser=uxid
userLoginCode=cname
userName=cname
email=cname
erpCode=cname
registSourceProject=cname
request_body = commonFuc().get_business_data(module, "payload5_1", id1, lastModified, createTime,
userLoginCode, userName, cname, email, erpCode,
registSourceProject)
# request_body = commonFuc().get_business_data(module, "payload5_2",id1)
print('企业审核request_body',request_body)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
# print('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',result)
print('企业审核',result)
#获取接口返回数据
code = commonFuc().analysis_json('code', result)
check_dict1 = commonFuc().get_business_data(module, "checkDict1")
......
# -*- encoding=utf8 -*-
from common.dateUtils import dateUtils
from common.fileUtls import FileUtils
__author__ = "xiaohesheng"
......@@ -12,70 +13,132 @@ from common.common_func import commonFuc
from air_case.mdm_login.登录外网系统.登录外网系统 import login_system
from airtest.core.api import using
import sys
module = "b5_spd3_core_business_flow"
def h_login():
#供货关系申请_客户类型_医院_登录_医院登录获取医院id
module = "a4_mdm3_cm"
#如果需要h0347医院账号登录,这里就从data文件获取登录医院的用户名
#username = commonFuc().get_business_data(module, "username")
def h_login():
# 供货关系申请_客户类型_医院_登录_医院登录获取医院id
module = "a4_mdm3_cm"
# 如果需要h0347医院账号登录,这里就从data文件获取登录医院的用户名
# username = commonFuc().get_business_data(module, "username")
username = commonFuc().get_business_data(module, "username")
username = commonFuc().get_business_data(module, "username")
password = commonFuc().get_business_data(module, "password1")
print('医院名称', username)
print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
print(username, password, 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
import time
while True:
try:
token,projectCode,uxid,corpId,info= login_system(username, password).get_token()
token, projectCode, uxid, corpId, info = login_system(username, password).get_token()
except:
time.sleep(6)
continue
else:
return token,projectCode,uxid,corpId,username
return token, projectCode, uxid, corpId, username
def e_login(type=1):
module = "a4_mdm3_cm"
username='username'
if type==1:#注册一个新企业,并审批
username = 'username'
if type == 1: # 注册一个新企业,并审批
pro_path=commonFuc().get_pro_path()
sys.path.append(pro_path+r'\\air_case\\a2_mdm3_ea\\企业审核.air')
using(pro_path+r'\\air_case\\a2_mdm3_ea\\企业审核.air')
from 企业审核 import test1
# # 注册一个新企业
# pro_path = commonFuc().get_pro_path()
# sys.path.append(pro_path + r'\\air_case\\a1_mdm3_es\\外网企业注册提交接口_正常注册.air')
# using(pro_path + r'\\air_case\\a1_mdm3_es\\外网企业注册提交接口_正常注册.air')
# from 外网企业注册提交接口_正常注册 import es
# id1, cname = es()
# # 企业审核
# module = "a2_mdm3_ea"
# username = commonFuc().get_business_data(module, "username1")
# password = commonFuc().get_business_data(module, "password")
# # print(username, password)
# # 获取token和projectCode
# token, projectCode, uxid, corpId, info = login_system(username, password).get_token()
# # 获取请求头信息
# headers = commonFuc().get_business_data(module, "json_headers2",
# commonFuc().get_business_data(module, "json_contentType"), token,
# projectCode,token)
# # #企业锁定
# # url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "queryAlCompanyRegistInfo_url")
# # print('企业锁定url', url)
# # request_body = commonFuc().get_business_data(module, "payload3", id1)
# # # 发送请求
# # result = commonFuc().http_post(url, request_body, headers)
# # print('企业锁定结果', result)
#
# url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "auditCompanyRegistBill_url")
# print('企业审核url', url)
# url2=commonFuc().get_business_data(module, "auditCompanyRegistBill_url")
# lastModified = dateUtils().get_current_time()
# createTime = dateUtils().get_current_time()
# lastModifiedUser = None
# userLoginCode = cname
# userName = cname
# email = cname
# erpCode = cname
# registSourceProject = cname
# request_body = commonFuc().get_business_data(module, "payload5_1", id1, lastModified, createTime,
# userLoginCode, userName, cname, email, erpCode,
# registSourceProject)
# # request_body = commonFuc().get_business_data(module, "payload5_2", id1)
# # request_body = commonFuc().get_business_data(module, "payload5_3",id1)
#
# import json
# request_body_str=json.dumps(request_body)
# request_body_str2=url+request_body_str
# data=request_body_str2
# import hashlib
# byte_str= data.encode('utf-8')
# hash_object = hashlib.sha256(byte_str)
# X_JS_HASH = hash_object.hexdigest()
# #重新获取头信息
# headers = commonFuc().get_business_data(module, "json_headers3",
# commonFuc().get_business_data(module, "json_contentType"), token,
# projectCode,X_JS_HASH)
# print('headers',headers)
# print('企业审核request_body', request_body)
# result = commonFuc().http_post(url, request_body, headers)
# print('企业审核', result)
info = FileUtils().r_info("a2_mdm3_ea", "企业信息")
print(info)
username = info['cname']
print('aaaaaaaaaaaaaaaaaaaaaaaaaaa',username)
else:#读取文件中存入的企业信息
print('aaaaaaaaaaaaaaaaaaaaaaaaaaa', username)
else: # 读取文件中存入的企业信息
info = FileUtils().r_info("a2_mdm3_ea", "企业信息")
print(info)
username = info['cname']
print('aaaaaaaaaaaaaaaaaaaaaaaaaaa', username)
#a2供货关系申请_客户类型_医院_登录_企业登录
# a2供货关系申请_客户类型_医院_登录_企业登录
# print('医院名称',username)
password = commonFuc().get_business_data(module, "password")
print(username, password)
# 获取token和projectCode
import time
i=1
i = 1
while True:
if i==1000:
if i == 1000:
print('6000秒过去了,新注册的企业还未登录,检查同步是否正常')
break
try:
token,projectCode,uxid,corpId,info= login_system(username, password).get_token()
token, projectCode, uxid, corpId, info = login_system(username, password).get_token()
except:
print('新注册的企业登录失败,等待6秒')
time.sleep(6)
i=i+1
i = i + 1
continue
else:
return token, projectCode, uxid, corpId, username
# break
def supply_and_marketing_apply():
def supply_and_marketing_apply():
token, projectCode, uxid, corpId, username = e_login()
# 获取医院corpId
h_token, h_projectCode, h_uxid, h_corpId, h_name = h_login()
......@@ -101,12 +164,13 @@ def supply_and_marketing_apply():
e_username = username
return e_corpId, h_corpId, e_username, h_name
def submitSupplyRelation_pass():
module = "a4_mdm3_cm"
token, projectCode, uxid, corpId, h_name = h_login()
print(token, projectCode, uxid, corpId, h_name)
pro_path = commonFuc().get_pro_path()
#查询待审核数据=========================================
# 查询待审核数据=========================================
# a11供货关系审核_驳回_客户类型_医院_供销关系审核_查询待审核数据1
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "listVoPage_url")
# 获取请求头信息
......@@ -121,61 +185,67 @@ def submitSupplyRelation_pass():
id1 = commonFuc().analysis_json('id', commonFuc().analysis_json('data', commonFuc().analysis_json('data', result)))
print('id1', id1)
# 查询待审核数据======================================
#b15供货关系审核_通过_客户类型_医院
# b15供货关系审核_通过_客户类型_医院
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "auditSupplyRelation_url")
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
projectCode)
contactUser=commonFuc().randomString(5)
contactWay=contactUser
request_body = commonFuc().get_business_data(module, "payload7_2", id1,contactUser,contactWay)
contactUser = commonFuc().randomString(5)
contactWay = contactUser
request_body = commonFuc().get_business_data(module, "payload7_2", id1, contactUser, contactWay)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('result', result)
#断言
checkDict=commonFuc().get_business_data(module,'checkDict')
commonFuc().check_result(checkDict,result)
# 断言
checkDict = commonFuc().get_business_data(module, 'checkDict')
commonFuc().check_result(checkDict, result)
def supply_and_marketing_apply2():
pro_path=commonFuc().get_pro_path()
pro_path = commonFuc().get_pro_path()
token,projectCode,uxid,corpId,username=e_login(2)
#获取医院corpId
token, projectCode, uxid, corpId, username = e_login(2)
# 获取医院corpId
h_token,h_projectCode,h_uxid,h_corpId,h_name=h_login()
h_token, h_projectCode, h_uxid, h_corpId, h_name = h_login()
module = "a4_mdm3_cm"
#a3供货关系申请_客户类型_医院_供销关系申请提交
# a3供货关系申请_客户类型_医院_供销关系申请提交
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "submitSupplyRelation_url")
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
projectCode)
contactUser=commonFuc().randomString(5)
contactWay=contactUser
request_body = commonFuc().get_business_data(module, "payload_2",h_corpId,contactUser,contactWay)
contactUser = commonFuc().randomString(5)
contactWay = contactUser
request_body = commonFuc().get_business_data(module, "payload_2", h_corpId, contactUser, contactWay)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('result',result)
print('result', result)
# #获取接口返回数据
#
check_dict= commonFuc().get_business_data(module, "checkDict")
commonFuc().check_result(check_dict,result)
e_corpId=corpId
e_username=username
return e_corpId,h_corpId,e_username,h_name
check_dict = commonFuc().get_business_data(module, "checkDict")
commonFuc().check_result(check_dict, result)
e_corpId = corpId
e_username = username
return e_corpId, h_corpId, e_username, h_name
def main():
try:
h_login()#医院登录
e_login(1)#企业登录
#供应关系申请-客户类型医院
h_login() # 医院登录
e_login(1) # 企业登录
# 供应关系申请-客户类型医院
FileUtils().w_info1(supply_and_marketing_apply(), module, '供货关系申请')
submitSupplyRelation_pass()
#供应关系申请-客户类型厂商
# 供应关系申请-客户类型厂商
FileUtils().w_info1(supply_and_marketing_apply2(), module, '供货关系申请2')
submitSupplyRelation_pass()
commonFuc().check_text_exist_result_text('succees','succees')
commonFuc().check_text_exist_result_text('succees', 'succees')
print('=================流程二结束=================')
except:
except Exception as e:
# 打印错误信息
print(f"发生错误: {e}")
print('a_a2_流程二供货关系申请提交审批,出现异常,请检查')
# main()
\ No newline at end of file
# main()
......@@ -255,7 +255,7 @@ def check_mcms_pick(type=16):
source_id = get_buyBillId(branch_id, type)
dept_id = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid1']
dept_name = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid1']
stock_id = get_stockId_fromdb(dept_name + '中心库房')
stock_id = get_stockId_fromdb(get_branch_name() + '中心库房')
area_code = get_stockAreaId_new_fromDb(dept_name, 1)
target_dept_id = FileUtils().r_info8("b5_spd3_core_business_flow", "供货关系申请2", 'message')['e_corpId']
target_dept_name = FileUtils().r_info8("b5_spd3_core_business_flow", "供货关系申请2", 'message')['e_username']
......
# -*- encoding=utf8 -*-
from air_case.public1.public1.public1 import get_X_JS_HASH
__author__ = "xiaohesheng"
"""
......@@ -43,6 +45,13 @@ class login_system():
commonFuc().get_business_data(self.module, "json_contentType"))
# print(headers)
# 发送登录请求
login_url2= commonFuc().get_business_data(self.module, "login_url")
X_JS_HASH=get_X_JS_HASH(request_body,login_url2)
X_APP_CODE='hdi.pc'
# 重新获取头信息
headers = commonFuc().get_business_data(self.module, "json_headers3",
commonFuc().get_business_data(self.module, "json_contentType"),
X_APP_CODE, X_JS_HASH)
result = commonFuc().http_post(login_url, request_body, headers)
token = commonFuc().analysis_json('token', result)
uxid = commonFuc().analysis_json('uxid', result)
......@@ -58,6 +67,12 @@ class login_system():
request_body = commonFuc().get_business_data(self.module, "payload2", token, uxid, projectCode)
# print(request_body)
# 发送平台登录请求
login_url2 = commonFuc().get_business_data(self.module, "platform_login_url")
X_JS_HASH = get_X_JS_HASH(request_body, login_url2)
# 重新获取头信息
headers = commonFuc().get_business_data(self.module, "json_headers4",
commonFuc().get_business_data(self.module, "json_contentType"),
token,X_APP_CODE, X_JS_HASH)
result = commonFuc().http_post(platform_login_url, request_body, headers)
print('平台登录接口结果', result)
......
......@@ -485,6 +485,16 @@ def get_stockId_fromdb(name): # 获取仓库id参数是库房名称
get_id("select id from mcms_stock_info where stock_name='%s'and branch_id='%s';" % (name, get_branch_id())))
return stockId
def get_X_JS_HASH(request_body,url2):
import json
request_body_str = json.dumps(request_body)
request_body_str2 = url2 + request_body_str
data = request_body_str2
import hashlib
byte_str = data.encode('utf-8')
hash_object = hashlib.sha256(byte_str)
X_JS_HASH = hash_object.hexdigest()
return X_JS_HASH
def dept_query_all(): # 科室查询,将科室id写入文件中
module = "b2_herp3_bs"
......
......@@ -6,8 +6,10 @@
"upCompanyList_url": "/api/mdmService/mdmCompany/upCompanyList"
"auditCompanyRegistBill_url": "/api/mdmService/companyRegistBill/auditCompanyRegistBill"
"updateByIdCompanyRegistBill_url": "/api/mdmService/companyRegistBill/updateById/"
"username": "test_1"
"password": "1qaz!QAZ"
"username1": "001f90380"
json_contentType: "application/json"
json_headers: {
......@@ -20,6 +22,13 @@ json_headers2: {
"X-APP-CODE":"%s",
"X-SESSION-ID":"%s"
}
json_headers3: {
"Content-Type": "%s",
"token": "%s",
"X-APP-CODE":"%s",
"X-JS-HASH":"%s",
"Host":"spdtest.cmic.com.cn"
}
"payload1": {
"id": "%s",
"isLocked": 1
......@@ -51,6 +60,72 @@ json_headers2: {
"id":"%s"
}
"payload5_1": {"id":"%s","lastModified":"%s","version":0,"createTime":"%s","createUser":null,"lastModifiedUser":null,"userLoginCode":"%s","userLoginPsw":"v/kTXSwg4s7FA7eIxX+S+w==","userName":"%s","cname":"%s","shortName":"","upCompanyId":"","compKind":"0","compFunction":"2","area":"","province":null,"city":null,"areaCode":null,"legal":"","address":"","isAbroad":1,"nation":null,"registContactUser":"","registContactWay":"","email":"%s@sina.com","hosProperty":null,"hosLevel":null,"erpCode":"%s","regCode":null,"jyxkCode":null,"jyxkbaCode":null,"scxkzCode":null,"scbapzCode":null,"isLocked":0,"auditStatus":10,"auditStartTime":null,"auditEndTime":null,"auditor":null,"auditComment":null,"registSourceProject":"%s","dataEntrance":"注册","importTaskMfrsId":null,"createUserCorpId":null,"hosSpdType":null,"organizationCode":null,"spdProjectCode":"h0347","adminRole":"role-prov-template","clientType":1,"provId":"","isDrugProv":null,"isDrugLic":null,"isApparatusProv":null,"isApparatusRegister":null,"userRole":"role-00530","companyRegistBizscopeVos":[],"certVOList":[],"upCompanyName":null,"basCode":null,"shortPyinyin":null,"spdProjectName":"邹城市人民医院(test)","areaText":""}
"payload5_2": {"id":"%s","lastModified":"2024-08-22 08:41:20","version":0,"createTime":"2024-08-22 08:41:20","createUser":null,"lastModifiedUser":null,"userLoginCode":"国药集团公司Ef96F","userLoginPsw":"v/kTXSwg4s7FA7eIxX+S+w==","userName":"国药集团公司Ef96F","cname":"国药集团公司Ef96F","shortName":"","upCompanyId":"","compKind":"0","compFunction":"2","area":"","province":null,"city":null,"areaCode":null,"legal":"","address":"","isAbroad":1,"nation":null,"registContactUser":"","registContactWay":"","email":"国药集团公司Ef96F@sina.com","hosProperty":null,"hosLevel":null,"erpCode":"国药集团公司Ef96F","regCode":null,"jyxkCode":null,"jyxkbaCode":null,"scxkzCode":null,"scbapzCode":null,"isLocked":0,"auditStatus":10,"auditStartTime":null,"auditEndTime":null,"auditor":null,"auditComment":null,"registSourceProject":"国药集团公司Ef96F","dataEntrance":"注册","importTaskMfrsId":null,"createUserCorpId":null,"hosSpdType":null,"organizationCode":null,"spdProjectCode":"h0347","adminRole":"role-prov-template","clientType":1,"provId":"","isDrugProv":null,"isDrugLic":null,"isApparatusProv":null,"isApparatusRegister":null,"userRole":"role-00530","companyRegistBizscopeVos":[],"certVOList":[],"upCompanyName":null,"basCode":null,"shortPyinyin":null,"spdProjectName":"邹城市人民医院(test)","areaText":""}
"payload5_3": {
"id": "%s",
"lastModified": "2024-08-22 09:17:05",
"version": 0,
"createTime": "2024-08-22 09:17:05",
"createUser": null,
"lastModifiedUser": null,
"userLoginCode": "国药集团公司fhJSX",
"userLoginPsw": "v/kTXSwg4s7FA7eIxX+S+w==",
"userName": "国药集团公司fhJSX",
"cname": "国药集团公司fhJSX",
"shortName": "",
"upCompanyId": "",
"compKind": "0",
"compFunction": "2",
"area": "",
"province": null,
"city": null,
"areaCode": null,
"legal": "",
"address": "",
"isAbroad": 1,
"nation": null,
"registContactUser": "",
"registContactWay": "",
"email": "国药集团公司fhJSX@sina.com",
"hosProperty": null,
"hosLevel": null,
"erpCode": "国药集团公司fhJSX",
"regCode": null,
"jyxkCode": null,
"jyxkbaCode": null,
"scxkzCode": null,
"scbapzCode": null,
"isLocked": 0,
"auditStatus": 10,
"auditStartTime": null,
"auditEndTime": null,
"auditor": null,
"auditComment": null,
"registSourceProject": "国药集团公司fhJSX",
"dataEntrance": "注册",
"importTaskMfrsId": null,
"createUserCorpId": null,
"hosSpdType": null,
"organizationCode": null,
"spdProjectCode": "h0347",
"adminRole": "role-prov-template",
"clientType": 1,
"provId": "",
"isDrugProv": null,
"isDrugLic": null,
"isApparatusProv": null,
"isApparatusRegister": null,
"userRole": "role-00530",
"companyRegistBizscopeVos": [],
"certVOList": [],
"upCompanyName": null,
"basCode": null,
"shortPyinyin": null,
"spdProjectName": "邹城市人民医院(test)",
"areaText": ""
}
"payload6": {
"id": "%s",
"isLocked": 0,
......
......@@ -13,6 +13,17 @@ json_headers2: {
"token": "%s",
"X-APP-CODE":"%s"
}
json_headers3: {
"Content-Type": "%s",
"X-APP-CODE":"%s",
"X-JS-HASH":"%s"
}
json_headers4: {
"Content-Type": "%s",
"token": "%s",
"X-APP-CODE":"%s",
"X-JS-HASH":"%s"
}
"payload": {
"username": "%s",
"passwd": "%s",
......@@ -26,7 +37,8 @@ json_headers2: {
"uxid": "%s",
"projectCode": "%s",
"traceId": null,
"jsHash": null
"jsHash": null,
"pwdSecureInfo":null
}
checkDict: {"code": 0,'msg': None}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment