...
|
...
|
@@ -990,8 +990,8 @@ func (srv *SummaryEvaluationService) getEvaluationSuperDefaultValue(transactionC |
|
|
return result, nil
|
|
|
}
|
|
|
|
|
|
// 获取上级评估的列表
|
|
|
func (srv *SummaryEvaluationService) ListEvaluationSuper(param *command.QueryEvaluationList) (map[string]interface{}, error) {
|
|
|
// 获取执行人的上级评估的列表
|
|
|
func (srv *SummaryEvaluationService) ListExecutorEvaluationSuper(param *command.QueryExecutorEvaluationList) (map[string]interface{}, error) {
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
...
|
...
|
@@ -1011,9 +1011,6 @@ func (srv *SummaryEvaluationService) ListEvaluationSuper(param *command.QueryEva |
|
|
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
|
|
|
|
...
|
...
|
@@ -1080,28 +1077,15 @@ func (srv *SummaryEvaluationService) ListEvaluationSuper(param *command.QueryEva |
|
|
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
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if len(positionIds) > 0 {
|
|
|
_, positionList, err := positionRepo.Find(map[string]interface{}{"ids": departmentIds})
|
|
|
_, positionList, err := positionRepo.Find(map[string]interface{}{"ids": positionIds})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取部门信息"+err.Error())
|
|
|
}
|
...
|
...
|
@@ -1124,14 +1108,11 @@ func (srv *SummaryEvaluationService) ListEvaluationSuper(param *command.QueryEva |
|
|
Position: "",
|
|
|
EntryTime: "",
|
|
|
}
|
|
|
for _, dep := range v.TargetDepartment {
|
|
|
item.Department += dep.DepartmentName + " "
|
|
|
}
|
|
|
//填充员工信息
|
|
|
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 {
|
...
|
...
|
@@ -1310,7 +1291,107 @@ func (srv *SummaryEvaluationService) GetTargetUserEvaluationSuper(param *command |
|
|
}
|
|
|
|
|
|
// 获取周期综合评估下,周期评估列表
|
|
|
func (srv *SummaryEvaluationService) ListEvalationSuper() (map[int]interface{}, error) {
|
|
|
func (srv *SummaryEvaluationService) ListAllEvaluationSuper(param *command.QueryEvaluationList) (map[string]interface{}, 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,
|
|
|
})
|
|
|
userRepo := factory.CreateUserRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
positionRepo := factory.CreatePositionRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
limit := param.PageSize
|
|
|
offset := (param.PageNumber - 1) * param.PageSize
|
|
|
|
|
|
//获取评估列表信息
|
|
|
condition1 := map[string]interface{}{
|
|
|
"cycleId": param.CycleId,
|
|
|
"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())
|
|
|
}
|
|
|
targetUserIds := []int{}
|
|
|
for _, v := range evaluationList {
|
|
|
targetUserIds = append(targetUserIds, v.TargetUser.UserId)
|
|
|
}
|
|
|
|
|
|
return nil, nil
|
|
|
//获取员工信息
|
|
|
userMap := map[int64]*domain.User{}
|
|
|
if len(targetUserIds) > 0 {
|
|
|
_, 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 positionIds []int
|
|
|
//获取职位列表
|
|
|
positionMap := map[int64]*domain.Position{}
|
|
|
for _, v := range userMap {
|
|
|
positionIds = append(positionIds, v.PositionId...)
|
|
|
}
|
|
|
if len(positionIds) > 0 {
|
|
|
_, positionList, err := positionRepo.Find(map[string]interface{}{"ids": positionIds})
|
|
|
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())
|
|
|
}
|
|
|
evaluationListAdapter := []*adapter.EvaluationSuperItemAdapter{}
|
|
|
for _, v := range evaluationList {
|
|
|
item := adapter.EvaluationSuperItemAdapter{
|
|
|
SummaryEvaluationId: v.Id,
|
|
|
TargetUserName: v.TargetUser.UserName,
|
|
|
TargetUserId: v.TargetUser.UserId,
|
|
|
CycleId: v.CycleId,
|
|
|
TotalScore: v.TotalScore,
|
|
|
Department: "",
|
|
|
Position: "",
|
|
|
}
|
|
|
for _, dep := range v.TargetDepartment {
|
|
|
item.Department += dep.DepartmentName + " "
|
|
|
}
|
|
|
//填充员工信息
|
|
|
if targetUser, ok := userMap[int64(v.TargetUser.UserId)]; ok {
|
|
|
//填充职位信息
|
|
|
for _, positionId := range targetUser.PositionId {
|
|
|
if position, ok := positionMap[int64(positionId)]; ok {
|
|
|
item.Position += position.Name + " "
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
evaluationListAdapter = append(evaluationListAdapter, &item)
|
|
|
}
|
|
|
result := tool_funs.SimpleWrapGridMap(int64(cnt), evaluationListAdapter)
|
|
|
return result, nil
|
|
|
} |
...
|
...
|
|