作者 tangxvhui

更新

package service
import (
"time"
"github.com/linmadan/egglib-go/core/application"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/notify"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/summary_evaluation/adapter"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/summary_evaluation/command"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/dao"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/xredis"
)
// 编辑综合自评详情
func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvaluationValue) (map[string][]adapter.EvaluationItemAdapter, error) {
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
if err := transactionContext.StartTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
defer func() {
_ = transactionContext.RollbackTransaction()
}()
evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
itemUsedRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
evaluationData, err := evaluationRepo.FindOne(map[string]interface{}{
"id": param.SummaryEvaluationId,
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取评估"+err.Error())
}
if evaluationData.Types != domain.EvaluationSelf {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限")
}
if evaluationData.Executor.UserId != param.ExecutorId {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限")
}
if evaluationData.CompanyId != param.CompanyId {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限")
}
lock := xredis.NewLockSummaryEvaluation(evaluationData.TargetUser.UserId)
err = lock.Lock()
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "未能完全提交评估内容")
}
defer func() {
lock.UnLock()
}()
_, itemList, err := itemUsedRepo.Find(map[string]interface{}{
"evaluationProjectId": evaluationData.EvaluationProjectId,
"nodeType": domain.LinkNodeSelfAssessment,
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
_, itemValueList, err := itemValueRepo.Find(map[string]interface{}{
"summaryEvaluationId": evaluationData.Id,
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
err = srv.editEvaluationValue(evaluationData, &itemValueList, itemList, param.EvaluationItems, nil, param.IsTemporary)
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
//保存填写值
for _, v := range itemValueList {
err = itemValueRepo.Save(v)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
}
if !param.IsTemporary {
evaluationData.Status = domain.EvaluationCompleted
//删除旧的填写值,使用新的填写内容
err = itemValueRepo.RemoveBySummaryEvaluationId(evaluationData.Id)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
for _, val := range itemValueList {
val.Id = 0
}
}
err = evaluationRepo.Save(evaluationData)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if !param.IsTemporary {
err = srv.AfterCompletedEvaluationSelf(transactionContext, evaluationData, itemValueList)
if err != nil {
return nil, err
}
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
itemValueAdapter := srv.buildSummaryItemValue(itemList, itemValueList)
return map[string][]adapter.EvaluationItemAdapter{
"EvaluationItems": itemValueAdapter,
}, nil
}
// 员工提交自评内容后,
// 员工作为被评估人,
// 变更360评估/人资评估/的开始时间
// 或者变更上级评估的开始时间
// 或者生成考核结果
func (srv *SummaryEvaluationService) AfterCompletedEvaluationSelf(
transactionContext application.TransactionContext,
evaluationData *domain.SummaryEvaluation,
evaluationValue []*domain.SummaryEvaluationValue,
) error {
evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
_, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
"targetUserId": evaluationData.TargetUser.UserId,
"typesList": []int{int(domain.Evaluation360), int(domain.EvaluationHrbp)},
"cycleId": evaluationData.CycleId,
"limit": 1000,
})
if err != nil {
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if len(evaluationList) == 0 {
//如果没有360评估和hrbp 评估,查找上级评估
_, evaluationList, err = evaluationRepo.Find(map[string]interface{}{
"targetUserId": evaluationData.TargetUser.UserId,
"typesList": []int{int(domain.EvaluationSuper)},
"cycleId": evaluationData.CycleId,
"limit": 10,
})
if err != nil {
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
}
nowTime := time.Now()
updatedId := []int{}
// 变更360评估/人资评估/上级评估的开始时间
for _, v := range evaluationList {
if v.BeginTime.After(nowTime) {
v.BeginTime = nowTime
updatedId = append(updatedId, v.Id)
}
}
evaluationDao := dao.NewSummaryEvaluationDao(map[string]interface{}{
"transactionContext": transactionContext,
})
err = evaluationDao.UpdateBeginTime(updatedId, nowTime)
if err != nil {
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if len(evaluationList) == 0 {
//没有上级评估、360评估、hrbp 评估
//直接进入考核结果阶段
_, evaluationFinishList, err := evaluationRepo.Find(map[string]interface{}{
"targetUserId": evaluationData.TargetUser.UserId,
"typesList": []int{int(domain.EvaluationFinish)},
"cycleId": evaluationData.CycleId,
"limit": 1,
})
if err != nil {
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if len(evaluationFinishList) > 0 {
//进入考核结果
//自评的结束时间
if evaluationFinishList[0].BeginTime.After(nowTime) {
evaluationFinishList[0].BeginTime = nowTime
}
evaluationFinishList[0].Status = domain.EvaluationCompleted
err = evaluationRepo.Save(evaluationFinishList[0])
if err != nil {
return application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存考核结果,"+err.Error())
}
//添加确认绩效成绩提醒短信提醒
err = notify.AddNotifyConfirmEvaluationScore(evaluationFinishList[0])
if err != nil {
return application.ThrowError(application.TRANSACTION_ERROR, "创建短信提醒失败"+err.Error())
}
}
}
return nil
}
... ...
... ... @@ -17,14 +17,6 @@ import (
// EditEvaluationSuper 更新上级评估内容
func (srv *SummaryEvaluationService) EditEvaluationSuper(param *command.EditEvaluationValue) (interface{}, error) {
// lock := xredis.NewLockSummaryEvaluationId(param.SummaryEvaluationId)
// err := lock.Lock()
// if err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "未能完全提交评估内容")
// }
// defer func() {
// lock.UnLock()
// }()
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ... @@ -62,6 +54,10 @@ func (srv *SummaryEvaluationService) EditEvaluationSuper(param *command.EditEval
if evaluationData.CompanyId != param.CompanyId {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限")
}
ok := evaluationData.EndTime.Before(time.Now())
if ok {
return nil, application.ThrowError(application.BUSINESS_ERROR, "评估时间已截止")
}
//按照被评估人id ,加锁
lock := xredis.NewLockSummaryEvaluation(evaluationData.TargetUser.UserId)
err = lock.Lock()
... ... @@ -112,23 +108,27 @@ func (srv *SummaryEvaluationService) EditEvaluationSuper(param *command.EditEval
if !param.IsTemporary {
//变更评估状态为已填写
evaluationData.Status = domain.EvaluationCompleted
}
for _, v := range itemValueList {
//保存填写值
err = itemValueRepo.Save(v)
//删除旧的填写值,使用新的填写内容
err = itemValueRepo.RemoveBySummaryEvaluationId(evaluationData.Id)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
for _, val := range itemValueList {
val.Id = 0
}
}
//保存填写值
err = evaluationRepo.Save(evaluationData)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
for _, v := range itemValueList {
//保存填写值
err = itemValueRepo.Save(v)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
}
if !param.IsTemporary {
err = srv.AfterCompletedEvaluationSuper(transactionContext, evaluationData, itemValueList)
if err != nil {
... ... @@ -136,6 +136,9 @@ func (srv *SummaryEvaluationService) EditEvaluationSuper(param *command.EditEval
}
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
itemValueAdapter := srv.buildSummaryItemValue(itemList, itemValueList)
return map[string][]adapter.EvaluationItemAdapter{
"EvaluationItems": itemValueAdapter,
... ... @@ -247,6 +250,7 @@ func (srv *SummaryEvaluationService) syncEvaluationFinishValue(
oldValue.Remark = item.Remark
}
}
// 重置各个评级数量
evaluationData.TotalRating = nil
for i := range itemList {
evaluationData.ResetTotalRating(itemList[i])
... ... @@ -256,7 +260,7 @@ func (srv *SummaryEvaluationService) syncEvaluationFinishValue(
for _, val := range oldEvaluationValue {
newEvaluationValue = append(newEvaluationValue, val)
}
//计算总分
evaluationData.EvaluationTotalScore(newEvaluationValue)
err = evaluationRepo.Save(evaluationData)
... ...
... ... @@ -483,203 +483,203 @@ func (srv *SummaryEvaluationService) getSummaryEvaluation(transactionContext app
}
// 编辑综合自评详情
func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvaluationValue) (map[string][]adapter.EvaluationItemAdapter, error) {
lock := xredis.NewLockSummaryEvaluationId(param.SummaryEvaluationId)
err := lock.Lock()
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "未能完全提交评估内容")
}
defer func() {
lock.UnLock()
}()
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
if err := transactionContext.StartTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
defer func() {
_ = transactionContext.RollbackTransaction()
}()
evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
itemUsedRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
// func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvaluationValue) (map[string][]adapter.EvaluationItemAdapter, error) {
// lock := xredis.NewLockSummaryEvaluationId(param.SummaryEvaluationId)
// err := lock.Lock()
// if err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "未能完全提交评估内容")
// }
// defer func() {
// lock.UnLock()
// }()
// transactionContext, err := factory.CreateTransactionContext(nil)
// if err != nil {
// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
// }
// if err := transactionContext.StartTransaction(); err != nil {
// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
// }
// defer func() {
// _ = transactionContext.RollbackTransaction()
// }()
// evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{
// "transactionContext": transactionContext,
// })
// itemUsedRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{
// "transactionContext": transactionContext,
// })
itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
evaluationData, err := evaluationRepo.FindOne(map[string]interface{}{
"id": param.SummaryEvaluationId,
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取评估"+err.Error())
}
if evaluationData.Types != domain.EvaluationSelf {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限")
}
// itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{
// "transactionContext": transactionContext,
// })
// evaluationData, err := evaluationRepo.FindOne(map[string]interface{}{
// "id": param.SummaryEvaluationId,
// })
// if err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "获取评估"+err.Error())
// }
// if evaluationData.Types != domain.EvaluationSelf {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限")
// }
if evaluationData.Executor.UserId != param.ExecutorId {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限")
}
// if evaluationData.Executor.UserId != param.ExecutorId {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限")
// }
if evaluationData.CompanyId != param.CompanyId {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限")
}
// if evaluationData.CompanyId != param.CompanyId {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限")
// }
_, itemList, err := itemUsedRepo.Find(map[string]interface{}{
"evaluationProjectId": evaluationData.EvaluationProjectId,
"nodeType": domain.LinkNodeSelfAssessment,
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
// _, itemList, err := itemUsedRepo.Find(map[string]interface{}{
// "evaluationProjectId": evaluationData.EvaluationProjectId,
// "nodeType": domain.LinkNodeSelfAssessment,
// })
// if err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
// }
_, itemValueList, err := itemValueRepo.Find(map[string]interface{}{
"summaryEvaluationId": evaluationData.Id,
})
// _, itemValueList, err := itemValueRepo.Find(map[string]interface{}{
// "summaryEvaluationId": evaluationData.Id,
// })
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
// if err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
// }
err = srv.editEvaluationValue(evaluationData, &itemValueList, itemList, param.EvaluationItems, nil, param.IsTemporary)
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
// err = srv.editEvaluationValue(evaluationData, &itemValueList, itemList, param.EvaluationItems, nil, param.IsTemporary)
// if err != nil {
// return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
// }
//保存填写值
for _, v := range itemValueList {
err = itemValueRepo.Save(v)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
}
if !param.IsTemporary {
evaluationData.Status = domain.EvaluationCompleted
}
err = evaluationRepo.Save(evaluationData)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if !param.IsTemporary {
err = srv.AfterCompletedEvaluationSelf(evaluationData)
if err != nil {
return nil, err
}
}
// //保存填写值
// for _, v := range itemValueList {
// err = itemValueRepo.Save(v)
// if err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
// }
// }
// if !param.IsTemporary {
// evaluationData.Status = domain.EvaluationCompleted
// }
// err = evaluationRepo.Save(evaluationData)
// if err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
// }
// if err := transactionContext.CommitTransaction(); err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
// }
// if !param.IsTemporary {
// err = srv.AfterCompletedEvaluationSelf(evaluationData)
// if err != nil {
// return nil, err
// }
// }
itemValueAdapter := srv.buildSummaryItemValue(itemList, itemValueList)
return map[string][]adapter.EvaluationItemAdapter{
"EvaluationItems": itemValueAdapter,
}, nil
}
// itemValueAdapter := srv.buildSummaryItemValue(itemList, itemValueList)
// return map[string][]adapter.EvaluationItemAdapter{
// "EvaluationItems": itemValueAdapter,
// }, nil
// }
// 员工提交自评内容后,
// 员工作为被评估人,
// 变更360评估/人资评估/的开始时间
// 或者变更上级评估的开始时间
// 或者生成考核结果
func (srv *SummaryEvaluationService) AfterCompletedEvaluationSelf(param *domain.SummaryEvaluation) error {
lock := xredis.NewLockSummaryEvaluation(param.TargetUser.UserId)
err := lock.Lock()
if err != nil {
return application.ThrowError(application.INTERNAL_SERVER_ERROR, "未能完全提交评估内容")
}
defer func() {
lock.UnLock()
}()
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
return application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
if err := transactionContext.StartTransaction(); err != nil {
return application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
defer func() {
_ = transactionContext.RollbackTransaction()
}()
evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
_, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
"targetUserId": param.TargetUser.UserId,
"typesList": []int{int(domain.Evaluation360), int(domain.EvaluationHrbp)},
"cycleId": param.CycleId,
"limit": 1000,
})
if err != nil {
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if len(evaluationList) == 0 {
//如果没有360评估和hrbp 评估,查找上级评估
_, evaluationList, err = evaluationRepo.Find(map[string]interface{}{
"targetUserId": param.TargetUser.UserId,
"typesList": []int{int(domain.EvaluationSuper)},
"cycleId": param.CycleId,
"limit": 10,
})
if err != nil {
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
}
nowTime := time.Now()
updatedId := []int{}
// 变更360评估/人资评估/上级评估的开始时间
for _, v := range evaluationList {
if v.BeginTime.After(nowTime) {
v.BeginTime = nowTime
updatedId = append(updatedId, v.Id)
}
}
evaluationDao := dao.NewSummaryEvaluationDao(map[string]interface{}{
"transactionContext": transactionContext,
})
err = evaluationDao.UpdateBeginTime(updatedId, nowTime)
if err != nil {
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if len(evaluationList) == 0 {
//没有上级评估、360评估、hrbp 评估
//直接进入考核结果阶段
_, evaluationFinishList, err := evaluationRepo.Find(map[string]interface{}{
"targetUserId": param.TargetUser.UserId,
"typesList": []int{int(domain.EvaluationFinish)},
"cycleId": param.CycleId,
"limit": 1,
})
if err != nil {
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if len(evaluationFinishList) > 0 {
//进入考核结果
//自评的结束时间
if evaluationFinishList[0].BeginTime.After(nowTime) {
evaluationFinishList[0].BeginTime = nowTime
}
evaluationFinishList[0].Status = domain.EvaluationCompleted
err = evaluationRepo.Save(evaluationFinishList[0])
if err != nil {
return application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存考核结果,"+err.Error())
}
//添加确认绩效成绩提醒短信提醒
err = notify.AddNotifyConfirmEvaluationScore(evaluationFinishList[0])
if err != nil {
return application.ThrowError(application.TRANSACTION_ERROR, "创建短信提醒失败"+err.Error())
}
}
}
if err := transactionContext.CommitTransaction(); err != nil {
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
return nil
}
// // 员工提交自评内容后,
// // 员工作为被评估人,
// // 变更360评估/人资评估/的开始时间
// // 或者变更上级评估的开始时间
// // 或者生成考核结果
// func (srv *SummaryEvaluationService) AfterCompletedEvaluationSelf(param *domain.SummaryEvaluation) error {
// lock := xredis.NewLockSummaryEvaluation(param.TargetUser.UserId)
// err := lock.Lock()
// if err != nil {
// return application.ThrowError(application.INTERNAL_SERVER_ERROR, "未能完全提交评估内容")
// }
// defer func() {
// lock.UnLock()
// }()
// transactionContext, err := factory.CreateTransactionContext(nil)
// if err != nil {
// return application.ThrowError(application.TRANSACTION_ERROR, err.Error())
// }
// if err := transactionContext.StartTransaction(); err != nil {
// return application.ThrowError(application.TRANSACTION_ERROR, err.Error())
// }
// defer func() {
// _ = transactionContext.RollbackTransaction()
// }()
// evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{
// "transactionContext": transactionContext,
// })
// _, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
// "targetUserId": param.TargetUser.UserId,
// "typesList": []int{int(domain.Evaluation360), int(domain.EvaluationHrbp)},
// "cycleId": param.CycleId,
// "limit": 1000,
// })
// if err != nil {
// return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
// }
// if len(evaluationList) == 0 {
// //如果没有360评估和hrbp 评估,查找上级评估
// _, evaluationList, err = evaluationRepo.Find(map[string]interface{}{
// "targetUserId": param.TargetUser.UserId,
// "typesList": []int{int(domain.EvaluationSuper)},
// "cycleId": param.CycleId,
// "limit": 10,
// })
// if err != nil {
// return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
// }
// }
// nowTime := time.Now()
// updatedId := []int{}
// // 变更360评估/人资评估/上级评估的开始时间
// for _, v := range evaluationList {
// if v.BeginTime.After(nowTime) {
// v.BeginTime = nowTime
// updatedId = append(updatedId, v.Id)
// }
// }
// evaluationDao := dao.NewSummaryEvaluationDao(map[string]interface{}{
// "transactionContext": transactionContext,
// })
// err = evaluationDao.UpdateBeginTime(updatedId, nowTime)
// if err != nil {
// return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
// }
// if len(evaluationList) == 0 {
// //没有上级评估、360评估、hrbp 评估
// //直接进入考核结果阶段
// _, evaluationFinishList, err := evaluationRepo.Find(map[string]interface{}{
// "targetUserId": param.TargetUser.UserId,
// "typesList": []int{int(domain.EvaluationFinish)},
// "cycleId": param.CycleId,
// "limit": 1,
// })
// if err != nil {
// return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
// }
// if len(evaluationFinishList) > 0 {
// //进入考核结果
// //自评的结束时间
// if evaluationFinishList[0].BeginTime.After(nowTime) {
// evaluationFinishList[0].BeginTime = nowTime
// }
// evaluationFinishList[0].Status = domain.EvaluationCompleted
// err = evaluationRepo.Save(evaluationFinishList[0])
// if err != nil {
// return application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存考核结果,"+err.Error())
// }
// //添加确认绩效成绩提醒短信提醒
// err = notify.AddNotifyConfirmEvaluationScore(evaluationFinishList[0])
// if err != nil {
// return application.ThrowError(application.TRANSACTION_ERROR, "创建短信提醒失败"+err.Error())
// }
// }
// }
// if err := transactionContext.CommitTransaction(); err != nil {
// return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
// }
// return nil
// }
// 提交员工的人资评估 或者 360 评估
// 变更上级评估的开始时间
... ... @@ -2152,14 +2152,6 @@ func (srv *SummaryEvaluationService) editEvaluationValueUnlimited(
}
}
}
// 等待产品确认
// if evaluationData.Types == domain.EvaluationSelf {
// // 填充评估填写值
// err := newItemValue.EvaluationSelfFillValue(evaluationItem, v.Value, v.Remark)
// if err != nil {
// return err
// }
// } else {
//填充评估填写值
err := newItemValue.FillValue(evaluationItem, v.Value, v.Remark)
if err != nil {
... ...