Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mancheng
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
mancheng
Commits
9ad3ec47
Commit
9ad3ec47
authored
Dec 09, 2022
by
dong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix20221209
parent
0ccdc64a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
147 additions
and
40 deletions
+147
-40
apps/view_index/view.py
+15
-6
apps/view_radar/view.py
+74
-1
apps/view_user/view.py
+58
-33
No files found.
apps/view_index/view.py
View file @
9ad3ec47
...
@@ -528,11 +528,6 @@ def company_detail():
...
@@ -528,11 +528,6 @@ def company_detail():
try
:
try
:
user_obj
=
verify_token
(
token
)
user_obj
=
verify_token
(
token
)
user_id
=
user_obj
.
id
user_id
=
user_obj
.
id
# collect_obj_list = UserCompany.query.filter_by(user_id=user_id).all()
# company_id_list = [collect_obj.id for collect_obj in collect_obj_list]
#
# collect_obj_list1 = UserEnterprise.query.filter_by(user_id=user_id).all()
# enterprise_id_list = [collect_obj.id for collect_obj in collect_obj_list1]
except
:
except
:
return
jsonify
(
code
=
RET
.
SESSIONERR
,
msg
=
"请重新登录!"
)
return
jsonify
(
code
=
RET
.
SESSIONERR
,
msg
=
"请重新登录!"
)
...
@@ -740,13 +735,24 @@ def enterprise_detail():
...
@@ -740,13 +735,24 @@ def enterprise_detail():
req_dict
=
request
.
get_json
()
req_dict
=
request
.
get_json
()
id
=
req_dict
.
get
(
"id"
)
# 企业id
id
=
req_dict
.
get
(
"id"
)
# 企业id
token
=
request
.
headers
[
'token'
]
try
:
user_obj
=
verify_token
(
token
)
user_id
=
user_obj
.
id
except
:
return
jsonify
(
code
=
RET
.
SESSIONERR
,
msg
=
"请重新登录!"
)
# 校验参数完整性
# 校验参数完整性
if
not
all
([
id
]):
if
not
all
([
id
]):
return
jsonify
(
code
=
RET
.
PARAMERR
,
msg
=
"参数不完整"
)
return
jsonify
(
code
=
RET
.
PARAMERR
,
msg
=
"参数不完整"
)
try
:
try
:
enterprise
=
Enterprise
.
query
.
get
(
id
)
enterprise
=
Enterprise
.
query
.
get
(
id
)
company
=
Company
.
query
.
get
(
id
)
user
=
User
.
query
.
get
(
user_id
)
# 获取关注列表
if
user
:
enterprise_ids
=
[
enter
.
id
for
enter
in
user
.
enterprise
]
else
:
enterprise_ids
=
[]
# 工商状况-查询行政许可数据
# 工商状况-查询行政许可数据
data_info1
=
EnterpriseAdminPermission
.
query
.
filter_by
(
company_id
=
id
)
.
all
()
data_info1
=
EnterpriseAdminPermission
.
query
.
filter_by
(
company_id
=
id
)
.
all
()
# 工商状况-查询税务信用数据
# 工商状况-查询税务信用数据
...
@@ -780,6 +786,9 @@ def enterprise_detail():
...
@@ -780,6 +786,9 @@ def enterprise_detail():
"web_site"
:
enterprise
.
web_site
if
enterprise
.
web_site
else
""
,
# 网址
"web_site"
:
enterprise
.
web_site
if
enterprise
.
web_site
else
""
,
# 网址
"email"
:
enterprise
.
email
if
enterprise
.
email
else
""
,
# 邮箱
"email"
:
enterprise
.
email
if
enterprise
.
email
else
""
,
# 邮箱
"address"
:
enterprise
.
address
if
enterprise
.
address
else
""
,
# 地址
"address"
:
enterprise
.
address
if
enterprise
.
address
else
""
,
# 地址
"collect"
:
"1"
if
enterprise
.
id
in
enterprise_ids
else
"2"
,
# 关注状态码1关注,2未关注
"choice"
:
"2"
,
# 1太原企业,2全国企业
"location"
:
province
+
city
+
district
,
"location"
:
province
+
city
+
district
,
"jwd"
:
{
"lng"
:
enterprise
.
lng
if
enterprise
.
lng
else
""
,
# 经度
"jwd"
:
{
"lng"
:
enterprise
.
lng
if
enterprise
.
lng
else
""
,
# 经度
...
...
apps/view_radar/view.py
View file @
9ad3ec47
...
@@ -457,7 +457,7 @@ def recommond():
...
@@ -457,7 +457,7 @@ def recommond():
# 优质企业-各资质企业数量
# 优质企业-各资质企业数量
@api_radar.route
(
'/GoodEnterpriseNum'
,
methods
=
[
'POST'
])
@api_radar.route
(
'/GoodEnterpriseNum'
,
methods
=
[
'POST'
])
# @login_required
# @login_required
def
radar_enums
():
def
radar_enums
1
():
'''雷达监测页企业数量统计'''
'''雷达监测页企业数量统计'''
req_dict
=
request
.
get_json
()
req_dict
=
request
.
get_json
()
inid
=
req_dict
.
get
(
"inid"
)
# 行业id
inid
=
req_dict
.
get
(
"inid"
)
# 行业id
...
@@ -1032,3 +1032,75 @@ def search_enterprise():
...
@@ -1032,3 +1032,75 @@ def search_enterprise():
except
Exception
as
e
:
except
Exception
as
e
:
current_app
.
logger
.
error
(
e
)
current_app
.
logger
.
error
(
e
)
return
jsonify
(
code
=
RET
.
DBERR
,
msg
=
'查询出错!'
)
return
jsonify
(
code
=
RET
.
DBERR
,
msg
=
'查询出错!'
)
# 雷达监测页企业数量统计
@api_radar.route
(
'/radar/enums'
,
methods
=
[
'POST'
])
# @login_required
def
radar_enums
():
'''雷达监测页企业数量统计'''
req_dict
=
request
.
get_json
()
inid
=
req_dict
.
get
(
"inid"
)
# 行业id
area
=
req_dict
.
get
(
"area"
)
# [省,市,区]
province
=
area
[
0
]
city
=
area
[
1
]
district
=
area
[
2
]
product
=
req_dict
.
get
(
"product"
)
# 企业产品
# 校验参数完整性
if
not
all
([
inid
]):
return
jsonify
(
code
=
RET
.
PARAMERR
,
msg
=
"参数不完整"
)
try
:
name_query
=
"radar"
+
str
(
inid
)
+
str
(
""
.
join
(
area
))
+
str
(
product
)
if
redis_store
.
get
(
name_query
)
is
not
None
:
data
=
json
.
loads
(
redis_store
.
get
(
name_query
))
return
jsonify
(
code
=
RET
.
OK
,
msg
=
"获取成功"
,
data
=
data
)
if
inid
:
enterprise
=
Enterprise
.
query
.
filter_by
(
c_type
=
inid
)
else
:
enterprise
=
Enterprise
.
query
.
filter_by
()
if
province
:
enterprise
=
enterprise
.
filter_by
(
province
=
province
)
if
city
:
enterprise
=
enterprise
.
filter_by
(
city
=
city
)
if
district
:
enterprise
=
enterprise
.
filter_by
(
district
=
district
)
if
product
:
# 有可能会变成模糊查询
enterprise
=
enterprise
.
filter
(
Enterprise
.
product_all
.
like
(
"
%
{}
%
"
.
format
(
product
)))
nums_all
=
enterprise
.
count
()
# 企业总数
nums_dengl
=
enterprise
.
filter_by
(
dengl
=
"1"
)
.
count
()
# 瞪羚企业
nums_hignew
=
enterprise
.
filter_by
(
high_new
=
"1"
)
.
count
()
# 高新技术企业
nums_tbe
=
enterprise
.
filter_by
(
tbe
=
"1"
)
.
count
()
# 科技型中小企业
nums_quoted
=
enterprise
.
filter_by
(
quoted_company
=
"1"
)
.
count
()
# 上市企业
nums_financ
=
enterprise
.
filter_by
(
fianacing
=
"1"
)
.
count
()
# 有融资小企业
nums_unicorn
=
enterprise
.
filter_by
(
unicorn
=
"1"
)
.
count
()
# 独角兽企业
nums_capital
=
round
(
float
(
enterprise
.
with_entities
(
func
.
sum
(
Enterprise
.
capital_nums
))
.
scalar
()
if
enterprise
.
with_entities
(
func
.
sum
(
Enterprise
.
capital_nums
))
.
scalar
()
else
0
)
/
10000
,
2
)
# 注册资本(亿元)
nums_bao
=
enterprise
.
with_entities
(
func
.
sum
(
Enterprise
.
bao_num
))
.
scalar
()
if
enterprise
.
with_entities
(
func
.
sum
(
Enterprise
.
bao_num
))
.
scalar
()
else
0
# 就业人数
nums_patent
=
enterprise
.
with_entities
(
func
.
sum
(
Enterprise
.
num_patent
))
.
scalar
()
if
enterprise
.
with_entities
(
func
.
sum
(
Enterprise
.
num_patent
))
.
scalar
()
else
0
# 授权发明专利
data
=
{
"nums_all"
:
float
(
nums_all
),
"nums_capital"
:
float
(
nums_capital
),
"nums_bao"
:
float
(
nums_bao
),
"nums_patent"
:
float
(
nums_patent
),
"nums_dengl"
:
float
(
nums_dengl
),
"nums_hignew"
:
float
(
nums_hignew
),
"nums_tbe"
:
float
(
nums_tbe
),
"nums_quoted"
:
float
(
nums_quoted
),
"nums_financ"
:
float
(
nums_financ
),
"nums_unicorn"
:
float
(
nums_unicorn
),
# "info": info
}
# redis缓存
redis_store
.
setex
(
name_query
,
30
*
24
*
3600
,
json
.
dumps
(
data
))
# redis_store.set(name_query, json.dumps(data))
# redis_store.expire(name_query, 30 * 24 * 3600)
print
(
"redis"
)
return
jsonify
(
code
=
RET
.
OK
,
msg
=
"获取成功"
,
data
=
data
)
except
Exception
as
e
:
current_app
.
logger
.
error
(
e
)
return
jsonify
(
code
=
RET
.
DBERR
,
msg
=
"数据库查询错误"
)
\ No newline at end of file
apps/view_user/view.py
View file @
9ad3ec47
...
@@ -877,23 +877,26 @@ def get_collect():
...
@@ -877,23 +877,26 @@ def get_collect():
company_list
=
user
.
enterprise
[(
page
-
1
)
*
per_page
:
page
*
per_page
]
company_list
=
user
.
enterprise
[(
page
-
1
)
*
per_page
:
page
*
per_page
]
for
i
in
company_list
:
for
i
in
company_list
:
create_time
=
UserEnterprise
.
query
.
filter_by
(
enterprise_id
=
i
.
id
,
user_id
=
user_id
)
.
first
()
create_time
=
UserEnterprise
.
query
.
filter_by
(
enterprise_id
=
i
.
id
,
user_id
=
user_id
)
.
first
()
if
company_name
and
company_name
in
i
.
company_name
:
if
company_name
:
company
.
append
({
if
company_name
in
i
.
company_name
:
"id"
:
i
.
id
,
company
.
append
({
"company_name"
:
i
.
company_name
,
"id"
:
i
.
id
,
"create_time"
:
create_time
.
create_time
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
),
"company_name"
:
i
.
company_name
,
"build_date"
:
i
.
build_date
.
strftime
(
"
%
Y-
%
m-
%
d"
)
if
i
.
build_date
else
"-"
,
"create_time"
:
create_time
.
create_time
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
),
"high_new"
:
'高新技术企业'
if
i
.
high_new
==
'1'
else
''
,
"build_date"
:
i
.
build_date
.
strftime
(
"
%
Y-
%
m-
%
d"
)
if
i
.
build_date
else
"-"
,
"tbe"
:
'科技型中小企业'
if
i
.
tbe
==
'1'
else
''
,
"high_new"
:
'高新技术企业'
if
i
.
high_new
==
'1'
else
''
,
"quoted_company"
:
'上市企业'
if
i
.
quoted_company
==
'1'
else
''
,
"tbe"
:
'科技型中小企业'
if
i
.
tbe
==
'1'
else
''
,
"sxmon"
:
'山西民营100强'
if
i
.
sxmon
==
'1'
else
''
,
"quoted_company"
:
'上市企业'
if
i
.
quoted_company
==
'1'
else
''
,
"zjtg"
:
'山西专精特新企业'
if
i
.
zjtg
==
'1'
else
''
,
"sxmon"
:
'山西民营100强'
if
i
.
sxmon
==
'1'
else
''
,
"unicorn"
:
'独角兽企业'
if
i
.
unicorn
==
'1'
else
''
,
"zjtg"
:
'山西专精特新企业'
if
i
.
zjtg
==
'1'
else
''
,
"dengl"
:
'瞪羚'
if
i
.
dengl
==
'1'
else
''
,
"unicorn"
:
'独角兽企业'
if
i
.
unicorn
==
'1'
else
''
,
"isfive"
:
'中国500强'
if
i
.
isfive
==
'1'
else
''
,
"dengl"
:
'瞪羚'
if
i
.
dengl
==
'1'
else
''
,
"scale"
:
'规模以上企业'
if
i
.
scale
==
'1'
else
''
,
"isfive"
:
'中国500强'
if
i
.
isfive
==
'1'
else
''
,
"serve"
:
'限额以上服务业'
if
i
.
serve
==
'1'
else
''
"scale"
:
'规模以上企业'
if
i
.
scale
==
'1'
else
''
,
})
"serve"
:
'限额以上服务业'
if
i
.
serve
==
'1'
else
''
})
else
:
continue
else
:
else
:
company
.
append
({
company
.
append
({
"id"
:
i
.
id
,
"id"
:
i
.
id
,
...
@@ -926,22 +929,44 @@ def get_collect():
...
@@ -926,22 +929,44 @@ def get_collect():
try
:
try
:
for
i
in
company_list
:
for
i
in
company_list
:
create_time
=
UserCompany
.
query
.
filter_by
(
company_id
=
i
.
id
,
user_id
=
user_id
)
.
first
()
create_time
=
UserCompany
.
query
.
filter_by
(
company_id
=
i
.
id
,
user_id
=
user_id
)
.
first
()
company
.
append
({
"id"
:
i
.
id
,
if
company_name
:
"company_name"
:
i
.
company_name
,
if
company_name
in
i
.
company_name
:
"create_time"
:
create_time
.
create_time
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
),
company
.
append
({
"build_date"
:
i
.
build_date
.
strftime
(
"
%
Y-
%
m-
%
d"
)
if
i
.
build_date
else
"-"
,
"id"
:
i
.
id
,
"high_new"
:
'高新技术企业'
if
i
.
high_new
==
'1'
else
''
,
"company_name"
:
i
.
company_name
,
"tbe"
:
'科技型中小企业'
if
i
.
tbe
==
'1'
else
''
,
"create_time"
:
create_time
.
create_time
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
),
"quoted_company"
:
'上市企业'
if
i
.
quoted_company
==
'1'
else
''
,
"build_date"
:
i
.
build_date
.
strftime
(
"
%
Y-
%
m-
%
d"
)
if
i
.
build_date
else
"-"
,
"sxmon"
:
'山西民营100强'
if
i
.
sxmon
==
'1'
else
''
,
"high_new"
:
'高新技术企业'
if
i
.
high_new
==
'1'
else
''
,
"zjtg"
:
'山西专精特新企业'
if
i
.
zjtg
==
'1'
else
''
,
"tbe"
:
'科技型中小企业'
if
i
.
tbe
==
'1'
else
''
,
"unicorn"
:
'独角兽企业'
if
i
.
unicorn
==
'1'
else
''
,
"quoted_company"
:
'上市企业'
if
i
.
quoted_company
==
'1'
else
''
,
"dengl"
:
'瞪羚'
if
i
.
dengl
==
'1'
else
''
,
"sxmon"
:
'山西民营100强'
if
i
.
sxmon
==
'1'
else
''
,
"isfive"
:
'中国500强'
if
i
.
isfive
==
'1'
else
''
,
"zjtg"
:
'山西专精特新企业'
if
i
.
zjtg
==
'1'
else
''
,
"scale"
:
'规模以上企业'
if
i
.
scale
==
'1'
else
''
,
"unicorn"
:
'独角兽企业'
if
i
.
unicorn
==
'1'
else
''
,
"serve"
:
'限额以上服务业'
if
i
.
serve
==
'1'
else
''
"dengl"
:
'瞪羚'
if
i
.
dengl
==
'1'
else
''
,
})
"isfive"
:
'中国500强'
if
i
.
isfive
==
'1'
else
''
,
"scale"
:
'规模以上企业'
if
i
.
scale
==
'1'
else
''
,
"serve"
:
'限额以上服务业'
if
i
.
serve
==
'1'
else
''
})
else
:
continue
else
:
company
.
append
({
"id"
:
i
.
id
,
"company_name"
:
i
.
company_name
,
"create_time"
:
create_time
.
create_time
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
),
"build_date"
:
i
.
build_date
.
strftime
(
"
%
Y-
%
m-
%
d"
)
if
i
.
build_date
else
"-"
,
"high_new"
:
'高新技术企业'
if
i
.
high_new
==
'1'
else
''
,
"tbe"
:
'科技型中小企业'
if
i
.
tbe
==
'1'
else
''
,
"quoted_company"
:
'上市企业'
if
i
.
quoted_company
==
'1'
else
''
,
"sxmon"
:
'山西民营100强'
if
i
.
sxmon
==
'1'
else
''
,
"zjtg"
:
'山西专精特新企业'
if
i
.
zjtg
==
'1'
else
''
,
"unicorn"
:
'独角兽企业'
if
i
.
unicorn
==
'1'
else
''
,
"dengl"
:
'瞪羚'
if
i
.
dengl
==
'1'
else
''
,
"isfive"
:
'中国500强'
if
i
.
isfive
==
'1'
else
''
,
"scale"
:
'规模以上企业'
if
i
.
scale
==
'1'
else
''
,
"serve"
:
'限额以上服务业'
if
i
.
serve
==
'1'
else
''
})
except
Exception
as
e
:
except
Exception
as
e
:
current_app
.
logger
.
error
(
e
)
current_app
.
logger
.
error
(
e
)
return
jsonify
(
code
=
RET
.
DBERR
,
msg
=
"数据库错误"
)
return
jsonify
(
code
=
RET
.
DBERR
,
msg
=
"数据库错误"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment