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
2db43668
Commit
2db43668
authored
Sep 27, 2023
by
ma_dev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新产业招商雷达
parent
2afb0685
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
10 deletions
+38
-10
apps/view_radar/view.py
+38
-10
No files found.
apps/view_radar/view.py
View file @
2db43668
...
@@ -1215,16 +1215,44 @@ def radar_enums():
...
@@ -1215,16 +1215,44 @@ def radar_enums():
enterprise
=
enterprise
.
filter_by
(
city
=
city
)
enterprise
=
enterprise
.
filter_by
(
city
=
city
)
if
district
:
if
district
:
enterprise
=
enterprise
.
filter_by
(
district
=
district
)
enterprise
=
enterprise
.
filter_by
(
district
=
district
)
if
product
:
# 有可能会变成模糊查询
enterprise
=
enterprise
.
filter
(
or_
(
Enterprise
.
product_all
.
like
(
"
%
{}
%
"
.
format
(
product
)),
Enterprise
.
product_all1
.
like
(
"
%
{}
%
"
.
format
(
product
)),
Enterprise
.
product_all2
.
like
(
"
%
{}
%
"
.
format
(
product
))
)
)
nums_all
=
enterprise
.
count
()
# 企业总数
# if product:
# # 有可能会变成模糊查询
# enterprise = enterprise.filter(or_(
# Enterprise.product_all.like("%{}%".format(product)),
# Enterprise.product_all1.like("%{}%".format(product)),
# Enterprise.product_all2.like("%{}%".format(product))
# )
# )
# 统计企业数量
# name_map_value = {}
# if product:
# industry_obj = IndustryChain.query.filter_by(industry_name=product).first()
# industry_id = industry_obj.chain_id
# chain_id = industry_obj.chain_id
# result = redis_store.get('chain_id_{}'.format(industry_id))
# if result:
# result = json.loads(result)
# nodeList = result.get("nodeList")
# else:
# flag = 2
# nodeList = [find_up_thr1(chain_id, 1, industry_id, flag),
# find_up_thr1(chain_id, 2, industry_id, flag),
# find_up_thr1(chain_id, 3, industry_id, flag)]
# for node1 in nodeList:
# for node2 in node1["subNodeList"]:
# name_map_value[node2["node"]] = node2["enterprise_count"]
# for node3 in node2["subNodeList"]:
# name_map_value[node3["node"]] = node3["enterprise_count"]
# for node4 in node3["subNodeList"]:
# name_map_value[node4["node"]] = node4["enterprise_count"]
# nums_all = name_map_value.get(product) if name_map_value.get(product) else enterprise.count() # 企业总数
# nums_all = enterprise.count() # 企业总数
industry_obj
=
IndustryChain
.
query
.
filter_by
(
industry_name
=
product
)
.
first
()
nums_all
=
industry_obj
.
enterprise_num
if
industry_obj
.
enterprise_num
else
enterprise
.
count
()
nums_dengl
=
enterprise
.
filter_by
(
dengl
=
"1"
)
.
count
()
# 瞪羚企业
nums_dengl
=
enterprise
.
filter_by
(
dengl
=
"1"
)
.
count
()
# 瞪羚企业
nums_hignew
=
enterprise
.
filter_by
(
high_new
=
"1"
)
.
count
()
# 高新技术企业
nums_hignew
=
enterprise
.
filter_by
(
high_new
=
"1"
)
.
count
()
# 高新技术企业
...
@@ -1251,7 +1279,7 @@ def radar_enums():
...
@@ -1251,7 +1279,7 @@ def radar_enums():
redis_store
.
setex
(
name_query
,
30
*
24
*
3600
,
json
.
dumps
(
data
))
redis_store
.
setex
(
name_query
,
30
*
24
*
3600
,
json
.
dumps
(
data
))
# redis_store.set(name_query, json.dumps(data))
# redis_store.set(name_query, json.dumps(data))
# redis_store.expire(name_query, 30 * 24 * 3600)
# redis_store.expire(name_query, 30 * 24 * 3600)
print
(
"redis"
)
#
print("redis")
return
jsonify
(
code
=
RET
.
OK
,
msg
=
"获取成功"
,
data
=
data
)
return
jsonify
(
code
=
RET
.
OK
,
msg
=
"获取成功"
,
data
=
data
)
except
Exception
as
e
:
except
Exception
as
e
:
...
...
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