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
10073925
Commit
10073925
authored
Dec 10, 2022
by
dong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix20221210
parent
671028c4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
21 deletions
+8
-21
apps/view_choose/view.py
+8
-21
No files found.
apps/view_choose/view.py
View file @
10073925
from
sqlalchemy
import
func
,
desc
,
or_
from
sqlalchemy
import
func
,
desc
,
or_
,
text
from
flask
import
current_app
,
request
,
jsonify
from
flask
import
current_app
,
request
,
jsonify
from
apps.models
import
Induzone
,
Industry
,
CompanyIndustryPoint
,
User
from
apps.models
import
Induzone
,
Industry
,
CompanyIndustryPoint
,
User
from
apps.utils.response_code
import
RET
from
apps.utils.response_code
import
RET
...
@@ -71,8 +71,8 @@ def advice():
...
@@ -71,8 +71,8 @@ def advice():
page
=
req_dict
.
get
(
"page"
)
page
=
req_dict
.
get
(
"page"
)
perpage
=
req_dict
.
get
(
"perpage"
)
perpage
=
req_dict
.
get
(
"perpage"
)
# print(address)
# print(address)
# if not all([industry_id, product, budget, preference
]):
if
not
any
([
industry_id
,
product
,
budget
,
preference
,
revenue
,
tax
,
address
]):
#
return jsonify(code=RET.DATAERR, msg="数据不全")
return
jsonify
(
code
=
RET
.
DATAERR
,
msg
=
"数据不全"
)
try
:
try
:
# indu = Industry.query.filter_by(nid=industry_id).first()
# indu = Industry.query.filter_by(nid=industry_id).first()
# if not indu:
# if not indu:
...
@@ -83,26 +83,13 @@ def advice():
...
@@ -83,26 +83,13 @@ def advice():
# zone = Induzone.query.filter(or_(Induzone.navigat.like("%{}%".format(industry_name)),
# zone = Induzone.query.filter(or_(Induzone.navigat.like("%{}%".format(industry_name)),
# Induzone.navigator.like("%{}%".format(industry_name))))
# Induzone.navigator.like("%{}%".format(industry_name))))
zone
=
Induzone
.
query
.
filter
(
zone
=
Induzone
.
query
.
filter
(
Induzone
.
district
==
address
if
address
else
text
(
""
)
Induzone
.
district
==
address
if
address
and
address
!=
'晋城市'
else
text
(
''
),
Induzone
.
navigat
.
like
(
'
%
{}
%
'
.
format
(
product
))
if
product
else
text
(
''
),
Induzone
.
invest_power
<
float
(
budget
)
if
budget
else
text
(
''
),
Induzone
.
cate
==
"产业园区"
,
Induzone
.
tax
<
tax
if
tax
else
text
(
''
)
)
)
print
(
zone
.
all
())
print
(
zone
.
all
())
if
product
:
zone
=
zone
.
filter
(
Induzone
.
navigat
.
like
(
'
%
{}
%
'
.
format
(
product
)))
# 根据投资预算过滤
if
budget
:
zone
=
zone
.
filter
(
Induzone
.
invest_power
<
float
(
budget
))
if
address
and
address
==
'晋城市'
:
# 如果有选址
# zone = zone.filter(or_(Induzone.upper_district == address, Induzone.development_zone == address))
# zone = zone.filter(Induzone.upper_district == address, Induzone.cate == "产业园区")
zone
=
zone
.
filter
(
Induzone
.
cate
==
"产业园区"
)
if
address
and
address
!=
'晋城市'
:
# 如果有选址
# zone = zone.filter(or_(Induzone.region == address, Induzone.development_zone == address))
zone
=
zone
.
filter
(
Induzone
.
region
==
address
,
Induzone
.
cate
==
"产业园区"
)
if
tax
:
# 如果有税收
zone
=
zone
.
filter
(
Induzone
.
tax
<
tax
)
if
preference
[
0
]
==
"true"
:
# 如果有政府扶持力度 --- 政策数的打分
if
preference
[
0
]
==
"true"
:
# 如果有政府扶持力度 --- 政策数的打分
zone
=
zone
.
order_by
(
Induzone
.
policy_point
.
desc
())
zone
=
zone
.
order_by
(
Induzone
.
policy_point
.
desc
())
if
preference
[
1
]
==
"true"
:
# 产业聚集度 --- 产业的打分
if
preference
[
1
]
==
"true"
:
# 产业聚集度 --- 产业的打分
...
...
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