|
|
@ -136,7 +136,7 @@ async def upload_file(files: List[UploadFile] = File(...)):
|
|
|
|
summary="生成日报",
|
|
|
|
summary="生成日报",
|
|
|
|
description="生成日报,将生成的简报和日报文档转成html返回前端",
|
|
|
|
description="生成日报,将生成的简报和日报文档转成html返回前端",
|
|
|
|
)
|
|
|
|
)
|
|
|
|
async def generate_report(background_tasks: BackgroundTasks):
|
|
|
|
async def generate_report(background_tasks: BackgroundTasks, time_type: int = 0):
|
|
|
|
global data_dict
|
|
|
|
global data_dict
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
logger.info("开始生成日报")
|
|
|
|
logger.info("开始生成日报")
|
|
|
@ -148,7 +148,7 @@ async def generate_report(background_tasks: BackgroundTasks):
|
|
|
|
# 存储文件的路径
|
|
|
|
# 存储文件的路径
|
|
|
|
fold_path = str(Path(UPLOAD_DIR).resolve()).replace("\\", "/")
|
|
|
|
fold_path = str(Path(UPLOAD_DIR).resolve()).replace("\\", "/")
|
|
|
|
|
|
|
|
|
|
|
|
data_dict = deal_docx(fold_path, DOWNLOAD_DIR)
|
|
|
|
data_dict = deal_docx(fold_path, DOWNLOAD_DIR,time_type=time_type)
|
|
|
|
|
|
|
|
|
|
|
|
# 判断是否生成日报成功,如果成功,则转成html返回前端
|
|
|
|
# 判断是否生成日报成功,如果成功,则转成html返回前端
|
|
|
|
report_sim_html = docx2html(data_dict["daily_repo_simple"])
|
|
|
|
report_sim_html = docx2html(data_dict["daily_repo_simple"])
|
|
|
|