切换导航条
此项目
正在载入...
登录
allied-creation
/
performance
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
郑周
2 years ago
提交
ecb7cca4772050eadbd709999e412f80f8bb277f
1 个父辈
f00bf3a0
1增加周期下的模板列表
2增加周期下的模板详情
隐藏空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
51 行增加
和
9 行删除
pkg/application/evaluation_cycle/command/cycle_query.go
pkg/application/evaluation_cycle/cycle_service.go
pkg/port/beego/controllers/evaluation_cycle_controller.go
pkg/application/evaluation_cycle/command/cycle_query.go
查看文件 @
ecb7cca
...
...
@@ -9,6 +9,20 @@ type QueryCycleCommand struct {
PageSize
int
`cname:"分页数量" json:"pageSize" valid:"Required"`
}
type
StatisticCycleProjectUserCommand
struct
{
CompanyId
int64
`cname:"公司ID" json:"companyId"`
CycleId
int64
`cname:"周期ID" json:"cycleId,string"`
}
type
CycleTemplateListCommand
struct
{
CycleId
int64
`cname:"周期ID" json:"cycleId,string" valid:"Required"`
}
type
CycleTemplateCommand
struct
{
CycleId
int64
`cname:"周期ID" json:"cycleId,string" valid:"Required"`
TemplateId
int64
`cname:"模板ID" json:"templateId,string" valid:"Required"`
}
func
(
in
*
QueryCycleCommand
)
Valid
(
validation
*
validation
.
Validation
)
{
if
in
.
CompanyId
==
0
{
validation
.
SetError
(
"companyId"
,
"公司ID无效"
)
...
...
@@ -16,17 +30,12 @@ func (in *QueryCycleCommand) Valid(validation *validation.Validation) {
}
}
type
StatisticCycleProjectUserCommand
struct
{
CompanyId
int64
`cname:"公司ID" json:"companyId"`
CycleId
int64
`cname:"周期ID" json:"cycleId,string"`
}
func
(
in
*
StatisticCycleProjectUserCommand
)
Valid
(
*
validation
.
Validation
)
{
}
type
CycleTemplateCommand
struct
{
CycleId
int64
`cname:"周期ID" json:"cycleId,string" valid:"Required"`
func
(
in
*
CycleTemplateListCommand
)
Valid
(
*
validation
.
Validation
)
{
}
func
(
in
*
CycleTemplateCommand
)
Valid
(
*
validation
.
Validation
)
{
...
...
pkg/application/evaluation_cycle/cycle_service.go
查看文件 @
ecb7cca
...
...
@@ -364,7 +364,7 @@ func (rs *EvaluationCycleService) StatisticCycleUser(in *command.StatisticCycleP
return
map
[
string
]
interface
{}{
"userTotal"
:
userTotal
,
"departmentTotal"
:
departmentTotal
},
nil
}
func
(
rs
*
EvaluationCycleService
)
CycleTemplateList
(
in
*
command
.
CycleTemplateCommand
)
(
interface
{},
error
)
{
func
(
rs
*
EvaluationCycleService
)
CycleTemplateList
(
in
*
command
.
CycleTemplate
List
Command
)
(
interface
{},
error
)
{
transactionContext
,
err
:=
factory
.
ValidateStartTransaction
(
in
)
if
err
!=
nil
{
return
nil
,
err
...
...
@@ -375,6 +375,9 @@ func (rs *EvaluationCycleService) CycleTemplateList(in *command.CycleTemplateCom
cycleTemplateRepository
:=
factory
.
CreateEvaluationCycleTemplateRepository
(
map
[
string
]
interface
{}{
"transactionContext"
:
transactionContext
})
_
,
cycleTemplates
,
err
:=
cycleTemplateRepository
.
Find
(
map
[
string
]
interface
{}{
"cycleId"
:
in
.
CycleId
},
"template"
)
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
list
:=
make
([]
*
domain
.
TemplateSimple
,
0
)
for
i
:=
range
cycleTemplates
{
...
...
@@ -390,3 +393,23 @@ func (rs *EvaluationCycleService) CycleTemplateList(in *command.CycleTemplateCom
}
return
map
[
string
]
interface
{}{
"list"
:
list
},
nil
}
func
(
rs
*
EvaluationCycleService
)
CycleTemplate
(
in
*
command
.
CycleTemplateCommand
)
(
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
})
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
if
err
:=
transactionContext
.
CommitTransaction
();
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
TRANSACTION_ERROR
,
err
.
Error
())
}
return
cycleTemplate
.
Template
,
nil
}
...
...
pkg/port/beego/controllers/evaluation_cycle_controller.go
查看文件 @
ecb7cca
...
...
@@ -90,10 +90,20 @@ func (controller *CycleController) StatisticCycleUser() {
func
(
controller
*
CycleController
)
CycleTemplateList
()
{
ruService
:=
service
.
NewEvaluationCycleService
()
in
:=
&
command
.
CycleTemplateCommand
{}
in
:=
&
command
.
CycleTemplate
List
Command
{}
if
err
:=
controller
.
Unmarshal
(
in
);
err
!=
nil
{
controller
.
Response
(
nil
,
application
.
ThrowError
(
application
.
ARG_ERROR
,
err
.
Error
()))
}
else
{
controller
.
Response
(
ruService
.
CycleTemplateList
(
in
))
}
}
func
(
controller
*
CycleController
)
CycleTemplate
()
{
ruService
:=
service
.
NewEvaluationCycleService
()
in
:=
&
command
.
CycleTemplateCommand
{}
if
err
:=
controller
.
Unmarshal
(
in
);
err
!=
nil
{
controller
.
Response
(
nil
,
application
.
ThrowError
(
application
.
ARG_ERROR
,
err
.
Error
()))
}
else
{
controller
.
Response
(
ruService
.
CycleTemplate
(
in
))
}
}
...
...
请
注册
或
登录
后发表评论