1.优化角色

This commit is contained in:
李伟 2022-09-15 13:56:23 +08:00
parent 36b29c4b35
commit 11ef2d5e72
2 changed files with 73 additions and 10 deletions

View File

@ -555,15 +555,15 @@ async def condition(
# 今天的面试 # 今天的面试
if data_in.time_type == 'now': if data_in.time_type == 'now':
# 查询返回的数据一共多少条 # 查询返回的数据一共多少条
len_sql = f"""select uid from HR.resumes where {where} and toDate(star_time) == '{times}' ORDER BY event_time""" len_sql = f"""select uid from HR.resumes where {where} and toDate(star_time) == '{times}' and interview_stage = 3 ORDER BY event_time"""
sql = f"""select interview_round,interview_type,star_time,end_time,name,phone,job_names,hr_name,uid,interview_id, sql = f"""select interview_round,interview_type,star_time,end_time,name,phone,job_names,hr_name,uid,interview_id,
feedback,interview_name from HR.resumes where {where} and toDate(star_time) == '{times}' ORDER BY event_time feedback,interview_name from HR.resumes where {where} and toDate(star_time) == '{times}' and interview_stage = 3 ORDER BY event_time
LIMIT 10 OFFSET {(data_in.pages - 1) * 10}""" LIMIT 10 OFFSET {(data_in.pages - 1) * 10}"""
# 明天及之后的面试 # 明天及之后的面试
elif data_in.time_type == 'tomorrow': elif data_in.time_type == 'tomorrow':
len_sql = f"""select uid from HR.resumes where {where} and toDate(star_time) > '{times}' ORDER BY event_time""" len_sql = f"""select uid from HR.resumes where {where} and toDate(star_time) > '{times}' and interview_stage = 3 ORDER BY event_time"""
sql = f"""select interview_round,interview_type,star_time,end_time,name,phone,job_names,hr_name,uid,interview_id, sql = f"""select interview_round,interview_type,star_time,end_time,name,phone,job_names,hr_name,uid,interview_id,
feedback,interview_name from HR.resumes where {where} and toDate(star_time) > '{times}' ORDER BY event_time feedback,interview_name from HR.resumes where {where} and toDate(star_time) > '{times}' and interview_stage = 3 ORDER BY event_time
LIMIT 10 OFFSET {(data_in.pages - 1) * 10}""" LIMIT 10 OFFSET {(data_in.pages - 1) * 10}"""
# 昨天及以前的面试 # 昨天及以前的面试
else: else:
@ -1842,3 +1842,54 @@ async def find_like(
return schemas.Msg(code=-9, msg='无数据', data='') return schemas.Msg(code=-9, msg='无数据', data='')
res = chkData(data) res = chkData(data)
return schemas.Msg(code=200, msg='ok', data=res) return schemas.Msg(code=200, msg='ok', data=res)
# 总览
@router.post("/interview_stage_nu")
async def interview_stage_nu(
request: Request,
data_in: schemas.nterview,
ckdb: CKDrive = Depends(get_ck_db),
current_user: schemas.UserDB = Depends(deps.get_current_user)
) -> schemas.Msg:
res_data = {'0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0, '8': 0, '9': 0, '10': 0, '11': 0}
res = data_in.date
strs = []
for k, v in res.items():
if v != '':
if 'int' in str(type(v)):
str_s = f"{k} = {v}"
strs.append(str_s)
else:
if k in ['hr_id', 'interview_id'] and v != '':
str_s = f"{k} like '%{v}%'"
else:
str_s = f"{k} = '{v}'"
strs.append(str_s)
where = ' and '.join(strs)
# 当前日期
times = get_time()
len_sql = f"""select uid from HR.resumes where {where} and toDate(star_time) == '{times}' and interview_stage = 3"""
if where == '':
len_sql = len_sql.replace('where and', 'where', 1)
# 面试人数
df_len = await ckdb.query_dataframe(len_sql)
if df_len.empty:
len_date = 0
else:
len_date = len(df_len)
res_data['now']=len_date
# 1:初筛 2:复筛 3:面试 4:沟通offer 5:待入职 6:放弃入职 7:已入职 8:转正 9:主动离职 10:被动离职 11淘汰
sql = """select interview_stage,count(*) as value from HR.resumes group by interview_stage"""
data = await ckdb.execute(sql)
for i in data.values():
key = str(i['interview_stage'])
if key not in res_data:
continue
res_data[key] = i['value']
# 待发送offer
off_sql="""select count(*) as value from HR.resumes where offer_state <= 2 and interview_stage = 4"""
res= await ckdb.execute(off_sql)
res_data['offer'] = res[0]['value']
return schemas.Msg(code=200, msg='ok', data=res_data)

View File

@ -157,3 +157,15 @@ class add_inter(BaseModel):
class find_like(BaseModel): class find_like(BaseModel):
interview_stage: str # 简历阶段 interview_stage: str # 简历阶段
date: dict # 查询条件 date: dict # 查询条件
class nterview(BaseModel):
date: dict # 要查询的条件
# date包含如下参数,如选择全部的则传空字符串
# job_name: str # 应聘职位
# hr_name: str # 面试负责人
# interview_name: str # 面试官
# interview_type: int # 面试类型
# interview_sign: int # 面试签到
# feedback: int # 面试反馈
# interview_round: int # 面试轮次