正在显示
5 个修改的文件
包含
69 行增加
和
3 行删除
1 | package command | 1 | package command |
2 | 2 | ||
3 | -// 查询执行人的上级评估列表 | 3 | +// 查询执行人的评估列表 |
4 | type QueryExecutorEvaluationList struct { | 4 | type QueryExecutorEvaluationList struct { |
5 | PageNumber int `json:"pageNumber"` | 5 | PageNumber int `json:"pageNumber"` |
6 | PageSize int `json:"pageSize"` | 6 | PageSize int `json:"pageSize"` |
@@ -3,6 +3,7 @@ package service | @@ -3,6 +3,7 @@ package service | ||
3 | import ( | 3 | import ( |
4 | "errors" | 4 | "errors" |
5 | "fmt" | 5 | "fmt" |
6 | + "strconv" | ||
6 | "strings" | 7 | "strings" |
7 | "time" | 8 | "time" |
8 | 9 | ||
@@ -1676,3 +1677,51 @@ func (srv *SummaryEvaluationService) editEvaluationValue( | @@ -1676,3 +1677,51 @@ func (srv *SummaryEvaluationService) editEvaluationValue( | ||
1676 | } | 1677 | } |
1677 | return nil | 1678 | return nil |
1678 | } | 1679 | } |
1680 | + | ||
1681 | +// 获取现在待执行的综合自评 | ||
1682 | +func (srv *SummaryEvaluationService) ListExecutorNowEvaluationSelf(param *command.QueryExecutorEvaluationList) (map[string]interface{}, error) { | ||
1683 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
1684 | + if err != nil { | ||
1685 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
1686 | + } | ||
1687 | + if err := transactionContext.StartTransaction(); err != nil { | ||
1688 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
1689 | + } | ||
1690 | + defer func() { | ||
1691 | + _ = transactionContext.RollbackTransaction() | ||
1692 | + }() | ||
1693 | + evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{ | ||
1694 | + "transactionContext": transactionContext, | ||
1695 | + }) | ||
1696 | + condition1 := map[string]interface{}{ | ||
1697 | + "types": int(domain.EvaluationSelf), | ||
1698 | + "targetUserId": param.ExecutorId, | ||
1699 | + "limit": 20, | ||
1700 | + "beginTime": time.Now(), | ||
1701 | + "endTime": time.Now(), | ||
1702 | + "status": string(domain.EvaluationUncompleted), | ||
1703 | + } | ||
1704 | + //获取评估列表信息 | ||
1705 | + cnt, evaluationList, err := evaluationRepo.Find(condition1) | ||
1706 | + if err != nil { | ||
1707 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
1708 | + } | ||
1709 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
1710 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
1711 | + } | ||
1712 | + | ||
1713 | + listResult := []map[string]string{} | ||
1714 | + for _, v := range evaluationList { | ||
1715 | + item := map[string]string{ | ||
1716 | + "summaryEvaluationId": strconv.Itoa(v.Id), | ||
1717 | + "cycleId": strconv.Itoa(int(v.CycleId)), | ||
1718 | + "cycleName": v.CycleName, | ||
1719 | + "evaluationStatus": string(v.Status), | ||
1720 | + "endTime": v.EndTime.Local().Format("2006-01-02 15:04:05"), | ||
1721 | + "beginTime": v.BeginTime.Local().Format("2006-01-02 15:04:05"), | ||
1722 | + } | ||
1723 | + listResult = append(listResult, item) | ||
1724 | + } | ||
1725 | + result := tool_funs.SimpleWrapGridMap(int64(cnt), listResult) | ||
1726 | + return result, nil | ||
1727 | +} |
@@ -43,7 +43,7 @@ const ( | @@ -43,7 +43,7 @@ const ( | ||
43 | Evaluation360 EvaluationType = 2 //360评估 | 43 | Evaluation360 EvaluationType = 2 //360评估 |
44 | EvaluationSuper EvaluationType = 3 //上级评估 | 44 | EvaluationSuper EvaluationType = 3 //上级评估 |
45 | EvaluationHrbp EvaluationType = 4 //人资评估 | 45 | EvaluationHrbp EvaluationType = 4 //人资评估 |
46 | - EvaluationFinish EvaluationType = 5 //评估考核结果 TODO | 46 | + |
47 | ) | 47 | ) |
48 | 48 | ||
49 | // 评估的填写状态 | 49 | // 评估的填写状态 |
@@ -362,3 +362,20 @@ func (c *SummaryEvaluationController) ExportAllEvaluationSuper() { | @@ -362,3 +362,20 @@ func (c *SummaryEvaluationController) ExportAllEvaluationSuper() { | ||
362 | c.Ctx.Output.Header("Expires", "0") | 362 | c.Ctx.Output.Header("Expires", "0") |
363 | data.Write(c.Ctx.ResponseWriter) | 363 | data.Write(c.Ctx.ResponseWriter) |
364 | } | 364 | } |
365 | + | ||
366 | +// 按周期获取上级评估列表 | ||
367 | +func (c *SummaryEvaluationController) ListExecutorEvaluationSelf() { | ||
368 | + srv := service.NewSummaryEvaluationService() | ||
369 | + param := &command.QueryExecutorEvaluationList{} | ||
370 | + err := c.BindJSON(param) | ||
371 | + if err != nil { | ||
372 | + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
373 | + c.Response(nil, e) | ||
374 | + return | ||
375 | + } | ||
376 | + userReq := middlewares.GetUser(c.Ctx) | ||
377 | + param.CompanyId = int(userReq.CompanyId) | ||
378 | + param.ExecutorId = int(userReq.UserId) | ||
379 | + data, err := srv.ListExecutorNowEvaluationSelf(param) | ||
380 | + c.Response(data, err) | ||
381 | +} |
@@ -31,7 +31,7 @@ func init() { | @@ -31,7 +31,7 @@ func init() { | ||
31 | web.NSCtrlPost("/target_user/evaluation-super", (*controllers.SummaryEvaluationController).GetTargetUserEvaluationSuper), | 31 | web.NSCtrlPost("/target_user/evaluation-super", (*controllers.SummaryEvaluationController).GetTargetUserEvaluationSuper), |
32 | web.NSCtrlPost("/evaluation-super/all", (*controllers.SummaryEvaluationController).ListAllEvaluationSuper), | 32 | web.NSCtrlPost("/evaluation-super/all", (*controllers.SummaryEvaluationController).ListAllEvaluationSuper), |
33 | web.NSCtrlPost("/evaluation-super/all/export", (*controllers.SummaryEvaluationController).ExportAllEvaluationSuper), | 33 | web.NSCtrlPost("/evaluation-super/all/export", (*controllers.SummaryEvaluationController).ExportAllEvaluationSuper), |
34 | - | 34 | + web.NSCtrlPost("/evaluation-self/now", (*controllers.SummaryEvaluationController).ListExecutorEvaluationSelf), |
35 | // | 35 | // |
36 | ) | 36 | ) |
37 | web.AddNamespace(summaryNS) | 37 | web.AddNamespace(summaryNS) |
-
请 注册 或 登录 后发表评论