Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
automatedtestplatform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
QA
automatedtestplatform
Commits
15fb7211
Commit
15fb7211
authored
Jan 03, 2023
by
王英豪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
a92c1e5e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
89 additions
and
10 deletions
+89
-10
testing_progress_url.cpython-37.pyc
...gress_url/__pycache__/testing_progress_url.cpython-37.pyc
+0
-0
testing_progress_url.py
...ted_main/url/testing_progress_url/testing_progress_url.py
+2
-1
api_yapi_util.py
automated_main/utils/api_yapi_util.py
+4
-4
personnel_allocation_view.py
...rogress/personnel_allocation/personnel_allocation_view.py
+83
-5
No files found.
automated_main/url/testing_progress_url/__pycache__/testing_progress_url.cpython-37.pyc
View file @
15fb7211
No preview for this file type
automated_main/url/testing_progress_url/testing_progress_url.py
View file @
15fb7211
...
@@ -4,12 +4,13 @@
...
@@ -4,12 +4,13 @@
# @File : testing_progress_url.py
# @File : testing_progress_url.py
# @desc:
# @desc:
from
django.urls
import
path
from
django.urls
import
path
from
automated_main.view.testing_progress.personnel_allocation.personnel_allocation_view
import
PersonnelAllocationView
,
PersonnelAllocationListView
from
automated_main.view.testing_progress.personnel_allocation.personnel_allocation_view
import
PersonnelAllocationView
,
PersonnelAllocationListView
,
dataExportGanttView
urlpatterns
=
[
urlpatterns
=
[
path
(
"api/backend/personnel_allocation/"
,
PersonnelAllocationView
.
as_view
()),
path
(
"api/backend/personnel_allocation/"
,
PersonnelAllocationView
.
as_view
()),
path
(
"api/backend/personnel_allocation/<int:pid>/"
,
PersonnelAllocationView
.
as_view
()),
path
(
"api/backend/personnel_allocation/<int:pid>/"
,
PersonnelAllocationView
.
as_view
()),
path
(
"api/backend/personnel_allocation/dataExportGantt/"
,
dataExportGanttView
.
as_view
()),
path
(
"api/backend/personnel_allocation_list/"
,
PersonnelAllocationListView
.
as_view
()),
path
(
"api/backend/personnel_allocation_list/"
,
PersonnelAllocationListView
.
as_view
()),
]
]
\ No newline at end of file
automated_main/utils/api_yapi_util.py
View file @
15fb7211
...
@@ -13,17 +13,17 @@ class ApiYapiServer:
...
@@ -13,17 +13,17 @@ class ApiYapiServer:
@
staticmethod
@
staticmethod
def
api_yapi_server_data
(
yapi_id
):
def
api_yapi_server_data
(
yapi_id
):
data
=
{
"email"
:
"
wangyinghao@qike366.com"
,
"password"
:
"123456
"
}
data
=
{
"email"
:
"
yinghao.wang"
,
"password"
:
"wangyinghao123!
"
}
header
=
{
header
=
{
"Content-Type"
:
"application/json"
"Content-Type"
:
"application/json"
}
}
# YaPi登录接口
# YaPi登录接口
r
=
requests
.
post
(
url
=
"http://yapi.
rd
.com/api/user/login_by_ldap"
,
json
=
data
,
headers
=
header
)
r
=
requests
.
post
(
url
=
"http://yapi.
quantgroups
.com/api/user/login_by_ldap"
,
json
=
data
,
headers
=
header
)
cookie
=
r
.
cookies
cookie
=
r
.
cookies
yapi_api_url
=
"http://yapi.
rd
.com/api/interface/get?id="
+
str
(
yapi_id
)
yapi_api_url
=
"http://yapi.
quantgroups
.com/api/interface/get?id="
+
str
(
yapi_id
)
# YaPi接口数据
# YaPi接口数据
yapi_api_data
=
requests
.
get
(
url
=
yapi_api_url
,
headers
=
header
,
cookies
=
cookie
)
.
json
()
yapi_api_data
=
requests
.
get
(
url
=
yapi_api_url
,
headers
=
header
,
cookies
=
cookie
)
.
json
()
...
@@ -118,7 +118,7 @@ class ApiYapiServer:
...
@@ -118,7 +118,7 @@ class ApiYapiServer:
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
sen
=
ApiYapiServer
()
sen
=
ApiYapiServer
()
print
(
sen
.
api_yapi_server_data
(
4
201
))
print
(
sen
.
api_yapi_server_data
(
4
7240
))
# 2646 json
# 2646 json
# 20066 from
# 20066 from
automated_main/view/testing_progress/personnel_allocation/personnel_allocation_view.py
View file @
15fb7211
...
@@ -27,11 +27,6 @@ class PersonnelAllocationView(View):
...
@@ -27,11 +27,6 @@ class PersonnelAllocationView(View):
return
response_success
()
return
response_success
()
data
=
json
.
loads
(
body
)
data
=
json
.
loads
(
body
)
ENV_PROFILE
=
os
.
getenv
(
"ENV"
)
logger
.
info
(
'222222222222'
)
logger
.
info
(
ENV_PROFILE
)
logger
.
info
(
'222222222222'
)
if
'color'
in
data
.
keys
():
if
'color'
in
data
.
keys
():
TestingProgress
.
objects
.
create
(
testing_progress_title
=
data
[
'text'
],
TestingProgress
.
objects
.
create
(
testing_progress_title
=
data
[
'text'
],
start_date
=
data
[
'start_date'
],
start_date
=
data
[
'start_date'
],
...
@@ -176,3 +171,86 @@ class PersonnelAllocationListView(View):
...
@@ -176,3 +171,86 @@ class PersonnelAllocationListView(View):
pass
pass
return
response_success
(
testing_progress_list
)
return
response_success
(
testing_progress_list
)
class
dataExportGanttView
(
View
):
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
"""
导出数据
"""
body
=
request
.
body
data
=
json
.
loads
(
body
)
# 查询时间
date_list_query
=
[]
begin_date_query
=
datetime
.
datetime
.
strptime
(
data
[
'data_time_personnel'
][
0
],
"
%
Y-
%
m-
%
d"
)
end_date_query
=
datetime
.
datetime
.
strptime
(
data
[
'data_time_personnel'
][
1
],
"
%
Y-
%
m-
%
d"
)
while
begin_date_query
<=
end_date_query
:
date_str
=
begin_date_query
.
strftime
(
"
%
Y-
%
m-
%
d"
)
date_list_query
.
append
(
date_str
)
begin_date_query
+=
datetime
.
timedelta
(
days
=
1
)
testing_progress_data
=
TestingProgress
.
objects
.
all
()
testing_progress_list
=
[]
for
testing_progress
in
testing_progress_data
:
if
testing_progress
.
group
==
1
:
render
=
"split"
testing_progress_dict
=
{
"text"
:
testing_progress
.
testing_progress_title
,
"id"
:
testing_progress
.
id
,
"render"
:
render
,
"parent"
:
testing_progress
.
parent
,
"group"
:
str
(
testing_progress
.
group
),
"color"
:
testing_progress
.
type
,
"description"
:
testing_progress
.
description
}
testing_progress_list
.
append
(
testing_progress_dict
)
else
:
render
=
""
# 任务的开始时间 转换 年月日时分
dates_start_date
=
time
.
strptime
(
testing_progress
.
start_date
,
"
%
Y-
%
m-
%
d
%
H:
%
M"
)
dates_start_date
=
time
.
strftime
(
"
%
Y-
%
m-
%
d"
,
dates_start_date
)
# 任务的结束时间 年月日时分
dates_end_date
=
time
.
strptime
(
testing_progress
.
end_date
,
"
%
Y-
%
m-
%
d
%
H:
%
M"
)
dates_end_date
=
time
.
strftime
(
"
%
Y-
%
m-
%
d"
,
dates_end_date
)
data_list_task
=
[]
date_start
=
datetime
.
datetime
.
strptime
(
dates_start_date
,
'
%
Y-
%
m-
%
d'
)
date_end
=
datetime
.
datetime
.
strptime
(
dates_end_date
,
'
%
Y-
%
m-
%
d'
)
data_list_task
.
append
(
date_start
.
strftime
(
'
%
Y-
%
m-
%
d'
))
while
date_start
<
date_end
:
date_start
+=
datetime
.
timedelta
(
days
=
1
)
data_list_task
.
append
(
date_start
.
strftime
(
'
%
Y-
%
m-
%
d'
))
set_c
=
set
(
date_list_query
)
&
set
(
data_list_task
)
list_c
=
list
(
set_c
)
if
len
(
list_c
)
>
0
:
if
testing_progress
.
parent
==
"0"
:
parent
=
""
else
:
parent
=
testing_progress
.
parent
testing_progress_dict
=
{
"text"
:
testing_progress
.
testing_progress_title
,
"start_date"
:
testing_progress
.
start_date
,
"id"
:
testing_progress
.
id
,
"duration"
:
testing_progress
.
duration
,
"parent"
:
parent
,
"type"
:
testing_progress
.
type
,
"end_date"
:
testing_progress
.
end_date
,
"render"
:
render
,
"progress"
:
testing_progress
.
testing_progress
,
"group"
:
str
(
testing_progress
.
group
),
"color"
:
testing_progress
.
type
,
"description"
:
testing_progress
.
description
}
testing_progress_list
.
append
(
testing_progress_dict
)
else
:
pass
print
(
testing_progress_list
)
return
response_success
()
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