切换导航条
此项目
正在载入...
登录
allied-creation
/
performance
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
郑周
2 years ago
提交
b32f1e6026d446d21bf1d230d3ec31b5610fb04c
1 个父辈
f9ce9e7e
创建周期 接口
隐藏空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
19 行增加
和
8 行删除
pkg/application/evaluation_cycle/command/cycle_create.go
pkg/application/evaluation_cycle/cycle_service.go
pkg/port/beego/controllers/evaluation_cycle_controller.go
pkg/application/evaluation_cycle/command/cycle_create.go
查看文件 @
b32f1e6
...
...
@@ -25,9 +25,14 @@ func (in *CreateCycleCommand) Valid(validation *validation.Validation) {
return
}
if
len
(
in
.
Name
)
>
40
{
validation
.
SetError
(
"name"
,
"
角色
名称最大长度40个字符"
)
validation
.
SetError
(
"name"
,
"名称最大长度40个字符"
)
return
}
if
in
.
KpiCycle
==
0
{
validation
.
SetError
(
"kpiCycle"
,
"请选择考核周期"
)
return
}
if
in
.
TimeStart
==
nil
{
validation
.
SetError
(
"timeStart"
,
"请选择考核周期的开始时间"
)
return
...
...
@@ -37,7 +42,7 @@ func (in *CreateCycleCommand) Valid(validation *validation.Validation) {
return
}
if
len
(
in
.
TemplateIds
)
==
0
{
validation
.
SetError
(
"templates"
,
"请
选择周期内使用的
评估模板"
)
validation
.
SetError
(
"templates"
,
"请
添加
评估模板"
)
return
}
}
...
...
pkg/application/evaluation_cycle/cycle_service.go
查看文件 @
b32f1e6
...
...
@@ -38,7 +38,7 @@ func (rs *EvaluationCycleService) Create(in *command.CreateCycleCommand) (interf
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
if
count
>
0
{
return
nil
,
application
.
ThrowError
(
application
.
BUSINESS_ERROR
,
"
名称已存在
"
)
return
nil
,
application
.
ThrowError
(
application
.
BUSINESS_ERROR
,
"
已存在相同名称的周期
"
)
}
_
,
templates
,
err
:=
templateRepository
.
Find
(
map
[
string
]
interface
{}{
"companyId"
:
in
.
CompanyId
,
"ids"
:
in
.
TemplateIds
})
...
...
@@ -65,19 +65,27 @@ func (rs *EvaluationCycleService) Create(in *command.CreateCycleCommand) (interf
}
// 获取所有模板中的规则对象数据
ruleIds
:=
make
([]
int64
,
0
)
ruleMap
:=
map
[
int64
]
*
domain
.
EvaluationRule
{}
ruleIdsMap
:=
map
[
int64
]
int64
{}
for
i
:=
range
templates
{
v
:=
templates
[
i
]
for
j
:=
range
v
.
LinkNodes
{
node
:=
v
.
LinkNodes
[
j
]
for
k
:=
range
node
.
NodeContents
{
nodeContent
:=
node
.
NodeContents
[
k
]
ruleIds
=
append
(
ruleIds
,
nodeContent
.
RuleId
)
if
nodeContent
.
RuleId
!=
0
{
ruleIdsMap
[
nodeContent
.
RuleId
]
=
nodeContent
.
RuleId
}
}
}
}
ruleIds
:=
make
([]
int64
,
0
)
for
k
:=
range
ruleIdsMap
{
ruleIds
=
append
(
ruleIds
,
k
)
}
_
,
rules
,
err
:=
ruleRepository
.
Find
(
map
[
string
]
interface
{}{
"ids"
:
ruleIds
,
"companyId"
:
in
.
CompanyId
})
ruleMap
:=
map
[
int64
]
*
domain
.
EvaluationRule
{}
for
i
:=
range
rules
{
ruleMap
[
rules
[
i
]
.
Id
]
=
rules
[
i
]
}
...
...
pkg/port/beego/controllers/evaluation_cycle_controller.go
查看文件 @
b32f1e6
...
...
@@ -21,8 +21,6 @@ func (controller *CycleController) CreateCycle() {
ua
:=
middlewares
.
GetUser
(
controller
.
Ctx
)
in
.
CompanyId
=
ua
.
CompanyId
in
.
CreatorId
=
ua
.
UserId
//in.CompanyId = middlewares.GetCompanyId(controller.Ctx)
//in.CreatorId = middlewares.GetUserId(controller.Ctx)
controller
.
Response
(
ruService
.
Create
(
in
))
}
}
...
...
请
注册
或
登录
后发表评论