x
This commit is contained in:
@@ -79,14 +79,20 @@ async def upload_stp(
|
||||
current_user: User = Depends(get_current_active_user)
|
||||
):
|
||||
"""上传STP文件并存储到数据库"""
|
||||
logger.info(
|
||||
f"[UPLOAD] 用户={current_user.username}(id={current_user.id}) "
|
||||
f"文件={file.filename} 材料={material}"
|
||||
)
|
||||
|
||||
if not file.filename.lower().endswith(('.stp', '.step')):
|
||||
logger.warning(f"[UPLOAD] 拒绝: 不支持的文件类型 - {file.filename}")
|
||||
raise HTTPException(400, "只支持STP/STEP文件")
|
||||
|
||||
task_id = str(uuid.uuid4())
|
||||
|
||||
# 保存文件
|
||||
file_path, file_size = await file_handler.save_uploaded_file(file)
|
||||
logger.info(f"[UPLOAD] 文件已保存: {file_path} ({file_size} bytes), task_id={task_id}")
|
||||
|
||||
# 创建存储集成服务实例
|
||||
storage_service = StorageIntegrationService()
|
||||
@@ -98,6 +104,7 @@ async def upload_stp(
|
||||
original_filename=file.filename,
|
||||
user_id=current_user.id
|
||||
)
|
||||
logger.info(f"[UPLOAD] STP文件已存入RustFS+PG: stp_file.id={stp_file.id}")
|
||||
|
||||
# 创建处理任务记录
|
||||
await storage_service.create_processing_task(db_session, task_id, stp_file.id)
|
||||
@@ -122,6 +129,7 @@ async def upload_stp(
|
||||
stp_file.id,
|
||||
material,
|
||||
)
|
||||
logger.info(f"[UPLOAD] 后台处理已调度: task_id={task_id}")
|
||||
|
||||
return {
|
||||
"task_id": task_id,
|
||||
|
||||
Reference in New Issue
Block a user