diff --git a/api/api_v1/endpoints/interview.py b/api/api_v1/endpoints/interview.py index 819a771..af1e539 100644 --- a/api/api_v1/endpoints/interview.py +++ b/api/api_v1/endpoints/interview.py @@ -285,16 +285,21 @@ async def event_edit( res = await crud.jobs.all_fields(db, data_in) # 获取职位数量 num = len(res) - job_list = [] - job_id = [] + + job = [] for i in res: # 获取职位名称 + job_list = [] + job_list.append(i['job_id']) job_list.append(i['job_name']) - job_id.append(i['job_id']) + job_list.append(i['job_sector']) + job_list.append(i['principal']) + job_list.append(i['owner_name']) + job_list.append(i['job_num']) + job.append(job_list) data = { 'num': num, - 'job_list': job_list, - 'job_id': job_id + 'job': job } return schemas.Msg(code=200, msg='ok', data=data) @@ -390,13 +395,18 @@ async def event_edit( async def event_edit( request: Request, data_in: schemas.Entry, - ckdb: CKDrive = Depends(get_ck_db) + ckdb: CKDrive = Depends(get_ck_db), + db: AsyncIOMotorDatabase = Depends(get_database) ) -> schemas.Msg: """修改入职状态""" sql = f""" ALTER table HR.resumes update interview_stage = {data_in.interview_stage} WHERE uid = '{data_in.uid}' """ await ckdb.execute(sql) + # 给招聘中职位计入职数 + res=await crud.jobs.find_job(db,data_in.job_id) + num=res['now_job_num']+1 + await crud.jobs.update_job(db,schemas.Jobs(job_id=data_in.job_id,now_job_num=num)) return schemas.Msg(code=200, msg='ok', data='') @@ -487,8 +497,8 @@ async def event_edit( # 同步钉钉发消息给面试官 try: now_time = str(datetime.now()).split('.')[0] - content=f"【催促反馈】\n请面试官尽快给{data_in.name}做面试反馈\n提醒时间:{now_time}" - send_dates(content,data_in.user_id) + content = f"【催促反馈】\n请面试官尽快给{data_in.name}做面试反馈\n提醒时间:{now_time}" + send_dates(content, data_in.user_id) return schemas.Msg(code=200, msg='发送成功', data='') except Exception: return schemas.Msg(code=-9, msg='发送失败', data='') @@ -533,12 +543,12 @@ async def event_edit( db: AsyncIOMotorDatabase = Depends(get_database), ) -> schemas.Msg: """获取所有用户角色""" - res = await crud.user.get_all_users(db,{}) - data=[] + res = await crud.user.get_all_users(db, {}) + data = [] for i in res: - data_dict={} - data_dict['name']=i.get('name') - data_dict['email']=i.get('email') + data_dict = {} + data_dict['name'] = i.get('name') + data_dict['email'] = i.get('email') data.append(data_dict) return schemas.Msg(code=200, msg='ok', data=data) @@ -552,4 +562,3 @@ async def event_edit( """修改职位信息,修改职位招聘状态""" await crud.jobs.update_job(db, data_in) return schemas.Msg(code=200, msg='ok', data='') - diff --git a/crud/crud_jobs.py b/crud/crud_jobs.py index 93de590..3930ccd 100644 --- a/crud/crud_jobs.py +++ b/crud/crud_jobs.py @@ -29,12 +29,17 @@ class CRUDJobs(CRUDBase): for k, v in data_dict.items(): if v != None and k != 'job_id': update[k] = v - await self.update_one(db, {'job_id': int(data_in.job_id)}, {'$set': update}) + await self.update_one(db, {'job_id': data_in.job_id}, {'$set': update}) # 插入一条新的职位数据 async def insert_job(self, db: AsyncIOMotorDatabase, data_in: schemas.Ins_Job): await self.insert_one(db, data_in.dict()) + # 获取对应jobid的信息 + async def find_job(self, db: AsyncIOMotorDatabase, job_id): + + return await self.find_one(db, {'job_id':job_id}) + jobs = CRUDJobs('jobs') diff --git a/schemas/interview_plan.py b/schemas/interview_plan.py index d42260f..8ccceb0 100644 --- a/schemas/interview_plan.py +++ b/schemas/interview_plan.py @@ -35,6 +35,7 @@ class get_uid(BaseModel): class Entry(BaseModel): uid: str # 面试者简历在CK中的唯一标识 interview_stage: int # 修改入职状态 + job_id:str #招聘职位的id class Email_str(BaseModel): diff --git a/schemas/jobs.py b/schemas/jobs.py index e7091e9..7c4ffd2 100644 --- a/schemas/jobs.py +++ b/schemas/jobs.py @@ -48,7 +48,8 @@ class Jobs(BaseModel): auto_repeater: bool = None # 是否自动转发 cacsi_count: int = None # 面试满意度反馈次数 state: bool = None # 职位招聘状态 - job_num: int = None # 招聘人数 + job_num: int = None # 目标招聘人数 + now_job_num: int = None # 实际招聘人数 education: str = None # 学历要求 job_rank: str = None # 职位级别 work_exp: str = None # 工作经验 @@ -59,7 +60,7 @@ class Jobs(BaseModel): class Ins_Job(BaseModel): - job_id: str = int(time.time()) # 职位的唯一id + job_id: str = str(int(time.time())) # 职位的唯一id job_name: str # 职位名称 job_sector: str # 职位部门 job_nature: str # 职位性质 @@ -74,7 +75,8 @@ class Ins_Job(BaseModel): auto_repeater: bool # 是否自动转发 cacsi_count: int = 0 # 面试满意度反馈次数 state: bool = True # 职位招聘状态 - job_num: int # 招聘人数 + job_num: int = None # 目标招聘人数 + now_job_num: int = None # 实际招聘人数 education: str # 学历要求 job_rank: str # 职位级别 work_exp: str # 工作经验 @@ -82,3 +84,6 @@ class Ins_Job(BaseModel): min_money: int # 薪资范围min max_money: int # 薪资范围max requirement: str # 需求描述 + + +