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
69041829
Commit
69041829
authored
Apr 12, 2023
by
dong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix20230411
parent
78b500fc
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
80 additions
and
12 deletions
+80
-12
apps/__init__.py
+3
-12
apps/big_data/__init__.py
+7
-0
apps/big_data/view.py
+69
-0
apps/view_atlas/view.py
+1
-0
No files found.
apps/__init__.py
View file @
69041829
...
@@ -2,15 +2,14 @@ import os
...
@@ -2,15 +2,14 @@ import os
import
redis
import
redis
import
logging
import
logging
from
flask
import
Flask
from
flask
import
Flask
from
config
import
config_map
from
config
import
config_map
from
flask_sqlalchemy
import
SQLAlchemy
from
flask_sqlalchemy
import
SQLAlchemy
from
flask_session
import
Session
from
flask_session
import
Session
from
flask_wtf
import
CSRFProtect
from
flask_cors
import
CORS
from
flask_cors
import
CORS
from
flask_mail
import
Mail
from
flask_mail
import
Mail
from
logging.handlers
import
RotatingFileHandler
from
logging.handlers
import
RotatingFileHandler
from
apps.utils.commons
import
RegexConverter
from
apps.utils.commons
import
RegexConverter
# from apps.util import RegexConverter
from
flask_qiniustorage
import
Qiniu
from
flask_qiniustorage
import
Qiniu
db
=
SQLAlchemy
()
# 创建数据库连接
db
=
SQLAlchemy
()
# 创建数据库连接
...
@@ -31,7 +30,6 @@ logging.getLogger().addHandler(file_log_handler)
...
@@ -31,7 +30,6 @@ logging.getLogger().addHandler(file_log_handler)
# 为全局的日志工具对象(flask app使用的)添加控制台显示记录器
# 为全局的日志工具对象(flask app使用的)添加控制台显示记录器
logging
.
getLogger
()
.
addHandler
(
stream_log_handler
)
logging
.
getLogger
()
.
addHandler
(
stream_log_handler
)
# 设置日志的记录等级
# 设置日志的记录等级
# logging.basicConfig(level=logging.DEBUG) # 调试debug级,会受flask的debug=True影响,强制忽略设置的等级
logging
.
basicConfig
(
level
=
logging
.
INFO
)
# 调试debug级,会受flask的debug=True影响,强制忽略设置的等级
logging
.
basicConfig
(
level
=
logging
.
INFO
)
# 调试debug级,会受flask的debug=True影响,强制忽略设置的等级
...
@@ -46,9 +44,6 @@ def after_request(resp):
...
@@ -46,9 +44,6 @@ def after_request(resp):
# 允许的请求header示例
# 允许的请求header示例
# 'Content-Type,Authorization,X-Requested-With,token,application/octet-stream'
# x-requested-with,content-type
# "Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With"
def
creat_app
(
config_name
):
def
creat_app
(
config_name
):
'''
'''
:param config_name: str 配置模式的名称('develop', 'product')
:param config_name: str 配置模式的名称('develop', 'product')
...
@@ -76,19 +71,13 @@ def creat_app(config_name):
...
@@ -76,19 +71,13 @@ def creat_app(config_name):
db
=
2
,
password
=
config_class
.
REDIS_PASS
)
db
=
2
,
password
=
config_class
.
REDIS_PASS
)
# cors跨域插件,是否允许发送cookies
# cors跨域插件,是否允许发送cookies
# CORS(app, supports_credentials=True)
# CORS(app, resources={r"/.*": {"origins": ["http://bigxigua.net","http://localhost:8006"]}})
CORS
(
app
,
resources
=
r'/*'
)
CORS
(
app
,
resources
=
r'/*'
)
# 邮箱
# 邮箱
Mail
(
app
)
Mail
(
app
)
# 利用flask_session扩展将session数据保存到redis中
Session
(
app
)
Session
(
app
)
# 为flask补充CSRF防护
# CSRFProtect(app)
# 为flask添加自定义的转换器
# 为flask添加自定义的转换器
app
.
url_map
.
converters
[
're'
]
=
RegexConverter
app
.
url_map
.
converters
[
're'
]
=
RegexConverter
...
@@ -104,6 +93,7 @@ def creat_app(config_name):
...
@@ -104,6 +93,7 @@ def creat_app(config_name):
from
apps.inves_manage
import
api_manage
from
apps.inves_manage
import
api_manage
# from apps.view_mobile import api_mobile
# from apps.view_mobile import api_mobile
from
apps.view_xiaocx
import
api_xiaocx
from
apps.view_xiaocx
import
api_xiaocx
from
apps.big_data
import
api_bigdata
app
.
register_blueprint
(
api_user
,
url_prefix
=
'/api/user'
)
app
.
register_blueprint
(
api_user
,
url_prefix
=
'/api/user'
)
app
.
register_blueprint
(
api_radar
,
url_prefix
=
'/api/radar'
)
# 产业招商雷达
app
.
register_blueprint
(
api_radar
,
url_prefix
=
'/api/radar'
)
# 产业招商雷达
...
@@ -117,5 +107,6 @@ def creat_app(config_name):
...
@@ -117,5 +107,6 @@ def creat_app(config_name):
app
.
register_blueprint
(
api_manage
,
url_prefix
=
"/api/manage"
)
app
.
register_blueprint
(
api_manage
,
url_prefix
=
"/api/manage"
)
# app.register_blueprint(api_mobile, url_prefix="/api/mobile")
# app.register_blueprint(api_mobile, url_prefix="/api/mobile")
app
.
register_blueprint
(
api_xiaocx
,
url_prefix
=
"/api/xiaocx"
)
app
.
register_blueprint
(
api_xiaocx
,
url_prefix
=
"/api/xiaocx"
)
app
.
register_blueprint
(
api_bigdata
,
url_prefix
=
"/api/bigdata"
)
return
app
return
app
apps/big_data/__init__.py
0 → 100644
View file @
69041829
from
flask
import
Blueprint
# 创建蓝图对象
api_bigdata
=
Blueprint
(
"api_bigdata"
,
__name__
)
from
.
import
view
"大数据局专用接口"
apps/big_data/view.py
0 → 100644
View file @
69041829
from
flask
import
current_app
,
jsonify
,
request
from
apps.models
import
*
from
apps.models
import
ProjectManagement
from
apps.utils.response_code
import
RET
from
apps.big_data
import
api_bigdata
# 项目管理---项目列表
"""项目总览"""
@api_bigdata.route
(
"/ProjectStalker"
,
methods
=
[
"POST"
])
# 项目跟踪
def
project_stalker
():
req_dic
=
request
.
get_json
()
district
=
req_dic
[
'district'
]
stalker_num1
=
0
stalker_num2
=
0
stalker_num3
=
0
sign_num
=
0
start_num
=
0
end_num
=
0
job_num
=
0
new_value_num
=
0
revenue_num
=
0
try
:
project_obj_list
=
ProjectManagement
.
query
.
filter
(
ProjectManagement
.
district
==
district
if
district
else
text
(
''
),
ProjectManagement
.
is_delete
==
0
)
.
all
()
for
project_obj
in
project_obj_list
:
if
project_obj
.
sign_time
and
project_obj
.
project_stalker
==
'进展顺利项目'
:
stalker_num1
+=
1
if
project_obj
.
sign_time
and
project_obj
.
project_stalker
==
'进展难点项目'
:
stalker_num2
+=
1
if
project_obj
.
sign_time
and
project_obj
.
project_stalker
==
'进展难点项目'
:
stalker_num3
+=
1
if
project_obj
.
sign_time
and
project_obj
.
investment_volume
>=
100000
:
stalker_num3
+=
1
if
project_obj
.
sign_time
:
sign_num
+=
1
if
project_obj
.
start_time
:
start_num
+=
1
if
project_obj
.
end_time
:
end_num
+=
1
if
project_obj
.
job_num
:
job_num
+=
project_obj
.
job_num
if
project_obj
.
new_value
:
new_value_num
+=
project_obj
.
new_value
if
project_obj
.
revenue
:
revenue_num
+=
project_obj
.
revenue
data
=
{
"stalker_num1"
:
stalker_num1
,
"stalker_num2"
:
stalker_num2
,
"stalker_num3"
:
stalker_num3
,
"sign_num"
:
sign_num
,
"start_num"
:
start_num
,
"end_num"
:
end_num
,
"job_num"
:
job_num
,
"new_value_num"
:
new_value_num
,
"revenue_num"
:
revenue_num
}
return
jsonify
(
code
=
RET
.
OK
,
data
=
data
,
msg
=
"查询成功!"
)
except
Exception
as
e
:
current_app
.
logger
.
error
(
e
)
return
jsonify
(
code
=
RET
.
DBERR
,
msg
=
"查询出错!"
)
apps/view_atlas/view.py
View file @
69041829
...
@@ -308,6 +308,7 @@ def find_up_thr1(chain_id, industry_type, industry_id, flag):
...
@@ -308,6 +308,7 @@ def find_up_thr1(chain_id, industry_type, industry_id, flag):
two_id_li
=
[]
two_id_li
=
[]
chain_name2
=
pname_two
[
"chain_name"
]
chain_name2
=
pname_two
[
"chain_name"
]
id_list
,
company_count
=
get_count
(
chain_id
,
industry_id
,
chain_name2
,
flag
)
id_list
,
company_count
=
get_count
(
chain_id
,
industry_id
,
chain_name2
,
flag
)
two_id_li
.
extend
(
id_list
)
one_id_li
.
extend
(
two_id_li
)
one_id_li
.
extend
(
two_id_li
)
# 二级
# 二级
...
...
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