fix: replace uuid.uuid4() with getID() from appPublic.uniqueID for all table ID generation
This commit is contained in:
parent
aa5c2c58df
commit
dc1908f316
@ -1,6 +1,7 @@
|
||||
from datetime import datetime, timedelta
|
||||
from typing import List, Dict, Optional
|
||||
import uuid
|
||||
from appPublic.uniqueID import getID
|
||||
import re
|
||||
|
||||
from ahserver.serverenv import ServerEnv
|
||||
@ -33,7 +34,7 @@ async def create_customer(
|
||||
db.databases = config.databases
|
||||
|
||||
async with db.sqlorContext(dbname) as sor:
|
||||
customer_id = str(uuid.uuid4()).replace('-', '')
|
||||
customer_id = getID()
|
||||
|
||||
# 数据校验
|
||||
await validate_customer_data(sor, phone, tax_id, customer_type)
|
||||
@ -104,7 +105,7 @@ async def initiate_handover(
|
||||
raise ValueError("只能交接活跃状态的客户")
|
||||
|
||||
# 创建交接记录
|
||||
handover_id = str(uuid.uuid4()).replace('-', '')
|
||||
handover_id = getID()
|
||||
handover_data = {
|
||||
"id": handover_id,
|
||||
"customer_id": customer_id,
|
||||
@ -131,7 +132,7 @@ async def generate_handover_items(sor, handover_id: str, customer_id: str):
|
||||
|
||||
# 基本信息
|
||||
items.append({
|
||||
"id": str(uuid.uuid4()).replace('-', ''),
|
||||
"id": getID(),
|
||||
"handover_id": handover_id,
|
||||
"item_type": "basic_info",
|
||||
"item_description": "客户基本信息和联系记录",
|
||||
@ -150,7 +151,7 @@ async def generate_handover_items(sor, handover_id: str, customer_id: str):
|
||||
if opportunities:
|
||||
for opp in opportunities:
|
||||
items.append({
|
||||
"id": str(uuid.uuid4()).replace('-', ''),
|
||||
"id": getID(),
|
||||
"handover_id": handover_id,
|
||||
"item_type": "opportunities",
|
||||
"item_id": opp["id"],
|
||||
@ -165,7 +166,7 @@ async def generate_handover_items(sor, handover_id: str, customer_id: str):
|
||||
if contracts:
|
||||
for contract in contracts:
|
||||
items.append({
|
||||
"id": str(uuid.uuid4()).replace('-', ''),
|
||||
"id": getID(),
|
||||
"handover_id": handover_id,
|
||||
"item_type": "contracts",
|
||||
"item_id": contract["id"],
|
||||
@ -185,7 +186,7 @@ async def generate_handover_items(sor, handover_id: str, customer_id: str):
|
||||
if service_tickets:
|
||||
for ticket in service_tickets:
|
||||
items.append({
|
||||
"id": str(uuid.uuid4()).replace('-', ''),
|
||||
"id": getID(),
|
||||
"handover_id": handover_id,
|
||||
"item_type": "service_tickets",
|
||||
"item_id": ticket["id"],
|
||||
@ -205,7 +206,7 @@ async def generate_handover_items(sor, handover_id: str, customer_id: str):
|
||||
if payment_issues:
|
||||
for issue in payment_issues:
|
||||
items.append({
|
||||
"id": str(uuid.uuid4()).replace('-', ''),
|
||||
"id": getID(),
|
||||
"handover_id": handover_id,
|
||||
"item_type": "payment_issues",
|
||||
"item_id": issue["id"],
|
||||
@ -382,7 +383,7 @@ async def recycle_to_pool(customer_id: str, inactive_days: int = None, reason: s
|
||||
raise ValueError("客户已在公海池中")
|
||||
|
||||
# 创建公海记录
|
||||
pool_id = str(uuid.uuid4()).replace('-', '')
|
||||
pool_id = getID()
|
||||
pool_data = {
|
||||
"id": pool_id,
|
||||
"customer_id": customer_id,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user