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
5ea94232
Commit
5ea94232
authored
Feb 26, 2023
by
dong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix20230226
parent
33ba6d71
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
219 additions
and
80 deletions
+219
-80
apps/inves_manage/statistic_analysis_view.py
+13
-9
apps/models.py
+9
-4
apps/view_atlas/view.py
+20
-5
apps/view_choose/choose_view.py
+2
-0
apps/view_choose/fill_data.py
+6
-0
apps/view_xiaocx/view.py
+168
-62
industry_enterprise_num.py
+1
-0
No files found.
apps/inves_manage/statistic_analysis_view.py
View file @
5ea94232
...
...
@@ -1380,18 +1380,22 @@ def areal_project():
def
get_data
():
req_dic
=
request
.
get_json
()
flag
=
req_dic
[
'flag'
]
current_year
=
str
(
datetime
.
now
()
.
year
)
data_time
=
req_dic
[
'data_time'
]
if
data_time
:
current_year
=
data_time
.
split
(
'年'
)[
0
]
else
:
current_year
=
str
(
datetime
.
now
()
.
year
)
# current_year = "2022"
district_li1
=
[
"全市"
,
"城区"
,
"泽州县"
,
"高平市"
,
"阳城县"
,
"陵川县"
,
"沁水县"
,
"晋城经济技术开发区"
]
now_time
=
(
datetime
.
now
()
-
relativedelta
(
years
=
1
))
.
strftime
(
'
%
Y-
%
m-
%
d'
)
now_time
=
now_time
.
split
(
'-'
)
data_time
=
now_time
[
0
]
+
'年'
+
now_time
[
1
]
+
'月'
+
now_time
[
2
]
+
'号-至今'
#
now_time = (datetime.now() - relativedelta(years=1)).strftime('%Y-%m-%d')
#
now_time = now_time.split('-')
#
data_time = now_time[0] + '年' + now_time[1] + '月' + now_time[2] + '号-至今'
target_data_li
=
[]
if
flag
==
1
:
# 签约项目完成情况
try
:
target_data_li
=
get_data1
(
[]
,
district_li1
,
current_year
)
target_data_li
=
get_data1
(
data_time
,
district_li1
,
current_year
)
return
jsonify
(
code
=
RET
.
OK
,
data
=
{
"target_data_li"
:
target_data_li
,
"data_time"
:
data_time
},
msg
=
'数据查询成功。'
)
except
Exception
as
e
:
current_app
.
logger
.
error
(
e
)
...
...
@@ -1399,7 +1403,7 @@ def get_data():
if
flag
==
2
:
# 项目开工完成情况
try
:
target_data_li
=
get_data2
(
[]
,
district_li1
,
current_year
)
target_data_li
=
get_data2
(
data_time
,
district_li1
,
current_year
)
return
jsonify
(
code
=
RET
.
OK
,
data
=
{
"target_data_li"
:
target_data_li
,
"data_time"
:
data_time
},
msg
=
'数据查询成功。'
)
except
Exception
as
e
:
current_app
.
logger
.
error
(
e
)
...
...
@@ -1407,7 +1411,7 @@ def get_data():
if
flag
==
3
:
# 新开工项目计划投资额完情况
try
:
target_data_li
=
get_data3
(
[]
,
district_li1
,
current_year
)
target_data_li
=
get_data3
(
data_time
,
district_li1
,
current_year
)
return
jsonify
(
code
=
RET
.
OK
,
data
=
{
"target_data_li"
:
target_data_li
,
"data_time"
:
data_time
},
msg
=
'数据查询成功。'
)
except
Exception
as
e
:
current_app
.
logger
.
error
(
e
)
...
...
@@ -1415,7 +1419,7 @@ def get_data():
if
flag
==
4
:
# 固投资金完成情况
try
:
target_data_li
=
get_data4
(
[]
,
district_li1
,
current_year
)
target_data_li
=
get_data4
(
data_time
,
district_li1
,
current_year
)
return
jsonify
(
code
=
RET
.
OK
,
data
=
{
"target_data_li"
:
target_data_li
,
"data_time"
:
data_time
},
msg
=
'数据查询成功。'
)
except
Exception
as
e
:
current_app
.
logger
.
error
(
e
)
...
...
@@ -1423,7 +1427,7 @@ def get_data():
if
flag
==
5
:
# 非固投资金完成情况
try
:
target_data_li
=
get_data5
(
[]
,
district_li1
,
current_year
)
target_data_li
=
get_data5
(
data_time
,
district_li1
,
current_year
)
return
jsonify
(
code
=
RET
.
OK
,
data
=
{
"target_data_li"
:
target_data_li
,
"data_time"
:
data_time
},
msg
=
'数据查询成功。'
)
except
Exception
as
e
:
current_app
.
logger
.
error
(
e
)
...
...
apps/models.py
View file @
5ea94232
...
...
@@ -39,7 +39,7 @@ class IndustryChain(db.Model):
industry_type
=
db
.
Column
(
db
.
Integer
,
comment
=
'行业类型(0是产业集群,1是上游行业,2是中游行业,3是下游行业)'
)
relate_id
=
db
.
Column
(
db
.
Integer
,
comment
=
'关系id(关联哪个产业环节'
)
chain_id
=
db
.
Column
(
db
.
Integer
,
comment
=
'关系id(关联哪个产业链'
)
enterprise
=
db
.
relationship
(
'Enterprise'
,
backref
=
db
.
backref
(
'enterprise'
))
#
enterprise = db.relationship('Enterprise', backref=db.backref('enterprise'))
enterprise_num
=
db
.
Column
(
db
.
Integer
,
comment
=
'相关全企业表数量'
)
...
...
@@ -48,7 +48,8 @@ class Enterprise(db.Model):
__tablename__
=
"enterprise"
id
=
db
.
Column
(
db
.
Integer
,
primary_key
=
True
,
autoincrement
=
True
,
doc
=
'企业主键id'
,
comment
=
'企业主键id主键id'
)
# 企业
industry_chain_id
=
db
.
Column
(
db
.
Integer
,
db
.
ForeignKey
(
'industry_chain.id'
))
# company_id = db.Column(db.Integer, index=True, unique=True, comment='企业id') # 企业
company_id
=
db
.
Column
(
db
.
String
(
255
),
index
=
True
,
comment
=
'企业id'
)
# 企业
company_name
=
db
.
Column
(
db
.
String
(
255
),
index
=
True
,
doc
=
'企业名'
,
comment
=
'企业名'
)
# 企业名
status
=
db
.
Column
(
db
.
String
(
32
),
doc
=
'经营状态'
,
comment
=
'经营状态'
)
# 经营状态
legal
=
db
.
Column
(
db
.
String
(
255
),
doc
=
'发定代表人'
,
comment
=
'发定代表人'
)
# 发定代表人
...
...
@@ -1777,6 +1778,7 @@ class IntroductionMeet(db.Model):
__table_args__
=
({
'comment'
:
'小程序-推介会数据表'
})
# 添加表注释
id
=
db
.
Column
(
db
.
Integer
,
primary_key
=
True
,
autoincrement
=
True
,
comment
=
'主键id'
)
name
=
db
.
Column
(
db
.
String
(
20
),
comment
=
'推介会名字'
)
flag
=
db
.
Column
(
db
.
Integer
,
comment
=
'推介会类型 1往期,2即将举办'
)
time
=
db
.
Column
(
db
.
String
(
100
),
default
=
''
,
comment
=
'时间段'
)
organizer
=
db
.
Column
(
db
.
String
(
20
),
default
=
''
,
comment
=
'举办方'
)
img_url
=
db
.
Column
(
db
.
String
(
255
),
comment
=
'推介会封面'
)
...
...
@@ -1802,15 +1804,18 @@ class CustomerConsultation(db.Model):
__table_args__
=
({
'comment'
:
'小程序-客户咨询信息表'
})
# 添加表注释
id
=
db
.
Column
(
db
.
Integer
,
primary_key
=
True
,
autoincrement
=
True
,
comment
=
'主键id'
)
project_name
=
db
.
Column
(
db
.
String
(
200
),
comment
=
'项目名称'
)
investor
=
db
.
Column
(
db
.
Integer
,
comment
=
'投资方名称'
)
investor
=
db
.
Column
(
db
.
String
(
100
)
,
comment
=
'投资方名称'
)
investor_place
=
db
.
Column
(
db
.
String
(
100
),
default
=
''
,
comment
=
'投资方所在地'
)
project_type
=
db
.
Column
(
db
.
String
(
200
),
default
=
''
,
comment
=
'项目类型'
)
investment_volume
=
db
.
Column
(
db
.
Tex
t
,
comment
=
'总投资额'
)
investment_volume
=
db
.
Column
(
db
.
Floa
t
,
comment
=
'总投资额'
)
basic_information
=
db
.
Column
(
db
.
Text
,
comment
=
'项目方基本情况'
)
land_area
=
db
.
Column
(
db
.
Text
,
comment
=
'拟落地区域'
)
linkman
=
db
.
Column
(
db
.
String
(
20
),
comment
=
'联系人'
)
link_mobile
=
db
.
Column
(
db
.
String
(
20
),
comment
=
'联系方式'
)
consultation_time
=
db
.
Column
(
db
.
DateTime
,
default
=
''
,
comment
=
'咨询时间'
)
reply_time
=
db
.
Column
(
db
.
DateTime
,
default
=
''
,
comment
=
'回复时间'
)
flag
=
db
.
Column
(
db
.
Integer
,
comment
=
'是否已回复 0否1是'
)
is_sync
=
db
.
Column
(
db
.
Integer
,
comment
=
'是否同步到平台 0否1是'
)
reply_content
=
db
.
Column
(
db
.
Text
,
comment
=
'回复内容'
)
apps/view_atlas/view.py
View file @
5ea94232
...
...
@@ -418,6 +418,8 @@ def industry_resource():
"nature"
:
i
.
nature
,
"ccode"
:
i
.
ccode
,
"address"
:
i
.
address
,
"lng"
:
i
.
lng
,
"lat"
:
i
.
lat
,
}
for
i
in
college
],
"size"
:
size
}
return
jsonify
(
code
=
RET
.
OK
,
msg
=
"查询成功"
,
data
=
data
)
...
...
@@ -453,7 +455,10 @@ def industry_resource():
"cate"
:
i
.
cate
,
"fax"
:
i
.
fax
,
"postcode"
:
i
.
postcode
,
"address"
:
i
.
address
}
for
i
in
lab
],
"address"
:
i
.
address
,
"lng"
:
i
.
lng
,
"lat"
:
i
.
lat
}
for
i
in
lab
],
"size"
:
size
}
return
jsonify
(
code
=
RET
.
OK
,
msg
=
"查询成功"
,
data
=
data
)
else
:
...
...
@@ -487,8 +492,13 @@ def get_data(name, industry_level, select_flag, page, perpage):
"area"
:
i
.
area
,
"address"
:
i
.
address
,
"navigat"
:
i
.
navigat
,
"cluster"
:
i
.
cluster
}
for
i
in
induzone
],
"size"
:
size
}
"cluster"
:
i
.
cluster
,
"lng"
:
i
.
lng
,
"lat"
:
i
.
lat
,
"phone"
:
i
.
phone
,
}
for
i
in
induzone
],
"size"
:
size
,
}
return
admin_data
if
select_flag
in
[
2
,
7
]:
...
...
@@ -502,8 +512,10 @@ def get_data(name, industry_level, select_flag, page, perpage):
"level"
:
i
.
level
,
# 园区级别
"navigat"
:
i
.
navigat
,
"cate"
:
i
.
cate
,
# 园区类型
"address"
:
i
.
address
,
}
for
i
in
induzone
],
# 园区地址
"size"
:
size
}
"address"
:
i
.
address
,
"lng"
:
i
.
lng
,
"lat"
:
i
.
lat
,
}
for
i
in
induzone
],
"size"
:
size
}
return
garden_data
# if select_flag == 3: # 当选择载体土地时
...
...
@@ -764,6 +776,7 @@ def industry_policy():
"id"
:
i
.
id
,
"name"
:
i
.
name
,
"org"
:
i
.
org
,
"file"
:
i
.
file
,
"pubdate"
:
(
i
.
pubdate
)
.
strftime
(
"
%
Y-
%
m-
%
d"
),
}
for
i
in
indu_policy
],
"size"
:
size
...
...
@@ -951,6 +964,8 @@ def get_zaiti_detail_data():
"people_num"
:
induzone
.
people_num
,
"carrier_form"
:
induzone
.
carrier_form
,
"area_structure"
:
induzone
.
area_structure
,
"lng"
:
induzone
.
lng
,
"lat"
:
induzone
.
lat
,
"resource_data"
:
resource_data
,
"labor_data"
:
labor_data
}
...
...
apps/view_choose/choose_view.py
View file @
5ea94232
...
...
@@ -233,11 +233,13 @@ def global_build(key_words, district_name, build_name, industry_name, build_type
"carrier_type"
:
"商业楼宇"
,
"district_name"
:
build_obj
.
district_name
,
"build_name"
:
build_obj
.
build_name
,
"build_area"
:
build_obj
.
build_area
,
"detail_address"
:
build_obj
.
detail_address
,
# 审核信息
# "industry_name": build_obj.industry_name,
"layer_num"
:
build_obj
.
layer_num
,
"build_type"
:
build_obj
.
build_type
,
"attract_status"
:
build_obj
.
attract_status
,
"rent_money"
:
build_obj
.
rent_money
,
"lng"
:
build_obj
.
lng
,
"lat"
:
build_obj
.
lat
}
for
build_obj
in
build_obj_list
]
...
...
apps/view_choose/fill_data.py
View file @
5ea94232
...
...
@@ -1384,6 +1384,8 @@ def carrier_detail():
"wuye_money"
:
carrier_obj
.
wuye_money
,
# 物业费(元/平米/月)
"linkman"
:
carrier_obj
.
linkman
,
# 联系人
"link_mobile"
:
carrier_obj
.
link_mobile
,
# 联系方式
"lng"
:
carrier_obj
.
lng
,
"lat"
:
carrier_obj
.
lat
,
"inside_picture_url"
:
[
{
"url"
:
carrier_obj
.
inside_picture_url
}]
if
carrier_obj
.
inside_picture_url
else
[],
"outer_picture_url"
:
[
...
...
@@ -1418,6 +1420,8 @@ def carrier_detail():
"linkman"
:
carrier_obj
.
linkman
,
# 联系人
"telephone"
:
carrier_obj
.
telephone
,
# 联系方式
"other_requirements"
:
carrier_obj
.
other_requirements
,
# 其他要求
"lng"
:
carrier_obj
.
lng
,
"lat"
:
carrier_obj
.
lat
,
"price_url"
:
[
{
"url"
:
carrier_obj
.
price_url
}]
if
carrier_obj
.
price_url
else
[],
}]
...
...
@@ -1454,6 +1458,8 @@ def carrier_detail():
"rent_money"
:
carrier_obj
.
rent_money
,
# 租金(元/平米/天)
"linkman"
:
carrier_obj
.
linkman
,
# 联系人
"link_mobile"
:
carrier_obj
.
link_mobile
,
# 联系方式
"lng"
:
carrier_obj
.
lng
,
"lat"
:
carrier_obj
.
lat
,
"inside_picture_url"
:
[
{
"url"
:
carrier_obj
.
inside_picture_url
}]
if
carrier_obj
.
inside_picture_url
else
[],
"outer_picture_url"
:
[
...
...
apps/view_xiaocx/view.py
View file @
5ea94232
...
...
@@ -18,6 +18,7 @@ from apps.view_xiaocx import api_xiaocx
# 首页搜索
from
apps.utils.vxconfig
import
WxConfig
from
apps.inves_manage.siku_view
import
get_num
,
write_dynamic
@api_xiaocx.route
(
'/IndexSearch'
,
methods
=
[
'POST'
])
...
...
@@ -41,15 +42,17 @@ def index_search():
page
=
req_dict
.
get
(
"page"
)
# page
perpage
=
req_dict
.
get
(
"perpage"
)
# perpage
data
=
[]
total_num
=
''
try
:
if
carrier_type
==
1
:
land_obj
_list
=
CarrierLand
.
query
.
filter
(
land_obj
=
CarrierLand
.
query
.
filter
(
CarrierLand
.
land_name
.
like
(
'
%
{}
%
'
.
format
(
carrier_name
))
if
carrier_name
else
text
(
''
),
CarrierLand
.
land_nature
==
nature
if
nature
else
text
(
''
),
CarrierLand
.
total_area
>
float
(
area
[
0
])
if
area
[
0
]
else
text
(
''
),
CarrierLand
.
total_area
<=
float
(
area
[
1
])
if
area
[
1
]
else
text
(
''
),
)
.
paginate
(
page
,
perpage
)
.
items
)
land_obj_list
=
land_obj
.
paginate
(
page
,
perpage
)
.
items
total_num
=
land_obj
.
count
()
data
=
[{
"id"
:
land_obj
.
id
,
"name"
:
land_obj
.
land_name
,
...
...
@@ -61,33 +64,36 @@ def index_search():
}
for
land_obj
in
land_obj_list
]
if
carrier_type
==
2
:
build_obj
_list
=
CarrierBuild
.
query
.
filter
(
build_obj
=
CarrierBuild
.
query
.
filter
(
CarrierBuild
.
build_name
.
like
(
'
%
{}
%
'
.
format
(
carrier_name
))
if
carrier_name
else
text
(
''
),
CarrierBuild
.
attract_status
==
industry
if
industry
else
text
(
''
),
CarrierBuild
.
build_area
>
build_area
[
0
]
if
build_area
[
0
]
else
text
(
''
),
CarrierBuild
.
build_area
<=
build_area
[
1
]
if
build_area
[
1
]
else
text
(
''
),
CarrierBuild
.
rent_money
>
rent_money
[
0
]
if
rent_money
[
0
]
else
text
(
''
),
CarrierBuild
.
rent_money
<=
rent_money
[
1
]
if
rent_money
[
1
]
else
text
(
''
)
)
.
paginate
(
page
,
perpage
)
.
items
)
build_obj_list
=
build_obj
.
paginate
(
page
,
perpage
)
.
items
total_num
=
build_obj
.
count
()
data
=
[{
"id"
:
build_obj
.
id
,
"name"
:
build_obj
.
build_name
,
"district"
:
build_obj
.
district_name
,
"rent"
:
build_obj
.
rent_money
,
"area"
:
build_obj
.
build_area
,
"attract_status"
:
build_obj
.
attract_status
,
"lng"
:
build_obj
.
lng
,
"lat"
:
build_obj
.
lat
,
}
for
build_obj
in
build_obj_list
]
if
carrier_type
==
3
:
factory_obj
_list
=
CarrierFactory
.
query
.
filter
(
factory_obj
=
CarrierFactory
.
query
.
filter
(
CarrierFactory
.
factory_name
.
like
(
'
%
{}
%
'
.
format
(
carrier_name
))
if
carrier_name
else
text
(
''
),
CarrierFactory
.
attract_status
==
industry
if
industry
else
text
(
''
),
CarrierFactory
.
factory_area
>
build_area
[
0
]
if
build_area
[
0
]
else
text
(
''
),
CarrierFactory
.
factory_area
<=
build_area
[
1
]
if
build_area
[
1
]
else
text
(
''
)
)
.
paginate
(
page
,
perpage
)
.
items
)
factory_obj_list
=
factory_obj
.
paginate
(
page
,
perpage
)
.
items
total_num
=
factory_obj
.
count
()
data
=
[{
"id"
:
factory_obj
.
id
,
"name"
:
factory_obj
.
factory_name
,
...
...
@@ -99,12 +105,13 @@ def index_search():
}
for
factory_obj
in
factory_obj_list
]
if
carrier_type
==
4
:
# 园区
zone_obj
_list
=
Induzone
.
query
.
filter
(
zone_obj
=
Induzone
.
query
.
filter
(
Induzone
.
name
.
like
(
'
%
{}
%
'
.
format
(
carrier_name
))
if
carrier_name
else
text
(
''
),
Induzone
.
navigat
==
industry
if
industry
else
text
(
''
),
Induzone
.
level
==
zone_level
if
zone_level
else
text
(
''
)
)
.
paginate
(
page
,
perpage
)
.
items
)
zone_obj_list
=
zone_obj
.
paginate
(
page
,
perpage
)
.
items
total_num
=
zone_obj
.
count
()
data
=
[{
"id"
:
zone_obj
.
id
,
"name"
:
zone_obj
.
name
,
...
...
@@ -116,15 +123,16 @@ def index_search():
}
for
zone_obj
in
zone_obj_list
]
if
carrier_type
==
5
:
# 项目
project_obj
_list
=
Project
.
query
.
filter
(
project_obj
=
Project
.
query
.
filter
(
Project
.
name
.
like
(
'
%
{}
%
'
.
format
(
carrier_name
))
if
carrier_name
else
text
(
''
),
Project
.
district
==
district
if
district
else
text
(
''
),
Project
.
industry
==
industry
if
industry
else
text
(
''
),
Project
.
attract_
industry
==
industry
if
industry
else
text
(
''
),
Project
.
money
>
float
(
investment_volume_list
[
0
])
*
10000
if
investment_volume_list
[
0
]
else
text
(
''
),
Project
.
money
<=
float
(
investment_volume_list
[
1
])
*
10000
if
investment_volume_list
[
1
]
else
text
(
''
),
)
.
paginate
(
page
,
perpage
)
.
items
)
project_obj_list
=
project_obj
.
paginate
(
page
,
perpage
)
.
items
total_num
=
project_obj
.
count
()
data
=
[{
"id"
:
project_obj
.
id
,
"name"
:
project_obj
.
name
,
...
...
@@ -133,11 +141,13 @@ def index_search():
"attract_industry"
:
project_obj
.
attract_industry
,
# "lng": project_obj.lng,
# "lat": project_obj.lat,
"lng"
:
''
,
"lat"
:
''
,
}
for
project_obj
in
project_obj_list
]
except
Exception
as
e
:
current_app
.
logger
.
error
(
e
)
return
jsonify
(
code
=
RET
.
SESSIONERR
,
msg
=
"查询出错!"
)
return
jsonify
(
code
=
RET
.
OK
,
data
=
data
,
msg
=
'数据查询成功!'
)
return
jsonify
(
code
=
RET
.
OK
,
data
=
{
"data"
:
data
,
"size"
:
total_num
}
,
msg
=
'数据查询成功!'
)
# 推介会列表
...
...
@@ -147,9 +157,10 @@ def introduction_meet():
req_dict
=
request
.
get_json
()
page
=
req_dict
.
get
(
"page"
)
perpage
=
req_dict
.
get
(
"perpage"
)
flag
=
req_dict
.
get
(
"flag"
)
try
:
meet_obj_list
=
IntroductionMeet
.
query
.
paginate
(
page
,
perpage
)
.
items
meet_obj_list
=
IntroductionMeet
.
query
.
filter
(
IntroductionMeet
.
flag
==
flag
)
.
paginate
(
page
,
perpage
)
.
items
meet_count
=
IntroductionMeet
.
query
.
count
()
data
=
[{
...
...
@@ -197,12 +208,20 @@ def information():
req_dict
=
request
.
get_json
()
page
=
req_dict
.
get
(
"page"
)
perpage
=
req_dict
.
get
(
"perpage"
)
flag
=
req_dict
.
get
(
"flag"
)
name
=
req_dict
.
get
(
"name"
)
try
:
inform_obj_list
=
InvestmentInformation
.
query
.
paginate
(
page
,
perpage
)
.
items
inform_count
=
InvestmentInformation
.
query
.
count
()
inform_obj
=
InvestmentInformation
.
query
.
filter
(
InvestmentInformation
.
flag
==
flag
,
InvestmentInformation
.
name
.
like
(
"
%
{}
%
"
.
format
(
name
))
if
name
else
text
(
''
)
)
inform_obj_list
=
inform_obj
.
paginate
(
page
,
perpage
)
.
items
inform_count
=
inform_obj
.
count
()
data
=
[{
"id"
:
inform_obj
.
id
,
"name"
:
inform_obj
.
name
,
"time"
:
inform_obj
.
time
,
"source"
:
inform_obj
.
source
,
...
...
@@ -249,10 +268,16 @@ def company_list():
req_dict
=
request
.
get_json
()
page
=
req_dict
.
get
(
"page"
)
perpage
=
req_dict
.
get
(
"perpage"
)
name
=
req_dict
.
get
(
"name"
)
district
=
req_dict
.
get
(
"district"
)
try
:
company_obj_list
=
Company
.
query
.
paginate
(
page
,
perpage
)
.
items
company_count
=
Company
.
query
.
count
()
company_obj
=
Company
.
query
.
filter
(
Company
.
district
==
district
if
district
else
text
(
''
),
Company
.
company_name
.
like
(
"
%
{}
%
"
.
format
(
name
))
if
name
else
text
(
''
)
)
company_obj_list
=
company_obj
.
paginate
(
page
,
perpage
)
.
items
company_count
=
company_obj
.
count
()
data
=
[{
"id"
:
company_obj
.
id
,
"name"
:
company_obj
.
company_name
...
...
@@ -284,20 +309,20 @@ def company_detail():
"company_info"
:
company_obj
.
company_info
,
"c_name"
:
company_obj
.
c_name
,
"zizhi"
:
list
(
filter
(
len
,
[
'
是否
高新技术企业'
if
company_obj
.
high_new
==
'1'
else
''
,
'
是否
科技型中小企业'
if
company_obj
.
tbe
==
'1'
else
''
,
'
是否为
省级民营科技企业'
if
company_obj
.
tbe_sjmy
==
'1'
else
''
,
'
是否为有
融资企业'
if
company_obj
.
fianacing
==
'1'
else
''
,
'
是否
上市企业'
if
company_obj
.
quoted_company
==
'1'
else
''
,
'
是否为有
专利企业'
if
company_obj
.
patent
==
'1'
else
''
,
'
是否
山西民营100强'
if
company_obj
.
sxmon
==
'1'
else
''
,
'
是否为
山西专精特新企业'
if
company_obj
.
zjtg
==
'1'
else
''
,
'
是否为
国家级专精特新小巨人企业'
if
company_obj
.
zjtg_gjjxjr
==
'1'
else
''
,
'
是否为
省级专精特新小巨人企业'
if
company_obj
.
zjtg_sjxjr
==
'1'
else
''
,
'高新技术企业'
if
company_obj
.
high_new
==
'1'
else
''
,
'科技型中小企业'
if
company_obj
.
tbe
==
'1'
else
''
,
'省级民营科技企业'
if
company_obj
.
tbe_sjmy
==
'1'
else
''
,
'融资企业'
if
company_obj
.
fianacing
==
'1'
else
''
,
'上市企业'
if
company_obj
.
quoted_company
==
'1'
else
''
,
'专利企业'
if
company_obj
.
patent
==
'1'
else
''
,
'山西民营100强'
if
company_obj
.
sxmon
==
'1'
else
''
,
'山西专精特新企业'
if
company_obj
.
zjtg
==
'1'
else
''
,
'国家级专精特新小巨人企业'
if
company_obj
.
zjtg_gjjxjr
==
'1'
else
''
,
'省级专精特新小巨人企业'
if
company_obj
.
zjtg_sjxjr
==
'1'
else
''
,
'独角兽企业'
if
company_obj
.
unicorn
==
'1'
else
''
,
'瞪羚'
if
company_obj
.
dengl
==
'1'
else
''
,
'
是否
中国500强'
if
company_obj
.
isfive
==
'1'
else
''
,
'
是否
山西100强'
if
company_obj
.
sxonhun
==
'1'
else
''
,
'中国500强'
if
company_obj
.
isfive
==
'1'
else
''
,
'山西100强'
if
company_obj
.
sxonhun
==
'1'
else
''
,
'规模以上企业'
if
company_obj
.
scale
==
'1'
else
''
,
'限额以上服务业'
if
company_obj
.
serve
==
'1'
else
''
]))
...
...
@@ -421,6 +446,7 @@ def consultation_list():
cons_obj_list
=
CustomerConsultation
.
query
.
paginate
(
page
,
perpage
)
.
items
cons_count
=
CustomerConsultation
.
query
.
count
()
data
=
[{
"id"
:
cons_obj
.
id
,
"project_name"
:
cons_obj
.
project_name
,
"investor"
:
cons_obj
.
investor
,
"investor_place"
:
cons_obj
.
investor_place
,
...
...
@@ -432,6 +458,8 @@ def consultation_list():
"link_mobile"
:
cons_obj
.
link_mobile
,
"flag"
:
cons_obj
.
flag
,
"reply_content"
:
cons_obj
.
reply_content
,
"consultation_time"
:
cons_obj
.
consultation_time
,
"reply_time"
:
cons_obj
.
reply_time
,
}
for
cons_obj
in
cons_obj_list
]
except
Enterprise
as
e
:
...
...
@@ -449,6 +477,8 @@ def consultation_detail():
try
:
cons_obj
=
CustomerConsultation
.
query
.
get
(
_id
)
data
=
{
"id"
:
cons_obj
.
id
,
"is_sync"
:
cons_obj
.
is_sync
,
"project_name"
:
cons_obj
.
project_name
,
"investor"
:
cons_obj
.
investor
,
"investor_place"
:
cons_obj
.
investor_place
,
...
...
@@ -474,11 +504,87 @@ def reply_consultation():
req_dict
=
request
.
get_json
()
reply_content
=
req_dict
.
get
(
"reply_content"
)
_id
=
req_dict
.
get
(
"id"
)
is_sync
=
req_dict
.
get
(
"is_sync"
)
token
=
request
.
headers
[
"token"
]
upload_time
=
datetime
.
datetime
.
now
()
.
strftime
(
"
%
Y/
%
m/
%
d"
)
time_strf
=
datetime
.
datetime
.
now
()
.
strftime
(
"
%
Y
%
m
%
d"
)
try
:
user_obj
=
verify_token
(
token
)
upload_unity
=
user_obj
.
name
upload_people
=
user_obj
.
belong_organization
mobile
=
user_obj
.
mobile
cons_obj
=
CustomerConsultation
.
query
.
get
(
_id
)
cons_obj
.
reply_content
=
reply_content
if
is_sync
==
1
:
cons_obj
.
is_sync
=
1
db
.
session
.
commit
()
if
is_sync
==
1
:
project_type
=
cons_obj
.
project_type
project_name
=
cons_obj
.
project_name
investor_name
=
cons_obj
.
investor
investor_district
=
cons_obj
.
investor_place
investment_volume
=
cons_obj
.
investment_volume
project_info
=
cons_obj
.
basic_information
project_obj
=
SikuProject
.
query
.
filter
(
SikuProject
.
project_name
==
project_name
,
SikuProject
.
thread_source
==
'来自晋城小程序'
)
.
first
()
if
project_obj
:
return
jsonify
(
code
=
RET
.
DBERR
,
msg
=
'项目已存在。'
)
project_obj_list
=
SikuProject
.
query
.
all
()
# 项目编号
project_num_list
=
''
if
project_obj_list
:
project_num_list
=
[
project_obj
.
project_num
for
project_obj
in
project_obj_list
if
(
project_obj
.
project_num
)
.
startswith
(
time_strf
)]
if
project_num_list
:
max_project_num
=
max
(
project_num_list
)[
8
:]
num
=
get_num
(
max_project_num
)
if
num
==
'error'
:
return
'error'
project_num
=
time_strf
+
num
else
:
project_num
=
time_strf
+
'001'
# 创建项目
new_project_obj
=
SikuProject
(
flag
=
1
,
# 表示线索库
is_delete
=
0
,
thread_progress
=
'待对接'
,
# provence=investor_district1,
# city=investor_district2,
industry
=
project_type
.
split
(
'/'
)[
0
]
if
project_type
and
'/'
in
project_type
else
project_type
,
industry2
=
project_type
.
split
(
'/'
)[
1
]
if
project_type
and
'/'
in
project_type
else
''
,
upload_unity
=
upload_unity
,
upload_people
=
upload_people
,
upload_time
=
upload_time
,
project_year
=
upload_time
.
split
(
'/'
)[
0
],
project_name
=
project_name
,
project_num
=
int
(
project_num
),
investor_name
=
investor_name
,
investor_district
=
investor_district
,
project_type
=
project_type
,
investment_volume
=
investment_volume
,
# investment_volume1=investment_volume1,
project_info
=
project_info
,
# project_info1=project_info1,
thread_people
=
upload_unity
,
thread_people_unity
=
upload_people
,
thread_people_mobile
=
mobile
,
thread_source
=
'来自晋城小程序'
,
# remark=remark,
)
db
.
session
.
add
(
new_project_obj
)
db
.
session
.
commit
()
project_id
=
new_project_obj
.
id
# 记录项目动态
time1
=
datetime
.
datetime
.
now
()
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
write_dynamic
(
upload_people
,
project_id
,
'从晋城小程序导入了项目'
,
time1
)
except
Enterprise
as
e
:
current_app
.
logger
.
error
(
e
)
return
jsonify
(
code
=
RET
.
SESSIONERR
,
msg
=
"回复信息保存出错!"
)
...
...
@@ -628,7 +734,6 @@ def collection_list():
return
jsonify
(
code
=
RET
.
DBERR
,
msg
=
'查询失败。'
)
# 微信授权
@api_xiaocx.route
(
"/WeChatLogin"
,
methods
=
[
"POST"
])
def
wechat_login
():
...
...
@@ -639,7 +744,7 @@ def wechat_login():
# 参数获取与校验
req_dict
=
request
.
get_json
()
code
=
req_dict
.
get
(
'code'
)
# 微信登录code
token
=
request
.
headers
.
environ
[
'HTTP_TOKEN'
]
# 校验参数完整性
if
not
all
([
code
]):
return
jsonify
(
code
=
RET
.
PARAMERR
,
msg
=
"参数不完整"
)
...
...
@@ -647,43 +752,44 @@ def wechat_login():
app_id
=
'wx67c0a99d684274f8'
app_secret
=
'd89755bb5d2d3f85e97d0f08c30dbebc'
# url = u'https://api.weixin.qq.com/sns/oauth2/access_token'
url
=
u'https://api.weixin.qq.com/sns/jscode2session'
params
=
{
'appid'
:
app_id
,
'secret'
:
app_secret
,
'js_code'
:
code
,
'grant_type'
:
'authorization_code'
}
res
=
requests
.
get
(
url
,
params
=
params
)
.
json
()
# user_info_url = u'https://api.weixin.qq.com/sns/userinfo'
# url = 'https://api.weixin.qq.com/cgi-bin/token'
# params = {
# 'appid': app_id,
# 'secret': app_secret,
# 'grant_type': 'client_credential'
# }
# res = requests.get(url, params=params).json()
#
# # try:
# params1 = {
# 'access_token': res.get("access_token"),
# 'openid': res.get("openid")
# # 'access_token': res['access_token'],
# 'access_token': token,
# 'code': code,
# }
# uinfo = requests.get(user_info_url, params=params1).json()
try
:
openid
=
res
[
"openid"
]
unionid
=
res
[
"unionid"
]
except
:
return
None
# # except:
# # return None
#
# url1 = 'https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=ACCESS_TOKEN'
# res1 = requests.post(url1, data=params1)
# print(res1)
try
:
user
=
User
.
query
.
filter_by
(
vxopenid
=
openid
,
vxunionid
=
unionid
)
.
first
()
if
user
:
# 若成功保存登录状态
token
=
create_token
(
user
.
id
)
return
jsonify
(
code
=
RET
.
OK
,
msg
=
"登录成功"
,
data
=
{
"token"
:
token
,
"flag"
:
user
.
flag
})
# user = User.query.filter_by(vxopenid=openid, vxunionid=unionid).first()
# if user:
# # 若成功保存登录状态
# token = create_token(user.id)
# return jsonify(code=RET.OK, msg="登录成功", data={"token": token, "flag": user.flag})
pass
except
Exception
as
e
:
current_app
.
logger
.
error
(
e
)
return
jsonify
(
code
=
RET
.
DBERR
,
msg
=
"appid,secreat异常"
)
time
=
datetime
.
now
()
time
=
datetime
.
datetime
.
now
()
current_app
.
logger
.
error
(
'++++++++++++++++++++++++++++登录日志>>>{}:{}通过使用微信登录成功了!+++++++++++++++++++++++=++'
.
format
(
time
,
user
))
# return jsonify(code=RET.USERERR, msg="
授权
成功", user_info=uinfo)
# return jsonify(code=RET.USERERR, msg="
登录
成功", user_info=uinfo)
return
jsonify
(
code
=
RET
.
USERERR
,
msg
=
"授权成功"
)
...
...
apps/utils/shell/
industry_enterprise_num.py
→
industry_enterprise_num.py
View file @
5ea94232
...
...
@@ -10,6 +10,7 @@ IndustryChain或者Enterprise数据表更新后,
计算产业环节相关企业的数量并填充到IndustryChain的enterprise_num字段中。
"""
def
handle
():
with
app
.
app_context
():
industry_obj_list
=
IndustryChain
.
query
.
all
()
...
...
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