|
@@ -11,7 +11,7 @@ class BidAmountChecker(object):
|
|
|
def __init__(self):
|
|
|
self.errors_tables = {
|
|
|
"0101": {
|
|
|
- "name": "预算/中标金额不在:[0.7,1.3]",
|
|
|
+ "name": "建筑行业,预算/中标金额不在:[0.7,1.3]",
|
|
|
"parent_name": "金额错误",
|
|
|
"parent_code": "01",
|
|
|
"checkFn": self.check0101
|
|
@@ -45,73 +45,72 @@ class BidAmountChecker(object):
|
|
|
"parent_name": "金额错误",
|
|
|
"parent_code": "01",
|
|
|
"checkFn": self.check0601
|
|
|
- },
|
|
|
- "0701": {
|
|
|
- "name": "建筑行业中标金额不在预算的 70%-130%范围",
|
|
|
- "parent_name": "金额错误",
|
|
|
- "parent_code": "01",
|
|
|
- "checkFn": self.check0701
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@staticmethod
|
|
|
- def check0101(budget: float, bidamount: float) -> bool:
|
|
|
+ def check0101(budget: float, bidamount: float,s_topscopeclass:str,subtype:str) -> bool:
|
|
|
"""
|
|
|
预算和中标金额的比例
|
|
|
:param budget:
|
|
|
:param amount:
|
|
|
:return:返回true 代表异常
|
|
|
"""
|
|
|
- if budget and bidamount:
|
|
|
- if 0.7 < budget / bidamount < 1.3:
|
|
|
- return False
|
|
|
- else:
|
|
|
- return True
|
|
|
- else:
|
|
|
- # 两者中有一方为空不判断,---0,None,空字符,空字符串都是空
|
|
|
- return False
|
|
|
+ if subtype in ("中标","成交","合同","验收"):
|
|
|
+ if "建筑工程" in s_topscopeclass or "建筑" in s_topscopeclass:
|
|
|
+ if budget and bidamount:
|
|
|
+ if 0.7 < budget / bidamount < 1.3:
|
|
|
+ return False
|
|
|
+ else:
|
|
|
+ return True
|
|
|
+ else:
|
|
|
+ # 两者中有一方为空不判断,---0,None,空字符,空字符串都是空
|
|
|
+ return False
|
|
|
|
|
|
@staticmethod
|
|
|
- def check0102(bidamount: float) -> bool:
|
|
|
+ def check0102(bidamount: float,subtype:str) -> bool:
|
|
|
"""
|
|
|
中标金额过大过小[100,10亿]
|
|
|
:param price:
|
|
|
:return: 返回true 代表异常
|
|
|
"""
|
|
|
- if 100 < bidamount < 1000000000:
|
|
|
- return False
|
|
|
- return True
|
|
|
+ if subtype in ("中标", "成交", "合同", "验收"):
|
|
|
+ if 100 < bidamount < 1000000000:
|
|
|
+ return False
|
|
|
+ return True
|
|
|
|
|
|
@staticmethod
|
|
|
- def check0103(bidamount: float) -> bool:
|
|
|
+ def check0103(bidamount: float,subtype:str) -> bool:
|
|
|
"""
|
|
|
中标金额小数点位数超过4位,视为异常
|
|
|
:param price:
|
|
|
:return: 返回true 代表异常
|
|
|
"""
|
|
|
- # 将数字转换为字符串
|
|
|
- number_str = str(bidamount)
|
|
|
- # 检查是否有小数点
|
|
|
- if '.' in number_str:
|
|
|
- # 分割整数部分和小数部分
|
|
|
- integer_part, decimal_part = number_str.split('.')
|
|
|
- # 返回小数部分的长度
|
|
|
- length= len(decimal_part)
|
|
|
- else:
|
|
|
- length = 0
|
|
|
- if length > 4 :
|
|
|
- return True
|
|
|
+ if subtype in ("中标", "成交", "合同", "验收"):
|
|
|
+ # 将数字转换为字符串
|
|
|
+ number_str = str(bidamount)
|
|
|
+ # 检查是否有小数点
|
|
|
+ if '.' in number_str:
|
|
|
+ # 分割整数部分和小数部分
|
|
|
+ integer_part, decimal_part = number_str.split('.')
|
|
|
+ # 返回小数部分的长度
|
|
|
+ length= len(decimal_part)
|
|
|
+ else:
|
|
|
+ length = 0
|
|
|
+ if length > 4:
|
|
|
+ return True
|
|
|
|
|
|
@staticmethod
|
|
|
- def check0104(supervisorrate:float) -> bool:
|
|
|
+ def check0104(supervisorrate:float,subtype:str) -> bool:
|
|
|
"""
|
|
|
中标金额存在费率,折扣率
|
|
|
:param price:
|
|
|
:return: 返回true 代表异常
|
|
|
"""
|
|
|
- if supervisorrate==0 :
|
|
|
- return False
|
|
|
- return True
|
|
|
+ if subtype in ("中标", "成交", "合同", "验收"):
|
|
|
+ if supervisorrate==0:
|
|
|
+ return False
|
|
|
+ return True
|
|
|
|
|
|
@staticmethod
|
|
|
def check0301(bidamount: float) -> bool :
|
|
@@ -124,27 +123,13 @@ class BidAmountChecker(object):
|
|
|
return False
|
|
|
|
|
|
@staticmethod
|
|
|
- def check0601(bidamount: float,budget:float) -> bool:
|
|
|
+ def check0601(bidamount: float,budget:float,subtype:str) -> bool:
|
|
|
"""
|
|
|
中标金额>预算,视为异常
|
|
|
:return: 返回true 代表异常
|
|
|
"""
|
|
|
- if bidamount > budget:
|
|
|
- return True
|
|
|
- return False
|
|
|
-
|
|
|
- @staticmethod
|
|
|
- def check0701(bidamount: float, budget: float,s_topscopeclass:str) -> bool:
|
|
|
- """
|
|
|
- 建筑行业中标金额不在预算的 70%-130%范围,视为异常
|
|
|
- :return: 返回true 代表异常
|
|
|
- """
|
|
|
- if s_topscopeclass in ["建筑", "建筑工程"]:
|
|
|
- # 独立判断1:低于70%
|
|
|
- if bidamount < budget * 0.7:
|
|
|
+ if subtype in ("中标", "成交", "合同", "验收"):
|
|
|
+ if bidamount > budget:
|
|
|
return True
|
|
|
- # 独立判断2:高于130%
|
|
|
- if bidamount > budget * 1.3:
|
|
|
- return True
|
|
|
- return False
|
|
|
+ return False
|
|
|
|