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
f6c7ca8d
Commit
f6c7ca8d
authored
Dec 10, 2022
by
dong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix20221210
parent
10073925
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
18 deletions
+27
-18
apps/view_choose/view.py
+27
-18
No files found.
apps/view_choose/view.py
View file @
f6c7ca8d
from
sqlalchemy
import
func
,
desc
,
or_
,
text
from
sqlalchemy
import
func
,
desc
,
or_
,
text
,
and_
from
flask
import
current_app
,
request
,
jsonify
from
apps.models
import
Induzone
,
Industry
,
CompanyIndustryPoint
,
User
from
apps.utils.response_code
import
RET
...
...
@@ -60,6 +60,7 @@ def default_address():
@api_address.route
(
"/ChooseAddress"
,
methods
=
[
"POST"
])
def
advice
():
req_dict
=
request
.
get_json
()
key_words
=
req_dict
.
get
(
"key_words"
)
# 关键字
industry_id
=
req_dict
.
get
(
"industry_id"
)
# 所属行业选择 nid(必填)
product
=
req_dict
.
get
(
"product"
)
# 主营产品 "药" (必填)
budget
=
req_dict
.
get
(
'budget'
)
# 落地投资预算 "22" # 大于 (必填)
...
...
@@ -70,26 +71,34 @@ def advice():
page
=
req_dict
.
get
(
"page"
)
perpage
=
req_dict
.
get
(
"perpage"
)
# print(address)
if
not
any
([
industry_id
,
product
,
budget
,
preference
,
revenue
,
tax
,
address
]):
if
not
any
([
product
,
budget
,
preference
,
revenue
,
tax
,
address
]):
return
jsonify
(
code
=
RET
.
DATAERR
,
msg
=
"数据不全"
)
try
:
# indu = Industry.query.filter_by(nid=industry_id).first()
# if not indu:
# return jsonify(code=RET.DATAERR, msg="参数错误")
# # 获取产业名称
# industry_name = indu.oname
# 根据产业名称查询园区
# zone = Induzone.query.filter(or_(Induzone.navigat.like("%{}%".format(industry_name)),
# Induzone.navigator.like("%{}%".format(industry_name))))
zone
=
Induzone
.
query
.
filter
(
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
())
and_
(
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
(
''
)
))
.
filter
(
or_
(
Induzone
.
name
.
like
(
"
%
"
+
key_words
+
"
%
"
)
if
key_words
else
text
(
''
),
Induzone
.
level
.
like
(
"
%
"
+
key_words
+
"
%
"
)
if
key_words
else
text
(
''
),
Induzone
.
industry_type
.
like
(
"
%
"
+
key_words
+
"
%
"
)
if
key_words
else
text
(
''
),
Induzone
.
charge
.
like
(
"
%
"
+
key_words
+
"
%
"
)
if
key_words
else
text
(
''
),
Induzone
.
address
.
like
(
"
%
"
+
key_words
+
"
%
"
)
if
key_words
else
text
(
''
)
))
if
industry_id
:
indu
=
Industry
.
query
.
filter_by
(
nid
=
industry_id
)
.
first
()
if
not
indu
:
return
jsonify
(
code
=
RET
.
DATAERR
,
msg
=
"参数错误"
)
# 获取产业名称
industry_name
=
indu
.
oname
# 根据产业名称查询园区
zone
=
Induzone
.
query
.
filter
(
or_
(
Induzone
.
navigat
.
like
(
"
%
{}
%
"
.
format
(
industry_name
)),
Induzone
.
navigator
.
like
(
"
%
{}
%
"
.
format
(
industry_name
))))
if
preference
[
0
]
==
"true"
:
# 如果有政府扶持力度 --- 政策数的打分
zone
=
zone
.
order_by
(
Induzone
.
policy_point
.
desc
())
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