...
|
...
|
@@ -200,11 +200,12 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri |
|
|
}
|
|
|
|
|
|
//查找当前周期,我的考核结果
|
|
|
_, myEvaluationSuper, _ := evaluationRepo.Find(map[string]interface{}{
|
|
|
"types": int(domain.EvaluationSuper),
|
|
|
_, myEvaluationFinish, _ := evaluationRepo.Find(map[string]interface{}{
|
|
|
"types": int(domain.EvaluationFinish),
|
|
|
"limit": 1,
|
|
|
"targetUserId": param.UserId,
|
|
|
"cycleId": param.CycleId,
|
|
|
"beginTime": time.Now(),
|
|
|
})
|
|
|
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
...
|
...
|
@@ -243,15 +244,13 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri |
|
|
}
|
|
|
menu1.Child = append(menu1.Child, menu1_1)
|
|
|
}
|
|
|
if len(myEvaluationSuper) > 0 {
|
|
|
if myEvaluationSuper[0].CheckResult == domain.EvaluationCheckCompleted {
|
|
|
if len(myEvaluationFinish) > 0 {
|
|
|
if myEvaluationFinish[0].CheckResult == domain.EvaluationCheckCompleted {
|
|
|
menu1_2.StatusName = "已完成"
|
|
|
} else {
|
|
|
menu1_2.StatusName = "未完成"
|
|
|
}
|
|
|
if myEvaluationSuper[0].Status == domain.EvaluationCompleted {
|
|
|
menu1.Child = append(menu1.Child, menu1_2)
|
|
|
}
|
|
|
menu1.Child = append(menu1.Child, menu1_2)
|
|
|
}
|
|
|
|
|
|
if len(selfEvaluation) > 0 {
|
...
|
...
|
@@ -491,7 +490,6 @@ func (srv *SummaryEvaluationService) getSummaryEvaluation(transactionContext app |
|
|
|
|
|
// 编辑综合自评详情
|
|
|
func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvaluationValue) (map[string][]adapter.EvaluationItemAdapter, error) {
|
|
|
// xredis.NewLockSummaryEvaluation(param.SummaryEvaluationId)
|
|
|
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
...
|
...
|
@@ -658,16 +656,13 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluationSelf(param *domain. |
|
|
if err != nil {
|
|
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if len(evaluationList) == 0 {
|
|
|
// 获取考核结果阶段
|
|
|
finishEvaluation := *param
|
|
|
finishEvaluation.BeginTime = time.Now()
|
|
|
finishEvaluation.CreatedAt = time.Now()
|
|
|
finishEvaluation.UpdatedAt = time.Now()
|
|
|
finishEvaluation.Executor = domain.StaffDesc{}
|
|
|
finishEvaluation.Id = 0
|
|
|
finishEvaluation.Types = domain.EvaluationFinish
|
|
|
err = evaluationRepo.Save(&finishEvaluation)
|
|
|
if len(evaluationList) > 0 {
|
|
|
// 进入考核结果阶段
|
|
|
if evaluationList[0].BeginTime.After(nowTime) {
|
|
|
evaluationList[0].BeginTime = nowTime
|
|
|
}
|
|
|
evaluationList[0].Status = domain.EvaluationCompleted
|
|
|
err = evaluationRepo.Save(evaluationList[0])
|
|
|
if err != nil {
|
|
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存考核结果,"+err.Error())
|
|
|
}
|
...
|
...
|
@@ -728,7 +723,7 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluation360Hrbp(param *doma |
|
|
"targetUserId": param.TargetUser.UserId,
|
|
|
"typesList": []int{int(domain.EvaluationSuper)},
|
|
|
"cycleId": param.CycleId,
|
|
|
"limit": 10,
|
|
|
"limit": 1,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
...
|
...
|
@@ -761,17 +756,12 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluation360Hrbp(param *doma |
|
|
if err != nil {
|
|
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if len(evaluationList) == 0 {
|
|
|
finishEvaluation := *param
|
|
|
finishEvaluation.BeginTime = time.Now()
|
|
|
finishEvaluation.CreatedAt = time.Now()
|
|
|
finishEvaluation.UpdatedAt = time.Now()
|
|
|
finishEvaluation.Executor = domain.StaffDesc{}
|
|
|
finishEvaluation.Id = 0
|
|
|
finishEvaluation.Types = domain.EvaluationFinish
|
|
|
finishEvaluation.TotalScore = ""
|
|
|
finishEvaluation.TotalRating = []domain.RatingCodeNumber{}
|
|
|
err = evaluationRepo.Save(&finishEvaluation)
|
|
|
if len(evaluationList) > 0 {
|
|
|
if evaluationList[0].BeginTime.After(nowTime) {
|
|
|
evaluationList[0].BeginTime = nowTime
|
|
|
}
|
|
|
evaluationList[0].Status = domain.EvaluationCompleted
|
|
|
err = evaluationRepo.Save(evaluationList[0])
|
|
|
if err != nil {
|
|
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存考核结果,"+err.Error())
|
|
|
}
|
...
|
...
|
@@ -783,7 +773,7 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluation360Hrbp(param *doma |
|
|
return nil
|
|
|
}
|
|
|
|
|
|
// 员工提交上级评估
|
|
|
// 员工提交上级评估后
|
|
|
// 生成考核结果
|
|
|
func (srv *SummaryEvaluationService) AfterCompletedEvaluationSuper(param *domain.SummaryEvaluation) error {
|
|
|
lock := xredis.NewLockSummaryEvaluation(param.TargetUser.UserId)
|
...
|
...
|
@@ -819,17 +809,13 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluationSuper(param *domain |
|
|
if err != nil {
|
|
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if len(evaluationList) == 0 {
|
|
|
finishEvaluation := *param
|
|
|
finishEvaluation.BeginTime = time.Now()
|
|
|
finishEvaluation.CreatedAt = time.Now()
|
|
|
finishEvaluation.UpdatedAt = time.Now()
|
|
|
finishEvaluation.Executor = domain.StaffDesc{}
|
|
|
finishEvaluation.Id = 0
|
|
|
finishEvaluation.Types = domain.EvaluationFinish
|
|
|
finishEvaluation.TotalScore = ""
|
|
|
finishEvaluation.TotalRating = []domain.RatingCodeNumber{}
|
|
|
err = evaluationRepo.Save(&finishEvaluation)
|
|
|
nowTime := time.Now()
|
|
|
if len(evaluationList) > 0 {
|
|
|
if evaluationList[0].BeginTime.After(nowTime) {
|
|
|
evaluationList[0].BeginTime = nowTime
|
|
|
}
|
|
|
evaluationList[0].Status = domain.EvaluationCompleted
|
|
|
err = evaluationRepo.Save(evaluationList[0])
|
|
|
if err != nil {
|
|
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存考核结果,"+err.Error())
|
|
|
}
|
...
|
...
|
@@ -1827,8 +1813,8 @@ func (srv *SummaryEvaluationService) GetTargetUserEvaluationSuper(param *command |
|
|
return &eiAdapter, nil
|
|
|
}
|
|
|
|
|
|
// 获取周期综合评估下,周期评估列表
|
|
|
func (srv *SummaryEvaluationService) ListAllEvaluationSuper(param *command.QueryEvaluationList) (map[string]interface{}, error) {
|
|
|
// 按周期获取所有员工的评估考核结果
|
|
|
func (srv *SummaryEvaluationService) ListAllEvaluationFinish(param *command.QueryEvaluationList) (map[string]interface{}, error) {
|
|
|
transactionContext, err := factory.CreateTransactionContext(nil)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
...
|
...
|
@@ -1872,7 +1858,7 @@ func (srv *SummaryEvaluationService) ListAllEvaluationSuper(param *command.Query |
|
|
//获取评估列表信息
|
|
|
condition1 := map[string]interface{}{
|
|
|
"cycleId": param.CycleId,
|
|
|
"types": int(domain.EvaluationSuper),
|
|
|
"types": int(domain.EvaluationFinish),
|
|
|
"limit": limit,
|
|
|
"beginTime": time.Now(),
|
|
|
}
|
...
|
...
|
@@ -1973,12 +1959,14 @@ func (srv *SummaryEvaluationService) editEvaluationValue( |
|
|
}
|
|
|
evaluationItemMap := map[int]*domain.EvaluationItemUsed{}
|
|
|
evaluationValueMap := map[int]*domain.SummaryEvaluationValue{}
|
|
|
evaluationValueSlice := []*domain.SummaryEvaluationValue{}
|
|
|
evaluationData.TotalRating = nil //清空评级数量统计
|
|
|
for _, v := range evaluationItems {
|
|
|
newValue := &domain.SummaryEvaluationValue{}
|
|
|
newValue.SetBlankValue(evaluationData, v)
|
|
|
evaluationValueMap[v.Id] = newValue
|
|
|
evaluationItemMap[v.Id] = v
|
|
|
evaluationValueSlice = append(evaluationValueSlice, newValue)
|
|
|
//重置计数
|
|
|
evaluationData.ResetTotalRating(v)
|
|
|
}
|
...
|
...
|
@@ -2036,10 +2024,14 @@ func (srv *SummaryEvaluationService) editEvaluationValue( |
|
|
}
|
|
|
}
|
|
|
//完全更新itemValueList
|
|
|
*itemValueList = (*itemValueList)[0:0]
|
|
|
for _, v := range evaluationValueMap {
|
|
|
*itemValueList = append(*itemValueList, v)
|
|
|
}
|
|
|
*itemValueList = evaluationValueSlice
|
|
|
// *itemValueList = (*itemValueList)[0:0]
|
|
|
// for _, v := range evaluationValueMap {
|
|
|
// *itemValueList = append(*itemValueList, v)
|
|
|
// }
|
|
|
// sort.Slice(*itemValueList, func(i, j int) bool {
|
|
|
// return (*itemValueList)[i].EvaluationItemId < (*itemValueList)[j].EvaluationItemId
|
|
|
// })
|
|
|
// 计算总得分
|
|
|
err := evaluationData.EvaluationTotalScore(*itemValueList)
|
|
|
if err != nil {
|
...
|
...
|
|