简历提取,写入
This commit is contained in:
@@ -5,7 +5,7 @@ import pathlib
|
|||||||
from decouple import config
|
from decouple import config
|
||||||
|
|
||||||
# BASE_PATH = config('BASE_PATH', default='E://pyptoject//yj_resume//')
|
# BASE_PATH = config('BASE_PATH', default='E://pyptoject//yj_resume//')
|
||||||
BASE_PATH = config('BASE_PATH', default='D://PycharmProject//yj_resume//')
|
BASE_PATH = config('BASE_PATH', default='D://PycharmProject//yj_resume//uploads//')
|
||||||
|
|
||||||
|
|
||||||
# 导出数据到excel
|
# 导出数据到excel
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import logging
|
|||||||
from service.parse_resume2_doc import extra_resume
|
from service.parse_resume2_doc import extra_resume
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
BASE_PATH = config('BASE_PATH', default='D://PycharmProject//yj_resume//')
|
BASE_PATH = config('BASE_PATH', default='D://PycharmProject//yj_resume//uploads//')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -25,6 +25,7 @@ def check_and_create_directory(files):
|
|||||||
logger.info("check_and_create_directory in service")
|
logger.info("check_and_create_directory in service")
|
||||||
# 先创建一个task
|
# 先创建一个task
|
||||||
if not files or len(files) == 0:
|
if not files or len(files) == 0:
|
||||||
|
logger.warning("check_and_create_directory is empty")
|
||||||
return None
|
return None
|
||||||
id = str(uuid.uuid4())
|
id = str(uuid.uuid4())
|
||||||
current_time = datetime.now()
|
current_time = datetime.now()
|
||||||
@@ -68,7 +69,7 @@ async def upload_and_save_file(dir_id, files: List[UploadFile]) -> (bool, str):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Failed to save DBRESUME error {e}")
|
print(f"Failed to save DBRESUME error {e}")
|
||||||
session.rollback()
|
session.rollback()
|
||||||
return False, f"Failed to save DBRESUME error {e}",[]
|
return False, f"Failed to save DBRESUME error {e}"
|
||||||
finally:
|
finally:
|
||||||
session.close()
|
session.close()
|
||||||
return True, "success"
|
return True, "success"
|
||||||
@@ -78,7 +79,7 @@ async def fetch_files(dir_id) -> (bool, str):
|
|||||||
logger.info(f"start fetching files task {dir_id} in service")
|
logger.info(f"start fetching files task {dir_id} in service")
|
||||||
if not os.path.exists(BASE_PATH):
|
if not os.path.exists(BASE_PATH):
|
||||||
logger.info(f"目录{BASE_PATH}不存在")
|
logger.info(f"目录{BASE_PATH}不存在")
|
||||||
return None
|
return False, f"Failed to fetch file 目录{BASE_PATH}不存在"
|
||||||
file_extensions = ['.docx', '.doc']
|
file_extensions = ['.docx', '.doc']
|
||||||
files_list = []
|
files_list = []
|
||||||
dir_path = pathlib.Path(BASE_PATH).joinpath(dir_id)
|
dir_path = pathlib.Path(BASE_PATH).joinpath(dir_id)
|
||||||
|
|||||||
Reference in New Issue
Block a user