feat: 添加JoyHub运费模板和Banner管理接口用例
This commit is contained in:
190
dulizhan/library/BusinessKw/JoyHub/ShippingTemplateManage.py
Normal file
190
dulizhan/library/BusinessKw/JoyHub/ShippingTemplateManage.py
Normal file
@@ -0,0 +1,190 @@
|
||||
import logging
|
||||
import allure
|
||||
from dulizhan.library.Dlizhan_interface import DlzhanInterface
|
||||
|
||||
obj_log = logging.getLogger("logger")
|
||||
|
||||
|
||||
class ShippingTemplateManage(DlzhanInterface):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
@allure.step("创建运费模板")
|
||||
def kw_joyhub_shipping_template_create_post(self, template_name, is_default, calculation_algorithm, currency, status, id=0):
|
||||
"""
|
||||
创建运费模板业务关键字
|
||||
:param template_name: 模板名称
|
||||
:param is_default: 是否为默认模板,1-是,2-否
|
||||
:param calculation_algorithm: 运费计算算法,fixed_amount-固定金额,percentage-百分比
|
||||
:param currency: 币种
|
||||
:param status: 状态 1-启用,2-停用
|
||||
:param id: 主键,新增为0
|
||||
:return: 响应结果
|
||||
"""
|
||||
obj_log.info(f"创建运费模板 - templateName: {template_name}, isDefault: {is_default}, calculationAlgorithm: {calculation_algorithm}, currency: {currency}, status: {status}")
|
||||
|
||||
params = {
|
||||
"id": id,
|
||||
"templateName": template_name,
|
||||
"isDefault": is_default,
|
||||
"calculationAlgorithm": calculation_algorithm,
|
||||
"currency": currency,
|
||||
"status": status
|
||||
}
|
||||
|
||||
resp = self.kw_in_joyhub_shipping_template_create_post(**params)
|
||||
obj_log.info(f"创建运费模板响应: {resp}")
|
||||
|
||||
return resp
|
||||
|
||||
@allure.step("删除运费模板")
|
||||
def kw_joyhub_shipping_template_delete_post(self, shipping_template_id):
|
||||
"""
|
||||
删除运费模板业务关键字
|
||||
:param shipping_template_id: 运费模板编号
|
||||
:return: 响应结果
|
||||
"""
|
||||
obj_log.info(f"删除运费模板 - id: {shipping_template_id}")
|
||||
|
||||
resp = self.kw_in_joyhub_shipping_template_delete_post(shipping_template_id=shipping_template_id)
|
||||
obj_log.info(f"删除运费模板响应: {resp}")
|
||||
|
||||
return resp
|
||||
|
||||
@allure.step("批量删除运费模板")
|
||||
def kw_joyhub_shipping_template_delete_list_post(self, ids):
|
||||
"""
|
||||
批量删除运费模板业务关键字
|
||||
:param ids: 运费模板编号列表
|
||||
:return: 响应结果
|
||||
"""
|
||||
obj_log.info(f"批量删除运费模板 - ids: {ids}")
|
||||
|
||||
resp = self.kw_in_joyhub_shipping_template_delete_list_post(ids=ids)
|
||||
obj_log.info(f"批量删除运费模板响应: {resp}")
|
||||
|
||||
return resp
|
||||
|
||||
@allure.step("获得运费模板详情")
|
||||
def kw_joyhub_shipping_template_get_detail_get(self, shipping_template_id):
|
||||
"""
|
||||
获得运费模板详情(含规则与子表)业务关键字
|
||||
:param shipping_template_id: 运费模板编号
|
||||
:return: 响应结果
|
||||
"""
|
||||
obj_log.info(f"获得运费模板详情 - id: {shipping_template_id}")
|
||||
|
||||
resp = self.kw_in_joyhub_shipping_template_get_detail_get(shipping_template_id=shipping_template_id)
|
||||
obj_log.info(f"获得运费模板详情响应: {resp}")
|
||||
|
||||
return resp
|
||||
|
||||
@allure.step("获得运费模板分页列表")
|
||||
def kw_joyhub_shipping_template_page_get(self, page_no=1, page_size=10, template_name="", is_default=None, calculation_algorithm="", currency="", status=None):
|
||||
"""
|
||||
获得运费模板分页列表业务关键字
|
||||
:param page_no: 页码
|
||||
:param page_size: 每页条数
|
||||
:param template_name: 模板名称
|
||||
:param is_default: 是否为默认模板,1-是,2-否
|
||||
:param calculation_algorithm: 运费计算算法
|
||||
:param currency: 币种
|
||||
:param status: 状态
|
||||
:return: 响应结果
|
||||
"""
|
||||
obj_log.info(f"获得运费模板分页列表 - pageNo: {page_no}, pageSize: {page_size}, templateName: {template_name}")
|
||||
|
||||
params = {
|
||||
"pageNo": page_no,
|
||||
"pageSize": page_size
|
||||
}
|
||||
|
||||
if template_name:
|
||||
params["templateName"] = template_name
|
||||
if is_default is not None:
|
||||
params["isDefault"] = is_default
|
||||
if calculation_algorithm:
|
||||
params["calculationAlgorithm"] = calculation_algorithm
|
||||
if currency:
|
||||
params["currency"] = currency
|
||||
if status is not None:
|
||||
params["status"] = status
|
||||
|
||||
resp = self.kw_in_joyhub_shipping_template_page_get(**params)
|
||||
obj_log.info(f"获得运费模板分页列表响应: {resp}")
|
||||
|
||||
return resp
|
||||
|
||||
@allure.step("保存运费模板(含规则与子表)")
|
||||
def kw_joyhub_shipping_template_save_with_children_post(self, template_name, is_default, calculation_algorithm, currency, status, shipping_rules=None, id=0):
|
||||
"""
|
||||
保存运费模板信息(含规则与子表)业务关键字
|
||||
:param template_name: 模板名称
|
||||
:param is_default: 是否为默认模板,1-是,2-否
|
||||
:param calculation_algorithm: 运费计算算法
|
||||
:param currency: 币种
|
||||
:param status: 状态
|
||||
:param shipping_rules: 运费规则列表
|
||||
:param id: 主键,新增为0
|
||||
:return: 响应结果
|
||||
"""
|
||||
obj_log.info(f"保存运费模板(含规则与子表) - templateName: {template_name}, isDefault: {is_default}")
|
||||
|
||||
params = {
|
||||
"id": id,
|
||||
"templateName": template_name,
|
||||
"isDefault": is_default,
|
||||
"calculationAlgorithm": calculation_algorithm,
|
||||
"currency": currency,
|
||||
"status": status
|
||||
}
|
||||
|
||||
if shipping_rules:
|
||||
params["shippingRules"] = shipping_rules
|
||||
|
||||
resp = self.kw_in_joyhub_shipping_template_save_with_children_post(**params)
|
||||
obj_log.info(f"保存运费模板(含规则与子表)响应: {resp}")
|
||||
|
||||
return resp
|
||||
|
||||
@allure.step("获得运费规则列表")
|
||||
def kw_joyhub_shipping_template_shipping_rule_list_get(self, shipping_template_id):
|
||||
"""
|
||||
获得运费规则列表业务关键字
|
||||
:param shipping_template_id: 关联的模板ID
|
||||
:return: 响应结果
|
||||
"""
|
||||
obj_log.info(f"获得运费规则列表 - shippingTemplateId: {shipping_template_id}")
|
||||
|
||||
resp = self.kw_in_joyhub_shipping_template_shipping_rule_list_get(shipping_template_id=shipping_template_id)
|
||||
obj_log.info(f"获得运费规则列表响应: {resp}")
|
||||
|
||||
return resp
|
||||
|
||||
@allure.step("更新运费模板")
|
||||
def kw_joyhub_shipping_template_update_put(self, id, template_name, is_default, calculation_algorithm, currency, status):
|
||||
"""
|
||||
更新运费模板业务关键字
|
||||
:param id: 模板编号
|
||||
:param template_name: 模板名称
|
||||
:param is_default: 是否为默认模板,1-是,2-否
|
||||
:param calculation_algorithm: 运费计算算法
|
||||
:param currency: 币种
|
||||
:param status: 状态
|
||||
:return: 响应结果
|
||||
"""
|
||||
obj_log.info(f"更新运费模板 - id: {id}, templateName: {template_name}")
|
||||
|
||||
params = {
|
||||
"id": id,
|
||||
"templateName": template_name,
|
||||
"isDefault": is_default,
|
||||
"calculationAlgorithm": calculation_algorithm,
|
||||
"currency": currency,
|
||||
"status": status
|
||||
}
|
||||
|
||||
resp = self.kw_in_joyhub_shipping_template_update_put(**params)
|
||||
obj_log.info(f"更新运费模板响应: {resp}")
|
||||
|
||||
return resp
|
||||
Reference in New Issue
Block a user