正则解析
This commit is contained in:
parent
3df5e9bc66
commit
f3bb2af5f8
@ -236,10 +236,10 @@ async def interview_update(
|
|||||||
await interview.init()
|
await interview.init()
|
||||||
res = interview.update_interview_sql()
|
res = interview.update_interview_sql()
|
||||||
sql = res['sql']
|
sql = res['sql']
|
||||||
try:
|
# try:
|
||||||
data = await db.execute(sql)
|
data = await db.execute(sql)
|
||||||
except:
|
# except:
|
||||||
return schemas.Msg(code=-9, msg='数据有误', data=None)
|
# return schemas.Msg(code=-9, msg='数据有误', data=None)
|
||||||
return schemas.Msg(code=200, msg='ok', data=data)
|
return schemas.Msg(code=200, msg='ok', data=data)
|
||||||
|
|
||||||
|
|
||||||
@ -310,8 +310,8 @@ async def file_to_hw(
|
|||||||
"owner_name": 2,
|
"owner_name": 2,
|
||||||
"education": 1,
|
"education": 1,
|
||||||
"work_undergo": [],
|
"work_undergo": [],
|
||||||
"project_undergo": [],
|
"project_undergo": "",
|
||||||
"work_list": [],
|
"work_list": "",
|
||||||
"school": "",
|
"school": "",
|
||||||
"at_school": "",
|
"at_school": "",
|
||||||
"specialty": "",
|
"specialty": "",
|
||||||
@ -326,7 +326,7 @@ async def file_to_hw(
|
|||||||
"interview_state": 1,
|
"interview_state": 1,
|
||||||
"counts": 1,
|
"counts": 1,
|
||||||
"nation": "汉",
|
"nation": "汉",
|
||||||
"review": [],
|
"review": "",
|
||||||
"upgrade": [],
|
"upgrade": [],
|
||||||
"come_time": "",
|
"come_time": "",
|
||||||
"now_money": "",
|
"now_money": "",
|
||||||
@ -339,6 +339,8 @@ async def file_to_hw(
|
|||||||
"pass_why": 0,
|
"pass_why": 0,
|
||||||
"pass_text": "",
|
"pass_text": "",
|
||||||
"now_address": "",
|
"now_address": "",
|
||||||
|
"language": "",
|
||||||
|
"remembrance": "",
|
||||||
"file_url": url,
|
"file_url": url,
|
||||||
}
|
}
|
||||||
uid = get_uid()
|
uid = get_uid()
|
||||||
@ -348,7 +350,7 @@ async def file_to_hw(
|
|||||||
f" education, work_undergo, project_undergo, work_list, school, at_school, specialty, specialty_do, " \
|
f" education, work_undergo, project_undergo, work_list, school, at_school, specialty, specialty_do, " \
|
||||||
f"mmended_state, mail, account, id_card, gender, age, gam, interview_state, counts, nation, come_time," \
|
f"mmended_state, mail, account, id_card, gender, age, gam, interview_state, counts, nation, come_time," \
|
||||||
f" review, upgrade, now_money, men_state, teacher_state, teacher_back, offer_state, offer_exam_state," \
|
f" review, upgrade, now_money, men_state, teacher_state, teacher_back, offer_state, offer_exam_state," \
|
||||||
f" notice_state, pass_why, pass_text, now_address, file_url) values"
|
f" notice_state, pass_why, pass_text, now_address,language,remembrance, file_url) values"
|
||||||
# 存数据
|
# 存数据
|
||||||
await db.execute_dict(sql, [data_mode])
|
await db.execute_dict(sql, [data_mode])
|
||||||
resData = {'file_url': url, 'filename': 'hrms/' + filename, 'uid': uid}
|
resData = {'file_url': url, 'filename': 'hrms/' + filename, 'uid': uid}
|
||||||
@ -467,37 +469,25 @@ async def interview_file_insert(
|
|||||||
language = data['language']
|
language = data['language']
|
||||||
project_undergo = data['project_undergo']
|
project_undergo = data['project_undergo']
|
||||||
remembrance = data['remembrance']
|
remembrance = data['remembrance']
|
||||||
true_work = []
|
# true_work = []
|
||||||
language_list = []
|
# language_list = []
|
||||||
remembrance_list = []
|
# remembrance_list = []
|
||||||
true_upgrade = []
|
# true_upgrade = []
|
||||||
if work_list:
|
# if work_list:
|
||||||
for d_str in work_list:
|
# true_work = json.loads(work_list)
|
||||||
data1 = eval(d_str)
|
# if language:
|
||||||
dict_data = deepcopy(data1)
|
# language_list = json.loads(language)
|
||||||
true_work.append(dict_data)
|
# if project_undergo:
|
||||||
if language:
|
# true_upgrade = json.loads(project_undergo)
|
||||||
for d_str2 in language:
|
# if remembrance:
|
||||||
data2 = eval(d_str2)
|
# remembrance_list = json.loads(remembrance)
|
||||||
dict_data2 = deepcopy(data2)
|
|
||||||
language_list.append(dict_data2)
|
|
||||||
if project_undergo:
|
|
||||||
for d_str3 in project_undergo:
|
|
||||||
data3 = eval(d_str3)
|
|
||||||
dict_data3 = deepcopy(data3)
|
|
||||||
true_upgrade.append(dict_data3)
|
|
||||||
if remembrance:
|
|
||||||
for d_str4 in remembrance:
|
|
||||||
data4 = eval(d_str4)
|
|
||||||
dict_data4 = deepcopy(data4)
|
|
||||||
remembrance_list.append(dict_data4)
|
|
||||||
|
|
||||||
res_data = {
|
res_data = {
|
||||||
'data': data,
|
'data': data,
|
||||||
'project_undergo': true_upgrade,
|
'project_undergo': project_undergo,
|
||||||
'work_list': true_work,
|
'work_list': work_list,
|
||||||
'language_list': language_list,
|
'language_list': language,
|
||||||
'remembrance_list': remembrance_list
|
'remembrance_list': remembrance
|
||||||
}
|
}
|
||||||
|
|
||||||
return schemas.Msg(code=200, msg='ok', data=res_data)
|
return schemas.Msg(code=200, msg='ok', data=res_data)
|
||||||
|
@ -188,14 +188,83 @@ class InterviewDo:
|
|||||||
def update_interview_sql(self):
|
def update_interview_sql(self):
|
||||||
updateStr = ''
|
updateStr = ''
|
||||||
whereStr = ''
|
whereStr = ''
|
||||||
|
|
||||||
|
# 转json字符串
|
||||||
|
self.data_in.pop('remembrance_list')
|
||||||
|
self.data_in.pop('language_list')
|
||||||
|
if self.data_in['project_undergo']:
|
||||||
|
self.data_in['project_undergo'] = json.dumps(self.data_in['project_undergo'])
|
||||||
|
else:
|
||||||
|
self.data_in['project_undergo'] = ''
|
||||||
|
if self.data_in['work_list']:
|
||||||
|
self.data_in['work_list'] = json.dumps(self.data_in['work_list'])
|
||||||
|
else:
|
||||||
|
self.data_in['work_list'] = ''
|
||||||
|
if self.data_in['language']:
|
||||||
|
self.data_in['language'] = json.dumps(self.data_in['language'])
|
||||||
|
else:
|
||||||
|
self.data_in['language'] = ''
|
||||||
|
if self.data_in['remembrance']:
|
||||||
|
self.data_in['remembrance'] = json.dumps(self.data_in['remembrance'])
|
||||||
|
else:
|
||||||
|
self.data_in['remembrance'] = ''
|
||||||
|
|
||||||
|
# # 字符串转datetime
|
||||||
|
# if self.data_in.get('in_time', ''):
|
||||||
|
# chk_in_time = self.data_in['in_time'].replace('-', '/').replace('.', '/')
|
||||||
|
# if len(chk_in_time.split('/')) == 2:
|
||||||
|
# self.data_in['in_time'] = datetime.datetime.strptime(chk_in_time, "%Y/%m").date()
|
||||||
|
# if len(chk_in_time.split('/')) == 3:
|
||||||
|
# self.data_in['in_time'] = datetime.datetime.strptime(chk_in_time, "%Y/%m/%d").date()
|
||||||
|
#
|
||||||
|
# if self.data_in.get('out_time', ''):
|
||||||
|
# chk_out_time = self.data_in['out_time'].replace('-', '/').replace('.', '/')
|
||||||
|
# if len(chk_out_time.split('/')) == 2:
|
||||||
|
# self.data_in['out_time'] = datetime.datetime.strptime(chk_out_time, "%Y/%m").date()
|
||||||
|
# if len(chk_out_time.split('/')) == 3:
|
||||||
|
# self.data_in['out_time'] = datetime.datetime.strptime(chk_out_time, "%Y/%m/%d").date()
|
||||||
|
#
|
||||||
|
# if self.data_in.get('birthday', ''):
|
||||||
|
# chk_birthday = self.data_in['birthday'].replace('-', '/').replace('.', '/')
|
||||||
|
# if len(chk_birthday.split('/')) == 2:
|
||||||
|
# self.data_in['birthday'] = datetime.datetime.strptime(chk_birthday, "%Y/%m").date()
|
||||||
|
# if len(chk_birthday.split('/')) == 3:
|
||||||
|
# self.data_in['birthday'] = datetime.datetime.strptime(chk_birthday, "%Y/%m/%d").date()
|
||||||
|
#
|
||||||
|
# if self.data_in.get('star_time', ''):
|
||||||
|
# chk_star_time = self.data_in['star_time'].replace('-', '/').replace('.', '/')
|
||||||
|
# if len(chk_star_time.split('/')) == 2:
|
||||||
|
# self.data_in['star_time'] = datetime.datetime.strptime(chk_star_time, "%Y/%m").date()
|
||||||
|
# if len(chk_star_time.split('/')) == 3:
|
||||||
|
# self.data_in['star_time'] = datetime.datetime.strptime(chk_star_time, "%Y/%m/%d").date()
|
||||||
|
#
|
||||||
|
# if self.data_in.get('end_time', ''):
|
||||||
|
# chk_end_time = self.data_in['end_time'].replace('-', '/').replace('.', '/')
|
||||||
|
# if len(chk_end_time.split('/')) == 2:
|
||||||
|
# self.data_in['end_time'] = datetime.datetime.strptime(chk_end_time, "%Y/%m").date()
|
||||||
|
# if len(chk_end_time.split('/')) == 3:
|
||||||
|
# self.data_in['end_time'] = datetime.datetime.strptime(chk_end_time, "%Y/%m/%d").date()
|
||||||
|
#
|
||||||
|
# if self.data_in.get('graduate_time', ''):
|
||||||
|
# chk_graduate = self.data_in['graduate_time'].replace('-', '/').replace('.', '/')
|
||||||
|
# if len(chk_graduate.split('/')) == 2:
|
||||||
|
# self.data_in['graduate_time'] = datetime.datetime.strptime(chk_graduate, "%Y/%m").date()
|
||||||
|
# if len(chk_graduate.split('/')) == 3:
|
||||||
|
# self.data_in['graduate_time'] = datetime.datetime.strptime(chk_graduate, "%Y/%m/%d").date()
|
||||||
|
|
||||||
for key, value in self.data_in.items():
|
for key, value in self.data_in.items():
|
||||||
|
if key == 'uid':
|
||||||
|
continue
|
||||||
if updateStr:
|
if updateStr:
|
||||||
updateStr += ','
|
updateStr += ','
|
||||||
if isinstance(value, str):
|
if isinstance(value, str):
|
||||||
updateStr += str(key) + ' = ' + "'" + value + "'" + ' '
|
updateStr += str(key) + ' = ' + "'" + value + "'" + ' '
|
||||||
continue
|
continue
|
||||||
updateStr += str(key) + ' = ' + str(value) + ' '
|
updateStr += str(key) + ' = ' + str(value) + ' '
|
||||||
|
if 'uid' in self.data_in:
|
||||||
|
self.where.update({
|
||||||
|
'uid': self.data_in['uid']
|
||||||
|
})
|
||||||
for key, value in self.where.items():
|
for key, value in self.where.items():
|
||||||
if isinstance(value, str):
|
if isinstance(value, str):
|
||||||
whereStr += str(key) + ' = ' + "'" + value + "'" + ' '
|
whereStr += str(key) + ' = ' + "'" + value + "'" + ' '
|
||||||
|
@ -44,7 +44,6 @@ def fmt_txt(chk_str):
|
|||||||
"hope_money": "",
|
"hope_money": "",
|
||||||
"feedback": 0,
|
"feedback": 0,
|
||||||
"interview_round": 0,
|
"interview_round": 0,
|
||||||
"event_time": "",
|
|
||||||
"name": "",
|
"name": "",
|
||||||
"phone": "",
|
"phone": "",
|
||||||
"job_name": "",
|
"job_name": "",
|
||||||
@ -70,7 +69,7 @@ def fmt_txt(chk_str):
|
|||||||
"interview_state": 1,
|
"interview_state": 1,
|
||||||
"counts": 1,
|
"counts": 1,
|
||||||
"nation": "汉",
|
"nation": "汉",
|
||||||
"review": [],
|
"review": "",
|
||||||
"upgrade": [],
|
"upgrade": [],
|
||||||
"come_time": "",
|
"come_time": "",
|
||||||
"now_money": "",
|
"now_money": "",
|
||||||
@ -372,7 +371,7 @@ def fmt_txt(chk_str):
|
|||||||
if '职责' in p_str_true:
|
if '职责' in p_str_true:
|
||||||
dict_project['duty'] += re.split('[:|:]', p_str_true)[-1]
|
dict_project['duty'] += re.split('[:|:]', p_str_true)[-1]
|
||||||
continue
|
continue
|
||||||
project_undergo_list.append(str(dict_project))
|
project_undergo_list.append(dict_project)
|
||||||
# 项目名开头
|
# 项目名开头
|
||||||
else:
|
else:
|
||||||
if project_undergo2.startswith(':') or project_undergo2.startswith(':'):
|
if project_undergo2.startswith(':') or project_undergo2.startswith(':'):
|
||||||
@ -400,7 +399,6 @@ def fmt_txt(chk_str):
|
|||||||
project_chk_str2_list = re.split('(:|:)', project_chk_str2)
|
project_chk_str2_list = re.split('(:|:)', project_chk_str2)
|
||||||
if project_chk_str2_list:
|
if project_chk_str2_list:
|
||||||
index3 = -1
|
index3 = -1
|
||||||
start_name = ''
|
|
||||||
new_p_chk_list = []
|
new_p_chk_list = []
|
||||||
for index, p_str3 in enumerate(project_chk_str2_list):
|
for index, p_str3 in enumerate(project_chk_str2_list):
|
||||||
if index <= index3:
|
if index <= index3:
|
||||||
@ -429,7 +427,7 @@ def fmt_txt(chk_str):
|
|||||||
if '职责' in p_str_true:
|
if '职责' in p_str_true:
|
||||||
dict_project['duty'] += re.split('[:|:]', p_str_true)[-1]
|
dict_project['duty'] += re.split('[:|:]', p_str_true)[-1]
|
||||||
continue
|
continue
|
||||||
project_undergo_list.append(str(dict_project))
|
project_undergo_list.append(dict_project)
|
||||||
else:
|
else:
|
||||||
index2 = -1
|
index2 = -1
|
||||||
name2 = ''
|
name2 = ''
|
||||||
@ -522,7 +520,7 @@ def fmt_txt(chk_str):
|
|||||||
if '职责' in p_str_true:
|
if '职责' in p_str_true:
|
||||||
dict_project['duty'] += re.split('[:|:]', p_str_true)[-1]
|
dict_project['duty'] += re.split('[:|:]', p_str_true)[-1]
|
||||||
continue
|
continue
|
||||||
project_undergo_list.append(str(dict_project))
|
project_undergo_list.append(dict_project)
|
||||||
dict_chk['project_undergo'] = project_undergo_list
|
dict_chk['project_undergo'] = project_undergo_list
|
||||||
|
|
||||||
# 数字开头
|
# 数字开头
|
||||||
@ -563,7 +561,7 @@ def fmt_txt(chk_str):
|
|||||||
work_dict['time'] = new_str_list2[0].split(' ')[0].replace('.', '/')
|
work_dict['time'] = new_str_list2[0].split(' ')[0].replace('.', '/')
|
||||||
work_dict['company_name'] = new_str_list2[0].split(' ')[1]
|
work_dict['company_name'] = new_str_list2[0].split(' ')[1]
|
||||||
work_dict['position_name'] = new_str_list2[1].split('|')[0]
|
work_dict['position_name'] = new_str_list2[1].split('|')[0]
|
||||||
work_list.append(str(work_dict))
|
work_list.append(work_dict)
|
||||||
# 公司名开头
|
# 公司名开头
|
||||||
else:
|
else:
|
||||||
index1 = -1
|
index1 = -1
|
||||||
@ -621,7 +619,7 @@ def fmt_txt(chk_str):
|
|||||||
duty1 = new_str_list1[2].split('职责')[-1]
|
duty1 = new_str_list1[2].split('职责')[-1]
|
||||||
duty = duty1.join((str(x) for x in work_duty))
|
duty = duty1.join((str(x) for x in work_duty))
|
||||||
work_dict['duty'] = duty
|
work_dict['duty'] = duty
|
||||||
work_list.append(str(work_dict))
|
work_list.append(work_dict)
|
||||||
dict_chk['work_list'] = work_list
|
dict_chk['work_list'] = work_list
|
||||||
review = ''
|
review = ''
|
||||||
upgrade = true_chkStr.split('教育经历')[-1]
|
upgrade = true_chkStr.split('教育经历')[-1]
|
||||||
@ -662,32 +660,31 @@ def fmt_txt(chk_str):
|
|||||||
for i in remembrance_list_str.split('\n'):
|
for i in remembrance_list_str.split('\n'):
|
||||||
if '??' in i:
|
if '??' in i:
|
||||||
dict_rem = {
|
dict_rem = {
|
||||||
'prize_name': i.split('??')[1],
|
"prize_name": i.split('??')[1],
|
||||||
'prize_time': i.split('??')[0]
|
"prize_time": i.split('??')[0]
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
dict_rem = {
|
dict_rem = {
|
||||||
'prize_name': i.split(' ')[1],
|
"prize_name": i.split(' ')[1],
|
||||||
'prize_time': i.split(' ')[0].replace('.', '/')
|
"prize_time": i.split(' ')[0].replace('.', '/')
|
||||||
}
|
}
|
||||||
str_rem = str(copy.deepcopy(dict_rem))
|
str_rem = copy.deepcopy(dict_rem)
|
||||||
remembrance.append(str_rem)
|
remembrance.append(str_rem)
|
||||||
|
|
||||||
|
|
||||||
elif '语言能力' in chk_upgrade_str1:
|
elif '语言能力' in chk_upgrade_str1:
|
||||||
remembrance_list_str = chk_upgrade_str1.split('语言能力')[0].strip().strip('\n')
|
remembrance_list_str = chk_upgrade_str1.split('语言能力')[0].strip().strip('\n')
|
||||||
for i in remembrance_list_str.split('\n'):
|
for i in remembrance_list_str.split('\n'):
|
||||||
if '??' in i:
|
if '??' in i:
|
||||||
dict_rem = {
|
dict_rem = {
|
||||||
'prize_name': i.split('??')[1],
|
"prize_name": i.split('??')[1],
|
||||||
'prize_time': i.split('??')[0]
|
"prize_time": i.split('??')[0]
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
dict_rem = {
|
dict_rem = {
|
||||||
'prize_name': re.split('([0-9]{4}.|/[0-9]{1,2})', i)[1],
|
"prize_name": re.split('([0-9]{4}.|/[0-9]{1,2})', i)[1],
|
||||||
'prize_time': re.split('([0-9]{4}.|/[0-9]{1,2})', i)[0].replace('.', '/')
|
"prize_time": re.split('([0-9]{4}.|/[0-9]{1,2})', i)[0].replace('.', '/')
|
||||||
}
|
}
|
||||||
str_rem = str(copy.deepcopy(dict_rem))
|
str_rem = copy.deepcopy(dict_rem)
|
||||||
remembrance.append(str_rem)
|
remembrance.append(str_rem)
|
||||||
language_list = chk_upgrade_str1.split('语言能力')[-1].strip().strip('\n')
|
language_list = chk_upgrade_str1.split('语言能力')[-1].strip().strip('\n')
|
||||||
language_dict = {
|
language_dict = {
|
||||||
@ -705,7 +702,7 @@ def fmt_txt(chk_str):
|
|||||||
continue
|
continue
|
||||||
if '读写' in i1:
|
if '读写' in i1:
|
||||||
language_dict1['writing'] = i1
|
language_dict1['writing'] = i1
|
||||||
language.append(str(language_dict1))
|
language.append(language_dict1)
|
||||||
elif '培训经历' in chk_upgrade_str1:
|
elif '培训经历' in chk_upgrade_str1:
|
||||||
remembrance_list_str = chk_upgrade_str1.split('培训经历')[0].strip().strip('\n')
|
remembrance_list_str = chk_upgrade_str1.split('培训经历')[0].strip().strip('\n')
|
||||||
remembrance_list_chk = remembrance_list_str.split('\n')
|
remembrance_list_chk = remembrance_list_str.split('\n')
|
||||||
@ -716,13 +713,13 @@ def fmt_txt(chk_str):
|
|||||||
if ',' in name:
|
if ',' in name:
|
||||||
for name1 in name.split(','):
|
for name1 in name.split(','):
|
||||||
dict_rem = {
|
dict_rem = {
|
||||||
'prize_name': name1,
|
"prize_name": name1,
|
||||||
'prize_time': time.replace('.', '/')
|
"prize_time": time.replace('.', '/')
|
||||||
}
|
}
|
||||||
str_rem = str(copy.deepcopy(dict_rem))
|
str_rem = copy.deepcopy(dict_rem)
|
||||||
remembrance.append(str_rem)
|
remembrance.append(str_rem)
|
||||||
else:
|
else:
|
||||||
remembrance.append(str({'prize_name': name, 'prize_time': time}))
|
remembrance.append({"prize_name": name, "prize_time": time})
|
||||||
dict_chk['remembrance'] = remembrance
|
dict_chk['remembrance'] = remembrance
|
||||||
dict_chk['specialty_do'] = specialty_do
|
dict_chk['specialty_do'] = specialty_do
|
||||||
dict_chk['language'] = language
|
dict_chk['language'] = language
|
||||||
|
Loading…
Reference in New Issue
Block a user