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
5b10cda0
Commit
5b10cda0
authored
Mar 06, 2023
by
dong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix20230306
parent
af335593
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
23 deletions
+39
-23
apps/inves_manage/statistic_analysis_view.py
+39
-23
No files found.
apps/inves_manage/statistic_analysis_view.py
View file @
5b10cda0
...
...
@@ -1418,7 +1418,7 @@ def project_graph():
now_time3
=
''
now_time4
=
''
now_time
=
datetime
.
now
()
.
strftime
(
'
%
Y-
%
m-01 00:00:00'
)
now_time1
=
(
datetime
.
now
()
-
relativedelta
(
years
=
1
))
.
strftime
(
'
%
Y-
%
m-01 00:00:00'
)
now_time1
=
(
datetime
.
now
()
+
relativedelta
(
years
=
1
))
.
strftime
(
'
%
Y-
%
m-01 00:00:00'
)
if
data_time
:
if
data_time
[
0
]
and
data_time
[
1
]:
...
...
@@ -1431,8 +1431,8 @@ 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_time
,
ProjectManagement
.
sign_time
>=
now_time
1
,
ProjectManagement
.
sign_time
<
now_time
1
,
ProjectManagement
.
sign_time
>=
now_time
,
ProjectManagement
.
is_delete
==
0
)
else
:
...
...
@@ -1651,10 +1651,10 @@ def project_graph():
return
jsonify
(
code
=
RET
.
PARAMERR
,
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
]
+
'号-至今
'
# 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] + '号-至今'
data_time1
=
str
(
current_year
)
+
'年
'
elif
not
data_time
[
2
]:
data_time1
=
data_time
[
0
]
+
'年'
+
data_time
[
1
]
+
'月'
# ["2022", "01", ""]
else
:
...
...
@@ -1680,12 +1680,12 @@ def areal_project():
per_page
=
req_dic
[
'per_page'
]
data_time
=
req_dic
[
'data_time'
]
# ["2022", "01", "12"]
#
current_year = datetime.now().year
current_year
=
datetime
.
now
()
.
year
# 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'
)
now_time1
=
(
datetime
.
now
()
+
relativedelta
(
years
=
1
))
.
strftime
(
'
%
Y-
%
m-
%
d'
)
if
data_time
:
if
data_time
[
0
]
and
data_time
[
1
]:
...
...
@@ -1698,8 +1698,8 @@ def areal_project():
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_time
1
,
ProjectManagement
.
sign_time
<
now_time
1
,
ProjectManagement
.
sign_time
>=
now_time
,
ProjectManagement
.
is_delete
==
0
)
else
:
...
...
@@ -1823,9 +1823,10 @@ def areal_project():
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
]
+
'号-至今'
# 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] + '号-至今'
data_time1
=
str
(
current_year
)
+
'年'
elif
not
data_time
[
2
]:
data_time1
=
data_time
[
0
]
+
'年'
+
data_time
[
1
]
+
'月'
# ["2022", "01", ""]
else
:
...
...
@@ -1855,14 +1856,21 @@ def get_data():
# 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] + '号-至今'
# 获取晋城年度目标表中的最新数据看看是哪一年的
jc_obj_list
=
JcTarget
.
query
.
filter
(
# JcTarget.district_name == district if district != '全市' else text(''),
JcTarget
.
is_delete
==
0
)
.
all
()
year_list
=
[]
for
jc_obj
in
jc_obj_list
:
year_list
.
append
(
int
(
jc_obj
.
year
.
split
(
'年'
)[
0
]))
max_year
=
max
(
set
(
year_list
))
target_data_li
=
[]
if
flag
==
1
:
# 签约项目完成情况
try
:
target_data_li
=
get_data1
(
data_time
,
district_li1
,
current_year
)
target_data_li
=
get_data1
(
data_time
,
district_li1
,
max_year
)
if
not
data_time
:
data_time
=
str
(
max_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
)
...
...
@@ -1870,7 +1878,9 @@ def get_data():
if
flag
==
2
:
# 项目开工完成情况
try
:
target_data_li
=
get_data2
(
data_time
,
district_li1
,
current_year
)
target_data_li
=
get_data2
(
data_time
,
district_li1
,
max_year
)
if
not
data_time
:
data_time
=
str
(
max_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
)
...
...
@@ -1878,7 +1888,9 @@ def get_data():
if
flag
==
3
:
# 新开工项目计划投资额完情况
try
:
target_data_li
=
get_data3
(
data_time
,
district_li1
,
current_year
)
target_data_li
=
get_data3
(
data_time
,
district_li1
,
max_year
)
if
not
data_time
:
data_time
=
str
(
max_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
)
...
...
@@ -1886,7 +1898,9 @@ def get_data():
if
flag
==
4
:
# 固投资金完成情况
try
:
target_data_li
=
get_data4
(
data_time
,
district_li1
,
current_year
)
target_data_li
=
get_data4
(
data_time
,
district_li1
,
max_year
)
if
not
data_time
:
data_time
=
str
(
max_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
)
...
...
@@ -1894,7 +1908,9 @@ def get_data():
if
flag
==
5
:
# 非固投资金完成情况
try
:
target_data_li
=
get_data5
(
data_time
,
district_li1
,
current_year
)
target_data_li
=
get_data5
(
data_time
,
district_li1
,
max_year
)
if
not
data_time
:
data_time
=
str
(
max_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
)
...
...
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