作者 tangxvhui

上级评估编辑

package adapter
type EvaluationSuperListAdapter struct {
SummaryEvaluationId int `json:"summaryEvaluationId,string"` //评估任务id
TargetUserName string `json:"targetUserName"` //目标用户,被评估的员工
EvaluationStatus string `json:"evaluationStatus"` //上级评估完成状态
EndTime string `json:"endTime"` //截止时间
TotalScoreSelf string `json:"totalScoreSelf"` //综合自评总分
Department string `json:"department"` //部门
Position string `json:"position"` //职位
EntryTime string `json:"entryTime"` //入职时间
}
... ...
package command
type QueryEvaluationList struct {
PageNumber int `json:"pageNumber"`
PageSize int `json:"pageSize"`
CycleId int `json:"cycleId,string"`
CompanyId int `json:"companyId"`
ExecutorId int `json:"executorId"`
TargetUsrName string `json:"targetUsrName"`
}
... ...
... ... @@ -975,3 +975,52 @@ func (srv *SummaryEvaluationService) getEvaluationSuperDefaultValue(transactionC
}
return result, nil
}
// 获取上级评估的列表
func (srv *SummaryEvaluationService) ListEvaluationSuper(param *command.QueryEvaluationList) (map[string]interface{}, error) {
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
if err := transactionContext.StartTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
defer func() {
_ = transactionContext.RollbackTransaction()
}()
evaluationRepo := factory.CreateSummaryEvaluationRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
userRepo := factory.CreateUserRepository(map[string]interface{}{
"transactionContext": transactionContext,
})
cnt, evaluationList, err := evaluationRepo.Find(map[string]interface{}{
"cycleId": param.CycleId,
"executorId": param.ExecutorId,
"types": int(domain.EvaluationSuper),
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
targetUserIds := []int{}
for _, v := range evaluationList {
targetUserIds = append(targetUserIds, v.TargetUser.UserId)
}
var userList []*domain.User
if len(targetUserIds) > 0 {
_, userList, err = userRepo.Find(map[string]interface{}{
"ids": targetUserIds,
})
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
}
_ = userList
_ = evaluationList
_ = cnt
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
return nil, nil
}
... ...
... ... @@ -174,3 +174,34 @@ func (c *SummaryEvaluationController) EditEvaluationHRBP() {
data, err := srv.EditEvaluationHRBP(in)
c.Response(data, err)
}
func (c *SummaryEvaluationController) GetEvaluationSuper() {
srv := service.NewSummaryEvaluationService()
param := &command.QueryEvaluationSuper{}
err := c.BindJSON(param)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
userReq := middlewares.GetUser(c.Ctx)
param.CompanyId = int(userReq.CompanyId)
data, err := srv.GetEvaluationSuper(param)
c.Response(data, err)
}
func (c *SummaryEvaluationController) EditEvaluationSuper() {
srv := service.NewSummaryEvaluationService()
param := &command.EditEvaluationValue{}
err := c.BindJSON(param)
if err != nil {
e := application.ThrowError(application.ARG_ERROR, "json 解析错误"+err.Error())
c.Response(nil, e)
return
}
userReq := middlewares.GetUser(c.Ctx)
param.CompanyId = int(userReq.CompanyId)
param.ExecutorId = int(userReq.UserId)
data, err := srv.EditEvaluationSuper(param)
c.Response(data, err)
}
... ...
... ... @@ -13,13 +13,15 @@ func init() {
web.NSCtrlPost("/executor/cycle/list", (*controllers.SummaryEvaluationController).GetExecutorCycleList),
web.NSCtrlPost("/target_user/cycle/list", (*controllers.SummaryEvaluationController).GetTargetUserCycleList),
web.NSCtrlPost("/cycle/menu", (*controllers.SummaryEvaluationController).GetMenu),
web.NSCtrlPost("/self", (*controllers.SummaryEvaluationController).GetEvaluationSelf),
web.NSCtrlPost("/self/edit", (*controllers.SummaryEvaluationController).EditEvaluationSelf),
web.NSCtrlPost("/evaluation-self", (*controllers.SummaryEvaluationController).GetEvaluationSelf),
web.NSCtrlPost("/evaluation-self/edit", (*controllers.SummaryEvaluationController).EditEvaluationSelf),
web.NSCtrlPost("/evaluation-360", (*controllers.SummaryEvaluationController).GetEvaluation360),
web.NSCtrlPost("/evaluation-360/edit", (*controllers.SummaryEvaluationController).EditEvaluation360),
web.NSCtrlPost("/evaluation-hr", (*controllers.SummaryEvaluationController).GetEvaluationHRBP),
web.NSCtrlPost("/evaluation-hr/edit", (*controllers.SummaryEvaluationController).EditEvaluationHRBP),
web.NSCtrlPost("/self/summary", (*controllers.SummaryEvaluationController).CountEvaluationSelfLevel),
web.NSCtrlPost("/evaluation-super", (*controllers.SummaryEvaluationController).GetEvaluationSuper),
web.NSCtrlPost("/evaluation-super/edit", (*controllers.SummaryEvaluationController).EditEvaluationSuper),
)
web.AddNamespace(summaryNS)
}
... ...