切换导航条
此项目
正在载入...
登录
allied-creation
/
performance
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
郑周
2 years ago
提交
ac37e0469de46fb4746e1bf5606484bd90857cbc
1 个父辈
8fb33e10
1. 新增 检测模板ID是否有任务指标
隐藏空白字符变更
内嵌
并排对比
正在显示
4 个修改的文件
包含
54 行增加
和
0 行删除
pkg/application/evaluation_project/command/project_update.go
pkg/application/evaluation_project/project_service.go
pkg/port/beego/controllers/evaluation_project_controller.go
pkg/port/beego/routers/evaluation_project_router.go
pkg/application/evaluation_project/command/project_update.go
查看文件 @
ac37e04
...
...
@@ -35,6 +35,11 @@ type CheckRecipientCommand struct {
Recipients
[]
string
`cname:"被评估人ID" json:"recipients"`
}
// CheckTaskTemplateCommand 检测选中的模板是否含有任务指标
type
CheckTaskTemplateCommand
struct
{
TemplateId
int64
`cname:"模板ID" json:"templateId,string"`
}
func
(
in
*
UpdateProjectCommand
)
Valid
(
validation
*
validation
.
Validation
)
{
if
utf8
.
RuneCountInString
(
in
.
Name
)
>
40
{
validation
.
SetError
(
"name"
,
"项目名称最大长度40个字符"
)
...
...
pkg/application/evaluation_project/project_service.go
查看文件 @
ac37e04
...
...
@@ -910,3 +910,41 @@ func (rs *EvaluationProjectService) generateEvaluationItemUsed(transactionContex
}
return
nil
}
func
(
rs
*
EvaluationProjectService
)
CheckTaskTemplate
(
in
*
command
.
CheckTaskTemplateCommand
)
(
interface
{},
error
)
{
transactionContext
,
err
:=
factory
.
ValidateStartTransaction
(
in
)
if
err
!=
nil
{
return
nil
,
err
}
defer
func
()
{
transactionContext
.
RollbackTransaction
()
}()
cycleTemplateRepository
:=
factory
.
CreateEvaluationCycleTemplateRepository
(
map
[
string
]
interface
{}{
"transactionContext"
:
transactionContext
})
cycleTemplate
,
err
:=
cycleTemplateRepository
.
FindOne
(
map
[
string
]
interface
{}{
"id"
:
in
.
TemplateId
,
"includeDeleted"
:
true
})
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
if
cycleTemplate
==
nil
||
cycleTemplate
.
Template
==
nil
{
return
nil
,
application
.
ThrowError
(
application
.
BUSINESS_ERROR
,
"未找到模板"
)
}
// 指标任务的项目(存在一项类型为任务指标),必须添加项目负责人
var
indicatorTypeTask
=
0
outerLoop
:
for
i
:=
range
cycleTemplate
.
Template
.
LinkNodes
{
var
node
=
cycleTemplate
.
Template
.
LinkNodes
[
i
]
for
j
:=
range
node
.
NodeContents
{
if
node
.
NodeContents
[
j
]
.
IndicatorType
==
domain
.
IndicatorTypeTask
{
indicatorTypeTask
=
1
break
outerLoop
}
}
}
if
err
:=
transactionContext
.
CommitTransaction
();
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
TRANSACTION_ERROR
,
err
.
Error
())
}
return
map
[
string
]
interface
{}{
"indicatorTypeTask"
:
indicatorTypeTask
},
nil
}
...
...
pkg/port/beego/controllers/evaluation_project_controller.go
查看文件 @
ac37e04
...
...
@@ -139,3 +139,13 @@ func (controller *ProjectController) CheckRecipients() {
controller
.
Response
(
ruService
.
CheckRecipients
(
in
))
}
}
func
(
controller
*
ProjectController
)
CheckTaskTemplate
()
{
ruService
:=
service
.
NewEvaluationProjectService
()
in
:=
&
command
.
CheckTaskTemplateCommand
{}
if
err
:=
controller
.
Unmarshal
(
in
);
err
!=
nil
{
controller
.
Response
(
nil
,
application
.
ThrowError
(
application
.
ARG_ERROR
,
err
.
Error
()))
}
else
{
controller
.
Response
(
ruService
.
CheckTaskTemplate
(
in
))
}
}
...
...
pkg/port/beego/routers/evaluation_project_router.go
查看文件 @
ac37e04
...
...
@@ -17,6 +17,7 @@ func init() {
web
.
NSRouter
(
"/list"
,
&
controllers
.
ProjectController
{},
"Post:ListProject"
),
web
.
NSRouter
(
"/detail"
,
&
controllers
.
ProjectController
{},
"Put:UpdateProjectForTemplate"
),
web
.
NSRouter
(
"/check-recipients"
,
&
controllers
.
ProjectController
{},
"Post:CheckRecipients"
),
web
.
NSRouter
(
"/check-template"
,
&
controllers
.
ProjectController
{},
"Post:CheckTaskTemplate"
),
web
.
NSRouter
(
"/copy"
,
&
controllers
.
ProjectController
{},
"Post:CopyProject"
),
web
.
NSRouter
(
"/activate"
,
&
controllers
.
ProjectController
{},
"Post:ActivateProject"
),
web
.
NSRouter
(
"/pause"
,
&
controllers
.
ProjectController
{},
"Post:PauseProject"
),
...
...
请
注册
或
登录
后发表评论