...
|
...
|
@@ -208,11 +208,8 @@ func (srv StaffAssessServeice) AssessTaskDesc(param *query.AssessTaskDescQuery) |
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//未参与的,不算在个人的评估环节里
|
|
|
if stepItem.Status != "" {
|
|
|
result.StepList = append(result.StepList, stepItem)
|
|
|
}
|
|
|
}
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
...
|
...
|
@@ -1598,6 +1595,12 @@ func (srv *StaffAssessServeice) getStaffDescrip(transactionContext application.T |
|
|
departmentRepo := factory.CreateDepartmentRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
// //查找员工的部门
|
|
|
// var departmentList []*domain.Department
|
|
|
// if len(userData.DepartmentId) > 0 {
|
|
|
|
|
|
// }
|
|
|
|
|
|
var supperUserList []*domain.User
|
|
|
if len(userData.DepartmentId) > 0 {
|
|
|
_, departmentList, err := departmentRepo.Find(map[string]interface{}{
|
...
|
...
|
@@ -1659,7 +1662,13 @@ func (srv StaffAssessServeice) SaveAssessInfo(param *command.SaveAssessInfoComma |
|
|
if endTimeInt < time.Now().Unix() {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, "当前环节已过截止时间,提交后无法修改内容")
|
|
|
}
|
|
|
|
|
|
//检查执行人
|
|
|
if assessData.CompanyId != param.CompanyId {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, "当前用户不是评估的执行人")
|
|
|
}
|
|
|
if assessData.Executor.UserId != param.ExecutorId {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, "当前用户不是评估的执行人")
|
|
|
}
|
|
|
assessContentRepo := factory.CreateStaffAssessContentRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
...
|
...
|
@@ -1763,3 +1772,78 @@ func (srv StaffAssessServeice) ListTargetUserAssess(param *query.ListTargetUserA |
|
|
|
|
|
return tool_funs.SimpleWrapGridMap(int64(cnt), assessList), nil
|
|
|
}
|
|
|
|
|
|
//获取员工的上级是谁 ,TODO
|
|
|
func (srv StaffAssessServeice) getStaffSuper(transactionContext application.TransactionContext, targetUser domain.User) ([]domain.User, error) {
|
|
|
departmentRepo := factory.CreateDepartmentRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
userRepo := factory.CreateUserRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
|
|
|
var departmemtList []*domain.Department
|
|
|
var err error
|
|
|
if len(targetUser.DepartmentId) > 0 {
|
|
|
_, departmemtList, err = departmentRepo.Find(map[string]interface{}{
|
|
|
"ids": targetUser.DepartmentId,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工的部门列表"+err.Error())
|
|
|
}
|
|
|
}
|
|
|
if len(departmemtList) == 0 {
|
|
|
|
|
|
}
|
|
|
//获取部门管理员
|
|
|
var chargeUserIds []int64
|
|
|
var targetUserAsManager *domain.Department
|
|
|
loop:
|
|
|
for _, v := range departmemtList {
|
|
|
if len(v.ChargeUserIds) == 0 {
|
|
|
continue
|
|
|
}
|
|
|
//检查员工自身是否是管理员
|
|
|
for _, vv := range v.ChargeUserIds {
|
|
|
if vv == targetUser.Id {
|
|
|
targetUserAsManager = v
|
|
|
break loop
|
|
|
}
|
|
|
}
|
|
|
chargeUserIds = append(chargeUserIds, v.ChargeUserIds...)
|
|
|
}
|
|
|
if targetUserAsManager != nil {
|
|
|
//清空原有的管理员
|
|
|
chargeUserIds = []int64{}
|
|
|
//员工自身是否是管理员,查找父级部门
|
|
|
_, parentDepartment, err := departmentRepo.Find(map[string]interface{}{
|
|
|
"id": targetUserAsManager.ParentId,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取员工现在部门的父级"+err.Error())
|
|
|
}
|
|
|
for _, v := range parentDepartment {
|
|
|
chargeUserIds = append(chargeUserIds, v.ChargeUserIds...)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
var chargeUserList []*domain.User
|
|
|
if len(chargeUserIds) > 0 {
|
|
|
_, chargeUserList, err = userRepo.Find(map[string]interface{}{
|
|
|
"ids": chargeUserIds,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取主管员工数据"+err.Error())
|
|
|
}
|
|
|
}
|
|
|
if len(chargeUserList) == 0 {
|
|
|
//如果都找不到数据
|
|
|
|
|
|
}
|
|
|
|
|
|
// _, chargeUserList, err := userRepo.Find(map[string]interface{}{
|
|
|
// "ids": chargeUserIds,
|
|
|
// })
|
|
|
|
|
|
return nil, nil
|
|
|
} |
...
|
...
|
|