提交
This commit is contained in:
1 parent
427bcb1551
commit
31b04575e2
247 files changed
+39284
-20367
No files matched your search
@@ -5,6 +5,8 @@ from __future__ import annotations
|
||||
from decimal import Decimal
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
from app.services.protocol_payment_installment import is_legacy_installment_ratios
|
||||
|
||||
LOCKED_STATUSES = frozenset({"jfqrz", "yjf", "tfqrz", "ytf"})
|
||||
BLOCKING_STATUSES = frozenset({"jfqrz", "tfqrz", "ytf"})
|
||||
|
||||
@@ -67,11 +69,14 @@ def validate_payment_details_for_save(
|
||||
if installment_advance_days is not None and int(installment_advance_days) < 0:
|
||||
raise ValueError("应缴费提前天数不能为负数")
|
||||
if installment_ratios is not None:
|
||||
ratios = [float(x) for x in installment_ratios]
|
||||
if len(ratios) != count:
|
||||
raise ValueError("缴费比例数量须与分期期数一致")
|
||||
if abs(sum(ratios) - 100.0) > 0.01:
|
||||
raise ValueError("缴费比例之和须等于 100%")
|
||||
values = [float(x) for x in installment_ratios]
|
||||
if len(values) != count:
|
||||
raise ValueError("分期金额数量须与分期期数一致")
|
||||
if is_legacy_installment_ratios(values, Decimal(str(contract)) if contract else None):
|
||||
if abs(sum(values) - 100.0) > 0.01:
|
||||
raise ValueError("缴费比例之和须等于 100%")
|
||||
elif contract and abs(sum(values) - contract) > 0.015:
|
||||
raise ValueError("分期金额合计须等于合同金额")
|
||||
if len(rows) != count:
|
||||
raise ValueError(f"分期明细条数应等于分期期数({count})")
|
||||
fq_forbidden = frozenset({"jfqrz", "tfqrz", "ytf"})
|
||||
|
||||
Reference in new issue
Block a user