作者 tangxvhui

调整逻辑,编辑周期评估

package service
import (
"github.com/linmadan/egglib-go/core/application"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory"
"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/xredis"
)
// EditEvaluation360 编辑提交360综评
func (srv *SummaryEvaluationService) EditEvaluation360(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})
summaryEvaluation, err := evaluationRepo.FindOne(map[string]interface{}{"id": param.SummaryEvaluationId})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if summaryEvaluation.Executor.UserId != param.ExecutorId {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限")
}
if summaryEvaluation.CompanyId != param.CompanyId {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限")
}
// 按照 被评估人加锁
lock := xredis.NewLockSummaryEvaluation(summaryEvaluation.TargetUser.UserId)
err = lock.Lock()
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "未能完全提交评估内容")
}
defer func() {
lock.UnLock()
}()
_, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
"targetUserId": summaryEvaluation.TargetUser.UserId,
"typesList": []int{int(domain.EvaluationFinish)},
"cycleId": summaryEvaluation.CycleId,
"limit": 1,
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
// 如果目标员工已经确认考核结果,就不能在进行评估编辑
if len(evaluationList) > 0 && evaluationList[0].CheckResult == domain.EvaluationCheckCompleted {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "用户已经确认该周期的考核结果,不能再编辑!")
}
// 自评评估内容(自评模板、筛选项目评估人)
_, itemList, err := itemUsedRepo.Find(map[string]interface{}{
"evaluationProjectId": summaryEvaluation.EvaluationProjectId,
"nodeType": domain.LinkNodeSelfAssessment,
"evaluatorId": param.ExecutorId,
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
// 评估内容对应的分数
_, itemValueList, err := itemValueRepo.Find(map[string]interface{}{"summaryEvaluationId": summaryEvaluation.Id})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
err = srv.editEvaluationValue(summaryEvaluation, &itemValueList, itemList, param.EvaluationItems, nil, param.IsTemporary)
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
if !param.IsTemporary {
//变更评估状态为已填写
summaryEvaluation.Status = domain.EvaluationCompleted
}
//保存填写值
for _, v := range itemValueList {
err = itemValueRepo.Save(v)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
}
//保存填写值
err = evaluationRepo.Save(summaryEvaluation)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if !param.IsTemporary {
err = srv.AfterCompletedEvaluation360Hrbp(transactionContext, summaryEvaluation)
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
}
... ...
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"
roleService "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/role"
"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"
)
// EditEvaluationHRBP 编辑提交人资综评
func (srv *SummaryEvaluationService) EditEvaluationHRBP(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()
}()
userRepo := factory.CreateUserRepository(map[string]interface{}{"transactionContext": transactionContext})
evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{"transactionContext": transactionContext})
itemUsedRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{"transactionContext": transactionContext})
itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{"transactionContext": transactionContext})
// 必须是HRBP权限的人才能编辑操作
hrbp, err := roleService.GetHrBp(transactionContext, param.CompanyId, param.ExecutorId)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if hrbp != domain.RoleTypeSystem {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限")
}
summaryEvaluation, err := evaluationRepo.FindOne(map[string]interface{}{"id": param.SummaryEvaluationId})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if summaryEvaluation.Types != domain.EvaluationHrbp {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限")
}
if summaryEvaluation.CompanyId != param.CompanyId {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限")
}
// 按照 被评估人加锁
lock := xredis.NewLockSummaryEvaluation(summaryEvaluation.TargetUser.UserId)
err = lock.Lock()
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "未能完全提交评估内容")
}
defer func() {
lock.UnLock()
}()
_, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
"targetUserId": summaryEvaluation.TargetUser.UserId,
"typesList": []int{int(domain.EvaluationFinish)},
"cycleId": summaryEvaluation.CycleId,
"limit": 1,
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
// 如果目标员工已经确认考核结果,就不能在进行评估编辑
if len(evaluationList) > 0 && evaluationList[0].CheckResult == domain.EvaluationCheckCompleted {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "用户已经确认该周期的考核结果,不能再编辑!")
}
// 自评评估内容(自评模板、筛选项目评估人)
_, itemList, err := itemUsedRepo.Find(map[string]interface{}{
"evaluationProjectId": summaryEvaluation.EvaluationProjectId,
"nodeType": domain.LinkNodeSelfAssessment,
"evaluatorId": -1,
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
// 评估内容对应的分数
_, itemValueList, err := itemValueRepo.Find(map[string]interface{}{"summaryEvaluationId": summaryEvaluation.Id})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
err = srv.editEvaluationValue(summaryEvaluation, &itemValueList, itemList, param.EvaluationItems, nil, param.IsTemporary)
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
if !param.IsTemporary {
//变更评估状态为已填写
summaryEvaluation.Status = domain.EvaluationCompleted
}
//保存填写值
for _, v := range itemValueList {
err = itemValueRepo.Save(v)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
}
// 针对HRBP类型,更新最后一次操作的HRBP人
user, err := userRepo.FindOne(map[string]interface{}{"id": param.ExecutorId})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
summaryEvaluation.Executor.UserId = param.ExecutorId
summaryEvaluation.Executor.Account = user.Account
summaryEvaluation.Executor.UserName = user.Name
summaryEvaluation.Executor.CompanyName = "" // 暂时无用
summaryEvaluation.Status = domain.EvaluationCompleted
//保存填写值
err = evaluationRepo.Save(summaryEvaluation)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if !param.IsTemporary {
err = srv.AfterCompletedEvaluation360Hrbp(transactionContext, summaryEvaluation)
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) AfterCompletedEvaluation360Hrbp(
transactionContext application.TransactionContext,
evaluationData *domain.SummaryEvaluation,
) error {
evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
_, evaluation360HrbList, 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())
}
allCompleted := true
for _, v := range evaluation360HrbList {
if v.Status == domain.EvaluationUncompleted {
allCompleted = false
break
}
}
if !allCompleted {
return nil
}
_, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
"targetUserId": evaluationData.TargetUser.UserId,
"typesList": []int{int(domain.EvaluationSuper)},
"cycleId": evaluationData.CycleId,
"limit": 1,
})
if err != nil {
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
nowTime := time.Now()
updatedId := []int{}
// 变更上级评估的开始时间
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 {
//没有上级评估
//直接进入考核结果阶段
_, 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
}
... ...
... ... @@ -51,6 +51,7 @@ func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvalu
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 {
... ... @@ -66,7 +67,6 @@ func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvalu
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
_, itemValueList, err := itemValueRepo.Find(map[string]interface{}{
"summaryEvaluationId": evaluationData.Id,
})
... ... @@ -80,13 +80,6 @@ func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvalu
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
//删除旧的填写值,使用新的填写内容
... ... @@ -102,6 +95,13 @@ func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvalu
if 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.AfterCompletedEvaluationSelf(transactionContext, evaluationData, itemValueList)
if err != nil {
... ... @@ -117,11 +117,11 @@ func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvalu
}, nil
}
// 员工提交自评内容后,
// 员工作为被评估人,
// 变更360评估/人资评估/的开始时间
// 或者变更上级评估的开始时间
// 或者生成考核结果
// 员工提交自评内容后,员工作为被评估人,
// 变更360评估/人资评估/的开始时间 或者变更上级评估的开始时间
// evaluationData 综合自评
// evaluationValue 自评的填写内容
func (srv *SummaryEvaluationService) AfterCompletedEvaluationSelf(
transactionContext application.TransactionContext,
evaluationData *domain.SummaryEvaluation,
... ... @@ -132,29 +132,32 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluationSelf(
})
_, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
"targetUserId": evaluationData.TargetUser.UserId,
"typesList": []int{int(domain.Evaluation360), int(domain.EvaluationHrbp)},
"cycleId": evaluationData.CycleId,
"limit": 1000,
"limit": 500,
})
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())
//查找需要的综合评估
var targetEvaluation []*domain.SummaryEvaluation
// 查找360 或 hrbp 评估
for _, v := range evaluationList {
if v.Types == domain.Evaluation360 || v.Types == domain.EvaluationHrbp {
targetEvaluation = append(targetEvaluation, v)
}
}
//没有360 或 hrbp 评估 ,就查找上级评估
if len(targetEvaluation) == 0 {
for _, v := range evaluationList {
if v.Types == domain.EvaluationSuper {
targetEvaluation = append(targetEvaluation, v)
}
}
}
nowTime := time.Now()
updatedId := []int{}
// 变更360评估/人资评估/上级评估的开始时间
for _, v := range evaluationList {
for _, v := range targetEvaluation {
if v.BeginTime.After(nowTime) {
v.BeginTime = nowTime
updatedId = append(updatedId, v.Id)
... ... @@ -163,39 +166,41 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluationSelf(
evaluationDao := dao.NewSummaryEvaluationDao(map[string]interface{}{
"transactionContext": transactionContext,
})
// 变更360评估/人资评估/上级评估的开始时间
err = evaluationDao.UpdateBeginTime(updatedId, nowTime)
if err != nil {
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if len(evaluationList) == 0 {
var evaluationFinish *domain.SummaryEvaluation
//查找综合评估结果
for _, v := range evaluationList {
if v.Types == domain.EvaluationFinish {
evaluationFinish = v
break
}
}
if len(targetEvaluation) == 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 evaluationFinish != nil {
//进入考核结果
//自评的结束时间
if evaluationFinishList[0].BeginTime.After(nowTime) {
evaluationFinishList[0].BeginTime = nowTime
if evaluationFinish.BeginTime.After(nowTime) {
evaluationFinish.BeginTime = nowTime
}
evaluationFinishList[0].Status = domain.EvaluationCompleted
err = evaluationRepo.Save(evaluationFinishList[0])
evaluationFinish.Status = domain.EvaluationCompleted
err = evaluationRepo.Save(evaluationFinish)
if err != nil {
return application.ThrowError(application.INTERNAL_SERVER_ERROR, "保存考核结果,"+err.Error())
}
//添加确认绩效成绩提醒短信提醒
err = notify.AddNotifyConfirmEvaluationScore(evaluationFinishList[0])
err = notify.AddNotifyConfirmEvaluationScore(evaluationFinish)
if err != nil {
return application.ThrowError(application.TRANSACTION_ERROR, "创建短信提醒失败"+err.Error())
}
}
}
return nil
}
... ...
... ... @@ -10,7 +10,6 @@ import (
"github.com/linmadan/egglib-go/core/application"
"github.com/linmadan/egglib-go/utils/tool_funs"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/notify"
roleService "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/role"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/summary_evaluation/adapter"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/summary_evaluation/command"
... ... @@ -684,107 +683,107 @@ func (srv *SummaryEvaluationService) getSummaryEvaluation(transactionContext app
// 提交员工的人资评估 或者 360 评估
// 变更上级评估的开始时间
// 或者生成考核结果
func (srv *SummaryEvaluationService) AfterCompletedEvaluation360Hrbp(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()
}()
// func (srv *SummaryEvaluationService) AfterCompletedEvaluation360Hrbp(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,
})
_, evaluation360HrbList, 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())
}
allCompleted := true
for _, v := range evaluation360HrbList {
if v.Status == domain.EvaluationUncompleted {
allCompleted = false
break
}
}
if !allCompleted {
return nil
}
_, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
"targetUserId": param.TargetUser.UserId,
"typesList": []int{int(domain.EvaluationSuper)},
"cycleId": param.CycleId,
"limit": 1,
})
if err != nil {
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
nowTime := time.Now()
updatedId := []int{}
// 变更上级评估的开始时间
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 {
//没有上级评估
//直接进入考核结果阶段
_, 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())
}
}
// evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{
// "transactionContext": transactionContext,
// })
// _, evaluation360HrbList, 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())
// }
// allCompleted := true
// for _, v := range evaluation360HrbList {
// if v.Status == domain.EvaluationUncompleted {
// allCompleted = false
// break
// }
// }
// if !allCompleted {
// return nil
// }
// _, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
// "targetUserId": param.TargetUser.UserId,
// "typesList": []int{int(domain.EvaluationSuper)},
// "cycleId": param.CycleId,
// "limit": 1,
// })
// if err != nil {
// return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
// }
// nowTime := time.Now()
// updatedId := []int{}
// // 变更上级评估的开始时间
// 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 {
// //没有上级评估
// //直接进入考核结果阶段
// _, 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
}
// }
// if err := transactionContext.CommitTransaction(); err != nil {
// return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
// }
// return nil
// }
// // 员工提交上级评估后
// // 生成考核结果
... ...
... ... @@ -14,7 +14,6 @@ import (
"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"
)
// Evaluation360List 获取360综评列表
... ... @@ -337,108 +336,108 @@ func (srv *SummaryEvaluationService) GetEvaluation360Complete(param *command.Que
}
// EditEvaluation360 编辑提交360综评
func (srv *SummaryEvaluationService) EditEvaluation360(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})
summaryEvaluation, err := evaluationRepo.FindOne(map[string]interface{}{"id": param.SummaryEvaluationId})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if summaryEvaluation.Executor.UserId != param.ExecutorId {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限")
}
if summaryEvaluation.CompanyId != param.CompanyId {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限")
}
_, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
"targetUserId": summaryEvaluation.TargetUser.UserId,
"typesList": []int{int(domain.EvaluationFinish)},
"cycleId": summaryEvaluation.CycleId,
"limit": 1,
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
// 如果目标员工已经确认考核结果,就不能在进行评估编辑
if len(evaluationList) > 0 && evaluationList[0].CheckResult == domain.EvaluationCheckCompleted {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "用户已经确认该周期的考核结果,不能再编辑!")
}
// 自评评估内容(自评模板、筛选项目评估人)
_, itemList, err := itemUsedRepo.Find(map[string]interface{}{
"evaluationProjectId": summaryEvaluation.EvaluationProjectId,
"nodeType": domain.LinkNodeSelfAssessment,
"evaluatorId": param.ExecutorId,
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
// 评估内容对应的分数
_, itemValueList, err := itemValueRepo.Find(map[string]interface{}{"summaryEvaluationId": summaryEvaluation.Id})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
err = srv.editEvaluationValue(summaryEvaluation, &itemValueList, itemList, param.EvaluationItems, nil, param.IsTemporary)
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
if !param.IsTemporary {
//变更评估状态为已填写
summaryEvaluation.Status = domain.EvaluationCompleted
}
//保存填写值
for _, v := range itemValueList {
err = itemValueRepo.Save(v)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
}
//保存填写值
err = evaluationRepo.Save(summaryEvaluation)
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.AfterCompletedEvaluation360Hrbp(summaryEvaluation)
if err != nil {
return nil, err
}
}
itemValueAdapter := srv.buildSummaryItemValue(itemList, itemValueList)
return map[string][]adapter.EvaluationItemAdapter{
"evaluationItems": itemValueAdapter,
}, nil
}
// func (srv *SummaryEvaluationService) EditEvaluation360(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})
// summaryEvaluation, err := evaluationRepo.FindOne(map[string]interface{}{"id": param.SummaryEvaluationId})
// if err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
// }
// if summaryEvaluation.Executor.UserId != param.ExecutorId {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限")
// }
// if summaryEvaluation.CompanyId != param.CompanyId {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限")
// }
// _, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
// "targetUserId": summaryEvaluation.TargetUser.UserId,
// "typesList": []int{int(domain.EvaluationFinish)},
// "cycleId": summaryEvaluation.CycleId,
// "limit": 1,
// })
// if err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
// }
// // 如果目标员工已经确认考核结果,就不能在进行评估编辑
// if len(evaluationList) > 0 && evaluationList[0].CheckResult == domain.EvaluationCheckCompleted {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "用户已经确认该周期的考核结果,不能再编辑!")
// }
// // 自评评估内容(自评模板、筛选项目评估人)
// _, itemList, err := itemUsedRepo.Find(map[string]interface{}{
// "evaluationProjectId": summaryEvaluation.EvaluationProjectId,
// "nodeType": domain.LinkNodeSelfAssessment,
// "evaluatorId": param.ExecutorId,
// })
// if err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
// }
// // 评估内容对应的分数
// _, itemValueList, err := itemValueRepo.Find(map[string]interface{}{"summaryEvaluationId": summaryEvaluation.Id})
// if err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
// }
// err = srv.editEvaluationValue(summaryEvaluation, &itemValueList, itemList, param.EvaluationItems, nil, param.IsTemporary)
// if err != nil {
// return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
// }
// if !param.IsTemporary {
// //变更评估状态为已填写
// summaryEvaluation.Status = domain.EvaluationCompleted
// }
// //保存填写值
// for _, v := range itemValueList {
// err = itemValueRepo.Save(v)
// if err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
// }
// }
// //保存填写值
// err = evaluationRepo.Save(summaryEvaluation)
// 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.AfterCompletedEvaluation360Hrbp(summaryEvaluation)
// if err != nil {
// return nil, err
// }
// }
// itemValueAdapter := srv.buildSummaryItemValue(itemList, itemValueList)
// return map[string][]adapter.EvaluationItemAdapter{
// "evaluationItems": itemValueAdapter,
// }, nil
// }
// EvaluationHRBPList 获取人资综评列表
func (srv *SummaryEvaluationService) EvaluationHRBPList(param *command.QueryEvaluationHRList) (map[string]interface{}, error) {
... ... @@ -726,128 +725,128 @@ func (srv *SummaryEvaluationService) GetEvaluationHRBPComplete(param *command.Qu
}
// EditEvaluationHRBP 编辑提交人资综评
func (srv *SummaryEvaluationService) EditEvaluationHRBP(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()
}()
userRepo := factory.CreateUserRepository(map[string]interface{}{"transactionContext": transactionContext})
evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{"transactionContext": transactionContext})
itemUsedRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{"transactionContext": transactionContext})
itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{"transactionContext": transactionContext})
// 必须是HRBP权限的人才能编辑操作
hrbp, err := roleService.GetHrBp(transactionContext, param.CompanyId, param.ExecutorId)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if hrbp != domain.RoleTypeSystem {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限")
}
summaryEvaluation, err := evaluationRepo.FindOne(map[string]interface{}{"id": param.SummaryEvaluationId})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if summaryEvaluation.Types != domain.EvaluationHrbp {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限")
}
if summaryEvaluation.CompanyId != param.CompanyId {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限")
}
_, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
"targetUserId": summaryEvaluation.TargetUser.UserId,
"typesList": []int{int(domain.EvaluationFinish)},
"cycleId": summaryEvaluation.CycleId,
"limit": 1,
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
// 如果目标员工已经确认考核结果,就不能在进行评估编辑
if len(evaluationList) > 0 && evaluationList[0].CheckResult == domain.EvaluationCheckCompleted {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "用户已经确认该周期的考核结果,不能再编辑!")
}
// 自评评估内容(自评模板、筛选项目评估人)
_, itemList, err := itemUsedRepo.Find(map[string]interface{}{
"evaluationProjectId": summaryEvaluation.EvaluationProjectId,
"nodeType": domain.LinkNodeSelfAssessment,
"evaluatorId": -1,
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
// 评估内容对应的分数
_, itemValueList, err := itemValueRepo.Find(map[string]interface{}{"summaryEvaluationId": summaryEvaluation.Id})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
err = srv.editEvaluationValue(summaryEvaluation, &itemValueList, itemList, param.EvaluationItems, nil, param.IsTemporary)
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
if !param.IsTemporary {
//变更评估状态为已填写
summaryEvaluation.Status = domain.EvaluationCompleted
}
//保存填写值
for _, v := range itemValueList {
err = itemValueRepo.Save(v)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
}
// 针对HRBP类型,更新最后一次操作的HRBP人
user, err := userRepo.FindOne(map[string]interface{}{"id": param.ExecutorId})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
summaryEvaluation.Executor.UserId = param.ExecutorId
summaryEvaluation.Executor.Account = user.Account
summaryEvaluation.Executor.UserName = user.Name
summaryEvaluation.Executor.CompanyName = "" // 暂时无用
summaryEvaluation.Status = domain.EvaluationCompleted
//保存填写值
err = evaluationRepo.Save(summaryEvaluation)
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.AfterCompletedEvaluation360Hrbp(summaryEvaluation)
if err != nil {
return nil, err
}
}
itemValueAdapter := srv.buildSummaryItemValue(itemList, itemValueList)
return map[string][]adapter.EvaluationItemAdapter{
"evaluationItems": itemValueAdapter,
}, nil
}
// func (srv *SummaryEvaluationService) EditEvaluationHRBP(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()
// }()
// userRepo := factory.CreateUserRepository(map[string]interface{}{"transactionContext": transactionContext})
// evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{"transactionContext": transactionContext})
// itemUsedRepo := factory.CreateEvaluationItemUsedRepository(map[string]interface{}{"transactionContext": transactionContext})
// itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{"transactionContext": transactionContext})
// // 必须是HRBP权限的人才能编辑操作
// hrbp, err := roleService.GetHrBp(transactionContext, param.CompanyId, param.ExecutorId)
// if err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
// }
// if hrbp != domain.RoleTypeSystem {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限")
// }
// summaryEvaluation, err := evaluationRepo.FindOne(map[string]interface{}{"id": param.SummaryEvaluationId})
// if err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
// }
// if summaryEvaluation.Types != domain.EvaluationHrbp {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限")
// }
// if summaryEvaluation.CompanyId != param.CompanyId {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有操作权限")
// }
// _, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
// "targetUserId": summaryEvaluation.TargetUser.UserId,
// "typesList": []int{int(domain.EvaluationFinish)},
// "cycleId": summaryEvaluation.CycleId,
// "limit": 1,
// })
// if err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
// }
// // 如果目标员工已经确认考核结果,就不能在进行评估编辑
// if len(evaluationList) > 0 && evaluationList[0].CheckResult == domain.EvaluationCheckCompleted {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "用户已经确认该周期的考核结果,不能再编辑!")
// }
// // 自评评估内容(自评模板、筛选项目评估人)
// _, itemList, err := itemUsedRepo.Find(map[string]interface{}{
// "evaluationProjectId": summaryEvaluation.EvaluationProjectId,
// "nodeType": domain.LinkNodeSelfAssessment,
// "evaluatorId": -1,
// })
// if err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
// }
// // 评估内容对应的分数
// _, itemValueList, err := itemValueRepo.Find(map[string]interface{}{"summaryEvaluationId": summaryEvaluation.Id})
// if err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
// }
// err = srv.editEvaluationValue(summaryEvaluation, &itemValueList, itemList, param.EvaluationItems, nil, param.IsTemporary)
// if err != nil {
// return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
// }
// if !param.IsTemporary {
// //变更评估状态为已填写
// summaryEvaluation.Status = domain.EvaluationCompleted
// }
// //保存填写值
// for _, v := range itemValueList {
// err = itemValueRepo.Save(v)
// if err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
// }
// }
// // 针对HRBP类型,更新最后一次操作的HRBP人
// user, err := userRepo.FindOne(map[string]interface{}{"id": param.ExecutorId})
// if err != nil {
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
// }
// summaryEvaluation.Executor.UserId = param.ExecutorId
// summaryEvaluation.Executor.Account = user.Account
// summaryEvaluation.Executor.UserName = user.Name
// summaryEvaluation.Executor.CompanyName = "" // 暂时无用
// summaryEvaluation.Status = domain.EvaluationCompleted
// //保存填写值
// err = evaluationRepo.Save(summaryEvaluation)
// 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.AfterCompletedEvaluation360Hrbp(summaryEvaluation)
// if err != nil {
// return nil, err
// }
// }
// itemValueAdapter := srv.buildSummaryItemValue(itemList, itemValueList)
// return map[string][]adapter.EvaluationItemAdapter{
// "evaluationItems": itemValueAdapter,
// }, nil
// }
// 修改周期考核的分数
func (srv *SummaryEvaluationService) ModifyFinishScore(param *command.ModifyFinishScore) error {
... ...