liumiaomiao 1 年間 前
コミット
9334973d2e
2 ファイル変更27 行追加15 行削除
  1. 9 14
      app.py
  2. 18 1
      tables/fields/bidamount.py

+ 9 - 14
app.py

@@ -66,7 +66,7 @@ def check_params(func, param_rows: dict, is_check_type=False) -> (bool, list):
     """
     函数传参数
     """
-    _default_params = {"attach_text": {}, "bidamount": 0, "budget": 0}  # 必要参数的默认值
+    _default_params = {"attach_text": {}, "bidamount": 0, "budget": 0,"supervisorrate":0}  # 必要参数的默认值
     func_params = inspect.getfullargspec(func)  # 取出函数的参数
     args_annotations = func_params.annotations  # 参数类型dict,取出参数类型
     args_list = func_params.args  # 参数list
@@ -192,7 +192,8 @@ if __name__ == '__main__':
     "autoid" : int(249351001), 
     "bidamount" : 15440.0, 
     "bidway" : "电子投标", 
-    "budget" : 15440.0, 
+    "budget" : 15440.0,
+    "supervisorrate": 0.03,
     "buyer" : "二连浩特市人民医院", 
     "buyerclass" : "医疗", 
     "dataprocess" : int(8), 
@@ -221,20 +222,14 @@ if __name__ == '__main__':
     "winner" : "二连浩特市智慧真彩文体办公",
     "pici" : int(1698740066)
 }
-    result=check(row,rules={ "purchasinglist" : {
-            "0101" : {
-                "name" : "标的物评估",
-                "parent_name" : "标的物",
-                "parent_code" : "01"
+    result=check(row,rules={
+        "bidamount" : {
+            "0104": {
+                "name": "中标金额存在费率,折扣率",
+                "parent_name": "金额错误",
+                "parent_code": "01",
             }
         },
-        "title": {
-            "0101": {
-                "name": "<=5个字",
-                "parent_name": "长度类型",
-                "parent_code": "01"
-            }
-        }
     })
 
     print(result)

+ 18 - 1
tables/fields/bidamount.py

@@ -21,7 +21,13 @@ class BidAmountChecker(object):
                 "parent_name": "金额错误",
                 "parent_code": "01",
                 "checkFn": self.check0102
-            }
+            },
+            "0104": {
+                "name": "中标金额存在费率,折扣率",
+                "parent_name": "金额错误",
+                "parent_code": "01",
+                "checkFn": self.check0104
+            },
         }
 
     @staticmethod
@@ -51,3 +57,14 @@ class BidAmountChecker(object):
         if 100 < bidamount < 1000000000:
             return False
         return True
+
+    @staticmethod
+    def check0104(supervisorrate:float) -> bool:
+        """
+        中标金额存在费率,折扣率
+        :param price:
+        :return: 返回true 代表异常
+        """
+        if supervisorrate==0 :
+            return False
+        return True