1.修改职位存储的逻辑
2.新增推荐记录 3.增删改推荐记录 4.嵌套提醒脚本
This commit is contained in:
parent
41c4c77a2c
commit
1cab86dcc1
@ -425,6 +425,9 @@ async def interview_update(
|
|||||||
res = await crud.user.get_users(db, userid_list)
|
res = await crud.user.get_users(db, userid_list)
|
||||||
unionid_list = [i['unionid'] for i in res]
|
unionid_list = [i['unionid'] for i in res]
|
||||||
Sample.create_task('淘汰通知', current_user.unionid, content, unionid_list) # 待办通知
|
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)
|
return schemas.Msg(code=200, msg='ok', data=data)
|
||||||
|
|
||||||
|
|
||||||
@ -2394,7 +2397,20 @@ async def send_interviewee(
|
|||||||
send = f"""【推荐通知】\n{current_user.nickname}给你推荐了一位面试者\n面试者姓名:{res[0]['name']}\n岗位:{res[0]['job_names']}"""
|
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) #工作通知
|
# 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)
|
department = ','.join(user_list)
|
||||||
up_sql = f"""ALTER TABLE HR.resumes update department = '{department}' where uid = '{data_in.uid}'"""
|
up_sql = f"""ALTER TABLE HR.resumes update department = '{department}' where uid = '{data_in.uid}'"""
|
||||||
print(up_sql)
|
print(up_sql)
|
||||||
|
@ -36,3 +36,4 @@ from .crud_basic_data import basic_data
|
|||||||
from .crud_section import section
|
from .crud_section import section
|
||||||
from .crud_feedback import feedback
|
from .crud_feedback import feedback
|
||||||
from .crud_find_column import api_find_column
|
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 .basic_data import *
|
||||||
from .section import *
|
from .section import *
|
||||||
from .feedback 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"}]
|
||||||
|
|
@ -44,7 +44,6 @@ class UserRestPassword(BaseModel):
|
|||||||
tel:str # 电话
|
tel:str # 电话
|
||||||
email: str # 邮箱
|
email: str # 邮箱
|
||||||
|
|
||||||
|
|
||||||
class UserRestMyPassword(BaseModel):
|
class UserRestMyPassword(BaseModel):
|
||||||
password: str = ...
|
password: str = ...
|
||||||
nickname:str # 用户名
|
nickname:str # 用户名
|
||||||
@ -75,10 +74,9 @@ class UserDB(DBBase):
|
|||||||
last_login_ts: str = '尚未登录'
|
last_login_ts: str = '尚未登录'
|
||||||
data_where: dict = dict()
|
data_where: dict = dict()
|
||||||
user_id: str # 钉钉id
|
user_id: str # 钉钉id
|
||||||
unionid: str # 钉钉unionid
|
unionid: str
|
||||||
rank: int # 区分hr和面试官
|
rank: int # 区分hr和面试官
|
||||||
|
|
||||||
|
|
||||||
class UserDBRW(DBBase):
|
class UserDBRW(DBBase):
|
||||||
hashed_password: str # 密码
|
hashed_password: str # 密码
|
||||||
unionid: str # 通过钉钉扫码获取的unionid
|
unionid: str # 通过钉钉扫码获取的unionid
|
||||||
|
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