正在显示
4 个修改的文件
包含
69 行增加
和
1 行删除
@@ -569,3 +569,58 @@ func (srv *MessagePersonalService) TodayMessageTaskAnomaly(param *command.GetUse | @@ -569,3 +569,58 @@ func (srv *MessagePersonalService) TodayMessageTaskAnomaly(param *command.GetUse | ||
569 | } | 569 | } |
570 | return resp, nil | 570 | return resp, nil |
571 | } | 571 | } |
572 | + | ||
573 | +// 提醒人员去确认周期评估的成绩 | ||
574 | +func (srv *MessagePersonalService) SummaartEvaluationScore(userId int) (msg map[string]interface{}, err error) { | ||
575 | + msg = map[string]interface{}{ | ||
576 | + "needNotify": false, | ||
577 | + "cycleId": "0", | ||
578 | + "cycleName": "", | ||
579 | + "targetUserId": "0", | ||
580 | + "targetUserName": "", | ||
581 | + } | ||
582 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
583 | + if err != nil { | ||
584 | + return msg, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
585 | + } | ||
586 | + if err := transactionContext.StartTransaction(); err != nil { | ||
587 | + return msg, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
588 | + } | ||
589 | + defer func() { | ||
590 | + _ = transactionContext.RollbackTransaction() | ||
591 | + }() | ||
592 | + | ||
593 | + evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{ | ||
594 | + "transactionContext": transactionContext, | ||
595 | + }) | ||
596 | + | ||
597 | + _, evaluationList, err := evaluationRepo.Find(map[string]interface{}{ | ||
598 | + "targetUserId": userId, | ||
599 | + "checkResult": domain.EvaluationCheckUncompleted, | ||
600 | + "types": 5, | ||
601 | + }) | ||
602 | + if err != nil { | ||
603 | + return msg, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
604 | + } | ||
605 | + if len(evaluationList) == 0 { | ||
606 | + return msg, nil | ||
607 | + } | ||
608 | + nowTime := time.Now() | ||
609 | + for _, val := range evaluationList { | ||
610 | + if nowTime.After(val.EndTime) { | ||
611 | + msg = map[string]interface{}{ | ||
612 | + "needNotify": true, | ||
613 | + "cycleId": strconv.FormatInt(val.CycleId, 10), | ||
614 | + "cycleName": val.CycleName, | ||
615 | + "targetUserId": strconv.Itoa(val.TargetUser.UserId), | ||
616 | + "targetUserName": val.TargetUser.UserName, | ||
617 | + } | ||
618 | + break | ||
619 | + } | ||
620 | + } | ||
621 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
622 | + return msg, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
623 | + } | ||
624 | + | ||
625 | + return msg, nil | ||
626 | +} |
@@ -151,6 +151,11 @@ func (repo *SummaryEvaluationRepository) Find(queryOptions map[string]interface{ | @@ -151,6 +151,11 @@ func (repo *SummaryEvaluationRepository) Find(queryOptions map[string]interface{ | ||
151 | if v, ok := queryOptions["status"]; ok { | 151 | if v, ok := queryOptions["status"]; ok { |
152 | query.Where("status=?", v) | 152 | query.Where("status=?", v) |
153 | } | 153 | } |
154 | + | ||
155 | + if v, ok := queryOptions["checkResult"]; ok { | ||
156 | + query.Where("check_result=?", v) | ||
157 | + } | ||
158 | + | ||
154 | if v, ok := queryOptions["targetUserId"]; ok { | 159 | if v, ok := queryOptions["targetUserId"]; ok { |
155 | query.Where(`summary_evaluation.target_user->>'userId'='?'`, v) | 160 | query.Where(`summary_evaluation.target_user->>'userId'='?'`, v) |
156 | } | 161 | } |
@@ -49,3 +49,11 @@ func (c *MessagePersonalController) TodayMessageTaskStageModify() { | @@ -49,3 +49,11 @@ func (c *MessagePersonalController) TodayMessageTaskStageModify() { | ||
49 | data, err := srv.TodayMessageTaskStageModifyV2(¶m) | 49 | data, err := srv.TodayMessageTaskStageModifyV2(¶m) |
50 | c.Response(data, err) | 50 | c.Response(data, err) |
51 | } | 51 | } |
52 | + | ||
53 | +func (c *MessagePersonalController) TodayMessageSummaryEvaluationFinishScore() { | ||
54 | + srv := service.NewMessagePersonalService() | ||
55 | + userReq := middlewares.GetUser(c.Ctx) | ||
56 | + userId := int(userReq.UserId) | ||
57 | + data, err := srv.SummaartEvaluationScore(userId) | ||
58 | + c.Response(data, err) | ||
59 | +} |
@@ -14,7 +14,7 @@ func init() { | @@ -14,7 +14,7 @@ func init() { | ||
14 | web.NSCtrlGet("/summary-evaluation/task_stage/today", (*controllers.MessagePersonalController).TodayMessageTaskStageAnomaly), | 14 | web.NSCtrlGet("/summary-evaluation/task_stage/today", (*controllers.MessagePersonalController).TodayMessageTaskStageAnomaly), |
15 | web.NSCtrlGet("/summary-evaluation/task_record/today", (*controllers.MessagePersonalController).TodayMessageTaskRecordAnomaly), | 15 | web.NSCtrlGet("/summary-evaluation/task_record/today", (*controllers.MessagePersonalController).TodayMessageTaskRecordAnomaly), |
16 | web.NSCtrlGet("/summary-evaluation/task_modify/today", (*controllers.MessagePersonalController).TodayMessageTaskStageModify), | 16 | web.NSCtrlGet("/summary-evaluation/task_modify/today", (*controllers.MessagePersonalController).TodayMessageTaskStageModify), |
17 | - // | 17 | + web.NSCtrlGet("/summary-evaluation-finish/confim-score", (*controllers.MessagePersonalController).TodayMessageSummaryEvaluationFinishScore), |
18 | ) | 18 | ) |
19 | web.AddNamespace(ns) | 19 | web.AddNamespace(ns) |
20 | } | 20 | } |
-
请 注册 或 登录 后发表评论