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
3d8d6a83
Commit
3d8d6a83
authored
Feb 07, 2023
by
dong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix20230202
parent
8b5eaa94
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
69 additions
and
25 deletions
+69
-25
apps/inves_manage/project_manager.py
+0
-1
apps/inves_manage/statistic_analysis_view.py
+69
-24
No files found.
apps/inves_manage/project_manager.py
View file @
3d8d6a83
...
...
@@ -294,7 +294,6 @@ def upload_project_data2():
if
not
row_content
:
return
jsonify
(
code
=
RET
.
NODATA
,
msg
=
"表格内无有效数据!请尝试 <清空浏览器缓存> 后下载最新模板,根据模板提示信息编辑数据后再次上传。(注:第三行为首行有效数据不能为空、第一行和第二行无法读取。)"
)
# del (row_content[0])
project_name
=
row_content
[
1
]
# 项目名称
# 判断该项目是否已经存在
project_obj
=
ProjectManagement
.
query
.
filter_by
(
project_name
=
project_name
,
is_delete
=
0
)
.
first
()
...
...
apps/inves_manage/statistic_analysis_view.py
View file @
3d8d6a83
...
...
@@ -183,8 +183,9 @@ def get_data3(data_time, district_li, current_year):
else
:
project_obj_list
=
ProjectManagement
.
query
.
filter
(
ProjectManagement
.
is_delete
==
0
,
ProjectManagement
.
start_time
<
now_time4
if
now_time4
else
now_time4
,
ProjectManagement
.
start_time
<
now_time4
if
now_time4
else
text
(
""
)
,
ProjectManagement
.
start_time
>=
now_time3
,
# ProjectManagement.start_time == now_time3 if now_time4 else text(""),
ProjectManagement
.
district
.
like
(
'
%
{}
%
'
.
format
(
str
(
district
)))
if
district
!=
'全市'
else
text
(
''
)
)
.
all
()
if
not
project_obj_list
:
...
...
@@ -290,7 +291,7 @@ def get_data5(data_time, district_li, current_year):
ProjectManagement
.
is_delete
==
0
,
ProjectManagement
.
is_fixed_investment
==
'否'
,
# ProjectManagement.sign_time.like('%{}%'.format(str(current_year))),
ProjectManagement
.
sign_time
<
now_time4
if
now_time4
else
now_time4
,
ProjectManagement
.
sign_time
<
now_time4
if
now_time4
else
text
(
""
)
,
ProjectManagement
.
sign_time
>=
now_time3
,
ProjectManagement
.
district
.
like
(
'
%
{}
%
'
.
format
(
str
(
district
)))
if
district
!=
'全市'
else
text
(
''
)
)
.
all
()
...
...
@@ -520,13 +521,16 @@ def statistic_jc_data():
# now_time = datetime.now().strftime('%Y-%m-01 00:00:00')
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
]
+
'号-至今'
data_time1
=
now_time
[
0
]
+
'年'
+
now_time
[
1
]
+
'月'
+
now_time
[
2
]
+
'号-至今'
elif
not
data_time
[
2
]:
data_time1
=
data_time
[
0
]
+
'年'
+
data_time
[
1
]
+
'月'
# ["2022", "01", ""]
else
:
data_time1
=
data_time
[
0
]
+
'年'
+
data_time
[
1
]
+
'-'
+
data_time
[
2
]
+
'月'
# ["2022", "01", "12"]
return
jsonify
(
code
=
RET
.
OK
,
data
=
{
"data_li1"
:
data_li1
,
"data_li2"
:
data_li2
,
"data_li3"
:
data_li3
,
"data_li4"
:
data_li4
,
"data_li5"
:
data_li5
,
"data_li6"
:
data_li6
},
data_time
=
data_time
,
data_time
=
data_time
1
,
msg
=
"数据查询成功"
)
except
Exception
as
e
:
current_app
.
logger
.
error
(
e
)
...
...
@@ -940,11 +944,9 @@ def project_graph():
flag
=
req_dic
[
'flag'
]
# 1项目来源区域分布,2项目投资额区间分布,3项目产业分布,4项目行业类型分布
project_source
=
req_dic
[
'project_source'
]
# 用于1项目来源区域分布
industry_name
=
req_dic
[
'industry_name'
]
# 用于4项目行业类型分布
data_time
=
req_dic
[
'data_time'
]
#
"2022年01-09月"
data_time
=
req_dic
[
'data_time'
]
#
["2022", "01", "12"]
current_year
=
datetime
.
now
()
.
year
# current_year = 2022
now_time3
=
''
now_time4
=
''
now_time
=
datetime
.
now
()
.
strftime
(
'
%
Y-
%
m-01 00:00:00'
)
...
...
@@ -969,7 +971,7 @@ def project_graph():
project_obj
=
ProjectManagement
.
query
.
filter
(
ProjectManagement
.
district
==
district
if
district
else
text
(
''
),
# ProjectManagement.sign_time.like('%{}%'.format(str(current_year))),
ProjectManagement
.
sign_time
<
now_time4
if
now_time4
else
now_time4
,
ProjectManagement
.
sign_time
<
now_time4
if
now_time4
else
text
(
''
)
,
ProjectManagement
.
sign_time
>=
now_time3
,
ProjectManagement
.
is_delete
==
0
)
...
...
@@ -1180,7 +1182,17 @@ def project_graph():
else
:
return
jsonify
(
code
=
RET
.
PARAMERR
,
msg
=
"参数错误!"
)
return
jsonify
(
code
=
RET
.
OK
,
data
=
data
,
msg
=
'数据查询成功'
)
if
not
data_time
:
# now_time = datetime.now().strftime('%Y-%m-01 00:00:00')
now_time
=
(
datetime
.
now
()
-
relativedelta
(
years
=
1
))
.
strftime
(
'
%
Y-
%
m-
%
d'
)
now_time
=
now_time
.
split
(
'-'
)
data_time1
=
now_time
[
0
]
+
'年'
+
now_time
[
1
]
+
'月'
+
now_time
[
2
]
+
'号-至今'
elif
not
data_time
[
2
]:
data_time1
=
data_time
[
0
]
+
'年'
+
data_time
[
1
]
+
'月'
# ["2022", "01", ""]
else
:
data_time1
=
data_time
[
0
]
+
'年'
+
data_time
[
1
]
+
'-'
+
data_time
[
2
]
+
'月'
# ["2022", "01", "12"]
return
jsonify
(
code
=
RET
.
OK
,
data
=
data
,
data_time
=
data_time1
,
msg
=
'数据查询成功'
)
except
Exception
as
e
:
current_app
.
logger
.
error
(
e
)
return
jsonify
(
code
=
RET
.
DBERR
,
msg
=
"数据查询错误!"
)
...
...
@@ -1195,19 +1207,41 @@ def areal_project():
investment_volume
=
req_dic
[
'investment_volume'
]
# 用于2项目投资额区间分布
industry_level
=
req_dic
[
'industry_level'
]
# 用于3项目产业分布
industry_name
=
req_dic
[
'industry_name'
]
# 用于4项目行业类型分布
flag
=
req_dic
[
'flag'
]
# 1项目来源区域分布,2项目投资额区间分布,3项目产业分布,4项目行业类型分布
page
=
req_dic
[
'page'
]
per_page
=
req_dic
[
'per_page'
]
data_time
=
req_dic
[
'data_time'
]
# ["2022", "01", "12"]
# current_year = datetime.now().year
current_year
=
2022
# current_year = 2022
now_time3
=
''
now_time4
=
''
now_time
=
datetime
.
now
()
.
strftime
(
'
%
Y-
%
m-
%
d'
)
now_time1
=
(
datetime
.
now
()
-
relativedelta
(
years
=
1
))
.
strftime
(
'
%
Y-
%
m-
%
d'
)
if
data_time
:
if
data_time
[
0
]
and
data_time
[
1
]:
now_time3
=
(
'{}-{}-01'
)
.
format
(
data_time
[
0
],
data_time
[
1
])
if
data_time
[
2
]:
now_time4
=
(
'{}-{}-01'
)
.
format
(
data_time
[
0
],
data_time
[
2
])
try
:
project_obj
=
ProjectManagement
.
query
.
filter
(
ProjectManagement
.
district
==
district
if
district
else
text
(
''
),
ProjectManagement
.
sign_time
.
like
(
'
%
{}
%
'
.
format
(
str
(
current_year
))),
ProjectManagement
.
is_delete
==
0
)
if
not
data_time
:
project_obj
=
ProjectManagement
.
query
.
filter
(
ProjectManagement
.
district
==
district
if
district
else
text
(
''
),
# ProjectManagement.sign_time.like('%{}%'.format(str(current_year))),
ProjectManagement
.
sign_time
<
now_time
,
ProjectManagement
.
sign_time
>=
now_time1
,
ProjectManagement
.
is_delete
==
0
)
else
:
project_obj
=
ProjectManagement
.
query
.
filter
(
ProjectManagement
.
district
==
district
if
district
else
text
(
''
),
# ProjectManagement.sign_time.like('%{}%'.format(str(current_year))),
ProjectManagement
.
sign_time
<
now_time4
if
now_time4
else
text
(
''
),
ProjectManagement
.
sign_time
>=
now_time3
,
ProjectManagement
.
is_delete
==
0
)
if
flag
==
1
:
# 项目来源区域分布项目列表
if
project_source
==
'京津冀'
:
...
...
@@ -1318,10 +1352,22 @@ def areal_project():
"project_type"
:
project_obj
.
industry_level
,
"investment_volume"
:
project_obj
.
investment_volume
}
for
project_obj
in
project_obj_list
]
if
not
data_time
:
# now_time = datetime.now().strftime('%Y-%m-01 00:00:00')
now_time
=
(
datetime
.
now
()
-
relativedelta
(
years
=
1
))
.
strftime
(
'
%
Y-
%
m-
%
d'
)
now_time
=
now_time
.
split
(
'-'
)
data_time1
=
now_time
[
0
]
+
'年'
+
now_time
[
1
]
+
'月'
+
now_time
[
2
]
+
'号-至今'
elif
not
data_time
[
2
]:
data_time1
=
data_time
[
0
]
+
'年'
+
data_time
[
1
]
+
'月'
# ["2022", "01", ""]
else
:
data_time1
=
data_time
[
0
]
+
'年'
+
data_time
[
1
]
+
'-'
+
data_time
[
2
]
+
'月'
# ["2022", "01", "12"]
return
jsonify
(
code
=
RET
.
OK
,
data
=
{
"data"
:
data
,
"size"
:
project_size
,
"id_list"
:
id_list
,
"data_time"
:
data_time1
,
"msg"
:
"数据获取成功!"
})
except
Exception
as
e
:
current_app
.
logger
.
error
(
e
)
...
...
@@ -1370,7 +1416,7 @@ def get_data():
# rate = round(sign_money / target * 100, 2) if target and target != 0 else 0
# data.update({"rate": rate})
# target_data_li.append(data)
target_data_li
=
get_data1
(
district_li1
,
current_year
)
target_data_li
=
get_data1
(
[],
district_li1
,
current_year
)
return
jsonify
(
code
=
RET
.
OK
,
data
=
target_data_li
,
msg
=
'数据查询成功。'
)
except
Exception
as
e
:
current_app
.
logger
.
error
(
e
)
...
...
@@ -1402,7 +1448,7 @@ def get_data():
# rate = round(target / sign_num * 100, 2) if sign_num and sign_num != 0 else 0
# data.update({"rate": rate})
# target_data_li.append(data)
target_data_li
=
get_data2
(
district_li1
,
current_year
)
target_data_li
=
get_data2
(
[],
district_li1
,
current_year
)
return
jsonify
(
code
=
RET
.
OK
,
data
=
target_data_li
,
msg
=
'数据查询成功。'
)
except
Exception
as
e
:
...
...
@@ -1443,7 +1489,7 @@ def get_data():
# rate = round(new_start_money / target * 100, 2) if target and target != 0 else 0
# data.update({"rate": rate})
# target_data_li.append(data)
target_data_li
=
get_data3
(
district_li1
,
current_year
)
target_data_li
=
get_data3
(
[],
district_li1
,
current_year
)
return
jsonify
(
code
=
RET
.
OK
,
data
=
target_data_li
,
msg
=
'数据查询成功。'
)
except
Exception
as
e
:
current_app
.
logger
.
error
(
e
)
...
...
@@ -1487,7 +1533,7 @@ def get_data():
# gutou1_rate = round(gutou1_money / gutou1_target * 100, 2) if gutou1_target and gutou1_target != 0 else 0
# data.update({"rate": gutou1_rate})
# target_data_li.append(data)
target_data_li
=
get_data4
(
district_li1
,
current_year
)
target_data_li
=
get_data4
(
[],
district_li1
,
current_year
)
return
jsonify
(
code
=
RET
.
OK
,
data
=
target_data_li
,
msg
=
'数据查询成功。'
)
except
Exception
as
e
:
current_app
.
logger
.
error
(
e
)
...
...
@@ -1528,8 +1574,8 @@ def get_data():
# gutou0_rate = round(gutou0_money / gutou0_target * 100, 2) if gutou0_target and gutou0_target != 0 else 0
# data.update({"rate": gutou0_rate})
# target_data_li.append(data)
target_data_li
=
get_data5
(
district_li1
,
current_year
)
target_data_li
=
get_data5
(
[],
district_li1
,
current_year
)
return
jsonify
(
code
=
RET
.
OK
,
data
=
target_data_li
,
msg
=
'数据查询成功。'
)
except
Exception
as
e
:
current_app
.
logger
.
error
(
e
)
return
jsonify
(
code
=
RET
.
DBERR
,
msg
=
"数据查询错误!"
)
\ No newline at end of file
return
jsonify
(
code
=
RET
.
DBERR
,
msg
=
"数据查询错误!"
)
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