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