正在显示
6 个修改的文件
包含
78 行增加
和
2 行删除
@@ -490,7 +490,14 @@ func (srv *SummaryEvaluationService) getSummaryEvaluation(transactionContext app | @@ -490,7 +490,14 @@ func (srv *SummaryEvaluationService) getSummaryEvaluation(transactionContext app | ||
490 | 490 | ||
491 | // 编辑综合自评详情 | 491 | // 编辑综合自评详情 |
492 | func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvaluationValue) (map[string][]adapter.EvaluationItemAdapter, error) { | 492 | func (srv *SummaryEvaluationService) EditEvaluationSelf(param *command.EditEvaluationValue) (map[string][]adapter.EvaluationItemAdapter, error) { |
493 | - | 493 | + lock := xredis.NewLockSummaryEvaluationId(param.SummaryEvaluationId) |
494 | + err := lock.Lock() | ||
495 | + if err != nil { | ||
496 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "未能完全提交评估内容") | ||
497 | + } | ||
498 | + defer func() { | ||
499 | + lock.UnLock() | ||
500 | + }() | ||
494 | transactionContext, err := factory.CreateTransactionContext(nil) | 501 | transactionContext, err := factory.CreateTransactionContext(nil) |
495 | if err != nil { | 502 | if err != nil { |
496 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 503 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
@@ -1091,6 +1098,14 @@ func (srv *SummaryEvaluationService) GetEvaluationSuper(param *command.QueryEval | @@ -1091,6 +1098,14 @@ func (srv *SummaryEvaluationService) GetEvaluationSuper(param *command.QueryEval | ||
1091 | 1098 | ||
1092 | // EditEvaluationSuper 更新上级评估内容 | 1099 | // EditEvaluationSuper 更新上级评估内容 |
1093 | func (srv *SummaryEvaluationService) EditEvaluationSuper(param *command.EditEvaluationValue) (interface{}, error) { | 1100 | func (srv *SummaryEvaluationService) EditEvaluationSuper(param *command.EditEvaluationValue) (interface{}, error) { |
1101 | + lock := xredis.NewLockSummaryEvaluationId(param.SummaryEvaluationId) | ||
1102 | + err := lock.Lock() | ||
1103 | + if err != nil { | ||
1104 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "未能完全提交评估内容") | ||
1105 | + } | ||
1106 | + defer func() { | ||
1107 | + lock.UnLock() | ||
1108 | + }() | ||
1094 | transactionContext, err := factory.CreateTransactionContext(nil) | 1109 | transactionContext, err := factory.CreateTransactionContext(nil) |
1095 | if err != nil { | 1110 | if err != nil { |
1096 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 1111 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
@@ -14,6 +14,7 @@ import ( | @@ -14,6 +14,7 @@ import ( | ||
14 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/summary_evaluation/command" | 14 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/summary_evaluation/command" |
15 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" | 15 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" |
16 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/dao" | 16 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/dao" |
17 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/xredis" | ||
17 | ) | 18 | ) |
18 | 19 | ||
19 | // Evaluation360List 获取360综评列表 | 20 | // Evaluation360List 获取360综评列表 |
@@ -337,6 +338,14 @@ func (srv *SummaryEvaluationService) GetEvaluation360Complete(param *command.Que | @@ -337,6 +338,14 @@ func (srv *SummaryEvaluationService) GetEvaluation360Complete(param *command.Que | ||
337 | 338 | ||
338 | // EditEvaluation360 编辑提交360综评 | 339 | // EditEvaluation360 编辑提交360综评 |
339 | func (srv *SummaryEvaluationService) EditEvaluation360(param *command.EditEvaluationValue) (map[string][]adapter.EvaluationItemAdapter, error) { | 340 | func (srv *SummaryEvaluationService) EditEvaluation360(param *command.EditEvaluationValue) (map[string][]adapter.EvaluationItemAdapter, error) { |
341 | + lock := xredis.NewLockSummaryEvaluationId(param.SummaryEvaluationId) | ||
342 | + err := lock.Lock() | ||
343 | + if err != nil { | ||
344 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "未能完全提交评估内容") | ||
345 | + } | ||
346 | + defer func() { | ||
347 | + lock.UnLock() | ||
348 | + }() | ||
340 | transactionContext, err := factory.CreateTransactionContext(nil) | 349 | transactionContext, err := factory.CreateTransactionContext(nil) |
341 | if err != nil { | 350 | if err != nil { |
342 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 351 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
@@ -704,6 +713,14 @@ func (srv *SummaryEvaluationService) GetEvaluationHRBPComplete(param *command.Qu | @@ -704,6 +713,14 @@ func (srv *SummaryEvaluationService) GetEvaluationHRBPComplete(param *command.Qu | ||
704 | 713 | ||
705 | // EditEvaluationHRBP 编辑提交人资综评 | 714 | // EditEvaluationHRBP 编辑提交人资综评 |
706 | func (srv *SummaryEvaluationService) EditEvaluationHRBP(param *command.EditEvaluationValue) (map[string][]adapter.EvaluationItemAdapter, error) { | 715 | func (srv *SummaryEvaluationService) EditEvaluationHRBP(param *command.EditEvaluationValue) (map[string][]adapter.EvaluationItemAdapter, error) { |
716 | + lock := xredis.NewLockSummaryEvaluationId(param.SummaryEvaluationId) | ||
717 | + err := lock.Lock() | ||
718 | + if err != nil { | ||
719 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "未能完全提交评估内容") | ||
720 | + } | ||
721 | + defer func() { | ||
722 | + lock.UnLock() | ||
723 | + }() | ||
707 | transactionContext, err := factory.CreateTransactionContext(nil) | 724 | transactionContext, err := factory.CreateTransactionContext(nil) |
708 | if err != nil { | 725 | if err != nil { |
709 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 726 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
pkg/domain/task.go
0 → 100644
pkg/domain/task_stage.go
0 → 100644
1 | +package domain |
@@ -11,7 +11,7 @@ type LockSummaryEvaluation struct { | @@ -11,7 +11,7 @@ type LockSummaryEvaluation struct { | ||
11 | } | 11 | } |
12 | 12 | ||
13 | func NewLockSummaryEvaluation(targetUserId int) *LockSummaryEvaluation { | 13 | func NewLockSummaryEvaluation(targetUserId int) *LockSummaryEvaluation { |
14 | - key := fmt.Sprintf("performance:summary_evaluation:%d", targetUserId) | 14 | + key := fmt.Sprintf("performance:summary_evaluation_targetuser:%d", targetUserId) |
15 | 15 | ||
16 | return &LockSummaryEvaluation{ | 16 | return &LockSummaryEvaluation{ |
17 | m: rsync.NewMutex(key), | 17 | m: rsync.NewMutex(key), |
@@ -25,3 +25,22 @@ func (lk *LockSummaryEvaluation) Lock() error { | @@ -25,3 +25,22 @@ func (lk *LockSummaryEvaluation) Lock() error { | ||
25 | func (lk *LockSummaryEvaluation) UnLock() (bool, error) { | 25 | func (lk *LockSummaryEvaluation) UnLock() (bool, error) { |
26 | return lk.m.Unlock() | 26 | return lk.m.Unlock() |
27 | } | 27 | } |
28 | + | ||
29 | +type LockSummaryEvaluationId struct { | ||
30 | + m *redsync.Mutex | ||
31 | +} | ||
32 | + | ||
33 | +func NewLockSummaryEvaluationId(summaryEvaluationId int) *LockSummaryEvaluation { | ||
34 | + key := fmt.Sprintf("performance:summary_evaluation_id:%d", summaryEvaluationId) | ||
35 | + return &LockSummaryEvaluation{ | ||
36 | + m: rsync.NewMutex(key), | ||
37 | + } | ||
38 | +} | ||
39 | + | ||
40 | +func (lk *LockSummaryEvaluationId) Lock() error { | ||
41 | + return lk.m.Lock() | ||
42 | +} | ||
43 | + | ||
44 | +func (lk *LockSummaryEvaluationId) UnLock() (bool, error) { | ||
45 | + return lk.m.Unlock() | ||
46 | +} |
sql/2023-04-11.sql
0 → 100644
1 | +-- 清理重复的数 | ||
2 | +DELETE FROM summary_evaluation_value | ||
3 | +WHERE id IN (1720, 1721, 1708, 1723, 1724, 1711, 1712, 1727, 1728, 1715, 1730, 1717, 1732, 1719); | ||
4 | + | ||
5 | +DELETE FROM summary_evaluation_value | ||
6 | +WHERE id IN (2299, 2302, 2303, 2304, 2309, 2308, 2313, 2312, 2314, 2316, 2318, 2322, 2324, 2325); | ||
7 | + |
-
请 注册 或 登录 后发表评论