Commit 5d5d2f2d authored by xiao-hesheng's avatar xiao-hesheng
Browse files

厂商查询

parent 47ab3ba1
......@@ -50,4 +50,12 @@ def enable_branch():
commonFuc().check_result(check_dict, result)
return branch_id
branch_id=enable_branch()
delByBranchId().Delete_branch_by_id(branch_id)
\ No newline at end of file
delByBranchId().Delete_branch_by_id(branch_id)#删除院区
#删除后再次新建一个院区
pro_path=commonFuc().get_pro_path()
sys.path.append(pro_path+r'\\air_case\\a2_herp3_bs\\a4_院区新增.air')
using(pro_path+r'\\air_case\\a2_herp3_bs\\a4_院区新增.air')
from a4_院区新增 import branch_add
id2,name=branch_add()
info=(id2,name)
FileUtils().w_info2(info,module,'院区新增')
\ No newline at end of file
# -*- encoding=utf8 -*-
from common.db.sql.sql_del_branch_info import delByBranchId
from common.timeUtils import timeUtils
__author__ = "xiaohesheng"
"""
case_tag:api,herp-web,b1_新增公告_供应商,id2263,id2263-11,sit,on
主数据平台:b1_新增公告_供应商
"""
from common.common_func import commonFuc
from air_case.a1_herp3_login.登录内网系统.登录内网系统 import login_system
module = "a2_herp3_bs"
def add_notices():
"""
场景:b1_新增公告_供应商
用例名称:b1_新增公告_供应商
输入:无
输出:"rtn_msg": {"code": 0, "msg": null, "data": 1}
"""
#内网登录
username = commonFuc().get_business_data(module, "username")
# print('医院名称',username)
password = commonFuc().get_business_data(module, "password")
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token,projectCode,uxid,corpId,info= login_system(username, password).get_token()
# print( token,projectCode,uxid,corpId,info)
#b1_新增公告_供应商
url=commonFuc().get_api_url()+commonFuc().get_business_data(module, "save_url")
print(url)
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
commonFuc().get_business_data(module, "X-APP-CODE"))
expireDate=timeUtils().get_time_add(30)
# print(expireDate)
#请求体
request_body=commonFuc().get_business_data(module, "payload6",expireDate)
# 发送请求
result = commonFuc().http_post(url, request_body,headers)
print('result', result)
#断言
check_dict = commonFuc().get_business_data(module, "checkDict2")
commonFuc().check_result(check_dict, result)
add_notices()
# -*- encoding=utf8 -*-
from common.db.sql.sql_del_branch_info import delByBranchId
from common.fileUtls import FileUtils
from common.timeUtils import timeUtils
__author__ = "xiaohesheng"
"""
case_tag:api,herp-web,b2_查询公告_模糊查询,id2263,id2263-12,sit,on
主数据平台:b2_查询公告_模糊查询
"""
from common.common_func import commonFuc
from air_case.a1_herp3_login.登录内网系统.登录内网系统 import login_system
module = "a2_herp3_bs"
def select_notices():
"""
场景:b2_查询公告_模糊查询
用例名称:b2_查询公告_模糊查询
输入:无
输出:"rtn_msg": {"code": 0, "msg": null, "data": 1}
"""
#内网登录
username = commonFuc().get_business_data(module, "username")
# print('医院名称',username)
password = commonFuc().get_business_data(module, "password")
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token,projectCode,uxid,corpId,info= login_system(username, password).get_token()
# print( token,projectCode,uxid,corpId,info)
#b2_查询公告_模糊查询
url=commonFuc().get_api_url()+commonFuc().get_business_data(module, "page_url")
print(url)
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
commonFuc().get_business_data(module, "X-APP-CODE"))
expireDate=timeUtils().get_time_add(30)
# print(expireDate)
#请求体
request_body=commonFuc().get_business_data(module, "payload7")
# 发送请求
result = commonFuc().http_post(url, request_body,headers)
print('result', result)
#断言
total=commonFuc().analysis_json('total',commonFuc().analysis_json('data',result))
id=commonFuc().analysis_json('id',commonFuc().analysis_json('data',commonFuc().analysis_json('data',result)))
content=commonFuc().analysis_json('content',commonFuc().analysis_json('data',commonFuc().analysis_json('data',result)))
if total>=1:
commonFuc().check_text_exist(0, result)
else:
commonFuc().check_text_exist(500, result)
return id,content
# select_notices()
id2,content_name=select_notices()
info=(id2,content_name)
FileUtils().w_info3(info,module,'公告新增')
\ No newline at end of file
# -*- encoding=utf8 -*-
from common.db.sql.sql_del_branch_info import delByBranchId
from common.timeUtils import timeUtils
__author__ = "xiaohesheng"
"""
case_tag:api,herp-web,b2_查询公告_精确查询,id2263,id2263-13,sit,on
主数据平台:b2_查询公告_精确查询
"""
from common.common_func import commonFuc
from air_case.a1_herp3_login.登录内网系统.登录内网系统 import login_system
module = "a2_herp3_bs"
def select_notices():
"""
场景:b2_查询公告_精确查询
用例名称:b2_查询公告_精确查询
输入:无
输出:"rtn_msg": {"code": 0, "msg": null, "data": 1}
"""
#内网登录
username = commonFuc().get_business_data(module, "username")
# print('医院名称',username)
password = commonFuc().get_business_data(module, "password")
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token,projectCode,uxid,corpId,info= login_system(username, password).get_token()
# print( token,projectCode,uxid,corpId,info)
#b2_查询公告_精确查询
url=commonFuc().get_api_url()+commonFuc().get_business_data(module, "page_url")
print(url)
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
commonFuc().get_business_data(module, "X-APP-CODE"))
expireDate=timeUtils().get_time_add(30)
# print(expireDate)
#请求体
request_body=commonFuc().get_business_data(module, "payload8")
# 发送请求
result = commonFuc().http_post(url, request_body,headers)
print('result', result)
# 断言
total = commonFuc().analysis_json('total', commonFuc().analysis_json('data', result))
if total >= 1:
commonFuc().check_text_exist(0, result)
else:
commonFuc().check_text_exist(500, result)
select_notices()
# -*- encoding=utf8 -*-
from common.db.sql.sql_del_branch_info import delByBranchId
from common.timeUtils import timeUtils
__author__ = "xiaohesheng"
"""
case_tag:api,herp-web,b4_查询公告_精确查询_不存在的公告,id2263,id2263-14,sit,on
主数据平台:b4_查询公告_精确查询_不存在的公告
"""
from common.common_func import commonFuc
from air_case.a1_herp3_login.登录内网系统.登录内网系统 import login_system
module = "a2_herp3_bs"
def select_notices():
"""
场景:b4_查询公告_精确查询_不存在的公告
用例名称:b4_查询公告_精确查询_存在的公告
输入:无
输出:"rtn_msg": {"code": 0, "msg": null, "data": 1}
"""
#内网登录
username = commonFuc().get_business_data(module, "username")
# print('医院名称',username)
password = commonFuc().get_business_data(module, "password")
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token,projectCode,uxid,corpId,info= login_system(username, password).get_token()
# print( token,projectCode,uxid,corpId,info)
#b4_查询公告_精确查询_不存在的公告
url=commonFuc().get_api_url()+commonFuc().get_business_data(module, "page_url")
print(url)
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
commonFuc().get_business_data(module, "X-APP-CODE"))
expireDate=timeUtils().get_time_add(30)
# print(expireDate)
#请求体
request_body=commonFuc().get_business_data(module, "payload9")
# 发送请求
result = commonFuc().http_post(url, request_body,headers)
print('result', result)
#断言
total=commonFuc().analysis_json('total',commonFuc().analysis_json('data',result))
if total==0:
commonFuc().check_text_exist(0, result)
else:
commonFuc().check_text_exist(500, result)
select_notices()
# -*- encoding=utf8 -*-
from common.db.sql.sql_del_branch_info import delByBranchId
from common.fileUtls import FileUtils
from common.timeUtils import timeUtils
__author__ = "xiaohesheng"
"""
case_tag:api,herp-web,b5_编辑公告,id2263,id2263-15,sit,on
主数据平台:b5_编辑公告
"""
from common.common_func import commonFuc
from air_case.a1_herp3_login.登录内网系统.登录内网系统 import login_system
module = "a2_herp3_bs"
def modify_notices():
"""
场景:b5_编辑公告
用例名称:b5_编辑公告
输入:无
输出:"rtn_msg": {"code": 0, "msg": null, "data": 1}
"""
#内网登录
username = commonFuc().get_business_data(module, "username")
# print('医院名称',username)
password = commonFuc().get_business_data(module, "password")
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token,projectCode,uxid,corpId,info= login_system(username, password).get_token()
# print( token,projectCode,uxid,corpId,info)
#b5_编辑公告
url=commonFuc().get_api_url()+commonFuc().get_business_data(module, "update_url")
print(url)
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
commonFuc().get_business_data(module, "X-APP-CODE"))
notices_id = FileUtils().r_info3(module, '公告新增')["notices_id"]
notices_title = FileUtils().r_info3(module, '公告新增')["notices_name"]
# print(notices_id,notices_title)
expireDate=timeUtils().get_time_add(30)
# print(expireDate)
#请求体
request_body=commonFuc().get_business_data(module, "payload10",notices_title,expireDate,notices_title,notices_id)
print(request_body)
# # 发送请求
result = commonFuc().http_post(url, request_body,headers)
print('result', result)
checkDict=commonFuc().get_business_data(module,'checkDict2')
#断言
commonFuc().check_result(checkDict,result)
modify_notices()
# -*- encoding=utf8 -*-
from common.db.sql.sql_del_branch_info import delByBranchId
from common.db.sql.sql_del_notices_info import delByNoticeName
from common.fileUtls import FileUtils
from common.timeUtils import timeUtils
__author__ = "xiaohesheng"
"""
case_tag:api,herp-web,b6_删除公告,id2263,id2263-16,sit,on
主数据平台:b6_删除公告
"""
from common.common_func import commonFuc
from air_case.a1_herp3_login.登录内网系统.登录内网系统 import login_system
module = "a2_herp3_bs"
def modify_notices():
"""
场景:b6_删除公告
用例名称:b6_删除公告
输入:无
输出:"rtn_msg": {"code": 0, "msg": null, "data": 1}
"""
#内网登录
username = commonFuc().get_business_data(module, "username")
# print('医院名称',username)
password = commonFuc().get_business_data(module, "password")
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token,projectCode,uxid,corpId,info= login_system(username, password).get_token()
# print( token,projectCode,uxid,corpId,info)
#b6_删除公告
notices_id = FileUtils().r_info3(module, '公告新增')["notices_id"]
url=commonFuc().get_api_url()+commonFuc().get_business_data(module, "del_url")
url=url+notices_id
print(url)
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
commonFuc().get_business_data(module, "X-APP-CODE"))
# # print(notices_id,notices_title)
# expireDate=timeUtils().get_time_add(30)
# # print(expireDate)
# #请求体
# request_body=commonFuc().get_business_data(module, "payload10",notices_title,expireDate,notices_title,notices_id)
# print(request_body)
# # # 发送请求
result = commonFuc().http_delte(url,headers)
# print('result', result)
checkDict=commonFuc().get_business_data(module,'checkDict2')
# #断言
commonFuc().check_result(checkDict,result)
modify_notices()
#调用数据库处理类删除发布的公告,是逻辑删除
delByNoticeName().delete_ByNoticeName()
# -*- encoding=utf8 -*-
from common.db.sql.sql_del_branch_info import delByBranchId
from common.db.sql.sql_del_notices_info import delByNoticeName
from common.fileUtls import FileUtils
from common.timeUtils import timeUtils
__author__ = "xiaohesheng"
"""
case_tag:api,herp-web,b7_厂商管理_厂商查询byID,id2263,id2263-17,sit,on
主数据平台:b7_厂商管理_厂商查询byID
"""
from common.common_func import commonFuc
from air_case.a1_herp3_login.登录内网系统.登录内网系统 import login_system
module = "a2_herp3_bs"
def facturer_query_byID():
"""
场景:b7_厂商管理_厂商查询byID
用例名称:b7_厂商管理_厂商查询byID
输入:无
输出:"rtn_msg": {"code": 0, "msg": null, "data": 1}
"""
#内网登录
username = commonFuc().get_business_data(module, "username")
# print('医院名称',username)
password = commonFuc().get_business_data(module, "password")
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token,projectCode,uxid,corpId,info= login_system(username, password).get_token()
# print( token,projectCode,uxid,corpId,info)
#b7_厂商管理_厂商查询byID
notices_id = FileUtils().r_info3(module, '公告新增')["notices_id"]
url=commonFuc().get_api_url()+commonFuc().get_business_data(module, "firmpage_url")
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
commonFuc().get_business_data(module, "X-APP-CODE"))
# # print(notices_id,notices_title)
# expireDate=timeUtils().get_time_add(30)
# # print(expireDate)
# #请求体
request_body=commonFuc().get_business_data(module, "payload11")
# print(request_body)
# # # 发送请求
result = commonFuc().http_post(url,request_body,headers)
print('result', result)
# checkDict=commonFuc().get_business_data(module,'checkDict2')
# #断言
# id=commonFuc().analysis_json('id',commonFuc().analysis_json('data',commonFuc().analysis_json('data',result)))
# print(id)
commonFuc().check_text_exist('p56a4',result)
facturer_query_byID()
......@@ -109,6 +109,15 @@ class commonFuc(object):
result = requests.post(url, data=json.dumps(postdata), headers=header)
result = json.loads(result.content)
return result
#删除请求
def http_delte(self, url,header):
"""
一个post请求,返回json
"""
# result = requests.post(url, data=postdata, headers=header)
result = requests.delete(url,headers=header)
result = json.loads(result.content)
return result
def check_result(self, check_dict, result):
"""
......
# -*- encoding=utf8 -*-
import pymysql
class delByNoticeName(object):
def delete_ByNoticeName(self):
connection = pymysql.connect(host="10.17.65.108", user="root", password="Gyxc.2023", database="spd3_herp_test2",
charset="utf8")
cursor = connection.cursor()
# 删除新增的院区数据,减少垃圾数据的产生,保证脚本下次还可以正常运行,接口脚本每次都使用新增数据
sql = "update sys_notice set del_flag=1 where title like '%test%';"
print(sql)
cursor.execute(sql)
cursor.execute("commit;")
print('%s公告数据已逻辑删除成功')
# delByNoticeName().delete_ByNoticeName()
......@@ -72,9 +72,35 @@ class FileUtils(object):
# 写入到yaml文件
with open(yamlpath, "a", encoding="utf-8") as f:
yaml.dump(dict, f, Dumper=yaml.RoundTripDumper, allow_unicode=True)
#写入公告id和公告标题
def w_info3(self, info,module,keyname):
module=module
dict = {}
value = {}
value['notices_id'] = info[0]
value['notices_name'] = info[1]
key=keyname
dict[key] = value
w_path=rootPath+os.sep+'data'+os.sep+module
# print(w_path)
yamlpath = os.path.join(w_path, "message1")
# 写入到yaml文件
with open(yamlpath, "w", encoding="utf-8") as f:
yaml.dump(dict, f, Dumper=yaml.RoundTripDumper, allow_unicode=True)
#读取公告id和标题
def r_info3(self, module,keyname):
w_path = rootPath + os.sep + 'data' + os.sep + module
yamlpath = os.path.join(w_path, "message1")
file_value = open(yamlpath, 'r',encoding='utf-8')
result = yaml.load(file_value.read(), Loader=yaml.Loader)
if result is not None:
key = keyname
if key in result:
return result[key]
else:
return None
else:
return None
if __name__ == '__main__':
# info=("aaaa","bbbbbb","mdm3-pim")
# FileUtils().w_info(info,"产品新增")
......
"9ea057742d4a406a9220b7113f81f61a_url": "/hospitaltest2api/platformService/sys/user/v2/permission/9ea057742d4a406a9220b7113f81f61a/"
"edit_h_info_url": "/hospitaltest2api/platformService/basic/company/detail/"
"5ce279bb138a4261828289ae834ed53a_url": "/hospitaltest2api/platformService/sys/user/v2/permission/5ce279bb138a4261828289ae834ed53a/"
......@@ -6,6 +5,10 @@
"page_url": "/hospitaltest2api/platformService/basic/branch/page/"
"edit_url": "/hospitaltest2api/platformService/basic/branch/edit/"
"save_url": "/hospitaltest2api/platformService/basic/notice/save"
"page_url": "/hospitaltest2api/platformService/basic/notice/page"
"update_url": "/hospitaltest2api/platformService/basic/notice/update"
"del_url": "/hospitaltest2api/platformService/basic/notice/del/"
"firmpage_url": "/hospitaltest2api/herpService/basic/firm/page/"
"username": "xhs1009"
"password": "1qaz!QAZ"
"X-APP-CODE": "herp.pc"
......@@ -63,11 +66,15 @@ json_headers2: {
"ybFlag": "0",
"address": "东土城路院区"
}
"payload3": {"content":"<p>test</p>","corpId":"h0347","expireDate":"%s","id":"","mgrRangeId":"","mgrRangeKind":"0","noticeType":1,"title":"test","topFlag":"0"}
"payload4": {"content":"<p>test</p>","corpId":"h0347","expireDate":"%s","id":"","mgrRangeId":"","mgrRangeKind":"1","noticeType":1,"title":"test","topFlag":"0"}
"payload5": {"content":"<p>test</p>","corpId":"h0347","expireDate":"%s","id":"","mgrRangeId":"","mgrRangeKind":"2","noticeType":1,"title":"test","topFlag":"0"}
"payload3": {"content":"xhstest","corpId":"h0347","expireDate":"%s","id":"","mgrRangeId":"","mgrRangeKind":"0","noticeType":1,"title":"test","topFlag":"0"}
"payload4": {"content":"xhstest","corpId":"h0347","expireDate":"%s","id":"","mgrRangeId":"","mgrRangeKind":"1","noticeType":1,"title":"test","topFlag":"0"}
"payload5": {"content":"xhstest","corpId":"h0347","expireDate":"%s","id":"","mgrRangeId":"","mgrRangeKind":"2","noticeType":1,"title":"test","topFlag":"0"}
"payload6": {"content":"xhstest","corpId":"h0347","expireDate":"%s","id":"","mgrRangeId":"","mgrRangeKind":"3","noticeType":1,"title":"test","topFlag":"0"}
"payload7": {"pageNum": 1,"pageSize": 50,"queryObject": {"title": "xhstest","mgrRangeKind": "","publishDateBegin": "", "publishDateEnd": "", "corpId": "h0347"}}
"payload8": {"pageNum": 1,"pageSize": 50,"queryObject": {"title": "xhs","mgrRangeKind": "","publishDateBegin": "", "publishDateEnd": "", "corpId": "h0347"}}
"payload9": {"pageNum": 1,"pageSize": 50,"queryObject": {"title": "不存在的公告","mgrRangeKind": "","publishDateBegin": "", "publishDateEnd": "", "corpId": "h0347"}}
"payload10": {"content": "%s","expireDate": "%s","mgrRangeId": "","title": "%supdate","id": "%s","topFlag": "0","mgrRangeKind": "1","corpId": "h0347","noticeType": 1}
"payload11": {"pageNum": 1,"pageSize": 50,"queryObject": {"hosId": "h0347","searchText": "p56a4","firmType": 1}}
checkDict: {"code": 0,'msg': None,'data': True}
checkDict1: {
......
院区新增:
branch_id: h0347-2638
branch_name: 东土城路院区M2laQ
branch_id: h0347-2641
branch_name: 东土城路院区aEh%r
\ No newline at end of file
......@@ -72,9 +72,9 @@
</tr>
<tr width="600">
<td class="details-col-elapsed"><a href='../log/a6_停用院区/log.html' target='_blank'>a6_停用院区</a></td>
<td class="details-col-elapsed"><a href='../log/b7_厂商管理_厂商查询byID/log.html' target='_blank'>b7_厂商管理_厂商查询byID</a></td>
<td class="success">成功</td>
<td class="details-col-elapsed">0.592</td>
<td class="details-col-elapsed">0.575</td>
<td class="details-col-elapsed">xiaohesheng</td>
</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