1.修改职位存储的逻辑
2.新增推荐记录 3.增删改推荐记录 4.嵌套提醒脚本
This commit is contained in:
parent
41c4c77a2c
commit
1cab86dcc1
@ -422,9 +422,12 @@ async def interview_update(
|
||||
content = f"""【淘汰通知】\n姓名:{interview_id[0]['name']}\n求职岗位:{interview_id[0]['job_names']}\n淘汰原因:{why}\n具体淘汰原因:{interview.data_in.get('pass_text')}\n简历阶段:{interview_stage}\n操作人:{current_user.nickname}"""
|
||||
if current_user.name != 'root':
|
||||
# send_dates(content, userid_list)# 工作通知
|
||||
res=await crud.user.get_users(db,userid_list)
|
||||
unionid_list=[i['unionid'] for i in res]
|
||||
res = await crud.user.get_users(db, userid_list)
|
||||
unionid_list = [i['unionid'] for i in res]
|
||||
Sample.create_task('淘汰通知', current_user.unionid, content, unionid_list) # 待办通知
|
||||
if interview.data_in.get('hr_manner', 10) in [0, 1]:
|
||||
# 更新推荐记录
|
||||
await crud.department.update(db, {'types': True}, interview.where.get('uid'))
|
||||
return schemas.Msg(code=200, msg='ok', data=data)
|
||||
|
||||
|
||||
@ -1219,13 +1222,13 @@ async def get_job(
|
||||
ress = await crud.jobs.all_fields(db, schemas.Jobs(state=True))
|
||||
nums = len(ress)
|
||||
job = []
|
||||
job_list=[i['job_id'] for i in res]
|
||||
job_list = [i['job_id'] for i in res]
|
||||
sql1 = f"""
|
||||
select job_id,count(*) as nu from HR.resumes where job_id in {job_list} and interview_stage < 6 group by job_id
|
||||
"""
|
||||
#获取各个职位的候选人总数
|
||||
# 获取各个职位的候选人总数
|
||||
df = await ckdb.query_dataframe(sql1)
|
||||
job_dict=dict(zip(df['job_id'],df['nu']))
|
||||
job_dict = dict(zip(df['job_id'], df['nu']))
|
||||
for i in res:
|
||||
job_list = {}
|
||||
job_list['key'] = i['job_id'] # 职位id
|
||||
@ -1234,7 +1237,7 @@ async def get_job(
|
||||
job_list['job_sector'] = i['job_sector'] # 部门
|
||||
job_list['job_num'] = i['job_num'] # 目标招聘人数
|
||||
job_list['now_job_num'] = i['now_job_num'] # 对应职位的入职人数
|
||||
job_list['hou_num'] = job_dict.get(i['job_id'],0) # 候选人总数
|
||||
job_list['hou_num'] = job_dict.get(i['job_id'], 0) # 候选人总数
|
||||
job_list['creat_time'] = i['creat_time'] # 创建职位的时间
|
||||
job.append(job_list)
|
||||
# 按创建职位的最新时间排序
|
||||
@ -1539,10 +1542,10 @@ async def teacher_state(
|
||||
now_time = str(datetime.now()).split('.')[0]
|
||||
if current_user.name != 'root':
|
||||
content = f"【催促反馈】\n请面试官尽快给{data_in.name}做面试反馈\n提醒时间:{now_time}"
|
||||
#send_dates(content, data_in.user_id)#工作通知
|
||||
res=await crud.user.get_users(db,data_in.user_id)
|
||||
unionid_list=[i['unionid'] for i in res]
|
||||
Sample.create_task('催促反馈',current_user.unionid,content,unionid_list) # 待办通知
|
||||
# send_dates(content, data_in.user_id)#工作通知
|
||||
res = await crud.user.get_users(db, data_in.user_id)
|
||||
unionid_list = [i['unionid'] for i in res]
|
||||
Sample.create_task('催促反馈', current_user.unionid, content, unionid_list) # 待办通知
|
||||
return schemas.Msg(code=200, msg='发送成功', data='')
|
||||
except Exception:
|
||||
return schemas.Msg(code=-9, msg='发送失败', data='')
|
||||
@ -1951,17 +1954,17 @@ async def login(
|
||||
'email': user.email, # 邮箱
|
||||
'tel': user.tel, # 电话
|
||||
'user_id': user.user_id, # 钉钉id
|
||||
'unionid':user.unionid, #钉钉unionid
|
||||
'unionid': user.unionid, # 钉钉unionid
|
||||
'id': user.id, # 账号的唯一标识
|
||||
'rank': user.rank, # 区分hr和面试官
|
||||
'nickname': user.nickname, # 显示名
|
||||
'token': security.create_access_token(
|
||||
expires_delta=access_token_expires, user_id=user.user_id, email=user.email,
|
||||
tel=user.tel, name=user.name, rank=user.rank,unionid=user.unionid),
|
||||
tel=user.tel, name=user.name, rank=user.rank, unionid=user.unionid),
|
||||
"token_type": "bearer"},
|
||||
'access_token': security.create_access_token(
|
||||
expires_delta=access_token_expires, user_id=user.user_id, email=user.email,
|
||||
tel=user.tel, name=user.name, rank=user.rank,unionid=user.unionid
|
||||
tel=user.tel, name=user.name, rank=user.rank, unionid=user.unionid
|
||||
),
|
||||
"token_type": "bearer",
|
||||
'code': 200,
|
||||
@ -2392,9 +2395,22 @@ async def send_interviewee(
|
||||
user_list = [i['user_id'] for i in user['hr_name']]
|
||||
if current_user.name != 'root':
|
||||
send = f"""【推荐通知】\n{current_user.nickname}给你推荐了一位面试者\n面试者姓名:{res[0]['name']}\n岗位:{res[0]['job_names']}"""
|
||||
unionid_list=[i['unionid'] for i in user['hr_name']]
|
||||
unionid_list = [i['unionid'] for i in user['hr_name']]
|
||||
# send_dates(send, user_list) #工作通知
|
||||
Sample.create_task('推荐通知', current_user.unionid, send, unionid_list) # 待办通知
|
||||
# Sample.create_task('推荐通知', current_user.unionid, send, unionid_list) # 待办通知
|
||||
# 存一份推荐,如到一定时间没有处理推荐,则返回通知推荐人处理
|
||||
datas = {'uid': data_in.uid, 'name': res[0]['name'], 'job_name': res[0]['job_names'],
|
||||
'hr_name': user['hr_name'],
|
||||
'referrer_name': current_user.nickname, 'referrer_id': current_user.unionid, 'types': False,
|
||||
'create': str(datetime.now()).split('.')[0]}
|
||||
# 先查有没有推荐记录
|
||||
res = await crud.department.where_dep(db, {'uid': data_in.uid})
|
||||
if res == []: # 没有则创建
|
||||
await crud.department.create(db, datas)
|
||||
else: # 有就更新
|
||||
datas.pop('uid')
|
||||
await crud.department.update(db, datas, data_in.uid)
|
||||
|
||||
department = ','.join(user_list)
|
||||
up_sql = f"""ALTER TABLE HR.resumes update department = '{department}' where uid = '{data_in.uid}'"""
|
||||
print(up_sql)
|
||||
@ -2435,8 +2451,8 @@ async def add_interviewee(
|
||||
hr_user.extend(data_in.user_id)
|
||||
if current_user.name != 'root':
|
||||
# send_dates(send, hr_user)#工作通知
|
||||
res=await crud.user.get_users(db,hr_user)
|
||||
unionid_list=[i['unionid'] for i in res]
|
||||
res = await crud.user.get_users(db, hr_user)
|
||||
unionid_list = [i['unionid'] for i in res]
|
||||
Sample.create_task('面试通知', current_user.unionid, send, unionid_list) # 待办通知
|
||||
find_sql = f"""
|
||||
select uid,name,interview_name,hr_name,star_time,interview_sign,interview_id,job_id,job_names,mail from HR.resumes where uid = '{data_in.uid}'
|
||||
|
@ -36,3 +36,4 @@ from .crud_basic_data import basic_data
|
||||
from .crud_section import section
|
||||
from .crud_feedback import feedback
|
||||
from .crud_find_column import api_find_column
|
||||
from .crud_department import department
|
||||
|
28
crud/crud_department.py
Normal file
28
crud/crud_department.py
Normal file
@ -0,0 +1,28 @@
|
||||
from motor.motor_asyncio import AsyncIOMotorDatabase
|
||||
import schemas
|
||||
from crud.base import CRUDBase
|
||||
|
||||
__all__ = 'department',
|
||||
|
||||
from utils import get_uid
|
||||
|
||||
|
||||
class CRUDProjectNumber(CRUDBase):
|
||||
# 获取所有数据
|
||||
async def all_dep(self, db: AsyncIOMotorDatabase):
|
||||
return await self.find_many(db, {})
|
||||
|
||||
# 获取对应条件数据
|
||||
async def where_dep(self, db: AsyncIOMotorDatabase, where):
|
||||
return await self.find_many(db, where,{'_id':0})
|
||||
|
||||
# 修改数据
|
||||
async def update(self, db: AsyncIOMotorDatabase, up,where):
|
||||
await self.update_one(db, {'uid': where}, {'$set': up})
|
||||
|
||||
# 插入数据
|
||||
async def create(self, db: AsyncIOMotorDatabase, data_in: dict):
|
||||
return await self.insert_one(db, data_in)
|
||||
|
||||
|
||||
department = CRUDProjectNumber('department')
|
@ -41,3 +41,4 @@ from .count_in_worker import *
|
||||
from .basic_data import *
|
||||
from .section import *
|
||||
from .feedback import *
|
||||
from .department import *
|
||||
|
17
schemas/department.py
Normal file
17
schemas/department.py
Normal file
@ -0,0 +1,17 @@
|
||||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel
|
||||
from typing import List
|
||||
|
||||
|
||||
class Department(BaseModel):
|
||||
uid: str # 求职者id
|
||||
name: str # 求职者姓名
|
||||
job_name: str # 应聘职位
|
||||
hr_name: list # 推荐给谁-用人经理
|
||||
referrer_name: str # 推荐人
|
||||
referrer_id: str # 推荐人unionid
|
||||
types: bool = False # 推荐人是否已处理
|
||||
create: str = str(datetime.now()).split('.')[0] # 创建时间
|
||||
# 'hr_name': [{"_id": "3af3ac42bf13fd","nickname": "张三","user_id": "16371426094531014","unionid": "wWR9K0iPGyzy1SGIO78fBUgiEiE"}]
|
||||
|
@ -40,15 +40,14 @@ class UserLogin(BaseModel):
|
||||
class UserRestPassword(BaseModel):
|
||||
user_id: str = ...
|
||||
password: str = ...
|
||||
nickname: str # 用户名
|
||||
tel: str # 电话
|
||||
nickname:str # 用户名
|
||||
tel:str # 电话
|
||||
email: str # 邮箱
|
||||
|
||||
|
||||
class UserRestMyPassword(BaseModel):
|
||||
password: str = ...
|
||||
nickname: str # 用户名
|
||||
tel: str # 电话
|
||||
nickname:str # 用户名
|
||||
tel:str # 电话
|
||||
email: str # 邮箱
|
||||
|
||||
|
||||
@ -59,7 +58,7 @@ class UserCreate(UserBase):
|
||||
rank: int # 判断是hr还是面试官
|
||||
email: str # 邮箱
|
||||
tel: str # 手机号
|
||||
user_id: str # 钉钉的用户id
|
||||
user_id: str # 钉钉的用户id
|
||||
|
||||
|
||||
# ****************************************************************************
|
||||
@ -67,18 +66,17 @@ class UserCreate(UserBase):
|
||||
|
||||
|
||||
class UserDB(DBBase):
|
||||
# email: EmailStr = None # 邮箱
|
||||
#email: EmailStr = None # 邮箱
|
||||
is_superuser: bool = False
|
||||
name: str # 姓名
|
||||
name: str # 姓名
|
||||
nickname: str = ''
|
||||
tel: Any = ''
|
||||
last_login_ts: str = '尚未登录'
|
||||
data_where: dict = dict()
|
||||
user_id: str # 钉钉id
|
||||
unionid: str # 钉钉unionid
|
||||
unionid: str
|
||||
rank: int # 区分hr和面试官
|
||||
|
||||
|
||||
class UserDBRW(DBBase):
|
||||
hashed_password: str # 密码
|
||||
unionid: str # 通过钉钉扫码获取的unionid
|
||||
@ -90,4 +88,4 @@ class UserDBRW(DBBase):
|
||||
last_login_ts: str = '尚未登录' # 登录时间
|
||||
create_date: datetime = datetime.now() # 创建账号的时间
|
||||
state: int = 0 # 默认刚创账号是不锁定的
|
||||
user_id: str # 钉钉里面的用户id
|
||||
user_id:str # 钉钉里面的用户id
|
||||
|
0
script/__init__.py
Normal file
0
script/__init__.py
Normal file
32
script/send_interviewee.py
Normal file
32
script/send_interviewee.py
Normal file
@ -0,0 +1,32 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def send_interviewee():
|
||||
|
||||
...
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
12
script/settings.py
Normal file
12
script/settings.py
Normal file
@ -0,0 +1,12 @@
|
||||
import pymongo
|
||||
from clickhouse_driver import Client
|
||||
|
||||
# 线上
|
||||
ckdb = Client(host='139.159.159.3', port='9654', user='legu', password='gncPASUwpYrc')
|
||||
|
||||
mdb = pymongo.MongoClient(host='139.159.159.3', port=27017, username='root', password='iamciniao')
|
||||
db = mdb['hr_system']
|
||||
mdb = db.userinfo
|
||||
# 本地
|
||||
# ckdb = Client(host='139.159.159.3', port='9654', user='legu', password='gncPASUwpYrc')
|
||||
# mdb = pymongo.MongoClient(host='10.0.0.240', port=27017)
|
Loading…
Reference in New Issue
Block a user