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
72fe2ccd
Commit
72fe2ccd
authored
Apr 13, 2023
by
dong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix20230413
parent
dcaace2d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
91 additions
and
75 deletions
+91
-75
apps/big_data/view.py
+91
-75
No files found.
apps/big_data/view.py
View file @
72fe2ccd
...
...
@@ -5,86 +5,103 @@ from apps.utils.response_code import RET
from
apps.big_data
import
api_bigdata
# 项目管理---项目列表
"""项目总览"""
# 获取项目列表
@api_bigdata.route
(
"/GetProject"
,
methods
=
[
"POST"
])
def
get_project
():
req_dic
=
request
.
get_json
()
# # token = request.headers['token']
#
# project_stalker = req_dic['project_stalker']
#
# project_name = req_dic['project_name']
# district = req_dic['district']
# development_area = req_dic['development_area']
# investor_name = req_dic['investor_name']
# investor_district = req_dic['investor_district']
# industry = req_dic['industry']
# industry2 = ''
# if '/' in industry:
# industry1 = industry.split('/')[0]
# industry2 = industry.split('/')[1]
# else:
# industry1 = industry
# investment_volume = req_dic['investment_volume']
# project_progress = req_dic['project_progress']
# project_year = req_dic['project_year']
page
=
req_dic
[
'page'
]
per_page
=
req_dic
[
'per_page'
]
# flag = req_dic['flag']
@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
=
"查询出错!"
)
@api_bigdata.route
(
"/GetCyfb"
,
methods
=
[
"POST"
])
# 项目跟踪
def
get_cyfb
():
req_dict
=
request
.
get_json
()
district
=
req_dict
.
get
(
"district"
)
# 区县或者开发区名称
# try:
# user_obj = verify_token(token)
# user_district = get_district_name(token)
# except Exception as e:
# current_app.logger.error(e)
# return jsonify(code=RET.SESSIONERR, msg="进行操作时用户信息校验失败,请重新登陆后尝试!")
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
()
# 文化旅游
# project_obj = ProjectManagement.query.filter(
# ProjectManagement.project_name.like('%{}%'.format(project_name)) if project_name else text(''),
# ProjectManagement.project_stalker == project_stalker if project_stalker else text(''),
# ProjectManagement.district == district if district else text(''),
# ProjectManagement.development_area == development_area if development_area else text(''),
# ProjectManagement.investment_volume > investment_volume[0] if investment_volume else text(''),
# ProjectManagement.investment_volume <= investment_volume[1] if investment_volume else text(''),
# ProjectManagement.investor_district.like('%{}%'.format(investor_district)) if investor_district else text(
# ''),
# ProjectManagement.industry.like('%{}%'.format(industry1)) if industry1 else text(''),
# ProjectManagement.industry2.like('%{}%'.format(industry2)) if industry2 else text(''),
# ProjectManagement.investor_name.like('%{}%'.format(investor_name)) if investor_name else text(''),
# ProjectManagement.project_progress == project_progress if project_progress else text(''),
# ProjectManagement.project_year == project_year if project_year else text(''),
# ProjectManagement.is_delete == 0
# )
project_obj
=
ProjectManagement
.
query
.
filter
(
# ProjectManagement.district == user_district if user_district != '晋城市' else text(''),
# ProjectManagement.sign_time.notin_(['Null', '']) if flag == 2 else text(''),
# ProjectManagement.project_name.like('%{}%'.format(project_name)) if project_name else text(''),
# ProjectManagement.project_stalker == project_stalker if project_stalker else text(''),
# ProjectManagement.project_stalker != '' if flag == 2 else text(''),
# ProjectManagement.district == district if district else text(''),
# ProjectManagement.development_area == development_area if development_area else text(''),
# ProjectManagement.investment_volume > investment_volume[0] if investment_volume else text(''),
# ProjectManagement.investment_volume <= investment_volume[1] if investment_volume else text(''),
# ProjectManagement.investor_district.like('%{}%'.format(investor_district)) if investor_district else text(''),
# ProjectManagement.industry.like('%{}%'.format(industry1)) if industry1 else text(''),
# ProjectManagement.industry2.like('%{}%'.format(industry2)) if industry2 else text(''),
# ProjectManagement.investor_name.like('%{}%'.format(investor_name)) if investor_name else text(''),
# ProjectManagement.project_progress == project_progress if project_progress else text(''),
# ProjectManagement.project_year == project_year if project_year else text(''),
ProjectManagement
.
is_delete
==
0
)
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
if
not
project_obj
.
all
():
return
jsonify
(
code
=
RET
.
NODATA
,
msg
=
'没有符合条件的数据!'
)
project_size
=
project_obj
.
count
()
# 产业结构分布
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
}
]
project_obj_list
=
project_obj
.
order_by
(
ProjectManagement
.
upload_time
.
desc
())
.
paginate
(
page
,
per_page
)
.
items
if
project_obj_list
:
data
=
[{
"id"
:
project_obj
.
id
,
"project_stalker"
:
project_obj
.
project_stalker
,
"project_name"
:
project_obj
.
project_name
,
"district"
:
project_obj
.
district
,
"development_area"
:
project_obj
.
development_area
,
"attract_name"
:
project_obj
.
attract_name
,
"investor_name"
:
project_obj
.
investor_name
,
"investor_district"
:
project_obj
.
investor_district
,
"industry"
:
project_obj
.
industry
,
"investment_volume"
:
project_obj
.
investment_volume
,
"construction_content"
:
project_obj
.
construction_content
,
"project_address"
:
project_obj
.
project_address
,
"project_progress"
:
project_obj
.
project_progress
,
"project_problem"
:
project_obj
.
project_problem
,
"project_year"
:
project_obj
.
project_year
}
for
project_obj
in
project_obj_list
]
return
jsonify
(
code
=
RET
.
OK
,
data
=
{
"data"
:
data
,
"size"
:
project_size
,
"msg"
:
"数据获取成功!"
})
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
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