|
|
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/factory"
|
|
|
service "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/role"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/summary_evaluation/adapter"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/summary_evaluation/command"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/dao"
|
|
|
"strings"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
|
// GetEvaluation360 获取360综评详情
|
|
|
// Evaluation360List 获取360综评列表
|
|
|
func (srv *SummaryEvaluationService) Evaluation360List(param *command.QueryEvaluation360List) (*adapter.SummaryEvaluationAdapter, error) {
|
|
|
transactionContext, err := factory.ValidateStartTransaction(param)
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
defer func() {
|
|
|
_ = transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
|
|
|
evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
evaluationItemRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
|
|
|
var searchTargetName string
|
|
|
if len(param.SearchName) > 0 {
|
|
|
searchTargetName = "%" + param.SearchName + "%"
|
|
|
} else {
|
|
|
searchTargetName = ""
|
|
|
}
|
|
|
limit := param.PageSize
|
|
|
offset := limit * (param.PageNumber - 1)
|
|
|
if offset < 0 {
|
|
|
offset = 0
|
|
|
}
|
|
|
count, list, err := evaluationRepo.Find(map[string]interface{}{
|
|
|
"companyId": param.CompanyId,
|
|
|
"cycleId": param.CycleId,
|
|
|
"executorId": param.UserId,
|
|
|
"types": domain.Evaluation360,
|
|
|
"targetUserName": searchTargetName,
|
|
|
"limit": limit,
|
|
|
"offset": offset,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
ids := make([]int, 0)
|
|
|
projectIds := make([]int, 0)
|
|
|
for i := range list {
|
|
|
ids = append(ids, list[i].Id)
|
|
|
projectIds = append(projectIds, list[i].EvaluationProjectId)
|
|
|
}
|
|
|
|
|
|
// 固定列
|
|
|
changeableHeader := []adapter.TableHeader{
|
|
|
{Key: "targetUserName", Name: "姓名"},
|
|
|
{Key: "statusVal", Name: "状态"},
|
|
|
{Key: "relation", Name: "360°评估关系"},
|
|
|
{Key: "endTime", Name: "360°评估截止日期"},
|
|
|
}
|
|
|
changeableRowMap := map[int]map[string]interface{}{} // k,v(用户ID -> 数据集合)行数据内容
|
|
|
itemMap := map[int][]*domain.EvaluationItemUsed{} // k,v(项目ID -> 评估数组)归类评估内容
|
|
|
valueMap := map[string]*domain.SummaryEvaluationValue{} // k,v(周期+评估 -> 提交值)
|
|
|
uniqueColumnsMap := map[string]string{} // 列名称唯一
|
|
|
|
|
|
if len(ids) > 0 {
|
|
|
// 评估内容(注.使用自评模板,并过滤出360综评人的评估内容)
|
|
|
_, itemList, err := evaluationItemRepo.Find(map[string]interface{}{"evaluationProjectIds": projectIds, "node_type": domain.LinkNodeSelfAssessment, "evaluatorId": param.UserId})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
// 填写值
|
|
|
_, valueList, err := itemValueRepo.Find(map[string]interface{}{"summaryEvaluationIdList": ids})
|
|
|
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())
|
|
|
}
|
|
|
|
|
|
for i := range valueList {
|
|
|
key := fmt.Sprintf("%d-%d", valueList[i].SummaryEvaluationId, valueList[i].EvaluationItemId)
|
|
|
valueMap[key] = valueList[i]
|
|
|
}
|
|
|
|
|
|
for i := range itemList {
|
|
|
item := itemList[i]
|
|
|
key := fmt.Sprintf("k%d", i)
|
|
|
name := fmt.Sprintf("%s-%s", item.Category, item.Name)
|
|
|
if _, ok := uniqueColumnsMap[name]; !ok {
|
|
|
changeableHeader = append(changeableHeader, adapter.TableHeader{Key: key, Name: name})
|
|
|
uniqueColumnsMap[name] = key
|
|
|
}
|
|
|
|
|
|
if pList, ok := itemMap[item.EvaluationProjectId]; !ok {
|
|
|
pList = make([]*domain.EvaluationItemUsed, 0)
|
|
|
itemMap[item.EvaluationProjectId] = pList
|
|
|
} else {
|
|
|
pList = append(pList, item)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
now := time.Now().Local() // 当前时间
|
|
|
var rowMap map[string]interface{}
|
|
|
for i := range list {
|
|
|
v := list[i]
|
|
|
if rm, ok := changeableRowMap[v.TargetUser.UserId]; ok {
|
|
|
rowMap = rm
|
|
|
} else {
|
|
|
rowMap = map[string]interface{}{}
|
|
|
changeableRowMap[v.TargetUser.UserId] = rowMap
|
|
|
}
|
|
|
|
|
|
endTime := v.EndTime.Local()
|
|
|
statusVal := ""
|
|
|
if v.Status == domain.EvaluationCompleted {
|
|
|
statusVal = "已完成"
|
|
|
} else {
|
|
|
if now.After(endTime) {
|
|
|
statusVal = "已逾期"
|
|
|
} else {
|
|
|
statusVal = "待完成"
|
|
|
}
|
|
|
}
|
|
|
rowMap["id"] = v.Id
|
|
|
rowMap["targetUserName"] = v.TargetUser.UserName
|
|
|
rowMap["statusVal"] = statusVal
|
|
|
rowMap["relation"] = "项目组员"
|
|
|
rowMap["endTime"] = endTime.Format("2006-01-02 15:04")
|
|
|
|
|
|
// 当前项目所有评估内容
|
|
|
if pList, ok := itemMap[v.EvaluationProjectId]; ok {
|
|
|
for _, item := range pList {
|
|
|
name := fmt.Sprintf("%s-%s", item.Category, item.Name)
|
|
|
if key, ok := uniqueColumnsMap[name]; ok { // 动态列用name -> key
|
|
|
valueKey := fmt.Sprintf("%d-%d", v.Id, item.Id)
|
|
|
if it, ok := valueMap[valueKey]; ok {
|
|
|
rowMap[key] = it.Score
|
|
|
} else {
|
|
|
rowMap[key] = ""
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
targetList := make([]map[string]interface{}, 0)
|
|
|
for _, v1 := range list {
|
|
|
rowMap := changeableRowMap[v1.TargetUser.UserId]
|
|
|
for _, v2 := range changeableHeader { // 填充部分动态列缺失字段
|
|
|
if _, ok := rowMap[v2.Key]; !ok {
|
|
|
rowMap[v2.Key] = ""
|
|
|
}
|
|
|
}
|
|
|
targetList = append(targetList, rowMap)
|
|
|
}
|
|
|
result := &adapter.SummaryEvaluationAdapter{
|
|
|
TableHeader: changeableHeader,
|
|
|
Total: count,
|
|
|
List: targetList,
|
|
|
}
|
|
|
return result, nil
|
|
|
}
|
|
|
|
|
|
// GetEvaluation360 获取360综评详情(登录人作为评估人,评估内容)
|
|
|
func (srv *SummaryEvaluationService) GetEvaluation360(param *command.QueryEvaluation360) (*adapter.EvaluationInfoAdapter, error) {
|
|
|
transactionContext, err := factory.ValidateStartTransaction(param)
|
|
|
if err != nil {
|
...
|
...
|
@@ -24,12 +186,26 @@ func (srv *SummaryEvaluationService) GetEvaluation360(param *command.QueryEvalua |
|
|
evaluationItemRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
|
|
|
sEvaluation, err := evaluationRepo.FindOne(map[string]interface{}{"id": param.SummaryEvaluationId})
|
|
|
//sEvaluation, err := evaluationRepo.FindOne(map[string]interface{}{"id": param.SummaryEvaluationId})
|
|
|
//if err != nil {
|
|
|
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
//}
|
|
|
_, evaluations, err := evaluationRepo.Find(map[string]interface{}{
|
|
|
"limit": 1,
|
|
|
"companyId": param.CompanyId,
|
|
|
"cycleId": param.CycleId,
|
|
|
"targetUserId": param.TargetUserId,
|
|
|
"types": domain.Evaluation360},
|
|
|
)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if len(evaluations) == 0 {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, "数据不存在")
|
|
|
}
|
|
|
sEvaluation := evaluations[0]
|
|
|
|
|
|
// 自评评估内容(自评模板、筛选项目评估人)
|
|
|
// 360评估内容(自评模板、筛选项目评估人)
|
|
|
_, itemList, err := evaluationItemRepo.Find(map[string]interface{}{
|
|
|
"evaluationProjectId": sEvaluation.EvaluationProjectId,
|
|
|
"nodeType": domain.LinkNodeSelfAssessment,
|
...
|
...
|
@@ -67,6 +243,98 @@ func (srv *SummaryEvaluationService) GetEvaluation360(param *command.QueryEvalua |
|
|
return &result, nil
|
|
|
}
|
|
|
|
|
|
// GetEvaluation360All 获取360综评详情-上级综评(所有的评估人,评估内容)
|
|
|
func (srv *SummaryEvaluationService) GetEvaluation360All(param *command.QueryEvaluation360) (*adapter.EvaluationInfoAdapter, error) {
|
|
|
transactionContext, err := factory.ValidateStartTransaction(param)
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
defer func() {
|
|
|
_ = transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
|
|
|
userRepo := factory.CreateUserRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
evaluationItemRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
_, evaluations, err := evaluationRepo.Find(map[string]interface{}{
|
|
|
"limit": 1,
|
|
|
"companyId": param.CompanyId,
|
|
|
"cycleId": param.CycleId,
|
|
|
"targetUserId": param.TargetUserId,
|
|
|
"types": domain.Evaluation360},
|
|
|
)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if len(evaluations) == 0 {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, "数据不存在")
|
|
|
}
|
|
|
sEvaluation := evaluations[0]
|
|
|
|
|
|
// 360评估内容(自评模板)
|
|
|
_, itemList, err := evaluationItemRepo.Find(map[string]interface{}{
|
|
|
"evaluationProjectId": sEvaluation.EvaluationProjectId,
|
|
|
"nodeType": domain.LinkNodeSelfAssessment,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
// 评估内容对应的分数
|
|
|
_, itemValues, err := itemValueRepo.Find(map[string]interface{}{"summaryEvaluationId": sEvaluation.Id})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
// 评估人ID -> User
|
|
|
evaluatorMap := map[int]*domain.User{}
|
|
|
evaluatorIds := make([]int, 0)
|
|
|
filterItemList := make([]*domain.EvaluationItemUsed, 0) // 筛选有评估人的评估内容
|
|
|
for i := range itemList {
|
|
|
if itemList[i].EvaluatorId > 0 {
|
|
|
filterItemList = append(filterItemList, itemList[i])
|
|
|
evaluatorIds = append(evaluatorIds, itemList[i].EvaluatorId)
|
|
|
}
|
|
|
}
|
|
|
if len(evaluatorIds) > 0 {
|
|
|
_, users, err := userRepo.Find(map[string]interface{}{"ids": evaluatorIds})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
for i := range users {
|
|
|
evaluatorMap[int(users[i].Id)] = users[i]
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
itemValuesAdapter := srv.buildSummaryItemValue(filterItemList, itemValues)
|
|
|
for i := range itemValuesAdapter { // 评估人名称赋值
|
|
|
if user, ok := evaluatorMap[itemValuesAdapter[i].EvaluatorId]; ok {
|
|
|
itemValuesAdapter[i].EvaluatorName = user.Name
|
|
|
}
|
|
|
}
|
|
|
|
|
|
result := adapter.EvaluationInfoAdapter{
|
|
|
SummaryEvaluationId: sEvaluation.Id,
|
|
|
CycleId: int(sEvaluation.CycleId),
|
|
|
CycleName: sEvaluation.CycleName,
|
|
|
EvaluationProjectId: sEvaluation.EvaluationProjectId,
|
|
|
EvaluationProjectName: sEvaluation.EvaluationProjectName,
|
|
|
LinkNodeId: sEvaluation.NodeId,
|
|
|
BeginTime: sEvaluation.BeginTime.Format("2006-01-02 15:04:05"),
|
|
|
EndTime: sEvaluation.EndTime.Format("2006-01-02 15:04:05"),
|
|
|
TargetUserId: sEvaluation.TargetUser.UserId,
|
|
|
TargetUserName: sEvaluation.TargetUser.UserName,
|
|
|
Status: string(sEvaluation.Status),
|
|
|
EvaluationItems: itemValuesAdapter,
|
|
|
}
|
|
|
return &result, nil
|
|
|
}
|
|
|
|
|
|
// EditEvaluation360 编辑提交360综评
|
|
|
func (srv *SummaryEvaluationService) EditEvaluation360(param *command.EditEvaluationValue) (map[string][]adapter.EvaluationItemAdapter, error) {
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
...
|
...
|
@@ -166,6 +434,162 @@ func (srv *SummaryEvaluationService) EditEvaluation360(param *command.EditEvalua |
|
|
}, nil
|
|
|
}
|
|
|
|
|
|
// EvaluationHRBPList 获取人资综评列表
|
|
|
func (srv *SummaryEvaluationService) EvaluationHRBPList(param *command.QueryEvaluationHRList) (map[string]interface{}, error) {
|
|
|
transactionContext, err := factory.ValidateStartTransaction(param)
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
defer func() {
|
|
|
_ = transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
|
|
|
// 必须是HRBP权限的人才能编辑操作
|
|
|
hrbp, err := service.GetHRBP(transactionContext, param.CompanyId, param.UserId)
|
|
|
if hrbp != 1 {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限")
|
|
|
}
|
|
|
|
|
|
evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
staffAssessDaoRepo := dao.NewStaffAssessDao(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
userRepo := factory.CreateUserRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
positionRepo := factory.CreatePositionRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
var searchTargetName string
|
|
|
if len(param.SearchName) > 0 {
|
|
|
searchTargetName = "%" + param.SearchName + "%"
|
|
|
} else {
|
|
|
searchTargetName = ""
|
|
|
}
|
|
|
limit := param.PageSize
|
|
|
offset := limit * (param.PageNumber - 1)
|
|
|
if offset < 0 {
|
|
|
offset = 0
|
|
|
}
|
|
|
count, list, err := evaluationRepo.Find(map[string]interface{}{
|
|
|
"companyId": param.CompanyId,
|
|
|
"cycleId": param.CycleId,
|
|
|
"executorId": -1,
|
|
|
"types": domain.EvaluationHrbp,
|
|
|
"targetUserName": searchTargetName,
|
|
|
"limit": limit,
|
|
|
"offset": offset,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
userIds := make([]int, 0)
|
|
|
positionIds := make([]int, 0)
|
|
|
projectIds := make([]int, 0)
|
|
|
projectCountMap := map[string]int{} // 自评逾期数量
|
|
|
userMap := map[int64]*domain.User{} // 用户
|
|
|
positionMap := map[int64]*domain.Position{} // 职位
|
|
|
|
|
|
for i := range list {
|
|
|
it := list[i]
|
|
|
userIds = append(userIds, it.TargetUser.UserId)
|
|
|
projectIds = append(projectIds, list[i].EvaluationProjectId)
|
|
|
}
|
|
|
_, users, err := userRepo.Find(map[string]interface{}{"ids": userIds, "companyId": param.CompanyId})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
for i := range users {
|
|
|
userMap[users[i].Id] = users[i]
|
|
|
for _, pid := range users[i].PositionId {
|
|
|
positionIds = append(positionIds, pid)
|
|
|
}
|
|
|
}
|
|
|
_, positions, err := positionRepo.Find(map[string]interface{}{"ids": positionIds, "companyId": param.CompanyId})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
for i := range positions {
|
|
|
positionMap[positions[i].Id] = positions[i]
|
|
|
}
|
|
|
|
|
|
if len(projectIds) > 0 {
|
|
|
targetCount, err := staffAssessDaoRepo.CountUncompletedSelfAssess(param.CompanyId, projectIds)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
for i := range targetCount {
|
|
|
key := fmt.Sprintf("%d-%d", targetCount[i].EvaluationProjectId, targetCount[i].TargetUserId)
|
|
|
projectCountMap[key] = targetCount[i].Cnt
|
|
|
}
|
|
|
}
|
|
|
|
|
|
now := time.Now().Local() // 当前时间
|
|
|
resultList := make([]*adapter.SummaryEvaluationHRBPAdapter, 0)
|
|
|
for i := range list {
|
|
|
v := list[i]
|
|
|
endTime := v.EndTime.Local()
|
|
|
// 状态
|
|
|
statusVal := ""
|
|
|
if v.Status == domain.EvaluationCompleted {
|
|
|
statusVal = "已完成"
|
|
|
} else {
|
|
|
if now.After(endTime) {
|
|
|
statusVal = "已逾期"
|
|
|
} else {
|
|
|
statusVal = "待完成"
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 部门拼接
|
|
|
var departmentBuild strings.Builder
|
|
|
departmentBuild.WriteString("")
|
|
|
for i2 := range v.TargetDepartment {
|
|
|
departmentBuild.WriteString(v.TargetDepartment[i2].DepartmentName)
|
|
|
if i2 != len(v.TargetDepartment)-1 {
|
|
|
departmentBuild.WriteString(",")
|
|
|
}
|
|
|
}
|
|
|
// 入职时间
|
|
|
entryTime := ""
|
|
|
// 职位拼接
|
|
|
var positionBuild strings.Builder
|
|
|
positionBuild.WriteString("")
|
|
|
if user, ok := userMap[int64(v.TargetUser.UserId)]; ok {
|
|
|
for i2 := range user.PositionId {
|
|
|
if position, ok := positionMap[int64(user.PositionId[i2])]; ok {
|
|
|
positionBuild.WriteString(position.Name)
|
|
|
if i2 != len(user.PositionId)-1 {
|
|
|
departmentBuild.WriteString(",")
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
entryTime = user.EntryTime
|
|
|
}
|
|
|
|
|
|
// 自评逾期数量
|
|
|
overdueCount := 0
|
|
|
key := fmt.Sprintf("%d-%d", v.EvaluationProjectId, v.TargetUser.UserId)
|
|
|
if cnt, ok := projectCountMap[key]; ok {
|
|
|
overdueCount = cnt
|
|
|
}
|
|
|
|
|
|
result := &adapter.SummaryEvaluationHRBPAdapter{
|
|
|
Id: v.Id,
|
|
|
TargetUserId: v.TargetUser.UserId,
|
|
|
TargetUserName: v.TargetUser.UserName,
|
|
|
Department: departmentBuild.String(),
|
|
|
Position: positionBuild.String(),
|
|
|
DutyTime: entryTime,
|
|
|
Status: statusVal,
|
|
|
EndTime: endTime.Format("2006-01-02 15:04"),
|
|
|
OverdueCount: overdueCount,
|
|
|
}
|
|
|
resultList = append(resultList, result)
|
|
|
}
|
|
|
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
return tool_funs.SimpleWrapGridMap(int64(count), resultList), nil
|
|
|
}
|
|
|
|
|
|
// GetEvaluationHRBP 获取人资综评详情
|
|
|
func (srv *SummaryEvaluationService) GetEvaluationHRBP(param *command.QueryEvaluationHRBP) (*adapter.EvaluationInfoAdapter, error) {
|
|
|
transactionContext, err := factory.ValidateStartTransaction(param)
|
...
|
...
|
@@ -180,10 +604,21 @@ func (srv *SummaryEvaluationService) GetEvaluationHRBP(param *command.QueryEvalu |
|
|
evaluationItemRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
|
|
|
sEvaluation, err := evaluationRepo.FindOne(map[string]interface{}{"id": param.SummaryEvaluationId})
|
|
|
_, evaluations, err := evaluationRepo.Find(map[string]interface{}{
|
|
|
"limit": 1,
|
|
|
"companyId": param.CompanyId,
|
|
|
"cycleId": param.CycleId,
|
|
|
"targetUserId": param.TargetUserId,
|
|
|
"types": domain.EvaluationHrbp},
|
|
|
)
|
|
|
// sEvaluation, err := evaluationRepo.FindOne(map[string]interface{}{"id": param.SummaryEvaluationId})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if len(evaluations) == 0 {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, "数据不存在")
|
|
|
}
|
|
|
sEvaluation := evaluations[0]
|
|
|
|
|
|
// 自评评估内容(自评模板、筛选项目评估人)
|
|
|
_, itemList, err := evaluationItemRepo.Find(map[string]interface{}{
|
...
|
...
|
|