切换导航条
此项目
正在载入...
登录
allied-creation
/
performance
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
tangxvhui
2 years ago
提交
e7bc2825ddb9be9da1db23f7d896bc11245d8563
1 个父辈
d9d7de34
根据
隐藏空白字符变更
内嵌
并排对比
正在显示
7 个修改的文件
包含
152 行增加
和
43 行删除
pkg/application/summary_evaluation/adapter/evaluation_info.go
pkg/application/summary_evaluation/command/get_evaluation.go
pkg/application/summary_evaluation/service/service.go
pkg/domain/summary_evaluation.go
pkg/domain/summary_evaluation_value.go
pkg/infrastructure/repository/pg_evaluation_item_used_repository.go
pkg/infrastructure/repository/pg_summary_evaluation_repository.go
pkg/application/summary_evaluation/adapter/evaluation_info.go
查看文件 @
e7bc282
...
...
@@ -3,32 +3,32 @@ package adapter
import
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
type
EvaluationInfoAdapter
struct
{
SummaryEvaluationId
int
`json:"summaryEvaluationId"`
//
CycleId
int
`json:"cycleId,string"`
//周期id
CycleName
string
`json:"cycleName"`
//周期名称
EvaluationProjectId
int
`json:"evaluationProjectId"`
//项目id
EvaluationProjectName
string
`json:"evaluationProjectName"`
//项目名称
LinkNodeId
int
`json:"linkNodeId,string"`
//评估环节id
LinkNodeName
string
`json:"linkNodeName"`
//评估环节名称
BeginTime
string
`json:"beginTime"`
//开始时间 2006-01-02 15:04:05
EndTime
string
`json:"endTime"`
//结束时间 2006-01-02 15:04:05
Status
string
`json:"status"`
//完成状态
// Content
SummaryEvaluationId
int
`json:"summaryEvaluationId"`
//
CycleId
int
`json:"cycleId,string"`
//周期id
CycleName
string
`json:"cycleName"`
//周期名称
EvaluationProjectId
int
`json:"evaluationProjectId"`
//项目id
EvaluationProjectName
string
`json:"evaluationProjectName"`
//项目名称
LinkNodeId
int
`json:"linkNodeId,string"`
//评估环节id
LinkNodeName
string
`json:"linkNodeName"`
//评估环节名称
BeginTime
string
`json:"beginTime"`
//开始时间 2006-01-02 15:04:05
EndTime
string
`json:"endTime"`
//结束时间 2006-01-02 15:04:05
Status
string
`json:"status"`
//完成状态
EvaluationItems
[]
EvaluationItemAdapter
`json:"assessContent"`
}
type
EvaluationItemAdapter
struct
{
SortBy
int
//排序
Category
string
//类别
Name
string
//名称
PromptTitle
string
//提示项标题
PromptText
string
//提示项正文
EntryItems
[]
domain
.
EntryItem
//填写的反馈
RuleType
int
//评估方式(0评级、1评分)
Rule
domain
.
EvaluationRule
//评估的选项规则
Weight
float64
//"权重"
Required
int
// 必填项
Value
string
//评估填写的评分
Score
string
//评定得分
Types
string
//评估类型
Remark
string
//填写的内容反馈
EvaluationItemId
int
`json:"evaluationItemId,string"`
//评估条目的id
SortBy
int
`json:"sortBy"`
//排序
Category
string
`json:"category"`
//类别
Name
string
`json:"name"`
//名称
PromptTitle
string
`json:"promptTitle"`
//提示项标题
PromptText
string
`json:"promptText"`
//提示项正文
EntryItems
[]
domain
.
EntryItem
`json:"entryItems"`
//填写的反馈
RuleType
int
`json:"ruleType"`
//评估方式(0评级、1评分)
Rule
domain
.
EvaluationRule
`json:"rule"`
//评估的选项规则
Weight
float64
`json:"weight"`
//"权重"
Required
int
`json:"required"`
// 必填项
Value
string
`json:"value"`
//评估填写的评分
Score
string
`json:"score"`
//评定得分
Remark
string
`json:"remark"`
//填写的内容反馈
}
...
...
pkg/application/summary_evaluation/command/get_evaluation.go
查看文件 @
e7bc282
package
command
type
QueryEvaluationInfo
struct
{
CycleId
int
`json:"cycleId,string"`
CompanyId
int
`json:"-"`
CycleId
int
`json:"cycleId,string"`
//周期id
ExecutorId
int
`json:"executorId,string"`
//执行人id
CompanyId
int
`json:"-"`
//公司id
}
...
...
pkg/application/summary_evaluation/service/service.go
查看文件 @
e7bc282
...
...
@@ -239,8 +239,107 @@ func (srv *SummaryEvaluationServeice) GetMenu(param *command.QueryMenu) (map[str
return
result
,
nil
}
// buildSummaryItemValue 将填写值填充进评估项
func
(
srv
*
SummaryEvaluationServeice
)
buildSummaryItemValue
(
itemList
[]
*
domain
.
EvaluationItemUsed
,
valueList
[]
*
domain
.
SummaryEvaluationValue
)
(
itemValues
[]
adapter
.
EvaluationItemAdapter
)
{
itemValues
=
[]
adapter
.
EvaluationItemAdapter
{}
valueMap
:=
map
[
int
]
*
domain
.
SummaryEvaluationValue
{}
for
_
,
v
:=
range
valueList
{
valueMap
[
v
.
EvaluationItemId
]
=
v
}
for
_
,
v
:=
range
itemList
{
item
:=
adapter
.
EvaluationItemAdapter
{
EvaluationItemId
:
v
.
Id
,
SortBy
:
v
.
SortBy
,
Category
:
v
.
Category
,
Name
:
v
.
Name
,
PromptTitle
:
v
.
PromptTitle
,
PromptText
:
v
.
PromptText
,
EntryItems
:
v
.
EntryItems
,
RuleType
:
v
.
RuleType
,
Rule
:
v
.
Rule
,
Weight
:
v
.
Weight
,
Required
:
v
.
Required
,
Value
:
""
,
Score
:
""
,
Remark
:
""
,
}
value
,
ok
:=
valueMap
[
v
.
Id
]
if
!
ok
{
continue
}
item
.
Score
=
value
.
Score
item
.
Value
=
value
.
Value
item
.
Remark
=
value
.
Remark
itemValues
=
append
(
itemValues
,
item
)
}
return
itemValues
}
// 获取综合自评详情
func
(
srv
*
SummaryEvaluationServeice
)
GetEvaluationSelf
(
param
*
command
.
QueryEvaluationInfo
)
{}
func
(
srv
*
SummaryEvaluationServeice
)
GetEvaluationSelf
(
param
*
command
.
QueryEvaluationInfo
)
(
*
adapter
.
EvaluationInfoAdapter
,
error
)
{
transactionContext
,
err
:=
factory
.
CreateTransactionContext
(
nil
)
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
TRANSACTION_ERROR
,
err
.
Error
())
}
if
err
:=
transactionContext
.
StartTransaction
();
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
TRANSACTION_ERROR
,
err
.
Error
())
}
defer
func
()
{
_
=
transactionContext
.
RollbackTransaction
()
}()
evaluationRepo
:=
factory
.
CreateSummaryEvaluationRepository
(
map
[
string
]
interface
{}{
"transactionContext"
:
transactionContext
,
})
evaluationItemRepo
:=
factory
.
CreateEvaluationItemUsedRepository
(
map
[
string
]
interface
{}{
"transactionContext"
:
transactionContext
,
})
itemValueRepo
:=
factory
.
CreateSummaryEvaluationRepository
(
map
[
string
]
interface
{}{
"transactionContext"
:
transactionContext
,
})
_
,
evaluationList
,
err
:=
evaluationRepo
.
Find
(
map
[
string
]
interface
{}{
"limit"
:
1
,
"cycleId"
:
param
.
CompanyId
,
"executorId"
:
param
.
ExecutorId
,
"types"
:
domain
.
EvaluationSelf
,
})
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
if
len
(
evaluationList
)
==
0
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
evaluationData
:=
evaluationList
[
0
]
_
,
itemList
,
err
:=
evaluationItemRepo
.
Find
(
map
[
string
]
interface
{}{
"evaluationProjectId"
:
evaluationData
.
EvaluationProjectId
,
"nodeType"
:
int
(
domain
.
LinkNodeSelfAssessment
),
})
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
if
err
:=
transactionContext
.
CommitTransaction
();
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
_
=
itemList
_
=
itemValueRepo
return
nil
,
nil
}
// 编辑综合自评详情
func
(
srv
*
SummaryEvaluationServeice
)
EditEvaluationSelf
()
{}
func
(
srv
*
SummaryEvaluationServeice
)
EditEvaluationSelf
()
(
map
[
string
][]
adapter
.
EvaluationItemAdapter
,
error
)
{
transactionContext
,
err
:=
factory
.
CreateTransactionContext
(
nil
)
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
TRANSACTION_ERROR
,
err
.
Error
())
}
if
err
:=
transactionContext
.
StartTransaction
();
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
TRANSACTION_ERROR
,
err
.
Error
())
}
defer
func
()
{
_
=
transactionContext
.
RollbackTransaction
()
}()
if
err
:=
transactionContext
.
CommitTransaction
();
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
return
nil
,
nil
}
...
...
pkg/domain/summary_evaluation.go
查看文件 @
e7bc282
...
...
@@ -31,10 +31,6 @@ const (
Evaluation360
EvaluationType
=
2
//360评估
EvaluationSuper
EvaluationType
=
3
//上级评估
EvaluationHrbp
EvaluationType
=
4
//人资评估
// EvaluationSelf EvaluationType = "self"
// Evaluation360 EvaluationType = "360"
// EvaluationSuper EvaluationType = "superior"
// EvaluationHrbp EvaluationType = "hrbp"
)
// 评估的填写状态
...
...
pkg/domain/summary_evaluation_value.go
查看文件 @
e7bc282
...
...
@@ -4,16 +4,16 @@ import "time"
// 周期综合评估填写的内容
type
SummaryEvaluationValue
struct
{
Id
int
//
EvaluationItemId
int
//评估条目的id
SummaryEvaluationId
int
//综合评估任务(SummaryEvaluation)的id
Value
string
//评估填写的评分
Score
string
//评定得分
Types
EvaluationType
//评估类型
Remark
string
//填写的内容反馈
CreatedAt
time
.
Time
//数据创建时间
UpdatedAt
time
.
Time
//数据更新时间
DeletedAt
*
time
.
Time
//数据删除时间
Id
int
`json:"id"`
//
EvaluationItemId
int
`json:"evaluationItemId"`
//评估条目的id
SummaryEvaluationId
int
`json:"summaryEvaluationId"`
//综合评估任务(SummaryEvaluation)的id
Value
string
`json:"value"`
//评估填写的评分
Score
string
`json:"score"`
//评定得分
Types
EvaluationType
`json:"types"`
//评估类型
Remark
string
`json:"remark"`
//填写的内容反馈
CreatedAt
time
.
Time
`json:"createdAt"`
//数据创建时间
UpdatedAt
time
.
Time
`json:"updatedAt"`
//数据更新时间
DeletedAt
*
time
.
Time
`json:"deletedAt"`
//数据删除时间
}
type
SummaryEvaluationValueRepository
interface
{
...
...
pkg/infrastructure/repository/pg_evaluation_item_used_repository.go
查看文件 @
e7bc282
...
...
@@ -78,6 +78,15 @@ func (repo *EvaluationItemUsedRepository) Find(queryOptions map[string]interface
if
v
,
ok
:=
queryOptions
[
"offset"
]
.
(
int
);
ok
{
query
.
Offset
(
v
)
}
if
v
,
ok
:=
queryOptions
[
"evaluationProjectId"
];
ok
{
query
.
Where
(
"evaluation_project_id=?"
,
v
)
}
if
v
,
ok
:=
queryOptions
[
"nodeType"
];
ok
{
query
.
Where
(
" node_type=?"
,
v
)
}
count
,
err
:=
query
.
SelectAndCount
()
if
err
!=
nil
{
return
0
,
nil
,
err
...
...
pkg/infrastructure/repository/pg_summary_evaluation_repository.go
查看文件 @
e7bc282
...
...
@@ -129,6 +129,10 @@ func (repo *SummaryEvaluationRepository) Find(queryOptions map[string]interface{
query
.
Where
(
"types=?"
,
v
)
}
if
v
,
ok
:=
queryOptions
[
"cycleId"
];
ok
{
query
.
Where
(
"cycle_id=?"
,
v
)
}
if
v
,
ok
:=
queryOptions
[
"status"
];
ok
{
query
.
Where
(
"status=?"
,
v
)
}
...
...
请
注册
或
登录
后发表评论