提交 0b43aa91 作者: 薛凌堃

更新企业基本信息采集

上级 caa8a15c
...@@ -9,7 +9,8 @@ import json ...@@ -9,7 +9,8 @@ import json
from kafka import KafkaProducer from kafka import KafkaProducer
from base.BaseCore import BaseCore from base.BaseCore import BaseCore
from getQccId import find_id_by_name from getQccId import find_id_by_name
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
baseCore = BaseCore() baseCore = BaseCore()
cnx_ = baseCore.cnx cnx_ = baseCore.cnx
cursor_ = baseCore.cursor cursor_ = baseCore.cursor
...@@ -336,8 +337,8 @@ if __name__ == '__main__': ...@@ -336,8 +337,8 @@ if __name__ == '__main__':
continue continue
start_time = time.time() start_time = time.time()
# 获取企业信息 # 获取企业信息
social_code = baseCore.redicPullData('BaseInfoEnterprise:gnqy_socialCode') # social_code = baseCore.redicPullData('BaseInfoEnterprise:gnqy_socialCode')
# social_code = '91330000734530895W' social_code = '91130800757548430L'
if social_code == '' or social_code is None: if social_code == '' or social_code is None:
time.sleep(20) time.sleep(20)
continue continue
...@@ -361,7 +362,7 @@ if __name__ == '__main__': ...@@ -361,7 +362,7 @@ if __name__ == '__main__':
if company_id == 'null': if company_id == 'null':
log.info('=====搜索不到该企业====') log.info('=====搜索不到该企业====')
#todo:搜不到的企业没有信用代码 传输不过去 生成一个信用代码 #todo:搜不到的企业没有信用代码 传输不过去 生成一个信用代码
baseCore.rePutIntoR('global100:baseinfo', social_code + ':搜索不到') baseCore.rePutIntoR('BaseInfoEnterprise:gnqy_socialCode', social_code + ':搜索不到')
continue continue
if not company_id: if not company_id:
log.info(com_name + ":企业ID获取失败===重新放入redis") log.info(com_name + ":企业ID获取失败===重新放入redis")
...@@ -406,7 +407,7 @@ if __name__ == '__main__': ...@@ -406,7 +407,7 @@ if __name__ == '__main__':
} }
name_list.append(name_compile) name_list.append(name_compile)
nowtime = baseCore.getNowTime(1).replace('-', '_')[:10] nowtime = baseCore.getNowTime(1).replace('-', '_')[:10]
baseCore.writerToExcel(name_list, f'企业名称对比_{nowtime}.xlsx') baseCore.writerToExcel(name_list, f'企业名称对比.xlsx')
log.info(f'采集{com_name}成功=======耗时{baseCore.getTimeCost(start_time,time.time())}') log.info(f'采集{com_name}成功=======耗时{baseCore.getTimeCost(start_time,time.time())}')
try: try:
producer = KafkaProducer(bootstrap_servers=['114.115.159.144:9092'], api_version=(2, 0, 2)) producer = KafkaProducer(bootstrap_servers=['114.115.159.144:9092'], api_version=(2, 0, 2))
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论