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
dcaace2d
Commit
dcaace2d
authored
Apr 13, 2023
by
dong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix20230413
parent
5afc9e53
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
28 deletions
+51
-28
apps/big_data/view.py
+51
-28
No files found.
apps/big_data/view.py
View file @
dcaace2d
...
...
@@ -38,30 +38,53 @@ def get_jjzb():
return
jsonify
(
code
=
RET
.
DBERR
,
msg
=
"查询出错!"
)
# @api_bigdata.route("/GetJjzb", methods=["GET"]) # 项目跟踪
# def get_jjzb():
# try:
# obj_li = City.query.all()
# data = [{
# "id": obj.id,
# "area": obj.area,
# "size": obj.size,
# "year": obj.year,
# "people": obj.people,
# "GDP": obj.GDP,
# "addscale": obj.addscale,
# "investment": obj.investment,
# "retail": obj.retail,
# "in_out": obj.in_out,
# "public": obj.public,
# "people_out": obj.people_out,
# "people_per": obj.people_per,
# "public_in": obj.public_in,
# "info": obj.info,
# "question": obj.question,
# "flag": obj.flag
# } for obj in obj_li]
# return jsonify(code=RET.OK, data=data, msg="查询成功!")
# except Exception as e:
# current_app.logger.error(e)
# return jsonify(code=RET.DBERR, msg="查询出错!")
\ No newline at end of file
@api_bigdata.route
(
"/GetCyfb"
,
methods
=
[
"POST"
])
# 项目跟踪
def
get_cyfb
():
req_dict
=
request
.
get_json
()
district
=
req_dict
.
get
(
"district"
)
# 区县或者开发区名称
try
:
# 3. 产业结构分布饼状图数据统计
company
=
Company
.
query
.
filter
(
Company
.
district
==
district
if
district
else
text
(
''
))
count_all
=
company
.
count
()
if
count_all
==
0
:
count_all
=
1
count_gt
=
company
.
filter_by
(
f_type
=
1
)
.
count
()
# 钢铁
count_gjd
=
company
.
filter_by
(
f_type
=
2
)
.
count
()
# 光机电
count_mcq
=
company
.
filter_by
(
f_type
=
7
)
.
count
()
# 煤层气
count_zbzz
=
company
.
filter_by
(
f_type
=
8
)
.
count
()
# 装备制造
count_zz
=
company
.
filter_by
(
f_type
=
9
)
.
count
()
# 铸造
count_mhg
=
company
.
filter_by
(
f_type
=
10
)
.
count
()
# 煤化工
count_xcl
=
company
.
filter_by
(
f_type
=
11
)
.
count
()
# 新材料
count_lsjc
=
company
.
filter_by
(
f_type
=
12
)
.
count
()
# 绿色建材
count_yy
=
company
.
filter_by
(
f_type
=
13
)
.
count
()
# 医药
count_smfz
=
company
.
filter_by
(
f_type
=
14
)
.
count
()
# 丝麻纺织服装
count_xdfwy
=
company
.
filter_by
(
f_type
=
15
)
.
count
()
# 现代服务业
count_szjj
=
company
.
filter_by
(
f_type
=
16
)
.
count
()
# 数字经济
count_whly
=
company
.
filter_by
(
f_type
=
17
)
.
count
()
# 文化旅游
count_qt
=
count_all
-
count_gt
-
count_gjd
-
count_mcq
-
count_zbzz
-
\
count_zz
-
count_mhg
-
count_xcl
-
count_lsjc
-
count_yy
-
\
count_smfz
-
count_xdfwy
-
count_szjj
-
count_whly
# 产业结构分布
data
=
[
{
"name"
:
"钢铁"
,
"value"
:
count_gt
},
# {百分比,value}
{
"name"
:
"光机电"
,
"value"
:
count_gjd
},
{
"name"
:
"煤层气"
,
"value"
:
count_mcq
},
{
"name"
:
"装备制造"
,
"value"
:
count_zbzz
},
{
"name"
:
"铸造"
,
"value"
:
count_zz
},
{
"name"
:
"煤化工"
,
"value"
:
count_mhg
},
{
"name"
:
"新材料"
,
"value"
:
count_xcl
},
{
"name"
:
"绿色建材"
,
"value"
:
count_lsjc
},
{
"name"
:
"医药"
,
"value"
:
count_yy
},
{
"name"
:
"丝麻纺织服装"
,
"value"
:
count_smfz
},
{
"name"
:
"现代服务业"
,
"value"
:
count_xdfwy
},
{
"name"
:
"数字经济"
,
"value"
:
count_szjj
},
{
"name"
:
"文化旅游"
,
"value"
:
count_whly
}
]
return
jsonify
(
code
=
RET
.
OK
,
data
=
data
,
msg
=
"查询成功!"
)
except
Exception
as
e
:
current_app
.
logger
.
error
(
e
)
return
jsonify
(
code
=
RET
.
DBERR
,
msg
=
"查询出错!"
)
\ No newline at end of file
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