...
|
...
|
@@ -10,6 +10,7 @@ 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"
|
...
|
...
|
@@ -647,7 +648,7 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluationSelf(param *domain. |
|
|
if len(evaluationList) == 0 {
|
|
|
//没有上级评估、360评估、hrbp 评估
|
|
|
//直接进入考核结果阶段
|
|
|
_, evaluationList, err = evaluationRepo.Find(map[string]interface{}{
|
|
|
_, evaluationFinishList, err := evaluationRepo.Find(map[string]interface{}{
|
|
|
"targetUserId": param.TargetUser.UserId,
|
|
|
"typesList": []int{int(domain.EvaluationFinish)},
|
|
|
"cycleId": param.CycleId,
|
...
|
...
|
@@ -656,12 +657,14 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluationSelf(param *domain. |
|
|
if err != nil {
|
|
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if len(evaluationList) > 0 {
|
|
|
if len(evaluationFinishList) > 0 {
|
|
|
//进入考核结果
|
|
|
//自评的结束时间
|
|
|
evaluationList[0].BeginTime = param.EndTime
|
|
|
evaluationList[0].Status = domain.EvaluationCompleted
|
|
|
err = evaluationRepo.Save(evaluationList[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())
|
|
|
}
|
...
|
...
|
@@ -746,7 +749,7 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluation360Hrbp(param *doma |
|
|
if len(evaluationList) == 0 {
|
|
|
//没有上级评估
|
|
|
//直接进入考核结果阶段
|
|
|
_, evaluationList, err = evaluationRepo.Find(map[string]interface{}{
|
|
|
_, evaluationFinishList, err := evaluationRepo.Find(map[string]interface{}{
|
|
|
"targetUserId": param.TargetUser.UserId,
|
|
|
"typesList": []int{int(domain.EvaluationFinish)},
|
|
|
"cycleId": param.CycleId,
|
...
|
...
|
@@ -755,11 +758,12 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluation360Hrbp(param *doma |
|
|
if err != nil {
|
|
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if len(evaluationList) > 0 {
|
|
|
//360评估的结束时间
|
|
|
evaluationList[0].BeginTime = param.EndTime
|
|
|
evaluationList[0].Status = domain.EvaluationCompleted
|
|
|
err = evaluationRepo.Save(evaluationList[0])
|
|
|
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())
|
|
|
}
|
...
|
...
|
@@ -810,16 +814,26 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluationSuper(param *domain |
|
|
|
|
|
if len(evaluationList) > 0 {
|
|
|
//上级评估的结束时间
|
|
|
evaluationList[0].BeginTime = param.EndTime
|
|
|
// evaluationList[0].BeginTime = param.EndTime
|
|
|
nowTime := time.Now()
|
|
|
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())
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
//添加确认绩效成绩提醒短信提醒
|
|
|
err = notify.AddNotifyConfirmEvaluationScore(param)
|
|
|
if err != nil {
|
|
|
return application.ThrowError(application.TRANSACTION_ERROR, "创建短信提醒失败"+err.Error())
|
|
|
}
|
|
|
return nil
|
|
|
}
|
|
|
|
...
|
...
|
@@ -907,7 +921,7 @@ func (srv *SummaryEvaluationService) CountEvaluationSelfLevel(param *command.Que |
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if len(evaluationList) == 0 {
|
|
|
return nil, nil
|
|
|
return &adapter.EvaluationInfoCountCodeAdapter{}, nil
|
|
|
}
|
|
|
evaluationData := evaluationList[0]
|
|
|
levelCodeCountList, err := assessDao.CountAssessContentLevelCode(evaluationData.EvaluationProjectId, param.TargetUserId, domain.AssessSelf, param.CycleId)
|
...
|
...
|
@@ -1007,22 +1021,21 @@ func (srv *SummaryEvaluationService) GetEvaluationSuper(param *command.QueryEval |
|
|
itemValueRepo := factory.CreateSummaryEvaluationValueRepository(map[string]interface{}{
|
|
|
"transactionContext": transactionContext,
|
|
|
})
|
|
|
// permissionRepository := factory.CreatePermissionRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
// 获取权限配置
|
|
|
// _, permissionList, err := permissionRepository.Find(map[string]interface{}{"companyId": param.CompanyId})
|
|
|
// if err != nil {
|
|
|
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
// }
|
|
|
|
|
|
permissinData, err := getPermission(int64(param.CompanyId))
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
evaluationData, err := evaluationRepo.FindOne(map[string]interface{}{
|
|
|
"id": param.SummaryEvaluationId,
|
|
|
_, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
|
|
|
"id": []int{param.SummaryEvaluationId},
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if len(evaluationList) == 0 {
|
|
|
return &adapter.EvaluationInfoSuperAdapter{}, nil
|
|
|
}
|
|
|
evaluationData := evaluationList[0]
|
|
|
if evaluationData.Types != domain.EvaluationSuper {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, "没有操作权限")
|
|
|
}
|
...
|
...
|
@@ -1113,10 +1126,22 @@ func (srv *SummaryEvaluationService) GetEvaluationSuperForAdmin(param *command.Q |
|
|
evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{"transactionContext": transactionContext})
|
|
|
evaluationItemRepo := 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})
|
|
|
// evaluationData, err := evaluationRepo.FindOne(map[string]interface{}{"id": param.SummaryEvaluationId})
|
|
|
// if err != nil {
|
|
|
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
// }
|
|
|
|
|
|
_, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
|
|
|
"id": []int{param.SummaryEvaluationId},
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
if len(evaluationList) == 0 {
|
|
|
return &adapter.EvaluationInfoSuperAdapter{}, nil
|
|
|
}
|
|
|
evaluationData := evaluationList[0]
|
|
|
|
|
|
if evaluationData.CompanyId != param.CompanyId {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, "没有操作权限")
|
|
|
}
|
...
|
...
|
@@ -1568,6 +1593,7 @@ func (srv *SummaryEvaluationService) ListExecutorEvaluationSuper(param *command. |
|
|
Department: "",
|
|
|
Position: "",
|
|
|
EntryTime: "",
|
|
|
TotalScoreSuper: v.TotalScore,
|
|
|
}
|
|
|
for _, dep := range v.TargetDepartment {
|
|
|
item.Department += dep.DepartmentName + " "
|
...
|
...
|
@@ -1705,10 +1731,12 @@ func (srv *SummaryEvaluationService) ConfirmScoreEvaluation(param *command.Confi |
|
|
for i := range itemList {
|
|
|
result.ResetTotalRating(itemList[i])
|
|
|
}
|
|
|
if err := result.EvaluationTotalScore(itemValues); err != nil {
|
|
|
return application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
//存在 超级管理员直接修改填写 总分的情况,此时不重新计算总分
|
|
|
if result.TotalScore == "0" || result.TotalScore == "" {
|
|
|
if err := result.EvaluationTotalScore(itemValues); err != nil {
|
|
|
return application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
}
|
|
|
|
|
|
result.CheckResult = domain.EvaluationCheckCompleted
|
|
|
if err := evaluationRepo.Save(result); err != nil {
|
|
|
return application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
...
|
...
|
@@ -1791,9 +1819,6 @@ func (srv *SummaryEvaluationService) GetTargetEvaluationResult(param *command.Qu |
|
|
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()
|
|
|
}()
|
...
|
...
|
@@ -1823,10 +1848,12 @@ func (srv *SummaryEvaluationService) GetTargetEvaluationResult(param *command.Qu |
|
|
continue
|
|
|
}
|
|
|
}
|
|
|
// if result == nil {
|
|
|
// return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有找到符合条件的数据")
|
|
|
// }
|
|
|
if result == nil {
|
|
|
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "没有找到符合条件的数据")
|
|
|
return &adapter.EvaluationInfoSuperAdapter{}, nil
|
|
|
}
|
|
|
|
|
|
// 评估内容和值
|
|
|
var itemList []*domain.EvaluationItemUsed
|
|
|
var itemValues []*domain.SummaryEvaluationValue
|
...
|
...
|
@@ -1879,8 +1906,11 @@ func (srv *SummaryEvaluationService) GetTargetEvaluationResult(param *command.Qu |
|
|
for i := range itemList {
|
|
|
result.ResetTotalRating(itemList[i])
|
|
|
}
|
|
|
if err = result.EvaluationTotalScore(itemValues); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
//存在 超级管理员直接修改填写 总分的情况,此时不重新计算总分
|
|
|
if result.TotalScore == "0" || result.TotalScore == "" {
|
|
|
if err = result.EvaluationTotalScore(itemValues); err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
|