1.优化面试阶段
This commit is contained in:
parent
968825baa0
commit
6f3905b368
@ -2111,3 +2111,57 @@ async def interview_teacher(
|
||||
"""
|
||||
await ckdb.execute(sql)
|
||||
return schemas.Msg(code=200, msg='ok', data='')
|
||||
|
||||
|
||||
@router.post("/interview")
|
||||
async def interview(
|
||||
request: Request,
|
||||
data_in: schemas.interviews,
|
||||
ckdb: CKDrive = Depends(get_ck_db),
|
||||
current_user: schemas.UserDB = Depends(deps.get_current_user)
|
||||
) -> schemas.Msg:
|
||||
""" 面试情况 """
|
||||
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', 'interview_name', 'hr_name'] 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 count(*) as v 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.execute(len_sql)
|
||||
# 已反馈的面试
|
||||
sql1 = f"""
|
||||
select count(*) as v from HR.resumes where {where} and teacher_state = 2 and interview_stage = 3
|
||||
"""
|
||||
# 未反馈的面试
|
||||
sql2 = f"""
|
||||
select count(*) as v from HR.resumes where {where} and teacher_state = 1 and interview_stage = 3
|
||||
"""
|
||||
# 已失效的面试
|
||||
sql3 = f"""
|
||||
|
||||
"""
|
||||
len1 = await ckdb.execute(sql1)
|
||||
len2 = await ckdb.execute(sql2)
|
||||
len3 = 0
|
||||
data = {
|
||||
'later': df_len[0]['v'], # 今天及之后的面试
|
||||
'teacher_true': len1[0]['v'], # 已反馈的面试
|
||||
'later_false': len2[0]['v'], # 未反馈的面试
|
||||
'later_invalid': len3 # 已失效的面试
|
||||
}
|
||||
return schemas.Msg(code=200, msg='ok', data=data)
|
||||
|
@ -174,3 +174,6 @@ class interview_teacher(BaseModel):
|
||||
uid: str # 求职者唯一id
|
||||
#date数据
|
||||
#{'voice':1,'thought':1,'diathesis':1,'evaluate':'评价'}
|
||||
|
||||
class interviews(BaseModel):
|
||||
date: dict # 要查询的条件
|
Loading…
Reference in New Issue
Block a user