切换导航条
此项目
正在载入...
登录
allied-creation
/
performance
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
tangxvhui
2 years ago
提交
149c0cdcc955f9741a81b0c005a55ba1386d92ae
1 个父辈
0160a545
日常保存
隐藏空白字符变更
内嵌
并排对比
正在显示
6 个修改的文件
包含
136 行增加
和
73 行删除
pkg/application/summary_evaluation/service/scheduled.go
pkg/domain/evaluation_project.go
pkg/infrastructure/pg/models/evaluation_project.go
pkg/infrastructure/repository/pg_evaluation_project_repository.go
pkg/port/beego/controllers/summary_evaluation_controller.go
pkg/port/beego/routers/summary_evaluation_router.go
pkg/application/summary_evaluation/service/scheduled.go
查看文件 @
149c0cd
package
service
//定时扫描评估项目表,确认是否下发评估任务
import
(
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
)
func
SendSummaryEvaluationTask
()
{}
// sendSummaryEvaluafionTask 根据评估项目设置,确认是否下发评估任务
func
sendSummaryEvaluafionTask
(
param
*
domain
.
EvaluationProject
)
error
{
transactionContext
,
err
:=
factory
.
CreateTransactionContext
(
nil
)
if
err
!=
nil
{
return
err
}
if
err
:=
transactionContext
.
StartTransaction
();
err
!=
nil
{
return
err
}
defer
func
()
{
_
=
transactionContext
.
RollbackTransaction
()
}()
//确定 被评估的人
//确定 被评估人的 上级评估
//确定 被评估人的 人资评估
//确定 被评估人的 360 评估
//回填 项目的状态
if
err
:=
transactionContext
.
CommitTransaction
();
err
!=
nil
{
return
err
}
return
nil
}
...
...
pkg/domain/evaluation_project.go
查看文件 @
149c0cd
...
...
@@ -13,25 +13,33 @@ const (
// 项目的评估内容配置
type
EvaluationProject
struct
{
Id
int64
`json:"id,string" comment:"ID"`
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角色权限"`
Pmp
int
`json:"pmp" comment:"PM角色权限"`
PmpIds
[]
string
`json:"pmpIds" comment:"项目管理员ID"`
Recipients
[]
string
`json:"recipients" comment:"被评估人ID"`
Template
*
EvaluationTemplate
`json:"template" comment:"评估模板"`
BeginTime
time
.
Time
`json:"beginTime" comment:"项目起始时间"`
EndTime
time
.
Time
`json:"endTime" comment:"项目截至时间"`
CreatedAt
time
.
Time
`json:"createdAt" comment:"创建时间"`
UpdatedAt
time
.
Time
`json:"updatedAt" comment:"更新时间"`
DeletedAt
*
time
.
Time
`json:"deletedAt" comment:"删除时间"`
Id
int64
`json:"id,string" comment:"ID"`
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结束)"`
SummaryState
ProjectSummaryState
`json:"summaryState" comment:"周期评估是否下发"`
HrBp
int
`json:"hrBp" comment:"HR角色权限"`
Pmp
int
`json:"pmp" comment:"PM角色权限"`
PmpIds
[]
string
`json:"pmpIds" comment:"项目管理员ID"`
Recipients
[]
string
`json:"recipients" comment:"被评估人ID"`
Template
*
EvaluationTemplate
`json:"template" comment:"评估模板"`
BeginTime
time
.
Time
`json:"beginTime" comment:"项目起始时间"`
EndTime
time
.
Time
`json:"endTime" comment:"项目截至时间"`
CreatedAt
time
.
Time
`json:"createdAt" comment:"创建时间"`
UpdatedAt
time
.
Time
`json:"updatedAt" comment:"更新时间"`
DeletedAt
*
time
.
Time
`json:"deletedAt" comment:"删除时间"`
}
type
ProjectSummaryState
int
const
(
ProjectSummaryStateNo
int
=
0
//未下发
ProjectSummaryStateYes
int
=
1
//已经下发
)
type
EvaluationProjectRepository
interface
{
Insert
(
project
*
EvaluationProject
)
(
*
EvaluationProject
,
error
)
Remove
(
project
*
EvaluationProject
)
(
*
EvaluationProject
,
error
)
...
...
pkg/infrastructure/pg/models/evaluation_project.go
查看文件 @
149c0cd
package
models
import
(
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
"time"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
)
type
EvaluationProject
struct
{
tableName
struct
{}
`comment:"评估项目" pg:"evaluation_project"`
Id
int64
`comment:"ID" pg:"pk:id"`
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停用)" pg:",use_zero"`
HrBp
int
`comment:"HR角色权限" pg:",use_zero"`
Pmp
int
`comment:"PM角色权限" pg:",use_zero"`
PmpIds
[]
string
`comment:"项目管理员ID"`
Recipients
[]
string
`comment:"被评估人ID"`
Template
*
domain
.
EvaluationTemplate
`comment:"评估模板"`
BeginTime
time
.
Time
`comment:"项目起始时间"`
EndTime
time
.
Time
`comment:"项目截至时间 "`
CreatedAt
time
.
Time
`comment:"创建时间"`
UpdatedAt
time
.
Time
`comment:"更新时间"`
DeletedAt
*
time
.
Time
`comment:"删除时间"`
tableName
struct
{}
`comment:"评估项目" pg:"evaluation_project"`
Id
int64
`comment:"ID" pg:"pk:id"`
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停用)" pg:",use_zero"`
SummaryState
int
`comment:"周期评估是否下发" pg:",use_zero"`
HrBp
int
`comment:"HR角色权限" pg:",use_zero"`
Pmp
int
`comment:"PM角色权限" pg:",use_zero"`
PmpIds
[]
string
`comment:"项目管理员ID"`
Recipients
[]
string
`comment:"被评估人ID"`
Template
*
domain
.
EvaluationTemplate
`comment:"评估模板"`
BeginTime
time
.
Time
`comment:"项目起始时间"`
EndTime
time
.
Time
`comment:"项目截至时间 "`
CreatedAt
time
.
Time
`comment:"创建时间"`
UpdatedAt
time
.
Time
`comment:"更新时间"`
DeletedAt
*
time
.
Time
`comment:"删除时间"`
}
...
...
pkg/infrastructure/repository/pg_evaluation_project_repository.go
查看文件 @
149c0cd
...
...
@@ -3,13 +3,14 @@ package repository
import
(
"errors"
"fmt"
"time"
"github.com/go-pg/pg/v10"
"github.com/linmadan/egglib-go/persistent/pg/sqlbuilder"
pgTransaction
"github.com/linmadan/egglib-go/transaction/pg"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/pg/models"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/utils"
"time"
)
type
EvaluationProjectRepository
struct
{
...
...
@@ -34,45 +35,47 @@ func (repo *EvaluationProjectRepository) TransformToDomain(m *models.EvaluationP
}
return
domain
.
EvaluationProject
{
Id
:
m
.
Id
,
Name
:
m
.
Name
,
Describe
:
m
.
Describe
,
CompanyId
:
m
.
CompanyId
,
CycleId
:
m
.
CycleId
,
CreatorId
:
m
.
CreatorId
,
State
:
m
.
State
,
HrBp
:
m
.
HrBp
,
Pmp
:
m
.
Pmp
,
PmpIds
:
m
.
PmpIds
,
Recipients
:
m
.
Recipients
,
Template
:
m
.
Template
,
BeginTime
:
m
.
BeginTime
,
EndTime
:
m
.
EndTime
,
CreatedAt
:
m
.
CreatedAt
.
Local
(),
UpdatedAt
:
m
.
UpdatedAt
.
Local
(),
DeletedAt
:
m
.
DeletedAt
,
Id
:
m
.
Id
,
Name
:
m
.
Name
,
Describe
:
m
.
Describe
,
CompanyId
:
m
.
CompanyId
,
CycleId
:
m
.
CycleId
,
CreatorId
:
m
.
CreatorId
,
State
:
m
.
State
,
SummaryState
:
domain
.
ProjectSummaryState
(
m
.
SummaryState
),
HrBp
:
m
.
HrBp
,
Pmp
:
m
.
Pmp
,
PmpIds
:
m
.
PmpIds
,
Recipients
:
m
.
Recipients
,
Template
:
m
.
Template
,
BeginTime
:
m
.
BeginTime
,
EndTime
:
m
.
EndTime
,
CreatedAt
:
m
.
CreatedAt
.
Local
(),
UpdatedAt
:
m
.
UpdatedAt
.
Local
(),
DeletedAt
:
m
.
DeletedAt
,
}
}
func
(
repo
*
EvaluationProjectRepository
)
TransformToModel
(
d
*
domain
.
EvaluationProject
)
models
.
EvaluationProject
{
return
models
.
EvaluationProject
{
Id
:
d
.
Id
,
Name
:
d
.
Name
,
Describe
:
d
.
Describe
,
CompanyId
:
d
.
CompanyId
,
CycleId
:
d
.
CycleId
,
CreatorId
:
d
.
CreatorId
,
State
:
d
.
State
,
HrBp
:
d
.
HrBp
,
Pmp
:
d
.
Pmp
,
PmpIds
:
d
.
PmpIds
,
Recipients
:
d
.
Recipients
,
Template
:
d
.
Template
,
BeginTime
:
d
.
BeginTime
,
EndTime
:
d
.
EndTime
,
CreatedAt
:
d
.
CreatedAt
,
UpdatedAt
:
d
.
UpdatedAt
,
DeletedAt
:
d
.
DeletedAt
,
Id
:
d
.
Id
,
Name
:
d
.
Name
,
Describe
:
d
.
Describe
,
CompanyId
:
d
.
CompanyId
,
CycleId
:
d
.
CycleId
,
CreatorId
:
d
.
CreatorId
,
State
:
d
.
State
,
SummaryState
:
int
(
d
.
SummaryState
),
HrBp
:
d
.
HrBp
,
Pmp
:
d
.
Pmp
,
PmpIds
:
d
.
PmpIds
,
Recipients
:
d
.
Recipients
,
Template
:
d
.
Template
,
BeginTime
:
d
.
BeginTime
,
EndTime
:
d
.
EndTime
,
CreatedAt
:
d
.
CreatedAt
,
UpdatedAt
:
d
.
UpdatedAt
,
DeletedAt
:
d
.
DeletedAt
,
}
}
...
...
pkg/port/beego/controllers/summary_evaluation_controller.go
查看文件 @
149c0cd
...
...
@@ -175,6 +175,7 @@ func (c *SummaryEvaluationController) EditEvaluationHRBP() {
c
.
Response
(
data
,
err
)
}
// 获取上级评估
func
(
c
*
SummaryEvaluationController
)
GetEvaluationSuper
()
{
srv
:=
service
.
NewSummaryEvaluationService
()
param
:=
&
command
.
QueryEvaluationSuper
{}
...
...
@@ -190,6 +191,7 @@ func (c *SummaryEvaluationController) GetEvaluationSuper() {
c
.
Response
(
data
,
err
)
}
// 编辑上级评估
func
(
c
*
SummaryEvaluationController
)
EditEvaluationSuper
()
{
srv
:=
service
.
NewSummaryEvaluationService
()
param
:=
&
command
.
EditEvaluationValue
{}
...
...
@@ -206,6 +208,7 @@ func (c *SummaryEvaluationController) EditEvaluationSuper() {
c
.
Response
(
data
,
err
)
}
// 上级评估列表
func
(
c
*
SummaryEvaluationController
)
ListEvaluationSuper
()
{
srv
:=
service
.
NewSummaryEvaluationService
()
param
:=
&
command
.
QueryEvaluationList
{}
...
...
@@ -221,3 +224,19 @@ func (c *SummaryEvaluationController) ListEvaluationSuper() {
data
,
err
:=
srv
.
ListEvaluationSuper
(
param
)
c
.
Response
(
data
,
err
)
}
// 员工确认评估分数
func
(
c
*
SummaryEvaluationController
)
ConfirmScoreSuperEvaluation
()
{
srv
:=
service
.
NewSummaryEvaluationService
()
param
:=
&
command
.
ConfirmScore
{}
err
:=
c
.
BindJSON
(
param
)
if
err
!=
nil
{
e
:=
application
.
ThrowError
(
application
.
ARG_ERROR
,
"json 解析错误"
+
err
.
Error
())
c
.
Response
(
nil
,
e
)
return
}
userReq
:=
middlewares
.
GetUser
(
c
.
Ctx
)
param
.
UserId
=
int
(
userReq
.
UserId
)
err
=
srv
.
ConfirmScoreSuperEvaluation
(
param
)
c
.
Response
(
nil
,
err
)
}
...
...
pkg/port/beego/routers/summary_evaluation_router.go
查看文件 @
149c0cd
...
...
@@ -23,6 +23,8 @@ func init() {
web
.
NSCtrlPost
(
"/evaluation-super"
,
(
*
controllers
.
SummaryEvaluationController
)
.
GetEvaluationSuper
),
web
.
NSCtrlPost
(
"/evaluation-super/edit"
,
(
*
controllers
.
SummaryEvaluationController
)
.
EditEvaluationSuper
),
web
.
NSCtrlPost
(
"/evaluation-super/list"
,
(
*
controllers
.
SummaryEvaluationController
)
.
ListEvaluationSuper
),
web
.
NSCtrlPost
(
"/evaluation-super/confirm"
,
(
*
controllers
.
SummaryEvaluationController
)
.
ConfirmScoreSuperEvaluation
),
//
)
web
.
AddNamespace
(
summaryNS
)
}
...
...
请
注册
或
登录
后发表评论