...
|
...
|
@@ -1091,16 +1091,26 @@ func (srv StaffAssessServeice) ListExecutorInviteAssess(param *query.ListInviteU |
|
|
assessRepo := factory.CreateStaffAssessRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
assessTaskRepo := factory.CreateStaffAssessTaskRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
|
|
|
// assessTaskkRepo := factory.CreateStaffAssessTaskRepository(map[string]interface{}{
|
|
|
// "transactionContext": transactionContext,
|
|
|
// })
|
|
|
//获取 executorId 对应的360评估任务 用户
|
|
|
cnt, assessList, err := assessRepo.Find(map[string]interface{}{
|
|
|
condition := map[string]interface{}{
|
|
|
"staffAssessTaskId": param.AssessTaskId,
|
|
|
"executorId": param.ExecutorId,
|
|
|
"typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},
|
|
|
})
|
|
|
"limit": 20,
|
|
|
}
|
|
|
if param.PageSize > 0 {
|
|
|
condition["limit"] = param.PageSize
|
|
|
}
|
|
|
offset := (param.PageNumber - 1) * param.PageSize
|
|
|
if offset > 0 {
|
|
|
condition["offset"] = offset
|
|
|
}
|
|
|
|
|
|
cnt, assessList, err := assessRepo.Find(condition)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
...
|
...
|
@@ -1125,13 +1135,51 @@ func (srv StaffAssessServeice) ListExecutorInviteAssess(param *query.ListInviteU |
|
|
Name: name,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
assessContentRepo := factory.CreateStaffAssessContentRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
// 获取已经填报的内容
|
|
|
changeableRows := map[int]map[string]string{}
|
|
|
for _, v := range assessList {
|
|
|
_, contentList, err := assessContentRepo.Find(map[string]interface{}{
|
|
|
"staffAssessId": v.Id,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取评估内容"+err.Error())
|
|
|
}
|
|
|
row := map[string]string{}
|
|
|
for _, vv := range contentList {
|
|
|
name := fmt.Sprintf("%s-%s", vv.Category, vv.Name)
|
|
|
if kk, ok := keyMap[name]; ok {
|
|
|
row[kk] = vv.Value
|
|
|
}
|
|
|
}
|
|
|
changeableRows[v.TargetUser.UserId] = row
|
|
|
}
|
|
|
|
|
|
//获取360邀请评估完成情况
|
|
|
//我评估别人,被邀请评估
|
|
|
cnnt, _, err := assessRepo.Find(map[string]interface{}{
|
|
|
"staffAssessTaskId": param.AssessTaskId,
|
|
|
"executorId": param.ExecutorId,
|
|
|
"typesList": []string{string(domain.AssessInviteDiffSuper), string(domain.AssessInviteSameSuper)},
|
|
|
"status": domain.StaffAssessUncompleted,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取个人的评估环节"+err.Error())
|
|
|
}
|
|
|
|
|
|
assessTaskData, err := assessTaskRepo.FindOne(map[string]interface{}{
|
|
|
"id": param.AssessTaskId,
|
|
|
})
|
|
|
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())
|
|
|
}
|
|
|
|
|
|
//TODO 评估填写数据行转列
|
|
|
//评估填写数据行转列
|
|
|
tableHeader := []adapter.ListTableHeader{
|
|
|
{Key: "userName", Name: "姓名"},
|
|
|
{Key: "status", Name: "状态"},
|
...
|
...
|
@@ -1143,20 +1191,35 @@ func (srv StaffAssessServeice) ListExecutorInviteAssess(param *query.ListInviteU |
|
|
for _, v := range assessList {
|
|
|
m := map[string]string{
|
|
|
"userName": v.TargetUser.UserName,
|
|
|
"userId": strconv.Itoa(v.TargetUser.UserId),
|
|
|
"status": string(v.Status),
|
|
|
"types": string(v.Types),
|
|
|
"endTime": v.EndTime.Local().Format("2006-01-02 15:04:05"),
|
|
|
"assessId": strconv.Itoa(v.Id),
|
|
|
}
|
|
|
if row, ok := changeableRows[v.TargetUser.UserId]; ok {
|
|
|
for k, v := range row {
|
|
|
m[k] = v
|
|
|
}
|
|
|
} else {
|
|
|
for _, v := range changeableHeader {
|
|
|
m[v.Key] = ""
|
|
|
}
|
|
|
}
|
|
|
listData = append(listData, m)
|
|
|
}
|
|
|
_ = tableHeader
|
|
|
|
|
|
result := adapter.ListInviteUserAssessResp{
|
|
|
TableHeader: tableHeader,
|
|
|
List: listData,
|
|
|
Total: cnt,
|
|
|
}
|
|
|
for _, v := range assessTaskData.StepList {
|
|
|
if v.LinkNodeType == domain.LinkNodeAllAssessment {
|
|
|
result.LinkNodeId = v.LinkNodeId
|
|
|
result.LinkNodeName = v.LinkNodeName
|
|
|
result.LintNodeDesc = fmt.Sprintf("截止时间 %s 待评估%d人", v.EndTime.Local().Format("2006-01-02 15:04:05"), cnnt)
|
|
|
}
|
|
|
}
|
|
|
return &result, nil
|
|
|
}
|
|
|
|
...
|
...
|
@@ -1251,6 +1314,7 @@ func (srv StaffAssessServeice) ListExecutorSupperAssess(param *query.ListSupperA |
|
|
UserName: v.TargetUser.UserName,
|
|
|
EndTime: v.EndTime.Local().Format("2006-01-02 15:04:05"),
|
|
|
InviteCompleted: 0,
|
|
|
Status: string(v.Status),
|
|
|
InviteTotal: 5,
|
|
|
Department: "",
|
|
|
Position: "",
|
...
|
...
|
|