Commit b83717a2 authored by xiao-hesheng's avatar xiao-hesheng
Browse files

优化脚本

parent 465ee95f
...@@ -4,7 +4,7 @@ from common.fileUtls import FileUtils ...@@ -4,7 +4,7 @@ from common.fileUtls import FileUtils
__author__ = "xiaohesheng" __author__ = "xiaohesheng"
""" """
case_tag:api,mdm-web,产品新增和审核,id2251,id2251-0,sit,on,2023091201 case_tag:api,mdm-web,产品新增和审核,id2251,id2251-8,sit,on,2023091201
主数据平台:产品新增和审核通过 主数据平台:产品新增和审核通过
""" """
......
# -*- encoding=utf8 -*-
from common.timeUtils import timeUtils
from common.fileUtls import FileUtils
__author__ = "xiaohesheng"
"""
case_tag:api,mdm-web,产品新增和审核,id2251,id2251-9,sit,on,2023091201
主数据平台:产品新增和审核通过
"""
from common.common_func import commonFuc
from air_case.mdm_login.登录外网系统.登录外网系统 import login_system
def Enterprise_audit():
module = "mdm3_ea"
# 注册企业
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "CompanyRegist_url")
# #获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers",
commonFuc().get_business_data(module, "json_contentType"))
print(headers)
name = commonFuc().get_business_data(module, "name1") # 获取前缀name
cname = name + commonFuc().randomString(5) # 随机数生成拼接企业名称
request_body = commonFuc().get_business_data(module, "payload", cname, cname, cname, cname, cname, cname)
print(request_body)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
# 获取接口返回id
id1 = commonFuc().analysis_json('id', result)
# 企业注册提交接口_认领
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "updateById_url")
username = commonFuc().get_business_data(module, "username")
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)
request_body = commonFuc().get_business_data(module, "payload1", id1)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
# # print(result)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict")
print(check_dict)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict, result)
# =============== 企业注册提交接口_认领结束
# 企业审核接口_查询数据_开始
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "queryListPage_url")
request_body = commonFuc().get_business_data(module, "payload2", cname)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
# 获取接口返回数据
code = commonFuc().analysis_json('code', result)
# 断言实际结果中是否包含预期结果的内容
# commonFuc().check_result(code, result)
# 断言实际结果中是否包含预期的文本
commonFuc().check_text_exist(code, result)
# ===============企业注册提交接口_查询数据_结束
# 企业注册提交接口_锁定_开始
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "queryAlCompanyRegistInfo_url")
request_body = commonFuc().get_business_data(module, "payload3", id1)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
# 获取接口返回数据
code = commonFuc().analysis_json('code', result)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_text_exist(code, result)
# ===============企业注册提交接口_锁定_结束
# 企业审核接口_再次查询数据_开始
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "upCompanyList_url")
request_body = commonFuc().get_business_data(module, "payload4", cname)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
# 获取接口返回数据
code = commonFuc().analysis_json('code', result)
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_text_exist(code, result)
# ===============企业注册提交接口_查询数据_结束
# 企业注册提交接口_审核通过_开始
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "auditCompanyRegistBill_url")
request_body = commonFuc().get_business_data(module, "payload5", id1)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
# print('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',result)
# 获取接口返回数据
code = commonFuc().analysis_json('code', result)
check_dict1 = commonFuc().get_business_data(module, "checkDict1")
# 断言实际结果中是否包含预期结果的内容
commonFuc().check_result(check_dict1, result)
return cname
# ===============企业注册提交接口_审核通过_结束
def p_m_a():
module = "mdm3_pim"
# 登录
username = Enterprise_audit()
password = commonFuc().get_business_data(module, "password")
print(username, password)
# 获取token和projectCode
token, projectCode, uxid, corpId,info = login_system(username, password).get_token()
# 分页查询供应商产品数据接口
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "listVoPage_url")
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
projectCode)
request_body = commonFuc().get_business_data(module, "payload", corpId)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
# print('实际值',result)
code = commonFuc().analysis_json('code', result)
data = commonFuc().analysis_json('data', result)
data = commonFuc().analysis_json('data', data)
# print('aaaaaaaaaaaaaaaaaaaaaaaaaaaa',data)
# 断言实际结果中是否包含预期结果的内容
# 新注册的企业首次查询产品信息,预期结果为空
check_dict = commonFuc().get_business_data(module, "checkDict")
# print('预期值',check_dict)
commonFuc().check_text_exist(code, result) # 检查验证码
commonFuc().check_text_exist(data, result) # 检查数据data为空[]
# 产品申报
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "submitGoodsRegist_url")
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
projectCode)
p_name = commonFuc().get_business_data(module, "name1") # 获取前缀name
p_name = p_name + commonFuc().randomString(5) # 随机数生成拼接产品名称
request_body = commonFuc().get_business_data(module, "payload6", p_name, p_name, p_name, p_name, p_name, p_name, p_name,
p_name, p_name, p_name, p_name, p_name, p_name, p_name)
print('新增产品请求体', request_body)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
print("新增产品返回结果", result)
goodsRegistVO = commonFuc().analysis_json('goodsRegistVO', result)
goodsName = commonFuc().analysis_json('goodsName', goodsRegistVO)
commonFuc().check_text_exist(goodsName, result) # 检查返回结果中是否存在新增的产品名称
# ===================产品查询==========================================
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "listAuditBillByPage_url")
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
projectCode)
request_body = commonFuc().get_business_data(module, "payload7", p_name)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('查询产品信息',result)
data = commonFuc().analysis_json('data', result)
GRBid = commonFuc().analysis_json('id', data)
print('GRBid',GRBid)
# ===================产品查询后锁定==================================================
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "updateById_url2")
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
projectCode)
now = timeUtils().get_time_hms()
request_body = commonFuc().get_business_data(module, "payload8", GRBid, uxid, now)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
# print('锁定结果',result)
# ===================产品锁定后查询获取产品详情登等必要信息==========================================
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "getGoodsRegistBillDetail_url")
url = url + GRBid + "/1"
print('url', url)
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
projectCode)
# 发送请求
result = commonFuc().http_get(url, headers)
print('产品锁定后查询获取必要信息', result)
# print('data',data)
goodsRegistVO_id = commonFuc().analysis_json('id', commonFuc().analysis_json('goodsRegistVO',
commonFuc().analysis_json('data', result)))
print('goodsRegistVO_id', goodsRegistVO_id)
goodsName = p_name
goodsMfrsId = commonFuc().analysis_json('goodsMfrsId', commonFuc().analysis_json('goodsRegistVO',
commonFuc().analysis_json('data',
result)))
corpId = commonFuc().analysis_json('corpId', commonFuc().analysis_json('goodsRegistVO',
commonFuc().analysis_json('data', result)))
registrationRegistVO_id = commonFuc().analysis_json('id', commonFuc().analysis_json('registrationRegistVO',
commonFuc().analysis_json('data',
result)))
goodsSpecsRegistVOList_id = commonFuc().analysis_json('id', commonFuc().analysis_json('goodsSpecsRegistVOList',
commonFuc().analysis_json('data',
result)))
print(goodsRegistVO_id, goodsMfrsId, corpId, registrationRegistVO_id, goodsSpecsRegistVOList_id)
# =============================产品审核通过======================================
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "handleAuditGoodsRegist_url")
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
projectCode)
request_body = commonFuc().get_business_data(module, "payload13", GRBid, goodsRegistVO_id, now, now, uxid, uxid, GRBid,
goodsName, goodsMfrsId, goodsMfrsId, corpId, corpId,
goodsSpecsRegistVOList_id, now, now, uxid, uxid, GRBid, goodsRegistVO_id,
goodsMfrsId, goodsName, goodsName, goodsName, goodsName, goodsName,
goodsName, registrationRegistVO_id, now, now, uxid, uxid, GRBid,
goodsRegistVO_id, goodsName, now, goodsMfrsId, goodsMfrsId, goodsName)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
# print('产品审核驳回',result)
code= commonFuc().analysis_json('code', result)
# print('code',code)
commonFuc().check_text_exist(code,result)
commonFuc().check_text_exist('驳回', result)
# print('username',username)
# return username,goodsName,module
p_m_a()
# FileUtils().w_info(p_m_a(),'产品新增')
...@@ -352,6 +352,92 @@ json_headers2: { ...@@ -352,6 +352,92 @@ json_headers2: {
"status": 0 "status": 0
} }
} }
"payload13": {
"id": "%s",
"auditStatus": 30,
"auditComment": "驳回",
"goodsRegistVO": {
"id": "%s",
"lastModified": "%s",
"version": 0,
"createTime": "%s",
"createUser": "%s",
"lastModifiedUser": "%s",
"billId": "%s",
"provGoodsId": null,
"mdmGoodsCode": null,
"goodsName": "%s",
"goodsMfrsId": "%s",
"goodsAgentMfrsId": "%s",
"brand": null,
"miDjmc": null,
"mi20code": null,
"miKindCode": null,
"isAbroad": 0,
"made": null,
"property": "1",
"mgrLevel": "1",
"goodsDesc": null,
"corpId": "%s",
"createUserCorpId": "%s",
"goodsMfrsName": "北京中杉金桥生物技术有限公司(test)",
"goodsAgentMfrsName": "北京中杉金桥生物技术有限公司(test)",
"purpose": "01",
"purposeName": "有源手术器械",
"kind68Code": "6801",
"kind68CodeName": "基础外科手术器械",
"mgrLevelName": "I级"
},
"goodsSpecsRegistVOList": [
{
"id": "%s",
"lastModified": "%s",
"version": 0,
"createTime": "%s",
"createUser": "%s",
"lastModifiedUser": "%s",
"billId": "%s",
"goodsRegistId": "%s",
"mdmGoodsSpecCode": null,
"provGoodsSpecsId": null,
"goodsMfrsId": "%s",
"goodsName": "%s",
"shortPinyin": "%s",
"goodsGg": "%s",
"miGoodsGg": "%s",
"miGoodsXh": "%s",
"mi27code": "%s",
"udiCode": 01234567891234,
"goodsUseUnit": "支",
"auditStatus": 10,
"auditComment": "审批通过",
"specAuditStatus": true
}
],
"registrationRegistVO": {
"id": "%s",
"lastModified": "%s",
"version": 0,
"createTime": "%s",
"createUser": "%s",
"lastModifiedUser": "%s",
"billId": "%s",
"goodsRegistId": "%s",
"certKind": "0",
"certKindName": "医疗器械注册证",
"certCode": "%s",
"expdtBeginDate": "%sT00:00:00.000+00:00",
"expdtEndDate": "2093-06-01 00:00:00T00:00:00.000+00:00",
"regMfrsId": "%s",
"agentMfrsId": "%s",
"productName": "%s",
"activeFlag": 1,
"registSourceProject": "h0347",
"filePath": "/sfile/2023/hdi/2023-04-30_090212_2ed1db473e3d42c3b2265a18a6596e5b.png",
"fileOriginalName": "2023-04-30_090212.png"
},
"version": 1
}
"name1": "一次性注射器" "name1": "一次性注射器"
checkDict: {"code": 0, "msg":None,"data": {"pageNum": 1, "pageSize": 20, "total": 0, "data": [], "totalInfo": None}} checkDict: {"code": 0, "msg":None,"data": {"pageNum": 1, "pageSize": 20, "total": 0, "data": [], "totalInfo": None}}
checkDict1: {"code": -2,"msg": "医院已被注册,请耐心等待审核通知!", "data": None} checkDict1: {"code": -2,"msg": "医院已被注册,请耐心等待审核通知!", "data": None}
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
<tr width="600"> <tr width="600">
<td class='details-col-elapsed'>1</td> <td class='details-col-elapsed'>1</td>
<td class='details-col-elapsed'>1</td> <td class='details-col-elapsed'>1</td>
<td class='details-col-elapsed'>0分0</td> <td class='details-col-elapsed'>0分3</td>
<td class="details-col-elapsed">100.0%</td> <td class="details-col-elapsed">100.0%</td>
</tr> </tr>
</table> </table>
...@@ -72,9 +72,9 @@ ...@@ -72,9 +72,9 @@
</tr> </tr>
<tr width="600"> <tr width="600">
<td class="details-col-elapsed"><a href='../log/查询产品数据/log.html' target='_blank'>查询产品数据</a></td> <td class="details-col-elapsed"><a href='../log/a8产品新增和审核驳回/log.html' target='_blank'>a8产品新增和审核驳回</a></td>
<td class="success">成功</td> <td class="success">成功</td>
<td class="details-col-elapsed">0.623</td> <td class="details-col-elapsed">3.911</td>
<td class="details-col-elapsed">xiaohesheng</td> <td class="details-col-elapsed">xiaohesheng</td>
</tr> </tr>
......
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