导入候选人
This commit is contained in:
parent
c6fd194614
commit
e1c82b1858
@ -99,6 +99,33 @@ async def interview_insert(
|
||||
except:
|
||||
return schemas.Msg(code=400, msg='上传文件有误', data=None)
|
||||
data = get_resume(filename, path_data)
|
||||
education = data['education']
|
||||
# 学历int转化
|
||||
education_int = {
|
||||
'大专': 1,
|
||||
'本科': 2,
|
||||
'研究生': 3,
|
||||
'博士': 4,
|
||||
'硕士': 5,
|
||||
}
|
||||
if education and isinstance(education, str):
|
||||
data['education'] = education_int.get(education, 1)
|
||||
age = data['age']
|
||||
# 年龄int转化
|
||||
if age and isinstance(age, str):
|
||||
true_age = re.search(r"\d+\.?\d*", age)
|
||||
if len(true_age.group()) > 2:
|
||||
data['age'] = 20
|
||||
else:
|
||||
data['age'] = int(true_age.group())
|
||||
work_exp = data['work_exp']
|
||||
# 工作经验float转化
|
||||
if work_exp and isinstance(work_exp, str):
|
||||
true_work_exp = re.search(r"\d+\.?\d*", work_exp)
|
||||
if len(true_work_exp.group()) > 3:
|
||||
data['work_exp'] = 1.0
|
||||
else:
|
||||
data['work_exp'] = float(true_work_exp.group())
|
||||
print(data)
|
||||
return schemas.Msg(code=200, msg='ok', data=data)
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import re
|
||||
from typing import Tuple
|
||||
|
||||
import datetime
|
||||
import arrow
|
||||
import sqlalchemy as sa
|
||||
import json
|
||||
@ -9,7 +9,7 @@ from fastapi import Depends
|
||||
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
|
||||
from utils.func import get_uid
|
||||
from sqlalchemy import func, or_, and_, not_
|
||||
from copy import deepcopy
|
||||
import crud
|
||||
@ -44,20 +44,57 @@ class InterviewDo:
|
||||
insert_data = self.data_in
|
||||
|
||||
sql = f"insert into HR.resumes(interview_name, interview_type, interview_sign, feedback, interview_round, star_time, end_time, event_time, uid, name, phone, job_name, hr_name, work_exp, interview_stage, owner_name, education, work_undergo, project_undergo, work_list, school, at_school, specialty, specialty_do, mmended_state, mail, account, id_card, gender, age, gam, interview_state, graduate_time, counts, nation, come_time, review, upgrade) values"
|
||||
now_time = datetime.datetime.now()
|
||||
for data in insert_data:
|
||||
s1 = data['star_time']
|
||||
s2 = data['end_time']
|
||||
s3 = data['event_time']
|
||||
s4 = data['graduate_time']
|
||||
if s1:
|
||||
if not s1:
|
||||
data['star_time'] = None
|
||||
else:
|
||||
data['star_time'] = parser.parse(s1)
|
||||
if s2:
|
||||
if not s2:
|
||||
data['end_time'] = None
|
||||
else:
|
||||
data['end_time'] = parser.parse(s2)
|
||||
if s3:
|
||||
if not s3:
|
||||
data['event_time'] = now_time
|
||||
else:
|
||||
data['event_time'] = parser.parse(s3)
|
||||
if s4:
|
||||
if not s4:
|
||||
data['graduate_time'] = None
|
||||
else:
|
||||
data['graduate_time'] = parser.parse(s4)
|
||||
data_true = deepcopy(data)
|
||||
data_true['uid'] = get_uid()
|
||||
education = data_true['education']
|
||||
# 学历int转化
|
||||
education_int = {
|
||||
'大专': 1,
|
||||
'本科': 2,
|
||||
'研究生': 3,
|
||||
'博士': 4,
|
||||
'硕士': 5,
|
||||
}
|
||||
if education and isinstance(education, str):
|
||||
data_true['education'] = education_int.get(education, 1)
|
||||
age = data_true['age']
|
||||
# 年龄int转化
|
||||
if age and isinstance(age, str):
|
||||
true_age = re.search(r"\d+\.?\d*", age)
|
||||
if len(true_age.group()) > 2:
|
||||
data_true['age'] = 20
|
||||
else:
|
||||
data_true['age'] = int(true_age.group())
|
||||
work_exp = data_true['work_exp']
|
||||
# 工作经验float转化
|
||||
if work_exp and isinstance(work_exp, str):
|
||||
true_work_exp = re.search(r"\d+\.?\d*", work_exp)
|
||||
if len(true_work_exp.group()) > 3:
|
||||
data_true['work_exp'] = 1.0
|
||||
else:
|
||||
data_true['work_exp'] = float(true_work_exp.group())
|
||||
res_data.append(data_true)
|
||||
print(sql)
|
||||
return {'sql': sql,
|
||||
@ -102,3 +139,7 @@ class InterviewDo:
|
||||
print(sql)
|
||||
return {'sql': sql,
|
||||
}
|
||||
|
||||
if __name__ == '__main__':
|
||||
find = re.search(r"\d+\.?\d*", "18岁")
|
||||
print(len(find.group()))
|
@ -20,7 +20,7 @@ schema_dict = {'姓名': 'name', '所在地': 'account', '户口所在地': 'acc
|
||||
|
||||
# 简历初始文档
|
||||
data_mode = {
|
||||
"interview_name": "",
|
||||
"interview_name": "吴操",
|
||||
"interview_type": 1,
|
||||
"interview_sign": 0,
|
||||
"hope_money": 10000,
|
||||
@ -32,8 +32,8 @@ data_mode = {
|
||||
"name": "",
|
||||
"phone": "",
|
||||
"job_name": "",
|
||||
"hr_name": "",
|
||||
"work_exp": "",
|
||||
"hr_name": "吴操",
|
||||
"work_exp": 0.0,
|
||||
"interview_stage": 1,
|
||||
"owner_name": 2,
|
||||
"education": 1,
|
||||
@ -49,7 +49,7 @@ data_mode = {
|
||||
"account": "",
|
||||
"id_card": "",
|
||||
"gender": "",
|
||||
"age": "",
|
||||
"age": 0,
|
||||
"gam": "",
|
||||
"interview_state": 1,
|
||||
"graduate_time": "",
|
||||
|
Loading…
Reference in New Issue
Block a user