新增m_date周边
This commit is contained in:
@@ -2,9 +2,10 @@
|
|||||||
小区周边1公里银行入库业务逻辑
|
小区周边1公里银行入库业务逻辑
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
from goojia_utils import MAIN_MONGO_CLIENT, process_dataframe_multithread
|
from goojia_utils import MAIN_MONGO_CLIENT, process_dataframe_multithread, dateutils
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
from pymongo import UpdateOne
|
from pymongo import UpdateOne
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
import poiutils
|
import poiutils
|
||||||
|
|
||||||
@@ -75,7 +76,7 @@ def sync_new(distance=3000):
|
|||||||
action = UpdateOne({'city': item['city'], 'region': item['region'],
|
action = UpdateOne({'city': item['city'], 'region': item['region'],
|
||||||
'district_name': item['name']},
|
'district_name': item['name']},
|
||||||
{'$set': {'bank': item['bank'], 'city': item['city'], 'region': item['region'],
|
{'$set': {'bank': item['bank'], 'city': item['city'], 'region': item['region'],
|
||||||
'district_name': item['name'], 'lng': item['lng'], 'lat': item['lat'], 'distance': distance}},
|
'district_name': item['name'], 'lng': item['lng'], 'lat': item['lat'], 'm_date': datetime.now(), 'distance': distance}},
|
||||||
upsert=True)
|
upsert=True)
|
||||||
actions.append(action)
|
actions.append(action)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -111,7 +112,7 @@ def sync1():
|
|||||||
action = UpdateOne({'city': item['city'], 'region': item['region'],
|
action = UpdateOne({'city': item['city'], 'region': item['region'],
|
||||||
'district_name': item['name']},
|
'district_name': item['name']},
|
||||||
{'$set': {'bank': item['bank'], 'city': item['city'], 'region': item['region'],
|
{'$set': {'bank': item['bank'], 'city': item['city'], 'region': item['region'],
|
||||||
'district_name': item['name'], 'lng': item['lng'], 'lat': item['lat']}},
|
'district_name': item['name'], 'lng': item['lng'], 'lat': item['lat'], 'm_date': datetime.now()}},
|
||||||
upsert=True)
|
upsert=True)
|
||||||
actions.append(action)
|
actions.append(action)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ from goojia_utils import MAIN_MONGO_CLIENT, process_dataframe_multithread
|
|||||||
import pandas as pd
|
import pandas as pd
|
||||||
from pymongo import UpdateOne
|
from pymongo import UpdateOne
|
||||||
import poiutils
|
import poiutils
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -58,7 +59,7 @@ def sync_new(distance=3000):
|
|||||||
action = UpdateOne({'city': item['city'], 'region': item['region'],
|
action = UpdateOne({'city': item['city'], 'region': item['region'],
|
||||||
'district_name': item['name']},
|
'district_name': item['name']},
|
||||||
{'$set': {'bus': item['bus'], 'city': item['city'], 'region': item['region'],
|
{'$set': {'bus': item['bus'], 'city': item['city'], 'region': item['region'],
|
||||||
'district_name': item['name'], 'lng': item['lng'], 'lat': item['lat'], 'distance': distance}},
|
'district_name': item['name'], 'lng': item['lng'], 'lat': item['lat'], 'm_date': datetime.now(), 'distance': distance}},
|
||||||
upsert=True)
|
upsert=True)
|
||||||
actions.append(action)
|
actions.append(action)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -95,7 +96,7 @@ def sync1():
|
|||||||
action = UpdateOne({'city': item['city'], 'region': item['region'],
|
action = UpdateOne({'city': item['city'], 'region': item['region'],
|
||||||
'district_name': item['name']},
|
'district_name': item['name']},
|
||||||
{'$set': {'bus': item['bus'], 'city': item['city'], 'region': item['region'],
|
{'$set': {'bus': item['bus'], 'city': item['city'], 'region': item['region'],
|
||||||
'district_name': item['name'], 'lng': item['lng'], 'lat': item['lat']}},
|
'district_name': item['name'], 'lng': item['lng'], 'lat': item['lat'], 'm_date': datetime.now()}},
|
||||||
upsert=True)
|
upsert=True)
|
||||||
actions.append(action)
|
actions.append(action)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import poiutils
|
|||||||
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
from pymongo import UpdateOne
|
from pymongo import UpdateOne
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -62,7 +63,7 @@ def sync_new(distance=3000):
|
|||||||
'district_name': item['name']}, {
|
'district_name': item['name']}, {
|
||||||
'$set': {'hospital': item['hospital'], 'city': item['city'],
|
'$set': {'hospital': item['hospital'], 'city': item['city'],
|
||||||
'region': item['region'],
|
'region': item['region'],
|
||||||
'district_name': item['name'], 'lng': item['lng'], 'lat': item['lat'], 'distance': distance}},
|
'district_name': item['name'], 'lng': item['lng'], 'lat': item['lat'], 'm_date': datetime.now(), 'distance': distance}},
|
||||||
upsert=True)
|
upsert=True)
|
||||||
actions.append(action)
|
actions.append(action)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -100,7 +101,7 @@ def sync1():
|
|||||||
'district_name': item['name']}, {
|
'district_name': item['name']}, {
|
||||||
'$set': {'hospital': item['hospital'], 'city': item['city'],
|
'$set': {'hospital': item['hospital'], 'city': item['city'],
|
||||||
'region': item['region'],
|
'region': item['region'],
|
||||||
'district_name': item['name'], 'lng': item['lng'], 'lat': item['lat']}},
|
'district_name': item['name'], 'lng': item['lng'], 'lat': item['lat'], 'm_date': datetime.now()}},
|
||||||
upsert=True)
|
upsert=True)
|
||||||
actions.append(action)
|
actions.append(action)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ from goojia_utils import MAIN_MONGO_CLIENT, process_dataframe_multithread
|
|||||||
import pandas as pd
|
import pandas as pd
|
||||||
from pymongo import UpdateOne
|
from pymongo import UpdateOne
|
||||||
import poiutils
|
import poiutils
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -60,7 +61,7 @@ def sync_new(distance=3000):
|
|||||||
# 周边配套库中历史原因,id可能不为小区id
|
# 周边配套库中历史原因,id可能不为小区id
|
||||||
action = UpdateOne({'city': item['city'], 'region': item['region'],
|
action = UpdateOne({'city': item['city'], 'region': item['region'],
|
||||||
'district_name': item['name']}, {'$set': {'school': item['school'], 'city': item['city'], 'region': item['region'],
|
'district_name': item['name']}, {'$set': {'school': item['school'], 'city': item['city'], 'region': item['region'],
|
||||||
'district_name': item['name'], 'lng': item['lng'], 'lat': item['lat'], 'distance': distance}}, upsert=True)
|
'district_name': item['name'], 'lng': item['lng'], 'lat': item['lat'], 'm_date': datetime.now(), 'distance': distance}}, upsert=True)
|
||||||
actions.append(action)
|
actions.append(action)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
@@ -93,7 +94,7 @@ def sync1():
|
|||||||
# 周边配套库中历史原因,id可能不为小区id
|
# 周边配套库中历史原因,id可能不为小区id
|
||||||
action = UpdateOne({'city': item['city'], 'region': item['region'],
|
action = UpdateOne({'city': item['city'], 'region': item['region'],
|
||||||
'district_name': item['name']}, {'$set': {'school': item['school'], 'city': item['city'], 'region': item['region'],
|
'district_name': item['name']}, {'$set': {'school': item['school'], 'city': item['city'], 'region': item['region'],
|
||||||
'district_name': item['name'], 'lng': item['lng'], 'lat': item['lat']}}, upsert=True)
|
'district_name': item['name'], 'lng': item['lng'], 'lat': item['lat'], 'm_date': datetime.now()}}, upsert=True)
|
||||||
actions.append(action)
|
actions.append(action)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ from goojia_utils import MAIN_MONGO_CLIENT, ElasticSearchClient, process_datafra
|
|||||||
import pandas as pd
|
import pandas as pd
|
||||||
from pymongo import UpdateOne
|
from pymongo import UpdateOne
|
||||||
import poiutils
|
import poiutils
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -60,7 +61,7 @@ def sync_new(distance=3000):
|
|||||||
action = UpdateOne({'city': item['city'], 'region': item['region'],
|
action = UpdateOne({'city': item['city'], 'region': item['region'],
|
||||||
'district_name': item['name']},
|
'district_name': item['name']},
|
||||||
{'$set': {'subway': item['subway'], 'city': item['city'], 'region': item['region'],
|
{'$set': {'subway': item['subway'], 'city': item['city'], 'region': item['region'],
|
||||||
'district_name': item['name'], 'lng': item['lng'], 'lat': item['lat'],
|
'district_name': item['name'], 'lng': item['lng'], 'lat': item['lat'], 'm_date': datetime.now(),
|
||||||
'distance': distance}}, upsert=True)
|
'distance': distance}}, upsert=True)
|
||||||
actions.append(action)
|
actions.append(action)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -98,7 +99,7 @@ def sync1():
|
|||||||
action = UpdateOne({'city': item['city'], 'region': item['region'],
|
action = UpdateOne({'city': item['city'], 'region': item['region'],
|
||||||
'district_name': item['name']},
|
'district_name': item['name']},
|
||||||
{'$set': {'subway': item['subway'], 'city': item['city'], 'region': item['region'],
|
{'$set': {'subway': item['subway'], 'city': item['city'], 'region': item['region'],
|
||||||
'district_name': item['name'], 'lng': item['lng'], 'lat': item['lat']}},
|
'district_name': item['name'], 'lng': item['lng'], 'lat': item['lat'], 'm_date': datetime.now()}},
|
||||||
upsert=True)
|
upsert=True)
|
||||||
actions.append(action)
|
actions.append(action)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ from goojia_utils import MAIN_MONGO_CLIENT, process_dataframe_multithread
|
|||||||
import pandas as pd
|
import pandas as pd
|
||||||
from pymongo import UpdateOne
|
from pymongo import UpdateOne
|
||||||
import poiutils
|
import poiutils
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -55,7 +56,7 @@ def sync_new():
|
|||||||
# 周边配套库中历史原因,id可能不为小区id
|
# 周边配套库中历史原因,id可能不为小区id
|
||||||
action = UpdateOne({'city': item['city'], 'region': item['region'],
|
action = UpdateOne({'city': item['city'], 'region': item['region'],
|
||||||
'district_name': item['name']}, {'$set': {'supermarket': item['supermarket'], 'city': item['city'], 'region': item['region'],
|
'district_name': item['name']}, {'$set': {'supermarket': item['supermarket'], 'city': item['city'], 'region': item['region'],
|
||||||
'district_name': item['name'], 'lng': item['lng'], 'lat': item['lat']}}, upsert=True)
|
'district_name': item['name'], 'lng': item['lng'], 'lat': item['lat'], 'm_date': datetime.now()}}, upsert=True)
|
||||||
actions.append(action)
|
actions.append(action)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
@@ -89,7 +90,7 @@ def sync1():
|
|||||||
# 周边配套库中历史原因,id可能不为小区id
|
# 周边配套库中历史原因,id可能不为小区id
|
||||||
action = UpdateOne({'city': item['city'], 'region': item['region'],
|
action = UpdateOne({'city': item['city'], 'region': item['region'],
|
||||||
'district_name': item['name']}, {'$set': {'supermarket': item['supermarket'], 'city': item['city'], 'region': item['region'],
|
'district_name': item['name']}, {'$set': {'supermarket': item['supermarket'], 'city': item['city'], 'region': item['region'],
|
||||||
'district_name': item['name'], 'lng': item['lng'], 'lat': item['lat']}}, upsert=True)
|
'district_name': item['name'], 'lng': item['lng'], 'lat': item['lat'], 'm_date': datetime.now()}}, upsert=True)
|
||||||
actions.append(action)
|
actions.append(action)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
|
|||||||
Reference in New Issue
Block a user