From a510529e1570939175806a0aa380ba3d0070982a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E4=BC=9F?= <250213850@qq.com> Date: Wed, 14 Sep 2022 10:54:24 +0800 Subject: [PATCH] =?UTF-8?q?1.=E7=AE=80=E5=8E=86=E6=A8=A1=E7=B3=8A=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/api_v1/endpoints/interview.py | 48 +++++++++++++++++++++++++++---- liwei_接口文档.md | 7 +++++ schemas/interview_plan.py | 5 +++- 3 files changed, 53 insertions(+), 7 deletions(-) diff --git a/api/api_v1/endpoints/interview.py b/api/api_v1/endpoints/interview.py index a150749..cb5ca1e 100644 --- a/api/api_v1/endpoints/interview.py +++ b/api/api_v1/endpoints/interview.py @@ -101,7 +101,8 @@ def chkData(data): for index, i in enumerate(work_list): if index == 0: continue - if int(i['time'].split('-')[0].replace('.', '').replace('/', '')) > int(work_list[true_index]['time'].split('-')[0].replace('.', '').replace('/', '')): + if int(i['time'].split('-')[0].replace('.', '').replace('/', '')) > int( + work_list[true_index]['time'].split('-')[0].replace('.', '').replace('/', '')): true_index = index work_dict = work_list[true_index] work_list = [work_dict] @@ -136,7 +137,7 @@ def chkData(data): remembrance = [] res1['remembrance'] = remembrance if 'education' in res1: - education=res1['education'] + education = res1['education'] res1['education'] = education_dict[education] res_data.append(res1) return res_data @@ -543,8 +544,8 @@ async def condition( 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}%'" + 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) @@ -1784,7 +1785,7 @@ async def head_to_hw( # 地址 url = res.body.objectUrl resData = {'file_url': url, 'filename': 'hrms/user_icon/' + filename} - return schemas.Msg(code=0, msg='ok', data=resData) + return schemas.Msg(code=200, msg='ok', data=resData) else: # print('errorCode:', res.errorCode) # print('errorMessage:', res.errorMessage) @@ -1792,4 +1793,39 @@ async def head_to_hw( except: import traceback print(traceback.format_exc()) - return schemas.Msg(code=400, msg='上传华为云失败', data=None) \ No newline at end of file + return schemas.Msg(code=400, msg='上传华为云失败', data=None) + + +# 候选人管理,模糊查询 +@router.post("/find_like") +async def find_like( + request: Request, + data_in: schemas.find_like, + ckdb: CKDrive = Depends(get_ck_db), + current_user: schemas.UserDB = Depends(deps.get_current_user) +) -> schemas.Msg: + find_column = ["uid", "age", "gender", "at_school", "name", "event_time", "owner_name", "education", + "school", "specialty", "interview_name", "mmended_state", "work_list", "work_exp", + "graduate_time", + "job_name", "feedback", "interview_round", "interview_state", "interview_stage", "pass_why", + "pass_text"] + find_columns=','.join(find_column) + if data_in.date != {}: + strs = [] + for k, v in data_in.date.items(): + if v != '': + str_s = f"{k} like '%{v}%'" + strs.append(str_s) + where = ' and '.join(strs) + sql = f""" + select {find_columns} from HR.resumes where interview_stage = '{data_in.interview_stage}' and {where} + """ + else: + sql = f""" + select {find_columns} from HR.resumes where interview_stage = '{data_in.interview_stage}' + """ + data = await ckdb.execute(sql) + if not data: + return schemas.Msg(code=-9, msg='无数据', data='') + res=chkData(data) + return schemas.Msg(code=200, msg='ok', data=res) diff --git a/liwei_接口文档.md b/liwei_接口文档.md index f0c85ca..5939b71 100644 --- a/liwei_接口文档.md +++ b/liwei_接口文档.md @@ -341,3 +341,10 @@ api:/api/v1/itr/send_interviewee #头像上传到华为云 api:/api/v1/itr/head_to_hw 请求方式:post + +# 候选人管理,模糊查询 +api:/api/v1/itr/find_like +请求方式:post +参数: + interview_stage: str # 简历阶段 + date: dict # 查询条件 \ No newline at end of file diff --git a/schemas/interview_plan.py b/schemas/interview_plan.py index aac8338..6246fe2 100644 --- a/schemas/interview_plan.py +++ b/schemas/interview_plan.py @@ -150,7 +150,10 @@ class add_inter(BaseModel): uid: str # 求职者uid user_id: List[str] # 面试官的钉钉id star_time: str # 面试开始时间 - end_time:str # 面试结束时间 + end_time: str # 面试结束时间 hr_user: List[str] # HR的钉钉id +class find_like(BaseModel): + interview_stage: str # 简历阶段 + date: dict # 查询条件