临时提交
This commit is contained in:
parent
3a6ab2d99c
commit
51c6d0808c
|
@ -1,8 +1,38 @@
|
|||
import os
|
||||
import json
|
||||
import functools
|
||||
|
||||
from flask import request
|
||||
|
||||
from setting import API_SECRET
|
||||
from setting import API_SECRET, APP_NAME
|
||||
|
||||
|
||||
def file_path(param):
|
||||
"""
|
||||
返回文件真实路径
|
||||
避免因为文件路径问题带来的麻烦
|
||||
Parameters:
|
||||
param: 文件相对路径
|
||||
Returns:
|
||||
path: 文件真实路径
|
||||
"""
|
||||
abs_path = os.path.abspath(os.path.dirname(__file__))
|
||||
rel_path = abs_path[:abs_path.find(APP_NAME) + len(APP_NAME)]
|
||||
path = os.path.abspath(rel_path + param)
|
||||
return path
|
||||
|
||||
|
||||
def read_json_file(param):
|
||||
"""
|
||||
读取json文件
|
||||
Parameters:
|
||||
param: json文件真实路径
|
||||
Returns:
|
||||
result: json内容
|
||||
"""
|
||||
with open(param, "r", encoding='utf-8') as f:
|
||||
result = json.load(f)
|
||||
return result
|
||||
|
||||
|
||||
def verify_token(func):
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
import pymongo
|
||||
|
||||
client_tfse = pymongo.MongoClient('mongodb://{}:{}@{}:{}'.format('root', 'sromitdTW569kC#M', '116.63.130.34', 27018))
|
||||
client_tyc = pymongo.MongoClient('mongodb://{}:{}@{}:{}'.format('root', 'gP%40DwMSVd5Sh6EiH', '116.63.130.34', 27019))
|
||||
|
||||
|
||||
def find_data_in_tyc(param1, param2, param3):
|
||||
"""
|
||||
根据企业ID查询企业信息
|
||||
Parameters:
|
||||
param1: string 数据库 db
|
||||
param2: string 数据集 collection
|
||||
param3: dict 查询条件 例如 {"企业名称": "xxx有限公司"}
|
||||
Returns:
|
||||
record: 查询结果
|
||||
"""
|
||||
collection = client_tyc[param1][param2]
|
||||
data = collection.find(param3, {'_id': False})
|
||||
record = list(data)
|
||||
return record
|
||||
|
||||
|
||||
def insert_data_in_tfse(param):
|
||||
"""
|
||||
|
||||
Parameters:
|
||||
param: desc
|
||||
Returns:
|
||||
res: desc
|
||||
"""
|
|
@ -1,6 +1,10 @@
|
|||
import json
|
||||
import time
|
||||
import requests
|
||||
|
||||
from common.scripts import file_path, read_json_file
|
||||
from company.db import find_data_in_tyc
|
||||
|
||||
|
||||
def drag_company_data_request(company_name):
|
||||
"""
|
||||
|
@ -30,3 +34,31 @@ def basic_info_etl(cid, company_name):
|
|||
Returns:
|
||||
-
|
||||
"""
|
||||
basic = read_json_file(file_path('/company/template/基本信息.json'))
|
||||
basic['企业ID'] = cid
|
||||
basic['更新日期'] = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
|
||||
|
||||
basic_tyc = find_data_in_tyc('公司背景', '基本信息', {"企业名称": company_name})
|
||||
|
||||
basic['企业名称'] = basic_tyc[0]['企业名称']
|
||||
basic['工商信息']['企业状态'] = basic_tyc[0]['基本信息']['regStatus']
|
||||
basic['工商信息']['法定代表人'] = basic_tyc[0]['基本信息']['legalPersonName']
|
||||
basic['工商信息']['企业类型'] = basic_tyc[0]['基本信息']['companyOrgType']
|
||||
basic['工商信息']['纳税人识别号'] = basic_tyc[0]['基本信息']['taxNumber']
|
||||
basic['工商信息']['经营范围'] = basic_tyc[0]['基本信息']['businessScope']
|
||||
basic['工商信息']['注册资本'] = basic_tyc[0]['基本信息']['regCapital']
|
||||
basic['工商信息']['实缴资本'] = basic_tyc[0]['基本信息']['actualCapital']
|
||||
basic['工商信息']['注册地址'] = basic_tyc[0]['基本信息']['regLocation']
|
||||
basic['工商信息']['登记机关'] = basic_tyc[0]['基本信息']['regInstitute']
|
||||
basic['工商信息']['行业'] = basic_tyc[0]['基本信息']['industry']
|
||||
basic['工商信息']['人员规模'] = basic_tyc[0]['基本信息']['staffNumRange']
|
||||
basic['工商信息']['参保人数'] = basic_tyc[0]['基本信息']['socialStaffNum']
|
||||
basic['工商信息']['小微企业'] = "是" if basic_tyc[0]['基本信息']['regStatus'] == 1 else "否"
|
||||
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
basic_info_etl('xxx', '德阳市德润达机械有限公司')
|
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
"企业ID": null,
|
||||
"更新日期": null,
|
||||
"工商信息": {
|
||||
"法定代表人": null,
|
||||
"企业类型": null,
|
||||
"纳税人识别号": null,
|
||||
"纳税人资质": null,
|
||||
"经营范围": null,
|
||||
"注册资本": null,
|
||||
"实缴资本": null,
|
||||
"注册地址": null,
|
||||
"登记机关": null,
|
||||
"行业": null,
|
||||
"人员规模": null,
|
||||
"参保人数": null,
|
||||
"营业年限": null
|
||||
},
|
||||
"股东信息": {
|
||||
"股东": null,
|
||||
"持股比例": null,
|
||||
"收益比例": null,
|
||||
"认缴出资额": null,
|
||||
"认缴日期": null
|
||||
},
|
||||
"主要成员": {
|
||||
"姓名": null,
|
||||
"职位": null,
|
||||
"持股比例": null,
|
||||
"收益比例": null
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue