jialuyao 1 week ago
parent
commit
c384c1bc8c
5 changed files with 41 additions and 37 deletions
  1. 8 0
      .gitignore
  2. 28 34
      app.py
  3. 2 1
      client_mongo_mysql_liantong.py
  4. BIN
      tables/fields/__pycache__/winner.cpython-37.pyc
  5. 3 2
      tables/fields/s_winner.py

+ 8 - 0
.gitignore

@@ -7,6 +7,14 @@ node_modules/
 # 忽略所有 .tmp 和 .temp 文件
 *.tmp
 *.temp
+*.out
+*.out
+*.out
+*.out
+*.out
+*.out
+*.out
+*.out
 
 # 忽略 macOS 系统文件
 .DS_Store

+ 28 - 34
app.py

@@ -3,8 +3,7 @@ import inspect
 import csv
 from pymongo import MongoClient
 from docs.config import abnormal_config
-from tables.fields import bidamount
-from tables.fields.winner import WinnerChecker
+from tables.fields.s_winner import WinnerChecker
 from tables.fields.buyer import BuyerChecker
 from tables.fields.bidamount import BidAmountChecker
 from tables.fields.budget import BudgetChecker
@@ -108,7 +107,7 @@ def check_params(func, param_rows: dict, is_check_type=False) -> (bool, list):
     """
     函数传参数
     """
-    _default_params = {"attach_text": {}, "bidamount": 0, "budget": 0,"s_winner":"","bidopentime":0,"publishtime":0,"subtype":"","supervisorrate":0,"district":"金水区","com_package":[]}  # 必要参数的默认值
+    _default_params = {"attach_text": {}, "bidamount": 0, "budget": 0,"s_winner":"","bidopentime":0,"publishtime":0,"subtype":"","supervisorrate":0,"district":"金水区","com_package":[],"buyer":""}  # 必要参数的默认值
     func_params = inspect.getfullargspec(func)  # 取出函数的参数
     args_annotations = func_params.annotations  # 参数类型dict,取出参数类型
     args_list = func_params.args  # 参数list
@@ -212,7 +211,7 @@ def check(obj: any, rules) -> any:
 
 if __name__ == '__main__':
     row={
-    "comeintime" : int(1698739748),
+    "comeintime" : int(1698739748), 
     "area" : "内蒙古",
     "purchasingsource" : "[{\"start\": 13, \"verify\": \"确定\", \"direction\": \"h\", \"type\": \"识别\", \"header\": {\"itemname\": \"产品名称\", \"model\": \"技术规格\", \"number\": \"数量\", \"unitprice\": \"单价(元)\", \"totalprice\": \"金额(元)\"}, \"file_name\": \"公告\"}]",
     "toptype" : "结果",
@@ -259,11 +258,11 @@ if __name__ == '__main__':
     "basicClass" : "货物", 
     "rate" : "97%", 
     "autoid" : int(249351001), 
-    "bidamount" :5000,
+    # "bidamount" : 1034.1111,
     "bidway" : "电子投标", 
-    "budget" : 800,
+    "budget" : 30.0,
     "supervisorrate": 0.03,
-    "buyer" : "哈密市伊州区花园乡人民政府",
+    # "buyer" : "哈密市伊州区花园乡人民政府",
     "buyerclass" : "医疗", 
     "dataprocess" : int(8), 
     "description" : "二连浩特市人民医院在政采商城电子卖场完成协议供货直购采购,采购结果确认如下:一、项目概述采购编号:ELHTSZFCG-DD-2023-407774采购单位:二连浩特市人民医院所属区域:二连浩特市本级预算金额(元):15,440.00采购人及", 
@@ -277,8 +276,8 @@ if __name__ == '__main__':
     "projectname" : "二连浩特市人民医院台式计算机(等)直接订购", 
     "purchasing_tag" : "台式计算机,计算机,摄像头,液晶显示器,DR,M9,液晶,4G", 
     "s_subscopeclass" : "信息技术_其他,行政办公_通用办公设备", 
-    "s_topscopeclass" : "行政办公,信息技术,建筑工程",
-    "s_winner" : "二连浩特市智慧真彩文体办公院院",
+    "s_topscopeclass" : "行政办公,信息技术", 
+    "s_winner" : "玖宸(北京)科技有限公司",
     "subscopeclass" : [
         "信息技术_其他", 
         "行政办公_通用办公设备"
@@ -326,9 +325,6 @@ if __name__ == '__main__':
     ],
     "pici" : int(1698740066)
 }
-    # result = BidAmountChecker.check0701(100, 800, "建筑工程")
-    # if result:
-    #     print("警告:中标金额低于预算70%!")
     # result=check(row,rules={
     #     "bidamount": {
     #         "0101": {
@@ -561,13 +557,23 @@ if __name__ == '__main__':
     # #     }
     # })
     result = check(row, rules={
-        # "budget": {
-        #     "0401": {
-        #         "name": "预算金额 < 中标金额",
-        #         "parent_name": "金额错误",
-        #         "parent_code": "01"
-        #        }
-        #     },
+        "s_winner": {
+            "0103": {
+                "name": "包含叠词,异常词汇,特殊词汇",
+                "parent_name": "名称错误",
+                "parent_code": "01"
+            },
+            "0104": {
+                "name": "中标单位包含采购单位",
+                "parent_name": "名称错误",
+                "parent_code": "01"
+            },
+            "0301": {
+                "name": "中标单位名称长度<3",
+                "parent_name": "名称长度异常错误",
+                "parent_code": "03"
+            }
+        },
         # "entname": {
         #     },
         # "price": {
@@ -593,7 +599,7 @@ if __name__ == '__main__':
         #                 "parent_code": "02"
         #             }
         # },
-        "bidamount": {
+        # "bidamount": {
         #             "0101": {
         #                 "name": "互相校验(预算和中标金额的比例)",
         #                 "parent_name": "金额错误",
@@ -614,19 +620,7 @@ if __name__ == '__main__':
         #                 "name": "中标金额存在费率,折扣率",
         #                 "parent_name": "金额错误",
         #                 "parent_code": "01"
-        #             },
-        #               "0601": {
-        #                   "name": "中标金额 > 预算金额",
-        #                   "parent_name": "金额错误",
-        #                   "parent_code": "01"
-        #               },
-                      "0701": {
-                          "name": "建筑行业中标金额不在预算的 70%-130%范围",
-                          "parent_name": "金额错误",
-                          "parent_code": "01"
-                      }
-
-                },
+        #             }
+        #         },
     })
     print(result)
-

+ 2 - 1
client_mongo_mysql_liantong.py

@@ -113,10 +113,11 @@ def batch_load_data():
     conn = MysqlUtil.connect_to_mysql(host='172.20.45.129', port='4000', user='root', password='=PDT49#80Z!RVv52_z',database='quality')
 
     max_id = ObjectId("0" * 24)
-    # max_id = ObjectId("655ec5609aed6eb2ffa654ca")
+    # max_id = ObjectId("6881072ff0c6ad8b095d808e")
     # 查询条件:_id >= max_id, appid匹配,且 createtime 在 [start_date, end_date] 之间
     query = {
         "_id": {"$gte": max_id},
+        # "_id": max_id,
         "appid": "jyGQ1XQQsEAwNeSENOFR9D",
         "createtime": {"$gte": start_date, "$lte": end_date}
     }

BIN
tables/fields/__pycache__/winner.cpython-37.pyc


+ 3 - 2
tables/fields/winner.py → tables/fields/s_winner.py

@@ -314,6 +314,7 @@ class WinnerChecker(object):
         :param obj:代表一个item
         :return:返回true 代表异常
         """
-        if buyer in s_winner:
-            return True
+        if buyer:
+            if buyer in s_winner:
+                return True
         return False