1.优化新增职位和获取职位

This commit is contained in:
李伟 2022-08-04 09:39:06 +08:00
parent 5a2a2eb316
commit 4ea9ef25e7
2 changed files with 56 additions and 46 deletions

View File

@ -321,20 +321,24 @@ async def event_edit(
job = [] job = []
for i in res: for i in res:
# 获取职位名称 # 获取职位名称
job_list = [] job_list = {}
job_list.append(i['job_id']) job_list['job_id'] = i['job_id'] # 职位id
# 查询对应职位id入职多少人 # 查询对应职位id入职多少人
sql = f""" sql = f"""
select count(job_id) from HR.resumes where job_id = '{i['job_id']}' and interview_stage = 7 select count(job_id) from HR.resumes where job_id = '{i['job_id']}' and interview_stage = 7
""" """
# 候选人总数
sql1 = f"""
select count(job_id) from HR.resumes where job_id = '{i['job_id']}' and interview_stage < 6
"""
hou_num = await ckdb.execute(sql1)
num = await ckdb.execute(sql) num = await ckdb.execute(sql)
job_list['job_name'] = i['job_name'] # 职位名
job_list.append(i['job_name']) job_list['principal'] = i['principal'] # 招聘负责人
job_list.append(i['job_sector']) job_list['job_sector'] = i['job_sector'] # 部门
job_list.append(i['principal']) job_list['job_num'] = i['job_num'] # 目标招聘人数
job_list.append(i['owner_name']) job_list['now_job_num'] = num # 对应职位的入职人数
job_list.append(num) job_list['hou_num'] = hou_num # 候选人总数
job_list.append(i['job_num'])
job.append(job_list) job.append(job_list)
data = { data = {
'num': num, 'num': num,
@ -600,6 +604,7 @@ async def event_edit(
for i in res: for i in res:
data_dict = {} data_dict = {}
data_dict['name'] = i.get('name') data_dict['name'] = i.get('name')
data_dict['user_id'] = i.get('user_id')
data_dict['email'] = i.get('email') data_dict['email'] = i.get('email')
data_dict['rank'] = i.get('rank') # 用于区分是面试官还是hr data_dict['rank'] = i.get('rank') # 用于区分是面试官还是hr
data.append(data_dict) data.append(data_dict)
@ -884,7 +889,7 @@ async def login(
async def reset_password(request: Request, async def reset_password(request: Request,
data_in: schemas.UserRestPassword, data_in: schemas.UserRestPassword,
db: AsyncIOMotorDatabase = Depends(get_database), db: AsyncIOMotorDatabase = Depends(get_database),
#current_user: schemas.User = Depends(deps.get_current_user) # current_user: schemas.User = Depends(deps.get_current_user)
) -> Any: ) -> Any:
""" """
修改其他人密码 修改其他人密码
@ -939,23 +944,24 @@ async def all_account(
async def forbid_lojin(request: Request, async def forbid_lojin(request: Request,
data_in: schemas.Get_userid, data_in: schemas.Get_userid,
db: AsyncIOMotorDatabase = Depends(get_database), db: AsyncIOMotorDatabase = Depends(get_database),
#current_user: schemas.User = Depends(deps.get_current_user) # current_user: schemas.User = Depends(deps.get_current_user)
) -> schemas.Msg: ) -> schemas.Msg:
""" """
禁止/解禁用户登录功能 禁止/解禁用户登录功能
""" """
if data_in.type == 1: if data_in.type == 1:
await crud.user.forbid_lojin(db, data_in,1) await crud.user.forbid_lojin(db, data_in, 1)
elif data_in.type == 0: elif data_in.type == 0:
await crud.user.forbid_lojin(db, data_in, 0) await crud.user.forbid_lojin(db, data_in, 0)
return schemas.Msg(code=200, msg='ok', data='') return schemas.Msg(code=200, msg='ok', data='')
@router.post("/owner_list") @router.post("/owner_list")
async def event_list( async def event_list(
request: Request, request: Request,
data_in: schemas.Getdate, data_in: schemas.Getdate,
db: AsyncIOMotorDatabase = Depends(get_database), db: AsyncIOMotorDatabase = Depends(get_database),
#current_user: schemas.UserDB = Depends(deps.get_current_user) # current_user: schemas.UserDB = Depends(deps.get_current_user)
) -> schemas.Msg: ) -> schemas.Msg:
"""获取基本信息列表""" """获取基本信息列表"""
try: try:
@ -971,7 +977,7 @@ async def event_edit(
request: Request, request: Request,
data_in: schemas.Ownername, data_in: schemas.Ownername,
db: AsyncIOMotorDatabase = Depends(get_database), db: AsyncIOMotorDatabase = Depends(get_database),
#current_user: schemas.UserDB = Depends(deps.get_current_user) # current_user: schemas.UserDB = Depends(deps.get_current_user)
) -> schemas.Msg: ) -> schemas.Msg:
"""新增,删除基本信息""" """新增,删除基本信息"""
await crud.basic_data.update(db, data_in) await crud.basic_data.update(db, data_in)

View File

@ -1,5 +1,6 @@
import time import time
from datetime import datetime from datetime import datetime
from typing import List
from pydantic import BaseModel from pydantic import BaseModel
@ -8,11 +9,11 @@ class Job(BaseModel):
job_id: str = None # 职位的唯一id job_id: str = None # 职位的唯一id
job_name: str # 职位名称 job_name: str # 职位名称
job_sector: str # 职位部门 job_sector: str # 职位部门
job_nature: str # 职位性质 job_nature: int # 职位性质
job_priority: str # 职位优先级 job_priority: str # 职位优先级
owner_name: str # 渠道 owner_name: str # 渠道
principal: str # 负责人 principal: List[dict] # 负责人
patronn: str # 协助人 patronn: List[dict] # 协助人
start_time: datetime = datetime.now() # 开始招聘时间 start_time: datetime = datetime.now() # 开始招聘时间
end_time: datetime = None # 结束招聘时间 end_time: datetime = None # 结束招聘时间
function_type: str # 职能类型 function_type: str # 职能类型
@ -21,25 +22,26 @@ class Job(BaseModel):
auto_repeater: bool # 是否自动转发 auto_repeater: bool # 是否自动转发
cacsi_count: int = None # 面试满意度反馈次数 cacsi_count: int = None # 面试满意度反馈次数
state: bool = None # 职位招聘状态 state: bool = None # 职位招聘状态
job_num: int = None # 招聘人数 job_num: str = None # 招聘人数
education: str # 学历要求 education: int # 学历要求
job_rank: str # 职位级别 job_rank: str # 职位级别
work_exp: str # 工作经验 work_exp: int # 工作经验
report_obj: str # 汇报对象 report_obj: str # 汇报对象
min_money: int # 薪资范围min min_money: int # 薪资范围min
max_money: int # 薪资范围max max_money: int # 薪资范围max
requirement: str # 需求描述 requirement: str # 需求描述
hr_name: List[dict] # 用人经理
interview: List[dict] # 面试官
class Jobs(BaseModel): class Jobs(BaseModel):
job_id: str = None # 职位的唯一id job_id: str = None # 职位的唯一id
job_name: str = None # 职位名称 job_name: str = None # 职位名称
job_sector: str = None # 职位部门 job_sector: str = None # 职位部门
job_nature: str = None # 职位性质 job_nature: int = None # 职位性质
job_priority: str = None # 职位优先级 job_priority: str = None # 职位优先级
owner_name: str = None # 渠道 owner_name: str = None # 渠道
principal: str = None # 负责人 principal: List[dict] = None # 负责人
patronn: str = None # 协助人 patronn: List[dict] = None # 协助人
start_time: datetime = None # 开始招聘时间 start_time: datetime = None # 开始招聘时间
end_time: datetime = None # 结束招聘时间 end_time: datetime = None # 结束招聘时间
function_type: str = None # 职能类型 function_type: str = None # 职能类型
@ -48,42 +50,44 @@ class Jobs(BaseModel):
auto_repeater: bool = None # 是否自动转发 auto_repeater: bool = None # 是否自动转发
cacsi_count: int = None # 面试满意度反馈次数 cacsi_count: int = None # 面试满意度反馈次数
state: bool = None # 职位招聘状态 state: bool = None # 职位招聘状态
job_num: int = None # 目标招聘人数 job_num: str = None # 目标招聘人数
now_job_num: int = None # 实际招聘人数 now_job_num: int = None # 实际招聘人数
education: str = None # 学历要求 education: int = None # 学历要求
job_rank: str = None # 职位级别 job_rank: str = None # 职位级别
work_exp: str = None # 工作经验 work_exp: int = None # 工作经验
report_obj: str = None # 汇报对象 report_obj: str = None # 汇报对象
min_money: int = None # 薪资范围min min_money: int = None # 薪资范围min
max_money: int = None # 薪资范围max max_money: int = None # 薪资范围max
requirement: str = None # 需求描述 requirement: str = None # 需求描述
hr_name: List[dict] =None # 用人经理
interview: List[str] =None # 面试官
class Ins_Job(BaseModel): class Ins_Job(BaseModel):
job_id: str = str(int(time.time())) # 职位的唯一id job_id: str = str(int(time.time())) # 职位的唯一id
job_name: str # 职位名称 job_name: str # 职位名称
job_sector: str # 职位部门 job_sector: str # 职位部门
job_nature: str # 职位性质 job_nature: int # 职位性质
job_priority: str # 职位优先级 job_priority: str =None # 职位优先级
owner_name: str # 渠道 owner_name: str =None # 渠道
principal: str # 负责人 principal: List[dict] # 负责人
patronn: str # 协助人 patronn: List[dict] # 协助人
start_time: datetime = datetime.now() # 开始招聘时间 start_time: str # 开始招聘时间
function_type: str # 职能类型 function_type: str # 职能类型
filtering_rules: bool # 是否使用筛选规则 filtering_rules: bool=None # 是否使用筛选规则
hiring_needs: bool # 是否关联招聘需求 hiring_needs: bool =None # 是否关联招聘需求
auto_repeater: bool # 是否自动转发 auto_repeater: bool =None # 是否自动转发
cacsi_count: int = 0 # 面试满意度反馈次数 cacsi_count: int = 0 # 面试满意度反馈次数
state: bool = True # 职位招聘状态 state: bool # 职位招聘状态
job_num: int = None # 目标招聘人数 job_num: str # 目标招聘人数
now_job_num: int = None # 实际招聘人数 now_job_num: int = 0 # 实际招聘人数
education: str # 学历要求 education: int # 学历要求
job_rank: str # 职位级别 job_rank: str # 职位级别
work_exp: str # 工作经验 work_exp: int # 工作经验
report_obj: str # 汇报对象 report_obj: str =None # 汇报对象
min_money: int # 薪资范围min min_money: int # 薪资范围min
max_money: int # 薪资范围max max_money: int # 薪资范围max
requirement: str # 需求描述 requirement: str # 需求描述
hr_name: List[dict] # 用人经理
interview: List[dict] # 面试官
end_time: str #结束招聘时间