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
8b22b940
Commit
8b22b940
authored
Mar 03, 2023
by
dong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix20230303
parent
a18af756
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
9 deletions
+37
-9
apps/inves_manage/project_manager.py
+2
-3
apps/inves_manage/statistic_analysis_view.py
+35
-6
apps/view_xiaocx/view.py
+0
-0
No files found.
apps/inves_manage/project_manager.py
View file @
8b22b940
...
...
@@ -1206,10 +1206,9 @@ def upload_jc_data():
# 上传的文件
file
=
request
.
files
[
'file'
]
year
=
request
.
form
[
'year'
]
# 年份,如'2022年'
print
(
file
.
filename
)
# 打印文件名
if
not
year
:
return
jsonify
(
code
=
RET
.
PARAMERR
,
msg
=
'数据年份不能为空!'
)
upload_time
=
datetime
.
now
()
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
# current_year = str(datetime.now().year) + '年'
try
:
f
=
file
.
read
()
# 文件内容
...
...
apps/inves_manage/statistic_analysis_view.py
View file @
8b22b940
...
...
@@ -26,13 +26,29 @@ from apps.inves_manage.siku_view import get_num, upload_daily_picture
"""指标分析"""
# 获取项目中的最大月份
def
get_max_month
():
try
:
project_obj_list
=
ProjectManagement
.
query
.
all
()
month_list
=
[]
year
=
datetime
.
now
()
.
year
for
project_obj
in
project_obj_list
:
if
project_obj
.
sign_time
and
str
(
year
)
in
project_obj
.
sign_time
:
month_list
.
append
(
project_obj
.
sign_time
.
split
(
'-'
)[
1
])
max_month
=
max
(
set
(
month_list
))
+
1
return
max_month
except
Exception
as
e
:
return
'error'
# 项目签约完成率
def
get_data1
(
data_time
,
district_li
,
current_year
):
data_li1
=
[]
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'
)
max_month
=
get_max_month
()
now_time
=
datetime
.
now
()
.
strftime
(
'
%
Y-{}-01 00:00:00'
.
format
(
max_month
))
now_time1
=
(
datetime
.
now
()
-
relativedelta
(
years
=
1
))
.
strftime
(
'
%
Y-01-01 00:00:00'
)
if
data_time
:
if
data_time
[
0
]
and
data_time
[
1
]:
...
...
@@ -42,6 +58,20 @@ def get_data1(data_time, district_li, current_year):
try
:
for
district
in
district_li
:
# 先查询最新的年度目标是哪一年的
jc_obj_list
=
JcTarget
.
query
.
filter
(
JcTarget
.
district_name
==
district
if
district
!=
'全市'
else
text
(
''
),
JcTarget
.
is_delete
==
0
)
.
all
()
# 获取最大年份
year_li
=
[]
for
jc_obj
in
jc_obj_list
:
year
=
jc_obj
.
year
.
split
(
'年'
)[
0
]
year_li
.
append
(
int
(
year
))
max_year
=
max
(
set
(
year_li
))
if
not
data_time
:
project_obj_list
=
ProjectManagement
.
query
.
filter
(
ProjectManagement
.
is_delete
==
0
,
...
...
@@ -65,10 +95,12 @@ def get_data1(data_time, district_li, current_year):
investment_volume
=
0
else
:
investment_volume
=
sum
([
project_obj
.
investment_volume
for
project_obj
in
project_obj_list
])
# 年度目标
jc_obj
=
JcTarget
.
query
.
filter
(
JcTarget
.
district_name
==
district
if
district
!=
'全市'
else
text
(
''
),
JcTarget
.
year
.
like
(
'
%
{}
%
'
.
format
(
str
(
data_time
[
0
]))
if
data_time
else
str
(
current_year
)),
# JcTarget.year.like('%{}%'.format(str(data_time[0])) if data_time else str(current_year)),
JcTarget
.
year
.
like
(
'
%
{}
%
'
.
format
(
str
(
data_time
[
0
])))
if
data_time
else
text
(
''
),
JcTarget
.
is_delete
==
0
)
.
first
()
if
not
jc_obj
:
...
...
@@ -500,17 +532,14 @@ def statistic_jc_data():
data_time
=
req_dic
[
'data_time'
]
# ["2022", "01", "12"]
current_year
=
datetime
.
now
()
.
year
# current_year = 2022
district_li
=
[
"全市"
,
"城区"
,
"泽州县"
,
"高平市"
,
"阳城县"
,
"陵川县"
,
"沁水县"
,
"晋城经济技术开发区"
]
try
:
# data_li1, data_li2, data_li3, data_li4, data_li5 = get_data_li(district_li, current_year, data_time)
data_li1
,
data_li2
,
data_li3
,
data_li4
,
data_li5
=
get_data_li
(
data_time
,
district_li
,
current_year
)
# 六。综合得分
data_li6
=
get_data6
(
district_li
,
data_li1
,
data_li2
,
data_li3
,
data_li4
,
data_li5
)
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
]
+
'号-至今'
...
...
apps/view_xiaocx/view.py
View file @
8b22b940
This diff is collapsed.
Click to expand it.
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