1.优化面试阶段

This commit is contained in:
李伟 2022-09-16 18:55:39 +08:00
parent 968825baa0
commit 6f3905b368
2 changed files with 62 additions and 5 deletions

View File

@ -141,7 +141,7 @@ def chkData(data):
education = res1['education'] education = res1['education']
res1['education'] = education_dict[education] res1['education'] = education_dict[education]
if 'teacher_txt' in res1: if 'teacher_txt' in res1:
teacher_txt=json.loads(res1['teacher_txt']) teacher_txt = json.loads(res1['teacher_txt'])
res1['teacher_txt'] = teacher_txt res1['teacher_txt'] = teacher_txt
res_data.append(res1) res_data.append(res1)
return res_data return res_data
@ -2104,10 +2104,64 @@ async def interview_teacher(
current_user: schemas.UserDB = Depends(deps.get_current_user) current_user: schemas.UserDB = Depends(deps.get_current_user)
) -> schemas.Msg: ) -> schemas.Msg:
""" 面试反馈 """ """ 面试反馈 """
date=json.dumps(data_in.date) date = json.dumps(data_in.date)
sql=f""" sql = f"""
ALTER TABLE HR.resumes update teacher_state = 2,teacher_back={data_in.teacher_back},teacher_txt='{date}' ALTER TABLE HR.resumes update teacher_state = 2,teacher_back={data_in.teacher_back},teacher_txt='{date}'
WHERE uid = '{data_in.uid}' WHERE uid = '{data_in.uid}'
""" """
await ckdb.execute(sql) await ckdb.execute(sql)
return schemas.Msg(code=200, msg='ok', data='') 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)

View File

@ -173,4 +173,7 @@ class interview_teacher(BaseModel):
teacher_back:int # 面试反馈选择 teacher_back:int # 面试反馈选择
uid: str # 求职者唯一id uid: str # 求职者唯一id
#date数据 #date数据
#{'voice':1,'thought':1,'diathesis':1,'evaluate':'评价'} #{'voice':1,'thought':1,'diathesis':1,'evaluate':'评价'}
class interviews(BaseModel):
date: dict # 要查询的条件