...
|
...
|
@@ -575,7 +575,7 @@ func (srv StaffAssessServeice) GetAssessInviteUser(param *query.GetAssessInviteU |
|
|
_, assessList, err := assessReps.Find(map[string]interface{}{
|
|
|
"typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},
|
|
|
"staffAssessTaskId": param.AssessTaskId,
|
|
|
"targetUserId": param.UsrId,
|
|
|
"targetUserId": param.UserId,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.ARG_ERROR, "获取个人评估任务"+err.Error())
|
...
|
...
|
@@ -585,7 +585,9 @@ func (srv StaffAssessServeice) GetAssessInviteUser(param *query.GetAssessInviteU |
|
|
}
|
|
|
|
|
|
result := adapter.AssessInviteUserResp{
|
|
|
AssessTaskId: assessTaskData.Id,
|
|
|
AssessTaskId: assessTaskData.Id,
|
|
|
InviteDiffSuper: []domain.StaffDesc{},
|
|
|
InviteSameSuper: []domain.StaffDesc{},
|
|
|
}
|
|
|
for _, v := range assessTaskData.StepList {
|
|
|
if v.LinkNodeType != domain.LinkNodeAllInvite {
|
...
|
...
|
@@ -608,7 +610,7 @@ func (srv StaffAssessServeice) GetAssessInviteUser(param *query.GetAssessInviteU |
|
|
return &result, nil
|
|
|
}
|
|
|
|
|
|
// 获取某个员工360邀请的人员
|
|
|
// 保存某个员工360邀请的人员
|
|
|
func (srv StaffAssessServeice) SaveAssessInviteUser(param *command.SaveAssessInvite) (*adapter.AssessInviteUserResp, error) {
|
|
|
inviteSameSuperId := []int{}
|
|
|
InviteDiffSuperId := []int{}
|
...
|
...
|
@@ -713,19 +715,22 @@ func (srv StaffAssessServeice) SaveAssessInviteUser(param *command.SaveAssessInv |
|
|
})
|
|
|
}
|
|
|
}
|
|
|
_ = assessReps
|
|
|
//获取员工邀请的人
|
|
|
_, assessList, err := assessReps.Find(map[string]interface{}{
|
|
|
"typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},
|
|
|
"staffAssessTaskId": param.AssessTaskId,
|
|
|
"targetUserId": param.TargetUserId,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.ARG_ERROR, "获取员工邀请的人"+err.Error())
|
|
|
}
|
|
|
//比对新旧数据
|
|
|
|
|
|
_ = assessList
|
|
|
_ = targetUser
|
|
|
_ = inviteSameSuper
|
|
|
_ = inviteDiffSuper
|
|
|
_ = targetUserDepartment
|
|
|
// _, assessList, err := assessReps.Find(map[string]interface{}{
|
|
|
// "typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},
|
|
|
// "staffAssessTaskId": param.AssessTaskId,
|
|
|
// "targetUserId": param.TargetUserId,
|
|
|
// })
|
|
|
// 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())
|
...
|
...
|
@@ -770,7 +775,6 @@ func (srv StaffAssessServeice) GetAssessSelfInfo(param *query.AssessInfoQuery) ( |
|
|
assessReps := factory.CreateStaffAssessRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
|
|
|
//获取员工的评估
|
|
|
_, assessList, err := assessReps.Find(map[string]interface{}{
|
|
|
"companyId": param.CompanyId,
|
...
|
...
|
@@ -785,43 +789,32 @@ func (srv StaffAssessServeice) GetAssessSelfInfo(param *query.AssessInfoQuery) ( |
|
|
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
|
|
|
|
|
|
assessContentList := []*domain.StaffAssessContent{}
|
|
|
if assessData.Status == domain.StaffAssessCompleted {
|
|
|
//已完成
|
|
|
assessContentRepo := factory.CreateStaffAssessContentRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
_, assessContentList, err = assessContentRepo.Find(map[string]interface{}{
|
|
|
"staffAssessId": assessData.Id,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取项目填写内容"+err.Error())
|
|
|
}
|
|
|
} else if assessData.Status == domain.StaffAssessUncompleted {
|
|
|
//未完成
|
|
|
assessContentList, err = srv.getAssessSelfInfoUncompleted(transactionContext, assessData)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取项目填写内容"+err.Error())
|
|
|
}
|
|
|
}
|
|
|
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{
|
|
|
AssessId: assessData.Id,
|
|
|
CycleId: assessData.CycleId,
|
|
|
CycleName: assessData.CycleName,
|
|
|
EvaluationProjectId: assessData.EvaluationProjectId,
|
...
|
...
|
@@ -831,18 +824,83 @@ func (srv StaffAssessServeice) GetAssessSelfInfo(param *query.AssessInfoQuery) ( |
|
|
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,
|
|
|
EntryItems: v.EntryItems,
|
|
|
})
|
|
|
AssessContent: assessContentList,
|
|
|
}
|
|
|
result.AssessContent = assessContent
|
|
|
return &result, nil
|
|
|
}
|
|
|
|
|
|
// 获取未完成的员工评估内容
|
|
|
func (srv StaffAssessServeice) getAssessSelfInfoUncompleted(transactionContext application.TransactionContext,
|
|
|
assess *domain.StaffAssess) ([]*domain.StaffAssessContent, error) {
|
|
|
projectRepo := factory.CreateEvaluationProjectRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
projectData, err := projectRepo.FindOne(map[string]interface{}{
|
|
|
"id": assess.EvaluationProjectId,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取项目填写内容"+err.Error())
|
|
|
}
|
|
|
var linkNode *domain.LinkNode
|
|
|
for _, v := range projectData.Template.LinkNodes {
|
|
|
if v.Id == int64(assess.LinkNodeId) {
|
|
|
linkNode = v
|
|
|
break
|
|
|
}
|
|
|
}
|
|
|
if linkNode == nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "未获得评估环节配置"+err.Error())
|
|
|
}
|
|
|
ruleRepo := factory.CreateEvaluationRuleRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
ruleMap := map[string]*domain.EvaluationRule{}
|
|
|
for _, v := range linkNode.NodeContents {
|
|
|
if _, ok := ruleMap[v.RuleId]; ok {
|
|
|
continue
|
|
|
}
|
|
|
rid, _ := strconv.Atoi(v.RuleId)
|
|
|
ruleData, err := ruleRepo.FindOne(map[string]interface{}{
|
|
|
"id": rid,
|
|
|
})
|
|
|
if err == nil {
|
|
|
ruleMap[v.RuleId] = ruleData
|
|
|
}
|
|
|
}
|
|
|
|
|
|
var contentList []*domain.StaffAssessContent
|
|
|
nowTime := time.Now()
|
|
|
for i, v := range linkNode.NodeContents {
|
|
|
item := &domain.StaffAssessContent{
|
|
|
Id: 0,
|
|
|
StaffAssessId: assess.Id,
|
|
|
SortBy: i + 1,
|
|
|
Category: v.Category,
|
|
|
Name: v.Name,
|
|
|
PromptTitle: v.PromptTitle,
|
|
|
PromptText: v.PromptText,
|
|
|
Remark: nil,
|
|
|
Value: "",
|
|
|
ReteResult: "",
|
|
|
CreatedAt: nowTime,
|
|
|
UpdatedAt: nowTime,
|
|
|
DeletedAt: nil,
|
|
|
// Rule: ,
|
|
|
}
|
|
|
if ruleVal, ok := ruleMap[v.RuleId]; ok {
|
|
|
item.Rule = *ruleVal
|
|
|
}
|
|
|
var remarks []domain.AssessContemtRemark
|
|
|
for _, vv := range v.EntryItems {
|
|
|
ritem := domain.AssessContemtRemark{
|
|
|
Title: vv.Title,
|
|
|
HintText: vv.HintText,
|
|
|
RemarkText: "",
|
|
|
}
|
|
|
remarks = append(remarks, ritem)
|
|
|
}
|
|
|
item.Remark = remarks
|
|
|
contentList = append(contentList, item)
|
|
|
}
|
|
|
return contentList, nil
|
|
|
} |
...
|
...
|
|