...
|
...
|
@@ -164,10 +164,12 @@ func (srv StaffAssessServeice) AssessTaskDesc(param *query.AssessTaskDescQuery) |
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error())
|
|
|
}
|
|
|
if len(assessInviteData) > 0 {
|
|
|
stepItem.Status = string(domain.StaffAssessCompleted)
|
|
|
}
|
|
|
//待邀请人数,为5人减去已邀请的人数。若邀请人数已等于或大于5人,则只显示截止日期即可
|
|
|
if len(assessInviteData) > 5 {
|
|
|
stepItem.Desc = fmt.Sprintf("截止日期:%s", stepItem.EndTime)
|
|
|
stepItem.Status = string(domain.StaffAssessCompleted)
|
|
|
} else {
|
|
|
stepItem.Desc = fmt.Sprintf("截止日期:%s 待邀请%d人", stepItem.EndTime, 5-len(assessInviteData))
|
|
|
stepItem.Status = string(domain.StaffAssessUncompleted)
|
...
|
...
|
@@ -345,7 +347,7 @@ func (srv StaffAssessServeice) AssessSelfList(param *query.AssessSelfListQuery) |
|
|
|
|
|
// 根据项目评估的配置,创建员工的评估任务
|
|
|
func (srv StaffAssessServeice) CreateStaffAssessTask(transactionContext application.TransactionContext, param *command.CreateStaffAssessTask) (map[string]interface{}, error) {
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
// transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
// if err != nil {
|
|
|
// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
// }
|
...
|
...
|
@@ -1300,6 +1302,19 @@ func (srv StaffAssessServeice) ListExecutorInviteAssess(param *query.ListInviteU |
|
|
"endTime": v.EndTime.Local().Format("2006-01-02 15:04:05"),
|
|
|
"assessId": strconv.Itoa(v.Id),
|
|
|
}
|
|
|
switch v.Status {
|
|
|
case domain.StaffAssessCompleted:
|
|
|
m["status"] = "已经完成"
|
|
|
case domain.StaffAssessUncompleted:
|
|
|
m["status"] = "未完成"
|
|
|
}
|
|
|
|
|
|
switch v.Types {
|
|
|
case domain.AssessInviteDiffSuper:
|
|
|
m["typs"] = "不同上级同事"
|
|
|
case domain.AssessInviteSameSuper:
|
|
|
m["types"] = "相同上级同事"
|
|
|
}
|
|
|
if row, ok := changeableRows[v.TargetUser.UserId]; ok {
|
|
|
for k, v := range row {
|
|
|
m[k] = v
|
...
|
...
|
@@ -1405,7 +1420,25 @@ func (srv StaffAssessServeice) ListExecutorSupperAssess(param *query.ListSupperA |
|
|
log.Logger.Error("获取员工邀请的人完成情况" + err.Error())
|
|
|
}
|
|
|
}
|
|
|
|
|
|
assessTaskRepo := factory.CreateStaffAssessTaskRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
assessTaskData, err := assessTaskRepo.FindOne(map[string]interface{}{
|
|
|
"id": param.AssessTaskId,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取评估任务"+err.Error())
|
|
|
}
|
|
|
//我评估别人,被邀请评估
|
|
|
cnnt, _, err := assessRepo.Find(map[string]interface{}{
|
|
|
"staffAssessTaskId": param.AssessTaskId,
|
|
|
"executorId": param.ExecutorId,
|
|
|
"typesList": []string{string(domain.AssessSuper)},
|
|
|
"status": string(domain.StaffAssessUncompleted),
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error())
|
|
|
}
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
...
|
...
|
@@ -1450,7 +1483,18 @@ func (srv StaffAssessServeice) ListExecutorSupperAssess(param *query.ListSupperA |
|
|
}
|
|
|
resultList = append(resultList, item)
|
|
|
}
|
|
|
return tool_funs.SimpleWrapGridMap(int64(cnt), resultList), nil
|
|
|
result := tool_funs.SimpleWrapGridMap(int64(cnt), resultList)
|
|
|
result["linkNodeName"] = ""
|
|
|
result["linkNodeId"] = ""
|
|
|
result["lintNodeDesc"] = ""
|
|
|
for _, v := range assessTaskData.StepList {
|
|
|
if v.LinkNodeType == domain.LinkNodeSuperiorAssessment {
|
|
|
result["linkNodeName"] = v.LinkNodeName
|
|
|
result["linkNodeId"] = fmt.Sprintf("%d", v.LinkNodeId)
|
|
|
result["lintNodeDesc"] = fmt.Sprintf("截止时间 %s 待评估 %d 人", v.EndTime.Local().Format("2006-01-02 15:04:05"), cnnt)
|
|
|
}
|
|
|
}
|
|
|
return result, nil
|
|
|
}
|
|
|
|
|
|
// 根据staffAssessId 获取评估的填写信息
|
...
|
...
|
@@ -1665,6 +1709,7 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma |
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//保存信息
|
|
|
for i := range assessContentList {
|
|
|
_, err = assessContentRepo.Save(assessContentList[i])
|
...
|
...
|
@@ -1672,6 +1717,12 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma |
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存评估填写内容"+err.Error())
|
|
|
}
|
|
|
}
|
|
|
assessData.Status = domain.StaffAssessCompleted
|
|
|
assessData.UpdatedAt = time.Now()
|
|
|
_, err = assessReps.Save(assessData)
|
|
|
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())
|
|
|
}
|
...
|
...
|
@@ -1700,6 +1751,7 @@ func (srv StaffAssessServeice) ListTargetUserAssess(param *query.ListTargetUserA |
|
|
"assessTaskId": param.AssessTaskId,
|
|
|
"companyId": param.CompanyId,
|
|
|
"targetUserId": param.TargetUserId,
|
|
|
"typesList": param.Types,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的评估"+err.Error())
|
...
|
...
|
|