...
|
...
|
@@ -4,6 +4,7 @@ import ( |
|
|
"fmt"
|
|
|
"sort"
|
|
|
"strconv"
|
|
|
"time"
|
|
|
|
|
|
"github.com/linmadan/egglib-go/core/application"
|
|
|
"github.com/linmadan/egglib-go/utils/tool_funs"
|
...
|
...
|
@@ -924,63 +925,63 @@ func (srv StaffAssessServeice) SelectAssessInviteUserV2(param *query.SelectAsses |
|
|
}
|
|
|
|
|
|
// 获取未完成的员工评估内容
|
|
|
// func (srv StaffAssessServeice) getAssessInfoUncompletedV2(transactionContext application.TransactionContext,
|
|
|
// assess *domain.StaffAssess) ([]*domain.StaffAssessContent, error) {
|
|
|
// evaluationItemRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{
|
|
|
// "transactionContext": transactionContext,
|
|
|
// })
|
|
|
// var evaluationItemList []*domain.EvaluationItemUsed
|
|
|
// var err error
|
|
|
// _, evaluationItemList, err = evaluationItemRepo.Find(map[string]interface{}{
|
|
|
// "evaluationProjectId": assess.EvaluationProjectId,
|
|
|
// "nodeId": assess.LinkNodeId,
|
|
|
// })
|
|
|
// if err != nil {
|
|
|
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取项目填写内容"+err.Error())
|
|
|
// }
|
|
|
// if len(evaluationItemList) == 0 {
|
|
|
// //如果当前节点没有评估内容,就去 使用自评节点的评估内容
|
|
|
// _, evaluationItemList, err = evaluationItemRepo.Find(map[string]interface{}{
|
|
|
// "evaluationProjectId": assess.EvaluationProjectId,
|
|
|
// "nodeType": domain.LinkNodeSelfAssessment,
|
|
|
// })
|
|
|
// if err != nil {
|
|
|
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取自评项目填写内容"+err.Error())
|
|
|
// }
|
|
|
// }
|
|
|
// var contentList []*domain.StaffAssessContent
|
|
|
// nowTime := time.Now()
|
|
|
// for i, v := range evaluationItemList {
|
|
|
// 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,
|
|
|
// Weight: v.Weight,
|
|
|
// Required: v.Required,
|
|
|
// UpdatedAt: nowTime,
|
|
|
// DeletedAt: nil,
|
|
|
// Rule: v.Rule,
|
|
|
// }
|
|
|
// var remarks []domain.AssessContemtRemark
|
|
|
// for _, vv := range v.EntryItems {
|
|
|
// ritem := domain.AssessContemtRemark{
|
|
|
// Title: vv.Title,
|
|
|
// HintText: vv.HintText,
|
|
|
// Definition: vv.Definition,
|
|
|
// RemarkText: "",
|
|
|
// }
|
|
|
// remarks = append(remarks, ritem)
|
|
|
// }
|
|
|
// item.Remark = remarks
|
|
|
// contentList = append(contentList, item)
|
|
|
// }
|
|
|
// return contentList, nil
|
|
|
// } |
|
|
func (srv StaffAssessServeice) getAssessInfoUncompletedV2(transactionContext application.TransactionContext,
|
|
|
assess *domain.StaffAssess) ([]*domain.StaffAssessContent, error) {
|
|
|
evaluationItemRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
var evaluationItemList []*domain.EvaluationItemUsed
|
|
|
var err error
|
|
|
_, evaluationItemList, err = evaluationItemRepo.Find(map[string]interface{}{
|
|
|
"evaluationProjectId": assess.EvaluationProjectId,
|
|
|
"nodeId": assess.LinkNodeId,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取项目填写内容"+err.Error())
|
|
|
}
|
|
|
if len(evaluationItemList) == 0 {
|
|
|
//如果当前节点没有评估内容,就去 使用自评节点的评估内容
|
|
|
_, evaluationItemList, err = evaluationItemRepo.Find(map[string]interface{}{
|
|
|
"evaluationProjectId": assess.EvaluationProjectId,
|
|
|
"nodeType": domain.LinkNodeSelfAssessment,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取自评项目填写内容"+err.Error())
|
|
|
}
|
|
|
}
|
|
|
var contentList []*domain.StaffAssessContent
|
|
|
nowTime := time.Now()
|
|
|
for i, v := range evaluationItemList {
|
|
|
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,
|
|
|
Weight: v.Weight,
|
|
|
Required: v.Required,
|
|
|
UpdatedAt: nowTime,
|
|
|
DeletedAt: nil,
|
|
|
Rule: v.Rule,
|
|
|
}
|
|
|
var remarks []domain.AssessContemtRemark
|
|
|
for _, vv := range v.EntryItems {
|
|
|
ritem := domain.AssessContemtRemark{
|
|
|
Title: vv.Title,
|
|
|
HintText: vv.HintText,
|
|
|
Definition: vv.Definition,
|
|
|
RemarkText: "",
|
|
|
}
|
|
|
remarks = append(remarks, ritem)
|
|
|
}
|
|
|
item.Remark = remarks
|
|
|
contentList = append(contentList, item)
|
|
|
}
|
|
|
return contentList, nil
|
|
|
} |
...
|
...
|
|