Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/master'

lizhikun 1 anno fa
parent
commit
0264112c59

+ 4 - 1
docs/table_head_doc/title_abnormal.csv

@@ -1 +1,4 @@
-nbsp
+nbsp
+...
+.
+..

+ 0 - 1
docs/table_head_doc/title_abnormal_contain.csv

@@ -1,4 +1,3 @@
 nbsp
 ...
-.
 ..

+ 24 - 6
tables/fields/NoField.py

@@ -18,6 +18,7 @@ class NoFieldChecker(object):
             "projectname": self.check_projectname,
             "buyer":self.check_buyer,
             "winner": self.check_winner,
+            "owner":self.check_owner,
             "budget": self.check_budget,
             "bidamount": self.check_bidamount,
             "area":self.check_region,
@@ -42,6 +43,19 @@ class NoFieldChecker(object):
                 return True
         return False
 
+    def check_owner(self,obj, catch_content: CatchContentObject) -> bool:
+        """
+        业主单位名称为空检测,除中标类型的标讯,其他类型标讯不检查这个字段是否为空
+        :param obj:代表一个item
+        :return:返回true 代表异常
+        """
+        subtype = obj.get("subtype", "")
+        if subtype in ["拟建"]:
+            owner = obj.get("owner")
+            if not owner:
+                return True
+        return False
+
     def check_winner(self,obj, catch_content: CatchContentObject) -> bool:
         """
         中标单位名称为空检测,除中标类型的标讯,其他类型标讯不检查这个字段是否为空
@@ -63,9 +77,11 @@ class NoFieldChecker(object):
         :param obj:代表一个item
         :return:返回true 代表异常
         """
-        buyer = obj.get("buyer")
-        if not buyer :
-            return True
+        subtype = obj.get("subtype", "")
+        if subtype not in ["拟建"]:
+            budget = obj.get("buyer")
+            if not budget:
+                return True
         return False
 
     def check_budget(self,obj, catch_content: CatchContentObject) -> bool:
@@ -119,9 +135,11 @@ class NoFieldChecker(object):
         :param obj:代表一个item
         :return:返回true 代表异常
         """
-        projectcode = obj.get("projectcode")
-        if not projectcode:
-            return True
+        toptype = obj.get("toptype", "")
+        if toptype  not in ["拟建","采购意向"]:
+            projectcode = obj.get("projectcode")
+            if not projectcode:
+                return True
         return False
 
     def check_subpackage(self,obj, catch_content: CatchContentObject) -> bool:

+ 1 - 1
tables/fields/budget.py

@@ -1,5 +1,5 @@
 """
-    中标金额字段检查
+    预算金额字段检查
 """
 
 

+ 14 - 9
tables/fields/projectname.py

@@ -103,12 +103,17 @@ class ProjectnameChecker(object):
                 if w[0] in projectname:
                     return True
         # 项目名称以异常字符结尾
-        with open(abnormal_config["table_field_config"]["path5"], "r") as f:
-            reads = csv.reader(f)
-            for w in reads:
-                if re.search(f"{w[0]}$", projectname) != None:
-                    return True
-        # 项目名称以异常字符开始
-        p1 = re.compile(r"^[3|6|7|8|0|\.]")
-        if p1.match(projectname):
-            return True
+        # with open(abnormal_config["table_field_config"]["path5"], "r") as f:
+        #     reads = csv.reader(f)
+        #     for w in reads:
+        #         if re.search(f"{w[0]}$", projectname) != None:
+        #             return True
+        p2 = re.search("[nbsp\..\...\.]$",projectname)
+        #re.search():匹配整个字符串,并返回第一个成功的匹配,如果匹配失败,则返回None
+        if p2!=None:
+            return True
+
+        #项目名称以异常字符开始
+        p1 = re.search("^[36780\.)]",projectname)
+        if p1!=None:
+            return True

+ 12 - 8
tables/fields/title.py

@@ -105,13 +105,17 @@ class TitleChecker(object):
                     return True
         #标题以异常字符结尾
         #re.search()匹配整个字符串,并返回第一个成功的匹配,如果匹配失败,则返回None
-        with open(abnormal_config["table_field_config"]["path5"], "r") as f:
-            reads = csv.reader(f)
-            for w in reads:
-                ret=re.search(f"{w[0]}$", title)
-                if  ret != None:
-                    return True
+        # with open(abnormal_config["table_field_config"]["path5"], "r") as f:
+        #     reads = csv.reader(f)
+        #     for w in reads:
+        #         ret=re.search(f"{w[0]}$", title)
+        #         if  (ret!= None) or (ret.group() == w[0]):
+        #             return True
+        p2 = re.search("[nbsp\..\...\.]$",title)
+        #re.search():匹配整个字符串,并返回第一个成功的匹配,如果匹配失败,则返回None
+        if p2!=None:
+            return True
         #标题以异常字符开始
-        p1 = re.compile(r"^[3|6|7|8|0|\.]")
-        if p1.match(title):
+        p1 = re.search("^[36780\.)]",title)
+        if p1!=None:
             return True