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
a5b9f6bc
Commit
a5b9f6bc
authored
Apr 12, 2023
by
dong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix20230412
parent
f93df474
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
4 deletions
+38
-4
apps/big_data/view.py
+30
-0
apps/view_map/view.py
+8
-4
No files found.
apps/big_data/view.py
View file @
a5b9f6bc
...
@@ -36,3 +36,32 @@ def get_jjzb():
...
@@ -36,3 +36,32 @@ def get_jjzb():
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_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
apps/view_map/view.py
View file @
a5b9f6bc
...
@@ -182,7 +182,8 @@ def attract_cnums():
...
@@ -182,7 +182,8 @@ def attract_cnums():
num
=
len
([
company
for
company
in
company1
if
company
.
province
==
pro
])
num
=
len
([
company
for
company
in
company1
if
company
.
province
==
pro
])
else
:
else
:
num
=
enterprise
.
filter_by
(
province
=
pro
)
.
count
()
num
=
enterprise
.
filter_by
(
province
=
pro
)
.
count
()
df
.
append
({
"name"
:
pro
,
"value"
:
num
})
if
num
!=
0
:
df
.
append
({
"name"
:
pro
,
"value"
:
num
})
df
=
sorted
(
df
,
key
=
lambda
x
:
x
[
"value"
],
reverse
=
True
)
df
=
sorted
(
df
,
key
=
lambda
x
:
x
[
"value"
],
reverse
=
True
)
redis_store
.
setex
(
name_query
,
30
*
24
*
3600
,
json
.
dumps
(
df
[:
5
]))
redis_store
.
setex
(
name_query
,
30
*
24
*
3600
,
json
.
dumps
(
df
[:
5
]))
return
jsonify
(
code
=
RET
.
OK
,
msg
=
"获取成功"
,
data
=
df
[:
5
])
return
jsonify
(
code
=
RET
.
OK
,
msg
=
"获取成功"
,
data
=
df
[:
5
])
...
@@ -195,7 +196,8 @@ def attract_cnums():
...
@@ -195,7 +196,8 @@ def attract_cnums():
else
:
else
:
num
=
enterprise
.
filter_by
(
province
=
province
,
city
=
cit
)
.
count
()
num
=
enterprise
.
filter_by
(
province
=
province
,
city
=
cit
)
.
count
()
# num = enterprise.filter_by(province=province, city=cit).count()
# num = enterprise.filter_by(province=province, city=cit).count()
df
.
append
({
"name"
:
cit
,
"value"
:
num
})
if
num
!=
0
:
df
.
append
({
"name"
:
cit
,
"value"
:
num
})
df
=
sorted
(
df
,
key
=
lambda
x
:
x
[
"value"
],
reverse
=
True
)
df
=
sorted
(
df
,
key
=
lambda
x
:
x
[
"value"
],
reverse
=
True
)
redis_store
.
setex
(
name_query
,
30
*
24
*
3600
,
json
.
dumps
(
df
[:
5
]))
redis_store
.
setex
(
name_query
,
30
*
24
*
3600
,
json
.
dumps
(
df
[:
5
]))
return
jsonify
(
code
=
RET
.
OK
,
msg
=
"获取成功"
,
data
=
df
[:
5
])
return
jsonify
(
code
=
RET
.
OK
,
msg
=
"获取成功"
,
data
=
df
[:
5
])
...
@@ -210,7 +212,8 @@ def attract_cnums():
...
@@ -210,7 +212,8 @@ def attract_cnums():
num
=
enterprise
.
filter_by
(
province
=
province
,
city
=
city
,
district
=
dis
)
.
count
()
num
=
enterprise
.
filter_by
(
province
=
province
,
city
=
city
,
district
=
dis
)
.
count
()
# num = enterprise.filter_by(province=province, city=city, district=dis).count()
# num = enterprise.filter_by(province=province, city=city, district=dis).count()
df
.
append
({
"name"
:
dis
,
"value"
:
num
})
if
num
!=
0
:
df
.
append
({
"name"
:
dis
,
"value"
:
num
})
df
=
sorted
(
df
,
key
=
lambda
x
:
x
[
"value"
],
reverse
=
True
)
df
=
sorted
(
df
,
key
=
lambda
x
:
x
[
"value"
],
reverse
=
True
)
redis_store
.
setex
(
name_query
,
30
*
24
*
3600
,
json
.
dumps
(
df
[:
5
]))
redis_store
.
setex
(
name_query
,
30
*
24
*
3600
,
json
.
dumps
(
df
[:
5
]))
return
jsonify
(
code
=
RET
.
OK
,
msg
=
"获取成功"
,
data
=
df
[:
5
])
return
jsonify
(
code
=
RET
.
OK
,
msg
=
"获取成功"
,
data
=
df
[:
5
])
...
@@ -222,7 +225,8 @@ def attract_cnums():
...
@@ -222,7 +225,8 @@ def attract_cnums():
num
=
enterprise
.
filter_by
(
province
=
province
,
city
=
city
,
district
=
district
)
.
count
()
num
=
enterprise
.
filter_by
(
province
=
province
,
city
=
city
,
district
=
district
)
.
count
()
# num = enterprise.filter_by(province=province, city=city, district=district).count()
# num = enterprise.filter_by(province=province, city=city, district=district).count()
df
.
append
({
"name"
:
district
,
"value"
:
num
})
if
num
!=
0
:
df
.
append
({
"name"
:
district
,
"value"
:
num
})
df
=
sorted
(
df
,
key
=
lambda
x
:
x
[
"value"
],
reverse
=
True
)
df
=
sorted
(
df
,
key
=
lambda
x
:
x
[
"value"
],
reverse
=
True
)
data
=
df
[:
5
]
data
=
df
[:
5
]
# redis缓存
# redis缓存
...
...
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