1) 客服 Agent 四份交付文档 + 构建脚手架:品牌由包装占位 XX科技 / 旧名 南方财富 统一为南方基金(热线 400-889-8899 / 官网 nffund.com),系统名改为「智能服务系统」; 同步追加 §0.4 修订记录行,工程记录行保留原占位字面以支撑硬编码扫描验收。 2) 开发文档:清理 28 份已作废/残留文档(14 份移出归档 + 14 份仓库副本), 新增《文档规整方案与开发前待决事项-2026-09-17》。 3) 客服agent 四份交付文档首次纳入本分支。
111 lines
3.7 KiB
Python
111 lines
3.7 KiB
Python
"""产品推介材料接口。"""
|
|
|
|
from typing import Any
|
|
|
|
from fastapi import APIRouter, Depends, File, Header, Query, UploadFile
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
|
|
from app.api.dependencies.auth import build_request_context
|
|
from app.api.dependencies.database import get_session
|
|
from app.api.schemas.promotion_material import (
|
|
PromotionDeliveryRequest,
|
|
PromotionGenerationRequest,
|
|
PromotionInputsUpdate,
|
|
PromotionReviewRequest,
|
|
PromotionTaskCreate,
|
|
)
|
|
from app.core.contracts import RequestContext
|
|
from app.service.promotion_material_service import PromotionMaterialService
|
|
|
|
router = APIRouter(
|
|
prefix="/api/v1/fund-promotion-materials",
|
|
tags=["fund-promotion-materials"],
|
|
)
|
|
|
|
|
|
@router.post("")
|
|
async def create_task(
|
|
payload: PromotionTaskCreate,
|
|
context: RequestContext = Depends(build_request_context), # noqa: B008
|
|
key: str | None = Header(default=None, alias="Idempotency-Key"),
|
|
) -> dict[str, Any]:
|
|
return await PromotionMaterialService().create_task(payload, context, key)
|
|
|
|
|
|
@router.put("/{task_no}/inputs")
|
|
async def update_inputs(
|
|
task_no: str,
|
|
payload: PromotionInputsUpdate,
|
|
context: RequestContext = Depends(build_request_context), # noqa: B008
|
|
key: str | None = Header(default=None, alias="Idempotency-Key"),
|
|
) -> dict[str, Any]:
|
|
return await PromotionMaterialService().update_inputs(task_no, payload, context, key)
|
|
|
|
|
|
@router.post("/{task_no}/attachments")
|
|
async def add_attachment(
|
|
task_no: str,
|
|
file: UploadFile = File(...), # noqa: B008
|
|
attachment_type: str = Query(...),
|
|
context: RequestContext = Depends(build_request_context), # noqa: B008
|
|
key: str | None = Header(default=None, alias="Idempotency-Key"),
|
|
) -> dict[str, Any]:
|
|
payload = await file.read()
|
|
return await PromotionMaterialService().add_attachment(
|
|
task_no,
|
|
attachment_type,
|
|
file.filename or "attachment",
|
|
file.content_type or "application/octet-stream",
|
|
payload,
|
|
context,
|
|
key,
|
|
)
|
|
|
|
|
|
@router.post("/{task_no}/generations")
|
|
async def generate_material(
|
|
task_no: str,
|
|
payload: PromotionGenerationRequest,
|
|
context: RequestContext = Depends(build_request_context), # noqa: B008
|
|
key: str | None = Header(default=None, alias="Idempotency-Key"),
|
|
) -> dict[str, Any]:
|
|
return await PromotionMaterialService().generate(task_no, payload, context, key)
|
|
|
|
|
|
@router.get("/{task_no}/compliance-checks")
|
|
async def compliance_checks(
|
|
task_no: str,
|
|
context: RequestContext = Depends(build_request_context), # noqa: B008
|
|
session: AsyncSession = Depends(get_session), # noqa: B008
|
|
) -> dict[str, Any]:
|
|
return await PromotionMaterialService(session).compliance_checks(task_no, context)
|
|
|
|
|
|
@router.get("/{task_no}")
|
|
async def get_task(
|
|
task_no: str,
|
|
context: RequestContext = Depends(build_request_context), # noqa: B008
|
|
session: AsyncSession = Depends(get_session), # noqa: B008
|
|
) -> dict[str, Any]:
|
|
return await PromotionMaterialService(session).get_task(task_no, context)
|
|
|
|
|
|
@router.post("/{task_no}/reviews")
|
|
async def review_material(
|
|
task_no: str,
|
|
payload: PromotionReviewRequest,
|
|
context: RequestContext = Depends(build_request_context), # noqa: B008
|
|
key: str | None = Header(default=None, alias="Idempotency-Key"),
|
|
) -> dict[str, Any]:
|
|
return await PromotionMaterialService().review(task_no, payload, context, key)
|
|
|
|
|
|
@router.post("/{task_no}/deliveries")
|
|
async def deliver_material(
|
|
task_no: str,
|
|
payload: PromotionDeliveryRequest,
|
|
context: RequestContext = Depends(build_request_context), # noqa: B008
|
|
key: str | None = Header(default=None, alias="Idempotency-Key"),
|
|
) -> dict[str, Any]:
|
|
return await PromotionMaterialService().deliver(task_no, payload, context, key)
|