...
|
...
|
@@ -359,7 +359,10 @@ func (srv StaffAssessServeice) createStaffAssess(transactionContext application. |
|
|
stepSelfTemp.LinkNodeId = v.LinkNodeId
|
|
|
stepSelfTemp.LinkNodeName = v.LinkNodeName
|
|
|
stepSelfTemp.Types = domain.AssessSelf
|
|
|
assessListTemp := srv.createStaffAssessSelf(stepSelfTemp, userList, userDepartmentMap)
|
|
|
assessListTemp, err := srv.createStaffAssessSelf(transactionContext, stepSelfTemp, userList, userDepartmentMap)
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
assessList = append(assessList, assessListTemp...)
|
|
|
}
|
|
|
if v.LinkNodeType == domain.LinkNodeSuperiorAssessment {
|
...
|
...
|
@@ -380,10 +383,28 @@ func (srv StaffAssessServeice) createStaffAssess(transactionContext application. |
|
|
}
|
|
|
|
|
|
// 构建员工自评
|
|
|
func (srv StaffAssessServeice) createStaffAssessSelf(assessTemp domain.StaffAssess,
|
|
|
userList []*domain.User, userDepartmentMap map[int64][]*domain.Department) []domain.StaffAssess {
|
|
|
result := []domain.StaffAssess{}
|
|
|
for _, usr := range userList {
|
|
|
func (srv StaffAssessServeice) createStaffAssessSelf(
|
|
|
transactionContext application.TransactionContext,
|
|
|
assessTemp domain.StaffAssess,
|
|
|
userList []*domain.User,
|
|
|
userDepartmentMap map[int64][]*domain.Department) ([]domain.StaffAssess, error) {
|
|
|
assessRepo := factory.CreateStaffAssessRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
beginDay := assessTemp.BeginTime.Format("2006-01-02")
|
|
|
_, assessListOld, err := assessRepo.Find(map[string]interface{}{"cycleId": assessTemp.CycleId, "beginDay": beginDay, "types": domain.AssessSelf})
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
userMapReal := map[int]*domain.User{}
|
|
|
for _, val := range userList {
|
|
|
userMapReal[int(val.Id)] = val
|
|
|
}
|
|
|
for _, val := range assessListOld {
|
|
|
delete(userMapReal, val.TargetUser.UserId)
|
|
|
}
|
|
|
assessListNew := []domain.StaffAssess{}
|
|
|
for _, usr := range userMapReal {
|
|
|
assessTemp.TargetUser = domain.StaffDesc{
|
|
|
UserId: int(usr.Id),
|
|
|
Account: usr.Account,
|
...
|
...
|
@@ -402,9 +423,9 @@ func (srv StaffAssessServeice) createStaffAssessSelf(assessTemp domain.StaffAsse |
|
|
})
|
|
|
}
|
|
|
}
|
|
|
result = append(result, assessTemp)
|
|
|
assessListNew = append(assessListNew, assessTemp)
|
|
|
}
|
|
|
return result
|
|
|
return assessListNew, nil
|
|
|
}
|
|
|
|
|
|
// 构建员工的上级评估
|
...
|
...
|
@@ -413,8 +434,24 @@ func (srv StaffAssessServeice) createStaffAssessSupper( |
|
|
assessTemp domain.StaffAssess,
|
|
|
userList []*domain.User, userDepartmentMap map[int64][]*domain.Department,
|
|
|
) ([]domain.StaffAssess, error) {
|
|
|
var assessList []domain.StaffAssess
|
|
|
for _, v := range userList {
|
|
|
assessRepo := factory.CreateStaffAssessRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
beginDay := assessTemp.BeginTime.Format("2006-01-02")
|
|
|
_, assessListOld, err := assessRepo.Find(map[string]interface{}{"cycleId": assessTemp.CycleId, "beginDay": beginDay, "types": domain.AssessSuper})
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
userMapReal := map[int]*domain.User{}
|
|
|
for _, val := range userList {
|
|
|
userMapReal[int(val.Id)] = val
|
|
|
}
|
|
|
for _, val := range assessListOld {
|
|
|
delete(userMapReal, val.TargetUser.UserId)
|
|
|
}
|
|
|
|
|
|
var assessListNew []domain.StaffAssess
|
|
|
for _, v := range userMapReal {
|
|
|
//获取上级
|
|
|
chargeUserList, err := srv.getStaffSuper(transactionContext, *v)
|
|
|
if err != nil {
|
...
|
...
|
@@ -444,11 +481,11 @@ func (srv StaffAssessServeice) createStaffAssessSupper( |
|
|
}
|
|
|
}
|
|
|
assessTemp.TargetDepartment = targetDepartment
|
|
|
assessList = append(assessList, assessTemp)
|
|
|
assessListNew = append(assessListNew, assessTemp)
|
|
|
}
|
|
|
|
|
|
}
|
|
|
return assessList, nil
|
|
|
return assessListNew, nil
|
|
|
}
|
|
|
|
|
|
// 获取某个员工360评估邀请的人员
|
...
|
...
|
|