Commit 1a176c48 by 黄静

hj

parent fc87edf5
...@@ -173,7 +173,7 @@ class EsBase: ...@@ -173,7 +173,7 @@ class EsBase:
es = Elasticsearch( es = Elasticsearch(
[self._eshost], [self._eshost],
http_auth=(self._esuser, self._espassword), http_auth=(self._esuser, self._espassword),
port=self._esport) port=self._esport,timeout = 30)
except Exception as data: except Exception as data:
......
...@@ -21,6 +21,7 @@ from service.tf_member import gaoguan,gudong ...@@ -21,6 +21,7 @@ from service.tf_member import gaoguan,gudong
from service.talking import talking,talking_product from service.talking import talking,talking_product
from service.moneyAPI import moneyAPI from service.moneyAPI import moneyAPI
from service.company_30s import tj_30s_hx from service.company_30s import tj_30s_hx
from service.talking_name import talkingName_new
server = Flask(__name__,static_url_path="",static_folder="") server = Flask(__name__,static_url_path="",static_folder="")
server.config['JSON_AS_ASCII'] = False server.config['JSON_AS_ASCII'] = False
...@@ -38,6 +39,7 @@ gaoguan(server) ...@@ -38,6 +39,7 @@ gaoguan(server)
gudong(server) gudong(server)
tj_rec_status(server) tj_rec_status(server)
talking(server) talking(server)
talkingName_new(server)
talking_product(server) talking_product(server)
tj_30s_hx(server) tj_30s_hx(server)
...@@ -141,7 +143,7 @@ def company_similar(): ...@@ -141,7 +143,7 @@ def company_similar():
return common_result.to_result(None, 300, "参数错误") return common_result.to_result(None, 300, "参数错误")
company_name = request_data.get('company_name') company_name = request_data.get('company_name')
company_info = companybase.companyinfo(company_name) company_info = companybase.companyinfo(company_name)
similar_company_list = companybase.similar_company(company_info) similar_company_list = companybase.similar_company(company_info,company_name)
return common_result.to_result(similar_company_list) return common_result.to_result(similar_company_list)
@server.route('/') @server.route('/')
......
...@@ -66,8 +66,9 @@ class CompanyBase: ...@@ -66,8 +66,9 @@ class CompanyBase:
return company_dict return company_dict
#查找相似企业 #查找相似企业
def similar_company(self,cinfo): def similar_company(self,cinfo,company_name):
querybody = self.companyes.select_company_body() querybody = self.companyes.select_company_body()
print(querybody,2222)
if cinfo["reg_status"]: if cinfo["reg_status"]:
dsl = {"terms": {"reg_status": ['存续', "在业"]}} dsl = {"terms": {"reg_status": ['存续', "在业"]}}
querybody['query']['bool']['must'].append(dsl) querybody['query']['bool']['must'].append(dsl)
...@@ -105,9 +106,21 @@ class CompanyBase: ...@@ -105,9 +106,21 @@ class CompanyBase:
company_list = self.companyes.select_company(querybody) company_list = self.companyes.select_company(querybody)
namelist = [] namelist = []
print( len(company_list['hits']['hits']),111)
if len(company_list['hits']['hits']) > 0: if len(company_list['hits']['hits']) > 0:
for row in company_list['hits']['hits']: for row in company_list['hits']['hits']:
data = {"company_name":row['_source']["company_name"], "credit_code":row['_source']["credit_code"]} if row['_source']["company_name"] == company_name:
continue
from_time = row['_source']["from_time"]
if row['_source']["from_time"] != None and row['_source']["from_time"] != "null":
from_time = self.array_time(
time_trans.TimestampChange(row['_source']["from_time"], 0)[0]) # 起时间
to_time = row['_source']["to_time"] # 社会统一性代码
if row['_source']["to_time"] != None and row['_source']["to_time"] != "null":
to_time = self.array_time(
time_trans.TimestampChange(row['_source']["to_time"], 0)[0]) # 止时间
print(row['_source']["company_name"])
data = {"company_name":row['_source']["company_name"], "credit_code":row['_source']["credit_code"],"legal_person":str(row['_source']["legal_person"]),"time_between":str(str(from_time) + '- ' + str(to_time)),"gsb_company_cate_1":str(row['_source']["gsb_company_cate_1"]),"compamy_org_type":str(row['_source']["company_org_type"]) }
namelist.append(data) namelist.append(data)
company_list_result = namelist[:3] company_list_result = namelist[:3]
return company_list_result return company_list_result
......
...@@ -28,10 +28,9 @@ es1 = Elasticsearch([esip], http_auth=(esuser, espassword), port=7200) ...@@ -28,10 +28,9 @@ es1 = Elasticsearch([esip], http_auth=(esuser, espassword), port=7200)
# conn = pymysql.connect(host='43.247.184.94', port=9187, user='nice', passwd='Niceee@2020#@', db='ent_data') # conn = pymysql.connect(host='43.247.184.94', port=9187, user='nice', passwd='Niceee@2020#@', db='ent_data')
# connection = pymysql.connect(host='43.247.184.94', port=9187, user='nice', passwd='Niceee@2020#@', db='test') # connection = pymysql.connect(host='43.247.184.94', port=9187, user='nice', passwd='Niceee@2020#@', db='test')
connection = pymysql.connect(host='47.95.76.74', port=3306, user='root', passwd='Gongsibao2018', db='ent_data') connection = pymysql.connect(host='47.95.76.74', port=3306, user='root', passwd='Gongsibao2018', db='ent_data')
conn = pymysql.connect(host='47.95.76.74', port=3306, user='root', passwd='Gongsibao2018', db='ent_data') # conn = pymysql.connect(host='47.95.76.74', port=3306, user='root', passwd='Gongsibao2018', db='ent_data')
cur = connection.cursor()
cur1= conn.cursor()
def strQ2B(ustring): def strQ2B(ustring):
...@@ -47,7 +46,8 @@ def strQ2B(ustring): ...@@ -47,7 +46,8 @@ def strQ2B(ustring):
return rstring return rstring
def moneyTest(mycompanyname): def moneyTest(mycompanyname):
print(mycompanyname,"=======moneyTest函数mycompanynamemycompanyname") connection = pymysql.connect(host='47.95.76.74', port=3306, user='root', passwd='Gongsibao2018', db='ent_data')
cur = connection.cursor()
result={} result={}
result["data"]=[] result["data"]=[]
result["total"]=0 result["total"]=0
...@@ -310,8 +310,8 @@ def moneyTest(mycompanyname): ...@@ -310,8 +310,8 @@ def moneyTest(mycompanyname):
if ICP_status =="未办理": if ICP_status =="未办理":
product_sql='SELECT * FROM tj_product_result_copy1_test_0317 where product_result like "%s" and companyname="%s"'%("%IDC%",mycompanyname) product_sql='SELECT * FROM tj_product_result_copy1_test_0317 where product_result like "%s" and companyname="%s"'%("%IDC%",mycompanyname)
cur1.execute(product_sql) cur.execute(product_sql)
data=cur1.fetchone() data=cur.fetchone()
if data: if data:
icp_num=1 icp_num=1
icp_money=2000 icp_money=2000
...@@ -324,8 +324,8 @@ def moneyTest(mycompanyname): ...@@ -324,8 +324,8 @@ def moneyTest(mycompanyname):
if EDI_status =="未办理": if EDI_status =="未办理":
product_sql='SELECT * FROM tj_product_result_copy1_test_0317 where product_result like "%s" and companyname="%s"'%("%EDI%",mycompanyname) product_sql='SELECT * FROM tj_product_result_copy1_test_0317 where product_result like "%s" and companyname="%s"'%("%EDI%",mycompanyname)
cur1.execute(product_sql) cur.execute(product_sql)
data=cur1.fetchone() data=cur.fetchone()
if data: if data:
edi_num=1 edi_num=1
edi_money=8500 edi_money=8500
...@@ -339,8 +339,8 @@ def moneyTest(mycompanyname): ...@@ -339,8 +339,8 @@ def moneyTest(mycompanyname):
if IDC_status =="未办理": if IDC_status =="未办理":
product_sql='SELECT * FROM tj_product_result_copy1_test_0317 where product_result like "%s" and companyname="%s"'%("%IDC%",mycompanyname) product_sql='SELECT * FROM tj_product_result_copy1_test_0317 where product_result like "%s" and companyname="%s"'%("%IDC%",mycompanyname)
cur1.execute(product_sql) cur.execute(product_sql)
data=cur1.fetchone() data=cur.fetchone()
if data: if data:
idc_num=1 idc_num=1
idc_money=50000 idc_money=50000
...@@ -354,8 +354,8 @@ def moneyTest(mycompanyname): ...@@ -354,8 +354,8 @@ def moneyTest(mycompanyname):
if web_status =="未办理": if web_status =="未办理":
product_sql='SELECT * FROM tj_product_result_copy1_test_0317 where product_result like "%s" and companyname="%s"'%("%网络文化经营许可证%",mycompanyname) product_sql='SELECT * FROM tj_product_result_copy1_test_0317 where product_result like "%s" and companyname="%s"'%("%网络文化经营许可证%",mycompanyname)
cur1.execute(product_sql) cur.execute(product_sql)
data=cur1.fetchone() data=cur.fetchone()
if data: if data:
web_num=1 web_num=1
web_money=20000 web_money=20000
...@@ -369,8 +369,8 @@ def moneyTest(mycompanyname): ...@@ -369,8 +369,8 @@ def moneyTest(mycompanyname):
if game_pub_status =="未办理": if game_pub_status =="未办理":
product_sql='SELECT * FROM tj_product_result_copy1_test_0317 where product_result like "%s" and companyname="%s"'%("%网络游戏出版备案%",mycompanyname) product_sql='SELECT * FROM tj_product_result_copy1_test_0317 where product_result like "%s" and companyname="%s"'%("%网络游戏出版备案%",mycompanyname)
cur1.execute(product_sql) cur.execute(product_sql)
data=cur1.fetchone() data=cur.fetchone()
if data: if data:
gm_pub_num=1 gm_pub_num=1
gm_pub_money=20000 gm_pub_money=20000
...@@ -384,8 +384,8 @@ def moneyTest(mycompanyname): ...@@ -384,8 +384,8 @@ def moneyTest(mycompanyname):
if game_do_status =="未办理": if game_do_status =="未办理":
product_sql='SELECT * FROM tj_product_result_copy1_test_0317 where product_result like "%s" and companyname="%s"'%("%网络游戏运营备案%",mycompanyname) product_sql='SELECT * FROM tj_product_result_copy1_test_0317 where product_result like "%s" and companyname="%s"'%("%网络游戏运营备案%",mycompanyname)
cur1.execute(product_sql) cur.execute(product_sql)
data=cur1.fetchone() data=cur.fetchone()
if data: if data:
gm_do_num=1 gm_do_num=1
gm_do_money=2000 gm_do_money=2000
...@@ -400,15 +400,15 @@ def moneyTest(mycompanyname): ...@@ -400,15 +400,15 @@ def moneyTest(mycompanyname):
zz_importance="1" zz_importance="1"
else: else:
product_sql='SELECT * FROM tj_product_result_copy1_test_0317 where product_result like "%s" and companyname="%s"'%("%作品著作权%",mycompanyname) product_sql='SELECT * FROM tj_product_result_copy1_test_0317 where product_result like "%s" and companyname="%s"'%("%作品著作权%",mycompanyname)
cur1.execute(product_sql) cur.execute(product_sql)
data=cur1.fetchone() data=cur.fetchone()
if data: if data:
zz_num=1+zz_num zz_num=1+zz_num
zz_type="办理" zz_type="办理"
zz_money=799+zz_money zz_money=799+zz_money
product_sql='SELECT * FROM tj_product_result_copy1_test_0317 where product_result like "%s" and companyname="%s"'%("%软件著作权%",mycompanyname) product_sql='SELECT * FROM tj_product_result_copy1_test_0317 where product_result like "%s" and companyname="%s"'%("%软件著作权%",mycompanyname)
cur1.execute(product_sql) cur.execute(product_sql)
data=cur1.fetchone() data=cur.fetchone()
if data: if data:
zz_num=zz_num+1 zz_num=zz_num+1
zz_type="办理" zz_type="办理"
...@@ -424,8 +424,8 @@ def moneyTest(mycompanyname): ...@@ -424,8 +424,8 @@ def moneyTest(mycompanyname):
if qs_status =="未办理": if qs_status =="未办理":
product_sql='SELECT * FROM tj_product_result_copy1_test_0317 where product_result like "%s" and companyname="%s"'%("%食品生产许可证%",mycompanyname) product_sql='SELECT * FROM tj_product_result_copy1_test_0317 where product_result like "%s" and companyname="%s"'%("%食品生产许可证%",mycompanyname)
cur1.execute(product_sql) cur.execute(product_sql)
data=cur1.fetchone() data=cur.fetchone()
if data: if data:
qs_num=1 qs_num=1
qs_money=3000 qs_money=3000
...@@ -440,8 +440,8 @@ def moneyTest(mycompanyname): ...@@ -440,8 +440,8 @@ def moneyTest(mycompanyname):
if sc_status =="未办理": if sc_status =="未办理":
product_sql='SELECT * FROM tj_product_result_copy1_test_0317 where product_result like "%s" and companyname="%s"'%("%食品生产许可证%",mycompanyname) product_sql='SELECT * FROM tj_product_result_copy1_test_0317 where product_result like "%s" and companyname="%s"'%("%食品生产许可证%",mycompanyname)
cur1.execute(product_sql) cur.execute(product_sql)
data=cur1.fetchone() data=cur.fetchone()
if data: if data:
sc_num=1 sc_num=1
sc_money=8000 sc_money=8000
...@@ -454,8 +454,8 @@ def moneyTest(mycompanyname): ...@@ -454,8 +454,8 @@ def moneyTest(mycompanyname):
if gxqy_status =="未办理": if gxqy_status =="未办理":
product_sql='SELECT * FROM tj_product_result_copy1_test_0317 where product_result like "%s" and companyname="%s"'%("%高新企业认证%",mycompanyname) product_sql='SELECT * FROM tj_product_result_copy1_test_0317 where product_result like "%s" and companyname="%s"'%("%高新企业认证%",mycompanyname)
cur1.execute(product_sql) cur.execute(product_sql)
data=cur1.fetchone() data=cur.fetchone()
if data: if data:
gxqy_num=1 gxqy_num=1
gxqy_money=20000 gxqy_money=20000
...@@ -468,8 +468,8 @@ def moneyTest(mycompanyname): ...@@ -468,8 +468,8 @@ def moneyTest(mycompanyname):
#税务筹划 #税务筹划
product_sql='SELECT * FROM tj_product_result_copy1_test_0317 where product_result like "%s" and companyname="%s"'%("%税收筹划%",mycompanyname) product_sql='SELECT * FROM tj_product_result_copy1_test_0317 where product_result like "%s" and companyname="%s"'%("%税收筹划%",mycompanyname)
cur1.execute(product_sql) cur.execute(product_sql)
data=cur1.fetchone() data=cur.fetchone()
if data: if data:
tax_num=1 tax_num=1
tax_money=20000 tax_money=20000
...@@ -484,21 +484,23 @@ def moneyTest(mycompanyname): ...@@ -484,21 +484,23 @@ def moneyTest(mycompanyname):
+qs_money+sc_money+gxqy_money+tax_money +qs_money+sc_money+gxqy_money+tax_money
result["total"]=sum_sj_money result["total"]=sum_sj_money
print(result) cur.close()
connection.close()
# print(result)
return result return result
# app = Flask(__name__)
def moneyAPI(server): def moneyAPI(server):
@server.route("/api/moneyAPI",methods = ['POST']) @server.route("/api/moneyAPI",methods = ['POST'])
def APImoney(): def APImoney():
try: try:
mycompanyname = request.get_json().get("mycompanyname") # 得到问题 mycompanyname = request.get_json().get("mycompanyname") # 得到问题
print(mycompanyname,"获取公司名称")
r_1 = moneyTest(strQ2B(mycompanyname)) r_1 = moneyTest(strQ2B(mycompanyname))
if r_1: if r_1:
print(r_1,"r_1r_1")
return r_1 return r_1
else: else:
return json.dumps({"status": -1, "msg":"失败","data": 0}, ensure_ascii=False) return json.dumps({"status": -1, "msg":"失败","data": 0}, ensure_ascii=False)
except: except:
......
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2020/5/12 0012 18:46
# @Author : guopeng
# @File : talking_name.py
# @Software: PyCharm Community Edition
import requests
import json
from flask import request
def ProductService(json_info):
print(json_info)
# json_info = eval(json_info)
url = 'https://entprofile.gongsibao.com/api/talkingName' # 获取信息接口
headers = {"Content-Type":"application/json","ak":"YLc6GsgLtuRGaVA5Om848x18NxLtHlyA"}
# companyname = {"companyname":companyname}# 接口访问参数
companyInfo = requests.post(url,data=json.dumps(json_info),headers=headers) # 访问接口返回的信息
# resultinfo=json.loads(companyInfo.text)
print(companyInfo.text)
return companyInfo.text
# 服务器接口API
def talkingName_new(server):
@server.route('/api/talkingNameGai', methods=['POST'])
def SingleLogoApi_re():
try:
recommend_product = request.get_json().get("recommend_product")
datas = ProductService({"recommend_product": recommend_product})
data1 = json.loads(datas)
data_talk = data1["data"]
mq = data_talk[2]
list1 = []
for i in mq.split('\n'):
list1.append(i)
print(list1)
return json.dumps({"status": 0, "msg": "成功", "data": list1}, ensure_ascii=False)
except:
return json.dumps({"status": -1, "msg":"调用服务出错","data": {}}, ensure_ascii=False)
# if __name__ == '__main__':
# CORS(app, supports_credentials=True)#允许跨域
# # app.run(host='172.16.18.2', port=15501, debug=True)
# app.run(host='127.0.0.1', port=5000, debug=True)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment