切换导航条
此项目
正在载入...
登录
allied-creation
/
performance
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
郑周
2 years ago
提交
89eed4f20103a1f52347ba8fc6570370a1bc0e11
1 个父辈
7ea26581
1. 更新周期模板时,新的模板Rule数据未赋值,导致出现null
隐藏空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
42 行增加
和
0 行删除
pkg/application/evaluation_cycle/cycle_service.go
pkg/application/evaluation_cycle/cycle_service.go
查看文件 @
89eed4f
...
...
@@ -160,6 +160,7 @@ func (rs *EvaluationCycleService) Update(in *command.UpdateCycleCommand) (interf
cycleRepository
:=
factory
.
CreateEvaluationCycleRepository
(
map
[
string
]
interface
{}{
"transactionContext"
:
transactionContext
})
cycleTemplateRepository
:=
factory
.
CreateEvaluationCycleTemplateRepository
(
map
[
string
]
interface
{}{
"transactionContext"
:
transactionContext
})
templateRepository
:=
factory
.
CreateEvaluationTemplateRepository
(
map
[
string
]
interface
{}{
"transactionContext"
:
transactionContext
})
ruleRepository
:=
factory
.
CreateEvaluationRuleRepository
(
map
[
string
]
interface
{}{
"transactionContext"
:
transactionContext
})
// 检测名称重复(排除自己)
count
,
err
:=
cycleRepository
.
Count
(
map
[
string
]
interface
{}{
"name"
:
in
.
Name
,
"companyId"
:
in
.
CompanyId
,
"notId"
:
in
.
Id
})
...
...
@@ -208,8 +209,49 @@ func (rs *EvaluationCycleService) Update(in *command.UpdateCycleCommand) (interf
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
// 获取所有模板中的规则对象数据
ruleMap
:=
map
[
int64
]
*
domain
.
EvaluationRule
{}
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
]
if
nodeContent
.
RuleId
!=
0
{
ruleMap
[
nodeContent
.
RuleId
]
=
nil
}
}
}
}
ruleIds
:=
make
([]
int64
,
0
)
for
k
:=
range
ruleMap
{
ruleIds
=
append
(
ruleIds
,
k
)
}
if
len
(
ruleIds
)
>
0
{
if
_
,
rules
,
err
:=
ruleRepository
.
Find
(
map
[
string
]
interface
{}{
"ids"
:
ruleIds
,
"companyId"
:
in
.
CompanyId
});
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
else
{
for
i
:=
range
rules
{
ruleMap
[
rules
[
i
]
.
Id
]
=
rules
[
i
]
}
}
}
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
]
if
rule
,
ok
:=
ruleMap
[
nodeContent
.
RuleId
];
ok
{
nodeContent
.
Rule
=
rule
}
}
}
cycleTemplate
:=
&
domain
.
EvaluationCycleTemplate
{
Id
:
0
,
Name
:
v
.
Name
,
...
...
请
注册
或
登录
后发表评论