...
|
...
|
@@ -585,44 +585,39 @@ func (srv StaffAssessServeice) createStaffAssessSupper( |
|
|
userList []*domain.User, userDepartmentMap map[int64][]*domain.Department,
|
|
|
) ([]domain.StaffAssess, error) {
|
|
|
var assessList []domain.StaffAssess
|
|
|
// 获取员工的上级用户
|
|
|
userRepo := factory.CreateUserRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
for _, v := range userList {
|
|
|
departmentList, ok := userDepartmentMap[v.Id]
|
|
|
if !ok {
|
|
|
continue
|
|
|
}
|
|
|
for _, vv2 := range departmentList {
|
|
|
if len(vv2.ChargeUserIds) == 0 {
|
|
|
continue
|
|
|
}
|
|
|
//获取部门的主管
|
|
|
_, chargeUserList, err := userRepo.Find(map[string]interface{}{
|
|
|
"ids": vv2.ChargeUserIds,
|
|
|
"limit": 40,
|
|
|
})
|
|
|
//获取上级
|
|
|
chargeUserList, err := srv.getStaffSuper(transactionContext, *v)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.ARG_ERROR, "获取部门主管信息"+err.Error())
|
|
|
return nil, err
|
|
|
}
|
|
|
for _, vvv3 := range chargeUserList {
|
|
|
assessTemp.TargetDepartment = []domain.StaffDepartment{
|
|
|
{DepartmentId: int(vv2.Id), DepartmentName: vv2.Name},
|
|
|
if len(chargeUserList) == 0 {
|
|
|
continue
|
|
|
}
|
|
|
for _, v2 := range chargeUserList {
|
|
|
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,
|
|
|
UserId: int(v2.Id),
|
|
|
Account: v2.Account,
|
|
|
UserName: v2.Name,
|
|
|
}
|
|
|
targetDepartment := []domain.StaffDepartment{}
|
|
|
if departmentList, ok := userDepartmentMap[v.Id]; ok {
|
|
|
for _, department := range departmentList {
|
|
|
targetDepartment = append(targetDepartment, domain.StaffDepartment{
|
|
|
DepartmentId: int(department.Id),
|
|
|
DepartmentName: department.Name,
|
|
|
})
|
|
|
}
|
|
|
assessList = append(assessList, assessTemp)
|
|
|
}
|
|
|
assessTemp.TargetDepartment = targetDepartment
|
|
|
assessList = append(assessList, assessTemp)
|
|
|
}
|
|
|
|
|
|
}
|
|
|
return assessList, nil
|
|
|
}
|
...
|
...
|
@@ -1792,6 +1787,7 @@ func (srv StaffAssessServeice) getStaffSuper(transactionContext application.Tran |
|
|
}
|
|
|
}
|
|
|
if len(departmemtList) == 0 {
|
|
|
//找不到员工的部门
|
|
|
companyRepo := factory.CreateCompanyRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
...
|
...
|
|