...
|
...
|
@@ -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,16 +244,14 @@ 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)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if len(selfEvaluation) > 0 {
|
|
|
menuList = append(menuList, menu1)
|
...
|
...
|
@@ -670,21 +669,17 @@ 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
|
|
|
err = evaluationRepo.Save(evaluationList[0])
|
|
|
if err != nil {
|
|
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存考核结果,"+err.Error())
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
...
|
...
|
@@ -773,29 +768,23 @@ 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
|
|
|
err = evaluationRepo.Save(evaluationList[0])
|
|
|
if err != nil {
|
|
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存考核结果,"+err.Error())
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
// 员工提交上级评估
|
|
|
// 员工提交上级评估后
|
|
|
// 生成考核结果
|
|
|
func (srv *SummaryEvaluationService) AfterCompletedEvaluationSuper(param *domain.SummaryEvaluation) error {
|
|
|
lock := xredis.NewLockSummaryEvaluation(param.TargetUser.UserId)
|
...
|
...
|
@@ -831,21 +820,16 @@ 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
|
|
|
err = evaluationRepo.Save(evaluationList[0])
|
|
|
if err != nil {
|
|
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存考核结果,"+err.Error())
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
...
|
...
|
@@ -1609,8 +1593,12 @@ func (srv *SummaryEvaluationService) GetTargetUserEvaluationSuper(param *command |
|
|
return &result, nil
|
|
|
}
|
|
|
|
|
|
// 获取周期综合评估下,周期评估列表
|
|
|
func (srv *SummaryEvaluationService) ListAllEvaluationSuper(param *command.QueryEvaluationList) (map[string]interface{}, error) {
|
|
|
return nil, nil
|
|
|
}
|
|
|
|
|
|
// 按周期获取所有员工的评估考核结果
|
|
|
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())
|
...
|
...
|
@@ -1654,7 +1642,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(),
|
|
|
}
|
...
|
...
|
@@ -1755,12 +1743,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)
|
|
|
}
|
...
|
...
|
@@ -1818,10 +1808,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 {
|
...
|
...
|
|