Jelajahi Sumber

调整不动产单位匹配逻辑

weijianghai 1 bulan lalu
induk
melakukan
1d2207f3c6

+ 2 - 2
doc/sql.md

@@ -86,11 +86,11 @@ from
 select
     *
 from
-    common.request_log
+    common.nginx_log
 where
     login_id != 'test'
 order by
-    request_time desc
+    access_time desc
 ```
 
 ## 查询数据处理日志

+ 3 - 1
house/house-building/house_building.py

@@ -104,6 +104,8 @@ def data_process():
     def get_area_no(x):
         second_unit = x['资产所属单位(二级)']
         third_unit = x['资产所属单位(三级)']
+        if '河北' == second_unit:
+            return '-12'
         if '长途通信传输局' == second_unit:
             return '-11'
         if '保定' in second_unit and ('雄县' in third_unit or '容城' in third_unit or '安新' in third_unit):
@@ -113,7 +115,7 @@ def data_process():
             area_no = second_org['id']
             if area_name in second_unit:
                 return area_no
-        return '-12'
+        raise RuntimeError(f'二级组织机构编码匹配失败: {second_unit}')
 
     df['二级组织机构编码'] = df.apply(get_area_no, axis=1)  # 应用函数,生成二级组织机构编码列
 

+ 3 - 1
house/house-fang-jian/house_fang_jian.py

@@ -108,6 +108,8 @@ def data_process():
     def get_area_no(x):
         second_unit = x['资产所属单位(二级)']
         third_unit = x['资产所属单位(三级)']
+        if '河北' == second_unit:
+            return '-12'
         if '长途通信传输局' == second_unit:
             return '-11'
         if '保定' in second_unit and ('雄县' in third_unit or '容城' in third_unit or '安新' in third_unit):
@@ -117,7 +119,7 @@ def data_process():
             area_no = second_org['id']
             if area_name in second_unit:
                 return area_no
-        return '-12'
+        raise RuntimeError(f'二级组织机构编码匹配失败: {second_unit}')
 
     # 应用 get_area_no 函数,生成二级组织机构编码列
     df['二级组织机构编码'] = df.apply(get_area_no, axis=1)

+ 3 - 1
house/house-land/house_land.py

@@ -108,6 +108,8 @@ def data_process():
     def get_area_no(x):
         second_unit = x['资产所属单位(二级)']
         third_unit = x['资产所属单位(三级)']
+        if '河北' == second_unit:
+            return '-12'
         if '长途通信传输局' == second_unit:
             return '-11'
         if '保定' in second_unit and ('雄县' in third_unit or '容城' in third_unit or '安新' in third_unit):
@@ -117,7 +119,7 @@ def data_process():
             area_no = second_org['id']
             if area_name in second_unit:
                 return area_no
-        return '-12'
+        raise RuntimeError(f'二级组织机构编码匹配失败: {second_unit}')
 
 
     # 应用函数,生成“二级组织机构编码”列

+ 3 - 1
house/house-site/house_site.py

@@ -112,6 +112,8 @@ def data_process():
         """
         second_unit = x['资产所属单位(二级)']
         third_unit = x['资产所属单位(三级)']
+        if '河北' == second_unit:
+            return '-12'
         if '长途通信传输局' == second_unit:
             return '-11'
         if '保定' in second_unit and ('雄县' in third_unit or '容城' in third_unit or '安新' in third_unit):
@@ -121,7 +123,7 @@ def data_process():
             area_no = second_org['id']
             if area_name in second_unit:
                 return area_no
-        return '-12'
+        raise RuntimeError(f'二级组织机构编码匹配失败: {second_unit}')
 
 
     df['二级组织机构编码'] = df.apply(get_area_no, axis=1)

+ 3 - 1
house/house-zu-ru-he-tong/house_zu_ru_he_tong.py

@@ -99,6 +99,8 @@ def data_process():
     def get_area_no(x):
         """根据使用单位隶属的地市级公司名称获取二级组织机构编码"""
         second_unit = x['使用单位隶属的地市级公司']
+        if '河北' == second_unit:
+            return '-12'
         if '长途通信传输局' == second_unit:
             return '-11'
         for second_org in second_orgs:
@@ -106,7 +108,7 @@ def data_process():
             area_no = second_org['id']
             if area_name in second_unit:
                 return area_no
-        return '-12'
+        raise RuntimeError(f'二级组织机构编码匹配失败: {second_unit}')
 
     df['二级组织机构编码'] = df.apply(get_area_no, axis=1)