...
|
...
|
@@ -111,7 +111,7 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri |
|
|
|
|
|
var cntAll360 int
|
|
|
var cntUncompleted360 int
|
|
|
//查找360评估,统计未完成的
|
|
|
//查找360评估,统计全部的
|
|
|
cntAll360, _, err = evaluationRepo.Find(map[string]interface{}{
|
|
|
"types": int(domain.Evaluation360),
|
|
|
"executorId": param.UserId,
|
...
|
...
|
@@ -140,7 +140,7 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri |
|
|
var cntAllSuper int
|
|
|
var cntUncompletedSuper int
|
|
|
|
|
|
//查询需要执行上级评估,统计未完成
|
|
|
//查询需要执行上级评估,全部的
|
|
|
cntAllSuper, _, err = evaluationRepo.Find(map[string]interface{}{
|
|
|
"types": int(domain.EvaluationSuper),
|
|
|
"executorId": param.UserId,
|
...
|
...
|
@@ -169,7 +169,7 @@ func (srv *SummaryEvaluationService) GetMenu(param *command.QueryMenu) (map[stri |
|
|
var cntAllHrbp int
|
|
|
var cntUncompletedHrbp int
|
|
|
|
|
|
//查询需要执行人资评估,统计未完成
|
|
|
//查询需要执行人资评估,全部的
|
|
|
cntAllHrbp, _, err = evaluationRepo.Find(map[string]interface{}{
|
|
|
"types": int(domain.EvaluationHrbp),
|
|
|
"limit": 1,
|
...
|
...
|
@@ -555,14 +555,7 @@ func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvalu |
|
|
}
|
|
|
}
|
|
|
if !param.IsTemporary {
|
|
|
if evaluationData.Status == domain.EvaluationUncompleted {
|
|
|
err = srv.AfterCompletedEvaluationSelf(transactionContext, evaluationData)
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
}
|
|
|
evaluationData.Status = domain.EvaluationCompleted
|
|
|
|
|
|
}
|
|
|
err = evaluationRepo.Save(evaluationData)
|
|
|
if err != nil {
|
...
|
...
|
@@ -571,6 +564,13 @@ func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvalu |
|
|
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,
|
...
|
...
|
@@ -580,7 +580,17 @@ func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvalu |
|
|
// 员工提交自评内容后,
|
|
|
// 员工作为被评估人,
|
|
|
// 变更360评估/人资评估/的开始时间
|
|
|
func (srv *SummaryEvaluationService) AfterCompletedEvaluationSelf(transactionContext application.TransactionContext, param *domain.SummaryEvaluation) error {
|
|
|
func (srv *SummaryEvaluationService) AfterCompletedEvaluationSelf(param *domain.SummaryEvaluation) error {
|
|
|
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,
|
|
|
})
|
...
|
...
|
@@ -593,20 +603,37 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluationSelf(transactionCon |
|
|
if err != nil {
|
|
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
nowTime := time.Now()
|
|
|
// 变更360评估/人资评估/上级评估的开始时间
|
|
|
for _, v := range evaluationList {
|
|
|
v.BeginTime = time.Now()
|
|
|
if v.BeginTime.After(nowTime) {
|
|
|
v.BeginTime = nowTime
|
|
|
}
|
|
|
err = evaluationRepo.Save(v)
|
|
|
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
|
|
|
}
|
|
|
|
|
|
// 被评估员工的人资评估 或者 360 评估,
|
|
|
// 变更上级评估的开始时间
|
|
|
func (srv *SummaryEvaluationService) AfterCompletedEvaluation360Hrbp(transactionContext application.TransactionContext, param *domain.SummaryEvaluation) error {
|
|
|
func (srv *SummaryEvaluationService) AfterCompletedEvaluation360Hrbp(param *domain.SummaryEvaluation) error {
|
|
|
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,
|
|
|
})
|
...
|
...
|
@@ -638,14 +665,20 @@ func (srv *SummaryEvaluationService) AfterCompletedEvaluation360Hrbp(transaction |
|
|
if err != nil {
|
|
|
return application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
nowTime := time.Now()
|
|
|
// 变更上级评估的开始时间
|
|
|
for _, v := range evaluationList {
|
|
|
v.BeginTime = time.Now()
|
|
|
if v.BeginTime.After(nowTime) {
|
|
|
v.BeginTime = nowTime
|
|
|
}
|
|
|
err = evaluationRepo.Save(v)
|
|
|
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
|
|
|
}
|
|
|
|
...
|
...
|
|