作者 tangxvhui

添加锁

... ... @@ -9,6 +9,7 @@ import (
roleService "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/role"
"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"
)
// 超管直接修改考核结果分数
... ... @@ -47,6 +48,17 @@ func (srv *SummaryEvaluationService) ModifyFinishScore(param *command.ModifyFini
return nil
}
evaluationFinishData := evaluationList[0]
//按照被评估人id ,加锁
lock := xredis.NewLockSummaryEvaluation(evaluationFinishData.TargetUser.UserId)
err = lock.Lock()
if err != nil {
return application.ThrowError(application.INTERNAL_SERVER_ERROR, "未能完全提交评估内容")
}
defer func() {
lock.UnLock()
}()
if evaluationFinishData.Types != domain.EvaluationFinish {
return nil
}
... ... @@ -91,7 +103,7 @@ func (srv *SummaryEvaluationService) ModifyFinishScore(param *command.ModifyFini
// buildSummaryFinishValue
// 当未能按照id直接查询到考核结果的评估项时,
// 从目标人员的上级评估 或者360评估、人资评估、自评 构建考核结果的评估项内容
// 从目标人员的上级评估 或者360评估、人资评估、自评 构建考核结果
func (srv *SummaryEvaluationService) buildSummaryFinishValue(transactionContext application.TransactionContext, evaluationFinisih *domain.SummaryEvaluation) (
[]*domain.SummaryEvaluationValue, error) {
evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{"transactionContext": transactionContext})
... ...
... ... @@ -24,9 +24,9 @@ func TestField(t *testing.T) {
func TestPushData(t *testing.T) {
nowTime := time.Unix(1688572800, 0)
c := NewClient()
c.Host = "https://character-library-metadata-bastion.sumifcc.com"
c.AppKey = "7q9Kd8ktoB"
c.AppSecret = "pQSoBj44Wk"
c.Host = ""
c.AppKey = ""
c.AppSecret = ""
entry := StaffAssessItem{}
data, err := entry.DataForAppend(nowTime)
if err != nil {
... ...