...
|
...
|
@@ -391,16 +391,20 @@ func (srv StaffAssessServeice) CreateStaffAssessTask(param *command.CreateStaffA |
|
|
assessTaskRepo := factory.CreateStaffAssessTaskRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
_, err = assessTaskRepo.Save(&assessTask)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存评估任务"+err.Error())
|
|
|
}
|
|
|
|
|
|
assessList, err := srv.createStaffAssess(transactionContext, &assessTask)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "生成个人评估项"+err.Error())
|
|
|
}
|
|
|
|
|
|
//评估的参与人
|
|
|
executorIds := []int{}
|
|
|
executorIdMap := map[int]struct{}{} //过滤重复的用户
|
|
|
for _, v := range param.ExecutorId {
|
|
|
if _, ok := executorIdMap[v]; ok {
|
|
|
continue
|
|
|
}
|
|
|
executorIds = append(executorIds, v)
|
|
|
}
|
|
|
assessRepo := factory.CreateStaffAssessRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
...
|
...
|
@@ -411,6 +415,12 @@ func (srv StaffAssessServeice) CreateStaffAssessTask(param *command.CreateStaffA |
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存个人评估项"+err.Error())
|
|
|
}
|
|
|
}
|
|
|
assessTask.ExecutorId = executorIds
|
|
|
_, err = assessTaskRepo.Save(&assessTask)
|
|
|
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())
|
|
|
}
|
...
|
...
|
@@ -550,7 +560,6 @@ func (srv StaffAssessServeice) createStaffAssessSupper( |
|
|
if !ok {
|
|
|
continue
|
|
|
}
|
|
|
targetDepartment := []domain.StaffDepartment{}
|
|
|
for _, vv2 := range departmentList {
|
|
|
if len(vv2.ChargeUserIds) == 0 {
|
|
|
continue
|
...
|
...
|
@@ -564,14 +573,23 @@ func (srv StaffAssessServeice) createStaffAssessSupper( |
|
|
}
|
|
|
for _, vvv3 := range chargeUserList {
|
|
|
assessTemp.TargetDepartment = []domain.StaffDepartment{
|
|
|
domain.StaffDepartment{DepartmentId: int(vv2.Id), DepartmentName: vv2.Name},
|
|
|
{DepartmentId: int(vv2.Id), DepartmentName: vv2.Name},
|
|
|
}
|
|
|
|
|
|
assessTemp.TargetUser = domain.StaffDesc{
|
|
|
UserId: int(v.Id),
|
|
|
Account: v.Account,
|
|
|
UserName: v.Name,
|
|
|
}
|
|
|
assessTemp.Executor = domain.StaffDesc{
|
|
|
UserId: int(vvv3.Id),
|
|
|
Account: vvv3.Account,
|
|
|
UserName: vvv3.Name,
|
|
|
}
|
|
|
assessList = append(assessList, assessTemp)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
return nil, nil
|
|
|
return assessList, nil
|
|
|
}
|
|
|
|
|
|
// 获取某个员工360评估邀请的人员
|
...
|
...
|
|