正在显示
5 个修改的文件
包含
106 行增加
和
2 行删除
| 1 | +package adapter | ||
| 2 | + | ||
| 3 | +type EvaluationSuperListAdapter struct { | ||
| 4 | + SummaryEvaluationId int `json:"summaryEvaluationId,string"` //评估任务id | ||
| 5 | + TargetUserName string `json:"targetUserName"` //目标用户,被评估的员工 | ||
| 6 | + EvaluationStatus string `json:"evaluationStatus"` //上级评估完成状态 | ||
| 7 | + EndTime string `json:"endTime"` //截止时间 | ||
| 8 | + TotalScoreSelf string `json:"totalScoreSelf"` //综合自评总分 | ||
| 9 | + Department string `json:"department"` //部门 | ||
| 10 | + Position string `json:"position"` //职位 | ||
| 11 | + EntryTime string `json:"entryTime"` //入职时间 | ||
| 12 | +} |
| 1 | +package command | ||
| 2 | + | ||
| 3 | +type QueryEvaluationList struct { | ||
| 4 | + PageNumber int `json:"pageNumber"` | ||
| 5 | + PageSize int `json:"pageSize"` | ||
| 6 | + CycleId int `json:"cycleId,string"` | ||
| 7 | + CompanyId int `json:"companyId"` | ||
| 8 | + ExecutorId int `json:"executorId"` | ||
| 9 | + TargetUsrName string `json:"targetUsrName"` | ||
| 10 | +} |
| @@ -975,3 +975,52 @@ func (srv *SummaryEvaluationService) getEvaluationSuperDefaultValue(transactionC | @@ -975,3 +975,52 @@ func (srv *SummaryEvaluationService) getEvaluationSuperDefaultValue(transactionC | ||
| 975 | } | 975 | } |
| 976 | return result, nil | 976 | return result, nil |
| 977 | } | 977 | } |
| 978 | + | ||
| 979 | +// 获取上级评估的列表 | ||
| 980 | +func (srv *SummaryEvaluationService) ListEvaluationSuper(param *command.QueryEvaluationList) (map[string]interface{}, error) { | ||
| 981 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
| 982 | + if err != nil { | ||
| 983 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 984 | + } | ||
| 985 | + if err := transactionContext.StartTransaction(); err != nil { | ||
| 986 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
| 987 | + } | ||
| 988 | + defer func() { | ||
| 989 | + _ = transactionContext.RollbackTransaction() | ||
| 990 | + }() | ||
| 991 | + evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{ | ||
| 992 | + "transactionContext": transactionContext, | ||
| 993 | + }) | ||
| 994 | + userRepo := factory.CreateUserRepository(map[string]interface{}{ | ||
| 995 | + "transactionContext": transactionContext, | ||
| 996 | + }) | ||
| 997 | + cnt, evaluationList, err := evaluationRepo.Find(map[string]interface{}{ | ||
| 998 | + "cycleId": param.CycleId, | ||
| 999 | + "executorId": param.ExecutorId, | ||
| 1000 | + "types": int(domain.EvaluationSuper), | ||
| 1001 | + }) | ||
| 1002 | + if err != nil { | ||
| 1003 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 1004 | + } | ||
| 1005 | + targetUserIds := []int{} | ||
| 1006 | + for _, v := range evaluationList { | ||
| 1007 | + targetUserIds = append(targetUserIds, v.TargetUser.UserId) | ||
| 1008 | + } | ||
| 1009 | + var userList []*domain.User | ||
| 1010 | + if len(targetUserIds) > 0 { | ||
| 1011 | + _, userList, err = userRepo.Find(map[string]interface{}{ | ||
| 1012 | + "ids": targetUserIds, | ||
| 1013 | + }) | ||
| 1014 | + if err != nil { | ||
| 1015 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 1016 | + } | ||
| 1017 | + } | ||
| 1018 | + | ||
| 1019 | + _ = userList | ||
| 1020 | + _ = evaluationList | ||
| 1021 | + _ = cnt | ||
| 1022 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
| 1023 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
| 1024 | + } | ||
| 1025 | + return nil, nil | ||
| 1026 | +} |
| @@ -174,3 +174,34 @@ func (c *SummaryEvaluationController) EditEvaluationHRBP() { | @@ -174,3 +174,34 @@ func (c *SummaryEvaluationController) EditEvaluationHRBP() { | ||
| 174 | data, err := srv.EditEvaluationHRBP(in) | 174 | data, err := srv.EditEvaluationHRBP(in) |
| 175 | c.Response(data, err) | 175 | c.Response(data, err) |
| 176 | } | 176 | } |
| 177 | + | ||
| 178 | +func (c *SummaryEvaluationController) GetEvaluationSuper() { | ||
| 179 | + srv := service.NewSummaryEvaluationService() | ||
| 180 | + param := &command.QueryEvaluationSuper{} | ||
| 181 | + err := c.BindJSON(param) | ||
| 182 | + if err != nil { | ||
| 183 | + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
| 184 | + c.Response(nil, e) | ||
| 185 | + return | ||
| 186 | + } | ||
| 187 | + userReq := middlewares.GetUser(c.Ctx) | ||
| 188 | + param.CompanyId = int(userReq.CompanyId) | ||
| 189 | + data, err := srv.GetEvaluationSuper(param) | ||
| 190 | + c.Response(data, err) | ||
| 191 | +} | ||
| 192 | + | ||
| 193 | +func (c *SummaryEvaluationController) EditEvaluationSuper() { | ||
| 194 | + srv := service.NewSummaryEvaluationService() | ||
| 195 | + param := &command.EditEvaluationValue{} | ||
| 196 | + err := c.BindJSON(param) | ||
| 197 | + if err != nil { | ||
| 198 | + e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error()) | ||
| 199 | + c.Response(nil, e) | ||
| 200 | + return | ||
| 201 | + } | ||
| 202 | + userReq := middlewares.GetUser(c.Ctx) | ||
| 203 | + param.CompanyId = int(userReq.CompanyId) | ||
| 204 | + param.ExecutorId = int(userReq.UserId) | ||
| 205 | + data, err := srv.EditEvaluationSuper(param) | ||
| 206 | + c.Response(data, err) | ||
| 207 | +} |
| @@ -13,13 +13,15 @@ func init() { | @@ -13,13 +13,15 @@ func init() { | ||
| 13 | web.NSCtrlPost("/executor/cycle/list", (*controllers.SummaryEvaluationController).GetExecutorCycleList), | 13 | web.NSCtrlPost("/executor/cycle/list", (*controllers.SummaryEvaluationController).GetExecutorCycleList), |
| 14 | web.NSCtrlPost("/target_user/cycle/list", (*controllers.SummaryEvaluationController).GetTargetUserCycleList), | 14 | web.NSCtrlPost("/target_user/cycle/list", (*controllers.SummaryEvaluationController).GetTargetUserCycleList), |
| 15 | web.NSCtrlPost("/cycle/menu", (*controllers.SummaryEvaluationController).GetMenu), | 15 | web.NSCtrlPost("/cycle/menu", (*controllers.SummaryEvaluationController).GetMenu), |
| 16 | - web.NSCtrlPost("/self", (*controllers.SummaryEvaluationController).GetEvaluationSelf), | ||
| 17 | - web.NSCtrlPost("/self/edit", (*controllers.SummaryEvaluationController).EditEvaluationSelf), | 16 | + web.NSCtrlPost("/evaluation-self", (*controllers.SummaryEvaluationController).GetEvaluationSelf), |
| 17 | + web.NSCtrlPost("/evaluation-self/edit", (*controllers.SummaryEvaluationController).EditEvaluationSelf), | ||
| 18 | web.NSCtrlPost("/evaluation-360", (*controllers.SummaryEvaluationController).GetEvaluation360), | 18 | web.NSCtrlPost("/evaluation-360", (*controllers.SummaryEvaluationController).GetEvaluation360), |
| 19 | web.NSCtrlPost("/evaluation-360/edit", (*controllers.SummaryEvaluationController).EditEvaluation360), | 19 | web.NSCtrlPost("/evaluation-360/edit", (*controllers.SummaryEvaluationController).EditEvaluation360), |
| 20 | web.NSCtrlPost("/evaluation-hr", (*controllers.SummaryEvaluationController).GetEvaluationHRBP), | 20 | web.NSCtrlPost("/evaluation-hr", (*controllers.SummaryEvaluationController).GetEvaluationHRBP), |
| 21 | web.NSCtrlPost("/evaluation-hr/edit", (*controllers.SummaryEvaluationController).EditEvaluationHRBP), | 21 | web.NSCtrlPost("/evaluation-hr/edit", (*controllers.SummaryEvaluationController).EditEvaluationHRBP), |
| 22 | web.NSCtrlPost("/self/summary", (*controllers.SummaryEvaluationController).CountEvaluationSelfLevel), | 22 | web.NSCtrlPost("/self/summary", (*controllers.SummaryEvaluationController).CountEvaluationSelfLevel), |
| 23 | + web.NSCtrlPost("/evaluation-super", (*controllers.SummaryEvaluationController).GetEvaluationSuper), | ||
| 24 | + web.NSCtrlPost("/evaluation-super/edit", (*controllers.SummaryEvaluationController).EditEvaluationSuper), | ||
| 23 | ) | 25 | ) |
| 24 | web.AddNamespace(summaryNS) | 26 | web.AddNamespace(summaryNS) |
| 25 | } | 27 | } |
-
请 注册 或 登录 后发表评论