切换导航条
此项目
正在载入...
登录
allied-creation
/
performance
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
郑周
2 years ago
提交
e6ecb10c13728ca65ffd17b7ffe067b098f88e9d
1 个父辈
3a3ca2a7
周期模板添加
隐藏空白字符变更
内嵌
并排对比
正在显示
5 个修改的文件
包含
59 行增加
和
14 行删除
pkg/application/evaluation_cycle/command/cycle_create.go
pkg/application/evaluation_cycle/cycle_service.go
pkg/domain/evaluation_cycle.go
pkg/domain/evaluation_template.go
pkg/port/beego/routers/evaluation_cycle_router.go
pkg/application/evaluation_cycle/command/cycle_create.go
查看文件 @
e6ecb10
...
...
@@ -11,7 +11,7 @@ type CreateCycleCommand struct {
Name
string
`cname:"周期名称" json:"name" valid:"Required"`
TimeStart
*
time
.
Time
`cname:"起始时间" json:"timeStart"`
TimeEnd
*
time
.
Time
`cname:"截至时间" json:"timeEnd"`
KpiCycle
int
`cname:"考核周期
(0日、1周、2月)
" json:"kpiCycle" valid:"Required"`
KpiCycle
int
`cname:"考核周期" json:"kpiCycle" valid:"Required"`
TemplateIds
[]
string
`cname:"周期使用模板ID" json:"templateIds"`
}
...
...
pkg/application/evaluation_cycle/cycle_service.go
查看文件 @
e6ecb10
...
...
@@ -62,6 +62,9 @@ func (rs *EvaluationCycleService) Create(in *command.CreateCycleCommand) (interf
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
ctAdapter
:=
&
adapter
.
CycleTemplateAdapter
{}
ctAdapter
.
EvaluationCycle
=
cycle
for
i
:=
range
templates
{
v
:=
templates
[
i
]
cycleTemplate
:=
&
domain
.
EvaluationCycleTemplate
{
...
...
@@ -74,12 +77,18 @@ func (rs *EvaluationCycleService) Create(in *command.CreateCycleCommand) (interf
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
ctAdapter
.
TemplateSimples
=
append
(
ctAdapter
.
TemplateSimples
,
&
domain
.
TemplateSimple
{
Id
:
v
.
Id
,
Name
:
v
.
Name
,
CreatedAt
:
v
.
CreatedAt
,
})
}
if
err
:=
transactionContext
.
CommitTransaction
();
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
TRANSACTION_ERROR
,
err
.
Error
())
}
return
c
ycle
,
nil
return
c
tAdapter
,
nil
}
...
...
@@ -166,10 +175,26 @@ func (rs *EvaluationCycleService) Update(in *command.UpdateCycleCommand) (interf
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
_
,
cycleTemplates
,
err
:=
cycleTemplateRepository
.
Find
(
map
[
string
]
interface
{}{
"cycleId"
:
cycle
.
Id
},
"template"
)
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
ctAdapter
:=
&
adapter
.
CycleTemplateAdapter
{}
ctAdapter
.
EvaluationCycle
=
cycle
for
i
:=
range
cycleTemplates
{
ctAdapter
.
TemplateSimples
=
append
(
ctAdapter
.
TemplateSimples
,
&
domain
.
TemplateSimple
{
Id
:
cycleTemplates
[
i
]
.
Id
,
Name
:
cycleTemplates
[
i
]
.
Name
,
CreatedAt
:
cycleTemplates
[
i
]
.
CreatedAt
,
})
}
if
err
:=
transactionContext
.
CommitTransaction
();
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
TRANSACTION_ERROR
,
err
.
Error
())
}
return
c
ycle
,
nil
return
c
tAdapter
,
nil
}
func
(
rs
*
EvaluationCycleService
)
Get
(
in
*
command
.
GetCycleCommand
)
(
interface
{},
error
)
{
...
...
pkg/domain/evaluation_cycle.go
查看文件 @
e6ecb10
...
...
@@ -4,6 +4,16 @@ import (
"time"
)
const
(
KpiCycleDay
int
=
1
// 考核周期-日
KpiCycleWeek
int
=
2
// 考核周期-周
KpiCycleOneMonth
int
=
3
// 考核周期-月
KpiCycleTwoMonth
int
=
4
// 考核周期-双月
KpiCycleThreeMonth
int
=
5
// 考核周期-季度
KpiCycleSixMonth
int
=
6
// 考核周期-半年
KpiCycleYear
int
=
7
// 考核周期-年
)
type
TemplateSimple
struct
{
Id
int64
`json:"id,string" comment:"模板ID"`
Name
string
`json:"name" comment:"模板名称"`
...
...
@@ -17,7 +27,7 @@ type EvaluationCycle struct {
TimeEnd
*
time
.
Time
`json:"timeEnd" comment:"截至时间"`
CompanyId
int64
`json:"companyId,string" comment:"公司ID"`
CreatorId
int64
`json:"creatorId,string" comment:"创建人ID"`
KpiCycle
int
`json:"
stat
e" comment:"考核周期(1日、2周、3月)"`
KpiCycle
int
`json:"
kpiCycl
e" comment:"考核周期(1日、2周、3月)"`
CreatedAt
time
.
Time
`json:"createdAt" comment:"创建时间"`
UpdatedAt
time
.
Time
`json:"updatedAt" comment:"更新时间"`
DeletedAt
*
time
.
Time
`json:"deletedAt" comment:"删除时间"`
...
...
pkg/domain/evaluation_template.go
查看文件 @
e6ecb10
...
...
@@ -24,16 +24,6 @@ const (
)
const
(
KpiCycleDay
int
=
1
// 考核周期-日
KpiCycleWeek
int
=
2
// 考核周期-周
KpiCycleOneMonth
int
=
3
// 考核周期-月
KpiCycleTwoMonth
int
=
4
// 考核周期-双月
KpiCycleThreeMonth
int
=
5
// 考核周期-季度
KpiCycleSixMonth
int
=
6
// 考核周期-半年
KpiCycleYear
int
=
7
// 考核周期-年
)
type
EntryItem
struct
{
Title
string
`json:"title" comment:"填写标题"`
HintText
string
`json:"hintText" comment:"文本内容提示"`
...
...
pkg/port/beego/routers/evaluation_cycle_router.go
0 → 100644
查看文件 @
e6ecb10
package
routers
import
(
"github.com/beego/beego/v2/server/web"
"github.com/linmadan/egglib-go/web/beego/filters"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego/controllers"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego/middlewares"
)
func
init
()
{
ns
:=
web
.
NewNamespace
(
"/v1/evaluation-cycle"
,
web
.
NSBefore
(
filters
.
AllowCors
(),
middlewares
.
CheckAdminToken
()),
web
.
NSRouter
(
"/"
,
&
controllers
.
CycleController
{},
"Post:CreateCycle"
),
web
.
NSRouter
(
"/"
,
&
controllers
.
CycleController
{},
"Put:UpdateCycle"
),
web
.
NSRouter
(
"/"
,
&
controllers
.
CycleController
{},
"Delete:RemoveCycle"
),
web
.
NSRouter
(
"/:Id"
,
&
controllers
.
CycleController
{},
"Get:GetCycle"
),
web
.
NSRouter
(
"/list"
,
&
controllers
.
CycleController
{},
"Post:ListRuleRelCreator"
),
)
web
.
AddNamespace
(
ns
)
}
...
...
请
注册
或
登录
后发表评论