切换导航条
此项目
正在载入...
登录
allied-creation
/
performance
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
tangxvhui
2 years ago
提交
84a274fd07120a5d1b7f729a647af0569502e407
1 个父辈
e9b9e57e
调整 任务详情输出
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
37 行增加
和
12 行删除
pkg/application/task/adapter/task_info.go
pkg/application/task/service/service.go
pkg/application/task/adapter/task_info.go
查看文件 @
84a274f
...
...
@@ -16,9 +16,10 @@ type TaskInfoAdapter struct {
}
type
UserData
struct
{
Id
int64
`json:"id,string"`
// 用户Id
Account
string
`json:"account"`
// 用户账号
Name
string
`json:"name"`
// 用户姓名
Id
int64
`json:"id,string"`
// 用户Id
ParentId
int64
`json:"parentId,string"`
Account
string
`json:"account"`
// 用户账号
Name
string
`json:"name"`
// 用户姓名
}
type
TaskStage
struct
{
...
...
pkg/application/task/service/service.go
查看文件 @
84a274f
...
...
@@ -109,7 +109,7 @@ func (srv TaskService) CreateTask(transactionContext application.TransactionCont
Status
:
domain
.
TaskRunning
,
Level
:
0
,
LevelName
:
""
,
RelatedUser
:
[]
int
{},
RelatedUser
:
[]
int
{
int
(
leaderData
.
Id
),
int
(
leaderData
.
ParentId
)
},
RunAt
:
nowTime
.
Unix
(),
StopAt
:
0
,
}
...
...
@@ -215,9 +215,22 @@ func (srv TaskService) UpdateTask(param *command.UpdateTaskCommand) (map[string]
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
"获取任务的相关人员"
+
err
.
Error
())
}
}
_
,
leaderList
,
err
:=
userRepo
.
Find
(
map
[
string
]
interface
{}{
"id"
:
taskData
.
Leader
.
Id
,
})
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
"查询人员失败:"
+
err
.
Error
())
}
if
len
(
leaderList
)
==
0
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
"没有查询到人员"
)
}
leaderData
:=
leaderList
[
0
]
//更新相关人员
taskData
.
RelatedUser
=
[]
int
{}
taskData
.
RelatedUser
=
[]
int
{
int
(
leaderData
.
Id
),
int
(
leaderData
.
ParentId
)
}
for
_
,
val
:=
range
relatedUser
{
if
val
.
Id
==
leaderData
.
Id
||
val
.
Id
==
leaderData
.
ParentId
{
continue
}
taskData
.
RelatedUser
=
append
(
taskData
.
RelatedUser
,
int
(
val
.
Id
))
}
//更新任务名称
...
...
@@ -385,7 +398,16 @@ func (srv TaskService) GetTaskInfo(param *command.GetTaskCommand) (*adapter.Task
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
"获取相关人员"
+
err
.
Error
())
}
}
_
,
leaderDataList
,
err
:=
userRepo
.
Find
(
map
[
string
]
interface
{}{
"ids"
:
taskData
.
Leader
.
Id
,
})
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
"获取相关人员"
+
err
.
Error
())
}
var
leaderData
domain
.
User
if
len
(
leaderDataList
)
>
0
{
leaderData
=
*
leaderDataList
[
0
]
}
//查询是否已经有每日评估
taskRecordRepo
:=
factory
.
CreateTaskRecordRepository
(
map
[
string
]
interface
{}{
"transactionContext"
:
transactionContext
,
...
...
@@ -407,9 +429,10 @@ func (srv TaskService) GetTaskInfo(param *command.GetTaskCommand) (*adapter.Task
Alias
:
taskData
.
Alias
,
LeaderId
:
taskData
.
Leader
.
Id
,
Leader
:
adapter
.
UserData
{
Id
:
taskData
.
Leader
.
Id
,
Account
:
taskData
.
Leader
.
Account
,
Name
:
taskData
.
Leader
.
Name
,
Id
:
taskData
.
Leader
.
Id
,
Account
:
taskData
.
Leader
.
Account
,
Name
:
taskData
.
Leader
.
Name
,
ParentId
:
leaderData
.
ParentId
,
},
Status
:
int
(
taskData
.
Status
),
StatusDescription
:
taskData
.
StatusDescription
(),
...
...
@@ -423,9 +446,10 @@ func (srv TaskService) GetTaskInfo(param *command.GetTaskCommand) (*adapter.Task
idStr
:=
strconv
.
Itoa
(
int
(
val
.
Id
))
result
.
RelatedUserId
=
append
(
result
.
RelatedUserId
,
idStr
)
result
.
RelatedUser
=
append
(
result
.
RelatedUser
,
adapter
.
UserData
{
Id
:
val
.
Id
,
Account
:
val
.
Account
,
Name
:
val
.
Name
,
Id
:
val
.
Id
,
Account
:
val
.
Account
,
Name
:
val
.
Name
,
ParentId
:
val
.
ParentId
,
})
}
...
...
请
注册
或
登录
后发表评论