作者 tangxvhui

员工上级的获取方式

@@ -280,30 +280,31 @@ func (srv StaffAssessServeice) AssessSelfList(param *query.AssessSelfListQuery) @@ -280,30 +280,31 @@ func (srv StaffAssessServeice) AssessSelfList(param *query.AssessSelfListQuery)
280 log.Logger.Error("获取用户信息," + err.Error()) 280 log.Logger.Error("获取用户信息," + err.Error())
281 return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取用户信息,"+err.Error()) 281 return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取用户信息,"+err.Error())
282 } 282 }
283 - departmentRepo := factory.CreateDepartmentRepository(map[string]interface{}{  
284 - "transactionContext": transactionContext,  
285 - })  
286 - var supperUserList []*domain.User  
287 - if len(userData.DepartmentId) > 0 {  
288 - _, departmentList, err := departmentRepo.Find(map[string]interface{}{  
289 - "ids": userData.DepartmentId,  
290 - })  
291 - if err != nil {  
292 - return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取部门信息,"+err.Error())  
293 - }  
294 - var chargeUserIds []int64  
295 - for _, v := range departmentList {  
296 - chargeUserIds = append(chargeUserIds, v.ChargeUserIds...)  
297 - }  
298 - if len(chargeUserIds) > 0 {  
299 - _, supperUserList, err = userRepo.Find(map[string]interface{}{  
300 - "ids": chargeUserIds,  
301 - })  
302 - if err != nil {  
303 - return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取员工上级信息,"+err.Error())  
304 - }  
305 - }  
306 - } 283 + // departmentRepo := factory.CreateDepartmentRepository(map[string]interface{}{
  284 + // "transactionContext": transactionContext,
  285 + // })
  286 + // var supperUserList []*domain.User
  287 + // if len(userData.DepartmentId) > 0 {
  288 + // _, departmentList, err := departmentRepo.Find(map[string]interface{}{
  289 + // "ids": userData.DepartmentId,
  290 + // })
  291 + // if err != nil {
  292 + // return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取部门信息,"+err.Error())
  293 + // }
  294 + // var chargeUserIds []int64
  295 + // for _, v := range departmentList {
  296 + // chargeUserIds = append(chargeUserIds, v.ChargeUserIds...)
  297 + // }
  298 + // if len(chargeUserIds) > 0 {
  299 + // _, supperUserList, err = userRepo.Find(map[string]interface{}{
  300 + // "ids": chargeUserIds,
  301 + // })
  302 + // if err != nil {
  303 + // return nil, application.ThrowError(application.TRANSACTION_ERROR, "获取员工上级信息,"+err.Error())
  304 + // }
  305 + // }
  306 + // }
  307 + supperUserList, _ := srv.getStaffSuper(transactionContext, *userData)
307 if err := transactionContext.CommitTransaction(); err != nil { 308 if err := transactionContext.CommitTransaction(); err != nil {
308 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 309 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
309 } 310 }
@@ -325,7 +326,7 @@ func (srv StaffAssessServeice) AssessSelfList(param *query.AssessSelfListQuery) @@ -325,7 +326,7 @@ func (srv StaffAssessServeice) AssessSelfList(param *query.AssessSelfListQuery)
325 UserName: userData.Name, 326 UserName: userData.Name,
326 CompanyName: companyData.Name, 327 CompanyName: companyData.Name,
327 SupperUserName: "", 328 SupperUserName: "",
328 - DutyTime: userData.CreatedAt.Local().Format("2006-01-02 15:04:05"), 329 + DutyTime: userData.EntryTime,
329 } 330 }
330 for _, v := range supperUserList { 331 for _, v := range supperUserList {
331 userInfo.SupperUserName = userInfo.SupperUserName + v.Name + " " 332 userInfo.SupperUserName = userInfo.SupperUserName + v.Name + " "