175 lines
5.4 KiB
Python
175 lines
5.4 KiB
Python
import logging
|
|
import allure
|
|
from dulizhan.library.Dlizhan_interface import DlzhanInterface
|
|
|
|
obj_log = logging.getLogger("logger")
|
|
|
|
|
|
class DeptManage(DlzhanInterface):
|
|
def __init__(self):
|
|
super().__init__()
|
|
|
|
@allure.step("创建部门")
|
|
def kw_joyhub_dept_create_post(self, name, sort, status=1, parent_id=None, leader_user_id=None, phone=None, email=None, code=None):
|
|
"""
|
|
创建部门业务关键字
|
|
:param name: 部门名称
|
|
:param sort: 显示顺序
|
|
:param status: 状态
|
|
:param parent_id: 父部门ID
|
|
:param leader_user_id: 负责人用户编号
|
|
:param phone: 联系电话
|
|
:param email: 邮箱
|
|
:param code: 部门编码
|
|
:return: 响应结果
|
|
"""
|
|
obj_log.info(f"创建部门 - name: {name}, sort: {sort}, status: {status}")
|
|
|
|
params = {
|
|
"name": name,
|
|
"sort": sort,
|
|
"status": status
|
|
}
|
|
|
|
if parent_id is not None:
|
|
params["parentId"] = parent_id
|
|
if leader_user_id is not None:
|
|
params["leaderUserId"] = leader_user_id
|
|
if phone:
|
|
params["phone"] = phone
|
|
if email:
|
|
params["email"] = email
|
|
if code:
|
|
params["code"] = code
|
|
|
|
resp = self.kw_in_joyhub_dept_create_post(**params)
|
|
obj_log.info(f"创建部门响应: {resp}")
|
|
|
|
return resp
|
|
|
|
@allure.step("删除部门")
|
|
def kw_joyhub_dept_delete_post(self, dept_id):
|
|
"""
|
|
删除部门业务关键字
|
|
:param dept_id: 部门编号
|
|
:return: 响应结果
|
|
"""
|
|
obj_log.info(f"删除部门 - id: {dept_id}")
|
|
|
|
resp = self.kw_in_joyhub_dept_delete_post(dept_id)
|
|
obj_log.info(f"删除部门响应: {resp}")
|
|
|
|
return resp
|
|
|
|
@allure.step("批量删除部门")
|
|
def kw_joyhub_dept_delete_list_post(self, ids):
|
|
"""
|
|
批量删除部门业务关键字
|
|
:param ids: 部门编号列表
|
|
:return: 响应结果
|
|
"""
|
|
obj_log.info(f"批量删除部门 - ids: {ids}")
|
|
|
|
resp = self.kw_in_joyhub_dept_delete_list_post(ids)
|
|
obj_log.info(f"批量删除部门响应: {resp}")
|
|
|
|
return resp
|
|
|
|
@allure.step("获得部门信息")
|
|
def kw_joyhub_dept_get_get(self, dept_id):
|
|
"""
|
|
获得部门信息业务关键字
|
|
:param dept_id: 部门编号
|
|
:return: 响应结果
|
|
"""
|
|
obj_log.info(f"获得部门信息 - id: {dept_id}")
|
|
|
|
resp = self.kw_in_joyhub_dept_get_get(dept_id)
|
|
obj_log.info(f"获得部门信息响应: {resp}")
|
|
|
|
return resp
|
|
|
|
@allure.step("获取部门列表")
|
|
def kw_joyhub_dept_list_get(self, name=None, status=None):
|
|
"""
|
|
获取部门列表业务关键字
|
|
:param name: 部门名称(模糊匹配)
|
|
:param status: 状态
|
|
:return: 响应结果
|
|
"""
|
|
obj_log.info(f"获取部门列表 - name: {name}, status: {status}")
|
|
|
|
params = {}
|
|
if name:
|
|
params["name"] = name
|
|
if status is not None:
|
|
params["status"] = status
|
|
|
|
resp = self.kw_in_joyhub_dept_list_get(**params)
|
|
obj_log.info(f"获取部门列表响应: {resp}")
|
|
|
|
return resp
|
|
|
|
@allure.step("获取部门精简信息列表")
|
|
def kw_joyhub_dept_list_all_simple_get(self):
|
|
"""
|
|
获取部门精简信息列表业务关键字
|
|
:return: 响应结果
|
|
"""
|
|
obj_log.info("获取部门精简信息列表")
|
|
|
|
resp = self.kw_in_joyhub_dept_list_all_simple_get()
|
|
obj_log.info(f"获取部门精简信息列表响应: {resp}")
|
|
|
|
return resp
|
|
|
|
@allure.step("获取部门精简信息列表")
|
|
def kw_joyhub_dept_simple_list_get(self):
|
|
"""
|
|
获取部门精简信息列表业务关键字(另一个接口)
|
|
:return: 响应结果
|
|
"""
|
|
obj_log.info("获取部门精简信息列表(simple-list)")
|
|
|
|
resp = self.kw_in_joyhub_dept_simple_list_get()
|
|
obj_log.info(f"获取部门精简信息列表响应: {resp}")
|
|
|
|
return resp
|
|
|
|
@allure.step("更新部门")
|
|
def kw_joyhub_dept_update_put(self, dept_id, name, sort, status=1, parent_id=None, leader_user_id=None, phone=None, email=None):
|
|
"""
|
|
更新部门业务关键字
|
|
:param dept_id: 部门编号
|
|
:param name: 部门名称
|
|
:param sort: 显示顺序
|
|
:param status: 状态
|
|
:param parent_id: 父部门ID
|
|
:param leader_user_id: 负责人用户编号
|
|
:param phone: 联系电话
|
|
:param email: 邮箱
|
|
:return: 响应结果
|
|
"""
|
|
obj_log.info(f"更新部门 - id: {dept_id}, name: {name}, sort: {sort}, status: {status}")
|
|
|
|
params = {
|
|
"id": dept_id,
|
|
"name": name,
|
|
"sort": sort,
|
|
"status": status
|
|
}
|
|
|
|
if parent_id is not None:
|
|
params["parentId"] = parent_id
|
|
if leader_user_id is not None:
|
|
params["leaderUserId"] = leader_user_id
|
|
if phone:
|
|
params["phone"] = phone
|
|
if email:
|
|
params["email"] = email
|
|
|
|
resp = self.kw_in_joyhub_dept_update_put(**params)
|
|
obj_log.info(f"更新部门响应: {resp}")
|
|
|
|
return resp
|