...
|
...
|
@@ -660,6 +660,9 @@ func (srv StaffAssessServeice) SaveAssessInviteUser(param *command.SaveAssessInv |
|
|
targetUser, err := userRepo.FindOne(map[string]interface{}{
|
|
|
"id": param.TargetUserId,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.ARG_ERROR, "获取被评估员工"+err.Error())
|
|
|
}
|
|
|
//被评估人的部门
|
|
|
var targetUserDepartment []domain.StaffDepartment
|
|
|
if len(targetUser.DepartmentId) > 0 {
|
...
|
...
|
@@ -676,7 +679,7 @@ func (srv StaffAssessServeice) SaveAssessInviteUser(param *command.SaveAssessInv |
|
|
})
|
|
|
}
|
|
|
}
|
|
|
//相同上级的员工
|
|
|
//邀请的相同上级的员工
|
|
|
var inviteSameSuper []domain.StaffDesc
|
|
|
if len(inviteSameSuperId) > 0 {
|
|
|
_, userList, err := userRepo.Find(map[string]interface{}{
|
...
|
...
|
@@ -693,22 +696,27 @@ func (srv StaffAssessServeice) SaveAssessInviteUser(param *command.SaveAssessInv |
|
|
})
|
|
|
}
|
|
|
}
|
|
|
//邀请的不同上级的员工
|
|
|
var inviteDiffSuper []domain.StaffDesc
|
|
|
if len(InviteDiffSuperId) > 0 {
|
|
|
_, userList, err := userRepo.Find(map[string]interface{}{
|
|
|
"ids": inviteSameSuperId,
|
|
|
"ids": InviteDiffSuperId,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.ARG_ERROR, "获取用户信息"+err.Error())
|
|
|
}
|
|
|
for _, v := range userList {
|
|
|
inviteSameSuper = append(inviteSameSuper, domain.StaffDesc{
|
|
|
inviteDiffSuper = append(inviteDiffSuper, domain.StaffDesc{
|
|
|
UserId: int(v.Id),
|
|
|
UserName: v.Name,
|
|
|
Account: v.Account,
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
_ = assessReps
|
|
|
_ = inviteSameSuper
|
|
|
_ = inviteDiffSuper
|
|
|
_ = targetUserDepartment
|
|
|
// _, assessList, err := assessReps.Find(map[string]interface{}{
|
|
|
// "typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},
|
|
|
// "staffAssessTaskId": param.AssessTaskId,
|
...
|
...
|
@@ -717,6 +725,7 @@ func (srv StaffAssessServeice) SaveAssessInviteUser(param *command.SaveAssessInv |
|
|
// if err != nil {
|
|
|
// return nil, application.ThrowError(application.ARG_ERROR, "获取个人评估任务"+err.Error())
|
|
|
// }
|
|
|
// TODO
|
|
|
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
...
|
...
|
@@ -745,3 +754,94 @@ func (srv StaffAssessServeice) SaveAssessInviteUser(param *command.SaveAssessInv |
|
|
// }
|
|
|
return &result, nil
|
|
|
}
|
|
|
|
|
|
// 获取员工自评的评估内容详情
|
|
|
func (srv StaffAssessServeice) GetAssessSelfInfo(param *query.AssessInfoQuery) (*adapter.AssessInfoResp, 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()
|
|
|
}()
|
|
|
assessReps := factory.CreateStaffAssessRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
|
|
|
//获取员工的评估
|
|
|
_, assessList, err := assessReps.Find(map[string]interface{}{
|
|
|
"companyId": param.CompanyId,
|
|
|
"staffAssessTaskId": param.AssessTaskId,
|
|
|
"targetUserId": param.TargetUserId,
|
|
|
"typesList": []string{string(domain.AssessSelf)},
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的评估"+err.Error())
|
|
|
}
|
|
|
if len(assessList) == 0 {
|
|
|
return &adapter.AssessInfoResp{}, nil
|
|
|
}
|
|
|
assessData := assessList[0]
|
|
|
projectRepo := factory.CreateEvaluationProjectRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
projectData, err := projectRepo.FindOne(map[string]interface{}{
|
|
|
"id": assessData.EvaluationProjectId,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取项目评估配置"+err.Error())
|
|
|
}
|
|
|
if projectData.Template == nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "未获取到项目评估配置模板")
|
|
|
}
|
|
|
var selfLinkNode *domain.LinkNode
|
|
|
for _, v := range projectData.Template.LinkNodes {
|
|
|
if v.Type == domain.LinkNodeSelfAssessment {
|
|
|
selfLinkNode = v
|
|
|
break
|
|
|
}
|
|
|
}
|
|
|
if selfLinkNode == nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "未获取到项目评估自评配置")
|
|
|
}
|
|
|
//获取员工评估的填写内容
|
|
|
// assessContentReps := factory.CreateStaffAssessContentRepository(map[string]interface{}{
|
|
|
// "transactionContext": transactionContext,
|
|
|
// })
|
|
|
// _, assessContentList, err := assessContentReps.Find(map[string]interface{}{
|
|
|
// "staffAssessId": assessData.Id,
|
|
|
// })
|
|
|
// 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())
|
|
|
}
|
|
|
|
|
|
result := adapter.AssessInfoResp{
|
|
|
CycleId: assessData.CycleId,
|
|
|
CycleName: assessData.CycleName,
|
|
|
EvaluationProjectId: assessData.EvaluationProjectId,
|
|
|
EvaluationProjectName: assessData.EvaluationProjectName,
|
|
|
BeginTime: assessData.BeginTime.Local().Format("2006-01-02 15:04:05"),
|
|
|
EndTime: assessData.EndTime.Local().Format("2006-01-02 15:04:05"),
|
|
|
Status: string(assessData.Status),
|
|
|
TargetUserId: assessData.TargetUser.UserId,
|
|
|
TargetUserName: assessData.TargetUser.UserName,
|
|
|
AssessContent: nil,
|
|
|
}
|
|
|
assessContent := make([]adapter.AssessContent, 0)
|
|
|
for _, v := range selfLinkNode.NodeContents {
|
|
|
assessContent = append(assessContent, adapter.AssessContent{
|
|
|
Category: v.Category,
|
|
|
Name: v.Name,
|
|
|
PromptTitle: v.PromptTitle,
|
|
|
PromptText: v.PromptText,
|
|
|
})
|
|
|
}
|
|
|
result.AssessContent = assessContent
|
|
|
return &result, nil
|
|
|
} |
...
|
...
|
|