1.面试相关提醒
This commit is contained in:
parent
9eef1571bd
commit
df24abebf0
@ -683,6 +683,7 @@ async def event_edit(
|
||||
"""
|
||||
df = await ckdb.query_dataframe(find_sql)
|
||||
# 存份面试数据到mongodb
|
||||
now_time = str(datetime.now()).split('.')[0]
|
||||
await crud.interview_record.insert_record(db, schemas.interview_record(uid=df['uid'][0], # 唯一id
|
||||
name=df['name'][0], # 求职者姓名
|
||||
interview_name=df['interview_name'][0],
|
||||
@ -691,7 +692,10 @@ async def event_edit(
|
||||
star_time=df['star_time'][0], # 开始面试时间
|
||||
interview_sign=0, # 签到状态
|
||||
job_id=df['job_id'][0], # 我们自己招聘的职位id
|
||||
job_names=df['job_names'][0] # 我们自己招聘的职位名
|
||||
job_names=df['job_names'][0], # 我们自己招聘的职位名
|
||||
times=now_time, # 创建数据日期
|
||||
read_status=0, # 读取状态
|
||||
type='interview' # 记录的类型
|
||||
))
|
||||
if df['mail'][0] != '':
|
||||
# 发送邮件给面试者通知面试
|
||||
@ -798,10 +802,16 @@ async def event_edit(
|
||||
@router.get("/hint")
|
||||
async def edit_report(
|
||||
request: Request,
|
||||
data_in: schemas.Get_hr,
|
||||
db: AsyncIOMotorDatabase = Depends(get_database)
|
||||
) -> schemas.Msg:
|
||||
"""重要事项-面试相关"""
|
||||
# 邮件,反馈
|
||||
res = await crud.email_record.all_hint(db)
|
||||
# 面试记录
|
||||
interview = await crud.interview_record.all_fields(db, {'hr_name': data_in.hr_name})
|
||||
for i in interview:
|
||||
res.append(i)
|
||||
data = sorted(res, key=operator.itemgetter('times'))
|
||||
return schemas.Msg(code=200, msg='ok', data=data)
|
||||
|
||||
@ -814,5 +824,10 @@ async def event_edit(
|
||||
db: AsyncIOMotorDatabase = Depends(get_database)
|
||||
) -> schemas.Msg:
|
||||
"""批量修改已读状态"""
|
||||
await crud.email_record.up_hint(db, data_in)
|
||||
# 面试记录
|
||||
if data_in.type == 'interview':
|
||||
await crud.interview_record.up_interview(db,data_in)
|
||||
# 邮件,反馈
|
||||
else:
|
||||
await crud.email_record.up_hint(db, data_in)
|
||||
return schemas.Msg(code=200, msg='ok', data='')
|
||||
|
@ -1,3 +1,5 @@
|
||||
import uuid
|
||||
|
||||
from motor.motor_asyncio import AsyncIOMotorDatabase
|
||||
import schemas
|
||||
from crud.base import CRUDBase
|
||||
@ -8,13 +10,21 @@ __all__ = 'interview_record',
|
||||
class CRUDInterview(CRUDBase):
|
||||
# 获取所有面试数据
|
||||
async def all_field(self, db: AsyncIOMotorDatabase):
|
||||
return await self.find_many(db, {}, {'_id': 0})
|
||||
return await self.find_many(db, {})
|
||||
|
||||
# 获取对应job_id的名字,以及部门, 招聘数量
|
||||
async def find_job_some(self, db: AsyncIOMotorDatabase, hr_names):
|
||||
|
||||
return await self.find_many(db, {'hr_name': {"$in": hr_names}},
|
||||
{'_id': 0, 'job_names': 1, 'hr_name': 1, 'interview_sign': 1, 'job_id': 1})
|
||||
{'_id': 0, 'job_names': 1, 'hr_name': 1, 'interview_sign': 1, 'job_id': 1})
|
||||
|
||||
# 获取对应条件的数据
|
||||
async def all_fields(self, db: AsyncIOMotorDatabase, where):
|
||||
return await self.find_many(db, {where})
|
||||
|
||||
# 修改面试读取状态
|
||||
async def up_interview(self, db: AsyncIOMotorDatabase, data_in: schemas.Up_hint):
|
||||
await self.update_many(db, {'_id': {'$in': data_in.hint_id}}, {'$set': {'read_status': 1}})
|
||||
|
||||
# 获取所有对应条件面试数据
|
||||
# async def all_fields(self, db: AsyncIOMotorDatabase, data_in: schemas.Jobs):
|
||||
# if data_in == None:
|
||||
@ -37,8 +47,8 @@ class CRUDInterview(CRUDBase):
|
||||
|
||||
# 插入一条新的面试数据数据
|
||||
async def insert_record(self, db: AsyncIOMotorDatabase, data_in: schemas.interview_record):
|
||||
|
||||
await self.insert_one(db, data_in.dict())
|
||||
data_ins = schemas.interview_records(**data_in.dict(), _id=uuid.uuid1().hex)
|
||||
await self.insert_one(db, data_ins.dict(by_alias=True))
|
||||
|
||||
|
||||
interview_record = CRUDInterview('interview_record')
|
||||
|
@ -9,7 +9,7 @@ class email_record(BaseModel):
|
||||
text: str # 邮件的文本内容
|
||||
times: str # 发送邮件的时间
|
||||
state: int # 邮件是否发送成功
|
||||
read_status:int #是否已读
|
||||
read_status: int # 是否已读
|
||||
type: str
|
||||
|
||||
|
||||
@ -23,5 +23,5 @@ class email_records(DBBase):
|
||||
text: str # 邮件的文本内容
|
||||
times: str # 发送邮件的时间
|
||||
state: int # 邮件是否发送成功
|
||||
read_status:int #是否已读
|
||||
type: str
|
||||
read_status: int # 是否已读
|
||||
type: str # 消息类型
|
||||
|
@ -83,3 +83,7 @@ class Post_head(BaseModel):
|
||||
|
||||
class Up_hint(BaseModel):
|
||||
hint_id: List[str] # 要修改已读的数据id
|
||||
type: str
|
||||
|
||||
class Get_hr(BaseModel):
|
||||
hr_name: str
|
||||
|
@ -3,6 +3,8 @@ from typing import List, Union, Dict
|
||||
from pydantic import BaseModel
|
||||
from typing import Optional
|
||||
|
||||
from schemas import DBBase
|
||||
|
||||
|
||||
class interview_record(BaseModel):
|
||||
uid: str # 简历的唯一id
|
||||
@ -13,4 +15,22 @@ class interview_record(BaseModel):
|
||||
interview_sign: int # 是否签到
|
||||
job_id: str # 我们自己招聘的职位id
|
||||
job_names: str # 我们自己招聘的职位名
|
||||
create_date: datetime = datetime.now()
|
||||
times: str # 创建数据的时间
|
||||
read_status: int # 读取状态
|
||||
type: str # 记录的类型
|
||||
|
||||
|
||||
# ------------------------------------------------
|
||||
# 数据库模型
|
||||
class interview_records(DBBase):
|
||||
uid: str # 简历的唯一id
|
||||
name: str # 求职者名字
|
||||
interview_name: str # 面试官名字
|
||||
hr_name: str # 人事名字
|
||||
star_time: str # 面试开始时间
|
||||
interview_sign: int # 是否签到
|
||||
job_id: str # 我们自己招聘的职位id
|
||||
job_names: str # 我们自己招聘的职位名
|
||||
times: str # 创建记录的时间
|
||||
read_status: int # 读取状态
|
||||
type: str # 记录的类型
|
||||
|
Loading…
Reference in New Issue
Block a user