切换导航条
此项目
正在载入...
登录
allied-creation
/
performance
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
tangxvhui
2 years ago
提交
9230f6df17451a4765998540e9c4a3724121e1f5
1 个父辈
ca1bbefe
更新 上级评估的 列表
隐藏空白字符变更
内嵌
并排对比
正在显示
5 个修改的文件
包含
152 行增加
和
13 行删除
pkg/application/summary_evaluation/command/query_evaluation_list.go
pkg/application/summary_evaluation/service/service.go
pkg/infrastructure/repository/pg_summary_evaluation_repository.go
pkg/port/beego/controllers/summary_evaluation_controller.go
pkg/port/beego/routers/summary_evaluation_router.go
pkg/application/summary_evaluation/command/query_evaluation_list.go
查看文件 @
9230f6d
package
command
type
QueryEvaluationList
struct
{
PageNumber
int
`json:"pageNumber"`
PageSize
int
`json:"pageSize"`
CycleId
int
`json:"cycleId,string"`
CompanyId
int
`json:"companyId"`
ExecutorId
int
`json:"executorId"`
TargetUsrName
string
`json:"targetUsrName"`
PageNumber
int
`json:"pageNumber"`
PageSize
int
`json:"pageSize"`
CycleId
int
`json:"cycleId,string"`
CompanyId
int
`json:"-"`
ExecutorId
int
`json:"-"`
TargetUserName
string
`json:"targetUserName"`
}
...
...
pkg/application/summary_evaluation/service/service.go
查看文件 @
9230f6d
...
...
@@ -994,10 +994,40 @@ func (srv *SummaryEvaluationService) ListEvaluationSuper(param *command.QueryEva
userRepo
:=
factory
.
CreateUserRepository
(
map
[
string
]
interface
{}{
"transactionContext"
:
transactionContext
,
})
cnt
,
evaluationList
,
err
:=
evaluationRepo
.
Find
(
map
[
string
]
interface
{}{
positionRepo
:=
factory
.
CreatePositionRepository
(
map
[
string
]
interface
{}{
"transactionContext"
:
transactionContext
,
})
departmentRepo
:=
factory
.
CreateDepartmentRepository
(
map
[
string
]
interface
{}{
"transactionContext"
:
transactionContext
,
})
limit
:=
param
.
PageSize
offset
:=
(
param
.
PageNumber
-
1
)
*
param
.
PageSize
//获取评估列表信息
condition1
:=
map
[
string
]
interface
{}{
"cycleId"
:
param
.
CycleId
,
"executorId"
:
param
.
ExecutorId
,
"types"
:
int
(
domain
.
EvaluationSuper
),
"limit"
:
limit
,
}
if
offset
>
0
{
condition1
[
"offset"
]
=
offset
}
if
len
(
param
.
TargetUserName
)
==
0
{
condition1
[
"targetUserName"
]
=
"%"
+
param
.
TargetUserName
+
"%"
}
//获取评估列表信息
cnt
,
evaluationList
,
err
:=
evaluationRepo
.
Find
(
condition1
)
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
//获取未完成上级评估的数量
cntUn
,
_
,
err
:=
evaluationRepo
.
Find
(
map
[
string
]
interface
{}{
"cycleId"
:
param
.
CycleId
,
"executorId"
:
param
.
ExecutorId
,
"types"
:
int
(
domain
.
EvaluationSuper
),
"status"
:
domain
.
EvaluationUncompleted
,
"limit"
:
1
,
})
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
...
...
@@ -1006,21 +1036,109 @@ func (srv *SummaryEvaluationService) ListEvaluationSuper(param *command.QueryEva
for
_
,
v
:=
range
evaluationList
{
targetUserIds
=
append
(
targetUserIds
,
v
.
TargetUser
.
UserId
)
}
var
userList
[]
*
domain
.
User
//获取员工的综合自评
evaluationSelfMap
:=
map
[
int
]
*
domain
.
SummaryEvaluation
{}
for
_
,
v
:=
range
evaluationList
{
_
,
evaluationSelfList
,
err
:=
evaluationRepo
.
Find
(
map
[
string
]
interface
{}{
"cycleId"
:
param
.
CycleId
,
"executorId"
:
v
.
TargetUser
.
UserId
,
"types"
:
int
(
domain
.
EvaluationSelf
),
"limit"
:
1
,
})
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
"获取综合自评"
+
err
.
Error
())
}
if
len
(
evaluationSelfList
)
>
0
{
evaluationSelfMap
[
v
.
TargetUser
.
UserId
]
=
evaluationSelfList
[
0
]
}
}
//获取员工信息
userMap
:=
map
[
int64
]
*
domain
.
User
{}
if
len
(
targetUserIds
)
>
0
{
_
,
userList
,
err
=
userRepo
.
Find
(
map
[
string
]
interface
{}{
_
,
userList
,
err
:
=
userRepo
.
Find
(
map
[
string
]
interface
{}{
"ids"
:
targetUserIds
,
})
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
for
_
,
v
:=
range
userList
{
userMap
[
v
.
Id
]
=
v
}
}
var
departmentIds
[]
int
//获取部门
departmentMap
:=
map
[
int64
]
*
domain
.
Department
{}
var
positionIds
[]
int
//获取职位列表
positionMap
:=
map
[
int64
]
*
domain
.
Position
{}
for
_
,
v
:=
range
userMap
{
departmentIds
=
append
(
departmentIds
,
v
.
DepartmentId
...
)
positionIds
=
append
(
positionIds
,
v
.
PositionId
...
)
}
if
len
(
departmentIds
)
>
0
{
_
,
departmentList
,
err
:=
departmentRepo
.
Find
(
map
[
string
]
interface
{}{
"ids"
:
departmentIds
})
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
"获取部门信息"
+
err
.
Error
())
}
for
_
,
v
:=
range
departmentList
{
departmentMap
[
v
.
Id
]
=
v
}
}
_
=
userList
_
=
evaluationList
_
=
cnt
if
len
(
positionIds
)
>
0
{
_
,
positionList
,
err
:=
positionRepo
.
Find
(
map
[
string
]
interface
{}{
"ids"
:
departmentIds
})
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
"获取部门信息"
+
err
.
Error
())
}
for
_
,
v
:=
range
positionList
{
positionMap
[
v
.
Id
]
=
v
}
}
if
err
:=
transactionContext
.
CommitTransaction
();
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
return
nil
,
nil
evaluationListAdapter
:=
[]
*
adapter
.
EvaluationSuperListAdapter
{}
for
_
,
v
:=
range
evaluationList
{
item
:=
adapter
.
EvaluationSuperListAdapter
{
SummaryEvaluationId
:
v
.
Id
,
TargetUserName
:
v
.
TargetUser
.
UserName
,
EvaluationStatus
:
string
(
v
.
Status
),
EndTime
:
v
.
EndTime
.
Format
(
"2006-01-02 15:04:05"
),
TotalScoreSelf
:
""
,
Department
:
""
,
Position
:
""
,
EntryTime
:
""
,
}
//填充员工信息
if
targetUser
,
ok
:=
userMap
[
int64
(
v
.
TargetUser
.
UserId
)];
ok
{
//填充部门信息
for
_
,
departId
:=
range
targetUser
.
DepartmentId
{
if
depart
,
ok
:=
departmentMap
[
int64
(
departId
)];
ok
{
item
.
Department
+=
depart
.
Name
+
" "
}
}
//填充职位信息
for
_
,
positionId
:=
range
targetUser
.
PositionId
{
if
position
,
ok
:=
positionMap
[
int64
(
positionId
)];
ok
{
item
.
Position
+=
position
.
Name
+
" "
}
}
//填充入职时间
item
.
EntryTime
=
targetUser
.
EntryTime
}
//填充自评总分
if
evaluationSelf
,
ok
:=
evaluationSelfMap
[
v
.
TargetUser
.
UserId
];
ok
{
item
.
TotalScoreSelf
=
evaluationSelf
.
TotalScore
}
evaluationListAdapter
=
append
(
evaluationListAdapter
,
&
item
)
}
result
:=
tool_funs
.
SimpleWrapGridMap
(
int64
(
cnt
),
evaluationListAdapter
)
result
[
"endTime"
]
=
""
result
[
"uncompleted_number"
]
=
0
if
len
(
evaluationList
)
>
0
{
result
[
"endTime"
]
=
evaluationList
[
0
]
.
EndTime
.
Format
(
"2006-01-02 15:04:05"
)
result
[
"uncompleted_number"
]
=
cntUn
}
return
result
,
nil
}
...
...
pkg/infrastructure/repository/pg_summary_evaluation_repository.go
查看文件 @
9230f6d
...
...
@@ -144,6 +144,10 @@ func (repo *SummaryEvaluationRepository) Find(queryOptions map[string]interface{
query
.
Where
(
`summary_evaluation.target_user->>'userId'='?'`
,
v
)
}
if
v
,
ok
:=
queryOptions
[
"targetUserName"
];
ok
{
query
.
Where
(
`summary_evaluation.target_user->>'userName' like ?`
,
v
)
}
if
v
,
ok
:=
queryOptions
[
"executorId"
];
ok
{
query
.
Where
(
`summary_evaluation.executor->>'userId'='?'`
,
v
)
}
...
...
pkg/port/beego/controllers/summary_evaluation_controller.go
查看文件 @
9230f6d
...
...
@@ -205,3 +205,19 @@ func (c *SummaryEvaluationController) EditEvaluationSuper() {
data
,
err
:=
srv
.
EditEvaluationSuper
(
param
)
c
.
Response
(
data
,
err
)
}
func
(
c
*
SummaryEvaluationController
)
ListEvaluationSuper
()
{
srv
:=
service
.
NewSummaryEvaluationService
()
param
:=
&
command
.
QueryEvaluationList
{}
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
.
CompanyId
=
int
(
userReq
.
CompanyId
)
param
.
ExecutorId
=
int
(
userReq
.
UserId
)
data
,
err
:=
srv
.
ListEvaluationSuper
(
param
)
c
.
Response
(
data
,
err
)
}
...
...
pkg/port/beego/routers/summary_evaluation_router.go
查看文件 @
9230f6d
...
...
@@ -22,6 +22,7 @@ func init() {
web
.
NSCtrlPost
(
"/self/summary"
,
(
*
controllers
.
SummaryEvaluationController
)
.
CountEvaluationSelfLevel
),
web
.
NSCtrlPost
(
"/evaluation-super"
,
(
*
controllers
.
SummaryEvaluationController
)
.
GetEvaluationSuper
),
web
.
NSCtrlPost
(
"/evaluation-super/edit"
,
(
*
controllers
.
SummaryEvaluationController
)
.
EditEvaluationSuper
),
web
.
NSCtrlPost
(
"/evaluation-super/list"
,
(
*
controllers
.
SummaryEvaluationController
)
.
ListEvaluationSuper
),
)
web
.
AddNamespace
(
summaryNS
)
}
...
...
请
注册
或
登录
后发表评论