|
|
@@ -1,10 +1,8 @@
|
|
|
import datetime
|
|
|
from fastapi import APIRouter, Depends, Query
|
|
|
-from typing import Any, List, Union, Optional
|
|
|
-import json
|
|
|
+from typing import Any, Union, Optional
|
|
|
import os
|
|
|
import logging
|
|
|
-from datetime import datetime
|
|
|
from alien_store.api.deps import get_contract_service
|
|
|
from alien_store.schemas.request.contract_store import TemplatesCreate, SignUrl
|
|
|
from alien_store.schemas.response.contract_store import (
|
|
|
@@ -227,10 +225,27 @@ async def get_contract_detail(
|
|
|
async def get_all_templates(
|
|
|
page: int = Query(1, ge=1, description="页码,从1开始"),
|
|
|
page_size: int = Query(10, ge=1, le=100, description="每页条数,默认10"),
|
|
|
+ store_name: Optional[str] = Query(None, description="店铺名称(模糊查询)"),
|
|
|
+ merchant_name: Optional[str] = Query(None, description="商家姓名(模糊查询)"),
|
|
|
+ signing_status: Optional[str] = Query(None, description="签署状态"),
|
|
|
+ business_segment: Optional[str] = Query(None, description="经营板块"),
|
|
|
+ store_status: Optional[str] = Query(None, description="店铺状态:正常/禁用"),
|
|
|
+ expiry_start: Optional[datetime] = Query(None, description="到期时间起"),
|
|
|
+ expiry_end: Optional[datetime] = Query(None, description="到期时间止"),
|
|
|
templates_server: ContractServer = Depends(get_contract_service)
|
|
|
) -> PaginatedResponse:
|
|
|
- """分页查询所有合同"""
|
|
|
- rows, total = await templates_server.list_all_paged(page, page_size)
|
|
|
+ """分页查询所有合同,支持筛选"""
|
|
|
+ rows, total = await templates_server.list_all_paged(
|
|
|
+ page,
|
|
|
+ page_size,
|
|
|
+ store_name=store_name,
|
|
|
+ merchant_name=merchant_name,
|
|
|
+ signing_status=signing_status,
|
|
|
+ business_segment=business_segment,
|
|
|
+ store_status=store_status,
|
|
|
+ expiry_start=expiry_start,
|
|
|
+ expiry_end=expiry_end,
|
|
|
+ )
|
|
|
total_pages = (total + page_size - 1) // page_size if total > 0 else 0
|
|
|
|
|
|
items = [ContractStoreResponse(**row) for row in rows]
|
|
|
@@ -304,7 +319,6 @@ async def esign_callback(
|
|
|
contract_download_url = download_json["data"]["files"][0]["downloadUrl"]
|
|
|
except Exception as e:
|
|
|
logger.error(f"file_download_url failed for sign_flow_id={sign_flow_id}: {e}")
|
|
|
- print(contract_download_url,666666666666666666666666666666)
|
|
|
updated = await templates_server.mark_signed_by_phone(contact_phone, sign_flow_id, signing_dt, contract_download_url)
|
|
|
logger.info(f"esign_callback success phone={contact_phone}, sign_flow_id={sign_flow_id}, updated={updated}")
|
|
|
return SuccessResponse(code="200", msg="success")
|