切换导航条
此项目
正在载入...
登录
allied-creation
/
performance
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
郑周
2 years ago
提交
d9a6ad86690ac2940c75253bcf2138b6a5632bad
1 个父辈
8aef6366
增加模型
隐藏空白字符变更
内嵌
并排对比
正在显示
8 个修改的文件
包含
92 行增加
和
6 行删除
pkg/application/evaluation_project/project_service.go
pkg/application/evaluation_template/template_service.go
pkg/domain/evaluation_project.go
pkg/domain/evaluation_template.go
pkg/domain/node_timer_task.go
pkg/infrastructure/pg/models/evaluation_project.go
pkg/infrastructure/pg/models/node_timer_task.go
pkg/infrastructure/repository/pg_evaluation_project_repository.go
pkg/application/evaluation_project/project_service.go
查看文件 @
d9a6ad8
package
service
import
(
"fmt"
"github.com/linmadan/egglib-go/core/application"
"github.com/linmadan/egglib-go/utils/tool_funs"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/evaluation_project/adapter"
...
...
@@ -43,6 +44,7 @@ func (rs *EvaluationProjectService) Create(in *command.CreateProjectCommand) (in
Name
:
in
.
Name
,
Describe
:
in
.
Describe
,
CompanyId
:
in
.
CompanyId
,
CycleId
:
in
.
CycleId
,
CreatorId
:
in
.
CreatorId
,
State
:
domain
.
ProjectStateWaitConfig
,
HrBp
:
in
.
HrBp
,
...
...
@@ -112,6 +114,33 @@ func (rs *EvaluationProjectService) UpdateTemplate(in *command.UpdateProjectTemp
projectRepository
:=
factory
.
CreateEvaluationProjectRepository
(
map
[
string
]
interface
{}{
"transactionContext"
:
transactionContext
})
cycleTemplateRepository
:=
factory
.
CreateEvaluationCycleTemplateRepository
(
map
[
string
]
interface
{}{
"transactionContext"
:
transactionContext
})
_
,
projects
,
err
:=
projectRepository
.
Find
(
map
[
string
]
interface
{}{
"companyId"
:
in
.
CompanyId
,
"cycleId"
:
in
.
CycleId
},
"linkNodes"
)
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
// 周期内的所有项目,员工不能重复被评估
rids
:=
map
[
string
]
bool
{}
for
i
:=
range
projects
{
// 排除当前项目
if
in
.
Id
!=
projects
[
i
]
.
Id
{
ids
:=
projects
[
i
]
.
Recipients
for
j
:=
range
ids
{
rids
[
ids
[
j
]]
=
true
}
}
}
repeatNum
:=
0
for
i
:=
range
in
.
Recipients
{
id
:=
in
.
Recipients
[
i
]
if
_
,
ok
:=
rids
[
id
];
ok
{
repeatNum
++
}
}
if
repeatNum
>
0
{
return
nil
,
application
.
ThrowError
(
application
.
BUSINESS_ERROR
,
fmt
.
Sprintf
(
"有%d人已经在本周期其他项目内,需要将他们移除"
,
repeatNum
))
}
project
,
err
:=
projectRepository
.
FindOne
(
map
[
string
]
interface
{}{
"id"
:
in
.
Id
})
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
...
...
pkg/application/evaluation_template/template_service.go
查看文件 @
d9a6ad8
...
...
@@ -6,6 +6,7 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/evaluation_template/command"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/utils"
)
type
EvaluationTemplateService
struct
{
...
...
@@ -37,27 +38,34 @@ func (rs *EvaluationTemplateService) Create(in *command.CreateTemplateCommand) (
}
linkNodes
:=
make
([]
*
domain
.
LinkNode
,
0
)
sid
,
_
:=
utils
.
NewSnowflakeId
()
linkNodes
=
append
(
linkNodes
,
&
domain
.
LinkNode
{
Id
:
sid
+
1
,
Type
:
domain
.
LinkNodeSelfAssessment
,
Name
:
"填写自评反馈"
,
KpiCycle
:
domain
.
KpiCycleDay
,
})
linkNodes
=
append
(
linkNodes
,
&
domain
.
LinkNode
{
Id
:
sid
+
2
,
Type
:
domain
.
LinkNodeAllInvite
,
Name
:
"360°邀请"
,
KpiCycle
:
domain
.
KpiCycleDay
,
})
linkNodes
=
append
(
linkNodes
,
&
domain
.
LinkNode
{
Id
:
sid
+
3
,
Type
:
domain
.
LinkNodeAllAssessment
,
Name
:
"360°评估"
,
KpiCycle
:
domain
.
KpiCycleDay
,
})
linkNodes
=
append
(
linkNodes
,
&
domain
.
LinkNode
{
Id
:
sid
+
4
,
Type
:
domain
.
LinkNodeSuperiorAssessment
,
Name
:
"上级评估"
,
KpiCycle
:
domain
.
KpiCycleDay
,
})
linkNodes
=
append
(
linkNodes
,
&
domain
.
LinkNode
{
Id
:
sid
+
5
,
Type
:
domain
.
LinkNodeViewResult
,
Name
:
"绩效结果查看"
,
KpiCycle
:
domain
.
KpiCycleDay
,
...
...
pkg/domain/evaluation_project.go
查看文件 @
d9a6ad8
...
...
@@ -16,6 +16,7 @@ type EvaluationProject struct {
Name
string
`json:"name" comment:"名称"`
Describe
string
`json:"describe" comment:"描述"`
CompanyId
int64
`json:"companyId,string" comment:"公司ID"`
CycleId
int64
`json:"cycleId,string" comment:"周期ID"`
CreatorId
int64
`json:"creatorId,string" comment:"创建人ID"`
State
int
`json:"state" comment:"状态(0待完成配置、1待启用、2启用、3结束)"`
HrBp
int
`json:"hrBp" comment:"HR角色权限"`
...
...
pkg/domain/evaluation_template.go
查看文件 @
d9a6ad8
...
...
@@ -51,17 +51,17 @@ type NodeAllInvite struct {
ParentSameIds
[]
int64
`json:"parentSameIds" comment:"相同上级同事ID"`
}
// NodeKpiResult 绩效结果查看
type
NodeKpiResult
struct
{
}
//// NodeKpiResult 绩效结果查看
//type NodeKpiResult struct {
//}
type
LinkNode
struct
{
Type
int
`json:"type" comment:"环节类型(1评估、2邀请、3绩效结果)"`
Id
int64
`json:"id,string" comment:"环节ID"`
Type
int
`json:"type" comment:"环节类型"`
Name
string
`json:"name" comment:"环节名称"`
Describe
string
`json:"describe" comment:"环节描述"`
NodeContents
[]
*
NodeContent
`json:"nodeContents" comment:"环节-评估内容"`
NodeAllInvite
*
NodeAllInvite
`json:"nodeAllInvite" comment:"环节-360°邀请"`
NodeKpiResult
*
NodeKpiResult
`json:"nodeKpiResult" comment:"环节-绩效结果"`
NodeAllInvite
*
NodeAllInvite
`json:"nodeAllInvite" comment:"360°邀请人员"`
TimeStart
*
time
.
Time
`json:"timeStart" comment:"起始时间"`
TimeEnd
*
time
.
Time
`json:"timeEnd" comment:"截至时间"`
KpiCycle
int
`json:"state" comment:"考核周期(0日、1周、2月)"`
...
...
pkg/domain/node_timer_task.go
0 → 100644
查看文件 @
d9a6ad8
package
domain
import
(
"time"
)
type
NodeTimerTask
struct
{
Id
int64
`json:"id,string" comment:"ID"`
CompanyId
int64
`json:"companyId,string" comment:"公司ID"`
CycleId
int64
`json:"cycleId,string" comment:"周期ID"`
ProjectId
int64
`json:"projectId,string" comment:"项目ID"`
NodeId
int64
`json:"nodeId,string" comment:"节点ID"`
LastSentAt
*
time
.
Time
`json:"lastSentAt" comment:"最后一次发送时间"`
NextSentAt
*
time
.
Time
`json:"nextSentAt" comment:"下一次发送时间"`
CreatedAt
time
.
Time
`json:"createdAt" comment:"创建时间"`
UpdatedAt
time
.
Time
`json:"updatedAt" comment:"更新时间"`
DeletedAt
*
time
.
Time
`json:"deletedAt" comment:"删除时间"`
}
type
NodeTimerTaskRepository
interface
{
Insert
(
template
*
NodeTimerTask
)
(
*
NodeTimerTask
,
error
)
Remove
(
template
*
NodeTimerTask
)
(
*
NodeTimerTask
,
error
)
FindOne
(
queryOptions
map
[
string
]
interface
{})
(
*
NodeTimerTask
,
error
)
Find
(
queryOptions
map
[
string
]
interface
{},
excludeColumns
...
string
)
(
int64
,
[]
*
NodeTimerTask
,
error
)
Count
(
queryOptions
map
[
string
]
interface
{})
(
int64
,
error
)
}
...
...
pkg/infrastructure/pg/models/evaluation_project.go
查看文件 @
d9a6ad8
...
...
@@ -11,6 +11,7 @@ type EvaluationProject struct {
Name
string
`comment:"名称"`
Describe
string
`comment:"描述"`
CompanyId
int64
`comment:"公司ID"`
CycleId
int64
`comment:"周期ID"`
CreatorId
int64
`comment:"创建人ID"`
State
int
`comment:"状态(0待完成配置、1待启用、2启用、3停用)"`
HrBp
int
`comment:"HR角色权限"`
...
...
pkg/infrastructure/pg/models/node_timer_task.go
0 → 100644
查看文件 @
d9a6ad8
package
models
import
(
"time"
)
type
NodeTimerTask
struct
{
tableName
struct
{}
`pg:"node_timer_task" comment:"流程节点定时任务"`
Id
int64
`comment:"ID"`
CompanyId
int64
`comment:"公司ID"`
CycleId
int64
`comment:"周期ID"`
ProjectId
int64
`comment:"项目ID"`
NodeId
int64
`comment:"流程ID"`
LastSentAt
*
time
.
Time
`comment:"最后一次发送时间"`
NextSentAt
*
time
.
Time
`comment:"下一次发送时间"`
CreatedAt
time
.
Time
`comment:"创建时间"`
UpdatedAt
time
.
Time
`comment:"更新时间"`
DeletedAt
*
time
.
Time
`comment:"删除时间"`
}
...
...
pkg/infrastructure/repository/pg_evaluation_project_repository.go
查看文件 @
d9a6ad8
...
...
@@ -26,6 +26,7 @@ func (repo *EvaluationProjectRepository) TransformToDomain(m *models.EvaluationP
Name
:
m
.
Name
,
Describe
:
m
.
Describe
,
CompanyId
:
m
.
CompanyId
,
CycleId
:
m
.
CycleId
,
CreatorId
:
m
.
CreatorId
,
State
:
m
.
State
,
HrBp
:
m
.
HrBp
,
...
...
@@ -45,6 +46,7 @@ func (repo *EvaluationProjectRepository) TransformToModel(d *domain.EvaluationPr
Name
:
d
.
Name
,
Describe
:
d
.
Describe
,
CompanyId
:
d
.
CompanyId
,
CycleId
:
d
.
CycleId
,
CreatorId
:
d
.
CreatorId
,
State
:
d
.
State
,
HrBp
:
d
.
HrBp
,
...
...
请
注册
或
登录
后发表评论