|
@@ -87,9 +87,9 @@ def process_career_path(career_path, talent_node_id, talent_name_zh):
|
|
|
|
|
|
# 在执行当前代码逻辑之前,清除传入节点的WORK_FOR和WORK_AS关系
|
|
# 在执行当前代码逻辑之前,清除传入节点的WORK_FOR和WORK_AS关系
|
|
try:
|
|
try:
|
|
- from app.core.graph.graph_operations import connect_graph
|
|
|
|
|
|
+ from app.services.neo4j_driver import neo4j_driver
|
|
|
|
|
|
- with connect_graph().session() as session:
|
|
|
|
|
|
+ with neo4j_driver.get_session() as session:
|
|
# 清除WORK_FOR关系
|
|
# 清除WORK_FOR关系
|
|
clear_work_for_query = """
|
|
clear_work_for_query = """
|
|
MATCH (t:Talent)-[r:WORK_FOR]->(h:Hotel)
|
|
MATCH (t:Talent)-[r:WORK_FOR]->(h:Hotel)
|
|
@@ -116,9 +116,9 @@ def process_career_path(career_path, talent_node_id, talent_name_zh):
|
|
# 查询Neo4j图数据库中DataLabel标签中node_type为"brand"的所有节点
|
|
# 查询Neo4j图数据库中DataLabel标签中node_type为"brand"的所有节点
|
|
brand_labels = []
|
|
brand_labels = []
|
|
try:
|
|
try:
|
|
- from app.core.graph.graph_operations import connect_graph
|
|
|
|
|
|
+ from app.services.neo4j_driver import neo4j_driver
|
|
|
|
|
|
- with connect_graph().session() as session:
|
|
|
|
|
|
+ with neo4j_driver.get_session() as session:
|
|
# 查询node_type为"brand"的DataLabel节点
|
|
# 查询node_type为"brand"的DataLabel节点
|
|
brand_query = """
|
|
brand_query = """
|
|
MATCH (n:DataLabel)
|
|
MATCH (n:DataLabel)
|
|
@@ -166,10 +166,10 @@ def process_career_path(career_path, talent_node_id, talent_name_zh):
|
|
|
|
|
|
# 创建Hotel节点
|
|
# 创建Hotel节点
|
|
try:
|
|
try:
|
|
- from app.core.graph.graph_operations import connect_graph
|
|
|
|
|
|
+ from app.services.neo4j_driver import neo4j_driver
|
|
|
|
|
|
# 直接使用Cypher语句查找或创建Hotel节点
|
|
# 直接使用Cypher语句查找或创建Hotel节点
|
|
- with connect_graph().session() as session:
|
|
|
|
|
|
+ with neo4j_driver.get_session() as session:
|
|
# 首先查找是否已存在相同hotel_zh的Hotel节点
|
|
# 首先查找是否已存在相同hotel_zh的Hotel节点
|
|
find_query = """
|
|
find_query = """
|
|
MATCH (h:Hotel {hotel_zh: $hotel_zh})
|
|
MATCH (h:Hotel {hotel_zh: $hotel_zh})
|
|
@@ -199,7 +199,7 @@ def process_career_path(career_path, talent_node_id, talent_name_zh):
|
|
hotel_en=hotel_en,
|
|
hotel_en=hotel_en,
|
|
create_time=current_time).single()
|
|
create_time=current_time).single()
|
|
|
|
|
|
- hotel_node_id = create_result['node_id']
|
|
|
|
|
|
+ hotel_node_id = create_result['node_id'] if create_result else None
|
|
logging.info(f"成功创建新Hotel节点,Neo4j ID: {hotel_node_id}, 酒店: {hotel_zh}")
|
|
logging.info(f"成功创建新Hotel节点,Neo4j ID: {hotel_node_id}, 酒店: {hotel_zh}")
|
|
result['hotels_created'] += 1
|
|
result['hotels_created'] += 1
|
|
|
|
|
|
@@ -275,10 +275,10 @@ def process_career_path(career_path, talent_node_id, talent_name_zh):
|
|
if brand_name:
|
|
if brand_name:
|
|
# 查找对应的DataLabel节点
|
|
# 查找对应的DataLabel节点
|
|
try:
|
|
try:
|
|
- from app.core.graph.graph_operations import connect_graph
|
|
|
|
|
|
+ from app.services.neo4j_driver import neo4j_driver
|
|
|
|
|
|
# 直接查询Neo4j查找name_zh等于品牌名称的DataLabel节点
|
|
# 直接查询Neo4j查找name_zh等于品牌名称的DataLabel节点
|
|
- with connect_graph().session() as session:
|
|
|
|
|
|
+ with neo4j_driver.get_session() as session:
|
|
query = "MATCH (n:DataLabel {name_zh: $brand_name}) RETURN id(n) as node_id, n.name_zh as name_zh LIMIT 1"
|
|
query = "MATCH (n:DataLabel {name_zh: $brand_name}) RETURN id(n) as node_id, n.name_zh as name_zh LIMIT 1"
|
|
result_query = session.run(query, brand_name=brand_name).single()
|
|
result_query = session.run(query, brand_name=brand_name).single()
|
|
|
|
|
|
@@ -287,9 +287,9 @@ def process_career_path(career_path, talent_node_id, talent_name_zh):
|
|
|
|
|
|
# 创建Hotel节点与品牌标签的BELONGS_TO关系
|
|
# 创建Hotel节点与品牌标签的BELONGS_TO关系
|
|
try:
|
|
try:
|
|
- from app.core.graph.graph_operations import connect_graph
|
|
|
|
|
|
+ from app.services.neo4j_driver import neo4j_driver
|
|
|
|
|
|
- with connect_graph().session() as session:
|
|
|
|
|
|
+ with neo4j_driver.get_session() as session:
|
|
# 检查Hotel节点与DataLabel节点之间是否已经存在BELONGS_TO关系
|
|
# 检查Hotel节点与DataLabel节点之间是否已经存在BELONGS_TO关系
|
|
check_relationship_query = """
|
|
check_relationship_query = """
|
|
MATCH (h:Hotel)-[r:BELONGS_TO]->(d:DataLabel)
|
|
MATCH (h:Hotel)-[r:BELONGS_TO]->(d:DataLabel)
|
|
@@ -307,7 +307,7 @@ def process_career_path(career_path, talent_node_id, talent_name_zh):
|
|
else:
|
|
else:
|
|
# 关系不存在,创建新的BELONGS_TO关系
|
|
# 关系不存在,创建新的BELONGS_TO关系
|
|
# 直接使用Cypher创建关系,避免使用create_relationship函数
|
|
# 直接使用Cypher创建关系,避免使用create_relationship函数
|
|
- with connect_graph().session() as session:
|
|
|
|
|
|
+ with neo4j_driver.get_session() as session:
|
|
create_rel_query = """
|
|
create_rel_query = """
|
|
MATCH (h:Hotel), (d:DataLabel)
|
|
MATCH (h:Hotel), (d:DataLabel)
|
|
WHERE id(h) = $hotel_node_id AND id(d) = $label_node_id
|
|
WHERE id(h) = $hotel_node_id AND id(d) = $label_node_id
|
|
@@ -328,7 +328,7 @@ def process_career_path(career_path, talent_node_id, talent_name_zh):
|
|
logging.error(f"检查Hotel节点与品牌标签关系失败: {str(check_error)}")
|
|
logging.error(f"检查Hotel节点与品牌标签关系失败: {str(check_error)}")
|
|
result['errors'].append(f"检查关系失败: {hotel_zh} -> {brand_name}, 错误: {str(check_error)}")
|
|
result['errors'].append(f"检查关系失败: {hotel_zh} -> {brand_name}, 错误: {str(check_error)}")
|
|
# 即使检查失败,也尝试创建关系
|
|
# 即使检查失败,也尝试创建关系
|
|
- with connect_graph().session() as session:
|
|
|
|
|
|
+ with neo4j_driver.get_session() as session:
|
|
create_rel_query = """
|
|
create_rel_query = """
|
|
MATCH (h:Hotel), (d:DataLabel)
|
|
MATCH (h:Hotel), (d:DataLabel)
|
|
WHERE id(h) = $hotel_node_id AND id(d) = $label_node_id
|
|
WHERE id(h) = $hotel_node_id AND id(d) = $label_node_id
|
|
@@ -382,9 +382,9 @@ def process_career_path(career_path, talent_node_id, talent_name_zh):
|
|
work_for_properties['date'] = date
|
|
work_for_properties['date'] = date
|
|
|
|
|
|
# 直接使用Cypher创建WORK_FOR关系,避免使用create_relationship函数
|
|
# 直接使用Cypher创建WORK_FOR关系,避免使用create_relationship函数
|
|
- from app.core.graph.graph_operations import connect_graph
|
|
|
|
|
|
+ from app.services.neo4j_driver import neo4j_driver
|
|
|
|
|
|
- with connect_graph().session() as session:
|
|
|
|
|
|
+ with neo4j_driver.get_session() as session:
|
|
work_for_query = """
|
|
work_for_query = """
|
|
MATCH (t:Talent), (h:Hotel)
|
|
MATCH (t:Talent), (h:Hotel)
|
|
WHERE id(t) = $talent_node_id AND id(h) = $hotel_node_id
|
|
WHERE id(t) = $talent_node_id AND id(h) = $hotel_node_id
|
|
@@ -408,10 +408,10 @@ def process_career_path(career_path, talent_node_id, talent_name_zh):
|
|
try:
|
|
try:
|
|
# 查找对应的DataLabel节点(职位标签)
|
|
# 查找对应的DataLabel节点(职位标签)
|
|
try:
|
|
try:
|
|
- from app.core.graph.graph_operations import connect_graph
|
|
|
|
|
|
+ from app.services.neo4j_driver import neo4j_driver
|
|
|
|
|
|
# 直接查询Neo4j查找name_zh等于title_zh的DataLabel节点
|
|
# 直接查询Neo4j查找name_zh等于title_zh的DataLabel节点
|
|
- with connect_graph().session() as session:
|
|
|
|
|
|
+ with neo4j_driver.get_session() as session:
|
|
query = "MATCH (n:DataLabel {name_zh: $title_zh}) RETURN id(n) as node_id, n.name_zh as name_zh LIMIT 1"
|
|
query = "MATCH (n:DataLabel {name_zh: $title_zh}) RETURN id(n) as node_id, n.name_zh as name_zh LIMIT 1"
|
|
result_query = session.run(query, title_zh=title_zh).single()
|
|
result_query = session.run(query, title_zh=title_zh).single()
|
|
|
|
|
|
@@ -504,7 +504,7 @@ def create_or_get_talent_node(**properties):
|
|
节点id
|
|
节点id
|
|
"""
|
|
"""
|
|
try:
|
|
try:
|
|
- from app.core.graph.graph_operations import connect_graph
|
|
|
|
|
|
+ from app.services.neo4j_driver import neo4j_driver
|
|
|
|
|
|
# 检查是否提供了pg_id
|
|
# 检查是否提供了pg_id
|
|
if 'pg_id' not in properties:
|
|
if 'pg_id' not in properties:
|
|
@@ -512,7 +512,7 @@ def create_or_get_talent_node(**properties):
|
|
|
|
|
|
pg_id = properties['pg_id']
|
|
pg_id = properties['pg_id']
|
|
|
|
|
|
- with connect_graph().session() as session:
|
|
|
|
|
|
+ with neo4j_driver.get_session() as session:
|
|
# 检查节点是否存在(根据pg_id查找)
|
|
# 检查节点是否存在(根据pg_id查找)
|
|
query = """
|
|
query = """
|
|
MATCH (n:Talent {pg_id: $pg_id})
|
|
MATCH (n:Talent {pg_id: $pg_id})
|
|
@@ -524,14 +524,19 @@ def create_or_get_talent_node(**properties):
|
|
# 节点存在,更新属性
|
|
# 节点存在,更新属性
|
|
props_string = ", ".join([f"n.{key} = ${key}" for key in properties if key != 'pg_id'])
|
|
props_string = ", ".join([f"n.{key} = ${key}" for key in properties if key != 'pg_id'])
|
|
if props_string:
|
|
if props_string:
|
|
|
|
+ # 使用字符串格式化来避免动态字符串构造
|
|
update_query = f"""
|
|
update_query = f"""
|
|
MATCH (n:Talent {{pg_id: $pg_id}})
|
|
MATCH (n:Talent {{pg_id: $pg_id}})
|
|
SET {props_string}
|
|
SET {props_string}
|
|
RETURN id(n) as node_id
|
|
RETURN id(n) as node_id
|
|
"""
|
|
"""
|
|
- result = session.run(update_query, **properties).single()
|
|
|
|
- logging.info(f"已更新现有Talent节点,pg_id: {pg_id}, Neo4j ID: {result['node_id']}")
|
|
|
|
- return result["node_id"]
|
|
|
|
|
|
+ result = session.run(update_query, **properties).single() # type: ignore
|
|
|
|
+ if result:
|
|
|
|
+ logging.info(f"已更新现有Talent节点,pg_id: {pg_id}, Neo4j ID: {result['node_id']}")
|
|
|
|
+ return result["node_id"]
|
|
|
|
+ else:
|
|
|
|
+ logging.error(f"更新Talent节点失败,pg_id: {pg_id}")
|
|
|
|
+ return None
|
|
else:
|
|
else:
|
|
# 没有需要更新的属性,返回现有节点ID
|
|
# 没有需要更新的属性,返回现有节点ID
|
|
existing_node_id = result['n'].id
|
|
existing_node_id = result['n'].id
|
|
@@ -544,9 +549,13 @@ def create_or_get_talent_node(**properties):
|
|
CREATE (n:Talent {{{props_keys}}})
|
|
CREATE (n:Talent {{{props_keys}}})
|
|
RETURN id(n) as node_id
|
|
RETURN id(n) as node_id
|
|
"""
|
|
"""
|
|
- result = session.run(create_query, **properties).single()
|
|
|
|
- logging.info(f"已创建新Talent节点,pg_id: {pg_id}, Neo4j ID: {result['node_id']}")
|
|
|
|
- return result["node_id"]
|
|
|
|
|
|
+ result = session.run(create_query, **properties).single() # type: ignore
|
|
|
|
+ if result:
|
|
|
|
+ logging.info(f"已创建新Talent节点,pg_id: {pg_id}, Neo4j ID: {result['node_id']}")
|
|
|
|
+ return result["node_id"]
|
|
|
|
+ else:
|
|
|
|
+ logging.error(f"创建Talent节点失败,pg_id: {pg_id}")
|
|
|
|
+ return None
|
|
|
|
|
|
except Exception as e:
|
|
except Exception as e:
|
|
logging.error(f"Error in create_or_get_talent_node: {str(e)}")
|
|
logging.error(f"Error in create_or_get_talent_node: {str(e)}")
|
|
@@ -760,17 +769,16 @@ def _handle_recruitment_task(created_by, data=None):
|
|
task_source.append(item)
|
|
task_source.append(item)
|
|
|
|
|
|
# 创建解析任务记录
|
|
# 创建解析任务记录
|
|
- parse_task = ParseTaskRepository(
|
|
|
|
- task_name=task_name,
|
|
|
|
- task_status='待解析', # 招聘任务不需要实际解析操作,直接设置为成功
|
|
|
|
- task_type='招聘',
|
|
|
|
- task_source=task_source,
|
|
|
|
- collection_count=len(task_source), # 招聘任务的数据项数量
|
|
|
|
- parse_count=0,
|
|
|
|
- parse_result=None,
|
|
|
|
- created_by=created_by,
|
|
|
|
- updated_by=created_by
|
|
|
|
- )
|
|
|
|
|
|
+ parse_task = ParseTaskRepository()
|
|
|
|
+ parse_task.task_name = task_name
|
|
|
|
+ parse_task.task_status = '待解析' # 招聘任务不需要实际解析操作,直接设置为成功
|
|
|
|
+ parse_task.task_type = '招聘'
|
|
|
|
+ parse_task.task_source = task_source
|
|
|
|
+ parse_task.collection_count = len(task_source) # 招聘任务的数据项数量
|
|
|
|
+ parse_task.parse_count = 0
|
|
|
|
+ parse_task.parse_result = None
|
|
|
|
+ parse_task.created_by = created_by
|
|
|
|
+ parse_task.updated_by = created_by
|
|
|
|
|
|
db.session.add(parse_task)
|
|
db.session.add(parse_task)
|
|
db.session.commit()
|
|
db.session.commit()
|
|
@@ -1036,17 +1044,16 @@ def add_parse_task(files, task_type, created_by='system', data=None, publish_tim
|
|
|
|
|
|
# 创建解析任务记录
|
|
# 创建解析任务记录
|
|
try:
|
|
try:
|
|
- parse_task = ParseTaskRepository(
|
|
|
|
- task_name=task_name,
|
|
|
|
- task_status='待解析',
|
|
|
|
- task_type=task_type,
|
|
|
|
- task_source=task_source,
|
|
|
|
- collection_count=len(uploaded_files),
|
|
|
|
- parse_count=0, # 解析数量初始为0
|
|
|
|
- parse_result=None, # 解析结果初始为空
|
|
|
|
- created_by=created_by,
|
|
|
|
- updated_by=created_by
|
|
|
|
- )
|
|
|
|
|
|
+ parse_task = ParseTaskRepository()
|
|
|
|
+ parse_task.task_name = task_name
|
|
|
|
+ parse_task.task_status = '待解析'
|
|
|
|
+ parse_task.task_type = task_type
|
|
|
|
+ parse_task.task_source = task_source
|
|
|
|
+ parse_task.collection_count = len(uploaded_files)
|
|
|
|
+ parse_task.parse_count = 0 # 解析数量初始为0
|
|
|
|
+ parse_task.parse_result = None # 解析结果初始为空
|
|
|
|
+ parse_task.created_by = created_by
|
|
|
|
+ parse_task.updated_by = created_by
|
|
|
|
|
|
db.session.add(parse_task)
|
|
db.session.add(parse_task)
|
|
db.session.commit()
|
|
db.session.commit()
|
|
@@ -1433,37 +1440,36 @@ def add_single_talent(talent_data, minio_path=None, task_type=None):
|
|
except (ValueError, TypeError):
|
|
except (ValueError, TypeError):
|
|
age_value = None
|
|
age_value = None
|
|
|
|
|
|
- business_card = BusinessCard(
|
|
|
|
- name_zh=talent_data.get('name_zh', ''),
|
|
|
|
- name_en=talent_data.get('name_en', ''),
|
|
|
|
- title_zh=talent_data.get('title_zh', ''),
|
|
|
|
- title_en=talent_data.get('title_en', ''),
|
|
|
|
- mobile=normalize_mobile_numbers(talent_data.get('mobile', '')),
|
|
|
|
- phone=talent_data.get('phone', ''),
|
|
|
|
- email=talent_data.get('email', ''),
|
|
|
|
- hotel_zh=talent_data.get('hotel_zh', ''),
|
|
|
|
- hotel_en=talent_data.get('hotel_en', ''),
|
|
|
|
- address_zh=talent_data.get('address_zh', ''),
|
|
|
|
- address_en=talent_data.get('address_en', ''),
|
|
|
|
- postal_code_zh=talent_data.get('postal_code_zh', ''),
|
|
|
|
- postal_code_en=talent_data.get('postal_code_en', ''),
|
|
|
|
- brand_zh=talent_data.get('brand_zh', ''),
|
|
|
|
- brand_en=talent_data.get('brand_en', ''),
|
|
|
|
- affiliation_zh=talent_data.get('affiliation_zh', ''),
|
|
|
|
- affiliation_en=talent_data.get('affiliation_en', ''),
|
|
|
|
- birthday=datetime.strptime(talent_data.get('birthday'), '%Y-%m-%d').date() if talent_data.get('birthday') else None,
|
|
|
|
- age=age_value,
|
|
|
|
- native_place=talent_data.get('native_place', ''),
|
|
|
|
- gender=talent_data.get('gender', ''), # 新增性别字段
|
|
|
|
- residence=talent_data.get('residence', ''),
|
|
|
|
- image_path=image_path, # 从talent_data获取图片路径
|
|
|
|
- career_path=career_path, # 直接使用talent_data中的career_path
|
|
|
|
- brand_group=talent_data.get('brand_group', ''),
|
|
|
|
- origin_source=_update_origin_source_with_minio_path(None, talent_data),
|
|
|
|
- talent_profile=talent_data.get('talent_profile', ''),
|
|
|
|
- status='active',
|
|
|
|
- updated_by='talent_system'
|
|
|
|
- )
|
|
|
|
|
|
+ business_card = BusinessCard()
|
|
|
|
+ business_card.name_zh = talent_data.get('name_zh', '')
|
|
|
|
+ business_card.name_en = talent_data.get('name_en', '')
|
|
|
|
+ business_card.title_zh = talent_data.get('title_zh', '')
|
|
|
|
+ business_card.title_en = talent_data.get('title_en', '')
|
|
|
|
+ business_card.mobile = normalize_mobile_numbers(talent_data.get('mobile', ''))
|
|
|
|
+ business_card.phone = talent_data.get('phone', '')
|
|
|
|
+ business_card.email = talent_data.get('email', '')
|
|
|
|
+ business_card.hotel_zh = talent_data.get('hotel_zh', '')
|
|
|
|
+ business_card.hotel_en = talent_data.get('hotel_en', '')
|
|
|
|
+ business_card.address_zh = talent_data.get('address_zh', '')
|
|
|
|
+ business_card.address_en = talent_data.get('address_en', '')
|
|
|
|
+ business_card.postal_code_zh = talent_data.get('postal_code_zh', '')
|
|
|
|
+ business_card.postal_code_en = talent_data.get('postal_code_en', '')
|
|
|
|
+ business_card.brand_zh = talent_data.get('brand_zh', '')
|
|
|
|
+ business_card.brand_en = talent_data.get('brand_en', '')
|
|
|
|
+ business_card.affiliation_zh = talent_data.get('affiliation_zh', '')
|
|
|
|
+ business_card.affiliation_en = talent_data.get('affiliation_en', '')
|
|
|
|
+ business_card.birthday = datetime.strptime(talent_data.get('birthday'), '%Y-%m-%d').date() if talent_data.get('birthday') else None
|
|
|
|
+ business_card.age = age_value
|
|
|
|
+ business_card.native_place = talent_data.get('native_place', '')
|
|
|
|
+ business_card.gender = talent_data.get('gender', '') # 新增性别字段
|
|
|
|
+ business_card.residence = talent_data.get('residence', '')
|
|
|
|
+ business_card.image_path = image_path # 从talent_data获取图片路径
|
|
|
|
+ business_card.career_path = career_path # 直接使用talent_data中的career_path
|
|
|
|
+ business_card.brand_group = talent_data.get('brand_group', '')
|
|
|
|
+ business_card.origin_source = _update_origin_source_with_minio_path(None, talent_data)
|
|
|
|
+ business_card.talent_profile = talent_data.get('talent_profile', '')
|
|
|
|
+ business_card.status = 'active'
|
|
|
|
+ business_card.updated_by = 'talent_system'
|
|
|
|
|
|
db.session.add(business_card)
|
|
db.session.add(business_card)
|
|
db.session.commit()
|
|
db.session.commit()
|
|
@@ -1824,40 +1830,39 @@ def record_parsed_talent(talent_data, task_id=None, task_type=None):
|
|
}
|
|
}
|
|
|
|
|
|
# 创建ParsedTalent记录
|
|
# 创建ParsedTalent记录
|
|
- parsed_talent = ParsedTalent(
|
|
|
|
- name_zh=_clean_field_value(talent_data.get('name_zh', ''), 'string'),
|
|
|
|
- name_en=_clean_field_value(talent_data.get('name_en', ''), 'string'),
|
|
|
|
- title_zh=_clean_field_value(talent_data.get('title_zh', ''), 'string'),
|
|
|
|
- title_en=_clean_field_value(talent_data.get('title_en', ''), 'string'),
|
|
|
|
- mobile=_clean_field_value(talent_data.get('mobile', ''), 'string'),
|
|
|
|
- phone=_clean_field_value(talent_data.get('phone', ''), 'string'),
|
|
|
|
- email=_clean_field_value(talent_data.get('email', ''), 'string'),
|
|
|
|
- hotel_zh=_clean_field_value(talent_data.get('hotel_zh', ''), 'string'),
|
|
|
|
- hotel_en=_clean_field_value(talent_data.get('hotel_en', ''), 'string'),
|
|
|
|
- address_zh=_clean_field_value(talent_data.get('address_zh', ''), 'string'),
|
|
|
|
- address_en=_clean_field_value(talent_data.get('address_en', ''), 'string'),
|
|
|
|
- postal_code_zh=_clean_field_value(talent_data.get('postal_code_zh', ''), 'string'),
|
|
|
|
- postal_code_en=_clean_field_value(talent_data.get('postal_code_en', ''), 'string'),
|
|
|
|
- brand_zh=_clean_field_value(talent_data.get('brand_zh', ''), 'string'),
|
|
|
|
- brand_en=_clean_field_value(talent_data.get('brand_en', ''), 'string'),
|
|
|
|
- affiliation_zh=_clean_field_value(talent_data.get('affiliation_zh', ''), 'string'),
|
|
|
|
- affiliation_en=_clean_field_value(talent_data.get('affiliation_en', ''), 'string'),
|
|
|
|
- image_path=_clean_field_value(talent_data.get('image_path', ''), 'string'),
|
|
|
|
- career_path=talent_data.get('career_path', []),
|
|
|
|
- brand_group=_clean_field_value(talent_data.get('brand_group', ''), 'string'),
|
|
|
|
- birthday=_clean_field_value(talent_data.get('birthday'), 'date'),
|
|
|
|
- residence=_clean_field_value(talent_data.get('residence', ''), 'string'),
|
|
|
|
- age=_clean_field_value(talent_data.get('age'), 'int'),
|
|
|
|
- native_place=_clean_field_value(talent_data.get('native_place', ''), 'string'),
|
|
|
|
- gender=_clean_field_value(talent_data.get('gender', ''), 'string'), # 新增性别字段
|
|
|
|
- origin_source=talent_data.get('origin_source', []),
|
|
|
|
- talent_profile=_clean_field_value(talent_data.get('talent_profile', ''), 'string'),
|
|
|
|
- task_id=str(task_id) if task_id else '',
|
|
|
|
- task_type=task_type or '',
|
|
|
|
- status='待审核', # 统一设置为待审核状态
|
|
|
|
- created_at=get_east_asia_time_naive(),
|
|
|
|
- updated_by='system'
|
|
|
|
- )
|
|
|
|
|
|
+ parsed_talent = ParsedTalent()
|
|
|
|
+ parsed_talent.name_zh = _clean_field_value(talent_data.get('name_zh', ''), 'string')
|
|
|
|
+ parsed_talent.name_en = _clean_field_value(talent_data.get('name_en', ''), 'string')
|
|
|
|
+ parsed_talent.title_zh = _clean_field_value(talent_data.get('title_zh', ''), 'string')
|
|
|
|
+ parsed_talent.title_en = _clean_field_value(talent_data.get('title_en', ''), 'string')
|
|
|
|
+ parsed_talent.mobile = _clean_field_value(talent_data.get('mobile', ''), 'string')
|
|
|
|
+ parsed_talent.phone = _clean_field_value(talent_data.get('phone', ''), 'string')
|
|
|
|
+ parsed_talent.email = _clean_field_value(talent_data.get('email', ''), 'string')
|
|
|
|
+ parsed_talent.hotel_zh = _clean_field_value(talent_data.get('hotel_zh', ''), 'string')
|
|
|
|
+ parsed_talent.hotel_en = _clean_field_value(talent_data.get('hotel_en', ''), 'string')
|
|
|
|
+ parsed_talent.address_zh = _clean_field_value(talent_data.get('address_zh', ''), 'string')
|
|
|
|
+ parsed_talent.address_en = _clean_field_value(talent_data.get('address_en', ''), 'string')
|
|
|
|
+ parsed_talent.postal_code_zh = _clean_field_value(talent_data.get('postal_code_zh', ''), 'string')
|
|
|
|
+ parsed_talent.postal_code_en = _clean_field_value(talent_data.get('postal_code_en', ''), 'string')
|
|
|
|
+ parsed_talent.brand_zh = _clean_field_value(talent_data.get('brand_zh', ''), 'string')
|
|
|
|
+ parsed_talent.brand_en = _clean_field_value(talent_data.get('brand_en', ''), 'string')
|
|
|
|
+ parsed_talent.affiliation_zh = _clean_field_value(talent_data.get('affiliation_zh', ''), 'string')
|
|
|
|
+ parsed_talent.affiliation_en = _clean_field_value(talent_data.get('affiliation_en', ''), 'string')
|
|
|
|
+ parsed_talent.image_path = _clean_field_value(talent_data.get('image_path', ''), 'string')
|
|
|
|
+ parsed_talent.career_path = talent_data.get('career_path', [])
|
|
|
|
+ parsed_talent.brand_group = _clean_field_value(talent_data.get('brand_group', ''), 'string')
|
|
|
|
+ parsed_talent.birthday = _clean_field_value(talent_data.get('birthday'), 'date')
|
|
|
|
+ parsed_talent.residence = _clean_field_value(talent_data.get('residence', ''), 'string')
|
|
|
|
+ parsed_talent.age = _clean_field_value(talent_data.get('age'), 'int')
|
|
|
|
+ parsed_talent.native_place = _clean_field_value(talent_data.get('native_place', ''), 'string')
|
|
|
|
+ parsed_talent.gender = _clean_field_value(talent_data.get('gender', ''), 'string') # 新增性别字段
|
|
|
|
+ parsed_talent.origin_source = talent_data.get('origin_source', [])
|
|
|
|
+ parsed_talent.talent_profile = _clean_field_value(talent_data.get('talent_profile', ''), 'string')
|
|
|
|
+ parsed_talent.task_id = str(task_id) if task_id else ''
|
|
|
|
+ parsed_talent.task_type = task_type or ''
|
|
|
|
+ parsed_talent.status = '待审核' # 统一设置为待审核状态
|
|
|
|
+ parsed_talent.created_at = get_east_asia_time_naive()
|
|
|
|
+ parsed_talent.updated_by = 'system'
|
|
|
|
|
|
# 添加到数据库会话并提交
|
|
# 添加到数据库会话并提交
|
|
db.session.add(parsed_talent)
|
|
db.session.add(parsed_talent)
|