From cd8dfea5b996a26375d6fccedd6b9b580d144edc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E4=BC=9F?= <250213850@qq.com> Date: Wed, 7 Sep 2022 17:53:51 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=B7=BB=E5=8A=A0=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/api_v1/endpoints/interview.py | 23 ++++++++++++++++++++++- crud/crud_user.py | 4 ++++ liwei_接口文档.md | 11 ++++++++++- schemas/interview_plan.py | 7 +++++++ 4 files changed, 43 insertions(+), 2 deletions(-) diff --git a/api/api_v1/endpoints/interview.py b/api/api_v1/endpoints/interview.py index 6f44a05..363a7ee 100644 --- a/api/api_v1/endpoints/interview.py +++ b/api/api_v1/endpoints/interview.py @@ -287,7 +287,7 @@ async def file_to_hw( if fn.endswith('pdf'): # pdf正常上传到华为云 res = obsClient.putFile('legu-cdn-source', 'hrms/' + filename, path_data + '/' + filename) else: # doc/docx则转化为pdf上传到华为云 - new_fn,fil = doc2pdf(fn, path_data, filename) + new_fn, fil = doc2pdf(fn, path_data, filename) res = obsClient.putFile('legu-cdn-source', 'hrms/' + fil, new_fn) if res.status < 300: # 地址 @@ -1681,3 +1681,24 @@ async def add_role_domain( # 存在则在这个用户表示已经有权限 else: return schemas.Msg(code=-9, msg='权限已存在', data='') + + +@router.post("/send_interviewee") +async def send_interviewee( + request: Request, + data_in: schemas.send_in, + db: AsyncIOMotorDatabase = Depends(get_database), + ckdb: CKDrive = Depends(get_ck_db), + current_user: schemas.UserDB = Depends(deps.get_current_user) +) -> schemas.Msg: + """一键推送给用人部门""" + up_da = data_in.push + up_list = await crud.user.get_users(db, up_da) + up_da_str = ','.join(up_da) + interview_name = [i['name'] for i in up_list] # 分配的面试官的名字 + interview_str = ','.join(interview_name) + sql = f""" + ALTER TABLE HR.resumes update interview_name = '{interview_str}',interview_id = '{up_da_str}' WHERE uid = '{data_in.uid}' + """ + await ckdb.execute(sql) # 初次分配面试官 + return schemas.Msg(code=200, msg='ok', data='') diff --git a/crud/crud_user.py b/crud/crud_user.py index 1bb1e64..cd07db7 100644 --- a/crud/crud_user.py +++ b/crud/crud_user.py @@ -25,6 +25,10 @@ class CRUDUser(CRUDBase): async def get_user(self, db: AsyncIOMotorDatabase, user_id: str): res = await db[self.coll_name].find_one({'user_id': user_id}) return res + #获取用户信息(list) + async def get_users(self, db: AsyncIOMotorDatabase, user_id: list): + res = await db[self.coll_name].find_many({'user_id':{'$in': user_id}}, {'name': 1,'user_id':1}) + return res async def edit_profile(self, db: AsyncIOMotorDatabase, data_id: schemas.UserProfileEdit, user_id): if data_id.nickname: diff --git a/liwei_接口文档.md b/liwei_接口文档.md index 5e56650..26964eb 100644 --- a/liwei_接口文档.md +++ b/liwei_接口文档.md @@ -327,4 +327,13 @@ api:/api/v1/itr/api_list api:/api/v1/itr/find_job 请求方式:post 参数: - job_id: str # 职位的唯一id \ No newline at end of file + job_id: str # 职位的唯一id + +#一键推送给用人部门 +api:/api/v1/itr/send_interviewee +请求方式:post +参数: + uid: str # 求职者uid + push: List[str] # 推送 + content: str # 备注内容 + bcc: List[str] # 抄送 \ No newline at end of file diff --git a/schemas/interview_plan.py b/schemas/interview_plan.py index a83b406..115eb86 100644 --- a/schemas/interview_plan.py +++ b/schemas/interview_plan.py @@ -137,3 +137,10 @@ class ExtendendOAuth(OAuth2PasswordRequestForm): super().__init__(grant_type, username, password, scope, client_id, client_secret) self.unionid = unionid # 通过钉钉扫码获取的unionid # unionid :str # 通过钉钉扫码获取的unionid + + +class send_in(BaseModel): + uid: str # 求职者uid + push: List[str] # 推送 + content: str # 备注内容 + bcc: List[str] # 抄送