1.优化面试阶段

This commit is contained in:
李伟 2022-09-16 20:11:15 +08:00
parent abaf52ae9d
commit e39d373363

View File

@ -2145,14 +2145,10 @@ async def interview(
len_sql = f"""select count(*) as v from HR.resumes where {where} and toDate(star_time) >= '{times}' and interview_stage = 3"""
print(len_sql)
# 已反馈的面试
sql1 = f"""
select count(*) as v from HR.resumes where {where} and teacher_state = 2 and interview_stage = 3
"""
sql1 = f"""select count(*) as v from HR.resumes where {where} and teacher_state = 2 and interview_stage = 3"""
print(sql1)
# 未反馈的面试
sql2 = f"""
select count(*) as v from HR.resumes where {where} and teacher_state = 1 and interview_stage = 3
"""
sql2 = f"""select count(*) as v from HR.resumes where {where} and teacher_state = 1 and interview_stage = 3 """
print(sql2)
# 已失效的面试
sql3 = f"""
@ -2173,3 +2169,63 @@ async def interview(
'later_invalid': len3 # 已失效的面试
}
return schemas.Msg(code=200, msg='ok', data=data)
@router.post("/interviews")
async def interviews(
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()
# 今天及之后的面试
sql = f"""select uid,name,job_names,end_time,star_time,interview_type,hr_name,interview_stage,teacher_back from HR.resumes
where {where} and toDate(star_time) >= '{times}' and interview_stage = 3"""
print(sql)
# 已反馈的面试
sql1 = f"""select uid,name,job_names,end_time,star_time,interview_type,hr_name,interview_stage,teacher_back from HR.resumes
where {where} and teacher_state = 2 and interview_stage = 3"""
print(sql1)
# 未反馈的面试
sql2 = f"""select uid,name,job_names,end_time,star_time,interview_type,hr_name,interview_stage,teacher_back from HR.resumes
where {where} and teacher_state = 1 and interview_stage = 3 """
print(sql2)
# 已失效的面试
sql3 = f"""
"""
if where == '':
sql = sql.replace('where and', 'where', 1)
sql1 = sql1.replace('where and', 'where', 1)
sql2 = sql2.replace('where and', 'where', 1)
data = await ckdb.execute(sql)
res = chkData(data)
data1 = await ckdb.execute(sql1)
res1 = chkData(data1)
data2 = await ckdb.execute(sql2)
res2 = chkData(data2)
res3=[]
datas={'later':res, # 今天及之后的面试
'teacher_true':res1, # 已反馈的面试
'later_false':res2, # 未反馈的面试
'later_invalid':res3} # 已失效的面试
return schemas.Msg(code=200, msg='ok', data=datas)